Documentation Archive Developer
Search
PATH  WebObjects 4.0 Documentation > EOInterface Reference



EOApplication

Inherits From:
com.sun.java.swing.JApplet

Inherits From:
com.apple.client.eointerface


Class Description

Java programs typically execute either as either an Applet running in a browser or care of a class implementing the static method main (often referred to as an "application"). EOApplication insulates the developer from the details of this distinction by serving as an execution-mode-independent repository for application-level client-side logic. The provided JApplet subclass EOApplet is essentially nothing more than an EOApplication-invoking shell.

EOApplication is for use in Java Client applications only; there isn't an equivalent class for Yellow Box.


Constructors

protected EOApplication()

This constructor is exposed simply so that subclasses may refer to it without compiler error. EOApplication should always be instantiated through one of the two static initializers.



application

public static com.apple.client.eointerface.EOApplication application(com.apple.client.eodistribution.EODistributionChannel channel)

One of two sharedApplication initializers, this variant should be invoked in contexts such as main where the parameters required by the following edition are unavailable and must be requested from a server-side WOJavaClientApplet via channel. Once these parameters have been retrieved this method performs the same initialization as the following method.

public static com.apple.client.eointerface.EOApplication application(java.lang.String className, com.apple.client.eodistribution.EODistributionChannel channel
com.apple.client.foundation.NSArray languages,
java.lang.String controllerClassName,
java.awt.container container)

Sets sharedApplication to a new instance of the EOApplication with className. After initializing an EODistributedObjectStore with channel and establishing it as EOEditingContext's defaultParentObjectStore, this method creates an instance of the EOInterfaceController with controllerClassName and runs it in container (see createInterfaceController and languages for further details).


Instance Methods


applicationWillExit

protected boolean applicationWillExit()

Invoked whenever the last window registered with the receiver via registerWindow has been closed in a non-Applet execution context, this method gives custom subclasses an opportunity to perform any necessary cleanup before exit or simply reject EOApplication's window management logic by returning false (see registerWindow). The default implementation returns true.


createInterfaceController

public static com.apple.client.eointerface.EOInterfaceController createInterfaceController(java.lang.String className, java.awt.Container container)

This convenience method creates and runs a new instance of the EOInterfaceController with className. If container is non-null, it is passed to the new controller's implementation of runInContainer, otherwise the "presentation-neutral" method run is invoked. Returns the new instance.


finishInitialization

protected void finishInitialization()

Invoked as the final step in the receiver's bootstrapping, this method represents a subclass initialization hook somewhat analogous to Applet's init. By the time finishInitialization is invoked, EOEditingContext's defaultParentObjectStore has been set, connecting the receiver to the server, and any specified EOInterfaceController has been instantiated and run.


languages

public void com.apple.client.foundation.NSArray languages()

Returns the array of languages supported by the receiver's localization as defined by developer and retrieved from the server (note that only the first element of this array, typically defined by WOJavaClientApplet's WOAppletLanguageKey, is currently used).


main

public static void main(java.lang.String arguments)

EOApplication's implementation of this method allows client-side programs to execute from the command line in addition to running as an Applet. The first, required element of arguments must be the same application URL users would enter to access the equivalent EOApplet in a browser. The optional second element should be the name of any initial entry page other than Main. After instantiating an EODistributionChannel on the basis of these two parameters,main simply invokes the channel-driven version of application.


registerWindow

public void registerWindow(java.awt.Window window)

Disposing of all windows in a non-Applet-based user interface launched via main does not cause the program to exit because the Java virtual machine continues to run. EOApplication attempts to manage this problem for the consumer by maintaining a registry of all Windows. When the last remaining Window registered with this method is disposed of in a non-Applet execution context, EOApplication invokes shouldTerminate. If this method returns true, System's exit method is invoked with a zero status. Also see windowRegistryEnabled and EOInterfaceController's shouldRegisterWindow.

Note the use of "disposing" rather than "closing" in the previous paragraph. Despite its name, the AWT WindowListener message windowClosed is only sent by java.awt.Window within dispose, not setVisible. As a result, the exit logic EOApplication provides is only activated by Window disposal.


setLanguages

public void setLanguages(com.apple.client.foundation.NSArray languages)

Sets the array of languages supported by the receiver's localization as defined by the developer. Note that only the first element of this array is currently referenced.


setWindowRegistryEnabled

public boolean setWindowRegistryEnabled(boolean enabled)

Sets whether or not the window registration logic described in registerWindow should be used by the receiver.


shouldTerminate

protected boolean shouldTerminate()

This method acts as a subclass hook for application cleanup logic and refinement of the exit condition described in registerWindow. A return value of false will inhibit invocation of exit when all registered windows have been disposed. The default implementation returns true.


sharedApplication

public static void sharedApplication()

Returns the EOApplication instance initialized via one the two application methods, throwing an IllegalStateException if neither has been invoked.


windowRegistryEnabled

public boolean windowRegistryEnabled()

Returns whether or not window registration logic described in registerWindow is used by the receiver. The default is true, but this may be overridden via setWindowRegistryEnabled.





Copyright © 1998, Apple Computer, Inc. All rights reserved.