org.openpermis.editor.policy.gui
Class IconRegistryConverter

java.lang.Object
  extended by org.jdesktop.application.ResourceConverter
      extended by org.openpermis.editor.policy.gui.IconRegistryConverter

public final class IconRegistryConverter
extends org.jdesktop.application.ResourceConverter

Resource converter that looks up icon keys in an icon registry.

An icon key is a key enclosed in angle brackets, e.g. <foo>. Icon keys may have annotations as in the following example: <foo[add,error]>.

Since:
0.3.0

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jdesktop.application.ResourceConverter
org.jdesktop.application.ResourceConverter.ResourceConverterException
 
Field Summary
private  org.jdesktop.application.ResourceConverter delegate
          The resource converter to delegate unhandled requests to.
private static String ICON_REGISTRY_KEY_END
           
private static String ICON_REGISTRY_KEY_START
           
private  IconRegistry iconRegistry
          The primary handler for requests.
private static IconRegistryConverter SINGLETON
          The singleton icon registry converter instance.
 
Fields inherited from class org.jdesktop.application.ResourceConverter
type
 
Constructor Summary
private IconRegistryConverter()
          Creates an icon registry converter that is not active yet.
 
Method Summary
static void activate(IconRegistry iconRegistry)
          Initializes the singleton resource converter.
private static String getIconRegistryKey(String key)
          Returns the icon registry key for the specified key.
static void initialize()
          Reserves a resource converter slot for the icon registry converter.
private  void initialize(org.jdesktop.application.ResourceConverter resourceConverter, IconRegistry registry)
          Activates this resource converter.
 Object parseString(String key, org.jdesktop.application.ResourceMap resourceMap)
           
 boolean supportsType(Class type)
           
 
Methods inherited from class org.jdesktop.application.ResourceConverter
forType, register, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SINGLETON

private static final IconRegistryConverter SINGLETON
The singleton icon registry converter instance.

Due to the poor design of the resource converter class we have to use a singleton which is plugged in at application startup (see initialize) and activate at a later stage.

Since:
0.3.0

ICON_REGISTRY_KEY_START

private static final String ICON_REGISTRY_KEY_START
Constant Field Value:
"<"
Since:
0.3.0

ICON_REGISTRY_KEY_END

private static final String ICON_REGISTRY_KEY_END
Constant Field Value:
">"
Since:
0.3.0

delegate

private org.jdesktop.application.ResourceConverter delegate
The resource converter to delegate unhandled requests to.

Since:
0.3.0

iconRegistry

private IconRegistry iconRegistry
The primary handler for requests.

Since:
0.3.0
Constructor Detail

IconRegistryConverter

private IconRegistryConverter()
Creates an icon registry converter that is not active yet.

Since:
0.3.0
Method Detail

initialize

public static void initialize()
Reserves a resource converter slot for the icon registry converter.

The slot has to be reserver prior to initialization of the default icon resource converter since the converter cannot be removed once its registered.

Since:
0.3.0

activate

public static void activate(IconRegistry iconRegistry)
Initializes the singleton resource converter.

Parameters:
iconRegistry - the icon registry to use.
Since:
0.3.0

getIconRegistryKey

private static String getIconRegistryKey(String key)
Returns the icon registry key for the specified key.

If the key starts and ends with angle brackets it returns the contents between the brackets. Returns null if the key is no icon registry key.

Parameters:
key - the key for which to retrieve the icon registry key.
Returns:
the icon registry key or null if the key is no icon registry key.
Since:
0.3.0

initialize

private void initialize(org.jdesktop.application.ResourceConverter resourceConverter,
                        IconRegistry registry)
Activates this resource converter.

Parameters:
resourceConverter - the delegate to use.
registry - the icon registry to use.
Since:
0.3.0

parseString

public Object parseString(String key,
                          org.jdesktop.application.ResourceMap resourceMap)
                   throws org.jdesktop.application.ResourceConverter.ResourceConverterException
Specified by:
parseString in class org.jdesktop.application.ResourceConverter
Throws:
org.jdesktop.application.ResourceConverter.ResourceConverterException
Since:
0.3.0

supportsType

public boolean supportsType(Class type)
Overrides:
supportsType in class org.jdesktop.application.ResourceConverter
Since:
0.3.0


PERMIS Role Based Access Control 0.4.0 (Build 15)
2009/05/20 08:15:22
Copyright (c) 2002-2007 Ergon Informatik AG