org.openpermis.editor.policy.gui
Class ControlFactory

java.lang.Object
  extended by org.openpermis.editor.policy.gui.AbstractComponentFactory
      extended by org.openpermis.editor.policy.gui.ControlFactory

public class ControlFactory
extends AbstractComponentFactory

Factory for controls used by the client.

Use this factory to create controls in views and dialog boxes whenever possible to guarantee a consistent look and feel.

The factory delivers controls that can be configured by means of resource maps (property files) and action maps (action annotations) where appropriate.

Even though tool bars and menu bars have their own factories, the control factory offers access to those factories by redirecting calls to create those controls.

Since:
0.9.0

Nested Class Summary
static interface ControlFactory.Resolver
          Combines the various resolver interfaces to a single resolver interface.
 
Constructor Summary
ControlFactory(ActionMap actionMap, org.jdesktop.application.ResourceMap resourceMap)
          Creates a control factory that operates on the specified action and resource map.
 
Method Summary
 JButton createButton(Action action)
          Creates a button for the specified action.
 JButton createButton(String key)
          Creates a button for the specified action and resource key.
 JButton createButton(String key, Object target, String method)
          Creates a button for the specified resource key, target and method.
 JButton createChooserButton(Action action)
          Creates a chooser button for the specified action.
 JButton createChooserButton(String key)
          Creates a chooser style button for the specified action and resource key.
 JButton createChooserButton(String key, Object target, String method)
          Creates a chooser style button for the specified resource key, target and method.
 JLabel createLabel(String key)
          Creates a label with properties defined in the resource map.
 JLabel createLabel(String key, Component component)
          Creates a label with properties defined in the resource map.
 JMenuBar createMenuBar(String key)
          Creates a menubar with the specified resource key name.
 JMenuBar createMenuBar(String key, MenuBarFactory.Resolver resolver)
          Creates a menubar with the specified resource key name.
 JPasswordField createPasswordField(String key)
          Creates a password field that features an action listener which triggers the action with the specified key.
 JPasswordField createPasswordField(String key, int columns)
          Creates a password field that features an action listener which triggers the action with the specified key.
 JComponent createSeparator(String key)
          Creates a named horizontal separator.
 JTextField createTextField(Object target, String method)
          Creates a text field that features an action listener which triggers the method on the specified target.
 JTextField createTextField(Object target, String method, int columns)
          Creates a text field that features an action listener which triggers the method on the specified target.
 JTextField createTextField(String key)
          Creates a text field that features an action listener which triggers the action with the specified key.
 JTextField createTextField(String key, int columns)
          Creates a text field that features an action listener which triggers the action with the specified key.
 JToolBar createToolBar(String key)
          Creates a tool bar from the specfied resource key.
 JToolBar createToolBar(String key, ToolBarFactory.Resolver resolver)
          Creates a tool bar from the specfied resource key.
 
Methods inherited from class org.openpermis.editor.policy.gui.AbstractComponentFactory
getAction, getAction, getActionMap, getEntries, getResourceMap, isComposite, isGlue, isPlaceholder, isSeparator, unmaskComposite
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ControlFactory

public ControlFactory(ActionMap actionMap,
                      org.jdesktop.application.ResourceMap resourceMap)
Creates a control factory that operates on the specified action and resource map.

Parameters:
actionMap - the action map this factory operates on.
resourceMap - the resource map this factory operates on.
Since:
0.9.0
Method Detail

createMenuBar

public JMenuBar createMenuBar(String key)
Creates a menubar with the specified resource key name.

Parameters:
key - the name of the menu bar configuration in the resource map.
Returns:
the menu bar requested.
See Also:
MenuBarFactory.createMenuBar(String)
Since:
0.9.0

createMenuBar

public JMenuBar createMenuBar(String key,
                              MenuBarFactory.Resolver resolver)
Creates a menubar with the specified resource key name.

Parameters:
key - the name of the menu bar configuration in the resource map.
resolver - the resolver to use for placeholders.
Returns:
the menu bar requested.
See Also:
MenuBarFactory.createMenuBar(String)
Since:
0.9.0

createToolBar

public JToolBar createToolBar(String key)
Creates a tool bar from the specfied resource key.

Parameters:
key - the resource key from which to create tool bar.
Returns:
the tool bar created.
See Also:
ToolBarFactory.createToolBar(String)
Since:
0.9.0

createToolBar

public JToolBar createToolBar(String key,
                              ToolBarFactory.Resolver resolver)
Creates a tool bar from the specfied resource key.

Parameters:
key - the resource key from which to create tool bar.
resolver - the resolver to use for placeholders.
Returns:
the tool bar created.
See Also:
ToolBarFactory.createToolBar(String, ToolBarFactory.Resolver)
Since:
0.9.0

createButton

public JButton createButton(Action action)
Creates a button for the specified action.

Uses the action name to set the name of the button.

Parameters:
action - the action to use for creating the button.
Returns:
the button requested.
Since:
0.9.0

createButton

public JButton createButton(String key)
Creates a button for the specified action and resource key.

Parameters:
key - the action and resource key used to create the button.
Returns:
the button requested.
Since:
0.9.0

createButton

public JButton createButton(String key,
                            Object target,
                            String method)
Creates a button for the specified resource key, target and method.

Parameters:
key - the resource key used to translate the button.
target - the target on which to trigger the method.
method - the method to trigger if the button is pressed.
Returns:
the button requested.
Since:
0.9.0

createChooserButton

public JButton createChooserButton(Action action)
Creates a chooser button for the specified action.

Uses the action name to set the name of the button.

Parameters:
action - the action to use for creating the button.
Returns:
the button requested.
Since:
0.9.0

createChooserButton

public JButton createChooserButton(String key)
Creates a chooser style button for the specified action and resource key.

Parameters:
key - the action and resource key used to create the button.
Returns:
the button requested.
Since:
0.9.0

createChooserButton

public JButton createChooserButton(String key,
                                   Object target,
                                   String method)
Creates a chooser style button for the specified resource key, target and method.

Parameters:
key - the resource key used to translate the button.
target - the target on which to trigger the method.
method - the method to trigger if the button is pressed.
Returns:
the button requested.
Since:
0.9.0

createLabel

public JLabel createLabel(String key)
Creates a label with properties defined in the resource map.

Parameters:
key - the resource key of the label as it appears in the resource map.
Returns:
the label requested.
Since:
0.9.0

createLabel

public JLabel createLabel(String key,
                          Component component)
Creates a label with properties defined in the resource map.

Parameters:
key - the resource key of the label as it appears in the resource map.
component - the component this label is for, or null if the label is not the label for a component.
Returns:
the label requested.
Since:
0.9.0

createTextField

public JTextField createTextField(String key)
Creates a text field that features an action listener which triggers the action with the specified key.

Parameters:
key - the action key to trigger if enter or return is pressed on the text field.
Returns:
the text field requested.
Since:
0.9.0

createTextField

public JTextField createTextField(String key,
                                  int columns)
Creates a text field that features an action listener which triggers the action with the specified key.

Parameters:
key - the action key to trigger if enter or return is pressed on the text field.
columns - the number of columns to use to calculate the preferred width; if columns is set to zero, the preferred width will be whatever naturally results from the component implementation, see JTextField.JTextField(int).
Returns:
the text field requested.
Since:
0.9.0

createTextField

public JTextField createTextField(Object target,
                                  String method)
Creates a text field that features an action listener which triggers the method on the specified target.

Parameters:
target - the target on which to trigger the method.
method - the method to trigger if enter or return is pressed on the text field.
Returns:
the text field requested.
Since:
0.9.0

createTextField

public JTextField createTextField(Object target,
                                  String method,
                                  int columns)
Creates a text field that features an action listener which triggers the method on the specified target.

Parameters:
target - the target on which to trigger the method.
method - the method to trigger if enter or return is pressed on the text field.
columns - the number of columns to use to calculate the preferred width; if columns is set to zero, the preferred width will be whatever naturally results from the component implementation, see JTextField.JTextField(int).
Returns:
the text field requested.
Since:
0.9.0

createPasswordField

public JPasswordField createPasswordField(String key)
Creates a password field that features an action listener which triggers the action with the specified key.

Parameters:
key - the action key to trigger if enter or return is pressed on the password field.
Returns:
the password field requested.
Since:
0.9.0

createPasswordField

public JPasswordField createPasswordField(String key,
                                          int columns)
Creates a password field that features an action listener which triggers the action with the specified key.

Parameters:
key - the action key to trigger if enter or return is pressed on the password field.
columns - the number of columns to use to calculate the preferred width; if columns is set to zero, the preferred width will be whatever naturally results from the component implementation, see JPasswordField.JPasswordField(int).
Returns:
the password field requested.
Since:
0.9.0

createSeparator

public JComponent createSeparator(String key)
Creates a named horizontal separator.

Parameters:
key - the resource key for the name of the separator.
Returns:
the separator created.
Since:
0.9.0


OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:17:21
Copyright (c) 2002-2007 Ergon Informatik AG