mirror of https://github.com/sipwise/jitsi.git
parent
75b4317884
commit
61fada7f4a
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
|
||||
package net.java.sip.communicator.impl.gui.main.configforms;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.i18n.Messages;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.ImageLoader;
|
||||
import net.java.sip.communicator.service.gui.ConfigurationForm;
|
||||
|
||||
public class AccountsConfigurationForm extends JPanel implements
|
||||
ConfigurationForm {
|
||||
|
||||
public AccountsConfigurationForm(){
|
||||
super(new BorderLayout());
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
|
||||
return Messages.getString("accounts");
|
||||
}
|
||||
|
||||
public Icon getIcon() {
|
||||
|
||||
return new ImageIcon(ImageLoader.getImage(ImageLoader.QUICK_MENU_ADD_ICON));
|
||||
}
|
||||
|
||||
public Component getForm() {
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
|
||||
package net.java.sip.communicator.impl.gui.main.configforms;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.GridLayout;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
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;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.ImageLoader;
|
||||
import net.java.sip.communicator.service.gui.ConfigurationForm;
|
||||
|
||||
public class AppearanceConfigurationForm extends JPanel implements
|
||||
ConfigurationForm {
|
||||
|
||||
private JCheckBox launchOnStartUpCheck = new JCheckBox(Messages
|
||||
.getString("launchOnStartUp"));
|
||||
|
||||
|
||||
private JPanel appliBehaviourPanel = new JPanel(new GridLayout(0, 1));
|
||||
|
||||
public AppearanceConfigurationForm(){
|
||||
super(new BorderLayout());
|
||||
|
||||
this.appliBehaviourPanel.setBorder(BorderFactory
|
||||
.createTitledBorder(Messages.getString("application")));
|
||||
|
||||
this.appliBehaviourPanel.add(launchOnStartUpCheck);
|
||||
|
||||
this.add(appliBehaviourPanel, BorderLayout.NORTH);
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
|
||||
return Messages.getString("appearance");
|
||||
}
|
||||
|
||||
public Icon getIcon() {
|
||||
|
||||
return new ImageIcon(ImageLoader.getImage(ImageLoader.QUICK_MENU_SEARCH_ICON));
|
||||
}
|
||||
|
||||
public Component getForm() {
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public void paint(Graphics g){
|
||||
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
|
||||
super.paint(g);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
|
||||
package net.java.sip.communicator.impl.gui.main.configforms;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.MouseListener;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.customcontrols.ListCellPanel;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
||||
|
||||
public class ConfigMenuItemPanel extends ListCellPanel
|
||||
implements MouseListener {
|
||||
|
||||
private JLabel textLabel;
|
||||
|
||||
private JLabel iconLabel;
|
||||
|
||||
public ConfigMenuItemPanel(String text, Icon icon){
|
||||
|
||||
this.setPreferredSize(new Dimension(80, 50));
|
||||
|
||||
this.setLayout(new GridLayout(0, 1));
|
||||
|
||||
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
|
||||
textLabel = new JLabel(text, JLabel.CENTER);
|
||||
|
||||
iconLabel = new JLabel(icon, JLabel.CENTER);
|
||||
|
||||
this.textLabel.setFont(this.getFont().deriveFont(Font.BOLD, 10));
|
||||
|
||||
this.add(iconLabel);
|
||||
|
||||
this.add(textLabel);
|
||||
}
|
||||
|
||||
|
||||
public String getText(){
|
||||
|
||||
return this.textLabel.getText();
|
||||
}
|
||||
|
||||
public void paintComponent(Graphics g){
|
||||
super.paintComponent(g);
|
||||
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
|
||||
if(this.isSelected()){
|
||||
|
||||
g2.setColor(Constants.CONTACTPANEL_BORDER_COLOR);
|
||||
g2.drawRoundRect(0, 0, this.getWidth() - 1, this.getHeight() -1, 5, 5);
|
||||
}
|
||||
else if (this.isMouseOver()){
|
||||
|
||||
g2.setColor(Constants.MSG_WINDOW_BORDER_COLOR);
|
||||
g2.drawRoundRect(0, 0, this.getWidth() - 1, this.getHeight() -1, 5, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,187 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
|
||||
package net.java.sip.communicator.impl.gui.main.configforms;
|
||||
|
||||
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 java.awt.event.InputEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.border.BevelBorder;
|
||||
|
||||
import net.java.sip.communicator.impl.gui.main.configforms.AppearanceConfigurationForm;
|
||||
import net.java.sip.communicator.impl.gui.main.configforms.GeneralConfigurationForm;
|
||||
import net.java.sip.communicator.impl.gui.main.customcontrols.ListCellPanel;
|
||||
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
|
||||
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommList;
|
||||
import net.java.sip.communicator.impl.gui.main.customcontrols.TitlePanel;
|
||||
import net.java.sip.communicator.impl.gui.main.message.MessageWindow;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.AntialiasingManager;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.Constants;
|
||||
import net.java.sip.communicator.service.gui.ConfigurationContainer;
|
||||
import net.java.sip.communicator.service.gui.ConfigurationForm;
|
||||
|
||||
/**
|
||||
* @author Yana Stamcheva
|
||||
*
|
||||
*/
|
||||
public class ConfigurationFrame extends JFrame implements
|
||||
ConfigurationContainer, MouseListener {
|
||||
|
||||
private Vector configContainer = new Vector();
|
||||
|
||||
private JScrollPane formScrollPane = new JScrollPane();
|
||||
|
||||
private SIPCommList configList = new SIPCommList();
|
||||
|
||||
private TitlePanel titlePanel = new TitlePanel();
|
||||
|
||||
private JPanel centerPanel = new JPanel(new BorderLayout());
|
||||
|
||||
public ConfigurationFrame() {
|
||||
|
||||
this.getContentPane().setLayout(new BorderLayout());
|
||||
|
||||
this.addDefaultForms();
|
||||
|
||||
this.centerPanel.add(formScrollPane, BorderLayout.CENTER);
|
||||
|
||||
this.getContentPane().add(centerPanel, BorderLayout.CENTER);
|
||||
|
||||
this.getContentPane().add(configList, BorderLayout.WEST);
|
||||
}
|
||||
|
||||
public void addDefaultForms() {
|
||||
|
||||
this.addConfigurationForm(new GeneralConfigurationForm());
|
||||
this.addConfigurationForm(new AppearanceConfigurationForm());
|
||||
this.addConfigurationForm(new AccountsConfigurationForm());
|
||||
}
|
||||
|
||||
public void addConfigurationForm(ConfigurationForm configForm) {
|
||||
|
||||
this.configContainer.add(configForm);
|
||||
|
||||
ConfigMenuItemPanel configItem = new ConfigMenuItemPanel(configForm
|
||||
.getTitle(), configForm.getIcon());
|
||||
|
||||
configItem.addMouseListener(this);
|
||||
|
||||
this.configList.addCell(configItem);
|
||||
}
|
||||
|
||||
public void removeConfigurationForm(ConfigurationForm configForm) {
|
||||
|
||||
this.configContainer.remove(configForm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the size of the frame depending on the size of the largest
|
||||
* contained form.
|
||||
*/
|
||||
public void setCalculatedSize() {
|
||||
|
||||
double width = 0;
|
||||
|
||||
double height = 0;
|
||||
|
||||
for (int i = 0; i < configContainer.size(); i++) {
|
||||
|
||||
ConfigurationForm configForm = (ConfigurationForm) configContainer
|
||||
.get(i);
|
||||
|
||||
if (width < configForm.getForm().getPreferredSize().getWidth())
|
||||
width = configForm.getForm().getPreferredSize().getWidth();
|
||||
|
||||
if (height < configForm.getForm().getPreferredSize().getHeight())
|
||||
height = configForm.getForm().getPreferredSize().getHeight();
|
||||
}
|
||||
|
||||
if (width > Constants.CONFIG_FRAME_MAX_WIDTH)
|
||||
width = Constants.CONFIG_FRAME_MAX_WIDTH;
|
||||
|
||||
if (height > Constants.CONFIG_FRAME_MAX_HEIGHT)
|
||||
height = Constants.CONFIG_FRAME_MAX_HEIGHT;
|
||||
|
||||
width = width + configList.getPreferredSize().getWidth();
|
||||
|
||||
height = height + titlePanel.getPreferredSize().getHeight();
|
||||
|
||||
this.setSize((int)width + 50, (int) height + 50);
|
||||
}
|
||||
|
||||
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
|
||||
ConfigMenuItemPanel configItemPanel = (ConfigMenuItemPanel) e
|
||||
.getSource();
|
||||
|
||||
this.configList.refreshCellStatus(configItemPanel);
|
||||
|
||||
if ((e.getModifiers() & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK) {
|
||||
|
||||
for (int i = 0; i < this.configContainer.size(); i++) {
|
||||
|
||||
ConfigurationForm configForm =
|
||||
(ConfigurationForm) this.configContainer.get(i);
|
||||
|
||||
if (configItemPanel.getText().equals(configForm.getTitle())) {
|
||||
|
||||
this.formScrollPane.getViewport().removeAll();
|
||||
|
||||
this.formScrollPane.getViewport().add(configForm.getForm());
|
||||
|
||||
this.titlePanel.removeAll();
|
||||
|
||||
this.titlePanel.setTitleText(configForm.getTitle());
|
||||
|
||||
this.centerPanel.remove(titlePanel);
|
||||
|
||||
this.centerPanel.add(titlePanel, BorderLayout.NORTH);
|
||||
|
||||
this.validate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void paint(Graphics g) {
|
||||
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
|
||||
super.paint(g);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
|
||||
package net.java.sip.communicator.impl.gui.main.configforms;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.GridLayout;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
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;
|
||||
import net.java.sip.communicator.impl.gui.main.utils.ImageLoader;
|
||||
import net.java.sip.communicator.service.gui.ConfigurationForm;
|
||||
import net.java.sip.communicator.service.gui.UIService;
|
||||
|
||||
/**
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class GeneralConfigurationForm extends JPanel implements
|
||||
ConfigurationForm {
|
||||
|
||||
private JCheckBox launchOnStartUpCheck = new JCheckBox(Messages
|
||||
.getString("launchOnStartUp"));
|
||||
|
||||
private JCheckBox alwaysOnTopCheck = new JCheckBox(Messages
|
||||
.getString("alwaysOnTop"));
|
||||
|
||||
private JCheckBox updateAutomaticallyCheck = new JCheckBox(Messages
|
||||
.getString("updateAutomatically"));
|
||||
|
||||
private JCheckBox enableNotificationsCheck = new JCheckBox(Messages
|
||||
.getString("enableNotifications"));
|
||||
|
||||
private JCheckBox activateWhenMinimizedCheck = new JCheckBox(Messages
|
||||
.getString("activateOnlyWhenMinimized"));
|
||||
|
||||
private JPanel appliBehaviourPanel = new JPanel(new GridLayout(0, 1));
|
||||
|
||||
private JPanel updatesPanel = new JPanel(new GridLayout(0, 1));
|
||||
|
||||
private JPanel notificationsPanel = new JPanel(new GridLayout(0, 1));
|
||||
|
||||
public GeneralConfigurationForm() {
|
||||
|
||||
super(new GridLayout(4, 1));
|
||||
|
||||
this.setPreferredSize(new Dimension(400, 300));
|
||||
|
||||
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
|
||||
this.appliBehaviourPanel.setBorder(BorderFactory
|
||||
.createTitledBorder(Messages.getString("application")));
|
||||
|
||||
this.updatesPanel.setBorder(BorderFactory
|
||||
.createTitledBorder(Messages.getString("updates")));
|
||||
|
||||
this.notificationsPanel.setBorder(BorderFactory
|
||||
.createTitledBorder(Messages.getString("notifications")));
|
||||
|
||||
this.appliBehaviourPanel.add(launchOnStartUpCheck);
|
||||
this.appliBehaviourPanel.add(alwaysOnTopCheck);
|
||||
|
||||
this.add(appliBehaviourPanel);
|
||||
|
||||
this.updatesPanel.add(updateAutomaticallyCheck);
|
||||
|
||||
this.add(updatesPanel);
|
||||
|
||||
this.notificationsPanel.add(enableNotificationsCheck);
|
||||
this.notificationsPanel.add(activateWhenMinimizedCheck);
|
||||
|
||||
this.add(notificationsPanel);
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
|
||||
return Messages.getString("general");
|
||||
}
|
||||
|
||||
public Icon getIcon() {
|
||||
|
||||
return new ImageIcon(ImageLoader.getImage(ImageLoader.QUICK_MENU_CONFIGURE_ICON));
|
||||
}
|
||||
|
||||
public Component getForm() {
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public void paint(Graphics g){
|
||||
|
||||
AntialiasingManager.activateAntialiasing(g);
|
||||
|
||||
super.paint(g);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue