- Inherits from:
- EOController : Object
- Implements:
- NSInlineObservable
- NSDisposable
- com.apple.client.EOKeyValueCodingAdditions
- com.apple.client.EOKeyValueCoding
- com.apple.client.NSKeyValueCoding
- EOAction.Enabling
- Package:
- com.apple.client.eoapplication
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 |
NSInlineObservable
NSDisposable
- dispose
EOKeyValueCodingAdditions (com.apple.client.eocontrol)
EOAction.Enabling
- canPerformActionNamed
EOKeyValueCoding (com.apple.client.eocontrol inherited from EOKeyValueCodingAdditions)
NSKeyValueCoding (inherited from EOKeyValueCoding)
- 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
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, he 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
.
public static EOApplication sharedApplication()
Returns the EOApplication instance initialized via the startApplication method, throwing an IllegalStateException if startApplication has not yet been invoked.
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.
public void activatePreviousWindow()
Activates the previously active window. The user can invoke this method from the Window menu.
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.
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.
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.
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.
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.
protected NSArray defaultActions()
Returns an NSArray containing the actions (EOAction objects) the receiver can perform.
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.
public void dispose()
Prepares the receiver so it is disposed when Java performs garbage collection.
public NSArray documents()
Returns an NSArray containing the receiver's visible documents (EODocument objects).
public NSArray documentsForGlobalID(
com.apple.client.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.
public NSArray editedDocuments()
Returns an NSArray containing the receiver's visible documents (EODocument objects) that have been edited.
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.
public boolean hasEditedDocuments()
Returns true
if
any of the receiver's documents has been edited. Otherwise returns false
.
public NSArray languages()
Returns an NSArray containing
the language names (Strings) for which the
application is localized. An example language is English
.
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
public void quit()
Causes the
receiver to quit (provided canQuit
is true
).
See Also: canQuit
public boolean quitsOnLastWindowClose()
Returns whether
or not the receiver quits when the user closes all of its windows.
Defaults to true
.
public boolean saveAll()
Attempts
to save all of the receiver's edited documents and returns true
if
it succeeds.
public void setCanQuit(boolean flag)
Sets whether or not the application has a quit item in the File menu.
public void setQuitsOnLastWindowClose(boolean flag)
Sets whether or not the receiver quits when the user closes all of its windows.
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.
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.
public EOWindowObserver windowObserver()
Returns the receiver's window observer.
DRAFT