org.openpermis.editor.policy
Class Application

java.lang.Object
  extended by org.jdesktop.application.AbstractBean
      extended by org.jdesktop.application.Application
          extended by org.jdesktop.application.SingleFrameApplication
              extended by org.openpermis.editor.policy.Application

public class Application
extends org.jdesktop.application.SingleFrameApplication

The singleton policy editor application instance.

In addition to the usual Application responsibilities the policy editor application instance manages the persistent application state.

Since:
0.1.0

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jdesktop.application.Application
org.jdesktop.application.Application.ExitListener
 
Field Summary
private static String APPLICATION_STATE
          Name of the file that holds the persistent application state.
private  org.picocontainer.PicoContainer container
          The dependency injection container of this application.
private static org.slf4j.Logger LOGGER
          The logger object of this class.
private  ApplicationState state
          The persistent state of this application.
private static String VERSION_APPLICATION
          The version file module name of the editor.
private static String VERSION_FILE
          The classpath location of the version property file.
 
Constructor Summary
Application()
           
 
Method Summary
 void about()
          Displays the application about box.
 File chooseFile(int type, boolean addToRecentFiles, PolicyFileFilter filter)
          Opens the file chooser and returns the user selection.
private  org.picocontainer.PicoContainer createContainer(Object... components)
          Creates and configures the pico container for this application.
private  org.jdesktop.application.ApplicationActionMap getActionMap()
          Returns the context application action map of this class.
 ApplicationState getApplicationState()
          Returns the application state.
static Application getInstance()
          Returns the singleton policy editor application instance.
private  org.jdesktop.application.ResourceMap getResourceMap()
          Returns the context resource map of this class.
protected  void initialize(String[] args)
           
private  ApplicationState loadApplicationState()
          Loads the persistent application state.
 void quit()
          Action wrapper for the application exit.
private  String[] readVersionProperties()
          Reads the version properties of the editor.
protected  void shutdown()
           
protected  void startup()
           
private  void storeApplicationState(ApplicationState appState)
          Stores the application state persistently in the application state file.
 
Methods inherited from class org.jdesktop.application.SingleFrameApplication
configureWindow, getMainFrame, getMainView, setMainFrame, show, show, show, show
 
Methods inherited from class org.jdesktop.application.Application
addExitListener, end, exit, exit, getContext, getExitListeners, getInstance, hide, launch, quit, ready, removeExitListener
 
Methods inherited from class org.jdesktop.application.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final org.slf4j.Logger LOGGER
The logger object of this class.

Since:
0.1.0

APPLICATION_STATE

private static final String APPLICATION_STATE
Name of the file that holds the persistent application state.

Constant Field Value:
"state.xml"
Since:
0.1.0

VERSION_FILE

private static final String VERSION_FILE
The classpath location of the version property file.

Constant Field Value:
"version.properties"
Since:
0.3.0

VERSION_APPLICATION

private static final String VERSION_APPLICATION
The version file module name of the editor.

This is used to identify the versioning file for the editor.

Constant Field Value:
"openpermis"
Since:
0.3.0

container

private org.picocontainer.PicoContainer container
The dependency injection container of this application.

See Also:
createContainer(Object...)
Since:
0.1.0

state

private ApplicationState state
The persistent state of this application.

See Also:
getApplicationState(), shutdown()
Since:
0.1.0
Constructor Detail

Application

public Application()
Method Detail

getInstance

public static Application getInstance()
Returns the singleton policy editor application instance.

Returns:
the singleton policy editor application instance.
Since:
0.1.0

getResourceMap

private org.jdesktop.application.ResourceMap getResourceMap()
Returns the context resource map of this class.

Returns:
the context resource map of this class.
Since:
0.1.0

getActionMap

private org.jdesktop.application.ApplicationActionMap getActionMap()
Returns the context application action map of this class.

Returns:
the context application action map of this class.
Since:
0.1.0

readVersionProperties

private String[] readVersionProperties()
Reads the version properties of the editor.

The array returned will contain the master version, the build number and date.

Returns:
the version property array, null if no versioning information is available.
Since:
0.3.0

about

@Action
public void about()
Displays the application about box.

Since:
0.1.0

quit

@Action
public void quit()
Action wrapper for the application exit.

Since:
0.1.0

chooseFile

public File chooseFile(int type,
                       boolean addToRecentFiles,
                       PolicyFileFilter filter)
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:
type - the file chooser type, either JFileChooser.OPEN_DIALOG or JFileChooser.SAVE_DIALOG.
addToRecentFiles - wether to add current file to the recent files list.
filter - file filter, possibly null.
Returns:
the file chosen or null if the user cancelled.
Since:
0.1.0

loadApplicationState

private ApplicationState loadApplicationState()
Loads the persistent application state.

Returns:
the application state or a default state if there is either no application state or there is an error reading the state.
Since:
0.1.0

storeApplicationState

private void storeApplicationState(ApplicationState appState)
Stores the application state persistently in the application state file.

Errors while storing the application state are ignored.

Parameters:
appState - the state to store.
Since:
0.1.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.1.0

createContainer

private final org.picocontainer.PicoContainer createContainer(Object... components)
Creates and configures the pico container for this application.

Parameters:
components - an array of components to add.
Returns:
the dependency injection container for this application.
Since:
0.1.0
0.3.0 added components.

initialize

protected void initialize(String[] args)
Overrides:
initialize in class org.jdesktop.application.Application
Since:
0.1.0

shutdown

protected void shutdown()
Overrides:
shutdown in class org.jdesktop.application.SingleFrameApplication
Since:
0.1.0

startup

protected void startup()
Specified by:
startup in class org.jdesktop.application.Application
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