Documentation Archive Developer
Search
PATH Documentation > WebObjects

Table of Contents

EOApplication


Inherits from:
EOController : Object
Package:
com.webobjects.eoapplication


Class Description


Java Client applications typically execute from the command line (often referred to as a "Java application") or as an applet running in a browser. EOApplication insulates the developer from this distinction by serving as an execution-mode-independent repository for application-level client-side logic. The provided JApplet subclass EOApplet simply invokes EOApplication with the HTML arguments as parameters.

Each application has a window observer which keeps track of all of the windows in the application, which window is active, and whether all windows have been closed. The window observer has two notifications: ActiveWindowChangedNotification and LastWindowClosedNotification, which the finishInitialization method binds to the activeWindowDidChange and lastWindowDidClose methods, respectively.

Each application also has a defaults manager, an EODefaults object, which maintains two dictionaries for application defaults: a transient dictionary whose values are forgotten when the application exits, and a persistent dictionary whose values are stored on the server. The defaults manager implements valueForKey to read the defaults and setPersistentValueForKey and setTransientValueForKey to store the defaults.

EOApplication is used in Java Client application only; there is no equivalent class on the server side.


XML Tag Default Rule System Controller Type
None None




Constants



Constant Description
ApplicationDidStart Description forthcoming.
ApplicationWillQuit Description forthcoming.



Interfaces Implemented


NSDisposable
dispose
EOKeyValueCodingAdditions (com.webobjects.eocontrol)
EOAction.Enabling
canPerformActionNamed
EOKeyValueCoding (com.webobjects.eocontrol inherited from EOKeyValueCodingAdditions)
NSKeyValueCoding (inherited from EOKeyValueCoding)


Method Types


Accessing the shared instance
sharedApplication
Entering the application
main
startApplication
Initializing and terminating the application
canQuit
finishInitialization
quitsOnLastWindowClose
setCanQuit
setQuitsOnLastWindowClose
Managing the application
arguments
defaults
languages
Managing documents
documents
documentsForGlobalID
editedDocuments
hasEditedDocuments
Managing the window observer
activeWindowDidChange
lastWindowDidClose
setWindowObserver
windowObserver
Methods inherited from Object
toString
Performing main menu operations
activatePreviousWindow
collectChangesFromServer
defaultActions
saveAll
quit


Constructors



EOApplication

public EOApplication()

Description forthcoming.


Static Methods



main

public static void main(String[] args[])

This is the standard entry point for applications started from the command line (not in an applet). The args array contains the application's command-line arguments (for example, -key1 value1 -key2 value2 ...), which are stored in a parameter dictionary (NSDictionary). The user must specify an application URL (using the -applicationURL <application URL> argument), the name of a distribution channel class (using the -channelClassName <channel class name> argument), or both depending on the specific distribution channel. If the user specifies the application URL, they can optionally specify any initial entry page other than Main. After instantiating an EODistributionChannel on the basis of these two parameters, main simply invokes startApplication.

sharedApplication

public static EOApplication sharedApplication()

Returns the EOApplication instance initialized via the startApplication method, throwing an IllegalStateException if startApplication has not yet been invoked.

startApplication

public static EOApplication startApplication( NSDictionary parameterDictionary, EOComponentController initialTopComponentController, boolean remoteRequestArguments)

Creates an EOApplication. An application can execute from the command line or as an applet. EOApplication's parameters are specified using parameterDictionary. If the application is a Java application, the EOApplication's main method reads and parses the parameters from the command line. In addition, it sets remoteRequestArguments to true, which triggers startApplication to read additional parameters from the applet at the URL specified on the command line. If the application is started in an applet, all parameters are contained in the HTML. The initialTopComponentController parameter specifies the top-most EOComponentController in the controller hierarchy. For applets, this controller is an EOAppletController. For command line applications, the main method sets initialTopComponentController to null, which causes a new EOFrameController to be instantiated and used as the top-most EOComponentController.


Instance Methods



activatePreviousWindow

public void activatePreviousWindow()

Activates the previously active window. The user can invoke this method from the Window menu.

activeWindowDidChange

public void activeWindowDidChange(NSNotification aNSNotification)

This method is invoked when the user changes the active window in the receiver (usually by clicking in an inactive window). It is invoked via a notification from the receiver's window observer.

arguments

public NSDictionary arguments()

Returns all of the receiver's arguments in a dictionary. If the application is a Java application (and not an Applet), the arguments can come from both the command line and the applet at the URL specified on the command line.

canPerformActionNamed

public boolean canPerformActionNamed(String actionName)

Conformance to EOAction.Enabling. See the method description of canPerformActionNamed in the interface specification for EOAction.Enabling. An action may be disallowed if it is disabled or is an activatePreviousWindow action and the first window is active.

canQuit

public boolean canQuit()

Returns whether or not the receiver has a Quit item in the File submenu. Defaults to true if the application is run from the command line and false if it is started in an applet.

collectChangesFromServer

public void collectChangesFromServer()

Updates the receiver's Enterprise Objects to reflect the changes sent to the server from other client applications. By default, the application does not automatically update its objects, however, the user can update the objects manually from the Document menu in Direct to Java Client applications.

defaultActions

protected NSArray defaultActions()

Returns an NSArray containing the actions (EOAction objects) the receiver can perform.

defaults

public EODefaults defaults()

Returns the receiver's defaults manager (an EODefaults object). If your application requires the user to log in, you should override this method so it returns null until the user logs in.

dispose

public void dispose()

Prepares the receiver so it is disposed when Java performs garbage collection.

documents

public NSArray documents()

Returns an NSArray containing the receiver's visible documents (EODocument objects).

documentsForGlobalID

public NSArray documentsForGlobalID( com.webobjects.eocontrol.EOGlobalID globalID, String entityName)

Returns an NSArray containing the receiver's visible documents (EODocument objects) that edit Enterprise Objects with an entity name matching entityName and global ID matching globalID.

editedDocuments

public NSArray editedDocuments()

Returns an NSArray containing the receiver's visible documents (EODocument objects) that have been edited.

finishInitialization

protected void finishInitialization()

This method is invoked after the final event thread is guaranteed to be running. If you subclass EOApplication, use this method to initialize anything relating to the user interface or event-handling. Do not perform such initialization using EOApplication's constructor.

hasEditedDocuments

public boolean hasEditedDocuments()

Returns true if any of the receiver's documents has been edited. Otherwise returns false.

languages

public NSArray languages()

Returns an NSArray containing the language names (Strings) for which the application is localized. An example language is English.

lastWindowDidClose

public void lastWindowDidClose(NSNotification aNSNotification)

This method is invoked when the user closes the last window in the receiver. It is invoked as a notification from the receiver's window observer.

See Also: quitsOnLastWindowClose



quit

public void quit()

Causes the receiver to quit (provided canQuit is true).

See Also: canQuit



quitsOnLastWindowClose

public boolean quitsOnLastWindowClose()

Returns whether or not the receiver quits when the user closes all of its windows. Defaults to true.

saveAll

public boolean saveAll()

Attempts to save all of the receiver's edited documents and returns true if it succeeds.

sessionDidTimeOut

public void sessionDidTimeOut()

Description forthcoming.

setCanQuit

public void setCanQuit(boolean flag)

Sets whether or not the application has a quit item in the File menu.

setQuitsOnLastWindowClose

public void setQuitsOnLastWindowClose(boolean flag)

Sets whether or not the receiver quits when the user closes all of its windows.

setWindowObserver

public void setWindowObserver(EOWindowObserver anEOWindowObserver)

Sets the receiver's window observer to anEOWindowObserver. The window observer manages the application's windows: which window is active, how many there are, etc.

toString

public String toString()

Returns the receiver as a string that contains the results of the EOController's toString method, the languages the receiver supports, and the status of the canQuit and quitsOnLastWindowClose flags.

windowObserver

public EOWindowObserver windowObserver()

Returns the receiver's window observer.

© 2001 Apple Computer, Inc. (Last Published April 14, 2001)


Table of Contents