diff --git a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java index 4a0ad5cc4..4eee4dead 100644 --- a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java +++ b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java @@ -34,7 +34,7 @@ import net.java.sip.communicator.util.Logger; /** - * An implementation of the UIService that would give access to + * An implementation of the UIService that gives access to * other bundles to this particular swing ui implementation. * * @author Yana Stamcheva @@ -80,10 +80,14 @@ public UIServiceImpl(MainFrame mainFrame) { } /** - * Implements addComponent in UIService interface. + * Implements addComponent in UIService interface. Stores a plugin component + * and fires a PluginComponentEvent to inform all interested listeners + * that a plugin component has been added. * - * @param containerID - * @param component + * @param containerID The ContainerID of the plugable container. + * @param component The component to add. + * + * @see UIService#addComponent(ContainerID, Object) */ public void addComponent(ContainerID containerID, Object component) throws ClassCastException, IllegalArgumentException { @@ -110,7 +114,9 @@ else if (!(component instanceof Component)) { } /** - * Implements getSupportedContainers in UIService interface. + * Implements UISercie.getSupportedContainers. Returns the + * list of supported containers by this implementation . + * * @see UIService#getSupportedContainers() */ public Iterator getSupportedContainers() { @@ -135,7 +141,10 @@ public Iterator getComponentsForContainer(ContainerID containerID) } /** - * For now this method only invokes addComponent(containerID, component). + * Implements UIService.addComponent(ContainerID, String, Object) + * . For now this method only invokes addComponent(containerID, + * component). + * @see UIService#addComponent(ContainerID, String, Object) */ public void addComponent(ContainerID containerID, String constraint, Object component) throws ClassCastException, @@ -145,6 +154,7 @@ public void addComponent(ContainerID containerID, String constraint, /** * Not yet implemented. + * @see UIService#getConstraintsForContainer(ContainerID) */ public Iterator getConstraintsForContainer(ContainerID containerID) { return null; @@ -197,6 +207,7 @@ private void firePluginEvent(Object pluginComponent, * Checks if the main application window is visible. * @return true if main application window is visible, * false otherwise + * @see UIService#isVisible() */ public boolean isVisible() { return this.mainFrame.isVisible(); @@ -206,6 +217,7 @@ public boolean isVisible() { * Implements setVisible in the UIService interface. * Shows or hides the main application window depending on the parameter * visible. + * @see UIService#setVisible(boolean) */ public void setVisible(boolean visible) { this.mainFrame.setVisible(visible); @@ -214,6 +226,7 @@ public void setVisible(boolean visible) { /** * Implements minimize in the UIService interface. * Minimizes the main application window. + * @see UIService#minimize() */ public void minimize() { this.mainFrame.setExtendedState(JFrame.ICONIFIED); @@ -222,6 +235,7 @@ public void minimize() { /** * Implements maximize in the UIService interface. * Maximizes the main application window. + * @see UIService#maximize() */ public void maximize() { this.mainFrame.setExtendedState(JFrame.MAXIMIZED_BOTH); @@ -230,6 +244,7 @@ public void maximize() { /** * Implements restore in the UIService interface. * Restores the main application window. + * @see UIService#restore() */ public void restore() { this.mainFrame.setExtendedState(JFrame.NORMAL); @@ -238,6 +253,7 @@ public void restore() { /** * Implements resize in the UIService interface. * Resizes the main application window. + * @see UIService#resize(int, int) */ public void resize(int width, int height) { this.mainFrame.setSize(width, height); @@ -246,6 +262,7 @@ public void resize(int width, int height) { /** * Implements move in the UIService interface. * Moves the main application window to the point with coordinates - x, y. + * @see UIService#move(int, int) */ public void move(int x, int y) { this.mainFrame.setLocation(x, y); @@ -255,6 +272,7 @@ public void move(int x, int y) { * Implements getExportedDialogs in the UIService interface. * Returns an iterator over a set of all dialogs exported by this * implementation. + * @see UIService#getExportedDialogs() */ public Iterator getExportedDialogs() { return Collections.unmodifiableMap(exportedDialogs) @@ -265,6 +283,7 @@ public Iterator getExportedDialogs() { * Implements getApplicationDialog in the UIService interface. * Returns the Dialog corresponding to the given * DialogID. + * @see UIService#getApplicationDialog(DialogID) */ public ExportedDialog getApplicationDialog(DialogID dialogID) { if (exportedDialogs.contains(dialogID)) { @@ -277,13 +296,17 @@ public ExportedDialog getApplicationDialog(DialogID dialogID) { * Implements getPopupDialog in the UIService interface. * Returns a PopupDialog that could be used to show simple * messages, warnings, errors, etc. + * @see UIService#getPopupDialog() */ public PopupDialog getPopupDialog() { return this.popupDialog; } /** - * Implements getChatDialog in the UIService interface. + * Implements getChatDialog in the UIService interface. If + * a chat dialog for the given contact exists already returns it, + * otherwise creates a new one. + * @see UIService#getChatDialog(Contact) */ public ExportedDialog getChatDialog(Contact contact) { @@ -294,7 +317,7 @@ public ExportedDialog getChatDialog(Contact contact) { = contactList.getTabbedChatWindow().getContactChatsTable(); if (contactChats.get(metaContact.getMetaUID()) != null) { - return (ExportedDialog)contactChats.get(metaContact.getMetaUID()); + return (ExportedDialog) contactChats.get(metaContact.getMetaUID()); } else { return contactList.getTabbedChatWindow().createChat( @@ -302,14 +325,28 @@ public ExportedDialog getChatDialog(Contact contact) { } } + /** + * Checks if there's an exported dialog for the given DialogID. + * @see UIService#isDialogExported(DialogID) + */ public boolean isDialogExported(DialogID dialogID) { return exportedDialogs.contains(dialogID); } + /** + * Checks if the plugable container with the given ContainerID is supported + * by this implementation. + * @see UIService#isContainerSupported(ContainerID) + */ public boolean isContainerSupported(ContainerID containderID) { return supportedContainers.contains(containderID); } + /** + * Returns the current implementation of the + * AccountRegistrationWizardContainer. + * @see UIService#getAccountRegWizardContainer() + */ public AccountRegistrationWizardContainer getAccountRegWizardContainer() { return this.wizardContainer; } diff --git a/src/net/java/sip/communicator/impl/gui/utils/StringUtils.java b/src/net/java/sip/communicator/impl/gui/utils/StringUtils.java index 24631e204..efb4ae804 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/StringUtils.java +++ b/src/net/java/sip/communicator/impl/gui/utils/StringUtils.java @@ -11,14 +11,28 @@ import javax.swing.SwingUtilities; /** + * The StringUtils class is used through this ui implementation for + * some special operations with strings. + * * @author Yana Stamcheva */ public class StringUtils { + /** + * Replaces some chars that are special in a regular expression. + * @param text The initial text. + * @return the formatted text + */ public static String replaceSpecialRegExpChars(String text) { return text.replaceAll("([.()^&$*|])", "\\\\$1"); } + /** + * Returns the width in pixels of a text. + * @param c the component where the text is contained + * @param text the text to measure + * @return the width in pixels of a text. + */ public static int getStringWidth(Component c, String text) { return SwingUtilities.computeStringWidth(c .getFontMetrics(Constants.FONT), text);