Class OxygenUIComponentsFactory


  • @API(type=EXTENDABLE,
         src=PUBLIC)
    public final class OxygenUIComponentsFactory
    extends java.lang.Object
    Create UI components that look and feel like the ones in oXygen.
    Since:
    21.1
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void changeContentType​(javax.swing.JTextArea textArea, java.lang.String contentType)
      Changes the content type of a text area created with Oxygen API createTextArea(String)
      static javax.swing.JButton createButton​(javax.swing.Action action)
      Create a button.
      static ColorButton createColorChooserButton​(java.awt.Color currentColor)
      Create a button that presents a color chooser.
      static javax.swing.JComboBox createComboBox​(javax.swing.ComboBoxModel model)
      Create a new Oxygen style combo box.
      static javax.swing.JEditorPane createHTMLEditorPane​(java.lang.String text, boolean useStandardTextFont)
      Creates a JEditorPane to edit HTML content.
      static InputUrlComponentProvider createInputURLPanelProvider​(java.lang.String[] extensions, java.lang.String filesDescription, java.lang.String[] initialContent, boolean showEditorVariables, java.lang.String persistenceKey, LocalFileBrowseType browseType)
      Create the input url component provider, used to create an URL chooser similar to the ones in the application which can be embedded inside a third party panel.
      static Menu createMenu​(java.lang.String menuName)
      Create a javax.swing.JMenu extension that has the look and feel consistent with the menus from oXygen.
      static javax.swing.JMenuItem createMenuItem​(javax.swing.Action action)
      Create a menu item over given action.
      static javax.swing.JComponent createMultilineLabel​(java.lang.String text, boolean boldText)
      Create a new multiline label.
      static OKCancelDialog createOkCancelDialog​(java.awt.Frame parentFrame, java.lang.String title, boolean modal)
      Create a dialog with OK and Cancel buttons.
      static PopupMenu createPopupMenu()
      Create a javax.swing.JPopupMenu extension that has the look and feel consistent with the pop-up menus from oXygen.
      static javax.swing.JScrollPane createScrollPane​(java.awt.Component view, int vsbPolicy, int hsbPolicy)
      Creates a ScrollPane that displays a view component in a viewport whose view position can be controlled with a pair of scrollbars.
      static SplitMenuButton createSplitMenuButton​(java.lang.String defaultText, javax.swing.Icon defaultIcon, boolean updateText, boolean updateIcon, boolean alwaysShowMenu, boolean setSelectedActionAsDefault)
      Create a split menu button.
      static Table createTable​(javax.swing.table.TableModel tableModel)
      Create a javax.swing.JTable extension that has the look and feel consistent with the tables from oXygen.
      static javax.swing.JTextArea createTextArea​(java.lang.String contentType)
      Create a javax.swing.JTextArea extension with undo/redo support.
      static javax.swing.JTextArea createTextArea​(java.lang.String contentType, boolean highlightCurrentLine)
      Create a javax.swing.JTextArea extension extension with undo/redo support.
      static TextField createTextField()
      Create a javax.swing.JTextField extension with undo/redo support.
      static javax.swing.JButton createToolbarButton​(javax.swing.Action action, boolean showText)
      Create a toolbar button.
      static javax.swing.JButton createToolbarToggleButton​(javax.swing.Action action, boolean showText)
      Create a toolbar toggle button.
      static Tree createTree​(javax.swing.tree.TreeModel model)
      Create a javax.swing.JTree extension that has a look and feel consistent with the trees used in oXygen.
      static javax.swing.JToolTip installMultilineTooltip​(javax.swing.JComponent component)
      Installs a new multiline tooltip on a component.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • createButton

        public static javax.swing.JButton createButton​(javax.swing.Action action)
        Create a button.
        Parameters:
        action - The action associated with the button.
        Returns:
        the button.
      • createColorChooserButton

        public static ColorButton createColorChooserButton​(java.awt.Color currentColor)
        Create a button that presents a color chooser.
        Parameters:
        currentColor - The color to set as current/selected.
        Returns:
        The button.
      • createMenu

        public static Menu createMenu​(java.lang.String menuName)
        Create a javax.swing.JMenu extension that has the look and feel consistent with the menus from oXygen.
        Parameters:
        menuName - The menu's name.
        Returns:
        the menu.
      • createOkCancelDialog

        public static OKCancelDialog createOkCancelDialog​(java.awt.Frame parentFrame,
                                                          java.lang.String title,
                                                          boolean modal)
        Create a dialog with OK and Cancel buttons.
        Parameters:
        parentFrame - The parent frame. Can be null, in which case it will be auto-detected.
        title - The dialog title.
        modal - true if modal.
        Returns:
        the dialog.
      • createPopupMenu

        public static PopupMenu createPopupMenu()
        Create a javax.swing.JPopupMenu extension that has the look and feel consistent with the pop-up menus from oXygen.
        Returns:
        the pop-up menu.
      • createSplitMenuButton

        public static SplitMenuButton createSplitMenuButton​(java.lang.String defaultText,
                                                            javax.swing.Icon defaultIcon,
                                                            boolean updateText,
                                                            boolean updateIcon,
                                                            boolean alwaysShowMenu,
                                                            boolean setSelectedActionAsDefault)
        Create a split menu button. This a component representing a combination of a button and a menu. There is a line in the component that splits it into the two aforementioned sub-components. The part before the line is a button, and can be clicked in order to trigger an action. The part after the line is a menu.
        Parameters:
        defaultText - The default text, used when there is no action set explicitly. Can be null.
        defaultIcon - The default icon, used when there is no action set explicitly. Can be null.
        updateText - true to update the text of the button when selecting an action.
        updateIcon - true to update the icon of the button when selecting an action.
        alwaysShowMenu - true if pressing the button should always display the associated menu.
        setSelectedActionAsDefault - true to promote the selected action, setting it as the current/default action of the button.
        Returns:
        the button.
      • createTable

        public static Table createTable​(javax.swing.table.TableModel tableModel)
        Create a javax.swing.JTable extension that has the look and feel consistent with the tables from oXygen.
        Parameters:
        tableModel - The table's model.
        Returns:
        the table.
      • createTextField

        public static TextField createTextField()
        Create a javax.swing.JTextField extension with undo/redo support. It also has an "edit" contextual menu (Cut, Copy, Paste, etc.).
        Returns:
        the text field.
      • createToolbarButton

        public static javax.swing.JButton createToolbarButton​(javax.swing.Action action,
                                                              boolean showText)
        Create a toolbar button.
        Parameters:
        action - The action to execute.
        showText - true to show the text set for the action.
        Returns:
        the button.
      • createToolbarToggleButton

        public static javax.swing.JButton createToolbarToggleButton​(javax.swing.Action action,
                                                                    boolean showText)
        Create a toolbar toggle button.
        Parameters:
        action - The action to execute.
        showText - true to show the text set for the action.
        Returns:
        the button.
      • createTree

        public static Tree createTree​(javax.swing.tree.TreeModel model)
        Create a javax.swing.JTree extension that has a look and feel consistent with the trees used in oXygen. It uses a TreeCellRenderer by default.
        Parameters:
        model - The model of the tree.
        Returns:
        the tree.
      • createMenuItem

        public static javax.swing.JMenuItem createMenuItem​(javax.swing.Action action)
        Create a menu item over given action.
        Parameters:
        action - The action to execute.
        Returns:
        the menu item.
      • installMultilineTooltip

        public static javax.swing.JToolTip installMultilineTooltip​(javax.swing.JComponent component)
        Installs a new multiline tooltip on a component. In order to install the multiline tooltip you have to override the javax.swing.JComponent.createToolTip() method of the component and return the result of the current method.
        Parameters:
        component - The component to install the tooltip on.
        Returns:
        The new tooltip component.
        Since:
        22
      • createMultilineLabel

        public static javax.swing.JComponent createMultilineLabel​(java.lang.String text,
                                                                  boolean boldText)
        Create a new multiline label.
        Parameters:
        text - The content of the multiline component.
        boldText - true if the content must be bold, false otherwise.
        Returns:
        A label which will present the given content on multiple lines.
        Since:
        22.1
      • createComboBox

        public static javax.swing.JComboBox createComboBox​(javax.swing.ComboBoxModel model)
        Create a new Oxygen style combo box.
        Parameters:
        model - The model of the combo box.
        Returns:
        An Oxygen style combo box.
        Since:
        23
      • createInputURLPanelProvider

        public static InputUrlComponentProvider createInputURLPanelProvider​(java.lang.String[] extensions,
                                                                            java.lang.String filesDescription,
                                                                            java.lang.String[] initialContent,
                                                                            boolean showEditorVariables,
                                                                            java.lang.String persistenceKey,
                                                                            LocalFileBrowseType browseType)
        Create the input url component provider, used to create an URL chooser similar to the ones in the application which can be embedded inside a third party panel.
        Parameters:
        extensions - Files having this extension will be shown in the file system browser.
        filesDescription - The file description associated with the extension.
        initialContent - The initial content of the combo box from the url chooser.
        showEditorVariables - true for showing the Editor Variables chooser button. false otherwise.
        persistenceKey - The key that will be used to save entries from this URL panel as persistent between sessions. Null to inhibit persistence.
        browseType - The browse mode for local file browsing: Open file, Save file or Open directory.
        Returns:
        The input url component provider which can be used to interact with the component.
        Since:
        23
      • createScrollPane

        public static javax.swing.JScrollPane createScrollPane​(java.awt.Component view,
                                                               int vsbPolicy,
                                                               int hsbPolicy)
        Creates a ScrollPane that displays a view component in a viewport whose view position can be controlled with a pair of scrollbars. The scrollbar policies specify when the scrollbars are displayed.
        Parameters:
        view - The component to display in the viewport.
        vsbPolicy - Determines when the vertical scrollbar appears in the scrollpane. The possible values are:
        • ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED
        • ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER
        • ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS
        hsbPolicy - Determines when the horizontal scrollbar appears in the scrollpane. The possible values are:
        • ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
        • ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER
        • ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS
        Returns:
        The scroll pane.
        Since:
        24
      • createHTMLEditorPane

        public static javax.swing.JEditorPane createHTMLEditorPane​(java.lang.String text,
                                                                   boolean useStandardTextFont)
        Creates a JEditorPane to edit HTML content.
        Parameters:
        text - the text to initialize the Editor
        useStandardTextFont - true if the Editor should use the same font as a standard JTextArea.
        Returns:
        The JEditorPane
        Since:
        25.0
      • createTextArea

        public static javax.swing.JTextArea createTextArea​(java.lang.String contentType)
        Create a javax.swing.JTextArea extension with undo/redo support. It also has an "edit" contextual menu (Cut, Copy, Paste, etc.). The current line in the text area is highlighted.
        Parameters:
        contentType - The content type used for color syntax highlight. The content types are available in ro.sync.basic.contenttypes.ContentTypes. If null, the plain text content type will be used.
        Returns:
        the text area.
        Since:
        25.0
      • createTextArea

        public static javax.swing.JTextArea createTextArea​(java.lang.String contentType,
                                                           boolean highlightCurrentLine)
        Create a javax.swing.JTextArea extension extension with undo/redo support. It also has an "edit" contextual menu (Cut, Copy, Paste, etc.).
        Parameters:
        contentType - The content type used for color syntax highlight. The content types are available in ro.sync.basic.contenttypes.ContentTypes. If null, the plain text content type will be used.
        highlightCurrentLine - true to highlight the current line
        Returns:
        the text area.
        Since:
        26.1

        *********************************
        EXPERIMENTAL - Subject to change
        ********************************

        Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.

      • changeContentType

        public static void changeContentType​(javax.swing.JTextArea textArea,
                                             java.lang.String contentType)
        Changes the content type of a text area created with Oxygen API createTextArea(String)
        Parameters:
        textArea - The text area to change the content type. The text area should be an Oxygen API text area
        contentType - The content type used for color syntax highlight. The content types are available in ro.sync.basic.contenttypes.ContentTypes. If null, the plain text content type will be used.
        Since:
        25.0