ContactList related components modified.

cusax-fix
Yana Stamcheva 20 years ago
parent 3804c837e6
commit 75b4317884

@ -1,3 +1,11 @@
/*
* 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.util.Vector;

@ -25,6 +25,7 @@
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
import net.java.sip.communicator.impl.gui.main.utils.ImageLoader;
/**
* @author Yana Stamcheva
@ -37,28 +38,30 @@ public class CallPanel extends JPanel implements ActionListener{
private JPanel comboPanel = new JPanel (new BorderLayout());
private JPanel buttonsPanel = new JPanel (
new FlowLayout(FlowLayout.CENTER, 15, 0));
new FlowLayout(FlowLayout.CENTER, 10, 0));
private SIPCommButton callButton = new SIPCommButton
(Constants.CALL_BUTTON_BG,
Constants.CALL_ROLLOVER_BUTTON_BG,
Constants.CALL_PRESSED_BUTTON_BG,
(ImageLoader.getImage(ImageLoader.CALL_BUTTON_BG),
ImageLoader.getImage(ImageLoader.CALL_ROLLOVER_BUTTON_BG),
ImageLoader.getImage(ImageLoader.CALL_PRESSED_BUTTON_BG),
null);
private SIPCommButton hangupButton = new SIPCommButton
(Constants.HANGUP_BUTTON_BG,
Constants.HANGUP_ROLLOVER_BUTTON_BG,
Constants.HANGUP_PRESSED_BUTTON_BG,
(ImageLoader.getImage(ImageLoader.HANGUP_BUTTON_BG),
ImageLoader.getImage(ImageLoader.HANGUP_ROLLOVER_BUTTON_BG),
ImageLoader.getImage(ImageLoader.HANGUP_PRESSED_BUTTON_BG),
null);
private SIPCommButton minimizeButton
= new SIPCommButton(Constants.CALL_PANEL_MINIMIZE_BUTTON,
Constants.CALL_PANEL_MINIMIZE_ROLLOVER_BUTTON);
= new SIPCommButton(
ImageLoader.getImage(ImageLoader.CALL_PANEL_MINIMIZE_BUTTON),
ImageLoader.getImage(ImageLoader.CALL_PANEL_MINIMIZE_ROLLOVER_BUTTON));
private SIPCommButton restoreButton
= new SIPCommButton(Constants.CALL_PANEL_RESTORE_BUTTON,
Constants.CALL_PANEL_RESTORE_ROLLOVER_BUTTON);
= new SIPCommButton(
ImageLoader.getImage(ImageLoader.CALL_PANEL_RESTORE_BUTTON),
ImageLoader.getImage(ImageLoader.CALL_PANEL_RESTORE_ROLLOVER_BUTTON));
private JPanel minimizeButtonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
private MainFrame parentWindow;

@ -1,3 +1,10 @@
/*
* 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;
@ -15,22 +22,29 @@
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
import net.java.sip.communicator.impl.gui.main.utils.ImageLoader;
public class CallReceivePanel extends JDialog{
private Image callButtonPressedIcon = Constants.CALL_PRESSED_BUTTON_BG;
private Image callButtonPressedIcon
= ImageLoader.getImage(ImageLoader.CALL_PRESSED_BUTTON_BG);
private Image hangupButtonPressedIcon = Constants.HANGUP_PRESSED_BUTTON_BG;
private Image hangupButtonPressedIcon
= ImageLoader.getImage(ImageLoader.HANGUP_PRESSED_BUTTON_BG);
private Image callButtonBG = Constants.CALL_BUTTON_BG;
private Image callButtonBG = ImageLoader.getImage(ImageLoader.CALL_BUTTON_BG);
private Image callButtonRolloverBG = Constants.CALL_ROLLOVER_BUTTON_BG;
private Image callButtonRolloverBG
= ImageLoader.getImage(ImageLoader.CALL_ROLLOVER_BUTTON_BG);
private Image hangupButtonBG = Constants.HANGUP_BUTTON_BG;
private Image hangupButtonBG
= ImageLoader.getImage(ImageLoader.HANGUP_BUTTON_BG);
private Image hangupButtonRolloverBG = Constants.HANGUP_ROLLOVER_BUTTON_BG;
private Image hangupButtonRolloverBG
= ImageLoader.getImage(ImageLoader.HANGUP_ROLLOVER_BUTTON_BG);
private JLabel personPhoto = new JLabel(new ImageIcon (Constants.DEFAULT_USER_PHOTO));
private JLabel personPhoto = new JLabel(new ImageIcon
(ImageLoader.getImage(ImageLoader.DEFAULT_USER_PHOTO)));
private JLabel personName = new JLabel ("John Smith");

@ -1,15 +1,24 @@
/*
* 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.io.File;
import java.net.MalformedURLException;
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 net.java.sip.communicator.impl.gui.main.configforms.ConfigurationFrame;
import net.java.sip.communicator.impl.gui.main.utils.ImageLoader;
import net.java.sip.communicator.service.contactlist.MetaContactListService;
import com.l2fprod.gui.plaf.skin.Skin;
import com.l2fprod.gui.plaf.skin.SkinLookAndFeel;
@ -23,47 +32,111 @@
*/
public class CommunicatorMain {
public static void main(String[] args){
private MainFrame mainFrame;
private MetaContactListService contactList;
public CommunicatorMain(){
this.setDefaultThemePack();
ConfigurationFrame configFrame = new ConfigurationFrame();
mainFrame = new MainFrame(this.getUser());
mainFrame.setConfigFrame(configFrame);
//In order to have the same icon when using option panes
JOptionPane.getRootFrame().setIconImage(ImageLoader.getImage(ImageLoader.SIP_LOGO));
}
/**
* To be removed after the real contact
* list is implemented.
*/
public ContactList getContactList(){
ContactList clist = new ContactList();
ContactItem citem1 = new ContactItem("Ivancho");
ContactItem citem2 = new ContactItem("Traiancho");
ContactItem citem3 = new ContactItem("Glupancho");
citem1.setUserIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.USER_ONLINE_ICON)));
citem2.setUserIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.USER_ONLINE_ICON)));
citem3.setUserIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.USER_ONLINE_ICON)));
citem1.setPhoto(ImageLoader.getImage(ImageLoader.DEFAULT_CHAT_USER_PHOTO));
citem2.setPhoto(ImageLoader.getImage(ImageLoader.DEFAULT_CHAT_USER_PHOTO));
citem3.setPhoto(ImageLoader.getImage(ImageLoader.DEFAULT_CHAT_USER_PHOTO));
clist.addContact(citem1);
clist.addContact(citem2);
clist.addContact(citem3);
citem1.setProtocolList(new String[]{"SIP", "ICQ", "MSN"});
citem2.setProtocolList(new String[]{"ICQ"});
citem3.setProtocolList(new String[]{"SIP", "ICQ", "MSN"});
return clist;
}
public User getUser(){
User user = new User();
user.setName("Yana");
user.setProtocols(new String[]{"SIP", "ICQ"});
return user;
}
public void setDefaultThemePack(){
try {
SkinLookAndFeel.setSkin(
SkinLookAndFeel.loadThemePackDefinition(new File("src/net/java/sip/communicator/impl/gui/themepacks/aquathemepack/skinlf-themepack.xml").toURL()));
UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void setThemePack(String themePack){
try {
//the theme could be passed as a parameter
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");
if (themePack.endsWith(".xml")) {
} 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);
SkinLookAndFeel.setSkin(
SkinLookAndFeel.loadThemePackDefinition(new File(themePack).toURL()));
} else {
UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
SkinLookAndFeel.setSkin(SkinLookAndFeel.loadThemePack(args[0]));
UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
} else if (themePack.startsWith("class:")) {
}
}
//the default theme is set if no theme is specified
else{
SkinLookAndFeel.setSkin(
SkinLookAndFeel.loadThemePackDefinition(new File("src/net/java/sip/communicator/impl/gui/themepacks/aquathemepack/skinlf-themepack.xml").toURL()));
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:")) {
//Decorates the frames and dialogs if we are running with jdk1.4 +
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(themePack));
UIManager.setLookAndFeel("com.l2fprod.gui.plaf.skin.SkinLookAndFeel");
}
// Decorates the frames and dialogs if we are running with jdk1.4 +
/*
if (OS.isOneDotFourOrMore()) {
java.lang.reflect.Method method = JFrame.class.getMethod(
@ -74,46 +147,35 @@ public static void main(String[] args){
method = JDialog.class.getMethod(
"setDefaultLookAndFeelDecorated",
new Class[] { boolean.class });
method.invoke(null, new Object[] { Boolean.TRUE });
}*/
method.invoke(null, neif (args.length > 0) {
}*/
} catch (Exception e) { }
//TODO: To be removed when the contact list service is ready
ContactList clist = new ContactList();
ContactItem citem1 = new ContactItem("Ivancho");
ContactItem citem2 = new ContactItem("Traiancho");
ContactItem citem3 = new ContactItem("Glupancho");
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);
clist.addContact(citem3);
User user = new User();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
user.setName("Yana");
user.setProtocols(new String[]{"SIP", "ICQ", "MSN"});
public void show(){
mainFrame.pack();
mainFrame.setVisible(true);
}
public static void main(String args[]){
//////////////////////////////////////////////////////////////////////
CommunicatorMain communicatorMain = new CommunicatorMain();
MainFrame mainFrame = new MainFrame(clist, user);
//In order to have the same icon when using option panes
JOptionPane.getRootFrame().setIconImage(Constants.SIP_LOGO);
mainFrame.pack();
mainFrame.setVisible(true);
communicatorMain.show();
}
public void setContactList(MetaContactListService contactList) {
this.contactList = contactList;
this.mainFrame.setContactList(contactList);
}
}

@ -1,3 +1,10 @@
/*
* 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.Image;

@ -1,3 +1,10 @@
/*
* 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.util.Vector;

@ -1,124 +0,0 @@
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;
import javax.swing.BoxLayout;
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
*
* The ContactListPanel contains the contact list.
*/
public class ContactListPanel extends JScrollPane{
private ContactList clist;
private JPanel mainPanel = new JPanel();
private JPanel contactsPanel = new JPanel();
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));
this.clist = clist;
this.init();
}
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(Constants.CONTACTPANEL_WIDTH, Constants.CONTACTPANEL_HEIGHT));
cpanel.addMouseListener(new MouseAdapter(){
public void mouseEntered(MouseEvent e){
ContactPanel cpanel = (ContactPanel)e.getSource();
cpanel.setMouseOver(true);
cpanel.repaint();
}
public void mouseExited(MouseEvent e){
ContactPanel cpanel = (ContactPanel)e.getSource();
cpanel.setMouseOver(false);
cpanel.repaint();
}
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);
}
}
});
this.contactsPanel.add(cpanel);
}
this.mainPanel.add(contactsPanel, BorderLayout.NORTH);
this.getViewport().add(mainPanel);
}
public void refreshContactsStatus(ContactPanel cpanelSelected){
for (int i = 0; i < this.contactsPanel.getComponentCount(); i ++){
ContactPanel cpanel = (ContactPanel)this.contactsPanel.getComponent(i);
if(!cpanel.equals(cpanelSelected)){
cpanel.setSelected(false);
}
}
}
}

@ -1,7 +0,0 @@
package net.java.sip.communicator.impl.gui.main;
import javax.swing.JTree;
public class ContactListTree extends JTree {
}

@ -1,157 +0,0 @@
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;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
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
*
* The ContactPanel contains the contact item.
*/
public class ContactPanel extends JPanel {
private ContactItem contactItem;
private boolean isMouseOver = false;
private boolean isSelected = false;
private JLabel nicknameLabel = new JLabel();
public ContactPanel(ContactItem contactItem){
super(new BorderLayout());
this.contactItem = contactItem;
this.setBackground(Color.WHITE);
this.setOpaque(true);
this.init();
}
private void init(){
this.nicknameLabel.setFont(this.getFont().deriveFont(Font.BOLD));
this.setUserData();
this.add(nicknameLabel, BorderLayout.CENTER);
}
public void setUserData(){
this.nicknameLabel.setText(this.contactItem.getNickName());
this.nicknameLabel.setIcon(this.contactItem.getUserIcon());
this.nicknameLabel.setIconTextGap(0);
}
public void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
if(this.isSelected()){
GradientPaint p = new GradientPaint(this.getWidth()/2,
0,
Constants.CONTACTPANEL_SELECTED_START_COLOR,
this.getWidth()/2,
Constants.CONTACTPANEL_SELECTED_GRADIENT_SIZE,
Constants.CONTACTPANEL_SELECTED_END_COLOR);
GradientPaint p1 = new GradientPaint( this.getWidth()/2,
this.getHeight() - Constants.CONTACTPANEL_SELECTED_GRADIENT_SIZE,
Constants.CONTACTPANEL_SELECTED_END_COLOR,
this.getWidth()/2,
this.getHeight(),
Constants.CONTACTPANEL_SELECTED_START_COLOR);
g2.setPaint(p);
g2.fillRect(0, 0, this.getWidth(), Constants.CONTACTPANEL_SELECTED_GRADIENT_SIZE);
g2.setColor(Constants.CONTACTPANEL_SELECTED_END_COLOR);
g2.fillRect(0,
Constants.CONTACTPANEL_SELECTED_GRADIENT_SIZE,
this.getWidth(),
this.getHeight() - Constants.CONTACTPANEL_SELECTED_GRADIENT_SIZE);
g2.setPaint(p1);
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,
Constants.CONTACTPANEL_MOVER_START_COLOR,
this.getWidth()/2,
Constants.CONTACTPANEL_GRADIENT_SIZE,
Constants.CONTACTPANEL_MOVER_END_COLOR);
GradientPaint p1 = new GradientPaint( this.getWidth()/2,
this.getHeight() - Constants.CONTACTPANEL_GRADIENT_SIZE,
Constants.CONTACTPANEL_MOVER_END_COLOR,
this.getWidth()/2,
this.getHeight(),
Constants.CONTACTPANEL_MOVER_START_COLOR);
g2.setPaint(p);
g2.fillRect(0, 0, this.getWidth(), Constants.CONTACTPANEL_GRADIENT_SIZE);
g2.setColor(Constants.CONTACTPANEL_MOVER_END_COLOR);
g2.fillRect(0,
Constants.CONTACTPANEL_GRADIENT_SIZE,
this.getWidth(),
this.getHeight() - Constants.CONTACTPANEL_GRADIENT_SIZE);
g2.setPaint(p1);
g2.fillRect(0, this.getHeight() - Constants.CONTACTPANEL_GRADIENT_SIZE - 1, this.getWidth(), this.getHeight() - 1);
}
}
public boolean isMouseOver() {
return isMouseOver;
}
public void setMouseOver(boolean isMouseOver) {
this.isMouseOver = isMouseOver;
}
public boolean isSelected() {
return isSelected;
}
public void setSelected(boolean isSelected) {
if(this.isSelected != isSelected) {
this.isSelected = isSelected;
/*if(isSelected) {
this.setSize(new Dimension(this.getWidth(), LookAndFeelConstants.CONTACTPANEL_SELECTED_HEIGHT));
} else {
this.setSize(new Dimension(this.getWidth(), LookAndFeelConstants.CONTACTPANEL_HEIGHT));
}*/
this.repaint();
}
}
public void paint(Graphics g){
AntialiasingManager.activateAntialiasing(g);
super.paint(g);
}
public ContactItem getContactItem() {
return contactItem;
}
}

@ -1,3 +1,10 @@
/*
* 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.Component;
@ -17,41 +24,42 @@
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;
import net.java.sip.communicator.impl.gui.main.utils.ImageLoader;
public class ContactRightButtonMenu extends JPopupMenu implements
ActionListener {
private AntialiasedMenu moveToMenu = new AntialiasedMenu(
Messages.getString("moveToGroup"),
new ImageIcon(Constants.GROUPS_16x16_ICON));
new ImageIcon(ImageLoader.getImage(ImageLoader.GROUPS_16x16_ICON)));
private AntialiasedMenu addSubcontactMenu = new AntialiasedMenu(
Messages.getString("addSubcontact"),
new ImageIcon(Constants.ADD_CONTACT_16x16_ICON));
new ImageIcon(ImageLoader.getImage(ImageLoader.ADD_CONTACT_16x16_ICON)));
private AntialiasedMenuItem sendMessageItem = new AntialiasedMenuItem(
Messages.getString("sendMessage"),
new ImageIcon(Constants.SEND_MESSAGE_16x16_ICON));
new ImageIcon(ImageLoader.getImage(ImageLoader.SEND_MESSAGE_16x16_ICON)));
private AntialiasedMenuItem sendFileItem = new AntialiasedMenuItem(
Messages.getString("sendFile"),
new ImageIcon(Constants.SEND_FILE_16x16_ICON));
new ImageIcon(ImageLoader.getImage(ImageLoader.SEND_FILE_16x16_ICON)));
private AntialiasedMenuItem removeContactItem = new AntialiasedMenuItem(
Messages.getString("removeContact"),
new ImageIcon(Constants.DELETE_16x16_ICON));
new ImageIcon(ImageLoader.getImage(ImageLoader.DELETE_16x16_ICON)));
private AntialiasedMenuItem renameContactItem = new AntialiasedMenuItem(
Messages.getString("renameContact"),
new ImageIcon(Constants.RENAME_16x16_ICON));
new ImageIcon(ImageLoader.getImage(ImageLoader.RENAME_16x16_ICON)));
private AntialiasedMenuItem userInfoItem = new AntialiasedMenuItem(
Messages.getString("userInfo"),
new ImageIcon(Constants.INFO_16x16_ICON));
new ImageIcon(ImageLoader.getImage(ImageLoader.INFO_16x16_ICON)));
private AntialiasedMenuItem viewHistoryItem = new AntialiasedMenuItem(
Messages.getString("viewHistory"),
new ImageIcon(Constants.HISTORY_16x16_ICON));
new ImageIcon(ImageLoader.getImage(ImageLoader.HISTORY_16x16_ICON)));
private ContactItem contactItem;
@ -123,7 +131,7 @@ private void init() {
this.userInfoItem.addActionListener(this);
}
public Point calculatePopupLocation() {
public Point getPopupLocation() {
Component component = this.getInvoker();
Point point = new Point();
@ -137,7 +145,7 @@ public Point calculatePopupLocation() {
x += component.getX();
y += component.getY();
}
System.out.println(component.getHeight());
point.x = x;
point.y = y + this.getInvoker().getHeight();

@ -1,3 +1,10 @@
/*
* 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;
@ -14,6 +21,7 @@
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
import net.java.sip.communicator.impl.gui.main.utils.ImageLoader;
/**
* @author Yana Stamcheva
@ -22,56 +30,55 @@
*/
public class DialPanel extends JPanel implements ActionListener {
private Font buttonTextFont = new Font("Verdana", Font.BOLD, 12);
private JComboBox phoneNumberCombo;
private SIPCommButton oneButton = new SIPCommButton
(Constants.ONE_DIAL_BUTTON,
(ImageLoader.getImage(ImageLoader.ONE_DIAL_BUTTON),
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton twoButton = new SIPCommButton
(Constants.TWO_DIAL_BUTTON,
(ImageLoader.getImage(ImageLoader.TWO_DIAL_BUTTON),
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton threeButton = new SIPCommButton
(Constants.THREE_DIAL_BUTTON,
(ImageLoader.getImage(ImageLoader.THREE_DIAL_BUTTON),
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton fourButton = new SIPCommButton
(Constants.FOUR_DIAL_BUTTON,
(ImageLoader.getImage(ImageLoader.FOUR_DIAL_BUTTON),
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton fiveButton = new SIPCommButton
(Constants.FIVE_DIAL_BUTTON,
(ImageLoader.getImage(ImageLoader.FIVE_DIAL_BUTTON),
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton sixButton = new SIPCommButton
(Constants.SIX_DIAL_BUTTON,
(ImageLoader.getImage(ImageLoader.SIX_DIAL_BUTTON),
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton sevenButton = new SIPCommButton
(Constants.SEVEN_DIAL_BUTTON,
(ImageLoader.getImage(ImageLoader.SEVEN_DIAL_BUTTON),
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton eightButton = new SIPCommButton
(Constants.EIGHT_DIAL_BUTTON,
(ImageLoader.getImage(ImageLoader.EIGHT_DIAL_BUTTON),
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton nineButton = new SIPCommButton
(Constants.NINE_DIAL_BUTTON,
(ImageLoader.getImage(ImageLoader.NINE_DIAL_BUTTON),
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton starButton = new SIPCommButton
(Constants.STAR_DIAL_BUTTON,
(ImageLoader.getImage(ImageLoader.STAR_DIAL_BUTTON),
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton zeroButton = new SIPCommButton
(Constants.ZERO_DIAL_BUTTON,
(ImageLoader.getImage(ImageLoader.ZERO_DIAL_BUTTON),
SIPCommButton.LEFT_ICON_LAYOUT);
private SIPCommButton diezButton = new SIPCommButton
(Constants.DIEZ_DIAL_BUTTON,
(ImageLoader.getImage(ImageLoader.DIEZ_DIAL_BUTTON),
SIPCommButton.LEFT_ICON_LAYOUT);
private JPanel dialPadPanel = new JPanel(new GridLayout(4, 3, 5, 5));
@ -112,18 +119,18 @@ public void init(){
diezButton.addActionListener(this);
starButton.addActionListener(this);
oneButton.setFont(this.buttonTextFont);
twoButton.setFont(this.buttonTextFont);
threeButton.setFont(this.buttonTextFont);
fourButton.setFont(this.buttonTextFont);
fiveButton.setFont(this.buttonTextFont);
sixButton.setFont(this.buttonTextFont);
sevenButton.setFont(this.buttonTextFont);
eightButton.setFont(this.buttonTextFont);
nineButton.setFont(this.buttonTextFont);
zeroButton.setFont(this.buttonTextFont);
diezButton.setFont(this.buttonTextFont);
starButton.setFont(this.buttonTextFont);
oneButton.setFont(Constants.FONT);
twoButton.setFont(Constants.FONT);
threeButton.setFont(Constants.FONT);
fourButton.setFont(Constants.FONT);
fiveButton.setFont(Constants.FONT);
sixButton.setFont(Constants.FONT);
sevenButton.setFont(Constants.FONT);
eightButton.setFont(Constants.FONT);
nineButton.setFont(Constants.FONT);
zeroButton.setFont(Constants.FONT);
diezButton.setFont(Constants.FONT);
starButton.setFont(Constants.FONT);
dialPadPanel.add(oneButton);
dialPadPanel.add(twoButton);

@ -0,0 +1,27 @@
/*
* 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;
public class GroupItem {
private String groupName;
public GroupItem(String groupName){
this.groupName = groupName;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
}

@ -1,396 +0,0 @@
package net.java.sip.communicator.impl.gui.main;
import java.awt.Color;
import java.awt.Image;
import java.io.IOException;
import java.util.ArrayList;
import javax.imageio.ImageIO;
import net.java.sip.communicator.impl.gui.main.customcontrols.StatusIcon;
import net.java.sip.communicator.util.Logger;
/**
* @author Yana Stamcheva
*
* All look and feel related constants are stored here.
*/
public class LookAndFeelConstants {
private static Logger log = Logger.getLogger(LookAndFeelConstants.class);
/*========================================================================
* ------------------------ SIZE CONSTANTS --------------------------------
========================================================================*/
public static final int MAINFRAME_HEIGHT = 200;
public static final int MAINFRAME_WIDTH = 30;
public static final int CONTACTPANEL_HEIGHT = 20;
public static final int CONTACTPANEL_WIDTH = 10;
public static final int CONTACTPANEL_SELECTED_HEIGHT = 50;
public static final int CONTACTPANEL_SELECTED_GRADIENT_SIZE = 10;
public static final int CONTACTPANEL_GRADIENT_SIZE = 10;
/*========================================================================
* ------------------------ COLOR CONSTANTS -------------------------------
========================================================================*/
public static final Color CONTACTPANEL_SELECTED_START_COLOR =
new Color(82, 111, 156);
public static final Color CONTACTPANEL_SELECTED_END_COLOR =
new Color(209, 212, 225);
public static final Color CONTACTPANEL_MOVER_START_COLOR =
new Color(210, 210, 210);
// public static final Color CONTACTPANEL_MOVER_START_COLOR =
// new Color(244, 235, 143);
public static final Color CONTACTPANEL_MOVER_END_COLOR =
new Color(255, 255, 255);
public static final Color CONTACTPANEL_LINES_COLOR =
new Color(154, 154, 154);
/*=========================================================================
* ------------------------------ ICONS ----------------------------------
========================================================================*/
public static final Image QUICK_MENU_ADD_ICON = LookAndFeelConstants
.loadImage("../resources/buttons/addContactIcon.png");
public static final Image QUICK_MENU_CONFIGURE_ICON = LookAndFeelConstants
.loadImage("../resources/buttons/configureIcon.png");
public static final Image QUICK_MENU_SEARCH_ICON = LookAndFeelConstants
.loadImage("../resources/buttons/searchIcon.png");
public static final Image QUICK_MENU_INFO_ICON = LookAndFeelConstants
.loadImage("../resources/buttons/infoIcon.png");
public static final Image QUICK_MENU_BUTTON_BG = LookAndFeelConstants
.loadImage("../resources/buttons/quickMenuButtonBg.png");
public static final Image QUICK_MENU_BUTTON_ROLLOVER_BG = LookAndFeelConstants
.loadImage("../resources/buttons/quickMenuButtonRolloverBg.png");
public static final Image CALL_BUTTON_BG = LookAndFeelConstants
.loadImage("../resources/buttons/callButton.png");
public static final Image HANGUP_BUTTON_BG = LookAndFeelConstants
.loadImage("../resources/buttons/hangupButton.png");
public static final Image CALL_ROLLOVER_BUTTON_BG = LookAndFeelConstants
.loadImage("../resources/buttons/callButtonRollover.png");
public static final Image CALL_PRESSED_BUTTON_BG = LookAndFeelConstants
.loadImage("../resources/buttons/callButtonPressed.png");
public static final Image HANGUP_ROLLOVER_BUTTON_BG = LookAndFeelConstants
.loadImage("../resources/buttons/hangupButtonRollover.png");
public static final Image HANGUP_PRESSED_BUTTON_BG = LookAndFeelConstants
.loadImage("../resources/buttons/hangupButtonPressed.png");
public static final Image STATUS_SELECTOR_BOX = LookAndFeelConstants
.loadImage("../resources/buttons/combobox.png");
public static final Image BUTTON_BG = LookAndFeelConstants
.loadImage("../resources/buttons/dialButtonBg.png");
public static final Image BUTTON_ROLLOVER_BG = LookAndFeelConstants
.loadImage("../resources/buttons/dialButtonRolloverBg.png");
public static final Image ONE_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/one.png");
public static final Image TWO_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/two.png");
public static final Image THREE_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/three.png");
public static final Image FOUR_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/four.png");
public static final Image FIVE_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/five.png");
public static final Image SIX_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/six.png");
public static final Image SEVEN_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/seven.png");
public static final Image EIGHT_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/eight.png");
public static final Image NINE_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/nine.png");
public static final Image STAR_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/star.png");
public static final Image ZERO_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/zero.png");
public static final Image DIEZ_DIAL_BUTTON = LookAndFeelConstants
.loadImage("../resources/buttons/diez.png");
/*=========================================================================
* ------------------------ STATUS LABELS ---------------------------------
========================================================================*/
public static final String ONLINE_STATUS = "Online";
public static final String OFFLINE_STATUS = "Offline";
public static final String OCCUPIED_STATUS = "Occupied";
public static final String CHAT_STATUS = "Free for chat";
public static final String AWAY_STATUS = "Away";
public static final String NA_STATUS = "Not available";
public static final String INVISIBLE_STATUS = "Invisible";
public static final String DND_STATUS = "Do not disturb";
/*=========================================================================
* ------------------------ PROTOCOL NAMES --------------------------------
========================================================================*/
public static final String ICQ = "ICQ";
public static final String MSN = "MSN";
public static final String AIM = "AIM";
public static final String YAHOO = "Yahoo";
public static final String JABBER = "Jabber";
public static final String SKYPE = "Skype";
public static final String SIP = "SIP";
/*=========================================================================
* --------------------- PROTOCOLS STATUS ICONS ---------------------------
========================================================================*/
public static final Image ICQ_LOGO = LookAndFeelConstants
.loadImage("../resources/protocols/icq/Icq16.png");
public static final Image ICQ_FF_CHAT_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/icq/cr16-action-icq_ffc.png");
public static final Image ICQ_AWAY_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/icq/cr16-action-icq_away.png");
public static final Image ICQ_NA_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/icq/cr16-action-icq_na.png");
public static final Image ICQ_DND_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/icq/cr16-action-icq_dnd.png");
public static final Image ICQ_OCCUPIED_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/icq/cr16-action-icq_occupied.png");
public static final Image ICQ_OFFLINE_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/icq/cr16-action-icq_offline.png");
public static final Image ICQ_INVISIBLE_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/icq/cr16-action-icq_invisible.png");
public static final Image MSN_LOGO = LookAndFeelConstants
.loadImage("../resources/protocols/msn/Msn16.png");
public static final Image AIM_LOGO = LookAndFeelConstants
.loadImage("../resources/protocols/aim/Aim16.png");
public static final Image YAHOO_LOGO = LookAndFeelConstants
.loadImage("../resources/protocols/yahoo/Yahoo16.png");
public static final Image JABBER_LOGO = LookAndFeelConstants
.loadImage("../resources/protocols/jabber/Jabber16.png");
public static final Image SKYPE_LOGO = LookAndFeelConstants
.loadImage("../resources/protocols/skype/Skype16.png");
public static final Image SIP_LOGO = LookAndFeelConstants
.loadImage("../resources/protocols/sip/sc_logo16x16.png");
public static final Image SIP_ONLINE_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/sip/onlineStatus.png");
public static final Image SIP_OFFLINE_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/sip/offlineStatus.png");
public static final Image SIP_INVISIBLE_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/sip/invisibleStatus.png");
public static final Image SIP_AWAY_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/sip/awayStatus.png");
public static final Image SIP_NA_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/sip/naStatus.png");
public static final Image SIP_DND_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/sip/dndStatus.png");
public static final Image SIP_OCCUPIED_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/sip/occupiedStatus.png");
public static final Image SIP_CHAT_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/sip/chatStatus.png");
/*========================================================================
* ------------------------ USERS ICONS ------------------v---------------
========================================================================*/
public static final Image USER_ONLINE_ICON = LookAndFeelConstants
.loadImage("../resources/protocols/sip/sc_user_online.png");
/*========================================================================
* ------------------------ OTHER CONSTANTS ------------------------------
========================================================================*/
public static final int RIGHT_SHIFT_STATUS_ICON = 2;
/**
* Gets all protocol statuses, including status and text.
*
* @param protocolName
* @return an ArrayList of all status Icons for the given protocol.
*/
public static ArrayList getProtocolIcons (String protocolName) {
ArrayList protocolStatusList = new ArrayList ();
if (protocolName.equals (LookAndFeelConstants.SIP)) {
protocolStatusList.add (new Status (ONLINE_STATUS,
new StatusIcon (LookAndFeelConstants.SIP_ONLINE_ICON)));
protocolStatusList.add (new Status (CHAT_STATUS,
new StatusIcon (LookAndFeelConstants.SIP_CHAT_ICON)));
protocolStatusList.add (new Status (AWAY_STATUS,
new StatusIcon (LookAndFeelConstants.SIP_AWAY_ICON)));
protocolStatusList.add (new Status (OCCUPIED_STATUS,
new StatusIcon (LookAndFeelConstants.SIP_OCCUPIED_ICON)));
protocolStatusList.add (new Status (NA_STATUS,
new StatusIcon (LookAndFeelConstants.SIP_NA_ICON)));
protocolStatusList.add (new Status (DND_STATUS,
new StatusIcon (LookAndFeelConstants.SIP_DND_ICON)));
protocolStatusList.add (new Status (OFFLINE_STATUS,
new StatusIcon (LookAndFeelConstants.SIP_OFFLINE_ICON)));
protocolStatusList.add (new Status (INVISIBLE_STATUS,
new StatusIcon (LookAndFeelConstants.SIP_INVISIBLE_ICON)));
} else if (protocolName.equals (LookAndFeelConstants.ICQ)) {
protocolStatusList.add (new Status(ONLINE_STATUS,
new StatusIcon (LookAndFeelConstants.ICQ_LOGO)));
protocolStatusList.add (new Status(CHAT_STATUS,
new StatusIcon (LookAndFeelConstants.ICQ_LOGO,
LookAndFeelConstants.ICQ_FF_CHAT_ICON)));
protocolStatusList.add(new Status(AWAY_STATUS,
new StatusIcon (LookAndFeelConstants.ICQ_LOGO,
LookAndFeelConstants.ICQ_AWAY_ICON)));
protocolStatusList.add(new Status(NA_STATUS,
new StatusIcon (LookAndFeelConstants.ICQ_LOGO,
LookAndFeelConstants.ICQ_NA_ICON)));
protocolStatusList.add(new Status(DND_STATUS,
new StatusIcon (LookAndFeelConstants.ICQ_LOGO,
LookAndFeelConstants.ICQ_DND_ICON)));
protocolStatusList.add(new Status(OCCUPIED_STATUS,
new StatusIcon (LookAndFeelConstants.ICQ_LOGO,
LookAndFeelConstants.ICQ_OCCUPIED_ICON)));
protocolStatusList.add(new Status(OFFLINE_STATUS,
new StatusIcon (LookAndFeelConstants.ICQ_OFFLINE_ICON)));
protocolStatusList.add(new Status(INVISIBLE_STATUS,
new StatusIcon (LookAndFeelConstants.ICQ_INVISIBLE_ICON)));
} else if (protocolName.equals (LookAndFeelConstants.MSN)) {
protocolStatusList.add (new Status(ONLINE_STATUS,
new StatusIcon (LookAndFeelConstants.MSN_LOGO)));
} else if (protocolName.equals (LookAndFeelConstants.AIM)) {
protocolStatusList.add (new Status(ONLINE_STATUS,
new StatusIcon (LookAndFeelConstants.AIM_LOGO)));
} else if (protocolName.equals (LookAndFeelConstants.YAHOO)) {
protocolStatusList.add (new Status(ONLINE_STATUS,
new StatusIcon (LookAndFeelConstants.YAHOO_LOGO)));
} else if (protocolName.equals (LookAndFeelConstants.JABBER)) {
protocolStatusList.add (new Status(ONLINE_STATUS,
new StatusIcon (LookAndFeelConstants.JABBER_LOGO)));
} else if (protocolName.equals (LookAndFeelConstants.SKYPE)) {
protocolStatusList.add (new Status(ONLINE_STATUS,
new StatusIcon (LookAndFeelConstants.SKYPE_LOGO)));
}
return protocolStatusList;
}
/**
* Loads an image from a given path.
*/
private static Image loadImage(String path) {
Image image = null;
try {
log.logEntry();
if (log.isTraceEnabled()) {
log.trace("Loading image : " + path + "...");
}
image = ImageIO.read(LookAndFeelConstants.class.getResource(path));
if (log.isTraceEnabled()) {
log.trace("Loading image : " + path + "... [ DONE ]");
}
} catch (IOException e) {
log.error("Failed to load image:" + path, e);
} finally {
log.logExit();
}
return image;
}
}

@ -1,91 +1,132 @@
/*
* 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.Cursor;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import net.java.sip.communicator.impl.gui.main.configforms.ConfigurationFrame;
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.contactlist.MetaContactListService;
/**
* @author Yana Stamcheva
*
* The MainFrame of the application.
*
* The MainFrame of the application.
*/
public class MainFrame extends JFrame{
private JPanel mainPanel = new JPanel(new BorderLayout());
private JPanel menusPanel = new JPanel(new BorderLayout());
private Menu menu = new Menu();
private QuickMenu quickMenu = new QuickMenu();
private CallPanel callPanel;
private StatusPanel statusPanel;
private MainTabbedPane tabbedPane;
private ContactList clist;
private User user;
public MainFrame(ContactList clist, User user){
this.clist = clist;
this.user = user;
public class MainFrame extends JFrame {
private JPanel contactListPanel = new JPanel(new BorderLayout());
private JPanel menusPanel = new JPanel(new BorderLayout());
private Menu menu = new Menu();
private ConfigurationFrame configFrame = new ConfigurationFrame();
private CallPanel callPanel;
private StatusPanel statusPanel;
private MainTabbedPane tabbedPane;
private QuickMenu quickMenu;
private MetaContactListService contactList;
private User user;
private Dimension minimumFrameSize = new Dimension(
Constants.MAINFRAME_MIN_WIDTH, Constants.MAINFRAME_MIN_HEIGHT);
public MainFrame(User user) {
callPanel = new CallPanel(this);
this.user = user;
callPanel = new CallPanel(this);
tabbedPane = new MainTabbedPane(this);
quickMenu = new QuickMenu(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();
this.setIconImage(ImageLoader.getImage(ImageLoader.SIP_LOGO));
this.setSize(Constants.MAINFRAME_WIDTH, Constants.MAINFRAME_HEIGHT);
this.init();
}
private void init(){
private void init() {
this.menusPanel.add(menu, BorderLayout.NORTH);
this.menusPanel.add(quickMenu, BorderLayout.CENTER);
this.mainPanel.add(tabbedPane, BorderLayout.CENTER);
this.mainPanel.add(callPanel, BorderLayout.SOUTH);
this.getContentPane().add(menusPanel, BorderLayout.NORTH);
this.getContentPane().add(mainPanel, BorderLayout.CENTER);
this.contactListPanel.add(tabbedPane, BorderLayout.CENTER);
this.contactListPanel.add(callPanel, BorderLayout.SOUTH);
this.getContentPane().add(menusPanel, BorderLayout.NORTH);
this.getContentPane().add(contactListPanel, BorderLayout.CENTER);
this.getContentPane().add(statusPanel, BorderLayout.SOUTH);
}
private void setInitialBounds(){
this.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width - MainFrame.WIDTH, 50);
private void setInitialBounds() {
this.getContentPane().setSize( Constants.MAINFRAME_WIDTH,
Constants.MAINFRAME_HEIGHT);
this.tabbedPane.setPreferredSize(new Dimension(Constants.MAINFRAME_WIDTH,
Constants.MAINFRAME_HEIGHT));
this.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width
- MainFrame.WIDTH, 50);
this.tabbedPane.setMinimumSize(minimumFrameSize);
}
public CallPanel getCallPanel() {
return callPanel;
}
public ContactList getContactList() {
return clist;
public MetaContactListService getContactList() {
return this.contactList;
}
public void setContactList(ContactList clist) {
this.clist = clist;
public void setContactList(MetaContactListService contactList) {
this.contactList = contactList;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
public ConfigurationFrame getConfigFrame() {
return configFrame;
}
public void setConfigFrame(ConfigurationFrame configFrame) {
this.configFrame = configFrame;
}
}

@ -1,3 +1,10 @@
/*
* 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.Color;
@ -11,8 +18,10 @@
import javax.swing.ListModel;
import javax.swing.event.ListDataListener;
import net.java.sip.communicator.impl.gui.main.contactlist.ContactListPanel;
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.service.contactlist.MetaContactListService;
/**
* @author Yana Stamcheva
@ -24,15 +33,15 @@ public class MainTabbedPane extends JTabbedPane {
private DialPanel dialPanel = new DialPanel();
private ContactListPanel contactList;
private ContactListPanel clistPanel;
public MainTabbedPane(MainFrame parent){
contactList = new ContactListPanel(parent, parent.getContactList());
clistPanel = new ContactListPanel(parent);
dialPanel.setPhoneNumberCombo(parent.getCallPanel().getPhoneNumberCombo());
this.addTab(Messages.getString("contacts"), contactList);
this.addTab(Messages.getString("contacts"), clistPanel);
this.addTab(Messages.getString("callList"), new JPanel());
this.addTab(Messages.getString("dial"), dialPanel);
}

@ -1,3 +1,10 @@
/*
* 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.Graphics;

@ -1,86 +1,106 @@
/*
* 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.Dimension;
import java.awt.FlowLayout;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JToolBar;
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton;
import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommToolBar;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
import net.java.sip.communicator.impl.gui.main.utils.ImageLoader;
/**
* @author Yana Stamcheva
*
* The quick menu.
*/
public class QuickMenu extends JToolBar{
public class QuickMenu extends SIPCommToolBar
implements ActionListener {
SIPCommButton infoButton;
SIPCommButton toolsButton;
SIPCommButton configureButton;
SIPCommButton addButton;
SIPCommButton searchButton;
public QuickMenu(){
private MainFrame mainFrame;
public QuickMenu(MainFrame mainFrame){
this.mainFrame = mainFrame;
this.setRollover(true);
this.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0));
this.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
infoButton = new SIPCommButton
(Constants.QUICK_MENU_BUTTON_BG,
Constants.QUICK_MENU_BUTTON_ROLLOVER_BG,
Constants.QUICK_MENU_INFO_ICON);
(ImageLoader.getImage(ImageLoader.QUICK_MENU_BUTTON_BG),
ImageLoader.getImage(ImageLoader.QUICK_MENU_BUTTON_ROLLOVER_BG),
ImageLoader.getImage(ImageLoader.QUICK_MENU_INFO_ICON));
toolsButton = new SIPCommButton
(Constants.QUICK_MENU_BUTTON_BG,
Constants.QUICK_MENU_BUTTON_ROLLOVER_BG,
Constants.QUICK_MENU_CONFIGURE_ICON);
configureButton = new SIPCommButton
(ImageLoader.getImage(ImageLoader.QUICK_MENU_BUTTON_BG),
ImageLoader.getImage(ImageLoader.QUICK_MENU_BUTTON_ROLLOVER_BG),
ImageLoader.getImage(ImageLoader.QUICK_MENU_CONFIGURE_ICON));
searchButton = new SIPCommButton
(Constants.QUICK_MENU_BUTTON_BG,
Constants.QUICK_MENU_BUTTON_ROLLOVER_BG,
Constants.QUICK_MENU_SEARCH_ICON);
(ImageLoader.getImage(ImageLoader.QUICK_MENU_BUTTON_BG),
ImageLoader.getImage(ImageLoader.QUICK_MENU_BUTTON_ROLLOVER_BG),
ImageLoader.getImage(ImageLoader.QUICK_MENU_SEARCH_ICON));
addButton = new SIPCommButton
(Constants.QUICK_MENU_BUTTON_BG,
Constants.QUICK_MENU_BUTTON_ROLLOVER_BG,
Constants.QUICK_MENU_ADD_ICON);
(ImageLoader.getImage(ImageLoader.QUICK_MENU_BUTTON_BG),
ImageLoader.getImage(ImageLoader.QUICK_MENU_BUTTON_ROLLOVER_BG),
ImageLoader.getImage(ImageLoader.QUICK_MENU_ADD_ICON));
this.init();
}
private void init() {
this.add(addButton);
this.add(toolsButton);
this.add(configureButton);
this.add(searchButton);
this.add(infoButton);
}
/*
public void paint(Graphics g){
super.paint(g);
Graphics2D g2 = (Graphics2D)g;
this.addButton.setName("add");
this.configureButton.setName("config");
this.searchButton.setName("search");
this.infoButton.setName("info");
GradientPaint p = new GradientPaint(this.getWidth()/2,
0,
Constants.CONTACTPANEL_SELECTED_START_COLOR,
this.getWidth()/2,
Constants.CONTACTPANEL_SELECTED_GRADIENT_SIZE,
Constants.CONTACTPANEL_SELECTED_END_COLOR);
this.addButton.addActionListener(this);
this.configureButton.addActionListener(this);
this.searchButton.addActionListener(this);
this.infoButton.addActionListener(this);
}
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
public void actionPerformed(ActionEvent e) {
g2.setPaint(p);
JButton button = (JButton)e.getSource();
String buttonName = button.getName();
//g2.dra
if (buttonName.equals("add")){
}
else if (buttonName.equals("config")){
mainFrame.getConfigFrame().setCalculatedSize();
mainFrame.getConfigFrame().setVisible(true);
}
else if (buttonName.equals("search")){
}
else if (buttonName.equals("info")){
}
}
*/
}

@ -1,29 +0,0 @@
package net.java.sip.communicator.impl.gui.main;
import java.awt.Image;
import javax.swing.ImageIcon;
public class Status {
private String text;
private Image icon;
public Status(String text, Image icon){
this.text = text;
this.icon = icon;
}
public Image getIcon () {
return icon;
}
public void setIcon (Image icon) {
this.icon = icon;
}
public String getText () {
return text;
}
public void setText (String text) {
this.text = text;
}
}

@ -1,3 +1,10 @@
/*
* 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.FlowLayout;
@ -6,8 +13,9 @@
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import net.java.sip.communicator.impl.gui.main.customcontrols.StatusSelectorBox;
import net.java.sip.communicator.impl.gui.main.customcontrols.SelectorBox;
import net.java.sip.communicator.impl.gui.main.utils.Constants;
import net.java.sip.communicator.impl.gui.main.utils.SelectorBoxItem;
public class StatusPanel extends JPanel {
@ -16,7 +24,7 @@ public class StatusPanel extends JPanel {
public StatusPanel(String[] userProtocols) {
this.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
this.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0,
Constants.CONTACTPANEL_MOVER_START_COLOR));
@ -32,9 +40,11 @@ private void init() {
ArrayList protocolStatusList = Constants
.getProtocolStatusIcons(userProtocols[i]);
StatusSelectorBox protocolStatusCombo = new StatusSelectorBox(
protocolStatusList.toArray(), (Status)protocolStatusList.get(0));
//TODO:to change this line!!!!!!!!!!!!
SelectorBox protocolStatusCombo = new SelectorBox(
protocolStatusList.toArray(), (SelectorBoxItem) protocolStatusList
.get(protocolStatusList.size() - 2));
this.add(protocolStatusCombo);
}
}

@ -1,11 +1,18 @@
/*
* 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;
public class User {
private String[] userProtocols;
private String name;
private String[] userProtocols;
private String name;
public void setProtocols(String[] userProtocols){
this.userProtocols = userProtocols;
}

Loading…
Cancel
Save