diff options
Diffstat (limited to 'src/net/java/sip/communicator')
14 files changed, 342 insertions, 95 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java index d845639..598dbe6 100644 --- a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java +++ b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java @@ -1291,6 +1291,9 @@ public class UIServiceImpl */ private void reloadComponents(Window window) { + if (window instanceof Skinnable) + ((Skinnable) window).loadSkin(); + reloadComponents((java.awt.Container) window); } @@ -1308,7 +1311,34 @@ public class UIServiceImpl if (c instanceof Skinnable) ((Skinnable) c).loadSkin(); - if (c instanceof java.awt.Container) + if (c instanceof JComponent) + { + JPopupMenu jpm = ((JComponent) c).getComponentPopupMenu(); + if(jpm != null && jpm.isVisible() + && jpm.getInvoker() == (JComponent)c) + { + if (jpm instanceof Skinnable) + ((Skinnable) jpm).loadSkin(); + + if (jpm instanceof java.awt.Container) + reloadComponents((java.awt.Container) jpm); + } + } + + if (c instanceof JMenu) + { + Component[] children = null; + children = ((JMenu)c).getMenuComponents(); + for(int ii = 0; ii < children.length; ii++) + { + if (children[ii] instanceof Skinnable) + ((Skinnable) children[ii]).loadSkin(); + + if (children[ii] instanceof java.awt.Container) + reloadComponents((java.awt.Container) children[ii]); + } + } + else if (c instanceof java.awt.Container) reloadComponents((java.awt.Container) c); } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/CommonRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/CommonRightButtonMenu.java index 721b71c..e6b8aa5 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/CommonRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/CommonRightButtonMenu.java @@ -14,6 +14,7 @@ import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.main.*; import net.java.sip.communicator.impl.gui.main.contactlist.addgroup.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.util.skin.*; /** * The GroupRightButtonMenu is the menu, opened when user clicks with the @@ -21,18 +22,19 @@ import net.java.sip.communicator.impl.gui.utils.*; * user could add a contact to a group. * * @author Yana Stamcheva + * @author Adam Netocny */ -public class CommonRightButtonMenu extends JPopupMenu - implements ActionListener +public class CommonRightButtonMenu + extends JPopupMenu + implements ActionListener, + Skinnable { private final JMenuItem addContactItem = new JMenuItem( GuiActivator.getResources() - .getI18NString("service.gui.ADD_CONTACT") + "...", - new ImageIcon(ImageLoader.getImage(ImageLoader.ADD_CONTACT_16x16_ICON))); + .getI18NString("service.gui.ADD_CONTACT") + "..."); private final JMenuItem createGroupItem = new JMenuItem( - GuiActivator.getResources().getI18NString("service.gui.CREATE_GROUP"), - new ImageIcon(ImageLoader.getImage(ImageLoader.GROUPS_16x16_ICON))); + GuiActivator.getResources().getI18NString("service.gui.CREATE_GROUP")); private MainFrame mainFrame; @@ -55,6 +57,8 @@ public class CommonRightButtonMenu extends JPopupMenu this.addContactItem.addActionListener(this); this.createGroupItem.addActionListener(this); + + loadSkin(); } /** @@ -81,4 +85,16 @@ public class CommonRightButtonMenu extends JPopupMenu dialog.setVisible(true); } } + + /** + * Reloads icons. + */ + public void loadSkin() + { + addContactItem.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.ADD_CONTACT_16x16_ICON))); + + createGroupItem.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.GROUPS_16x16_ICON))); + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListCellRenderer.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListCellRenderer.java index 8ec1d54..37d10a6 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListCellRenderer.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListCellRenderer.java @@ -16,6 +16,7 @@ import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.util.*; +import net.java.sip.communicator.util.skin.*; import net.java.sip.communicator.util.swing.*; /** @@ -26,11 +27,13 @@ import net.java.sip.communicator.util.swing.*; * * @author Yana Stamcheva * @author Lubomir Marinov + * @author Adam Netocny */ public class ContactListCellRenderer extends JPanel implements ListCellRenderer, - Icon + Icon, + Skinnable { /** * The avatar icon height. @@ -52,13 +55,13 @@ public class ContactListCellRenderer /** * The icon indicating an open group. */ - private final ImageIcon openedGroupIcon = + private ImageIcon openedGroupIcon = new ImageIcon(ImageLoader.getImage(ImageLoader.DOWN_ARROW_ICON)); /** * The icon indicating a closed group. */ - private final ImageIcon closedGroupIcon = + private ImageIcon closedGroupIcon = new ImageIcon(ImageLoader.getImage(ImageLoader.RIGHT_ARROW_ICON)); /** @@ -470,4 +473,28 @@ public class ContactListCellRenderer g.dispose(); } } + + /** + * Reloads skin information for this render class. + */ + public void loadSkin() + { + openedGroupIcon + = new ImageIcon(ImageLoader.getImage(ImageLoader.DOWN_ARROW_ICON)); + + closedGroupIcon + = new ImageIcon(ImageLoader.getImage(ImageLoader.RIGHT_ARROW_ICON)); + + int groupForegroundProperty = GuiActivator.getResources() + .getColor("service.gui.CONTACT_LIST_GROUP_FOREGROUND"); + + if (groupForegroundProperty > -1) + groupForegroundColor = new Color (groupForegroundProperty); + + int contactForegroundProperty = GuiActivator.getResources() + .getColor("service.gui.CONTACT_LIST_CONTACT_FOREGROUND"); + + if (contactForegroundProperty > -1) + contactForegroundColor = new Color(contactForegroundProperty); + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultContactList.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultContactList.java index 8f968e8..80a619b 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultContactList.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/DefaultContactList.java @@ -18,15 +18,18 @@ import net.java.sip.communicator.impl.gui.main.chat.conference.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.util.skin.*; /** * DeafultContactlist used to display <code>JList</code>s with contacts. * * @author Damian Minkov * @author Yana Stamcheva + * @author Adam Netocny */ public class DefaultContactList extends JList + implements Skinnable { private static final long serialVersionUID = 0L; @@ -36,6 +39,11 @@ public class DefaultContactList private MouseEvent cachedMouseEvent; /** + * List cell renderer. + */ + ContactListCellRenderer renderer = new ContactListCellRenderer(); + + /** * Creates an instance of <tt>DefaultContactList</tt>. */ public DefaultContactList() @@ -47,7 +55,7 @@ public class DefaultContactList this.setDragEnabled(true); // this.setTransferHandler(new ContactListTransferHandler(this)); - this.setCellRenderer(new ContactListCellRenderer()); + this.setCellRenderer(renderer); } /** @@ -345,4 +353,12 @@ public class DefaultContactList cachedMouseEvent= event; super.processMouseEvent(event); } + + /** + * Reloads skin information stored in render class. + */ + public void loadSkin() + { + renderer.loadSkin(); + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java index bdb1674..570754b 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/GroupRightButtonMenu.java @@ -18,6 +18,7 @@ import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.gui.Container; import net.java.sip.communicator.util.*; +import net.java.sip.communicator.util.skin.*; import org.osgi.framework.*; @@ -25,29 +26,29 @@ import org.osgi.framework.*; * The GroupRightButtonMenu is the menu, opened when user clicks with the right * mouse button on a group in the contact list. Through this menu the user could * add a contact to a group. - * + * * @author Yana Stamcheva + * @author Adam Netocny */ public class GroupRightButtonMenu extends JPopupMenu - implements ActionListener, PluginComponentListener + implements ActionListener, + PluginComponentListener, + Skinnable { private final Logger logger = Logger.getLogger(GroupRightButtonMenu.class); - private final JMenuItem addContactItem = - new JMenuItem(GuiActivator.getResources().getI18NString( - "service.gui.ADD_CONTACT") + "...", new ImageIcon(ImageLoader - .getImage(ImageLoader.ADD_CONTACT_16x16_ICON))); + private final JMenuItem addContactItem + = new JMenuItem(GuiActivator.getResources().getI18NString( + "service.gui.ADD_CONTACT") + "..."); - private final JMenuItem removeGroupItem = - new JMenuItem(GuiActivator.getResources().getI18NString( - "service.gui.REMOVE_GROUP"), new ImageIcon(ImageLoader - .getImage(ImageLoader.DELETE_16x16_ICON))); + private final JMenuItem removeGroupItem + = new JMenuItem(GuiActivator.getResources().getI18NString( + "service.gui.REMOVE_GROUP")); - private final JMenuItem renameGroupItem = - new JMenuItem(GuiActivator.getResources().getI18NString( - "service.gui.RENAME_GROUP"), new ImageIcon(ImageLoader - .getImage(ImageLoader.RENAME_16x16_ICON))); + private final JMenuItem renameGroupItem + = new JMenuItem(GuiActivator.getResources().getI18NString( + "service.gui.RENAME_GROUP")); private final MetaContactGroup group; @@ -84,6 +85,8 @@ public class GroupRightButtonMenu this.renameGroupItem.addActionListener(this); this.removeGroupItem.addActionListener(this); + loadSkin(); + this.initPluginComponents(); } @@ -214,4 +217,19 @@ public class GroupRightButtonMenu this.remove((Component) c.getComponent()); } } + + /** + * Reloads label icons. + */ + public void loadSkin() + { + addContactItem.setIcon(new ImageIcon(ImageLoader + .getImage(ImageLoader.ADD_CONTACT_16x16_ICON))); + + removeGroupItem.setIcon(new ImageIcon(ImageLoader + .getImage(ImageLoader.DELETE_16x16_ICON))); + + renameGroupItem.setIcon(new ImageIcon(ImageLoader + .getImage(ImageLoader.RENAME_16x16_ICON))); + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java index 6fbf26d..4d75b1f 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java @@ -27,6 +27,7 @@ import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.gui.Container; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.util.*; +import net.java.sip.communicator.util.skin.*; import net.java.sip.communicator.util.swing.*; import org.osgi.framework.*; @@ -36,12 +37,14 @@ import org.osgi.framework.*; * user could add a subcontact, remove a contact, send message, etc. * * @author Yana Stamcheva + * @author Adam Netocny */ public class MetaContactRightButtonMenu extends JPopupMenu implements ActionListener, PluginComponentListener, - ContactListListener + ContactListListener, + Skinnable { /** * An eclipse generated serial version unique ID @@ -96,31 +99,18 @@ public class MetaContactRightButtonMenu private final JMenuItem addContactItem = new JMenuItem(); - private final JMenuItem callItem = new JMenuItem( - callString, - new ImageIcon(ImageLoader.getImage(ImageLoader.CALL_16x16_ICON))); + private final JMenuItem callItem = new JMenuItem(callString); - private final JMenuItem sendMessageItem = new JMenuItem( - sendMessageString, - new ImageIcon(ImageLoader - .getImage(ImageLoader.SEND_MESSAGE_16x16_ICON))); + private final JMenuItem sendMessageItem = new JMenuItem(sendMessageString); - private final JMenuItem sendFileItem = new JMenuItem( - sendFileString, - new ImageIcon(ImageLoader.getImage(ImageLoader.SEND_FILE_16x16_ICON))); + private final JMenuItem sendFileItem = new JMenuItem(sendFileString); - private final JMenuItem sendSmsItem = new JMenuItem( - sendSmsString, - new ImageIcon(ImageLoader - .getImage(ImageLoader.SEND_MESSAGE_16x16_ICON))); + private final JMenuItem sendSmsItem = new JMenuItem(sendSmsString); private final JMenuItem renameContactItem = new JMenuItem( - renameContactString, - new ImageIcon(ImageLoader.getImage(ImageLoader.RENAME_16x16_ICON))); + renameContactString); - private final JMenuItem viewHistoryItem = new JMenuItem( - viewHistoryString, - new ImageIcon(ImageLoader.getImage(ImageLoader.HISTORY_16x16_ICON))); + private final JMenuItem viewHistoryItem = new JMenuItem(viewHistoryString); private final MetaContact contactItem; @@ -160,6 +150,8 @@ public class MetaContactRightButtonMenu this.init(); this.initMnemonics(); + + loadSkin(); } /** @@ -171,21 +163,6 @@ public class MetaContactRightButtonMenu .getI18NString("service.gui.ADD_CONTACT_TO") + " " + contactItem.getDisplayName()); - this.moveToMenu.setIcon(new ImageIcon(ImageLoader - .getImage(ImageLoader.GROUPS_16x16_ICON))); - - this.addContactItem.setIcon(new ImageIcon(ImageLoader - .getImage(ImageLoader.ADD_CONTACT_16x16_ICON))); - - this.removeContactMenu.setIcon(new ImageIcon(ImageLoader - .getImage(ImageLoader.DELETE_16x16_ICON))); - - this.moveSubcontactMenu.setIcon(new ImageIcon(ImageLoader - .getImage(ImageLoader.MOVE_CONTACT_ICON))); - - this.callContactMenu.setIcon(new ImageIcon(ImageLoader - .getImage(ImageLoader.CALL_16x16_ICON))); - //Initialize moveTo menu. Iterator<MetaContactGroup> groups = GuiActivator.getContactListService().getRoot().getSubgroups(); @@ -780,4 +757,43 @@ public class MetaContactRightButtonMenu protoContact.getPresenceStatus().getStatusIcon()), protoContact.getProtocolProvider()); } + + /** + * Reloads skin related information. + */ + public void loadSkin() + { + callItem.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.CALL_16x16_ICON))); + + sendMessageItem.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.SEND_MESSAGE_16x16_ICON))); + + sendFileItem.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.SEND_FILE_16x16_ICON))); + + sendSmsItem.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.SEND_MESSAGE_16x16_ICON))); + + renameContactItem.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.RENAME_16x16_ICON))); + + viewHistoryItem.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.HISTORY_16x16_ICON))); + + moveToMenu.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.GROUPS_16x16_ICON))); + + addContactItem.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.ADD_CONTACT_16x16_ICON))); + + removeContactMenu.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.DELETE_16x16_ICON))); + + moveSubcontactMenu.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.MOVE_CONTACT_ICON))); + + callContactMenu.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.CALL_16x16_ICON))); + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/MoveSubcontactMessageDialog.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/MoveSubcontactMessageDialog.java index 59107bf..31d483e 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/MoveSubcontactMessageDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/MoveSubcontactMessageDialog.java @@ -15,6 +15,7 @@ import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.main.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.util.skin.*; import net.java.sip.communicator.util.swing.*; /** @@ -24,9 +25,11 @@ import net.java.sip.communicator.util.swing.*; * choosen contact will be moved. * * @author Yana Stamcheva + * @author Adam Netocny */ public class MoveSubcontactMessageDialog extends SIPCommDialog + implements Skinnable { private SIPCommMsgTextArea infoArea = new SIPCommMsgTextArea( GuiActivator.getResources() @@ -36,8 +39,7 @@ public class MoveSubcontactMessageDialog GuiActivator.getResources() .getI18NString("service.gui.MOVE_SUBCONTACT")); - private JLabel iconLabel = new JLabel( - new ImageIcon(ImageLoader.getImage(ImageLoader.INFO_ICON))); + private JLabel iconLabel = new JLabel(); private JButton cancelButton = new JButton( GuiActivator.getResources().getI18NString("service.gui.CANCEL")); @@ -113,6 +115,9 @@ public class MoveSubcontactMessageDialog this.mainPanel.add(buttonsPanel, BorderLayout.SOUTH); this.getContentPane().add(mainPanel); + + loadSkin(); + this.pack(); } @@ -138,15 +143,36 @@ public class MoveSubcontactMessageDialog } } + /** + * Automatically clicks the cancel button when the dialog is closed. + * + * @param isEscaped indicates if the dialog has been closed by pressing the + * Esc key + */ protected void close(boolean isEscaped) { this.cancelButton.doClick(); } + /** + * In addition to setVisible this method would also set the dialog location + * to fit the main frame. + * + * @param isVisible indicates if the component should be visible or not + */ public void setVisible(boolean isVisible) { super.setVisible(isVisible); this.setDialogLocation(mainFrame); } + + /** + * Reloads the icon. + */ + public void loadSkin() + { + iconLabel.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.INFO_ICON))); + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/RenameContactPanel.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/RenameContactPanel.java index a7d65d7..a5335ac 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/RenameContactPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/RenameContactPanel.java @@ -12,6 +12,7 @@ import javax.swing.*; import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.util.skin.*; import net.java.sip.communicator.util.swing.*; /** @@ -19,9 +20,11 @@ import net.java.sip.communicator.util.swing.*; * meta contact. * * @author Yana Stamcheva + * @author Adam Netocny */ public class RenameContactPanel extends TransparentPanel + implements Skinnable { private JLabel uinLabel = new JLabel( GuiActivator.getResources().getI18NString("service.gui.NEW_NAME")); @@ -38,9 +41,7 @@ public class RenameContactPanel private JLabel infoTitleLabel = new JLabel( GuiActivator.getResources().getI18NString("service.gui.RENAME_CONTACT")); - private JLabel iconLabel - = new JLabel(new ImageIcon(ImageLoader - .getImage(ImageLoader.RENAME_DIALOG_ICON))); + private JLabel iconLabel = new JLabel(); private TransparentPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1)); @@ -50,6 +51,8 @@ public class RenameContactPanel /** * Creates an instance of <tt>RenameContactPanel</tt> and initializes it. + * + * @param oldName the old name of the contact to rename */ public RenameContactPanel(String oldName) { @@ -81,6 +84,8 @@ public class RenameContactPanel this.add(iconLabel, BorderLayout.WEST); this.add(rightPanel, BorderLayout.CENTER); + + loadSkin(); } /** @@ -100,4 +105,13 @@ public class RenameContactPanel { this.textField.requestFocus(); } + + /** + * Reloads the icon. + */ + public void loadSkin() + { + iconLabel.setIcon(new ImageIcon(ImageLoader + .getImage(ImageLoader.RENAME_DIALOG_ICON))); + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/RenameGroupPanel.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/RenameGroupPanel.java index f66f71d..cbe8830 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/RenameGroupPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/RenameGroupPanel.java @@ -12,6 +12,7 @@ import javax.swing.*; import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.util.skin.*; import net.java.sip.communicator.util.swing.*; /** @@ -19,9 +20,11 @@ import net.java.sip.communicator.util.swing.*; * meta contact group. * * @author Yana Stamcheva + * @author Adam Netocny */ public class RenameGroupPanel extends TransparentPanel + implements Skinnable { private JLabel uinLabel = new JLabel( GuiActivator.getResources().getI18NString("service.gui.NEW_NAME")); @@ -38,9 +41,7 @@ public class RenameGroupPanel private JLabel infoTitleLabel = new JLabel( GuiActivator.getResources().getI18NString("service.gui.RENAME_GROUP")); - private JLabel iconLabel - = new JLabel(new ImageIcon(ImageLoader.getImage( - ImageLoader.RENAME_DIALOG_ICON))); + private JLabel iconLabel = new JLabel(); private TransparentPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1)); @@ -81,6 +82,8 @@ public class RenameGroupPanel this.add(iconLabel, BorderLayout.WEST); this.add(rightPanel, BorderLayout.CENTER); + + loadSkin(); } /** @@ -100,4 +103,13 @@ public class RenameGroupPanel { this.textField.requestFocus(); } + + /** + * Reloads the icon. + */ + public void loadSkin() + { + iconLabel.setIcon(new ImageIcon(ImageLoader.getImage( + ImageLoader.RENAME_DIALOG_ICON))); + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchField.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchField.java index e69ab3f..8e6743f 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchField.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchField.java @@ -8,18 +8,22 @@ import javax.swing.event.*; import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.main.*; +import net.java.sip.communicator.util.skin.*; import net.java.sip.communicator.util.swing.*; import net.java.sip.communicator.util.swing.event.*; /** * The field shown on the top of the main window, which allows the user to * search for users. + * * @author Yana Stamcheva + * @author Adam Netocny */ public class SearchField extends SIPCommTextField implements TextFieldChangeListener, - FilterQueryListener + FilterQueryListener, + Skinnable { /** * The main application window. @@ -27,6 +31,11 @@ public class SearchField private final MainFrame mainFrame; /** + * SearchFieldUI defs. + */ + private final SearchFieldUI textFieldUI; + + /** * Creates the <tt>SearchField</tt>. * @param frame the main application window */ @@ -37,7 +46,7 @@ public class SearchField this.mainFrame = frame; - SearchFieldUI textFieldUI = new SearchFieldUI(); + textFieldUI = new SearchFieldUI(); textFieldUI.setDeleteButtonEnabled(true); this.setUI(textFieldUI); this.setBorder(null); @@ -179,4 +188,12 @@ public class SearchField query.setQueryListener(null); } + + /** + * Reloads text field UI defs. + */ + public void loadSkin() + { + textFieldUI.loadSkin(); + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFieldUI.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFieldUI.java index 53e341b..9398670 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFieldUI.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/SearchFieldUI.java @@ -11,6 +11,7 @@ import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.main.call.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.util.*; +import net.java.sip.communicator.util.skin.*; import net.java.sip.communicator.util.swing.*; import net.java.sip.communicator.util.swing.plaf.*; @@ -20,9 +21,11 @@ import net.java.sip.communicator.util.swing.plaf.*; * of the editor rectangle according to it. * * @author Yana Stamcheva + * @author Adam Netocny */ public class SearchFieldUI extends SIPCommTextFieldUI + implements Skinnable { /** * The icon indicating that this is a search field. @@ -60,15 +63,7 @@ public class SearchFieldUI */ public SearchFieldUI() { - searchIcon = UtilActivator.getResources() - .getImage("service.gui.icons.SEARCH_ICON"); - - callIcon = UtilActivator.getResources() - .getImage("service.gui.buttons.SEARCH_CALL_ICON").getImage(); - - callRolloverIcon = UtilActivator.getResources() - .getImage("service.gui.buttons.SEARCH_CALL_ROLLOVER_ICON") - .getImage(); + loadSkin(); } /** @@ -318,4 +313,20 @@ public class SearchFieldUI callRolloverIcon.getWidth(null), callRolloverIcon.getHeight(null)); } + + /** + * Reloads UI icons. + */ + public void loadSkin() + { + searchIcon = UtilActivator.getResources() + .getImage("service.gui.icons.SEARCH_ICON"); + + callIcon = UtilActivator.getResources() + .getImage("service.gui.buttons.SEARCH_CALL_ICON").getImage(); + + callRolloverIcon = UtilActivator.getResources() + .getImage("service.gui.buttons.SEARCH_CALL_ROLLOVER_ICON") + .getImage(); + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/SourceContactRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/SourceContactRightButtonMenu.java index af7d8d3..8299c51 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/SourceContactRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/SourceContactRightButtonMenu.java @@ -19,18 +19,33 @@ import net.java.sip.communicator.impl.gui.main.contactlist.contactsource.*; import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.contactsource.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.util.skin.*; import net.java.sip.communicator.util.swing.*; /** * The right button menu for external contact sources. * @see ExternalContactSource + * + * @author Yana Stamcheva + * @author Adam Netocny */ public class SourceContactRightButtonMenu extends JPopupMenu + implements Skinnable { private final SourceContact sourceContact; /** + * Call contact menu. + */ + private SIPCommMenu callContactMenu; + + /** + * Add contact component. + */ + private Component addContactComponent; + + /** * Creates an instance of <tt>SourceContactRightButtonMenu</tt> by * specifying the <tt>SourceContact</tt>, for which this menu is created. * @param sourceContact the <tt>SourceContact</tt>, for which this menu is @@ -55,7 +70,8 @@ public class SourceContactRightButtonMenu if (cDetail != null) add(initCallMenu()); - Component addContactComponent = initAddContactMenu(); + addContactComponent = initAddContactMenu(); + if (addContactComponent != null) add(addContactComponent); } @@ -66,7 +82,7 @@ public class SourceContactRightButtonMenu */ private Component initCallMenu() { - SIPCommMenu callContactMenu = new SIPCommMenu( + callContactMenu = new SIPCommMenu( GuiActivator.getResources().getI18NString("service.gui.CALL")); callContactMenu.setIcon(new ImageIcon(ImageLoader .getImage(ImageLoader.CALL_16x16_ICON))); @@ -107,13 +123,13 @@ public class SourceContactRightButtonMenu */ private Component initAddContactMenu() { - Component addContactComponent = null; + Component addContactComponentTmp = null; List<ContactDetail> details = sourceContact.getContactDetails(); if (details.size() == 1) { - addContactComponent + addContactComponentTmp = new JMenuItem(GuiActivator.getResources().getI18NString( "service.gui.ADD_CONTACT"), new ImageIcon(ImageLoader @@ -121,7 +137,7 @@ public class SourceContactRightButtonMenu final ContactDetail detail = details.get(0); - ((JMenuItem) addContactComponent) + ((JMenuItem) addContactComponentTmp) .addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -134,7 +150,7 @@ public class SourceContactRightButtonMenu // item for each one of them. else if (details.size() > 1) { - addContactComponent + addContactComponentTmp = new JMenu(GuiActivator.getResources().getI18NString( "service.gui.ADD_CONTACT")); @@ -146,7 +162,7 @@ public class SourceContactRightButtonMenu JMenuItem addMenuItem = new JMenuItem(detail.getContactAddress()); - ((JMenu) addContactComponent).add(addMenuItem); + ((JMenu) addContactComponentTmp).add(addMenuItem); addMenuItem.addActionListener(new ActionListener() { @@ -157,7 +173,8 @@ public class SourceContactRightButtonMenu }); } } - return addContactComponent; + + return addContactComponentTmp; } /** @@ -226,4 +243,19 @@ public class SourceContactRightButtonMenu // } // return callContactMenu; // } + + /** + * Reloads icons for menu items. + */ + public void loadSkin() + { + callContactMenu.setIcon(new ImageIcon(ImageLoader + .getImage(ImageLoader.CALL_16x16_ICON))); + + if(addContactComponent instanceof JMenuItem) + { + ((JMenuItem) addContactComponent).setIcon(new ImageIcon(ImageLoader + .getImage(ImageLoader.ADD_CONTACT_16x16_ICON))); + } + } } diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/UnknownContactPanel.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/UnknownContactPanel.java index c16dc4f..85ef51b 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/UnknownContactPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/UnknownContactPanel.java @@ -17,6 +17,7 @@ import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.main.*; import net.java.sip.communicator.impl.gui.main.call.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.util.skin.*; import net.java.sip.communicator.util.swing.*; import net.java.sip.communicator.util.swing.event.*; @@ -27,20 +28,18 @@ import net.java.sip.communicator.util.swing.event.*; * the contact list. * * @author Yana Stamcheva + * @author Adam Netocny */ public class UnknownContactPanel extends TransparentPanel - implements TextFieldChangeListener + implements TextFieldChangeListener, + Skinnable { private final JButton addContact = new JButton( - GuiActivator.getResources().getI18NString("service.gui.ADD_CONTACT"), - GuiActivator.getResources() - .getImage("service.gui.icons.ADD_CONTACT_16x16_ICON")); + GuiActivator.getResources().getI18NString("service.gui.ADD_CONTACT")); private final JButton callContact = new JButton( - GuiActivator.getResources().getI18NString("service.gui.CALL_CONTACT"), - GuiActivator.getResources() - .getImage("service.gui.icons.CALL_16x16_ICON")); + GuiActivator.getResources().getI18NString("service.gui.CALL_CONTACT")); private final JTextPane textArea = new JTextPane(); @@ -128,6 +127,8 @@ public class UnknownContactPanel } } }); + + loadSkin(); } /** @@ -197,4 +198,15 @@ public class UnknownContactPanel this.revalidate(); this.repaint(); } + + /** + * Reloads button resources. + */ + public void loadSkin() + { + addContact.setIcon(GuiActivator.getResources() + .getImage("service.gui.icons.ADD_CONTACT_16x16_ICON")); + callContact.setIcon(GuiActivator.getResources() + .getImage("service.gui.icons.CALL_16x16_ICON")); + } } diff --git a/src/net/java/sip/communicator/plugin/skinmanager/SkinManagerPanel.java b/src/net/java/sip/communicator/plugin/skinmanager/SkinManagerPanel.java index 6fa2f1d..9e930af 100644 --- a/src/net/java/sip/communicator/plugin/skinmanager/SkinManagerPanel.java +++ b/src/net/java/sip/communicator/plugin/skinmanager/SkinManagerPanel.java @@ -35,7 +35,7 @@ public class SkinManagerPanel */ public SkinManagerPanel() { - super(new FlowLayout(FlowLayout.CENTER)); + super(new BorderLayout()); JPanel selectorPanel = new TransparentPanel(); selectorPanel.setLayout(new BoxLayout(selectorPanel, BoxLayout.Y_AXIS)); |