diff --git a/src/net/java/sip/communicator/impl/gui/GuiActivator.java b/src/net/java/sip/communicator/impl/gui/GuiActivator.java index 50da1e4ef..cd6877b82 100644 --- a/src/net/java/sip/communicator/impl/gui/GuiActivator.java +++ b/src/net/java/sip/communicator/impl/gui/GuiActivator.java @@ -18,7 +18,9 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; -/** +/** + * The GUI Activator class. + * * @author Yana Stamcheva */ public class GuiActivator implements BundleActivator { @@ -30,6 +32,12 @@ public class GuiActivator implements BundleActivator { private LoginManager loginManager; + /** + * Called when this bundle is started. + * + * @param context The execution context of the bundle being started. + * @throws Exception If + */ public void start(BundleContext bundleContext) throws Exception { MainFrame mainFrame = communicatorMain.getMainFrame(); @@ -75,10 +83,24 @@ public void start(BundleContext bundleContext) throws Exception { } } + /** + * Called when this bundle is stopped so the Framework can perform the + * bundle-specific activities necessary to stop the bundle. + * + * @param context The execution context of the bundle being stopped. + * @throws Exception If this method throws an exception, the bundle is + * still marked as stopped, and the Framework will remove the bundle's + * listeners, unregister all services registered by the bundle, and + * release all services used by the bundle. + */ public void stop(BundleContext bundleContext) throws Exception { logger.info("UI Service ...[STOPPED]"); } + /** + * The RunLogin 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(communicatorMain.getMainFrame()); diff --git a/src/net/java/sip/communicator/impl/gui/PopupDialogImpl.java b/src/net/java/sip/communicator/impl/gui/PopupDialogImpl.java index fe904f2f2..1827d18ac 100644 --- a/src/net/java/sip/communicator/impl/gui/PopupDialogImpl.java +++ b/src/net/java/sip/communicator/impl/gui/PopupDialogImpl.java @@ -12,7 +12,7 @@ import net.java.sip.communicator.service.gui.PopupDialog; /** - * Implements PopupDialog. + * Implements PopupDialog interface. * * @author Yana Stamcheva */ @@ -21,20 +21,38 @@ public class PopupDialogImpl extends JOptionPane private MainFrame parentWindow; + /** + * Creates an instance of PopupDialogImpl. + * @param parentWindow The main application window. + */ public PopupDialogImpl(MainFrame parentWindow) { this.parentWindow = parentWindow; } + /** + * Implements the PopupDialog.showInputPopupDialog(Object) method. + * Invokes the corresponding JOptionPane.showInputDialog method. + */ public String showInputPopupDialog(Object message) { return showInputDialog(parentWindow, message); } + /** + * Implements the PopupDialog.showInputPopupDialog(Object, String) + * method. Invokes the corresponding JOptionPane.showInputDialog + * method. + */ public String showInputPopupDialog(Object message, String initialSelectionValue) { return showInputDialog(parentWindow, message, initialSelectionValue); } + /** + * Implements the + * PopupDialog.showInputPopupDialog(Object, String, int) method. + * Invokes the corresponding JOptionPane.showInputDialog method. + */ public String showInputPopupDialog(Object message, String title, int messageType) { @@ -58,6 +76,12 @@ else if (messageType == PopupDialog.WARNING_MESSAGE) { title, type); } + /** + * Implements the + * PopupDialog.showInputPopupDialog(Object, String, int, Object[], + * Object) method. Invokes the corresponding + * JOptionPane.showInputDialog method. + */ public Object showInputPopupDialog(Object message, String title, int messageType, Object[] selectionValues, Object initialSelectionValue) { @@ -83,10 +107,20 @@ else if (messageType == PopupDialog.WARNING_MESSAGE) { null, selectionValues, initialSelectionValue); } + /** + * Implements the PopupDialog.showMessagePopupDialog(Object) + * method. Invokes the corresponding + * JOptionPane.showMessageDialog method. + */ public void showMessagePopupDialog(Object message) { showMessageDialog(parentWindow, message); } + /** + * Implements the PopupDialog.showMessagePopupDialog(Object, String, + * int) method. Invokes the corresponding + * JOptionPane.showMessageDialog method. + */ public void showMessagePopupDialog(Object message, String title, int messageType) { int type; @@ -109,10 +143,20 @@ else if (messageType == PopupDialog.WARNING_MESSAGE) { showMessageDialog(parentWindow, message, title, type); } + /** + * Implements the PopupDialog.showConfirmPopupDialog(Object) + * method. Invokes the corresponding + * JOptionPane.showConfirmDialog method. + */ public int showConfirmPopupDialog(Object message) { return showConfirmDialog(parentWindow, message); } + /** + * Implements the PopupDialog.showConfirmPopupDialog(Object, String, + * int) method. Invokes the corresponding + * JOptionPane.showConfirmDialog method. + */ public int showConfirmPopupDialog(Object message, String title, int optionType) { int type; @@ -132,6 +176,11 @@ else if (optionType == PopupDialog.YES_NO_CANCEL_OPTION) { return showConfirmDialog(parentWindow, message, title, type); } + /** + * Implements the PopupDialog.showConfirmPopupDialog(Object, String, + * int, int) method. Invokes the corresponding + * JOptionPane.showConfirmDialog method. + */ public int showConfirmPopupDialog(Object message, String title, int optionType, int messageType) { @@ -170,22 +219,43 @@ else if (messageType == PopupDialog.WARNING_MESSAGE) { optType, msgType); } + /** + * Implements the PopupDialog.isDialogVisible method. + * @return true if the dialog is visible, false + * otherwise. + */ public boolean isDialogVisible() { return this.isVisible(); } + /** + * Implements the PopupDialog.isDialogVisible method. + * Shows this JOptionPane. + */ public void showDialog() { this.setVisible(true); } + /** + * Implements the PopupDialog.isDialogVisible method. + * Hides this JOptionPane. + */ public void hideDialog() { this.setVisible(false); } + /** + * Implements the PopupDialog.isDialogVisible method. + * Resizes this JOptionPane. + */ public void resizeDialog(int width, int height) { this.setSize(width, height); } + /** + * Implements the PopupDialog.isDialogVisible method. + * Moves this JOptionPane. + */ public void moveDialog(int x, int y) { this.setLocation(x, y); } diff --git a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java b/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java index 31f446808..e788e3094 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java +++ b/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java @@ -23,7 +23,7 @@ import net.java.sip.communicator.util.Logger; /** - * Stores and loads images used throughout the GUI. + * Stores and loads images used throughout this ui implementation. * * @author Yana Stamcheva */ @@ -31,309 +31,609 @@ public class ImageLoader { private static Logger log = Logger.getLogger(ImageLoader.class); + /** + * Stores all already loaded images. + */ private static Hashtable loadedImages = new Hashtable(); /*------------------------------------------------------------------------ * =========================LOOK AND FEEL IMAGES========================== * ----------------------------------------------------------------------- */ + /** + * The background image of a button. + */ public static final ImageID BUTTON = new ImageID("BUTTON"); + /** + * The rollover image of a button. + */ public static final ImageID BUTTON_ROLLOVER = new ImageID("BUTTON_ROLLOVER"); + /** + * The image used for a horizontal split. + */ public static final ImageID SPLITPANE_HORIZONTAL = new ImageID("SPLITPANE_HORIZONTAL"); + /** + * The image used for a vertical split. + */ public static final ImageID SPLITPANE_VERTICAL = new ImageID("SPLITPANE_VERTICAL"); + /** + * The image used for the "thumb" of a vertical scrollbar. + */ public static final ImageID SCROLLBAR_THUMB_VERTICAL = new ImageID("SCROLLBAR_VERTICAL"); + /** + * The image used for the "thumb" of a horizontal scrollbar. + */ public static final ImageID SCROLLBAR_THUMB_HORIZONTAL = new ImageID("SCROLLBAR_HORIZONTAL"); + /** + * The image used for the "thumb handle" of a horizontal scrollbar. + */ public static final ImageID SCROLLBAR_THUMB_HANDLE_HORIZONTAL = new ImageID("SCROLLBAR_THUMB_HORIZONTAL"); + /** + * The image used for the "thumb handle" of a vertical scrollbar. + */ public static final ImageID SCROLLBAR_THUMB_HANDLE_VERTICAL = new ImageID("SCROLLBAR_THUMB_VERTICAL"); + + /** + * The image used in the SIPCommLookAndFeel to paint the background + * of a tab. + */ + public static final ImageID TAB_BG = new ImageID("TAB_BG"); + + /** + * The image used in the SIPCommLookAndFeel to paint the background + * of a selected tab. + */ + public static final ImageID SELECTED_TAB_BG + = new ImageID("SELECTED_TAB_BG"); + + /** + * The image used in the SIPCommLookAndFeel to paint the background + * of a closable tab. + */ + public static final ImageID CLOSABLE_TAB_BG + = new ImageID("CLOSABLE_TAB_BG"); + + /** + * The image used in the SIPCommLookAndFeel to paint the background + * of a closable selected tab. + */ + public static final ImageID SELECTED_CLOSABLE_TAB_BG + = new ImageID("SELECTED_CLOSABLE_TAB_BG"); + + /** + * The image used in the SIPCommLookAndFeel to paint a close + * button on a tab. + */ + public static final ImageID CLOSE_TAB_ICON = new ImageID("CLOSE_TAB_ICON"); + + /** + * The image used in the SIPCommLookAndFeel to paint a rollover + * close button on a tab. + */ + public static final ImageID CLOSE_TAB_SELECTED_ICON + = new ImageID("CLOSE_TAB_SELECTED_ICON"); + + /////////////////////// OptionPane icons ///////////////////////////// + + /** + * The icon used in the SIPCommLookAndFeel to paint the icon + * of an option pane warning message. + */ + public static final ImageID WARNING_ICON = new ImageID("WARNING_ICON"); /*------------------------------------------------------------------------ * ============================APPLICATION ICONS ========================= * ----------------------------------------------------------------------- */ + /** + * An empty 16x16 icon used for alignment. + */ public static final ImageID EMPTY_16x16_ICON = new ImageID("EMPTY_16x16_ICON"); + /** + * The icon on the "Add contact" button in the QuickMenu. + */ public static final ImageID QUICK_MENU_ADD_ICON = new ImageID("QUICK_MENU_ADD_ICON"); + /** + * The icon on the "Configure" button in the QuickMenu. + */ public static final ImageID QUICK_MENU_CONFIGURE_ICON = new ImageID("QUICK_MENU_CONFIGURE_ICON"); + /** + * The icon on the "Hide/Show offline contacts" button in the + * QuickMenu and in the AppearanceConfigurationForm. + */ public static final ImageID QUICK_MENU_SEARCH_ICON = new ImageID("QUICK_MENU_SEARCH_ICON"); + /** + * The icon on the "Info" button in the QuickMenu. + */ public static final ImageID QUICK_MENU_INFO_ICON = new ImageID("QUICK_MENU_INFO_ICON"); + /** + * The background image of a QuickMenu button. + */ public static final ImageID QUICK_MENU_BUTTON_BG = new ImageID("QUICK_MENU_BUTTON_BG"); + /** + * The background rollover image of a QuickMenu button. + */ public static final ImageID QUICK_MENU_BUTTON_ROLLOVER_BG = new ImageID("QUICK_MENU_BUTTON_ROLLOVER_BG"); + /** + * The call button image. + */ public static final ImageID CALL_BUTTON_BG = new ImageID("CALL_BUTTON_BG"); + /** + * The hangup button image. + */ public static final ImageID HANGUP_BUTTON_BG = new ImageID("HANGUP_BUTTON_BG"); + /** + * The call button mouse over image. + */ public static final ImageID CALL_ROLLOVER_BUTTON_BG = new ImageID("CALL_ROLLOVER_BUTTON_BG"); + /** + * The hangup button mouse over image. + */ public static final ImageID HANGUP_ROLLOVER_BUTTON_BG = new ImageID("HANGUP_ROLLOVER_BUTTON_BG"); + /** + * The background image for the StatusSelectorBox. + */ public static final ImageID STATUS_SELECTOR_BOX = new ImageID("STATUS_SELECTOR_BOX"); - - public static final ImageID BUTTON_BG = new ImageID("BUTTON_BG"); - - public static final ImageID BUTTON_ROLLOVER_BG - = new ImageID("BUTTON_ROLLOVER_BG"); - + + /** + * A dial button icon. + */ public static final ImageID ONE_DIAL_BUTTON = new ImageID("ONE_DIAL_BUTTON"); + /** + * A dial button icon. + */ public static final ImageID TWO_DIAL_BUTTON = new ImageID("TWO_DIAL_BUTTON"); + /** + * A dial button icon. + */ public static final ImageID THREE_DIAL_BUTTON = new ImageID("THREE_DIAL_BUTTON"); + /** + * A dial button icon. + */ public static final ImageID FOUR_DIAL_BUTTON = new ImageID("FOUR_DIAL_BUTTON"); + /** + * A dial button icon. + */ public static final ImageID FIVE_DIAL_BUTTON = new ImageID("FIVE_DIAL_BUTTON"); + /** + * A dial button icon. + */ public static final ImageID SIX_DIAL_BUTTON = new ImageID("SIX_DIAL_BUTTON"); + /** + * A dial button icon. + */ public static final ImageID SEVEN_DIAL_BUTTON = new ImageID("SEVEN_DIAL_BUTTON"); + /** + * A dial button icon. + */ public static final ImageID EIGHT_DIAL_BUTTON = new ImageID("EIGHT_DIAL_BUTTON"); + /** + * A dial button icon. + */ public static final ImageID NINE_DIAL_BUTTON = new ImageID("NINE_DIAL_BUTTON"); + /** + * A dial button icon. + */ public static final ImageID STAR_DIAL_BUTTON = new ImageID("STAR_DIAL_BUTTON"); + /** + * A dial button icon. + */ public static final ImageID ZERO_DIAL_BUTTON = new ImageID("ZERO_DIAL_BUTTON"); + /** + * A dial button icon. + */ public static final ImageID DIEZ_DIAL_BUTTON = new ImageID("DIEZ_DIAL_BUTTON"); + /** + * The image used, when a contact has no photo specified. + */ public static final ImageID DEFAULT_USER_PHOTO = new ImageID("DEFAULT_USER_PHOTO"); + /** + * The image used in the chat window, when a contact has no photo + * specified. + */ public static final ImageID DEFAULT_CHAT_USER_PHOTO = new ImageID("DEFAULT_CHAT_USER_PHOTO"); + /** + * The minimize button icon in the CallPanel. + */ public static final ImageID CALL_PANEL_MINIMIZE_BUTTON = new ImageID("CALL_PANEL_MINIMIZE_BUTTON"); + /** + * The restore button icon in the CallPanel. + */ public static final ImageID CALL_PANEL_RESTORE_BUTTON = new ImageID("CALL_PANEL_RESTORE_BUTTON"); + /** + * The minimize rollover button icon in the CallPanel. + */ public static final ImageID CALL_PANEL_MINIMIZE_ROLLOVER_BUTTON = new ImageID("CALL_PANEL_MINIMIZE_ROLLOVER_BUTTON"); + /** + * The restore rollover button icon in the CallPanel. + */ public static final ImageID CALL_PANEL_RESTORE_ROLLOVER_BUTTON = new ImageID("CALL_PANEL_RESTORE_ROLLOVER_BUTTON"); + /** + * The background image of the "Add contact to chat" button in the + * chat window. + */ public static final ImageID ADD_TO_CHAT_BUTTON = new ImageID("ADD_TO_CHAT_BUTTON"); + /** + * The background rollover image of the "Add contact to chat" button in + * the chat window. + */ public static final ImageID ADD_TO_CHAT_ROLLOVER_BUTTON = new ImageID("ADD_TO_CHAT_ROLLOVER_BUTTON"); + /** + * The icon image of the "Add contact to chat" button in the + * chat window. + */ public static final ImageID ADD_TO_CHAT_ICON = new ImageID("ADD_TO_CHAT_ICON"); + /** + * The image used as a separator in all toolbars. + */ public static final ImageID TOOLBAR_DIVIDER = new ImageID("TOOLBAR_DIVIDER"); - - public static final ImageID RIGHT_ARROW_ICON - = new ImageID("RIGHT_ARROW_ICON"); - - public static final ImageID RIGHT_ARROW_ROLLOVER_ICON - = new ImageID("RIGHT_ARROW_ROLLOVER_ICON"); - - public static final ImageID BOTTOM_ARROW_ICON - = new ImageID("BOTTOM_ARROW_ICON"); - - public static final ImageID BOTTOM_ARROW_ROLLOVER_ICON - = new ImageID("BOTTOM_ARROW_ROLLOVER_ICON"); - - public static final ImageID TAB_BG = new ImageID("TAB_BG"); - - public static final ImageID SELECTED_TAB_BG - = new ImageID("SELECTED_TAB_BG"); - - public static final ImageID CLOSABLE_TAB_BG - = new ImageID("CLOSABLE_TAB_BG"); - - public static final ImageID SELECTED_CLOSABLE_TAB_BG - = new ImageID("SELECTED_CLOSABLE_TAB_BG"); - + /** + * The image used for decoration of the "Add contact" window. + */ public static final ImageID ADD_CONTACT_WIZARD_ICON = new ImageID("ADD_CONTACT_WIZARD_ICON"); + /** + * The image used for decoration of the "Rename contact" window. + */ public static final ImageID RENAME_DIALOG_ICON = new ImageID("RENAME_DIALOG_ICON"); // ///////////////////// Edit Text Toolbar icons ////////////////////////// + /** + * "Left align" button image in the EditTextToolBar in the + * ChatWindow. + */ public static final ImageID ALIGN_LEFT_BUTTON = new ImageID("ALIGN_LEFT_BUTTON"); + /** + * "Right align" button image in the EditTextToolBar in the + * ChatWindow. + */ public static final ImageID ALIGN_RIGHT_BUTTON = new ImageID("ALIGN_RIGHT_BUTTON"); + /** + * "Center align" button image in the EditTextToolBar in the + * ChatWindow. + */ public static final ImageID ALIGN_CENTER_BUTTON = new ImageID("ALIGN_RIGHT_BUTTON"); + /** + * "Left align" button rollover image in the EditTextToolBar in + * the ChatWindow. + */ public static final ImageID ALIGN_LEFT_ROLLOVER_BUTTON = new ImageID("ALIGN_LEFT_ROLLOVER_BUTTON"); + /** + * "Right align" button rollover image in the EditTextToolBar in + * the ChatWindow. + */ public static final ImageID ALIGN_RIGHT_ROLLOVER_BUTTON = new ImageID("ALIGN_RIGHT_ROLLOVER_BUTTON"); + /** + * "Center align" button rollover image in the EditTextToolBar in + * the ChatWindow. + */ public static final ImageID ALIGN_CENTER_ROLLOVER_BUTTON = new ImageID("ALIGN_CENTER_ROLLOVER_BUTTON"); + /** + * "Bold" button image in the EditTextToolBar in the + * ChatWindow. + */ public static final ImageID TEXT_BOLD_BUTTON = new ImageID("TEXT_BOLD_BUTTON"); + /** + * "Italic" button image in the EditTextToolBar in the + * ChatWindow. + */ public static final ImageID TEXT_ITALIC_BUTTON = new ImageID("TEXT_ITALIC_BUTTON"); + /** + * "Underline" button image in the EditTextToolBar in the + * ChatWindow. + */ public static final ImageID TEXT_UNDERLINED_BUTTON - = new ImageID("TEXT_ITALIC_BUTTON"); + = new ImageID("TEXT_UNDERLINED_BUTTON"); + /** + * "Bold" button rollover image in the EditTextToolBar in the + * ChatWindow. + */ public static final ImageID TEXT_BOLD_ROLLOVER_BUTTON = new ImageID("TEXT_BOLD_ROLLOVER_BUTTON"); + /** + * "Italic" button rollover image in the EditTextToolBar in the + * ChatWindow. + */ public static final ImageID TEXT_ITALIC_ROLLOVER_BUTTON = new ImageID("TEXT_ITALIC_ROLLOVER_BUTTON"); + /** + * "Underline" button rollover image in the EditTextToolBar in + * the ChatWindow. + */ public static final ImageID TEXT_UNDERLINED_ROLLOVER_BUTTON = new ImageID("TEXT_UNDERLINED_ROLLOVER_BUTTON"); - - public static final ImageID CLOSE_TAB_ICON = new ImageID("CLOSE_TAB_ICON"); - - public static final ImageID CLOSE_TAB_SELECTED_ICON - = new ImageID("CLOSE_TAB_SELECTED_ICON"); - + // ///////////////////////// Main Toolbar icons //////////////////////////// - public static final ImageID MSG_TOOLBAR_BUTTON_BG + /** + * The background image of a button in one of the ChatWindow + * toolbars. + */ + public static final ImageID CHAT_TOOLBAR_BUTTON_BG = new ImageID("MSG_TOOLBAR_BUTTON_BG"); - public static final ImageID MSG_TOOLBAR_ROLLOVER_BUTTON_BG + /** + * The background rollover image of a button in one of the + * ChatWindow toolbars. + */ + public static final ImageID CHAT_TOOLBAR_ROLLOVER_BUTTON_BG = new ImageID("MSG_TOOLBAR_ROLLOVER_BUTTON_BG"); + /** + * Copy icon. + */ public static final ImageID COPY_ICON = new ImageID("COPY_ICON"); + /** + * Cut icon. + */ public static final ImageID CUT_ICON = new ImageID("CUT_ICON"); + /** + * Paste icon. + */ public static final ImageID PASTE_ICON = new ImageID("PASTE_ICON"); + /** + * Smily icon, used for the "Smily" button in the MainToolBar. + */ public static final ImageID SMILIES_ICON = new ImageID("SMILIES_ICON"); + /** + * Save icon. + */ public static final ImageID SAVE_ICON = new ImageID("SAVE_ICON"); + /** + * Print icon. + */ public static final ImageID PRINT_ICON = new ImageID("PRINT_ICON"); + /** + * Close icon. + */ public static final ImageID CLOSE_ICON = new ImageID("CLOSE_ICON"); + /** + * Quit icon. + */ public static final ImageID QUIT_ICON = new ImageID("QUIT_ICON"); + /** + * Left flash icon. + */ public static final ImageID PREVIOUS_ICON = new ImageID("PREVIOUS_ICON"); + /** + * Right flash icon. + */ public static final ImageID NEXT_ICON = new ImageID("NEXT_ICON"); + /** + * Clock icon. + */ public static final ImageID HISTORY_ICON = new ImageID("HISTORY_ICON"); + /** + * Send file icon. + */ public static final ImageID SEND_FILE_ICON = new ImageID("SEND_FILE_ICON"); + /** + * Font icon. + */ public static final ImageID FONT_ICON = new ImageID("FONT_ICON"); // ///////////////////// Chat contact icons //////////////////////////////// + /** + * A special "info" icon used in the ChatContactPanel. + */ public static final ImageID CHAT_CONTACT_INFO_BUTTON = new ImageID("CHAT_CONTACT_INFO_BUTTON"); + /** + * A special "info" rollover icon used in the ChatContactPanel. + */ public static final ImageID CHAT_CONTACT_INFO_ROLLOVER_BUTTON = new ImageID("CHAT_CONTACT_INFO_ROLLOVER_BUTTON"); + /** + * A special "call" icon used in the ChatContactPanel. + */ public static final ImageID CHAT_CONTACT_CALL_BUTTON = new ImageID("CHAT_CONTACT_CALL_BUTTON"); + /** + * A special "call" rollover icon used in the ChatContactPanel. + */ public static final ImageID CHAT_CONTACT_CALL_ROLLOVER_BUTTON = new ImageID("CHAT_CONTACT_CALL_ROLLOVER_BUTTON"); + /** + * A special "send file" icon used in the ChatContactPanel. + */ public static final ImageID CHAT_CONTACT_SEND_FILE_BUTTON = new ImageID("CHAT_CONTACT_SEND_FILE_BUTTON"); + /** + * A special "send file" rollover icon used in the + * ChatContactPanel. + */ public static final ImageID CHAT_SEND_FILE_ROLLOVER_BUTTON = new ImageID("CHAT_SEND_FILE_ROLLOVER_BUTTON"); + - // ///////////////////// Optionpane icons ///////////////////////////// - - public static final ImageID WARNING_ICON = new ImageID("WARNING_ICON"); - - // //////////////////// RightButton menu icons //////////////////////// - + ////////////////////////////// 16x16 icons //////////////////////////////// + /** + * Send message 16x16 image. + */ public static final ImageID SEND_MESSAGE_16x16_ICON = new ImageID("SEND_MESSAGE_16x16_ICON"); - + + /** + * Delete 16x16 image. + */ public static final ImageID DELETE_16x16_ICON = new ImageID("DELETE_16x16_ICON"); + /** + * History 16x16 image. + */ public static final ImageID HISTORY_16x16_ICON = new ImageID("HISTORY_16x16_ICON"); + /** + * Send file 16x16 image. + */ public static final ImageID SEND_FILE_16x16_ICON = new ImageID("SEND_FILE_16x16_ICON"); + /** + * Groups 16x16 image. + */ public static final ImageID GROUPS_16x16_ICON = new ImageID("GROUPS_16x16_ICON"); + /** + * Info 16x16 image. + */ public static final ImageID INFO_16x16_ICON = new ImageID("INFO_16x16_ICON"); + /** + * Add contact 16x16 image. + */ public static final ImageID ADD_CONTACT_16x16_ICON = new ImageID("ADD_CONTACT_16x16_ICON"); + /** + * Rename 16x16 image. + */ public static final ImageID RENAME_16x16_ICON = new ImageID("RENAME_16x16_ICON"); + /////////////////////////////////////////////////////////////////////////// + + /** + * Contact list cell "more info" button. + */ public static final ImageID MORE_INFO_ICON = new ImageID("MORE_INFO_ICON"); + /** + * Toolbar drag area icon. + */ public static final ImageID TOOLBAR_DRAG_ICON = new ImageID( "TOOLBAR_DRAG_ICON"); + /** + * The background image of LoginWindow and WelcomeWindow + * frames. + */ public static final ImageID LOGIN_WINDOW_LOGO = new ImageID( "LOGIN_WINDOW_LOGO"); @@ -342,81 +642,170 @@ public class ImageLoader { * --------------------- PROTOCOLS STATUS ICONS --------------------------- * ======================================================================== */ - + /** + * The ICQ logo 16x16 icon. + */ public static final ImageID ICQ_LOGO = new ImageID("ICQ_LOGO"); + /** + * The ICQ "connecting" 16x16 animated icon. + */ public static final ImageID ICQ_CONNECTING = new ImageID("ICQ_CONNECTING"); + /** + * The ICQ "free for chat" 16x16 icon. + */ public static final ImageID ICQ_FF_CHAT_ICON = new ImageID( "ICQ_FF_CHAT_ICON"); + /** + * The ICQ "away" 16x16 icon. + */ public static final ImageID ICQ_AWAY_ICON = new ImageID("ICQ_AWAY_ICON"); + /** + * The ICQ "not available" 16x16 icon. + */ public static final ImageID ICQ_NA_ICON = new ImageID("ICQ_NA_ICON"); + /** + * The ICQ "do not disturb" 16x16 icon. + */ public static final ImageID ICQ_DND_ICON = new ImageID("ICQ_DND_ICON"); + /** + * The ICQ "occupied" 16x16 icon. + */ public static final ImageID ICQ_OCCUPIED_ICON = new ImageID( "ICQ_OCCUPIED_ICON"); + /** + * The ICQ "offline" 16x16 icon. + */ public static final ImageID ICQ_OFFLINE_ICON = new ImageID( "ICQ_OFFLINE_ICON"); + /** + * The ICQ "invisible" 16x16 icon. + */ public static final ImageID ICQ_INVISIBLE_ICON = new ImageID( "ICQ_INVISIBLE_ICON"); + /** + * The MSN logo 16x16 icon. + */ public static final ImageID MSN_LOGO = new ImageID("MSN_LOGO"); + /** + * The AIM logo 16x16 icon. + */ public static final ImageID AIM_LOGO = new ImageID("AIM_LOGO"); + /** + * The Yahoo logo 16x16 icon. + */ public static final ImageID YAHOO_LOGO = new ImageID("YAHOO_LOGO"); + /** + * The Jabber logo 16x16 icon. + */ public static final ImageID JABBER_LOGO = new ImageID("JABBER_LOGO"); + /** + * The Skype logo 16x16 icon. + */ public static final ImageID SKYPE_LOGO = new ImageID("SKYPE_LOGO"); + /** + * The SIP logo 16x16 icon. + */ public static final ImageID SIP_LOGO = new ImageID("SIP_LOGO"); + /** + * The SIP online 16x16 icon. + */ public static final ImageID SIP_ONLINE_ICON = new ImageID("SIP_ONLINE_ICON"); + /** + * The SIP offline 16x16 icon. + */ public static final ImageID SIP_OFFLINE_ICON = new ImageID( "SIP_OFFLINE_ICON"); + /** + * The SIP invisible 16x16 icon. + */ public static final ImageID SIP_INVISIBLE_ICON = new ImageID( "SIP_INVISIBLE_ICON"); + /** + * The SIP away 16x16 icon. + */ public static final ImageID SIP_AWAY_ICON = new ImageID("SIP_AWAY_ICON"); + /** + * The SIP "not availabled" 16x16 icon. + */ public static final ImageID SIP_NA_ICON = new ImageID("SIP_NA_ICON"); + /** + * The SIP "do not disturb" 16x16 icon. + */ public static final ImageID SIP_DND_ICON = new ImageID("SIP_DND_ICON"); + /** + * The SIP "occupied" 16x16 icon. + */ public static final ImageID SIP_OCCUPIED_ICON = new ImageID( "SIP_OCCUPIED_ICON"); + /** + * The SIP "chat" 16x16 icon. + */ public static final ImageID SIP_CHAT_ICON = new ImageID("SIP_CHAT_ICON"); /* - * ===================================================================== - * ------------------------ USERS ICONS -------------------------------- - * ===================================================================== + * ======================================================================= + * ------------------------ USERS' ICONS --------------------------------- + * ======================================================================= */ + /** + * Contact "online" icon. + */ public static final ImageID USER_ONLINE_ICON = new ImageID( "USER_ONLINE_ICON"); + /** + * Contact "offline" icon. + */ public static final ImageID USER_OFFLINE_ICON = new ImageID( "USER_OFFLINE_ICON"); + /** + * Contact "away" icon. + */ public static final ImageID USER_AWAY_ICON = new ImageID("USER_AWAY_ICON"); + /** + * Contact "not available" icon. + */ public static final ImageID USER_NA_ICON = new ImageID("USER_NA_ICON"); + /** + * Contact "free for chat" icon. + */ public static final ImageID USER_FFC_ICON = new ImageID("USER_FFC_ICON"); + /** + * Contact "do not disturb" icon. + */ public static final ImageID USER_DND_ICON = new ImageID("USER_DND_ICON"); + /** + * Contact "occupied" icon. + */ public static final ImageID USER_OCCUPIED_ICON = new ImageID( "USER_OCCUPIED_ICON"); @@ -551,7 +940,7 @@ public static BufferedImage getImage(ImageID imageID) { } /** - * Loads animated gif image. + * Loads an animated gif image. * @param imageID The image identifier. * @return A BufferedImage array containing the animated image. */ diff --git a/src/net/java/sip/communicator/impl/gui/utils/Images.java b/src/net/java/sip/communicator/impl/gui/utils/Images.java index 2360ddd14..0f081c8f0 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/Images.java +++ b/src/net/java/sip/communicator/impl/gui/utils/Images.java @@ -12,6 +12,7 @@ /** * Manages the access to the properties file containing all image paths. + * * @author Yana Stamcheva */ public class Images { @@ -25,6 +26,11 @@ public class Images { private Images() { } + /** + * Returns an image path corresponding to the given image key. + * @param key The key of the image. + * @return An image path corresponding to the given image key. + */ public static String getString(String key) { try { return RESOURCE_BUNDLE.getString(key); diff --git a/src/net/java/sip/communicator/impl/gui/utils/SIPCommHTMLEditorKit.java b/src/net/java/sip/communicator/impl/gui/utils/SIPCommHTMLEditorKit.java index b7f27cc65..b6d6568e4 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/SIPCommHTMLEditorKit.java +++ b/src/net/java/sip/communicator/impl/gui/utils/SIPCommHTMLEditorKit.java @@ -23,19 +23,26 @@ import javax.swing.text.html.StyleSheet; /** - * The SIPCommHTMLEditorKit is a custom HTMLEditorKit which defines its own - * image view in the html document. The image view used to represent the image - * is the SIPCommImageView. + * The SIPCommHTMLEditorKit is an HTMLEditorKit which uses + * the SIPCommImageView and an extended ParagraphView. * * @author Yana Stamcheva */ public class SIPCommHTMLEditorKit extends HTMLEditorKit { + /** + * Returns the extended HTMLFactory defined here. + */ public ViewFactory getViewFactory() { return new HTMLFactoryX(); } - static class HTMLFactoryX extends HTMLFactory + /** + * An extended HTMLFactory that uses the SIPCommImageView + * to represent images and the ParagraphViewX to represent + * paragraphs. + */ + static class HTMLFactoryX extends HTMLFactory implements ViewFactory { public View create(Element elem) { @@ -47,17 +54,30 @@ public View create(Element elem) { } else if (v instanceof ParagraphView) { return new ParagraphViewX(elem); - } - + } return v; } } + /** + * The ParagraphViewX is created in order to solve the following + * problem (Bug ID: 4855207): + *

+ * When a paragraph in a JTextPane has a large amount of text the + * processing needed to layout the entire paragraph increases as the + * paragraph grows. + */ static class ParagraphViewX extends ParagraphView { public ParagraphViewX(Element elem) { super(elem); } + /** + * Calculate equirements along the minor axis. This + * is implemented to forward the request to the logical + * view by calling getMinimumSpan, getPreferredSpan, and + * getMaximumSpan on it. + */ protected SizeRequirements calculateMinorAxisRequirements ( int axis, SizeRequirements r) { if (r == null) { @@ -79,7 +99,7 @@ protected SizeRequirements calculateMinorAxisRequirements ( * Create an uninitialized text storage model * that is appropriate for this type of editor. * - * @return the model + * @return the model. */ public Document createDefaultDocument() { StyleSheet styles = getStyleSheet(); diff --git a/src/net/java/sip/communicator/impl/gui/utils/SIPCommImageView.java b/src/net/java/sip/communicator/impl/gui/utils/SIPCommImageView.java index 7a34e2b56..9f3839c40 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/SIPCommImageView.java +++ b/src/net/java/sip/communicator/impl/gui/utils/SIPCommImageView.java @@ -45,28 +45,30 @@ import javax.swing.text.html.ImageView; import javax.swing.text.html.StyleSheet; +/* + * The content of this file was based on code borrowed from Rob Kenworthy, + * http://www.javaworld.com/javaworld/javatips/jw-javatip109.html#resources. + */ /** - * The SIPCommImageView is an ImageView which allows to specify a related path - * when describing an image within an html document. + * The SIPCommImageView is an ImageView which allows to + * specify a related path when describing an image within an html document. * * @author Yana Stamcheva */ public class SIPCommImageView extends ImageView implements ImageObserver { - // --- Attribute Values ------------------------------------------ - - public static final String TOP = "top", TEXTTOP = "texttop", - MIDDLE = "middle", ABSMIDDLE = "absmiddle", CENTER = "center", - BOTTOM = "bottom"; - - // --- Construction ---------------------------------------------- + public static final String TOP = "top"; + public static final String TEXTTOP = "texttop"; + public static final String MIDDLE = "middle"; + public static final String ABSMIDDLE = "absmiddle"; + public static final String CENTER = "center"; + public static final String BOTTOM = "bottom"; /** * Creates a new view that represents an IMG element. * - * @param elem - * the element to create a view for + * @param elem the element to create a view for. */ public SIPCommImageView(Element elem) { @@ -79,6 +81,11 @@ public SIPCommImageView(Element elem) { attr = sheet.getViewAttributes(this); } + /** + * Initializes this view. + * + * @param elem the element. + */ private void initialize(Element elem) { synchronized (this) { loading = true; @@ -112,7 +119,7 @@ private void initialize(Element elem) { } } else { - /** ****** Code to load from relative path ************ */ + /*--Code to load from relative path--*/ String src = (String) fElement.getAttributes().getAttribute( HTML.Attribute.SRC); @@ -130,9 +137,7 @@ private void initialize(Element elem) { } catch (IOException e) { e.printStackTrace(); } - - /** *************************************************** */ - + /*----------------------------------*/ } // Get height/width from params or image or defaults: @@ -163,16 +168,7 @@ private void initialize(Element elem) { width, this); else Toolkit.getDefaultToolkit().prepareImage(fImage, -1, -1, - this); - - /******************************************************************* - * // Rob took this out. Changed scope of src. if( DEBUG ) { if( - * fImage != null ) System.out.println("ImageInfo: new on "+src+ " - * ("+fWidth+"x"+fHeight+")"); else System.out.println("ImageInfo: - * couldn't get image at "+ src); if(isLink()) System.out.println(" - * It's a link! Border = "+ getBorder()); - * //((AbstractDocument.AbstractElement)elem).dump(System.out,4); } - ******************************************************************/ + this); } finally { synchronized (this) { @@ -190,7 +186,7 @@ private void initialize(Element elem) { /** - * Determines if path is in the form of a URL. + * Determines if path is in the form of an URL. * @return TRUE if the source is URL, FALSE otherwise. */ private boolean isURL() { @@ -202,7 +198,7 @@ private boolean isURL() { } /** - * Make sure an image is loaded - ie no broken images. So far its used only + * Make sure an image is loaded - ie no broken images. So far its used only * for images loaded off the disk (non-URL). * @throws InterruptedException */ @@ -235,7 +231,9 @@ public AttributeSet getAttributes() { return attr; } - /** Is this image within a link? */ + /** + * Checks if the image is within a link. + */ boolean isLink() { // ! It would be nice to cache this but in an editor it can change // See if I have an HREF attribute courtesy of the enclosing A tag: @@ -250,24 +248,32 @@ boolean isLink() { return false; } - /** Returns the size of the border to use. */ + /** + * Returns the size of the border to use. + */ int getBorder() { return getIntAttr(HTML.Attribute.BORDER, isLink() ? DEFAULT_BORDER : 0); } - /** Returns the amount of extra space to add along an axis. */ + /** + * Returns the amount of extra space to add along an axis. + */ int getSpace(int axis) { return getIntAttr(axis == X_AXIS ? HTML.Attribute.HSPACE : HTML.Attribute.VSPACE, 0); } - /** Returns the border's color, or null if this is not a link. */ + /** + * Returns the border's color, or null if this is not a link. + */ Color getBorderColor() { StyledDocument doc = (StyledDocument) getDocument(); return doc.getForeground(getAttributes()); } - /** Returns the image's vertical alignment. */ + /** + * Returns the image's vertical alignment. + */ float getVerticalAlignment() { String align = (String) fElement.getAttributes().getAttribute( HTML.Attribute.ALIGN); @@ -283,6 +289,12 @@ else if (align.equals(this.CENTER) || align.equals(MIDDLE) return 1.0f; // default alignment is bottom } + /** + * Checks if the image is at least one pixel. + * @param obs The ImageObserver. + * @return true if the image is not null and is at least one + * pixel big, false otherwise. + */ boolean hasPixels(ImageObserver obs) { return fImage != null && fImage.getHeight(obs) > 0 @@ -290,7 +302,8 @@ boolean hasPixels(ImageObserver obs) { } /** - * Return a URL for the image source, or null if it could not be determined. + * Returns an URL for the image source, or null if it could not be + * determined. */ private URL getSourceURL() { @@ -308,7 +321,9 @@ private URL getSourceURL() { } } - /** Look up an integer-valued attribute. Not recursive. */ + /** + * Look up an integer-valued attribute. Not recursive. + */ private int getIntAttr(HTML.Attribute name, int deflt) { AttributeSet attr = fElement.getAttributes(); if (attr.isDefined(name)) { // does not check parents! @@ -340,7 +355,9 @@ public void setParent(View parent) { } } - /** My attributes may have changed. */ + /** + * The attributes may have changed. + */ public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f) { if (DEBUG) System.out.println("ImageView: changedUpdate begin..."); @@ -364,15 +381,11 @@ public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f) { + getVerticalAlignment()); } - // --- Painting -------------------------------------------------------- - /** * Paints the image. * - * @param g - * the rendering surface to use - * @param a - * the allocated region to render into + * @param g the rendering surface to use + * @param a the allocated region to render into * @see View#paint */ public void paint(Graphics g, Shape a) { @@ -384,15 +397,7 @@ public void paint(Graphics g, Shape a) { int width = fWidth; int height = fHeight; int sel = getSelectionState(); - - // Make sure my Component is in the right place: - /* - * if( fComponent == null ) { fComponent = new Component() { }; - * fComponent.addMouseListener(this); - * fComponent.addMouseMotionListener(this); - * fComponent.setCursor(Cursor.getDefaultCursor()); // use arrow cursor - * fContainer.add(fComponent); } fComponent.setBounds(x,y,width,height); - */ + // If no pixels yet, draw gray outline and icon: if (!hasPixels(this)) { g.setColor(Color.lightGray); @@ -482,12 +487,19 @@ protected int getSelectionState() { return 0; } + /** + * Checks whether the container is editable. + * @return true if the container is editable, + * false otherwise. + */ protected boolean isEditable() { return fContainer instanceof JEditorPane && ((JEditorPane) fContainer).isEditable(); } - /** Returns the text editor's highlight color. */ + /** + * Returns the text editor's highlight color. + */ protected Color getHighlightColor() { JTextComponent textComp = (JTextComponent) fContainer; return textComp.getSelectionColor(); @@ -567,7 +579,7 @@ else if ((flags & SOMEBITS) != 0) } /* - * /** Static properties for incremental drawing. Swiped from Component.java + * Static properties for incremental drawing. Swiped from Component.java * * @see #imageUpdate */ diff --git a/src/net/java/sip/communicator/impl/gui/utils/Smiley.java b/src/net/java/sip/communicator/impl/gui/utils/Smiley.java index ab56cc12b..aa604c365 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/Smiley.java +++ b/src/net/java/sip/communicator/impl/gui/utils/Smiley.java @@ -9,7 +9,9 @@ import net.java.sip.communicator.impl.gui.utils.ImageLoader.ImageID; -/** +/** + * The Smily is used to store a smily. + * * @author Yana Stamcheva */ public class Smiley { @@ -18,6 +20,13 @@ public class Smiley { private String[] smileyStrings; + /** + * Creates an instance of Smily, by specifying the smily + * image identifier and the strings corresponding to it. + * @param imageID The image identifier of the smily icon. + * @param smileyStrings A set of strings corresponding to the smily + * icon. + */ public Smiley(ImageID imageID, String[] smileyStrings) { this.imageID = imageID; @@ -25,26 +34,48 @@ public Smiley(ImageID imageID, String[] smileyStrings) { this.setSmileyStrings(smileyStrings); } + /** + * Returns the set of Strings corresponding to this smily. + * @return the set of Strings corresponding to this smily. + */ public String[] getSmileyStrings() { return smileyStrings; } + /** + * Sets the set of Strings corresponding to this smily. They could be + * ":-)", ":)", ":))" for example. + * @param smileyStrings the set of Strings corresponding to this smily. + */ public void setSmileyStrings(String[] smileyStrings) { this.smileyStrings = smileyStrings; } + /** + * Returns the default String corresponding for this smily. For example + * ":-)". + * @return the default String corresponding for this smily. + */ public String getDefaultString() { return this.smileyStrings[0]; } + /** + * Returns the identifier of the image corresponding to this smily. + * @return the identifier of the image corresponding to this smily. + */ public ImageID getImageID() { return this.imageID; } + /** + * Returns the path of the image corresponding to this smily. + * @return the path of the image corresponding to this smily. + */ public String getImagePath() { return Images.getString(this.getImageID().getId()); }