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
ComponentManagerinterface.This class implements the methods of the
ComponentManagerinterface 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 StringBUILDER_NAMEConstant 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 voidaddContainerComponent(Object container, Object component, Object constraints)Adds the specified component to a container using the given constraints.ObjectcreateBorderLayout(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.ObjectcreateButtonLayout(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 BordercreateDefaultBorder()Creates a default border.ObjectcreateDesktopPanel(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.PlatformEventManagercreateEventManager()Creates the Swing specific platform event manager.ObjectcreateFont(net.sf.jguiraffe.gui.builder.components.tags.FontTag tag)Creates a font based on the data provided by the givenFontTag.ObjectcreateIcon(net.sf.jguiraffe.locators.Locator locator)Creates an icon with the information obtained from the given locator.ObjectcreateLabel(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.ObjectcreatePanel(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.ObjectcreatePercentLayout(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.ButtonGroupcreateRadioGroup(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.ObjectcreateSplitter(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.WidgetHandlergetWidgetHandlerFor(Object component)Returns aWidgetHandlerfor the specified component.protected voidinitButton(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 voidinitComponent(JComponent component, net.sf.jguiraffe.gui.builder.components.tags.ComponentBaseTag tag)Initializes the given component from the specified tag.protected voidinitLabel(JLabel label, net.sf.jguiraffe.gui.builder.components.tags.ComponentBaseTag tag, net.sf.jguiraffe.gui.builder.components.tags.TextIconData data)Initializes a label from aTextIconDataobject.protected voidinitTableColumnWidths(net.sf.jguiraffe.gui.builder.components.tags.table.TableTag tag, JTable table)Initializes the widths of the columns of the specified table.protected voidinitText(JTextComponent text, net.sf.jguiraffe.gui.builder.components.tags.InputComponentTag tag, int maxlen)Initializes a text component.voidlinkLabel(Object label, Object component, String text)Associates a label with another component.protected voidregisterTableListener(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.voidsetContainerLayout(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.Containerand the component of typejava.awt.Component. The constraints may be undefined.- Specified by:
addContainerComponentin 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.LayoutManagerinterface.- Specified by:
setContainerLayoutin 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 theSwingEventManagerclass.- Specified by:
createEventManagerin 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 aWidgetHandlerfor the specified component. This implementation expects that the passed in component is either derived fromjavax.swing.JComponentor is ajavax.swing.ButtonGroup. It will then return a Swing-specific handler implementation, which allows manipulation of this component. Some components created bySwingComponentManagerare wrapped inside aJScrollPane. If the component passed in happens to be a scroll pane, theWidgetHandleris therefore created for the viewport component.- Specified by:
getWidgetHandlerForin interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager- Parameters:
component- the affected component- Returns:
- a
WidgetHandlerfor this component - Throws:
net.sf.jguiraffe.gui.builder.components.FormBuilderRuntimeException- if the component is aButtonGroupand 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 aJLabelobject if thecreateparameter is false.- Specified by:
createLabelin 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:
linkLabelin 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. AnImageIconobject will be returned.- Specified by:
createIconin interfacenet.sf.jguiraffe.gui.builder.components.ComponentManager- Parameters:
locator- theLocatorpointing 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.Fontobject using the constructor that takes a map with attributes. The default font attributes specified by the tag are mapped to corresponding constants of theTextAttributeclass. For the map with extended attributes two kinds of keys are supported:- Objects of type
TextAttributeare used directly. - If a key is of type
String, it is checked whether it is the name of a constant in theTextAttributeclass. In this case the key is accepted.
- Specified by:
createFontin 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:
createPercentLayoutin 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:
createButtonLayoutin 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:
createBorderLayoutin 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 theborderattribute 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 theborderrefattribute.- Specified by:
createPanelin 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 theJDesktopPaneclass.- Specified by:
createDesktopPanelin 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 theJSplitPaneclass.- Specified by:
createSplitterin 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:
createRadioGroupin 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:
createButtonin 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:
createToggleButtonin 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:
createTextFieldin 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:
createTextAreain 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:
createPasswordFieldin 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:
createCheckboxin 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:
createRadioButtonin 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:
createComboBoxin 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:
createListBoxin 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:
createTabbedPanein 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.FormBuilderExceptionCreates a component handler for a static text, which is specified by the given tag.- Specified by:
createStaticTextin 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:
createProgressBarin 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:
createSliderin 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:
createTablein 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:
createTreein 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 aTextIconDataobject.- 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 aSwingButtonHandlerthat 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.FormBuilderExceptionInitializes 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.FormBuilderExceptionRegisters 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
-
-