From 352c5f2509959e5c7ad8806aee67ecebbc60017f Mon Sep 17 00:00:00 2001 From: Lyubomir Marinov Date: Tue, 14 Dec 2010 21:46:52 +0000 Subject: [PATCH] Commits patches to enable the blue theme for the tabs of various pages in Tools > Options provided by Akash Nawani in the dev mailing list thread "Regarding Security Page". --- .../ChatRoomConfigurationWindow.java | 5 ++-- .../impl/neomedia/ZrtpConfigurePanel.java | 9 +++--- .../plugin/accountinfo/AccountInfoPanel.java | 2 +- .../contactinfo/ContactInfoDetailsPanel.java | 2 +- .../jabberaccregwizz/FirstWizardPage.java | 2 +- .../KeybindingsConfigPanel.java | 13 ++++++--- .../SecurityConfigurationPanel.java | 5 ++-- .../SIPAccountRegistrationForm.java | 6 ++-- .../util/swing/SIPCommTabbedPane.java | 28 +++++++++++++------ 9 files changed, 46 insertions(+), 26 deletions(-) diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomConfigurationWindow.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomConfigurationWindow.java index 68bb470af..7fafd73d4 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomConfigurationWindow.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ChatRoomConfigurationWindow.java @@ -74,7 +74,7 @@ public class ChatRoomConfigurationWindow /** * The tabbed pane containing the "General" and "Options" tabs. */ - private JTabbedPane tabbedPane = new SIPCommTabbedPane(false, false); + private final JTabbedPane tabbedPane = new SIPCommTabbedPane(); /** * The panel containing the title. @@ -408,7 +408,7 @@ else if (c instanceof AbstractButton) { boolean isSelected = ((AbstractButton)c).isSelected(); - formField.addValue(new Boolean(isSelected)); + formField.addValue(Boolean.valueOf(isSelected)); } else if (c instanceof JComboBox) { @@ -434,6 +434,7 @@ else if (c instanceof JPanel) new Thread() { + @Override public void run() { try diff --git a/src/net/java/sip/communicator/impl/neomedia/ZrtpConfigurePanel.java b/src/net/java/sip/communicator/impl/neomedia/ZrtpConfigurePanel.java index 6413a9967..ecfef85ed 100644 --- a/src/net/java/sip/communicator/impl/neomedia/ZrtpConfigurePanel.java +++ b/src/net/java/sip/communicator/impl/neomedia/ZrtpConfigurePanel.java @@ -127,8 +127,8 @@ else if (source == mandButton) } else if (source == saveButton) { - Boolean t = new Boolean(active.isTrustedMitM()); - Boolean s = new Boolean(active.isSasSignature()); + Boolean t = Boolean.valueOf(active.isTrustedMitM()); + Boolean s = Boolean.valueOf(active.isSasSignature()); NeomediaActivator.getConfigurationService() .setProperty(TRUSTED_PROP, t); NeomediaActivator.getConfigurationService() @@ -161,7 +161,7 @@ public void itemStateChanged(ItemEvent e) { trustedMitM.addItemListener(itemListener); sasSignature.addItemListener(itemListener); - JTabbedPane algorithmsPane = new JTabbedPane(); + JTabbedPane algorithmsPane = new SIPCommTabbedPane(); algorithmsPane.addTab( resources.getI18NString("impl.media.security.zrtp.PUB_KEYS"), @@ -191,7 +191,8 @@ public void itemStateChanged(ItemEvent e) { private >String getPropertyValue(T algo) { - StringBuffer strb = new StringBuffer(); + StringBuilder strb = new StringBuilder(); + for (T it : active.algos(algo)) { strb.append(it.name()); strb.append(';'); diff --git a/src/net/java/sip/communicator/plugin/accountinfo/AccountInfoPanel.java b/src/net/java/sip/communicator/plugin/accountinfo/AccountInfoPanel.java index 527dcb2a5..afb6af575 100644 --- a/src/net/java/sip/communicator/plugin/accountinfo/AccountInfoPanel.java +++ b/src/net/java/sip/communicator/plugin/accountinfo/AccountInfoPanel.java @@ -43,7 +43,7 @@ public AccountInfoPanel() { super(new BorderLayout()); - JTabbedPane accountsTabbedPane = new SIPCommTabbedPane(false, false); + JTabbedPane accountsTabbedPane = new SIPCommTabbedPane(); for (ProtocolProviderFactory providerFactory : AccountInfoActivator .getProtocolProviderFactories().values()) diff --git a/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java b/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java index 91b55d1c2..6fc1922e6 100644 --- a/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java +++ b/src/net/java/sip/communicator/plugin/contactinfo/ContactInfoDetailsPanel.java @@ -32,7 +32,7 @@ public class ContactInfoDetailsPanel /** * The tabbed pane containing the two different tabs for details. */ - private JTabbedPane tabbedPane = new SIPCommTabbedPane(false, false); + private final JTabbedPane tabbedPane = new SIPCommTabbedPane(); /** * The operation set giving access to the server stored contact details. diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java index dbcc4219a..6fb9fe045 100644 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/FirstWizardPage.java @@ -71,7 +71,7 @@ public FirstWizardPage(JabberAccountRegistrationWizard wizard) */ private void init() { - JTabbedPane tabbedPane = new SIPCommTabbedPane(false, false); + JTabbedPane tabbedPane = new SIPCommTabbedPane(); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); diff --git a/src/net/java/sip/communicator/plugin/keybindingchooser/KeybindingsConfigPanel.java b/src/net/java/sip/communicator/plugin/keybindingchooser/KeybindingsConfigPanel.java index 941db8119..829d65d7d 100644 --- a/src/net/java/sip/communicator/plugin/keybindingchooser/KeybindingsConfigPanel.java +++ b/src/net/java/sip/communicator/plugin/keybindingchooser/KeybindingsConfigPanel.java @@ -51,11 +51,13 @@ public KeybindingsConfigPanel() KeybindingsService service = getKeybindingsService(); setFocusable(true); - JTabbedPane chooserPanes = new JTabbedPane(); + + JTabbedPane chooserPanes = new SIPCommTabbedPane(); // deselects entries awaiting input when focus is lost this.addFocusListener(new FocusAdapter() { + @Override public void focusLost(FocusEvent event) { for (SIPChooser chooser : choosers.values()) @@ -150,6 +152,7 @@ private class SIPChooser new HashMap(); // Calls focus to the form so keyboard events are received + @Override protected void onClick(MouseEvent event, BindingEntry entry, BindingEntry.Field field) { @@ -157,6 +160,7 @@ protected void onClick(MouseEvent event, BindingEntry entry, KeybindingsConfigPanel.this.requestFocus(); } + @Override public boolean putBinding(BindingEntry newEntry, int index) { // Converts to I18N strings for UI @@ -192,10 +196,10 @@ public boolean putBinding(BindingEntry newEntry, int index) */ private String getI18NString(String key) { - StringBuffer newKey = new StringBuffer(); + StringBuilder newKey = new StringBuilder(); + newKey.append("plugin.keybindings."); - char[] keyChars = key.toCharArray(); - for (char keyChar : keyChars) + for (char keyChar : key.toCharArray()) { if (Character.isLowerCase(keyChar)) newKey.append(Character.toUpperCase(keyChar)); @@ -213,6 +217,7 @@ else if (Character.isUpperCase(keyChar)) newKey.toString()); } + @Override public LinkedHashMap getBindingMap() { // Translates I18N strings back to internal action labels diff --git a/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigurationPanel.java b/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigurationPanel.java index cb561fcf4..5a46dbbf1 100644 --- a/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigurationPanel.java +++ b/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigurationPanel.java @@ -7,9 +7,8 @@ import java.awt.*; -import javax.swing.*; - import net.java.sip.communicator.service.gui.*; +import net.java.sip.communicator.util.swing.*; import org.osgi.framework.*; @@ -19,7 +18,7 @@ * @author Yana Stamcheva */ public class SecurityConfigurationPanel - extends JTabbedPane + extends SIPCommTabbedPane implements ServiceListener { /** diff --git a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java index 1086a9e77..7667d2ca5 100644 --- a/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java +++ b/src/net/java/sip/communicator/plugin/sipaccregwizz/SIPAccountRegistrationForm.java @@ -28,7 +28,7 @@ public class SIPAccountRegistrationForm private final SIPAccountRegistrationWizard wizard; - private final JTabbedPane tabbedPane = new SIPCommTabbedPane(false, false); + private final JTabbedPane tabbedPane = new SIPCommTabbedPane(); /** * The panels which value needs validation before we continue. @@ -168,7 +168,9 @@ public boolean isModification() /** * Saves the user input when the "Next" wizard buttons is clicked. + * * @param registration the SIPAccountRegistration + * @return */ public boolean commitPage(SIPAccountRegistration registration) { @@ -342,7 +344,7 @@ public void loadAccount(AccountID accountID) ProtocolProviderFactory.DEFAULT_SIPZRTP_ATTRIBUTE, true); boolean proxyAutoConfigureEnabled = accountID.getAccountPropertyBoolean( - ProtocolProviderFactory.PROXY_AUTO_CONFIG, false);; + ProtocolProviderFactory.PROXY_AUTO_CONFIG, false); String pollingPeriod = accountID.getAccountPropertyString( ProtocolProviderFactory.POLLING_PERIOD); diff --git a/src/net/java/sip/communicator/util/swing/SIPCommTabbedPane.java b/src/net/java/sip/communicator/util/swing/SIPCommTabbedPane.java index 0adbce3b6..938b29833 100644 --- a/src/net/java/sip/communicator/util/swing/SIPCommTabbedPane.java +++ b/src/net/java/sip/communicator/util/swing/SIPCommTabbedPane.java @@ -41,6 +41,11 @@ public class SIPCommTabbedPane private int lastSelectedIndex; + public SIPCommTabbedPane() + { + this(false, false); + } + /** * Creates the CloseAndMaxTabbedPane with an enhanced UI if * enhancedUI parameter is set to true. @@ -75,6 +80,8 @@ public SIPCommTabbedPane(boolean closingTabs, boolean maximizingTabs) /** * Returns the index of the last tab on which the mouse did an action. + * + * @return */ public int getOverTabIndex() { @@ -83,6 +90,8 @@ public int getOverTabIndex() /** * Returns true if the close icon is enabled. + * + * @return */ public boolean isCloseEnabled() { @@ -92,17 +101,19 @@ public boolean isCloseEnabled() /** * Returns true if the max/detach icon is enabled. + * + * @return */ public boolean isMaxEnabled() { - SIPCommTabbedPaneUI ui = (SIPCommTabbedPaneUI) this.getUI(); - return ui.isMaxEnabled(); + return ((SIPCommTabbedPaneUI) getUI()).isMaxEnabled(); } /** * Override JTabbedPane method. Does nothing. * @param tabLayoutPolicy The tab layout policy. */ + @Override public void setTabLayoutPolicy(int tabLayoutPolicy) { } @@ -111,6 +122,7 @@ public void setTabLayoutPolicy(int tabLayoutPolicy) * Override JTabbedPane method. Does nothing. * @param tabPlacement The tab placement. */ + @Override public void setTabPlacement(int tabPlacement) { } @@ -122,8 +134,7 @@ public void setTabPlacement(int tabPlacement) */ public void setCloseIcon(boolean b) { - SIPCommTabbedPaneUI ui = (SIPCommTabbedPaneUI) this.getUI(); - ui.setCloseIcon(b); + ((SIPCommTabbedPaneUI) getUI()).setCloseIcon(b); } /** @@ -133,12 +144,11 @@ public void setCloseIcon(boolean b) */ public void setMaxIcon(boolean b) { - SIPCommTabbedPaneUI ui = (SIPCommTabbedPaneUI) this.getUI(); - ui.setMaxIcon(b); + ((SIPCommTabbedPaneUI) getUI()).setMaxIcon(b); } /** - * Detaches the index tab in a seperate frame. When the frame + * Detaches the index tab in a separate frame. When the frame * is closed, the tab is automatically reinserted into the tabbedPane. * * @param index index of the tabbedPane to be detached @@ -427,9 +437,10 @@ public void firePopupOutsideTabEvent(MouseEvent e) /** * Overrides setSelectedIndex in JTabbedPane in order to remove the - * hightlight if the tab which is selected. + * highlight if the tab which is selected. * @param tabIndex The index of the tab to be selected. */ + @Override public void setSelectedIndex(int tabIndex) { SIPCommTabbedPaneEnhancedUI ui @@ -458,6 +469,7 @@ public void highlightTab(int tabIndex) this.repaint(); } + @Override public void removeTabAt(int index) { if (index < lastSelectedIndex)