org.openpermis.editor.policy.gui
Class ComponentFactory

java.lang.Object
  extended by org.openpermis.editor.policy.gui.ComponentFactory
Direct Known Subclasses:
ButtonFactory, MenuBarFactory

public abstract class ComponentFactory
extends Object

Abstract factory for user interface components based on resource and action map keys.

Since:
0.1.0

Field Summary
private  ActionMap actionMap
          The action map attached to this factory instance.
private static char[] COMPOSITE
          Resource entry start and stop characters for composite entries.
private static String ENTRIES
          Suffix for collection entries.
private static String GLUE
          Resource entry value for a tool glue entry.
private static char[] PLACEHOLDER
          Resource entry start and stop characters for placeholders.
private  org.jdesktop.application.ResourceMap resourceMap
          The resource map attached to this factory instance.
private static String SEPARATOR
          Resource entry value for a tool separator entry.
 
Constructor Summary
protected ComponentFactory(ActionMap actionMap, org.jdesktop.application.ResourceMap resourceMap)
          Creates an abstract factory that operates on the specified action and resource map.
 
Method Summary
protected  Action getAction(String name)
          Returns a swing action with the specified name.
protected  ActionMap getActionMap()
          Returns the action map this factory operates on.
protected  String[] getEntries(String name)
          Returns the entries of a collection resource key.
protected  org.jdesktop.application.ResourceMap getResourceMap()
          Returns the resource map this factory operates on.
protected  boolean isComposite(String name)
          Checks if the resource entry is a special composite entry.
protected  boolean isGlue(String name)
          Checks if a resource entry is a glue entry.
private  boolean isMaskedBy(String name, char[] mask)
          Checks if the name specified is surrounded by the mask characters given.
protected  boolean isPlaceholder(String name)
          Checks if the resource entry is a special placeholder entry.
protected  boolean isSeparator(String name)
          Checks if a resource entry is a separator entry.
protected  String unmaskComposite(String name)
          Unmasks a name composite name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENTRIES

private static final String ENTRIES
Suffix for collection entries.

Constant Field Value:
".Entries"
Since:
0.1.0

SEPARATOR

private static final String SEPARATOR
Resource entry value for a tool separator entry.

Constant Field Value:
"-"
Since:
0.1.0

GLUE

private static final String GLUE
Resource entry value for a tool glue entry.

Constant Field Value:
"~"
Since:
0.1.0

PLACEHOLDER

private static final char[] PLACEHOLDER
Resource entry start and stop characters for placeholders.

Since:
0.1.0

COMPOSITE

private static final char[] COMPOSITE
Resource entry start and stop characters for composite entries.

Since:
0.1.0

actionMap

private final ActionMap actionMap
The action map attached to this factory instance.

Since:
0.1.0

resourceMap

private final org.jdesktop.application.ResourceMap resourceMap
The resource map attached to this factory instance.

Since:
0.1.0
Constructor Detail

ComponentFactory

protected ComponentFactory(ActionMap actionMap,
                           org.jdesktop.application.ResourceMap resourceMap)
Creates an abstract 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.1.0
Method Detail

getActionMap

protected ActionMap getActionMap()
Returns the action map this factory operates on.

Returns:
the action map this factory operates on.
Since:
0.1.0

getResourceMap

protected org.jdesktop.application.ResourceMap getResourceMap()
Returns the resource map this factory operates on.

Returns:
the resource map this factory operates on.
Since:
0.1.0

getAction

protected Action getAction(String name)
Returns a swing action with the specified name.

Parameters:
name - the name of the swing action as it appears in the resource map.
Returns:
the swing action requested.
Throws:
IllegalStateException - if the action cannot be found.
Since:
0.1.0

getEntries

protected String[] getEntries(String name)
Returns the entries of a collection resource key.

Collection resource keys always have the suffix .Entries.

Parameters:
name - the name of the collection resource.
Returns:
the entries requested, never null.
Since:
0.1.0

isMaskedBy

private boolean isMaskedBy(String name,
                           char[] mask)
Checks if the name specified is surrounded by the mask characters given.

Parameters:
name - the name to check.
mask - the mask.
Returns:
true if the name is surrounded by the mask characters.
Since:
0.1.0

isPlaceholder

protected boolean isPlaceholder(String name)
Checks if the resource entry is a special placeholder entry.

Special entries are placeholder replaced at a later stage.

Parameters:
name - the name to check.
Returns:
true if the entry is a placeholder.
Since:
0.1.0

unmaskComposite

protected String unmaskComposite(String name)
Unmasks a name composite name.

Parameters:
name - the name to unmask if it is a isComposite(String) name.
Returns:
the unmasked name if it was a composite name, the unmodified name otherwise.
Since:
0.1.0

isComposite

protected boolean isComposite(String name)
Checks if the resource entry is a special composite entry.

Special entries are placeholder replaced at a later stage.

Parameters:
name - the name to check.
Returns:
true if the entry is a placeholder.
Since:
0.1.0

isGlue

protected boolean isGlue(String name)
Checks if a resource entry is a glue entry.

Parameters:
name - the resource entry to check.
Returns:
true if the entry denotes a glue entry, false otherwise.
Since:
0.1.0

isSeparator

protected boolean isSeparator(String name)
Checks if a resource entry is a separator entry.

Parameters:
name - the resource entry to check.
Returns:
true if the entry denotes a separator, false otherwise.
Since:
0.1.0


PERMIS Role Based Access Control 0.3.0 (Build 14)
2009/05/08 09:06:48
Copyright (c) 2002-2007 Ergon Informatik AG