com.anthonyeden.lib
Class Application

java.lang.Object
  extended bycom.anthonyeden.lib.Application

public class Application
extends java.lang.Object

This class provides basic services which all applications may find useful. The services include location or creation of the home directory, installation of additional look and feels, and a mutable map of application attributes.

Author:
Anthony Eden

Constructor Summary
Application(java.lang.String appName)
          Construct an application with the given name.
 
Method Summary
 void addWindow(java.awt.Component window)
          Add a window to the list of window objects.
 void clearAttributes()
          Clear all attributes.
 java.lang.Object getAttribute(java.lang.Object key)
          Get the attribute for the specified key.
 java.util.Iterator getAttributeKeys()
          Return an Iterator for all attribute keys.
 java.io.File getHomeDirectory()
          Get the current user's home directory.
static Application getInstance(java.lang.String appName)
          Get a instance of an Application object for the named application.
 org.apache.commons.vfs.FileObject getVFSHomeDirectory()
          Get the current user's virtual home directory.
 java.util.List getWindows()
          Get a list of open window objects.
 void initialize(java.lang.String[] args)
          Initialize the application using the given command line arguments.
 java.lang.Object removeAttribute(java.lang.Object key)
          Remove the specified attribute.
 void removeWindow(java.awt.Component window)
          Remove a window from the list of window objects.
 void setAttribute(java.lang.Object key, java.lang.Object value)
          Set the attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Application

public Application(java.lang.String appName)
Construct an application with the given name.

Parameters:
appName - The name of the application
Method Detail

getInstance

public static Application getInstance(java.lang.String appName)
Get a instance of an Application object for the named application. If the application does not exist then one will be created.

Returns:
The Application instance

getHomeDirectory

public java.io.File getHomeDirectory()
Get the current user's home directory. If the directory does not exist then it will be created.

Returns:
The home directory

getVFSHomeDirectory

public org.apache.commons.vfs.FileObject getVFSHomeDirectory()
                                                      throws org.apache.commons.vfs.FileSystemException
Get the current user's virtual home directory. If the virtual directory does not exist then it will be created.

Returns:
The virtual home directory
Throws:
org.apache.commons.vfs.FileSystemException

initialize

public void initialize(java.lang.String[] args)
Initialize the application using the given command line arguments.

Parameters:
args - The command line arguments

getWindows

public java.util.List getWindows()
Get a list of open window objects.

Returns:
A List of window objects

addWindow

public void addWindow(java.awt.Component window)
Add a window to the list of window objects.

Parameters:
window - The window

removeWindow

public void removeWindow(java.awt.Component window)
Remove a window from the list of window objects.

Parameters:
window - The window

getAttribute

public java.lang.Object getAttribute(java.lang.Object key)
Get the attribute for the specified key.

Parameters:
key - The attribute key
Returns:
The attribute value or null

setAttribute

public void setAttribute(java.lang.Object key,
                         java.lang.Object value)
Set the attribute.

Parameters:
key - The attribute key
value - The attribute value

getAttributeKeys

public java.util.Iterator getAttributeKeys()
Return an Iterator for all attribute keys.

Returns:
An Iterator of attribute keys

removeAttribute

public java.lang.Object removeAttribute(java.lang.Object key)
Remove the specified attribute.

Parameters:
key - The attribute key
Returns:
The removed object or null

clearAttributes

public void clearAttributes()
Clear all attributes.



Copyright (c) 2000-2003 Anthony Eden. All Rights Reserved.