org.openpermis.editor.policy
Class ApplicationState

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

public final class ApplicationState
extends Object

Describes persistent application state.

Since:
0.1.0

Constructor Summary
ApplicationState()
          Creates a new application state.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a property change listener that gets notified on bound property changes.
 void addRecentFiles(FileType type, String file)
          Adds a recent file of the specified type.
 void addRecentFiles(String file)
          Convenience method to add a file entry to the recent files list.
 String[] getRecentFiles()
          Returns a clone of the recent files list of this application state.
 String getRecentFiles(int index)
          Returns a recent files entry at the specified index.
 int getRecentFilesCount()
          Returns the number of recent files stored at this application state.
 Map<String,String> getWorkingDirectories()
          Java bean accessor for the working directories.
 String getWorkingDirectory(FileType type)
          Returns the working directory bean property.
 File getWorkingDirectoryFile(FileType type)
          Returns the application working directory as file.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes the specified property change listener.
 void removeRecentFiles(int index)
          Convenience method to remove the file entry at the specified index.
 void setRecentFiles(int index, String file)
          Sets the recent files entry at the specified index.
 void setRecentFiles(String[] files)
          Sets the recent files list of this application state.
 void setWorkingDirectories(Map<String,String> workingDirectories)
          Java bean setter for the working directories.
 void setWorkingDirectory(FileType type, String workingDirectory)
          Sets the working directory bean property.
 void setWorkingDirectoryFile(FileType type, File file)
          Sets the application working directory from the given file.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ApplicationState

public ApplicationState()
Creates a new application state.

Since:
0.1.0
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener that gets notified on bound property changes.

The same listener object may be added more than once, and will be called as many times as it is added. If listener is null, no exception is thrown and no action is taken.

Parameters:
listener - the listener to add.
Since:
0.1.0

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes the specified property change listener.

If listener was added more than once to the same event source, it will be notified one less time after being removed. If listener is null, or was never added, no exception is thrown and no action is taken.

Parameters:
listener - the listener to remove.
Since:
0.1.0

getWorkingDirectories

public Map<String,String> getWorkingDirectories()
Java bean accessor for the working directories.

Note: This method is intended for bean bindings and serialization, do not use directly. Wse the various getWorkingDirectory methods instead.

Returns:
the working directories map.
Since:
0.9.0

setWorkingDirectories

public void setWorkingDirectories(Map<String,String> workingDirectories)
Java bean setter for the working directories.

Note: This method is intended for bean bindings and serialization, do not use directly. Wse the various setWorkingDirectory methods instead.

Parameters:
workingDirectories - the new working directories to set.
Since:
0.9.0

getWorkingDirectory

public String getWorkingDirectory(FileType type)
Returns the working directory bean property.

Use the file version if you are interested in an actual File object.

Parameters:
type - the type of working directory to retrieve.
Returns:
the working directory bean property.
See Also:
getWorkingDirectoryFile(FileType)
Since:
0.1.0
0.9.0 added type.

setWorkingDirectory

public void setWorkingDirectory(FileType type,
                                String workingDirectory)
Sets the working directory bean property.

Use the file version if your source is an actual File object.

Parameters:
type - the type of working directory to set.
workingDirectory - the working directory bean property.
See Also:
setWorkingDirectoryFile(FileType,File)
Since:
0.1.0
0.9.0 added type.

getWorkingDirectoryFile

public File getWorkingDirectoryFile(FileType type)
Returns the application working directory as file.

Convenience method for the working directory bean property.

Parameters:
type - the type of working directory to retrieve.
Returns:
the application working directory as file.
See Also:
getWorkingDirectory(FileType)
Since:
0.1.0
0.9.0 added type.

setWorkingDirectoryFile

public void setWorkingDirectoryFile(FileType type,
                                    File file)
Sets the application working directory from the given file.

If the file denotes a directory it is used as is, in case of a plain file the parent directory is chosen.

Convenience method for the working directory bean property.

Parameters:
type - the type of working directory to set.
file - the working directory to set.
See Also:
setWorkingDirectory(FileType,String)
Since:
0.1.0
0.9.0 added type.

getRecentFiles

public String getRecentFiles(int index)
Returns a recent files entry at the specified index.

Parameters:
index - the index of the recent files entry to retrieve.
Returns:
the recent files entry requested or null if there is no such entry.
Since:
0.1.0

getRecentFilesCount

public int getRecentFilesCount()
Returns the number of recent files stored at this application state.

Returns:
the number of recent files stored at this application state.
Since:
0.1.0

getRecentFiles

public String[] getRecentFiles()
Returns a clone of the recent files list of this application state.

Returns:
the recent files list requested, guaranteed not to be null.
Since:
0.1.0

setRecentFiles

public void setRecentFiles(int index,
                           String file)
Sets the recent files entry at the specified index.

Parameters:
index - the index of the file entry to set, [0..getRecentFilesCount()[.
file - the file to entry to set, null to remove the entry.
See Also:
getRecentFilesCount()
Throws:
IllegalArgumentException - if the index is not a valid index.
Since:
0.1.0

removeRecentFiles

public void removeRecentFiles(int index)
Convenience method to remove the file entry at the specified index.

This method changes the whole recent files list.

Parameters:
index - the index of the file entry to set, [0..getRecentFilesCount()[.
Throws:
IllegalArgumentException - if the index is not a valid index.
Since:
0.1.0

addRecentFiles

public void addRecentFiles(FileType type,
                           String file)
Adds a recent file of the specified type.

Note: Currently only files of type FileType.XML_POLICY are stored.

Parameters:
type - the type of file to add.
file - the file to add.
See Also:
addRecentFiles(String)
Since:
0.9.0

addRecentFiles

public void addRecentFiles(String file)
Convenience method to add a file entry to the recent files list.

This method does nothing if the file entry is null or there is already a file entry equal to the one specified contained.

This method changes the whole recent files list.

Parameters:
file - the file entry to add, may be null.
Since:
0.1.0

setRecentFiles

public void setRecentFiles(String[] files)
Sets the recent files list of this application state.

Parameters:
files - the new files list to set, null to set an empty files list.
Since:
0.1.0

toString

public String toString()
Overrides:
toString in class Object
Since:
0.1.0


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