various modifications

cusax-fix
Yana Stamcheva 20 years ago
parent 51dd74637c
commit 8d138f1f6a

@ -1,66 +1,145 @@
/*
* 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;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JPanel;
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
/**
* @author Yana Stamcheva
*/
public class CallPanel extends JPanel implements ActionListener{
public class CallPanel extends JPanel{
private JComboBox phoneNumberCombo = new JComboBox ();
private Image callButtonPressedIcon = LookAndFeelConstants.CALL_PRESSED_BUTTON_BG;
private Image hangupButtonPressedIcon = LookAndFeelConstants.HANGUP_PRESSED_BUTTON_BG;
private Image callButtonBG = LookAndFeelConstants.CALL_BUTTON_BG;
private Image callButtonRolloverBG = LookAndFeelConstants.CALL_ROLLOVER_BUTTON_BG;
private Image hangupButtonBG = LookAndFeelConstants.HANGUP_BUTTON_BG;
private Image hangupButtonRolloverBG = LookAndFeelConstants.HANGUP_ROLLOVER_BUTTON_BG;
private JComboBox phoneNumberCombo = new JComboBox();
private JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 15, 5));
private SIPCommButton callButton;
private SIPCommButton hangupButton;
public CallPanel(){
private JPanel comboPanel = new JPanel (new BorderLayout());
private JPanel buttonsPanel = new JPanel (
new FlowLayout(FlowLayout.CENTER, 15, 0));
private SIPCommButton callButton = new SIPCommButton
(Constants.CALL_BUTTON_BG,
Constants.CALL_ROLLOVER_BUTTON_BG,
Constants.CALL_PRESSED_BUTTON_BG,
null);
private SIPCommButton hangupButton = new SIPCommButton
(Constants.HANGUP_BUTTON_BG,
Constants.HANGUP_ROLLOVER_BUTTON_BG,
Constants.HANGUP_PRESSED_BUTTON_BG,
null);
private SIPCommButton minimizeButton
= new SIPCommButton(Constants.CALL_PANEL_MINIMIZE_BUTTON,
Constants.CALL_PANEL_MINIMIZE_ROLLOVER_BUTTON);
private SIPCommButton restoreButton
= new SIPCommButton(Constants.CALL_PANEL_RESTORE_BUTTON,
Constants.CALL_PANEL_RESTORE_ROLLOVER_BUTTON);
private JPanel minimizeButtonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
private MainFrame parentWindow;
public CallPanel(MainFrame parentWindow) {
super(new BorderLayout());
/*
callButton = new SIPCommButton(callButtonBG,
callButtonRolloverBG,
callButtonIcon);
hangupButton = new SIPCommButton(hangupButtonBG,
hangupButtonRolloverBG,
hangupButtonIcon);
*/
callButton = new SIPCommButton(callButtonBG,
callButtonRolloverBG,
callButtonPressedIcon,
null);
this.parentWindow = parentWindow;
hangupButton = new SIPCommButton(hangupButtonBG,
hangupButtonRolloverBG,
hangupButtonPressedIcon,
null);
this.buttonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
this.comboPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 5));
this.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
this.init();
}
private void init() {
this.phoneNumberCombo.setEditable(true);
this.add(phoneNumberCombo, BorderLayout.NORTH);
this.comboPanel.add(phoneNumberCombo, BorderLayout.CENTER);
this.add(comboPanel, BorderLayout.NORTH);
this.callButton.setName("call");
this.hangupButton.setName("hangup");
this.minimizeButton.setName("minimize");
this.restoreButton.setName("restore");
this.callButton.addActionListener(this);
this.hangupButton.addActionListener(this);
this.minimizeButton.addActionListener(this);
this.restoreButton.addActionListener(this);
this.buttonsPanel.add(callButton);
this.buttonsPanel.add(hangupButton);
this.add(buttonsPanel, BorderLayout.CENTER);
this.minimizeButtonPanel.add(minimizeButton);
this.add(minimizeButtonPanel,BorderLayout.SOUTH);
}
public JComboBox getPhoneNumberCombo() {
return phoneNumberCombo;
}
public void actionPerformed(ActionEvent e) {
JButton button = (JButton) e.getSource();
String buttonName = button.getName();
if (buttonName.equalsIgnoreCase("call")){
CallReceivePanel cr = new CallReceivePanel(this.parentWindow);
cr.setVisible(true);
}
else if (buttonName.equalsIgnoreCase("hangup")){
}
else if (buttonName.equalsIgnoreCase("minimize")){
this.remove(comboPanel);
this.remove(buttonsPanel);
this.minimizeButtonPanel.removeAll();
this.minimizeButtonPanel.add(restoreButton);
this.parentWindow.validate();
}
else if (buttonName.equalsIgnoreCase("restore")){
this.add(comboPanel, BorderLayout.NORTH);
this.add(buttonsPanel, BorderLayout.CENTER);
this.minimizeButtonPanel.removeAll();
this.minimizeButtonPanel.add(minimizeButton);
this.parentWindow.validate();
}
}
}

@ -0,0 +1,93 @@
package net.java.sip.communicator.impl.gui.main;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Image;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
public class CallReceivePanel extends JDialog{
private Image callButtonPressedIcon = Constants.CALL_PRESSED_BUTTON_BG;
private Image hangupButtonPressedIcon = Constants.HANGUP_PRESSED_BUTTON_BG;
private Image callButtonBG = Constants.CALL_BUTTON_BG;
private Image callButtonRolloverBG = Constants.CALL_ROLLOVER_BUTTON_BG;
private Image hangupButtonBG = Constants.HANGUP_BUTTON_BG;
private Image hangupButtonRolloverBG = Constants.HANGUP_ROLLOVER_BUTTON_BG;
private JLabel personPhoto = new JLabel(new ImageIcon (Constants.DEFAULT_USER_PHOTO));
private JLabel personName = new JLabel ("John Smith");
private JLabel birthDate = new JLabel ("11/11/1900");
private JLabel emptyLabel = new JLabel (" ");
private JLabel personInfo = new JLabel ("additional info");
private SIPCommButton callButton;
private SIPCommButton hangupButton;
private JPanel userInfoPanel = new JPanel();
private JPanel buttonsPanel = new JPanel(
new FlowLayout(FlowLayout.CENTER, 15, 5));
public CallReceivePanel (MainFrame parent){
super(parent);
this.setSize(300, 200);
this.getContentPane().setLayout(new BorderLayout());
callButton = new SIPCommButton(callButtonBG, callButtonRolloverBG,
callButtonPressedIcon, null);
hangupButton = new SIPCommButton(hangupButtonBG,
hangupButtonRolloverBG, hangupButtonPressedIcon, null);
this.init();
}
public void init () {
this.personName.setFont(new Font("Sans Serif", Font.BOLD, 12));
//this.buttonsPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.GRAY));
this.buttonsPanel.add(callButton);
this.buttonsPanel.add(hangupButton);
this.userInfoPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 0));
this.userInfoPanel.setLayout(new BoxLayout(userInfoPanel, BoxLayout.Y_AXIS));
this.userInfoPanel.add(personName);
this.userInfoPanel.add(birthDate);
this.userInfoPanel.add(emptyLabel);
this.userInfoPanel.add(personInfo);
this.getContentPane().add(personPhoto, BorderLayout.WEST);
this.getContentPane().add(userInfoPanel, BorderLayout.CENTER);
this.getContentPane().add(buttonsPanel, BorderLayout.SOUTH);
}
}

@ -3,11 +3,14 @@
import java.io.File;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.plaf.metal.MetalTheme;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
import com.l2fprod.gui.plaf.skin.Skin;
import com.l2fprod.gui.plaf.skin.SkinLookAndFeel;
@ -27,22 +30,30 @@ public static void main(String[] args){
if (args.length > 0) {
String themepack = args[0];
if (themepack.endsWith(".xml")) {
SkinLookAndFeel.setSkin(
SkinLookAndFeel.loadThemePackDefinition(new File(args[0]).toURL()));
UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
} else if (themepack.startsWith("class:")) {
String classname = themepack.substring("class:".length());
SkinLookAndFeel.setSkin((Skin)Class.forName(classname).newInstance());
UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
} else if (themepack.startsWith("theme:")) {
String classname = themepack.substring("theme:".length());
MetalTheme theme = (MetalTheme)Class.forName(classname).newInstance();
MetalLookAndFeel metal = new MetalLookAndFeel();
MetalLookAndFeel.setCurrentTheme(theme);
UIManager.setLookAndFeel(metal);
} else {
SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePack(args[0]));
UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
}
}
//the default theme is set if no theme is specified
@ -76,9 +87,13 @@ public static void main(String[] args){
ContactItem citem2 = new ContactItem("Traiancho");
ContactItem citem3 = new ContactItem("Glupancho");
citem1.setUserIcon(new ImageIcon(LookAndFeelConstants.USER_ONLINE_ICON));
citem2.setUserIcon(new ImageIcon(LookAndFeelConstants.USER_ONLINE_ICON));
citem3.setUserIcon(new ImageIcon(LookAndFeelConstants.USER_ONLINE_ICON));
citem1.setUserIcon(new ImageIcon(Constants.USER_ONLINE_ICON));
citem2.setUserIcon(new ImageIcon(Constants.USER_ONLINE_ICON));
citem3.setUserIcon(new ImageIcon(Constants.USER_ONLINE_ICON));
citem1.setPhoto(Constants.DEFAULT_CHAT_USER_PHOTO);
citem2.setPhoto(Constants.DEFAULT_CHAT_USER_PHOTO);
citem3.setPhoto(Constants.DEFAULT_CHAT_USER_PHOTO);
clist.addContact(citem1);
clist.addContact(citem2);
@ -86,19 +101,17 @@ public static void main(String[] args){
User user = new User();
user.setName("Yana");
user.setProtocols(new String[]{"SIP", "ICQ", "MSN"});
//////////////////////////////////////////////////////////////////////
MainFrame mainFrame = new MainFrame(clist, user);
mainFrame.setTitle("SipCommunicator");
mainFrame.setIconImage(LookAndFeelConstants.SIP_LOGO);
//In order to have the same icon when using option panes
JOptionPane.getRootFrame().setIconImage(LookAndFeelConstants.SIP_LOGO);
JOptionPane.getRootFrame().setIconImage(Constants.SIP_LOGO);
mainFrame.pack();
mainFrame.setVisible(true);

@ -1,7 +1,10 @@
package net.java.sip.communicator.impl.gui.main;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.InputEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -9,6 +12,10 @@
import javax.swing.JPanel;
import javax.swing.JScrollPane;
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;
/**
* @author Yana Stamcheva
*
@ -17,10 +24,19 @@
public class ContactListPanel extends JScrollPane{
private ContactList clist;
private JPanel mainPanel = new JPanel();
private JPanel contactsPanel = new JPanel();
public ContactListPanel(ContactList clist){
private MainFrame parent;
public ContactListPanel(MainFrame parent, ContactList clist){
this.mainPanel.setBackground(Color.WHITE);
this.mainPanel.setOpaque(true);
this.parent = parent;
this.mainPanel.setLayout(new BorderLayout());
this.contactsPanel.setLayout(new BoxLayout(this.contactsPanel, BoxLayout.Y_AXIS));
@ -34,7 +50,7 @@ private void init(){
for (int i = 0; i < this.clist.getAllContacts().size(); i ++){
ContactPanel cpanel = new ContactPanel((ContactItem)this.clist.getAllContacts().get(i));
cpanel.setPreferredSize(new Dimension(LookAndFeelConstants.CONTACTPANEL_WIDTH, LookAndFeelConstants.CONTACTPANEL_HEIGHT));
cpanel.setPreferredSize(new Dimension(Constants.CONTACTPANEL_WIDTH, Constants.CONTACTPANEL_HEIGHT));
cpanel.addMouseListener(new MouseAdapter(){
public void mouseEntered(MouseEvent e){
@ -52,10 +68,36 @@ public void mouseExited(MouseEvent e){
}
public void mouseClicked(MouseEvent e){
ContactPanel cpanel = (ContactPanel)e.getSource();
cpanel.setSelected(true);
refreshContactsStatus(cpanel);
if((e.getModifiers() & InputEvent.BUTTON1_MASK)
== InputEvent.BUTTON1_MASK){
MessageWindow msgWindow = new MessageWindow(parent);
msgWindow.addContactToChat(cpanel.getContactItem());
msgWindow.setVisible(true);
msgWindow.getWriteMessagePanel().getEditorPane().requestFocus();
msgWindow.enableKeyboardSending();
}
else if((e.getModifiers() & InputEvent.BUTTON3_MASK)
== InputEvent.BUTTON3_MASK){
ContactRightButtonMenu popupMenu
= new ContactRightButtonMenu(parent, cpanel.getContactItem());
popupMenu.setInvoker(cpanel);
popupMenu.setLocation(popupMenu.calculatePopupLocation());
popupMenu.setVisible(true);
}
}
});
@ -76,5 +118,7 @@ public void refreshContactsStatus(ContactPanel cpanelSelected){
}
}
}
}

@ -1,6 +1,7 @@
package net.java.sip.communicator.impl.gui.main;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
@ -11,6 +12,9 @@
import javax.swing.JLabel;
import javax.swing.JPanel;
import net.java.sip.communicator.impl.gui.main.utils.AntialiasingManager;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
/**
* @author Yana Stamcheva
*
@ -24,13 +28,17 @@ public class ContactPanel extends JPanel {
private boolean isMouseOver = false;
private boolean isSelected = false;
private JLabel nicknameLabel = new JLabel();
private JLabel nicknameLabel = new JLabel();
public ContactPanel(ContactItem contactItem){
super(new BorderLayout());
this.contactItem = contactItem;
this.setBackground(Color.WHITE);
this.setOpaque(true);
this.init();
}
@ -58,56 +66,56 @@ public void paintComponent(Graphics g){
if(this.isSelected()){
GradientPaint p = new GradientPaint(this.getWidth()/2,
0,
LookAndFeelConstants.CONTACTPANEL_SELECTED_START_COLOR,
Constants.CONTACTPANEL_SELECTED_START_COLOR,
this.getWidth()/2,
LookAndFeelConstants.CONTACTPANEL_SELECTED_GRADIENT_SIZE,
LookAndFeelConstants.CONTACTPANEL_SELECTED_END_COLOR);
Constants.CONTACTPANEL_SELECTED_GRADIENT_SIZE,
Constants.CONTACTPANEL_SELECTED_END_COLOR);
GradientPaint p1 = new GradientPaint( this.getWidth()/2,
this.getHeight() - LookAndFeelConstants.CONTACTPANEL_SELECTED_GRADIENT_SIZE,
LookAndFeelConstants.CONTACTPANEL_SELECTED_END_COLOR,
this.getHeight() - Constants.CONTACTPANEL_SELECTED_GRADIENT_SIZE,
Constants.CONTACTPANEL_SELECTED_END_COLOR,
this.getWidth()/2,
this.getHeight(),
LookAndFeelConstants.CONTACTPANEL_SELECTED_START_COLOR);
Constants.CONTACTPANEL_SELECTED_START_COLOR);
g2.setPaint(p);
g2.fillRect(0, 0, this.getWidth(), LookAndFeelConstants.CONTACTPANEL_SELECTED_GRADIENT_SIZE);
g2.fillRect(0, 0, this.getWidth(), Constants.CONTACTPANEL_SELECTED_GRADIENT_SIZE);
g2.setColor(LookAndFeelConstants.CONTACTPANEL_SELECTED_END_COLOR);
g2.setColor(Constants.CONTACTPANEL_SELECTED_END_COLOR);
g2.fillRect(0,
LookAndFeelConstants.CONTACTPANEL_SELECTED_GRADIENT_SIZE,
Constants.CONTACTPANEL_SELECTED_GRADIENT_SIZE,
this.getWidth(),
this.getHeight() - LookAndFeelConstants.CONTACTPANEL_SELECTED_GRADIENT_SIZE);
this.getHeight() - Constants.CONTACTPANEL_SELECTED_GRADIENT_SIZE);
g2.setPaint(p1);
g2.fillRect(0, this.getHeight() - LookAndFeelConstants.CONTACTPANEL_SELECTED_GRADIENT_SIZE, this.getWidth(), this.getHeight() - 1);
g2.fillRect(0, this.getHeight() - Constants.CONTACTPANEL_SELECTED_GRADIENT_SIZE, this.getWidth(), this.getHeight() - 1);
}
else if(this.isMouseOver()){
GradientPaint p = new GradientPaint(this.getWidth()/2,
0,
LookAndFeelConstants.CONTACTPANEL_MOVER_START_COLOR,
Constants.CONTACTPANEL_MOVER_START_COLOR,
this.getWidth()/2,
LookAndFeelConstants.CONTACTPANEL_GRADIENT_SIZE,
LookAndFeelConstants.CONTACTPANEL_MOVER_END_COLOR);
Constants.CONTACTPANEL_GRADIENT_SIZE,
Constants.CONTACTPANEL_MOVER_END_COLOR);
GradientPaint p1 = new GradientPaint( this.getWidth()/2,
this.getHeight() - LookAndFeelConstants.CONTACTPANEL_GRADIENT_SIZE,
LookAndFeelConstants.CONTACTPANEL_MOVER_END_COLOR,
this.getHeight() - Constants.CONTACTPANEL_GRADIENT_SIZE,
Constants.CONTACTPANEL_MOVER_END_COLOR,
this.getWidth()/2,
this.getHeight(),
LookAndFeelConstants.CONTACTPANEL_MOVER_START_COLOR);
Constants.CONTACTPANEL_MOVER_START_COLOR);
g2.setPaint(p);
g2.fillRect(0, 0, this.getWidth(), LookAndFeelConstants.CONTACTPANEL_GRADIENT_SIZE);
g2.fillRect(0, 0, this.getWidth(), Constants.CONTACTPANEL_GRADIENT_SIZE);
g2.setColor(LookAndFeelConstants.CONTACTPANEL_MOVER_END_COLOR);
g2.setColor(Constants.CONTACTPANEL_MOVER_END_COLOR);
g2.fillRect(0,
LookAndFeelConstants.CONTACTPANEL_GRADIENT_SIZE,
Constants.CONTACTPANEL_GRADIENT_SIZE,
this.getWidth(),
this.getHeight() - LookAndFeelConstants.CONTACTPANEL_GRADIENT_SIZE);
this.getHeight() - Constants.CONTACTPANEL_GRADIENT_SIZE);
g2.setPaint(p1);
g2.fillRect(0, this.getHeight() - LookAndFeelConstants.CONTACTPANEL_GRADIENT_SIZE - 1, this.getWidth(), this.getHeight() - 1);
g2.fillRect(0, this.getHeight() - Constants.CONTACTPANEL_GRADIENT_SIZE - 1, this.getWidth(), this.getHeight() - 1);
}
}
@ -134,4 +142,16 @@ public void setSelected(boolean isSelected) {
this.repaint();
}
}
public void paint(Graphics g){
AntialiasingManager.activateAntialiasing(g);
super.paint(g);
}
public ContactItem getContactItem() {
return contactItem;
}
}

@ -0,0 +1,190 @@
package net.java.sip.communicator.impl.gui.main;
import java.awt.Component;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import net.java.sip.communicator.impl.gui.main.customcontrols.AntialiasedMenu;
import net.java.sip.communicator.impl.gui.main.customcontrols.AntialiasedMenuItem;
import net.java.sip.communicator.impl.gui.main.customcontrols.MessageDialog;
import net.java.sip.communicator.impl.gui.main.history.HistoryWindow;
import net.java.sip.communicator.impl.gui.main.i18n.Messages;
import net.java.sip.communicator.impl.gui.main.message.MessageWindow;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
public class ContactRightButtonMenu extends JPopupMenu implements
ActionListener {
private AntialiasedMenu moveToMenu = new AntialiasedMenu(
Messages.getString("moveToGroup"),
new ImageIcon(Constants.GROUPS_16x16_ICON));
private AntialiasedMenu addSubcontactMenu = new AntialiasedMenu(
Messages.getString("addSubcontact"),
new ImageIcon(Constants.ADD_CONTACT_16x16_ICON));
private AntialiasedMenuItem sendMessageItem = new AntialiasedMenuItem(
Messages.getString("sendMessage"),
new ImageIcon(Constants.SEND_MESSAGE_16x16_ICON));
private AntialiasedMenuItem sendFileItem = new AntialiasedMenuItem(
Messages.getString("sendFile"),
new ImageIcon(Constants.SEND_FILE_16x16_ICON));
private AntialiasedMenuItem removeContactItem = new AntialiasedMenuItem(
Messages.getString("removeContact"),
new ImageIcon(Constants.DELETE_16x16_ICON));
private AntialiasedMenuItem renameContactItem = new AntialiasedMenuItem(
Messages.getString("renameContact"),
new ImageIcon(Constants.RENAME_16x16_ICON));
private AntialiasedMenuItem userInfoItem = new AntialiasedMenuItem(
Messages.getString("userInfo"),
new ImageIcon(Constants.INFO_16x16_ICON));
private AntialiasedMenuItem viewHistoryItem = new AntialiasedMenuItem(
Messages.getString("viewHistory"),
new ImageIcon(Constants.HISTORY_16x16_ICON));
private ContactItem contactItem;
private MainFrame mainFrame;
public ContactRightButtonMenu(MainFrame mainFrame, ContactItem contactItem) {
super();
this.mainFrame = mainFrame;
this.contactItem = contactItem;
this.init();
}
private void init() {
// This feature is disabled until it's implemented
this.sendFileItem.setEnabled(false);
String[] userProtocols = mainFrame.getUser().getProtocols();
for (int i = 0; i < userProtocols.length; i++) {
AntialiasedMenuItem protocolMenuItem = new AntialiasedMenuItem(
userProtocols[i],
new ImageIcon(Constants.getProtocolIcon(userProtocols[i])));
this.addSubcontactMenu.add(protocolMenuItem);
}
this.add(sendMessageItem);
this.add(sendFileItem);
this.addSeparator();
this.add(moveToMenu);
this.addSeparator();
this.add(addSubcontactMenu);
this.addSeparator();
this.add(removeContactItem);
this.add(renameContactItem);
this.addSeparator();
this.add(viewHistoryItem);
this.add(userInfoItem);
this.sendMessageItem.setName("sendMessage");
this.sendFileItem.setName("sendFile");
this.moveToMenu.setName("moveToGroup");
this.addSubcontactMenu.setName("addSubcontact");
this.removeContactItem.setName("removeContact");
this.renameContactItem.setName("renameContact");
this.viewHistoryItem.setName("viewHistory");
this.userInfoItem.setName("userInfo");
this.sendMessageItem.addActionListener(this);
this.sendFileItem.addActionListener(this);
this.moveToMenu.addActionListener(this);
this.addSubcontactMenu.addActionListener(this);
this.removeContactItem.addActionListener(this);
this.renameContactItem.addActionListener(this);
this.viewHistoryItem.addActionListener(this);
this.userInfoItem.addActionListener(this);
}
public Point calculatePopupLocation() {
Component component = this.getInvoker();
Point point = new Point();
int x = component.getX();
int y = component.getY();
while (component.getParent() != null) {
component = component.getParent();
x += component.getX();
y += component.getY();
}
System.out.println(component.getHeight());
point.x = x;
point.y = y + this.getInvoker().getHeight();
return point;
}
public void actionPerformed(ActionEvent e) {
JMenuItem menuItem = (JMenuItem) e.getSource();
String itemName = menuItem.getName();
if (itemName.equalsIgnoreCase("sendMessage")) {
MessageWindow msgWindow = new MessageWindow(this.mainFrame);
msgWindow.addContactToChat(this.contactItem);
msgWindow.setVisible(true);
}
else if (itemName.equalsIgnoreCase("sendFile")) {
// disabled
}
else if (itemName.equalsIgnoreCase("removeContact")) {
MessageDialog warning = new MessageDialog(this.mainFrame);
String message = "<HTML>Are you sure you want to remove <B>"
+ this.contactItem.getNickName()
+"</B><BR>from your contact list?</html>";
warning.setMessage(message);
warning.setVisible(true);
}
else if (itemName.equalsIgnoreCase("renameContact")) {
}
else if (itemName.equalsIgnoreCase("viewHistory")) {
HistoryWindow history = new HistoryWindow();
history.setContact(this.contactItem);
history.setVisible(true);
}
else if (itemName.equalsIgnoreCase("userInfo")) {
}
}
}

@ -4,11 +4,16 @@
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
/**
* @author Yana Stamcheva
@ -16,55 +21,57 @@
* The DialPanel contains the dial buttons.
*/
public class DialPanel extends JPanel {
public class DialPanel extends JPanel implements ActionListener {
private Font buttonTextFont = new Font("Verdana", Font.BOLD, 12);
private JComboBox phoneNumberCombo;
private SIPCommButton oneButton = new SIPCommButton
(LookAndFeelConstants.ONE_DIAL_BUTTON,
(Constants.ONE_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton twoButton = new SIPCommButton
(LookAndFeelConstants.TWO_DIAL_BUTTON,
(Constants.TWO_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton threeButton = new SIPCommButton
(LookAndFeelConstants.THREE_DIAL_BUTTON,
(Constants.THREE_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton fourButton = new SIPCommButton
(LookAndFeelConstants.FOUR_DIAL_BUTTON,
(Constants.FOUR_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton fiveButton = new SIPCommButton
(LookAndFeelConstants.FIVE_DIAL_BUTTON,
(Constants.FIVE_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton sixButton = new SIPCommButton
(LookAndFeelConstants.SIX_DIAL_BUTTON,
(Constants.SIX_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton sevenButton = new SIPCommButton
(LookAndFeelConstants.SEVEN_DIAL_BUTTON,
(Constants.SEVEN_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton eightButton = new SIPCommButton
(LookAndFeelConstants.EIGHT_DIAL_BUTTON,
(Constants.EIGHT_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton nineButton = new SIPCommButton
(LookAndFeelConstants.NINE_DIAL_BUTTON,
(Constants.NINE_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton starButton = new SIPCommButton
(LookAndFeelConstants.STAR_DIAL_BUTTON,
(Constants.STAR_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton zeroButton = new SIPCommButton
(LookAndFeelConstants.ZERO_DIAL_BUTTON,
(Constants.ZERO_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton diezButton = new SIPCommButton
(LookAndFeelConstants.DIEZ_DIAL_BUTTON,
(Constants.DIEZ_DIAL_BUTTON,
SIPCommButton.LEFT_ICON_LAYOUT);
private JPanel dialPadPanel = new JPanel(new GridLayout(4, 3, 5, 5));
@ -72,11 +79,39 @@ public class DialPanel extends JPanel {
public DialPanel(){
super(new FlowLayout(FlowLayout.CENTER));
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
this.init();
}
public void init(){
oneButton.setName("one");
twoButton.setName("two");
threeButton.setName("three");
fourButton.setName("four");
fiveButton.setName("five");
sixButton.setName("six");
sevenButton.setName("seven");
eightButton.setName("eight");
nineButton.setName("nine");
zeroButton.setName("zero");
diezButton.setName("diez");
starButton.setName("star");
oneButton.addActionListener(this);
twoButton.addActionListener(this);
threeButton.addActionListener(this);
fourButton.addActionListener(this);
fiveButton.addActionListener(this);
sixButton.addActionListener(this);
sevenButton.addActionListener(this);
eightButton.addActionListener(this);
nineButton.addActionListener(this);
zeroButton.addActionListener(this);
diezButton.addActionListener(this);
starButton.addActionListener(this);
oneButton.setFont(this.buttonTextFont);
twoButton.setFont(this.buttonTextFont);
threeButton.setFont(this.buttonTextFont);
@ -105,4 +140,50 @@ public void init(){
this.add(dialPadPanel, BorderLayout.CENTER);
}
public void actionPerformed(ActionEvent e) {
JButton button = (JButton)e.getSource();
String buttonName = button.getName();
String phoneNumber = "";
if (this.phoneNumberCombo.getEditor().getItem() != null)
phoneNumber = (String)this.phoneNumberCombo.getEditor().getItem();
if(buttonName.equals("one"))
this.phoneNumberCombo.getEditor().setItem(phoneNumber + "1");
else if (buttonName.equals("two"))
this.phoneNumberCombo.getEditor().setItem(phoneNumber + "2");
else if (buttonName.equals("three"))
this.phoneNumberCombo.getEditor().setItem(phoneNumber + "3");
else if (buttonName.equals("four"))
this.phoneNumberCombo.getEditor().setItem(phoneNumber + "4");
else if (buttonName.equals("five"))
this.phoneNumberCombo.getEditor().setItem(phoneNumber + "5");
else if (buttonName.equals("six"))
this.phoneNumberCombo.getEditor().setItem(phoneNumber + "6");
else if (buttonName.equals("seven"))
this.phoneNumberCombo.getEditor().setItem(phoneNumber + "7");
else if (buttonName.equals("eight"))
this.phoneNumberCombo.getEditor().setItem(phoneNumber + "8");
else if (buttonName.equals("nine"))
this.phoneNumberCombo.getEditor().setItem(phoneNumber + "9");
else if (buttonName.equals("zero"))
this.phoneNumberCombo.getEditor().setItem(phoneNumber + "0");
this.phoneNumberCombo.requestFocus();
}
public void setPhoneNumberCombo(JComboBox combo){
this.phoneNumberCombo = combo;
}
}

@ -7,6 +7,9 @@
import javax.swing.JFrame;
import javax.swing.JPanel;
import net.java.sip.communicator.impl.gui.main.i18n.Messages;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
/**
* @author Yana Stamcheva
*
@ -18,19 +21,28 @@ public class MainFrame extends JFrame{
private JPanel menusPanel = new JPanel(new BorderLayout());
private Menu menu = new Menu();
private QuickMenu quickMenu = new QuickMenu();
private CallPanel callPanel = new CallPanel();
private CallPanel callPanel;
private StatusPanel statusPanel;
private MainTabbedPane tabbedPane;
private ContactList clist;
private User user;
public MainFrame(ContactList clist, User user){
tabbedPane = new MainTabbedPane(clist);
statusPanel = new StatusPanel(user.getProtocols());
this.clist = clist;
this.user = user;
callPanel = new CallPanel(this);
tabbedPane = new MainTabbedPane(this);
statusPanel = new StatusPanel(user.getProtocols());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setInitialBounds();
this.setTitle(Messages.getString("sipCommunicator"));
this.setIconImage(Constants.SIP_LOGO);
this.init();
}
@ -49,10 +61,31 @@ private void init(){
private void setInitialBounds(){
this.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width - MainFrame.WIDTH, 50);
this.getContentPane().setSize( LookAndFeelConstants.MAINFRAME_WIDTH,
LookAndFeelConstants.MAINFRAME_HEIGHT);
this.getContentPane().setSize( Constants.MAINFRAME_WIDTH,
Constants.MAINFRAME_HEIGHT);
this.tabbedPane.setPreferredSize(new Dimension(LookAndFeelConstants.MAINFRAME_WIDTH,
LookAndFeelConstants.MAINFRAME_HEIGHT));
this.tabbedPane.setPreferredSize(new Dimension(Constants.MAINFRAME_WIDTH,
Constants.MAINFRAME_HEIGHT));
}
public CallPanel getCallPanel() {
return callPanel;
}
public ContactList getContactList() {
return clist;
}
public void setContactList(ContactList clist) {
this.clist = clist;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}

@ -1,5 +1,7 @@
package net.java.sip.communicator.impl.gui.main;
import java.awt.Color;
import java.awt.Graphics;
import java.util.Vector;
import javax.swing.JButton;
@ -9,6 +11,9 @@
import javax.swing.ListModel;
import javax.swing.event.ListDataListener;
import net.java.sip.communicator.impl.gui.main.i18n.Messages;
import net.java.sip.communicator.impl.gui.main.utils.AntialiasingManager;
/**
* @author Yana Stamcheva
*
@ -19,13 +24,24 @@ public class MainTabbedPane extends JTabbedPane {
private DialPanel dialPanel = new DialPanel();
public MainTabbedPane(ContactList clist){
private ContactListPanel contactList;
public MainTabbedPane(MainFrame parent){
ContactListPanel contactList = new ContactListPanel(clist);
contactList = new ContactListPanel(parent, parent.getContactList());
dialPanel.setPhoneNumberCombo(parent.getCallPanel().getPhoneNumberCombo());
//this.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
this.addTab("Contacts", contactList);
this.addTab("Call list", new JPanel());
this.addTab("Dial", dialPanel);
this.addTab(Messages.getString("contacts"), contactList);
this.addTab(Messages.getString("callList"), new JPanel());
this.addTab(Messages.getString("dial"), dialPanel);
}
public void paint(Graphics g){
AntialiasingManager.activateAntialiasing(g);
super.paint(g);
}
}

@ -1,9 +1,14 @@
package net.java.sip.communicator.impl.gui.main;
import java.awt.Graphics;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import net.java.sip.communicator.impl.gui.main.i18n.Messages;
import net.java.sip.communicator.impl.gui.main.utils.AntialiasingManager;
/**
* @author Yana Stamcheva
*
@ -20,25 +25,32 @@ public Menu(){
}
private void init(){
userMenu.setText("User");
userMenu.setMnemonic('U');
userMenu.setToolTipText("User");
userMenu.setText(Messages.getString("file"));
userMenu.setMnemonic(Messages.getString("mnemonic.file").charAt(0));
userMenu.setToolTipText(Messages.getString("file"));
toolsMenu.setText("Tools");
toolsMenu.setMnemonic('T');
toolsMenu.setToolTipText("Tools");
toolsMenu.setText(Messages.getString("tools"));
toolsMenu.setMnemonic(Messages.getString("mnemonic.tools").charAt(0));
toolsMenu.setToolTipText(Messages.getString("tools"));
viewMenu.setText("View");
viewMenu.setMnemonic('V');
viewMenu.setToolTipText("View");
viewMenu.setText(Messages.getString("view"));
viewMenu.setMnemonic(Messages.getString("mnemonic.view").charAt(0));
viewMenu.setToolTipText(Messages.getString("view"));
helpMenu.setText("Help");
helpMenu.setMnemonic('H');
helpMenu.setToolTipText("Help");
helpMenu.setText(Messages.getString("help"));
helpMenu.setMnemonic(Messages.getString("mnemonic.help").charAt(0));
helpMenu.setToolTipText(Messages.getString("help"));
this.add(userMenu);
this.add(toolsMenu);
this.add(viewMenu);
this.add(helpMenu);
}
public void paint(Graphics g){
AntialiasingManager.activateAntialiasing(g);
super.paint(g);
}
}

@ -14,6 +14,7 @@
import javax.swing.JToolBar;
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
/**
* @author Yana Stamcheva
*
@ -33,24 +34,24 @@ public QuickMenu(){
this.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
infoButton = new SIPCommButton
(LookAndFeelConstants.QUICK_MENU_BUTTON_BG,
LookAndFeelConstants.QUICK_MENU_BUTTON_ROLLOVER_BG,
LookAndFeelConstants.QUICK_MENU_INFO_ICON);
(Constants.QUICK_MENU_BUTTON_BG,
Constants.QUICK_MENU_BUTTON_ROLLOVER_BG,
Constants.QUICK_MENU_INFO_ICON);
toolsButton = new SIPCommButton
(LookAndFeelConstants.QUICK_MENU_BUTTON_BG,
LookAndFeelConstants.QUICK_MENU_BUTTON_ROLLOVER_BG,
LookAndFeelConstants.QUICK_MENU_CONFIGURE_ICON);
(Constants.QUICK_MENU_BUTTON_BG,
Constants.QUICK_MENU_BUTTON_ROLLOVER_BG,
Constants.QUICK_MENU_CONFIGURE_ICON);
searchButton = new SIPCommButton
(LookAndFeelConstants.QUICK_MENU_BUTTON_BG,
LookAndFeelConstants.QUICK_MENU_BUTTON_ROLLOVER_BG,
LookAndFeelConstants.QUICK_MENU_SEARCH_ICON);
(Constants.QUICK_MENU_BUTTON_BG,
Constants.QUICK_MENU_BUTTON_ROLLOVER_BG,
Constants.QUICK_MENU_SEARCH_ICON);
addButton = new SIPCommButton
(LookAndFeelConstants.QUICK_MENU_BUTTON_BG,
LookAndFeelConstants.QUICK_MENU_BUTTON_ROLLOVER_BG,
LookAndFeelConstants.QUICK_MENU_ADD_ICON);
(Constants.QUICK_MENU_BUTTON_BG,
Constants.QUICK_MENU_BUTTON_ROLLOVER_BG,
Constants.QUICK_MENU_ADD_ICON);
this.init();
}
@ -62,6 +63,7 @@ private void init() {
this.add(infoButton);
}
/*
public void paint(Graphics g){
super.paint(g);
@ -69,10 +71,10 @@ public void paint(Graphics g){
GradientPaint p = new GradientPaint(this.getWidth()/2,
0,
LookAndFeelConstants.CONTACTPANEL_SELECTED_START_COLOR,
Constants.CONTACTPANEL_SELECTED_START_COLOR,
this.getWidth()/2,
LookAndFeelConstants.CONTACTPANEL_SELECTED_GRADIENT_SIZE,
LookAndFeelConstants.CONTACTPANEL_SELECTED_END_COLOR);
Constants.CONTACTPANEL_SELECTED_GRADIENT_SIZE,
Constants.CONTACTPANEL_SELECTED_END_COLOR);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
@ -80,4 +82,5 @@ public void paint(Graphics g){
//g2.dra
}
*/
}

@ -7,6 +7,7 @@
import javax.swing.JPanel;
import net.java.sip.communicator.impl.gui.main.customcontrols.StatusSelectorBox;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
public class StatusPanel extends JPanel {
@ -17,7 +18,7 @@ public StatusPanel(String[] userProtocols) {
this.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
this.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0,
LookAndFeelConstants.CONTACTPANEL_MOVER_START_COLOR));
Constants.CONTACTPANEL_MOVER_START_COLOR));
this.userProtocols = userProtocols;
@ -28,8 +29,8 @@ private void init() {
for (int i = 0; i < userProtocols.length; i++) {
ArrayList protocolStatusList = LookAndFeelConstants
.getProtocolIcons(userProtocols[i]);
ArrayList protocolStatusList = Constants
.getProtocolStatusIcons(userProtocols[i]);
StatusSelectorBox protocolStatusCombo = new StatusSelectorBox(
protocolStatusList.toArray(), (Status)protocolStatusList.get(0));

@ -1,7 +1,10 @@
package net.java.sip.communicator.impl.gui.main;
public class User {
private String[] userProtocols;
private String[] userProtocols;
private String name;
public void setProtocols(String[] userProtocols){
this.userProtocols = userProtocols;
@ -10,4 +13,14 @@ public void setProtocols(String[] userProtocols){
public String[] getProtocols(){
return this.userProtocols;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

Loading…
Cancel
Save