org.springframework.richclient.factory
Interface ComponentFactory

All Known Implementing Classes:
DefaultComponentFactory

public interface ComponentFactory

A factory interface for encapsulating logic to create well-formed, configured GUI controls.

Author:
Keith Donald

Method Summary
 void addConfiguredTab(JTabbedPane tabbedPane, String labelKey, JComponent tabComponent)
          Adds a tab to the provided tabbed pane, configuring the tab's appearance from information retrieved using the labelKey property.
 void configureForEnum(JComboBox comboBox, Class enumType)
          Configure a combo box to be populated with all enums of the specified enumeration type.
 JButton createButton(String labelKey)
          Create and configure a button with the specified label key.
 JCheckBox createCheckBox(String labelKey)
          Create a configured checkbox.
 JCheckBox createCheckBox(String[] labelKeys)
          Create a configured checkbox.
 JComboBox createComboBox()
          Create a combo box using this component factory.
 JComboBox createComboBox(Class enumType)
          Create a combo box using this component factory, to be populated by the list of all enums of the specified type, resolved using this factory's enum resolver.
 JFormattedTextField createFormattedTextField(JFormattedTextField.AbstractFormatterFactory formatterFactory)
          Create a formatted text field using this component factory.
 JLabel createLabel(String labelKey)
          Create and configure a label with the specified label key.
 JLabel createLabel(String[] labelKeys)
          Create and configure a label with the specified label key.
 JLabel createLabel(String labelKey, Object[] arguments)
          Creates and configure a label with the specified label key and parameterized arguments.
 JLabel createLabel(String labelKey, ValueModel[] argumentValueHolders)
          Creates and configure a label with the specified label key and parameterized arguments.
 JComponent createLabeledSeparator(String labelKey)
          Create and configure an left-aligned label acting as a form dividing separator; that is, a control that displays a label and a separator immediately underneath it.
 JComponent createLabeledSeparator(String labelKey, Alignment alignment)
          Create and configure an aligned label acting as a form dividing separator; that is, a control that displays a label and a separator immediately underneath it.
 JLabel createLabelFor(String[] labelKeys, JComponent comp)
          Create and configure a label for the provided component.
 JLabel createLabelFor(String labelKey, JComponent comp)
          Create and configure a label for the provided component.
 JList createList()
          Create a list using this component factory.
 JComboBox createListValueModelComboBox(ValueModel selectedItemValueModel, ValueModel selectableItemsListHolder, String renderedPropertyPath)
          Create a combo box using this component factory.
 JMenuItem createMenuItem(String labelKey)
          Create a configured menu item.
 JPanel createPanel()
          Creates a panel using this component factory.
 JPanel createPanel(LayoutManager layoutManager)
          Creates a panel with the supplied LayoutManager using this component factory.
 JPasswordField createPasswordField()
          Create a standard password field using this component factory.
 JRadioButton createRadioButton(String labelKey)
          Create a configured radio button.
 JRadioButton createRadioButton(String[] labelKeys)
          Create a configured radio button.
 JScrollPane createScrollPane()
          Create a scroll pane using this component factory.
 JScrollPane createScrollPane(Component view)
          Create a scroll pane using this component factory, with the specified component as the viewport view.
 JScrollPane createScrollPane(Component view, int vsbPolicy, int hsbPolicy)
          Create a scroll pane using this component factory, with the specified component as the viewport view and with the specified vertical and horizontal scrollbar policies.
 JTabbedPane createTabbedPane()
          Create and return a new tabbed pane.
 JTable createTable()
          Construct a JTable with a default model.
 JTable createTable(TableModel model)
          Construct a JTable with the specified table model.
 JTextArea createTextArea()
          Create a text area using this component factory.
 JTextArea createTextArea(int row, int columns)
          Create a text area using this component factory.
 JTextArea createTextAreaAsLabel()
          Create a text area that looks like a label (but with cut/copy/paste enabled!) using this component factory.
 JTextField createTextField()
          Create a standard text field using this component factory.
 JComponent createTitledBorderFor(String labelKey, JComponent comp)
          Creates a titled border for the specified component.
 JLabel createTitleLabel(String labelKey)
          Create and configure a title label with the specified label key.
 JToggleButton createToggleButton(String labelKey)
          Create a configured toggle button.
 JToggleButton createToggleButton(String[] labelKeys)
          Create a configured toggle button.
 JComponent createToolBar()
          Construct a JToolBar.
 

Method Detail

createLabel

JLabel createLabel(String labelKey)
Create and configure a label with the specified label key. For example: "&My Control Label:", where the '&' marks a positional mnemonic.

Parameters:
labelKey - The label message code; may also be the label text if no message source is configured.
Returns:
The configured label.

createLabel

JLabel createLabel(String[] labelKeys)
Create and configure a label with the specified label key. For example: "&My Control Label:", where the '&' marks a positional mnemonic.

Parameters:
labelKey - The label message code; may also be the label text if no message source is configured.
Returns:
The configured label.

createLabel

JLabel createLabel(String labelKey,
                   Object[] arguments)
Creates and configure a label with the specified label key and parameterized arguments. Argument values are resolved to {digit placeholder} characters in the resolved message string.

Parameters:
labelKey -
arguments -
Returns:
The configured label.

createLabel

JLabel createLabel(String labelKey,
                   ValueModel[] argumentValueHolders)
Creates and configure a label with the specified label key and parameterized arguments. Argument values are resolved to {digit placeholder} characters in the resolved message string. Argument values are pulled from the provided value model, and this component factory will auto-subscribe for changes, dynamically updating the label when underlying arguments change.

Parameters:
labelKey -
argumentValueHolders - The value model of the arguments;
Returns:
The configured label.

createTitleLabel

JLabel createTitleLabel(String labelKey)
Create and configure a title label with the specified label key. A title label's text matches that of a titled border title (bold, highlighted.)

Parameters:
labelKey - The label message code; may also be the label text if no message source is configured.
Returns:
The configured label.

createTitledBorderFor

JComponent createTitledBorderFor(String labelKey,
                                 JComponent comp)
Creates a titled border for the specified component.

Parameters:
labelKey - the title label message code.
comp - the component to attach a titled border to.
Returns:
the configured component.

createLabelFor

JLabel createLabelFor(String labelKey,
                      JComponent comp)
Create and configure a label for the provided component. Associating a label with a component ensures when the mnemonic is selected the component is given focus.

Parameters:
labelKey - The label message code; may also be the label text if no message source is configured.
comp - the labeled component
Returns:
The configured label.

createLabelFor

JLabel createLabelFor(String[] labelKeys,
                      JComponent comp)
Create and configure a label for the provided component. Associating a label with a component ensures when the mnemonic is selected the component is given focus.

Parameters:
labelKey - The label message code; may also be the label text if no message source is configured.
comp - the labeled component
Returns:
The configured label.

createButton

JButton createButton(String labelKey)
Create and configure a button with the specified label key. The button will be configured with the appropriate mnemonic and accelerator. Note: if you find yourself duplicating the same handler logic accross different buttons, maybe its time to use a Command.

Parameters:
labelKey - The label message code; may also be the label text if no message source is configured.
Returns:
The configured button.

createLabeledSeparator

JComponent createLabeledSeparator(String labelKey)
Create and configure an left-aligned label acting as a form dividing separator; that is, a control that displays a label and a separator immediately underneath it.

Parameters:
labelKey - The label message code; may also be the label text if no message source is configured.
Returns:
The configured labeled separator.

createLabeledSeparator

JComponent createLabeledSeparator(String labelKey,
                                  Alignment alignment)
Create and configure an aligned label acting as a form dividing separator; that is, a control that displays a label and a separator immediately underneath it.

Parameters:
labelKey - The label message code; may also be the label text if no message source is configured.
alignment - The label's alignment.
Returns:
The configured labeled separator.

createList

JList createList()
Create a list using this component factory.

Returns:
The new list.

createComboBox

JComboBox createComboBox()
Create a combo box using this component factory.

Returns:
The new combo box.

createListValueModelComboBox

JComboBox createListValueModelComboBox(ValueModel selectedItemValueModel,
                                       ValueModel selectableItemsListHolder,
                                       String renderedPropertyPath)
Create a combo box using this component factory. The list of selectable items is populated from the provided value model, which provides access to a list. When an item is selected in the list, the selectedItemValueModel is set.

Parameters:
the - value model for the list of selectable items
the - property to render each item in the list.
Returns:
The new combo box.

createComboBox

JComboBox createComboBox(Class enumType)
Create a combo box using this component factory, to be populated by the list of all enums of the specified type, resolved using this factory's enum resolver.

Returns:
The new combo box.

configureForEnum

void configureForEnum(JComboBox comboBox,
                      Class enumType)
Configure a combo box to be populated with all enums of the specified enumeration type. The type must be resolvable by this factory's enum resolver.

Parameters:
enumType - The enumeration type.

createMenuItem

JMenuItem createMenuItem(String labelKey)
Create a configured menu item.

Parameters:
labelKey - The label message code; may also be the label text if no message source is configured.
Returns:
The menu item.

createCheckBox

JCheckBox createCheckBox(String labelKey)
Create a configured checkbox.

Parameters:
labelKey - The label message code; may also be the label text if no message source is configured.
Returns:
The checkbox.

createCheckBox

JCheckBox createCheckBox(String[] labelKeys)
Create a configured checkbox.

Parameters:
labelKeys - The label message codes; may also be the label text if no message source is configured.
Returns:
The checkbox.

createToggleButton

JToggleButton createToggleButton(String labelKey)
Create a configured toggle button.

Parameters:
labelKey - The label message code; may also be the label text if no message source is configured.
Returns:
The toggle button.

createToggleButton

JToggleButton createToggleButton(String[] labelKeys)
Create a configured toggle button.

Parameters:
labelKeys - The label message codes; may also be the label text if no message source is configured.
Returns:
The toggle button.

createRadioButton

JRadioButton createRadioButton(String labelKey)
Create a configured radio button.

Parameters:
labelKey - The label message code; may also be the label text if no message source is configured.
Returns:
The radio button.

createRadioButton

JRadioButton createRadioButton(String[] labelKeys)
Create a configured radio button.

Parameters:
labelKeys - The label message codes; may also be the label text if no message source is configured.
Returns:
The radio button.

createFormattedTextField

JFormattedTextField createFormattedTextField(JFormattedTextField.AbstractFormatterFactory formatterFactory)
Create a formatted text field using this component factory.

Parameters:
formatterFactory - AbstractFormatterFactory used for formatting.
Returns:
The new formatted text field

createTextField

JTextField createTextField()
Create a standard text field using this component factory.

Returns:
the new text field.

createPasswordField

JPasswordField createPasswordField()
Create a standard password field using this component factory.

Returns:
the new password field.

createTextArea

JTextArea createTextArea()
Create a text area using this component factory.

Returns:
The new text area.

createTextArea

JTextArea createTextArea(int row,
                         int columns)
Create a text area using this component factory.

Returns:
The new text area.

createTextAreaAsLabel

JTextArea createTextAreaAsLabel()
Create a text area that looks like a label (but with cut/copy/paste enabled!) using this component factory.

Returns:
The new text area.

createTabbedPane

JTabbedPane createTabbedPane()
Create and return a new tabbed pane.

Returns:
a new tabbed pane.

addConfiguredTab

void addConfiguredTab(JTabbedPane tabbedPane,
                      String labelKey,
                      JComponent tabComponent)
Adds a tab to the provided tabbed pane, configuring the tab's appearance from information retrieved using the labelKey property. The tab title text, icon, mnemonic, and mnemonic index are all configurable.

Parameters:
tabbedPane -
labelKey -
tabComponent -

createScrollPane

JScrollPane createScrollPane()
Create a scroll pane using this component factory.

Returns:
empty scroll pane.
See Also:
JScrollPane.JScrollPane()

createScrollPane

JScrollPane createScrollPane(Component view)
Create a scroll pane using this component factory, with the specified component as the viewport view.

Parameters:
view - the component to display in the scrollpane's viewport
Returns:
scroll pane with specified view
See Also:
JScrollPane.JScrollPane(java.awt.Component)

createScrollPane

JScrollPane createScrollPane(Component view,
                             int vsbPolicy,
                             int hsbPolicy)
Create a scroll pane using this component factory, with the specified component as the viewport view and with the specified vertical and horizontal scrollbar policies.

Parameters:
view - the component to display in the scrollpane's viewport
vsbPolicy - set the vertical scrollbar policy.
hsbPolicy - set the horizontal scrollbar policy.
Returns:
scroll pane with specified view and scrolling policies
See Also:
JScrollPane.JScrollPane(java.awt.Component, int, int)

createPanel

JPanel createPanel()
Creates a panel using this component factory.

Returns:
the panel
See Also:
JPanel

createPanel

JPanel createPanel(LayoutManager layoutManager)
Creates a panel with the supplied LayoutManager using this component factory.

Parameters:
layoutManager - the LayoutManager that will be used by the returned panel
Returns:
a panel
See Also:
JPanel.JPanel(java.awt.LayoutManager)

createTable

JTable createTable()
Construct a JTable with a default model.

Returns:
new table instance

createTable

JTable createTable(TableModel model)
Construct a JTable with the specified table model.

Parameters:
model - TableModel to install into the new table
Returns:
new table instance

createToolBar

JComponent createToolBar()
Construct a JToolBar.

Returns:
new toolbar instance


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.