mirror of https://github.com/sipwise/jitsi.git
parent
ed2a57ae16
commit
507ef48311
@ -0,0 +1,61 @@
|
||||
package net.java.sip.communicator.impl.gui.main.history;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.customcontrols.AntialiasedMenuItem;
|
||||
import net.java.sip.communicator.impl.gui.main.i18n.Messages;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.AntialiasingManager;
|
||||
|
||||
public class HistoryMenu extends JMenu implements ActionListener {
|
||||
|
||||
private AntialiasedMenuItem emptyMenuItem
|
||||
= new AntialiasedMenuItem(Messages.getString("emptyHistory"));
|
||||
|
||||
private AntialiasedMenuItem closeMenuItem
|
||||
= new AntialiasedMenuItem(Messages.getString("close"));
|
||||
|
||||
private JFrame parentWindow;
|
||||
|
||||
public HistoryMenu(JFrame parentWindow){
|
||||
|
||||
super(Messages.getString("history"));
|
||||
|
||||
this.parentWindow = parentWindow;
|
||||
|
||||
this.emptyMenuItem.setName("empty");
|
||||
this.closeMenuItem.setName("close");
|
||||
|
||||
this.emptyMenuItem.addActionListener(this);
|
||||
this.closeMenuItem.addActionListener(this);
|
||||
|
||||
this.add(emptyMenuItem);
|
||||
this.add(closeMenuItem);
|
||||
}
|
||||
|
||||
public void paint(Graphics g){
|
||||
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
|
||||
super.paint(g);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JMenuItem menuItem = (JMenuItem)e.getSource();
|
||||
String menuName = menuItem.getName();
|
||||
|
||||
if(menuName.equalsIgnoreCase("empty")){
|
||||
|
||||
}
|
||||
else if(menuName.equalsIgnoreCase("close")){
|
||||
|
||||
this.parentWindow.setVisible(false);
|
||||
this.parentWindow.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,98 @@
|
||||
package net.java.sip.communicator.impl.gui.main.history;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuBar;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.ContactItem;
|
||||
import net.java.sip.communicator.impl.gui.main.i18n.Messages;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
||||
|
||||
public class HistoryWindow extends JFrame {
|
||||
|
||||
private JScrollPane historyPane = new JScrollPane();
|
||||
|
||||
private JPanel mainPanel = new JPanel(new BorderLayout());
|
||||
|
||||
private NavigationPanel navigationPanel = new NavigationPanel();
|
||||
|
||||
private SearchPanel searchPanel = new SearchPanel();
|
||||
|
||||
private JMenuBar historyMenuBar = new JMenuBar();
|
||||
|
||||
private HistoryMenu historyMenu;
|
||||
|
||||
private JMenu settingsMenu = new JMenu(Messages.getString("settings"));
|
||||
|
||||
private JPanel northPanel = new JPanel(new BorderLayout());
|
||||
|
||||
private Vector contacts;
|
||||
|
||||
private ContactItem contactItem;
|
||||
|
||||
String title = Messages.getString("history") + " - ";
|
||||
|
||||
public HistoryWindow(){
|
||||
|
||||
historyMenu = new HistoryMenu(this);
|
||||
|
||||
this.setSize(Constants.HISTORY_WINDOW_WIDTH,
|
||||
Constants.HISTORY_WINDOW_HEIGHT);
|
||||
|
||||
this.setIconImage(Constants.SIP_LOGO);
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
public void init(){
|
||||
|
||||
this.historyMenuBar.add(historyMenu);
|
||||
|
||||
this.historyMenuBar.add(settingsMenu);
|
||||
|
||||
this.northPanel.add(historyMenuBar, BorderLayout.NORTH);
|
||||
|
||||
this.northPanel.add(searchPanel, BorderLayout.CENTER);
|
||||
|
||||
this.mainPanel.add(northPanel, BorderLayout.NORTH);
|
||||
|
||||
this.mainPanel.add(historyPane, BorderLayout.CENTER);
|
||||
|
||||
this.mainPanel.add(navigationPanel, BorderLayout.SOUTH);
|
||||
|
||||
|
||||
this.getContentPane().add(mainPanel);
|
||||
}
|
||||
|
||||
public Vector getContacts() {
|
||||
return contacts;
|
||||
}
|
||||
|
||||
public void setContacts(Vector contacts) {
|
||||
|
||||
this.contacts = contacts;
|
||||
|
||||
for (int i = 0; i < contacts.size(); i ++){
|
||||
|
||||
ContactItem contact = (ContactItem)contacts.get(i);
|
||||
|
||||
this.title += " " + contact.getNickName();
|
||||
}
|
||||
|
||||
this.setTitle(title);
|
||||
}
|
||||
|
||||
public void setContact(ContactItem contact) {
|
||||
|
||||
this.contactItem = contact;
|
||||
|
||||
this.title += " " + contact.getNickName();
|
||||
|
||||
this.setTitle(title);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package net.java.sip.communicator.impl.gui.main.history;
|
||||
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Graphics;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.i18n.Messages;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.AntialiasingManager;
|
||||
|
||||
public class NavigationPanel extends JPanel {
|
||||
|
||||
private JButton nextPageButton = new JButton(Messages.getString("next"));
|
||||
|
||||
private JButton previousPageButton = new JButton(Messages.getString("previous"));
|
||||
|
||||
private JButton lastPageButton = new JButton(Messages.getString("last"));
|
||||
|
||||
private JButton firstPageButton = new JButton(Messages.getString("first"));
|
||||
|
||||
public NavigationPanel(){
|
||||
super (new FlowLayout(FlowLayout.CENTER));
|
||||
|
||||
this.add(firstPageButton);
|
||||
this.add(previousPageButton);
|
||||
this.add(nextPageButton);
|
||||
this.add(lastPageButton);
|
||||
}
|
||||
|
||||
public void paint(Graphics g){
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
|
||||
super.paint(g);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,183 @@
|
||||
package net.java.sip.communicator.impl.gui.main.history;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
|
||||
import net.java.sip.communicator.impl.gui.main.i18n.Messages;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.AntialiasingManager;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
||||
|
||||
public class SearchPanel extends JPanel implements ActionListener {
|
||||
|
||||
private JButton searchButton
|
||||
= new JButton(Messages.getString("search"),
|
||||
new ImageIcon(Constants.QUICK_MENU_SEARCH_ICON));
|
||||
|
||||
private JLabel searchLabel = new JLabel(Messages.getString("search") + ": ");
|
||||
|
||||
private JTextField searchTextField = new JTextField(20);
|
||||
|
||||
private JRadioButton todayMessagesRadio = new JRadioButton(Messages.getString("today"));
|
||||
|
||||
private JRadioButton yesterdayMessagesRadio = new JRadioButton(Messages.getString("yesterday")); //$NON-NLS-1$
|
||||
|
||||
private JRadioButton allMessagesRadio = new JRadioButton(Messages.getString("all")); //$NON-NLS-1$
|
||||
|
||||
private ButtonGroup radiosGroup = new ButtonGroup();
|
||||
|
||||
private JLabel dateLabel = new JLabel(Messages.getString("date") + ": "); //$NON-NLS-1$
|
||||
|
||||
private JTextField dateTextField = new JTextField(10);
|
||||
|
||||
private JLabel hourLabel = new JLabel(Messages.getString("hour") + ": "); //$NON-NLS-1$
|
||||
|
||||
private JTextField hourTextField = new JTextField(10);
|
||||
|
||||
private JLabel lastNMessagesLabel = new JLabel(Messages.getString("last") + ": "); //$NON-NLS-1$
|
||||
|
||||
private JTextField lastNMessagesTextField = new JTextField(10);
|
||||
|
||||
/*
|
||||
private SIPCommButton extendedSearchButton = new SIPCommButton
|
||||
(Messages.getString("extendedCriteria"), //$NON-NLS-1$
|
||||
Constants.RIGHT_ARROW_ICON,
|
||||
Constants.RIGHT_ARROW_ROLLOVER_ICON);
|
||||
|
||||
private SIPCommButton extendedSearchOpenedButton = new SIPCommButton
|
||||
(Messages.getString("extendedCriteria"), //$NON-NLS-1$
|
||||
Constants.BOTTOM_ARROW_ICON,
|
||||
Constants.BOTTOM_ARROW_ROLLOVER_ICON);
|
||||
*/
|
||||
|
||||
//////////////////////// Panels //////////////////////////////
|
||||
|
||||
private JPanel datePanel = new JPanel(new GridLayout(0, 2, 10, 0));
|
||||
|
||||
private JPanel dateCenteredPanel
|
||||
= new JPanel(new FlowLayout(FlowLayout.CENTER));
|
||||
|
||||
private JPanel searchPanel = new JPanel(new BorderLayout());
|
||||
|
||||
private JPanel detailsPanel = new JPanel(new BorderLayout());
|
||||
|
||||
private JPanel detailsLabelsPanel = new JPanel(new GridLayout(0, 1, 5, 5));
|
||||
|
||||
private JPanel detailsFieldsPanel = new JPanel(new GridLayout(0, 1, 5, 5));
|
||||
|
||||
private JPanel checksPanel = new JPanel(new GridLayout(0, 1));
|
||||
|
||||
private JPanel searchButtonPanel
|
||||
= new JPanel(new FlowLayout(FlowLayout.CENTER));
|
||||
|
||||
//private JPanel extendedSearchPanel = new JPanel(new BorderLayout());
|
||||
|
||||
|
||||
public SearchPanel(){
|
||||
super();
|
||||
|
||||
this.setBorder(BorderFactory.createTitledBorder(Messages.getString("search"))); //$NON-NLS-1$
|
||||
|
||||
this.init();
|
||||
}
|
||||
|
||||
public void init(){
|
||||
|
||||
this.searchPanel.add(searchLabel, BorderLayout.WEST);
|
||||
this.searchPanel.add(searchTextField, BorderLayout.CENTER);
|
||||
|
||||
this.detailsLabelsPanel.add(dateLabel);
|
||||
this.detailsLabelsPanel.add(hourLabel);
|
||||
this.detailsLabelsPanel.add(lastNMessagesLabel);
|
||||
|
||||
this.detailsFieldsPanel.add(dateTextField);
|
||||
this.detailsFieldsPanel.add(hourTextField);
|
||||
this.detailsFieldsPanel.add(lastNMessagesTextField);
|
||||
|
||||
this.detailsPanel.add(detailsLabelsPanel, BorderLayout.WEST);
|
||||
this.detailsPanel.add(detailsFieldsPanel, BorderLayout.CENTER);
|
||||
|
||||
this.radiosGroup.add(allMessagesRadio);
|
||||
this.radiosGroup.add(todayMessagesRadio);
|
||||
this.radiosGroup.add(yesterdayMessagesRadio);
|
||||
|
||||
this.checksPanel.add(allMessagesRadio);
|
||||
this.checksPanel.add(todayMessagesRadio);
|
||||
this.checksPanel.add(yesterdayMessagesRadio);
|
||||
|
||||
this.datePanel.add(checksPanel);
|
||||
this.datePanel.add(detailsPanel);
|
||||
|
||||
this.dateCenteredPanel.add(datePanel);
|
||||
|
||||
this.searchButton.setName("search");
|
||||
//this.extendedSearchButton.setName("extendedSearch");
|
||||
//this.extendedSearchOpenedButton.setName("extendedSearchOpened");
|
||||
|
||||
this.searchButtonPanel.add(searchButton);
|
||||
|
||||
//this.extendedSearchPanel.add(extendedSearchButton, BorderLayout.CENTER);
|
||||
|
||||
this.add(searchPanel, BorderLayout.CENTER);
|
||||
this.add(searchButtonPanel, BorderLayout.EAST);
|
||||
|
||||
//this.add(extendedSearchPanel, BorderLayout.SOUTH);
|
||||
|
||||
//this.extendedSearchButton.addActionListener(this);
|
||||
//this.extendedSearchOpenedButton.addActionListener(this);
|
||||
|
||||
this.enableDefaultSearchSettings();
|
||||
}
|
||||
|
||||
public void paint(Graphics g){
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
|
||||
super.paint(g);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
JButton button = (JButton) e.getSource();
|
||||
String buttonName = button.getName();
|
||||
|
||||
if(buttonName.equalsIgnoreCase("search")){
|
||||
|
||||
}
|
||||
/*else if(buttonName.equalsIgnoreCase("extendedSearch")){
|
||||
|
||||
this.extendedSearchPanel.removeAll();
|
||||
this.extendedSearchPanel.add(extendedSearchOpenedButton,
|
||||
BorderLayout.NORTH);
|
||||
this.extendedSearchPanel.add(dateCenteredPanel, BorderLayout.CENTER);
|
||||
|
||||
this.getParent().validate();
|
||||
}
|
||||
else if(buttonName.equalsIgnoreCase("extendedSearchOpened")){
|
||||
|
||||
this.extendedSearchPanel.removeAll();
|
||||
this.extendedSearchPanel.add(extendedSearchButton,
|
||||
BorderLayout.CENTER);
|
||||
|
||||
this.getParent().validate();
|
||||
}*/
|
||||
}
|
||||
|
||||
private void enableDefaultSearchSettings(){
|
||||
|
||||
this.allMessagesRadio.setSelected(true);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue