org.openpermis.editor.policy
Class ApplicationContext

java.lang.Object
  extended by org.openpermis.editor.policy.ApplicationContext

public class ApplicationContext
extends Object

Customized application context for the policy editor.

Even though this context shares the name with the context of the Swing Application Framework, the policy editor has to maintain its own application context since the one of the Swing Application Framework is not extensible.

This application context will and should replace all functionality covered by the original Swing Application Framework context and is suitable for injecting into views and presenters.

Since:
0.9.0

Nested Class Summary
static class ApplicationContext.FileChooserType
          Type object for file chooser types.
 
Constructor Summary
ApplicationContext(Application application)
          Creates a new application context for the specified Swing Application Framework context.
 
Method Summary
 File chooseFile(ApplicationContext.FileChooserType chooserType, FileType fileType)
          Opens the file chooser and returns the user selection.
 org.jdesktop.application.ApplicationActionMap getActionMap(Object target)
          Returns the action map of the specified target.
 ApplicationState getApplicationState()
          Returns the application state.
 JFrame getMainFrame()
          Returns the main application frame.
 org.jdesktop.application.ResourceMap getResourceMap(Object target)
          Returns the resource map of the specified target.
 void store()
          Stores all persistent application context state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationContext

public ApplicationContext(Application application)
Creates a new application context for the specified Swing Application Framework context.

Parameters:
application - the owner application of this context.
Since:
0.9.0
Method Detail

getResourceMap

public org.jdesktop.application.ResourceMap getResourceMap(Object target)
Returns the resource map of the specified target.

Uses the type of the target (i.e. Object.getClass() to make a lookup in the underlying Swing Application Framework context using ApplicationContext.getResourceMap(Class)).

Parameters:
target - the target object for which to retrieve the resource map.
Returns:
the resource map requested.
See Also:
ApplicationContext.getResourceMap(Class)
Since:
0.9.0

getActionMap

public org.jdesktop.application.ApplicationActionMap getActionMap(Object target)
Returns the action map of the specified target.

Uses the type of the target (i.e. Object.getClass() to make a lookup in the underlying Swing Application Framework context using ApplicationContext.getActionMap(Class, Object)).

Parameters:
target - the target object for which to retrieve the action map.
Returns:
the action map requested.
See Also:
ApplicationContext.getActionMap(Class, Object)
Since:
0.9.0

getMainFrame

public JFrame getMainFrame()
Returns the main application frame.

Returns:
the main application frame.
Since:
0.9.0

chooseFile

public File chooseFile(ApplicationContext.FileChooserType chooserType,
                       FileType fileType)
Opens the file chooser and returns the user selection.

The file chooser is displayed as dialog with the application frame as parent and will use the specified file chooser type.

Parameters:
chooserType - the file chooser type, either JFileChooser.OPEN_DIALOG or JFileChooser.SAVE_DIALOG.
fileType - file type to choose, may be null.
Returns:
the file chosen or null if the user cancelled.
Since:
0.9.0

getApplicationState

public ApplicationState getApplicationState()
Returns the application state.

The state is lazily loaded or initialized on first use.

Returns:
the application state requested.
Since:
0.9.0

store

public void store()
Stores all persistent application context state.

Note: Errors while storing the application state will only be logged but not forwarded to the caller since there is nothing we can do about I/O errors when storing the state.

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