diff options
author | Yana Stamcheva <yana@jitsi.org> | 2006-07-19 11:41:44 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2006-07-19 11:41:44 +0000 |
commit | 29cd7cad9a2cfb6300db49b101d8a77db259067f (patch) | |
tree | 595c127aeca10ad863e7780673090aa454ddeaf8 | |
parent | fbc1722a18b5ee446503943d753f0c172b98344a (diff) | |
download | jitsi-29cd7cad9a2cfb6300db49b101d8a77db259067f.zip jitsi-29cd7cad9a2cfb6300db49b101d8a77db259067f.tar.gz jitsi-29cd7cad9a2cfb6300db49b101d8a77db259067f.tar.bz2 |
javadoc comments added
21 files changed, 411 insertions, 147 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/AuthorizationHandlerImpl.java b/src/net/java/sip/communicator/impl/gui/main/AuthorizationHandlerImpl.java index 07ec1d6..90a5fb3 100644 --- a/src/net/java/sip/communicator/impl/gui/main/AuthorizationHandlerImpl.java +++ b/src/net/java/sip/communicator/impl/gui/main/AuthorizationHandlerImpl.java @@ -13,6 +13,17 @@ import net.java.sip.communicator.service.protocol.AuthorizationRequest; import net.java.sip.communicator.service.protocol.AuthorizationResponse; import net.java.sip.communicator.service.protocol.Contact; +/** + * The <tt>AuthorizationHandlerImpl</tt> is an implementation of the + * <tt>AuthorizationHandler</tt> interface, which is used by the protocol + * provider in order to make the user act upon requests coming from contacts + * that would like to add us to their contact list or simply track our presence + * status, or whenever a subscription request has failed for a particular + * contact because we need to first generate an authorization request demanding + * permission to subscibe. + * + * @author Yana Stamcheva + */ public class AuthorizationHandlerImpl extends JDialog implements AuthorizationHandler { @@ -20,12 +31,26 @@ public class AuthorizationHandlerImpl extends JDialog } + /** + * Implements the <tt>AuthorizationHandler.processAuthorisationRequest</tt> + * method. + * <p> + * Called by the protocol provider whenever someone would like to add us to + * their contact list. + */ public AuthorizationResponse processAuthorisationRequest( AuthorizationRequest req, Contact sourceContact) { - // TODO Auto-generated method stub + // TODO Implement this method. return null; } + /** + * Implements the <tt>AuthorizationHandler.createAuthorizationRequest</tt> + * method. + * <p> + * The method is called when the user has tried to add a contact to the + * contact list and this contact requires authorization. + */ public AuthorizationRequest createAuthorizationRequest(Contact contact) { AuthorizationRequest request = new AuthorizationRequest(); @@ -38,6 +63,13 @@ public class AuthorizationHandlerImpl extends JDialog return request; } + /** + * Implements the <tt>AuthorizationHandler.processAuthorizationResponse</tt> + * method. + * <p> + * The method will be called any whenever someone acts upone an authorization + * request that we have previously sent. + */ public void processAuthorizationResponse(AuthorizationResponse response, Contact sourceContact) { // TODO Auto-generated method stub diff --git a/src/net/java/sip/communicator/impl/gui/main/CallPanel.java b/src/net/java/sip/communicator/impl/gui/main/CallPanel.java index 3542244..a754976 100644 --- a/src/net/java/sip/communicator/impl/gui/main/CallPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/CallPanel.java @@ -20,6 +20,10 @@ import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton; import net.java.sip.communicator.impl.gui.utils.ImageLoader; /** + * The <tt>CallPanel</tt> is the panel that contains the "Call" and "Hangup" + * buttons, as well as the field, where user could enter the phone number or + * the contact name of the person, to which he would like to call. + * * @author Yana Stamcheva */ @@ -53,6 +57,10 @@ public class CallPanel extends JPanel implements ActionListener { private MainFrame parentWindow; + /** + * Creates an instance of <tt>CallPanel</tt>. + * @param parentWindow The main application window. + */ public CallPanel(MainFrame parentWindow) { super(new BorderLayout()); @@ -67,6 +75,9 @@ public class CallPanel extends JPanel implements ActionListener { this.init(); } + /** + * Initializes and constructs this panel. + */ private void init() { this.phoneNumberCombo.setEditable(true); @@ -98,10 +109,18 @@ public class CallPanel extends JPanel implements ActionListener { this.hangupButton.setEnabled(false); } + /** + * Returns the combo box, where user enters the phone number to call to. + * @return the combo box, where user enters the phone number to call to. + */ public JComboBox getPhoneNumberCombo() { return phoneNumberCombo; } + /** + * Handles the <tt>ActionEvent</tt> generated when user presses one of the + * buttons in this panel. + */ public void actionPerformed(ActionEvent e) { JButton button = (JButton) e.getSource(); String buttonName = button.getName(); diff --git a/src/net/java/sip/communicator/impl/gui/main/CallReceivePanel.java b/src/net/java/sip/communicator/impl/gui/main/CallReceivePanel.java index 401858b..9be7fc9 100644 --- a/src/net/java/sip/communicator/impl/gui/main/CallReceivePanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/CallReceivePanel.java @@ -23,6 +23,7 @@ import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommButton; import net.java.sip.communicator.impl.gui.utils.ImageLoader; /** + * * @author Yana Stamcheva */ public class CallReceivePanel extends JDialog { diff --git a/src/net/java/sip/communicator/impl/gui/main/CommunicatorMain.java b/src/net/java/sip/communicator/impl/gui/main/CommunicatorMain.java index efaf8f4..e0a26bc 100755 --- a/src/net/java/sip/communicator/impl/gui/main/CommunicatorMain.java +++ b/src/net/java/sip/communicator/impl/gui/main/CommunicatorMain.java @@ -18,7 +18,8 @@ import net.java.sip.communicator.impl.gui.utils.ImageLoader; import net.java.sip.communicator.util.Logger; /** - * Starts the GUI application using the SkinLookAndFeel of l2fprod. + * Starts the GUI application using the SIPCommLookAndFeel with the + * SIPCommDefaultTheme. * * @author Yana Stamcheva */ @@ -28,6 +29,10 @@ public class CommunicatorMain { private Logger logger = Logger.getLogger(CommunicatorMain.class.getName()); + /** + * Creates an instance of <tt>CommunicatorMain</tt>. Creates the + * <tt>MainFrame</tt>. + */ public CommunicatorMain() { this.setDefaultThemePack(); @@ -36,13 +41,14 @@ public class CommunicatorMain { mainFrame = new MainFrame(); - mainFrame.setConfigFrame(configFrame); - // In order to have the same icon when using option panes JOptionPane.getRootFrame().setIconImage( ImageLoader.getImage(ImageLoader.SIP_LOGO)); } + /** + * Sets the look&feel and the theme. + */ public void setDefaultThemePack() { SIPCommLookAndFeel lf = new SIPCommLookAndFeel(); @@ -58,18 +64,21 @@ public class CommunicatorMain { } } + /** + * Shows or hides the main application window. + * + * @param isVisible <code>true</code> to show the main application + * window, <code>false</code> to hide it. + */ public void showCommunicator(boolean isVisible) { this.mainFrame.pack(); this.mainFrame.setVisible(isVisible); } - public static void main(String args[]) { - - CommunicatorMain communicatorMain = new CommunicatorMain(); - - communicatorMain.showCommunicator(true); - } - + /** + * Returns the main application window. + * @return the main application window. + */ public MainFrame getMainFrame() { return mainFrame; } diff --git a/src/net/java/sip/communicator/impl/gui/main/DialPanel.java b/src/net/java/sip/communicator/impl/gui/main/DialPanel.java index 4414603..9c4994c 100755 --- a/src/net/java/sip/communicator/impl/gui/main/DialPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/DialPanel.java @@ -23,9 +23,10 @@ import net.java.sip.communicator.impl.gui.utils.Constants; import net.java.sip.communicator.impl.gui.utils.ImageLoader; /** - * @author Yana Stamcheva + * The <tt>DialPanel</tt> is the panel that contains the buttons to + * dial a phone number. * - * The DialPanel contains the dial buttons. + * @author Yana Stamcheva */ public class DialPanel extends JPanel implements ActionListener { @@ -82,6 +83,9 @@ public class DialPanel extends JPanel implements ActionListener { private JPanel dialPadPanel = new JPanel(new GridLayout(4, 3, 5, 5)); + /** + * Creates an instance of <tt>DialPanel</tt>. + */ public DialPanel() { super(new FlowLayout(FlowLayout.CENTER)); @@ -90,6 +94,9 @@ public class DialPanel extends JPanel implements ActionListener { this.init(); } + /** + * Initializes this panel by adding all dial buttons to it. + */ public void init() { oneButton.setName("one"); twoButton.setName("two"); @@ -146,6 +153,10 @@ public class DialPanel extends JPanel implements ActionListener { this.add(dialPadPanel, BorderLayout.CENTER); } + /** + * Handles the <tt>ActionEvent</tt> triggered when user presses one of + * the dial buttons. + */ public void actionPerformed(ActionEvent e) { JButton button = (JButton) e.getSource(); String buttonName = button.getName(); @@ -187,6 +198,11 @@ public class DialPanel extends JPanel implements ActionListener { this.phoneNumberCombo.requestFocus(); } + /** + * Sets the combo box, where user enters the phone number to call to. + * @param combo The combo box, where user enters the phone number to + * call to. + */ public void setPhoneNumberCombo(JComboBox combo) { this.phoneNumberCombo = combo; } diff --git a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java index 85c8cec..da94496 100755 --- a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java +++ b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java @@ -46,7 +46,11 @@ import net.java.sip.communicator.service.protocol.icqconstants.IcqStatusEnum; import net.java.sip.communicator.util.Logger; /** - * The main application frame. This is the core of the user interface. + * The main application window. This class is the core of this ui + * implementation. It stores all available protocol providers and their + * operation sets, as well as all registered accounts, the + * <tt>MetaContactListService</tt> and all sent messages that aren't + * delivered yet. * * @author Yana Stamcheva */ @@ -60,8 +64,6 @@ public class MainFrame extends JFrame { private Menu menu = new Menu(); - private ConfigurationFrame configFrame = new ConfigurationFrame(); - private CallPanel callPanel; private StatusPanel statusPanel; @@ -88,6 +90,9 @@ public class MainFrame extends JFrame { private Hashtable waitToBeDeliveredMsgs = new Hashtable(); + /** + * Creates an instance of <tt>MainFrame</tt>. + */ public MainFrame() { callPanel = new CallPanel(this); tabbedPane = new MainTabbedPane(this); @@ -133,18 +138,18 @@ public class MainFrame extends JFrame { } /** - * Returns the current meta contactlist. + * Returns the <tt>MetaContactListService</tt>. * - * @return MetaContactListService The current meta contactlist. + * @return <tt>MetaContactListService</tt> The current meta contact list. */ public MetaContactListService getContactList() { return this.contactList; } /** - * Inits the contact list tree. + * Initializes the contact list panel. * - * @param contactList The MetaContactListService containing + * @param contactList The <tt>MetaContactListService</tt> containing * the contact list data. */ public void setContactList(MetaContactListService contactList) { @@ -153,7 +158,7 @@ public class MainFrame extends JFrame { ContactListPanel clistPanel = this.tabbedPane.getContactListPanel(); - clistPanel.initTree(contactList); + clistPanel.initList(contactList); //add a key listener to the tabbed pane, when the contactlist is //initialized @@ -161,14 +166,7 @@ public class MainFrame extends JFrame { .getContactList())); } - public ConfigurationFrame getConfigFrame() { - return configFrame; - } - - public void setConfigFrame(ConfigurationFrame configFrame) { - this.configFrame = configFrame; - } - + /** * Returns a set of all operation sets supported by the given * protocol provider. @@ -183,15 +181,16 @@ public class MainFrame extends JFrame { } /** - * Adds protocol supported operation sets. For now adds the presence and - * instant messaging operation sets. + * Adds all protocol supported operation sets. * - * @param protocolProvider - * @param supportedOperationSets + * @param protocolProvider The protocol provider. */ public void addProtocolSupportedOperationSets( - ProtocolProviderService protocolProvider, Map supportedOperationSets) { + ProtocolProviderService protocolProvider) { + Map supportedOperationSets + = protocolProvider.getSupportedOperationSets(); + this.protocolSupportedOperationSets.put(protocolProvider, supportedOperationSets); @@ -214,7 +213,8 @@ public class MainFrame extends JFrame { presence.addContactPresenceStatusListener( new ContactPresenceStatusAdapter()); - presence.setAuthorizationHandler(new AuthorizationHandlerImpl()); + presence.setAuthorizationHandler( + new AuthorizationHandlerImpl()); try { presence.publishPresenceStatus(IcqStatusEnum.ONLINE, ""); @@ -273,14 +273,15 @@ public class MainFrame extends JFrame { /** * Returns a set of all protocol providers. * - * @return Map a set of all protocol providers. + * @return a set of all protocol providers. */ public Iterator getProtocolProviders() { return this.protocolProviders.iterator(); } /** - * Returns the protocol provider associated to the given account. + * Returns the protocol provider associated to the account given + * by the account user identifier. * * @param accountName The account user identifier. * @return The protocol provider associated to the given account. @@ -302,11 +303,13 @@ public class MainFrame extends JFrame { /** * Adds a protocol provider. - * @param protocolProvider The protocol provider to be added. + * @param protocolProvider The protocol provider to add. */ public void addProtocolProvider(ProtocolProviderService protocolProvider) { this.protocolProviders.add(protocolProvider); + + this.addProtocolSupportedOperationSets(protocolProvider); } /** diff --git a/src/net/java/sip/communicator/impl/gui/main/MainTabbedPane.java b/src/net/java/sip/communicator/impl/gui/main/MainTabbedPane.java index f0f0dfc..79e9d9e 100755 --- a/src/net/java/sip/communicator/impl/gui/main/MainTabbedPane.java +++ b/src/net/java/sip/communicator/impl/gui/main/MainTabbedPane.java @@ -14,8 +14,9 @@ import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommTabbedPane; import net.java.sip.communicator.impl.gui.main.i18n.Messages; /** - * The main tabbed pane containing the contact list panel, the call list panel - * and the dial panel. + * The <tt>MainTabbedPane</tt> is a <tt>SIPCommTabbedPane</tt> that contains + * three tabs: the <tt>ContactListPanel</tt>, the call list panel and + * the <tt>DialPanel</tt>. * * @author Yana Stamcheva */ @@ -25,6 +26,11 @@ public class MainTabbedPane extends SIPCommTabbedPane { private ContactListPanel contactListPanel; + /** + * Constructs the <tt>MainTabbedPane</tt>. + * + * @param parent The main application frame. + */ public MainTabbedPane(MainFrame parent) { super(true); @@ -45,6 +51,10 @@ public class MainTabbedPane extends SIPCommTabbedPane { this.setEnabledAt(2, false); } + /** + * Returns the <tt>ContactListPanel</tt> contained in this tabbed pane. + * @return the <tt>ContactListPanel</tt> contained in this tabbed pane. + */ public ContactListPanel getContactListPanel() { return contactListPanel; } diff --git a/src/net/java/sip/communicator/impl/gui/main/Menu.java b/src/net/java/sip/communicator/impl/gui/main/Menu.java index 04a3398..4e1e6e4 100755 --- a/src/net/java/sip/communicator/impl/gui/main/Menu.java +++ b/src/net/java/sip/communicator/impl/gui/main/Menu.java @@ -7,13 +7,10 @@ package net.java.sip.communicator.impl.gui.main; -import java.awt.Graphics; - import javax.swing.JMenu; import javax.swing.JMenuBar; import net.java.sip.communicator.impl.gui.main.i18n.Messages; -import net.java.sip.communicator.impl.gui.utils.AntialiasingManager; /** * The main menu. @@ -29,10 +26,16 @@ public class Menu extends JMenuBar { private JMenu helpMenu = new JMenu(); + /** + * Creates an instance of <tt>Menu</tt>. + */ public Menu() { this.init(); } + /** + * Constructs the menu. + */ private void init() { userMenu.setText(Messages.getString("file")); userMenu.setMnemonic(Messages.getString("mnemonic.file").charAt(0)); diff --git a/src/net/java/sip/communicator/impl/gui/main/QuickMenu.java b/src/net/java/sip/communicator/impl/gui/main/QuickMenu.java index 0376a25..7ae05ec 100755 --- a/src/net/java/sip/communicator/impl/gui/main/QuickMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/QuickMenu.java @@ -19,6 +19,7 @@ import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JOptionPane; +import net.java.sip.communicator.impl.gui.main.configforms.ConfigurationFrame; import net.java.sip.communicator.impl.gui.main.contactlist.ContactList; import net.java.sip.communicator.impl.gui.main.contactlist.ContactListModel; import net.java.sip.communicator.impl.gui.main.contactlist.addcontact.AddContactWizardPage1; @@ -40,9 +41,14 @@ import net.java.sip.communicator.service.protocol.OperationSetWebContactInfo; import net.java.sip.communicator.service.protocol.ProtocolProviderService; /** - * The QuickMenu is the toolbar on the top of the main program window. - * It contains quick launch buttons for accessing the user info, the - * configuration window, etc. + * The <tt>QuickMenu</tt> is the toolbar on the top of the main + * application window. It provides quick access to the "User info" window, the + * "Configuration" window, the "Add contact" window and the "Hide/Open offline + * contacts" window. + * <p> + * Note that this class implements the <tt>PluginComponentListener</tt>. This + * means that this toolbar is a plugable container and could contain plugin + * components. * * @author Yana Stamcheva */ @@ -61,11 +67,13 @@ public class QuickMenu extends SIPCommToolBar implements ActionListener, private JButton addButton = new JButton(new ImageIcon(ImageLoader .getImage(ImageLoader.QUICK_MENU_ADD_ICON))); + private ConfigurationFrame configFrame = new ConfigurationFrame(); + private MainFrame mainFrame; /** - * Create an instance of the QuickMenu. - * @param mainFrame The parent MainFrame window. + * Create an instance of the <tt>QuickMenu</tt>. + * @param mainFrame The parent <tt>MainFrame</tt> window. */ public QuickMenu(MainFrame mainFrame) { this.mainFrame = mainFrame; @@ -90,7 +98,7 @@ public class QuickMenu extends SIPCommToolBar implements ActionListener, } /** - * Initialize the QuickMenu by adding the buttons. + * Initialize the <tt>QuickMenu</tt> by adding the buttons. */ private void init() { this.add(addButton); @@ -110,6 +118,10 @@ public class QuickMenu extends SIPCommToolBar implements ActionListener, } + /** + * Handles the <tt>ActionEvent</tt> triggered when user clicks on one of + * the buttons in this toolbar. + */ public void actionPerformed(ActionEvent e) { JButton button = (JButton) e.getSource(); String buttonName = button.getName(); @@ -183,9 +195,9 @@ public class QuickMenu extends SIPCommToolBar implements ActionListener, } else if (buttonName.equals("config")) { - mainFrame.getConfigFrame().setCalculatedSize(); + configFrame.setCalculatedSize(); - mainFrame.getConfigFrame().setVisible(true); + configFrame.setVisible(true); } else if (buttonName.equals("search")) { @@ -243,10 +255,18 @@ public class QuickMenu extends SIPCommToolBar implements ActionListener, } } + /** + * Implements the <code>PluginComponentListener.pluginComponentAdded</code> + * method. + */ public void pluginComponentAdded(PluginComponentEvent event) { //TODO Implement pluginComponentAdded. } + /** + * Implements the <code>PluginComponentListener.pluginComponentRemoved</code> + * method. + */ public void pluginComponentRemoved(PluginComponentEvent event) { //TODO Implement pluginComponentRemoved. } diff --git a/src/net/java/sip/communicator/impl/gui/main/RequestAuthorisationDialog.java b/src/net/java/sip/communicator/impl/gui/main/RequestAuthorisationDialog.java index 0569d46..2bf4abc 100644 --- a/src/net/java/sip/communicator/impl/gui/main/RequestAuthorisationDialog.java +++ b/src/net/java/sip/communicator/impl/gui/main/RequestAuthorisationDialog.java @@ -23,7 +23,12 @@ import javax.swing.JScrollPane; import net.java.sip.communicator.impl.gui.main.i18n.Messages; import net.java.sip.communicator.service.protocol.AuthorizationRequest; import net.java.sip.communicator.service.protocol.Contact; - +/** + * The <tt>RequestAuthorisationDialog</tt> is a <tt>JDialog</tt> that is + * shown when user is trying to add a contact, which requires authorization. + * + * @author Yana Stamcheva + */ public class RequestAuthorisationDialog extends JDialog implements ActionListener { @@ -43,6 +48,12 @@ public class RequestAuthorisationDialog extends JDialog private AuthorizationRequest request; + /** + * Constructs the <tt>RequestAuthorisationDialog</tt>. + * + * @param contact The <tt>Contact</tt>, which requires authorisation. + * @param request The <tt>AuthorizationRequest</tt> that will be sent. + */ public RequestAuthorisationDialog(Contact contact, AuthorizationRequest request) { @@ -75,6 +86,10 @@ public class RequestAuthorisationDialog extends JDialog this.getContentPane().add(mainPanel); } + /** + * Handles the <tt>ActionEvent</tt> triggered when one user clicks + * on one of the buttons. + */ public void actionPerformed(ActionEvent e) { JButton button = (JButton)e.getSource(); String name = button.getName(); diff --git a/src/net/java/sip/communicator/impl/gui/main/StatusPanel.java b/src/net/java/sip/communicator/impl/gui/main/StatusPanel.java index 48275f8..ed712c0 100644 --- a/src/net/java/sip/communicator/impl/gui/main/StatusPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/StatusPanel.java @@ -22,8 +22,8 @@ import net.java.sip.communicator.service.protocol.AccountID; import net.java.sip.communicator.service.protocol.ProtocolProviderService; /** - * The StatusPanel is the place where the user can see and change its status - * for all registered protocols. + * The <tt>StatusPanel</tt> is the place where the user can see and change + * its status for all registered protocols. * * @author Yana Stamcheva */ @@ -33,6 +33,10 @@ public class StatusPanel extends JPanel { private MainFrame mainFrame; + /** + * Creates an instance of <tt>StatusPanel</tt>. + * @param mainFrame The main application window. + */ public StatusPanel(MainFrame mainFrame) { this.mainFrame = mainFrame; @@ -40,7 +44,7 @@ public class StatusPanel extends JPanel { this.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); this.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, - Constants.CONTACTPANEL_MOVER_START_COLOR)); + Constants.MOVER_START_COLOR)); } /** @@ -89,8 +93,8 @@ public class StatusPanel extends JPanel { } /** - * Shows the protocol animated icon, indicating that it is in a connecting - * state. + * Shows the protocol animated icon, which indicates that it is in a + * connecting state. * * @param protocolProvider The protocol provider. */ @@ -107,7 +111,7 @@ public class StatusPanel extends JPanel { } /** - * Removes the protocol animated icon, indicating that the connecting + * Removes the protocol animated icon, which indicates that the connecting * process is finished. * * @param protocolProvider The ProtocolProvider. @@ -124,10 +128,10 @@ public class StatusPanel extends JPanel { } /** - * Checks if the given protocol has already its StatusSelectorBox in the - * StatusPanel. + * Checks if the given protocol has already its <tt>StatusSelectorBox</tt> + * in the <tt>StatusPanel</tt>. * - * @param accountID The account id. + * @param accountID The identifier of the account. * @return True if the protcol has already its StatusSelectorBox in the * StatusPanel, False otherwise. */ @@ -136,13 +140,5 @@ public class StatusPanel extends JPanel { return true; else return false; - } - - public MainFrame getMainFrame() { - return mainFrame; - } - - public void setMainFrame(MainFrame mainFrame) { - this.mainFrame = mainFrame; - } + } }
\ No newline at end of file diff --git a/src/net/java/sip/communicator/impl/gui/main/StatusSelectorBox.java b/src/net/java/sip/communicator/impl/gui/main/StatusSelectorBox.java index 788f9aa..42a85b4 100644 --- a/src/net/java/sip/communicator/impl/gui/main/StatusSelectorBox.java +++ b/src/net/java/sip/communicator/impl/gui/main/StatusSelectorBox.java @@ -31,8 +31,9 @@ import net.java.sip.communicator.service.protocol.icqconstants.IcqStatusEnum; import net.java.sip.communicator.util.Logger; /** - * The component containging the list of statuses for a protocol, - * where the user could change its status. + * The <tt>StatusSelectorBox</tt> is a <tt>SIPCommSelectorBox</tt> that contains + * the list of statuses for a protocol provider. This is where the user could + * select its status. * * @author Yana Stamcheva */ @@ -50,6 +51,12 @@ public class StatusSelectorBox extends SIPCommSelectorBox { private Map itemsMap; + /** + * Creates an instance of <tt>StatusSelectorBox</tt>. + * + * @param mainFrame The main application window. + * @param protocolProvider The protocol provider. + */ public StatusSelectorBox(MainFrame mainFrame, ProtocolProviderService protocolProvider) { super(); @@ -58,8 +65,18 @@ public class StatusSelectorBox extends SIPCommSelectorBox { this.protocolProvider = protocolProvider; } + /** + * Creates an instance of <tt>StatusSelectorBox</tt> and initializes + * the selector box with data. + * + * @param mainFrame The main application window. + * @param protocolProvider The protocol provider. + * @param itemsMap The list from which to initialize the selector box. + * @param selectedItem The initially selected item. + */ public StatusSelectorBox(MainFrame mainFrame, - ProtocolProviderService protocolProvider, Map itemsMap, + ProtocolProviderService protocolProvider, + Map itemsMap, Image selectedItem) { super(selectedItem); @@ -72,6 +89,9 @@ public class StatusSelectorBox extends SIPCommSelectorBox { this.init(); } + /** + * Constructs the list of choices of the selector box. + */ public void init() { Iterator iter = itemsMap.entrySet().iterator(); @@ -84,6 +104,10 @@ public class StatusSelectorBox extends SIPCommSelectorBox { } } + /** + * Handles the <tt>ActionEvent</tt> triggered when one of the items + * in the list is selected. + */ private class ItemActionListener implements ActionListener { public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JMenuItem) { @@ -139,11 +163,12 @@ public class StatusSelectorBox extends SIPCommSelectorBox { JOptionPane.ERROR_MESSAGE); } else if (e1.getErrorCode() - == OperationFailedException.NETWORK_FAILURE) { + == OperationFailedException + .NETWORK_FAILURE) { SIPCommMsgTextArea msgText = new SIPCommMsgTextArea( Messages.getString( - "statusChangeNetworkFailure")); + "statusChangeNetworkFailure")); JOptionPane.showMessageDialog( null, @@ -152,7 +177,8 @@ public class StatusSelectorBox extends SIPCommSelectorBox { JOptionPane.ERROR_MESSAGE); } else if (e1.getErrorCode() - == OperationFailedException.PROVIDER_NOT_REGISTERED) { + == OperationFailedException + .PROVIDER_NOT_REGISTERED) { SIPCommMsgTextArea msgText = new SIPCommMsgTextArea( Messages.getString( @@ -174,6 +200,13 @@ public class StatusSelectorBox extends SIPCommSelectorBox { } } + /** + * Starts the timer that changes the images given by the array, thus + * creating an animated image that indicates that the user is connecting. + * + * @param images A <tt>BufferedImage</tt> array that contains all images + * from which to create the animated image indicating the connecting state. + */ public void startConnecting(BufferedImage[] images) { this.animatedImageArray = images; @@ -183,11 +216,18 @@ public class StatusSelectorBox extends SIPCommSelectorBox { this.connecting.start(); } + /** + * Stops the timer that manages the connecting animated icon. + */ public void stopConnecting() { this.connecting.stop(); } + /** + * A <tt>Timer</tt> that creates an animated icon, which indicates the + * connecting state. + */ private class Connecting extends Timer { public Connecting() { diff --git a/src/net/java/sip/communicator/impl/gui/main/WelcomeWindow.java b/src/net/java/sip/communicator/impl/gui/main/WelcomeWindow.java index 06a5919..39175b6 100644 --- a/src/net/java/sip/communicator/impl/gui/main/WelcomeWindow.java +++ b/src/net/java/sip/communicator/impl/gui/main/WelcomeWindow.java @@ -39,6 +39,10 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.BundleException; /** + * The <tt>WelcomeWindow</tt> is the window shown at the very beginning, + * when the application is run and indicates that the current version is + * not a final release and may not work as expected. + * * @author Yana Stamcheva */ public class WelcomeWindow extends JDialog @@ -69,6 +73,13 @@ public class WelcomeWindow extends JDialog private Logger logger = Logger.getLogger(WelcomeWindow.class.getName()); + /** + * Constructs the <tt>WelcomeWindow</tt>. + * @param c The application main class that runs the main application + * window. + * @param loginManager The login manager that runs all login windows. + * @param context The bundle context. + */ public WelcomeWindow(CommunicatorMain c, LoginManager loginManager, BundleContext context) { super(c.getMainFrame(), Messages.getString("warning")); @@ -120,10 +131,20 @@ public class WelcomeWindow extends JDialog KeyEvent.ALT_DOWN_MASK), "exit"); } + /** + * Sets a transparent background to some components, because of the + * background image of this window. + * + * @param transparent <code>true</code> to make components transparent, + * <code>false</code> otherwise. + */ private void setTransparent(boolean transparent) { this.buttonPanel.setOpaque(!transparent); } + /** + * Shows this window. + */ public void showWindow() { this.pack(); @@ -133,6 +154,9 @@ public class WelcomeWindow extends JDialog this.setVisible(true); } + /** + * Sets the location of this window. + */ private void setWindowLocation() { int x = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() @@ -144,6 +168,9 @@ public class WelcomeWindow extends JDialog this.setLocation(x, y); } + /** + * Constructs the window background in order to have a background image. + */ private class WindowBackground extends JPanel { private Image bgImage @@ -169,6 +196,10 @@ public class WelcomeWindow extends JDialog } } + /** + * Handles the <tt>ActionEvent</tt> triggered when user clicks on one + * of the buttons. + */ public void actionPerformed(ActionEvent e) { if (e.getSource().equals(continueButton)) { this.dispose(); @@ -184,12 +215,21 @@ public class WelcomeWindow extends JDialog } } + /** + * The <tt>RunLogin</tt> implements the Runnable interface and is used to + * shows the login windows in new thread. + */ private class RunLogin implements Runnable { public void run() { loginManager.showLoginWindows(communicator.getMainFrame()); } } + /** + * The <tt>CloseAction</tt> is an <tt>AbstractAction</tt> that + * closes this <tt>WelcomeWindow</tt> and shows the main application + * window and the login windows. + */ private class CloseAction extends AbstractAction { public void actionPerformed(ActionEvent e) { dispose(); @@ -198,6 +238,10 @@ public class WelcomeWindow extends JDialog } }; + /** + * The <tt>ExitAction</tt> is an <tt>AbstractAction</tt> that + * exits the application. + */ private class ExitAction extends AbstractAction { public void actionPerformed(ActionEvent e) { try { diff --git a/src/net/java/sip/communicator/impl/gui/main/message/ChatContactPanel.java b/src/net/java/sip/communicator/impl/gui/main/message/ChatContactPanel.java index 321af6e..2a3862f 100644 --- a/src/net/java/sip/communicator/impl/gui/main/message/ChatContactPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/message/ChatContactPanel.java @@ -151,27 +151,27 @@ public class ChatContactPanel extends JPanel { Graphics2D g2 = (Graphics2D) g; 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); + Constants.MOVER_START_COLOR, this.getWidth() / 2, + Constants.GRADIENT_SIZE, + Constants.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); + - Constants.GRADIENT_SIZE, + Constants.MOVER_END_COLOR, this.getWidth() / 2, + this.getHeight(), Constants.MOVER_START_COLOR); g2.setPaint(p); g2 .fillRect(0, 0, this.getWidth(), - Constants.CONTACTPANEL_GRADIENT_SIZE); + Constants.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.setColor(Constants.MOVER_END_COLOR); + g2.fillRect(0, Constants.GRADIENT_SIZE, this.getWidth(), + this.getHeight() - Constants.GRADIENT_SIZE); g2.setPaint(p1); - g2.fillRect(0, this.getHeight() - Constants.CONTACTPANEL_GRADIENT_SIZE + g2.fillRect(0, this.getHeight() - Constants.GRADIENT_SIZE - 1, this.getWidth(), this.getHeight() - 1); } diff --git a/src/net/java/sip/communicator/impl/gui/main/message/ChatConversationPanel.java b/src/net/java/sip/communicator/impl/gui/main/message/ChatConversationPanel.java index 5e2a322..fd9cab1 100755 --- a/src/net/java/sip/communicator/impl/gui/main/message/ChatConversationPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/message/ChatConversationPanel.java @@ -375,7 +375,7 @@ public class ChatConversationPanel extends JScrollPane implements } else if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) { String href = e.getDescription(); - this.chatPanel.setChatStatus(href); + this.chatPanel.setChatStatusMessage(href); this.currentHref = href; /* @@ -396,7 +396,7 @@ public class ChatConversationPanel extends JScrollPane implements } else if (e.getEventType() == HyperlinkEvent.EventType.EXITED) { - this.chatPanel.setChatStatus(""); + this.chatPanel.setChatStatusMessage(""); this.currentHref = ""; /* * Tooltip on hyperlinks - JDK1.5+ @@ -418,7 +418,7 @@ public class ChatConversationPanel extends JScrollPane implements Graphics2D g2 = (Graphics2D) g; - g2.setColor(Constants.MSG_WINDOW_BORDER_COLOR); + g2.setColor(Constants.BLUE_GRAY_BORDER_COLOR); g2.setStroke(new BasicStroke(1.5f)); g2.drawRoundRect(3, 3, this.getWidth() - 7, this.getHeight() - 5, 8, 8); diff --git a/src/net/java/sip/communicator/impl/gui/main/message/ChatSendPanel.java b/src/net/java/sip/communicator/impl/gui/main/message/ChatSendPanel.java index d1aa545..7c49813 100755 --- a/src/net/java/sip/communicator/impl/gui/main/message/ChatSendPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/message/ChatSendPanel.java @@ -19,12 +19,10 @@ import java.util.Iterator; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; -import javax.swing.JEditorPane; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; -import javax.swing.SwingUtilities; import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommMsgTextArea; import net.java.sip.communicator.impl.gui.main.customcontrols.SIPCommSelectorBox; @@ -38,10 +36,11 @@ import net.java.sip.communicator.service.protocol.Message; import net.java.sip.communicator.service.protocol.OperationSetBasicInstantMessaging; /** - * The ChatSendPanel is the panel in the bottom of the chat. It contains - * the send button, the status panel, where typing notifications are + * The <tt>ChatSendPanel</tt> is the panel in the bottom of the chat. It + * contains the send button, the status panel, where typing notifications are * shown and the selector box, where the protocol specific contact is * choosen. + * * @author Yana Stamcheva */ public class ChatSendPanel extends JPanel implements ActionListener { @@ -61,8 +60,8 @@ public class ChatSendPanel extends JPanel implements ActionListener { private SIPCommSelectorBox contactSelectorBox = new SIPCommSelectorBox(); /** - * Creates an instance of ChatSendPanel. - * @param chatPanel The parent ChatPanel. + * Creates an instance of <tt>ChatSendPanel</tt>. + * @param chatPanel The parent <tt>ChatPanel</tt>. */ public ChatSendPanel(ChatPanel chatPanel) { @@ -84,7 +83,7 @@ public class ChatSendPanel extends JPanel implements ActionListener { } /** - * Overrides the javax.swing.JComponent.paint() to provide + * Overrides the <code>javax.swing.JComponent.paint()</code> to provide * a new round border for the status panel. * @param g The Graphics object. */ @@ -95,7 +94,7 @@ public class ChatSendPanel extends JPanel implements ActionListener { Graphics2D g2 = (Graphics2D) g; - g2.setColor(Constants.CONTACTPANEL_MOVER_START_COLOR); + g2.setColor(Constants.MOVER_START_COLOR); g2.setStroke(new BasicStroke(1f)); g2.drawRoundRect(3, 4, this.statusPanel.getWidth() - 2, @@ -104,7 +103,7 @@ public class ChatSendPanel extends JPanel implements ActionListener { /** * Defines actions when send button is pressed. - * @param e The ActionEvent object. + * @param e The <tt>ActionEvent</tt> object. */ public void actionPerformed(ActionEvent e) { @@ -146,6 +145,12 @@ public class ChatSendPanel extends JPanel implements ActionListener { return sendButton; } + /** + * Initializes the <tt>ContactSelectorBox</tt> with all protocol + * specific contacts for the given <tt>MetaContact</tt>. + * + * @param metaContact The <tt>MetaContact</tt>. + */ public void addProtocolContacts(MetaContact metaContact) { Iterator protocolContacts = metaContact.getContacts(); @@ -165,11 +170,11 @@ public class ChatSendPanel extends JPanel implements ActionListener { } /** - * Sets a text to the status panel at the bottom of the chat window. - * - * @param statusMessage The text to be displayed. + * Sets the message text to the status panel in the bottom of the chat + * window. Used to show typing notification messages, links' hrefs, etc. + * @param statusMessage The message text to be displayed. */ - public void setChatStatus(String statusMessage) { + public void setChatStatusMessage(String statusMessage) { int stringWidth = StringUtils .getStringWidth(statusLabel, statusMessage); @@ -190,6 +195,13 @@ public class ChatSendPanel extends JPanel implements ActionListener { statusLabel.setText(statusMessage); } + /** + * Selects the given protocol contact from the list of protocol specific + * contacts and shows its icon in the component on the left of the "Send" + * button. + * + * @param protocolContact The protocol specific contact to select. + */ public void setSelectedProtocolContact(Contact protocolContact) { contactSelectorBox.setIcon(new ImageIcon(Constants .getProtocolIcon(protocolContact.getProtocolProvider() @@ -197,6 +209,9 @@ public class ChatSendPanel extends JPanel implements ActionListener { contactSelectorBox.setSelectedObject(protocolContact); } + /** + * The listener of the protocol contact's selector box. + */ private class ProtocolItemListener implements ActionListener { public void actionPerformed(ActionEvent e) { JMenuItem menuItem = (JMenuItem) e.getSource(); @@ -219,6 +234,10 @@ public class ChatSendPanel extends JPanel implements ActionListener { } } + /** + * Returns the protocol contact selector box. + * @return the protocol contact selector box. + */ public SIPCommSelectorBox getContactSelectorBox() { return contactSelectorBox; } diff --git a/src/net/java/sip/communicator/impl/gui/main/message/ChatWritePanel.java b/src/net/java/sip/communicator/impl/gui/main/message/ChatWritePanel.java index 0ede5d4..d860996 100755 --- a/src/net/java/sip/communicator/impl/gui/main/message/ChatWritePanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/message/ChatWritePanel.java @@ -21,12 +21,10 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.BorderFactory; -import javax.swing.JButton; import javax.swing.JEditorPane; import javax.swing.JScrollPane; import javax.swing.SwingUtilities; import javax.swing.Timer; - import javax.swing.event.UndoableEditEvent; import javax.swing.event.UndoableEditListener; import javax.swing.text.StyledEditorKit; @@ -34,14 +32,16 @@ import javax.swing.undo.CannotRedoException; import javax.swing.undo.CannotUndoException; import javax.swing.undo.UndoManager; -import net.java.sip.communicator.impl.gui.main.message.menu.ChatRightButtonMenu; import net.java.sip.communicator.impl.gui.main.message.menu.WritePanelRightButtonMenu; import net.java.sip.communicator.impl.gui.utils.AntialiasingManager; import net.java.sip.communicator.impl.gui.utils.Constants; import net.java.sip.communicator.service.protocol.OperationSetTypingNotifications; import net.java.sip.communicator.util.Logger; /** - * The ChatWritePanel is the panel, where user write his messages. + * The <tt>ChatWritePanel</tt> is the panel, where user writes her messages. + * It is located at the bottom of the split in the <tt>ChatPanel</tt> and + * it contains an editor, where user writes the text. + * * @author Yana Stamcheva */ public class ChatWritePanel extends JScrollPane implements @@ -67,8 +67,8 @@ public class ChatWritePanel extends JScrollPane implements private WritePanelRightButtonMenu rightButtonMenu; /** - * Creates an instance of ChatWritePanel. - * @param chatPanel The parent ChatPanel. + * Creates an instance of <tt>ChatWritePanel</tt>. + * @param chatPanel The parent <tt>ChatPanel</tt>. */ public ChatWritePanel(ChatPanel chatPanel) { @@ -99,7 +99,7 @@ public class ChatWritePanel extends JScrollPane implements } /** - * Overrides the javax.swing.JComponent.paint() in order + * Overrides the <code>javax.swing.JComponent.paint()</code> in order * to privide a round border. * @param g The Graphics object. */ @@ -111,22 +111,24 @@ public class ChatWritePanel extends JScrollPane implements Graphics2D g2 = (Graphics2D) g; - g2.setColor(Constants.MSG_WINDOW_BORDER_COLOR); + g2.setColor(Constants.BLUE_GRAY_BORDER_COLOR); g2.setStroke(new BasicStroke(1.5f)); g2.drawRoundRect(3, 3, this.getWidth() - 4, this.getHeight() - 4, 8, 8); } /** - * Returns the editor panel in this panel. - * @return The editor panel in this panel. + * Returns the editor panel, contained in this <tt>ChatWritePanel</tt>. + * @return The editor panel, contained in this <tt>ChatWritePanel</tt>. */ public JEditorPane getEditorPane() { return editorPane; } /** - * @param e The UndoableEditEvent. + * Handles the <tt>UndoableEditEvent</tt>, by adding the content edit + * to the <tt>UndoManager</tt>. + * @param e The <tt>UndoableEditEvent</tt>. */ public void undoableEditHappened(UndoableEditEvent e) { this.undo.addEdit(e.getEdit()); @@ -157,6 +159,13 @@ public class ChatWritePanel extends JScrollPane implements public void keyTyped(KeyEvent e) { } + /** + * When CTRL+Z is pressed invokes the <code>ChatWritePanel.undo()</code> + * method, when CTRL+R is pressed invokes the + * <code>ChatWritePanel.redo()</code> method. + * <p> + * Sends typing notifications when user types. + */ public void keyPressed(KeyEvent e) { if ((e.getModifiers() & KeyEvent.CTRL_MASK) == KeyEvent.CTRL_MASK && (e.getKeyCode() == KeyEvent.VK_Z)) { @@ -192,6 +201,9 @@ public class ChatWritePanel extends JScrollPane implements public void keyReleased(KeyEvent e) { } + /** + * Listens for <code>stoppedTypingTimer</tt> events. + */ private class Timer1ActionListener implements ActionListener { public void actionPerformed(ActionEvent e) { typingTimer.stop(); @@ -208,6 +220,9 @@ public class ChatWritePanel extends JScrollPane implements } } + /** + * Listens for <code>typingTimer</tt> events. + */ private class Timer2ActionListener implements ActionListener { public void actionPerformed(ActionEvent e) { if (typingState == OperationSetTypingNotifications.STATE_TYPING) { @@ -229,6 +244,10 @@ public class ChatWritePanel extends JScrollPane implements stoppedTypingTimer.stop(); } + /** + * Opens the <tt>WritePanelRightButtonMenu</tt> whe user clicks with the + * right mouse button on the editor area. + */ public void mouseClicked(MouseEvent e) { if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0) { Point p = e.getPoint(); diff --git a/src/net/java/sip/communicator/impl/gui/main/message/MenusPanel.java b/src/net/java/sip/communicator/impl/gui/main/message/MenusPanel.java index 6d5a29a..72b6002 100644 --- a/src/net/java/sip/communicator/impl/gui/main/message/MenusPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/message/MenusPanel.java @@ -16,7 +16,8 @@ import net.java.sip.communicator.impl.gui.main.message.menu.MessageWindowMenuBar import net.java.sip.communicator.impl.gui.main.message.toolBars.EditTextToolBar; import net.java.sip.communicator.impl.gui.main.message.toolBars.MainToolBar; /** - * MenusPanel is the panel, containing all toolbars in the chat window. + * The <tt>MenusPanel</tt> is the panel, containing all toolbars in the chat + * window. * @author Yana Stamcheva */ public class MenusPanel extends JPanel { @@ -30,8 +31,8 @@ public class MenusPanel extends JPanel { private ChatWindow parentWindow; /** - * Creates an instance and constructs the MenusPanel. - * @param parentWindow The parent ChatWindow for this panel. + * Creates an instance and constructs the <tt>MenusPanel</tt>. + * @param parentWindow The parent <tt>ChatWindow</tt> for this panel. */ public MenusPanel(ChatWindow parentWindow) { @@ -50,13 +51,17 @@ public class MenusPanel extends JPanel { } /** - * Adds a new toolbar to this MenusPanel. + * Adds a new toolbar to this <tt>MenusPanel</tt>. * @param toolBar The toolbar to add. */ public void addToolBar(JToolBar toolBar) { this.add(toolBar); } + /** + * Returns the <tt>MainToolBar</tt>. + * @return the <tt>MainToolBar</tt>. + */ public MainToolBar getMainToolBar() { return mainToolBar; } diff --git a/src/net/java/sip/communicator/impl/gui/main/message/SmiliesSelectorBox.java b/src/net/java/sip/communicator/impl/gui/main/message/SmiliesSelectorBox.java index e0ddf5c..7a17925 100644 --- a/src/net/java/sip/communicator/impl/gui/main/message/SmiliesSelectorBox.java +++ b/src/net/java/sip/communicator/impl/gui/main/message/SmiliesSelectorBox.java @@ -20,28 +20,32 @@ import net.java.sip.communicator.impl.gui.utils.ImageLoader; import net.java.sip.communicator.impl.gui.utils.Smiley; /** - * SmiliesSelectorBox is the component where user could choose a smily to send. + * The <tt>SmiliesSelectorBox</tt> is the component where user could choose + * a smily icon to send. * * @author Yana Stamcheva */ -public class SmiliesSelectorBox extends BoxPopupMenu implements ActionListener { +public class SmiliesSelectorBox extends BoxPopupMenu + implements ActionListener { - private ChatWindow messageWindow; + private ChatWindow chatWindow; private ArrayList imageList; /** - * Creates an instance of this SmiliesSelectorBox and initializes the panel - * with the smily icons given by the incoming imageList. + * Creates an instance of this <tt>SmiliesSelectorBox</tt> and initializes + * the panel with the smily icons given by the incoming imageList. * * @param imageList The pack of smily icons. */ - public SmiliesSelectorBox(ArrayList imageList) { + public SmiliesSelectorBox(ArrayList imageList, ChatWindow chatWindow) { super(imageList.size()); - + this.imageList = imageList; + this.chatWindow = chatWindow; + for (int i = 0; i < imageList.size(); i++) { Smiley smiley = (Smiley) this.imageList.get(i); @@ -58,6 +62,10 @@ public class SmiliesSelectorBox extends BoxPopupMenu implements ActionListener { } + /** + * Writes the symbol corresponding to a choosen smily icon to the write + * message area at the end of the current text. + */ public void actionPerformed(ActionEvent e) { JButton imageButton = (JButton) e.getSource(); @@ -69,7 +77,7 @@ public class SmiliesSelectorBox extends BoxPopupMenu implements ActionListener { if (buttonText.equals(smiley.getSmileyStrings()[0])) { - ChatPanel chatPanel = this.messageWindow + ChatPanel chatPanel = this.chatWindow .getCurrentChatPanel(); chatPanel.addTextInWriteArea( @@ -79,12 +87,4 @@ public class SmiliesSelectorBox extends BoxPopupMenu implements ActionListener { } } } - - public ChatWindow getMessageWindow() { - return messageWindow; - } - - public void setMessageWindow(ChatWindow messageWindow) { - this.messageWindow = messageWindow; - } } diff --git a/src/net/java/sip/communicator/impl/gui/utils/AntialiasingManager.java b/src/net/java/sip/communicator/impl/gui/utils/AntialiasingManager.java index fc0a2ea..c329007 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/AntialiasingManager.java +++ b/src/net/java/sip/communicator/impl/gui/utils/AntialiasingManager.java @@ -11,8 +11,21 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; +/** + * Through the <tt>AntialiasingManager</tt> the developer could activate the + * antialiasing mechanism when painting. The method that do the job is + * the <code>activateAntialiasing</code> method. It takes a <tt>Graphics</tt> + * object and activates the antialiasing for it. + * + * @author Yana Stamcheva + */ public class AntialiasingManager { + /** + * Activates the antialiasing mechanism for the given <tt>Graphics</tt> + * object. + * @param g The <tt>Graphics</tt> object. + */ public static void activateAntialiasing(Graphics g) { Graphics2D g2d = (Graphics2D) g; diff --git a/src/net/java/sip/communicator/impl/gui/utils/BrowserLauncher.java b/src/net/java/sip/communicator/impl/gui/utils/BrowserLauncher.java index e96ddf9..cc2b722 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/BrowserLauncher.java +++ b/src/net/java/sip/communicator/impl/gui/utils/BrowserLauncher.java @@ -6,17 +6,6 @@ */ package net.java.sip.communicator.impl.gui.utils; - -// /////////////////////////////////////////////////////// -// Bare Bones Browser Launch // -// Version 1.5 // -// December 10, 2005 // -// Supports: Mac OS X, GNU/Linux, Unix, Windows XP // -// Example Usage: // -// String url = "http://www.centerkey.com/"; // -// BareBonesBrowserLaunch.openURL(url); // -// Public Domain Software -- Free to Use as You Like // -// /////////////////////////////////////////////////////// /* * The content of this file was based on code borrowed from * http://www.centerkey.com/. @@ -24,14 +13,25 @@ package net.java.sip.communicator.impl.gui.utils; import java.lang.reflect.Method; import javax.swing.JOptionPane; +import net.java.sip.communicator.impl.gui.main.i18n.Messages; + /** + * Launches a browser, depending on the operation system and the browsers + * available. + * * @author Yana Stamcheva */ public class BrowserLauncher { private static final String errMsg - = "Error attempting to launch web browser"; + = Messages.getString("launchBrowserError"); + /** + * Launches a browser for the given url, depending on the operation system + * and the browsers available. + * + * @param url The url to open in the browser. + */ public static void openURL(String url) { String osName = System.getProperty("os.name"); try { @@ -50,7 +50,7 @@ public class BrowserLauncher { String browser = null; for (int count = 0; count < browsers.length && browser == null; count++) { - if (Runtime.getRuntime().exec(new String[] { + if (Runtime.getRuntime().exec(new String[] { "which", browsers[count] }).waitFor() == 0) browser = browsers[count]; } |