Class SwingComponentManager
- java.lang.Object
-
- net.sf.jguiraffe.gui.platform.swing.builder.components.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 ofSwingComponentManager
.
-
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 givenFontTag
.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 aWidgetHandler
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 aTextIconData
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.
-
-
-
Field Detail
-
BUILDER_NAME
public static final String BUILDER_NAME
Constant for the Swing form builder name.- See Also:
- Constant Field Values
-
-
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 typejava.awt.Container
and the component of typejava.awt.Component
. The constraints may be undefined.- Specified by:
addContainerComponent
in interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
container
- the containercomponent
- the componentconstraints
- 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 fromjava.awt.Container
, the layout manager object must implement thejava.awt.LayoutManager
interface.- Specified by:
setContainerLayout
in interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
container
- the containerlayout
- 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 theSwingEventManager
class.- Specified by:
createEventManager
in interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Returns:
- the platform event manager
-
getWidgetHandlerFor
public net.sf.jguiraffe.gui.builder.components.WidgetHandler getWidgetHandlerFor(Object component)
Returns aWidgetHandler
for the specified component. This implementation expects that the passed in component is either derived fromjavax.swing.JComponent
or is ajavax.swing.ButtonGroup
. It will then return a Swing-specific handler implementation, which allows manipulation of this component. Some components created bySwingComponentManager
are wrapped inside aJScrollPane
. If the component passed in happens to be a scroll pane, theWidgetHandler
is therefore created for the viewport component.- Specified by:
getWidgetHandlerFor
in interfacenet.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 aButtonGroup
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 aJLabel
object if thecreate
parameter is false.- Specified by:
createLabel
in interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the label tagcreate
- 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 typejavax.swing.JLabel
, the component must be of typejava.awt.Component
.- Specified by:
linkLabel
in interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
label
- the labelcomponent
- the componenttext
- 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. AnImageIcon
object will be returned.- Specified by:
createIcon
in interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
locator
- theLocator
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 givenFontTag
. This implementation creates ajava.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 theTextAttribute
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 theTextAttribute
class. In this case the key is accepted.
- Specified by:
createFont
in interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- theFontTag
- Returns:
- the newly created font
- Throws:
net.sf.jguiraffe.gui.builder.components.FormBuilderException
- if an error occurs
- Objects of type
-
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 interfacenet.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 interfacenet.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 interfacenet.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 typejavax.swing.JPanel
. If a text is defined or theborder
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 theborderref
attribute.- Specified by:
createPanel
in interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the panel tagcreate
- 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 theJDesktopPane
class.- Specified by:
createDesktopPanel
in interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the desktop panel tagcreate
- 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 theJSplitPane
class.- Specified by:
createSplitter
in interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the splitter tagcreate
- 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 typejavax.swing.AbstractButton
. The button group must not be empty.- Specified by:
createRadioGroup
in interfacenet.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 interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the button tagcreate
- 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 interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the toggle button tagcreate
- 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 interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the text field tagcreate
- 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 interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the text area tagcreate
- 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 interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the password tagcreate
- 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 interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the checkbox tagcreate
- 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 interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the radio button tagcreate
- 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 interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the combo box tagcreate
- 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 interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the list box tagcreate
- 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 interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the tabbed pane tagcreate
- 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 interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the static text tagcreate
- 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 interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the progress bar tagcreate
- 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 interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the slider tagcreate
- 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 interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the tagcreate
- 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 interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager
- Parameters:
tag
- the tagcreate
- 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 initializetag
- 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 aTextIconData
object.- Parameters:
label
- the label to be initializedtag
- the tag with the label definitiondata
- 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 initializetag
- the tag for the buttondata
- the text icon data objectcommand
- 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 callsinitButton()
and then creates aSwingButtonHandler
that wraps the button.- Parameters:
button
- the button to initializetag
- the tag for the buttondata
- the text icon data objectcommand
- 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 componenttag
- the input component tagmaxlen
- 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 tabletable
- 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 taghandler
- the handler for the table- Throws:
net.sf.jguiraffe.gui.builder.components.FormBuilderException
- if an error occurs
-
-