mirror of https://github.com/sipwise/jitsi.git
parent
3804c837e6
commit
75b4317884
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -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,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;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue