Class SwingComponentManager

  • All Implemented Interfaces:
    net.sf.jguiraffe.gui.builder.components.ComponentManager

    public class SwingComponentManager
    extends Object
    implements net.sf.jguiraffe.gui.builder.components.ComponentManager

    The Swing specific implementation of the ComponentManager interface.

    This class implements the methods of the ComponentManager interface in a way that standard Swing components are created.

    Version:
    $Id: SwingComponentManager.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String BUILDER_NAME
      Constant for the Swing form builder name.
    • Constructor Summary

      Constructors 
      Constructor Description
      SwingComponentManager()
      Creates a new instance of SwingComponentManager.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addContainerComponent​(Object container, Object component, Object constraints)
      Adds the specified component to a container using the given constraints.
      Object createBorderLayout​(net.sf.jguiraffe.gui.builder.components.tags.BorderLayoutTag tag)
      Creates a border layout with the information from the passed in tag.
      net.sf.jguiraffe.gui.forms.ComponentHandler<Boolean> createButton​(net.sf.jguiraffe.gui.builder.components.tags.ButtonTag tag, boolean create)
      Creates a component handler for a command button, which is specified by the given tag.
      protected net.sf.jguiraffe.gui.forms.ComponentHandler<Boolean> createButtonHandler​(AbstractButton button, net.sf.jguiraffe.gui.builder.components.tags.InputComponentTag tag, net.sf.jguiraffe.gui.builder.components.tags.TextIconData data, String command)
      Initializes a button component and creates a component handler for it.
      Object createButtonLayout​(net.sf.jguiraffe.gui.builder.components.tags.ButtonLayoutTag tag)
      Creates a button layout with the information from the passed in tag.
      net.sf.jguiraffe.gui.forms.ComponentHandler<Boolean> createCheckbox​(net.sf.jguiraffe.gui.builder.components.tags.CheckboxTag tag, boolean create)
      Creates a component handler for a checkbox, which is specified by the given tag.
      net.sf.jguiraffe.gui.forms.ComponentHandler<Object> createComboBox​(net.sf.jguiraffe.gui.builder.components.tags.ComboBoxTag tag, boolean create)
      Creates a component handler for a combo box, which is specified by the given tag.
      protected Border createDefaultBorder()
      Creates a default border.
      Object createDesktopPanel​(net.sf.jguiraffe.gui.builder.components.tags.DesktopPanelTag tag, boolean create)
      Creates a desktop panel with the information obtained from the passed in tag.
      net.sf.jguiraffe.gui.builder.event.PlatformEventManager createEventManager()
      Creates the Swing specific platform event manager.
      Object createFont​(net.sf.jguiraffe.gui.builder.components.tags.FontTag tag)
      Creates a font based on the data provided by the given FontTag.
      Object createIcon​(net.sf.jguiraffe.locators.Locator locator)
      Creates an icon with the information obtained from the given locator.
      Object createLabel​(net.sf.jguiraffe.gui.builder.components.tags.LabelTag tag, boolean create)
      Creates a label component with the information obtained from the given tag.
      net.sf.jguiraffe.gui.forms.ComponentHandler<Object> createListBox​(net.sf.jguiraffe.gui.builder.components.tags.ListBoxTag tag, boolean create)
      Creates a component handler for a list, which is specified by the given tag.
      Object createPanel​(net.sf.jguiraffe.gui.builder.components.tags.PanelTag tag, boolean create)
      Creates a panel with the information obtained from the passed in tag.
      net.sf.jguiraffe.gui.forms.ComponentHandler<String> createPasswordField​(net.sf.jguiraffe.gui.builder.components.tags.PasswordFieldTag tag, boolean create)
      Creates a component handler for a password text field which is specified by the given tag.
      Object createPercentLayout​(net.sf.jguiraffe.gui.builder.components.tags.PercentLayoutTag tag)
      Creates a percent layout with the information from the passed in tag.
      net.sf.jguiraffe.gui.forms.ComponentHandler<Integer> createProgressBar​(net.sf.jguiraffe.gui.builder.components.tags.ProgressBarTag tag, boolean create)
      Creates a component handler for a progress bar, which is specified by the given tag.
      net.sf.jguiraffe.gui.forms.ComponentHandler<Boolean> createRadioButton​(net.sf.jguiraffe.gui.builder.components.tags.RadioButtonTag tag, boolean create)
      Creates a component handler for a radio button, which is specified by the given tag.
      ButtonGroup createRadioGroup​(Map<String,​Object> radios)
      Creates a radio group, which contains the specified radio buttons.
      net.sf.jguiraffe.gui.forms.ComponentHandler<Integer> createSlider​(net.sf.jguiraffe.gui.builder.components.tags.SliderTag tag, boolean create)
      Creates a component handler for a slider, which is specified by the given tag.
      Object createSplitter​(net.sf.jguiraffe.gui.builder.components.tags.SplitterTag tag, boolean create)
      Creates a splitter component from the information contained in the passed in tag.
      net.sf.jguiraffe.gui.forms.ComponentHandler<net.sf.jguiraffe.gui.builder.components.model.StaticTextData> createStaticText​(net.sf.jguiraffe.gui.builder.components.tags.StaticTextTag tag, boolean create)
      Creates a component handler for a static text, which is specified by the given tag.
      net.sf.jguiraffe.gui.forms.ComponentHandler<Integer> createTabbedPane​(net.sf.jguiraffe.gui.builder.components.tags.TabbedPaneTag tag, boolean create)
      Creates a component handler for a tabbed pane, which is specified by the given tag.
      net.sf.jguiraffe.gui.forms.ComponentHandler<Object> createTable​(net.sf.jguiraffe.gui.builder.components.tags.table.TableTag tag, boolean create)
      Creates a component handler for a table specified by the given tag.
      net.sf.jguiraffe.gui.forms.ComponentHandler<String> createTextArea​(net.sf.jguiraffe.gui.builder.components.tags.TextAreaTag tag, boolean create)
      Creates a component handler for a text area which is specified by the given tag.
      net.sf.jguiraffe.gui.forms.ComponentHandler<String> createTextField​(net.sf.jguiraffe.gui.builder.components.tags.TextFieldTag tag, boolean create)
      Creates a component handler for a text field which is specified by the given tag.
      net.sf.jguiraffe.gui.forms.ComponentHandler<Boolean> createToggleButton​(net.sf.jguiraffe.gui.builder.components.tags.ToggleButtonTag tag, boolean create)
      Creates a component handler for a toggle button, which is specified by the given tag.
      net.sf.jguiraffe.gui.forms.ComponentHandler<Object> createTree​(net.sf.jguiraffe.gui.builder.components.tags.TreeTag tag, boolean create)
      Creates a component handler for a tree specified by the given tag.
      net.sf.jguiraffe.gui.builder.components.WidgetHandler getWidgetHandlerFor​(Object component)
      Returns a WidgetHandler for the specified component.
      protected void initButton​(AbstractButton button, net.sf.jguiraffe.gui.builder.components.tags.InputComponentTag tag, net.sf.jguiraffe.gui.builder.components.tags.TextIconData data, String command)
      Initializes a button component like a toggle button or a checkbox.
      protected void initComponent​(JComponent component, net.sf.jguiraffe.gui.builder.components.tags.ComponentBaseTag tag)
      Initializes the given component from the specified tag.
      protected void initLabel​(JLabel label, net.sf.jguiraffe.gui.builder.components.tags.ComponentBaseTag tag, net.sf.jguiraffe.gui.builder.components.tags.TextIconData data)
      Initializes a label from a TextIconData object.
      protected void initTableColumnWidths​(net.sf.jguiraffe.gui.builder.components.tags.table.TableTag tag, JTable table)
      Initializes the widths of the columns of the specified table.
      protected void initText​(JTextComponent text, net.sf.jguiraffe.gui.builder.components.tags.InputComponentTag tag, int maxlen)
      Initializes a text component.
      void linkLabel​(Object label, Object component, String text)
      Associates a label with another component.
      protected void registerTableListener​(net.sf.jguiraffe.gui.builder.components.tags.table.TableTag tag, net.sf.jguiraffe.gui.platform.swing.builder.components.SwingTableComponentHandler handler)
      Registers a specialized listener for resizing table columns if required.
      void setContainerLayout​(Object container, Object layout)
      Sets the layout manager for the specified container.
    • Constructor Detail

      • SwingComponentManager

        public SwingComponentManager()
        Creates a new instance of SwingComponentManager.
    • Method Detail

      • addContainerComponent

        public void addContainerComponent​(Object container,
                                          Object component,
                                          Object constraints)
        Adds the specified component to a container using the given constraints. This implementation expects the container object to be of type java.awt.Container and the component of type java.awt.Component. The constraints may be undefined.
        Specified by:
        addContainerComponent in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        container - the container
        component - the component
        constraints - the layout constrains
      • setContainerLayout

        public void setContainerLayout​(Object container,
                                       Object layout)
        Sets the layout manager for the specified container. The passed in container object must be derived from java.awt.Container, the layout manager object must implement the java.awt.LayoutManager interface.
        Specified by:
        setContainerLayout in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        container - the container
        layout - the layout manager
      • createEventManager

        public net.sf.jguiraffe.gui.builder.event.PlatformEventManager createEventManager()
        Creates the Swing specific platform event manager. This is an instance of the SwingEventManager class.
        Specified by:
        createEventManager in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Returns:
        the platform event manager
      • getWidgetHandlerFor

        public net.sf.jguiraffe.gui.builder.components.WidgetHandler getWidgetHandlerFor​(Object component)
        Returns a WidgetHandler for the specified component. This implementation expects that the passed in component is either derived from javax.swing.JComponent or is a javax.swing.ButtonGroup. It will then return a Swing-specific handler implementation, which allows manipulation of this component. Some components created by SwingComponentManager are wrapped inside a JScrollPane. If the component passed in happens to be a scroll pane, the WidgetHandler is therefore created for the viewport component.
        Specified by:
        getWidgetHandlerFor in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        component - the affected component
        Returns:
        a WidgetHandler for this component
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderRuntimeException - if the component is a ButtonGroup and does not contain any elements
      • createLabel

        public Object createLabel​(net.sf.jguiraffe.gui.builder.components.tags.LabelTag tag,
                                  boolean create)
        Creates a label component with the information obtained from the given tag. This method returns a JLabel object if the create parameter is false.
        Specified by:
        createLabel in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the label tag
        create - the create flag
        Returns:
        the label
      • linkLabel

        public void linkLabel​(Object label,
                              Object component,
                              String text)
                       throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Associates a label with another component. The label must be of type javax.swing.JLabel, the component must be of type java.awt.Component.
        Specified by:
        linkLabel in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        label - the label
        component - the component
        text - the text for the label
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createIcon

        public Object createIcon​(net.sf.jguiraffe.locators.Locator locator)
                          throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates an icon with the information obtained from the given locator. An ImageIcon object will be returned.
        Specified by:
        createIcon in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        locator - the Locator pointing to the icon's data
        Returns:
        the icon
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if the icon cannot be loaded
      • createFont

        public Object createFont​(net.sf.jguiraffe.gui.builder.components.tags.FontTag tag)
                          throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a font based on the data provided by the given FontTag. This implementation creates a java.awt.Font object using the constructor that takes a map with attributes. The default font attributes specified by the tag are mapped to corresponding constants of the TextAttribute class. For the map with extended attributes two kinds of keys are supported:
        • Objects of type TextAttribute are used directly.
        • If a key is of type String, it is checked whether it is the name of a constant in the TextAttribute class. In this case the key is accepted.
        All other objects appearing as keys in the map are ignored.
        Specified by:
        createFont in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the FontTag
        Returns:
        the newly created font
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createPercentLayout

        public Object createPercentLayout​(net.sf.jguiraffe.gui.builder.components.tags.PercentLayoutTag tag)
                                   throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a percent layout with the information from the passed in tag. A Swing specific adapter is created for the layout object maintained by the tag.
        Specified by:
        createPercentLayout in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the percent layout tag
        Returns:
        the new layout object
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createButtonLayout

        public Object createButtonLayout​(net.sf.jguiraffe.gui.builder.components.tags.ButtonLayoutTag tag)
                                  throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a button layout with the information from the passed in tag. A Swing specific adapter is created for the button layout maintained by the tag.
        Specified by:
        createButtonLayout in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the button layout tag
        Returns:
        the new layout object
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createBorderLayout

        public Object createBorderLayout​(net.sf.jguiraffe.gui.builder.components.tags.BorderLayoutTag tag)
                                  throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a border layout with the information from the passed in tag. A Swing specific adapter is created for the border layout maintained by the tag.
        Specified by:
        createBorderLayout in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the border layout tag
        Returns:
        the new layout object
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createPanel

        public Object createPanel​(net.sf.jguiraffe.gui.builder.components.tags.PanelTag tag,
                                  boolean create)
                           throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a panel with the information obtained from the passed in tag. The returned object is of type javax.swing.JPanel. If a text is defined or the border attribute is true, a border will be added. This implementation also supports border objects that have been placed into the Jelly context and that are referenced by the borderref attribute.
        Specified by:
        createPanel in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the panel tag
        create - the create flag
        Returns:
        the new panel object
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createDesktopPanel

        public Object createDesktopPanel​(net.sf.jguiraffe.gui.builder.components.tags.DesktopPanelTag tag,
                                         boolean create)
                                  throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a desktop panel with the information obtained from the passed in tag. This implementation will return an instance of the JDesktopPane class.
        Specified by:
        createDesktopPanel in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the desktop panel tag
        create - the create flag
        Returns:
        the new desktop panel
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createSplitter

        public Object createSplitter​(net.sf.jguiraffe.gui.builder.components.tags.SplitterTag tag,
                                     boolean create)
                              throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a splitter component from the information contained in the passed in tag. This implementation returns an instance of the JSplitPane class.
        Specified by:
        createSplitter in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the splitter tag
        create - the create flag
        Returns:
        the splitter component
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createRadioGroup

        public ButtonGroup createRadioGroup​(Map<String,​Object> radios)
                                     throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a radio group, which contains the specified radio buttons. The passed in elements must be of type javax.swing.AbstractButton. The button group must not be empty.
        Specified by:
        createRadioGroup in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        radios - a collection with the radio buttons to add
        Returns:
        the radio group
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createButton

        public net.sf.jguiraffe.gui.forms.ComponentHandler<Boolean> createButton​(net.sf.jguiraffe.gui.builder.components.tags.ButtonTag tag,
                                                                                 boolean create)
                                                                          throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a component handler for a command button, which is specified by the given tag.
        Specified by:
        createButton in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the button tag
        create - the create flag
        Returns:
        the handler for the button
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createToggleButton

        public net.sf.jguiraffe.gui.forms.ComponentHandler<Boolean> createToggleButton​(net.sf.jguiraffe.gui.builder.components.tags.ToggleButtonTag tag,
                                                                                       boolean create)
                                                                                throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a component handler for a toggle button, which is specified by the given tag.
        Specified by:
        createToggleButton in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the toggle button tag
        create - the create flag
        Returns:
        the handler for the toggle button
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createTextField

        public net.sf.jguiraffe.gui.forms.ComponentHandler<String> createTextField​(net.sf.jguiraffe.gui.builder.components.tags.TextFieldTag tag,
                                                                                   boolean create)
                                                                            throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a component handler for a text field which is specified by the given tag.
        Specified by:
        createTextField in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the text field tag
        create - the create flag
        Returns:
        the new component handler
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createTextArea

        public net.sf.jguiraffe.gui.forms.ComponentHandler<String> createTextArea​(net.sf.jguiraffe.gui.builder.components.tags.TextAreaTag tag,
                                                                                  boolean create)
                                                                           throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a component handler for a text area which is specified by the given tag.
        Specified by:
        createTextArea in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the text area tag
        create - the create flag
        Returns:
        the new component handler
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createPasswordField

        public net.sf.jguiraffe.gui.forms.ComponentHandler<String> createPasswordField​(net.sf.jguiraffe.gui.builder.components.tags.PasswordFieldTag tag,
                                                                                       boolean create)
                                                                                throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a component handler for a password text field which is specified by the given tag.
        Specified by:
        createPasswordField in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the password tag
        create - the create flag
        Returns:
        the new component handler
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createCheckbox

        public net.sf.jguiraffe.gui.forms.ComponentHandler<Boolean> createCheckbox​(net.sf.jguiraffe.gui.builder.components.tags.CheckboxTag tag,
                                                                                   boolean create)
                                                                            throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a component handler for a checkbox, which is specified by the given tag.
        Specified by:
        createCheckbox in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the checkbox tag
        create - the create flag
        Returns:
        the new component handler
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createRadioButton

        public net.sf.jguiraffe.gui.forms.ComponentHandler<Boolean> createRadioButton​(net.sf.jguiraffe.gui.builder.components.tags.RadioButtonTag tag,
                                                                                      boolean create)
                                                                               throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a component handler for a radio button, which is specified by the given tag.
        Specified by:
        createRadioButton in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the radio button tag
        create - the create flag
        Returns:
        the new component handler
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createComboBox

        public net.sf.jguiraffe.gui.forms.ComponentHandler<Object> createComboBox​(net.sf.jguiraffe.gui.builder.components.tags.ComboBoxTag tag,
                                                                                  boolean create)
                                                                           throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a component handler for a combo box, which is specified by the given tag.
        Specified by:
        createComboBox in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the combo box tag
        create - the create flag
        Returns:
        the new component handler
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createListBox

        public net.sf.jguiraffe.gui.forms.ComponentHandler<Object> createListBox​(net.sf.jguiraffe.gui.builder.components.tags.ListBoxTag tag,
                                                                                 boolean create)
                                                                          throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a component handler for a list, which is specified by the given tag.
        Specified by:
        createListBox in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the list box tag
        create - the create flag
        Returns:
        the new component handler
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createTabbedPane

        public net.sf.jguiraffe.gui.forms.ComponentHandler<Integer> createTabbedPane​(net.sf.jguiraffe.gui.builder.components.tags.TabbedPaneTag tag,
                                                                                     boolean create)
                                                                              throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a component handler for a tabbed pane, which is specified by the given tag.
        Specified by:
        createTabbedPane in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the tabbed pane tag
        create - the create flag
        Returns:
        the new component handler
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createStaticText

        public net.sf.jguiraffe.gui.forms.ComponentHandler<net.sf.jguiraffe.gui.builder.components.model.StaticTextData> createStaticText​(net.sf.jguiraffe.gui.builder.components.tags.StaticTextTag tag,
                                                                                                                                          boolean create)
                                                                                                                                   throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a component handler for a static text, which is specified by the given tag.
        Specified by:
        createStaticText in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the static text tag
        create - the create flag
        Returns:
        the component handler for the new element
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createProgressBar

        public net.sf.jguiraffe.gui.forms.ComponentHandler<Integer> createProgressBar​(net.sf.jguiraffe.gui.builder.components.tags.ProgressBarTag tag,
                                                                                      boolean create)
                                                                               throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a component handler for a progress bar, which is specified by the given tag.
        Specified by:
        createProgressBar in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the progress bar tag
        create - the create flag
        Returns:
        the component handler for the progress bar element
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createSlider

        public net.sf.jguiraffe.gui.forms.ComponentHandler<Integer> createSlider​(net.sf.jguiraffe.gui.builder.components.tags.SliderTag tag,
                                                                                 boolean create)
                                                                          throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a component handler for a slider, which is specified by the given tag.
        Specified by:
        createSlider in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the slider tag
        create - the create flag
        Returns:
        the component handler for the slider element
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createTable

        public net.sf.jguiraffe.gui.forms.ComponentHandler<Object> createTable​(net.sf.jguiraffe.gui.builder.components.tags.table.TableTag tag,
                                                                               boolean create)
                                                                        throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a component handler for a table specified by the given tag.
        Specified by:
        createTable in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the tag
        create - the create flag
        Returns:
        the component handler
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • createTree

        public net.sf.jguiraffe.gui.forms.ComponentHandler<Object> createTree​(net.sf.jguiraffe.gui.builder.components.tags.TreeTag tag,
                                                                              boolean create)
                                                                       throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Creates a component handler for a tree specified by the given tag.
        Specified by:
        createTree in interface net.sf.jguiraffe.gui.builder.components.ComponentManager
        Parameters:
        tag - the tag
        create - the create flag
        Returns:
        the component handler
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • initComponent

        protected void initComponent​(JComponent component,
                                     net.sf.jguiraffe.gui.builder.components.tags.ComponentBaseTag tag)
        Initializes the given component from the specified tag.
        Parameters:
        component - the component to initialize
        tag - the tag
      • initLabel

        protected void initLabel​(JLabel label,
                                 net.sf.jguiraffe.gui.builder.components.tags.ComponentBaseTag tag,
                                 net.sf.jguiraffe.gui.builder.components.tags.TextIconData data)
        Initializes a label from a TextIconData object.
        Parameters:
        label - the label to be initialized
        tag - the tag with the label definition
        data - the text icon data object
      • initButton

        protected void initButton​(AbstractButton button,
                                  net.sf.jguiraffe.gui.builder.components.tags.InputComponentTag tag,
                                  net.sf.jguiraffe.gui.builder.components.tags.TextIconData data,
                                  String command)
        Initializes a button component like a toggle button or a checkbox. These components can all be handled pretty the same.
        Parameters:
        button - the button to initialize
        tag - the tag for the button
        data - the text icon data object
        command - the button's command (can be null)
      • createButtonHandler

        protected net.sf.jguiraffe.gui.forms.ComponentHandler<Boolean> createButtonHandler​(AbstractButton button,
                                                                                           net.sf.jguiraffe.gui.builder.components.tags.InputComponentTag tag,
                                                                                           net.sf.jguiraffe.gui.builder.components.tags.TextIconData data,
                                                                                           String command)
        Initializes a button component and creates a component handler for it. This method calls initButton() and then creates a SwingButtonHandler that wraps the button.
        Parameters:
        button - the button to initialize
        tag - the tag for the button
        data - the text icon data object
        command - the button's command (can be null)
        Returns:
        the component handler for the button
      • initText

        protected void initText​(JTextComponent text,
                                net.sf.jguiraffe.gui.builder.components.tags.InputComponentTag tag,
                                int maxlen)
        Initializes a text component. Default initialization will be performed and a limited text document will be set if necessary.
        Parameters:
        text - the text component
        tag - the input component tag
        maxlen - the maximum text length
      • createDefaultBorder

        protected Border createDefaultBorder()
        Creates a default border. This method is used for panels that should have a border. If no specific border is specified, the default border returned by this method is used.
        Returns:
        the default border
      • initTableColumnWidths

        protected void initTableColumnWidths​(net.sf.jguiraffe.gui.builder.components.tags.table.TableTag tag,
                                             JTable table)
                                      throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Initializes the widths of the columns of the specified table. This implementation checks whether there is at least one column tag with the width attribute defined. In this case it turns off auto resizing of the table's columns and sets the preferred and minimum widths of the columns affected.
        Parameters:
        tag - the tag defining the table
        table - the table
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs
      • registerTableListener

        protected void registerTableListener​(net.sf.jguiraffe.gui.builder.components.tags.table.TableTag tag,
                                             net.sf.jguiraffe.gui.platform.swing.builder.components.SwingTableComponentHandler handler)
                                      throws net.sf.jguiraffe.gui.builder.components.FormBuilderException
        Registers a specialized listener for resizing table columns if required. This method checks whether the table has columns with a relative width. If this is the case, a listener is registered that adjusts the columns' widths when the table is resized.
        Parameters:
        tag - the table tag
        handler - the handler for the table
        Throws:
        net.sf.jguiraffe.gui.builder.components.FormBuilderException - if an error occurs