Class Application
All Packages Class Hierarchy This Package Previous Next Index
Class Application
public class netscape.application.Application
extends java.lang.Object
implements java.lang.Runnable,
netscape.application.EventProcessor
{
/* Constructors
*/
public Application();
public Application(Applet);
/* Methods
*/
public static Application application();
public static String releaseName();
public void addObserver(ApplicationObserver);
public void appletStarted();
public void appletStopped();
public void cleanup();
public URL codeBase();
protected FoundationApplet createApplet();
public void didProcessEvent(Event);
public EventLoop eventLoop();
public Vector externalWindows();
public void init();
public boolean isApplet();
public boolean isPaused();
public boolean isRunning();
public void keyDown(KeyEvent);
public void keyUp(KeyEvent);
public RootView mainRootView();
public String parameterNamed(String);
public void performCommandAndWait(Target, String, Object);
public void performCommandLater(Target, String, Object, boolean);
public void performCommandLater(Target, String, Object);
public void processEvent(Event);
public void removeObserver(ApplicationObserver);
public Vector rootViews();
public void run();
public void setMainRootView(RootView);
public void stopRunning();
public void willProcessEvent(Event);
}
Object subclass that represents the overall IFC-based Java
application. An Application instance maintains application-wide state and
manages access to resources or objects that provide resources
or services, such as RootViews.
Constructors
Application
public Application()
- Constructs an Application. The Application will not begin processing
Events until it receives a run() message. You will almost never
create an Application instance - the IFC machinery will create
one for you.
- See Also:
- run
Application
public Application(Applet applet)
- Constructs an Application for an existing Applet. You should only
use this constructor when including IFC Views within an AWT-based
component hierarchy. You must call run() on the returned
Application for your Views to draw and receive events.
- See Also:
- FoundationPanel, run
Methods
releaseName
public static String releaseName()
application
public static Application application()
- Returns the application instance.
init
public void init()
- Initializes the Application. Override to perform any initialization.
cleanup
public void cleanup()
- Called when the run loop has exited.
stopRunning
public void stopRunning()
- Destroys the Application, including all ExternalWindows.
Stops the EventLoop and causes run() to return.
run
public void run()
- Starts the Application's EventLoop.
eventLoop
public EventLoop eventLoop()
- Returns the Application's EventLoop.
- See Also:
- EventLoop
isApplet
public boolean isApplet()
- Returns true if the Application was started as an Applet.
codeBase
public URL codeBase()
- Returns the Application's codebase, the URL where the Applet's class
file originated.
parameterNamed
public String parameterNamed(String name)
- Returns the values for the parameter name.
mainRootView
public RootView mainRootView()
- Returns the Application's "main" RootView. In the case of an Applet,
this method returns the RootView associated with the Applet. If
not an Applet and never set by the Application, this method returns
null.
- See Also:
- setMainRootView
setMainRootView
public void setMainRootView(RootView view)
- Sets the main RootView.
- See Also:
- mainRootView
rootViews
public Vector rootViews()
- Returns a Vector containing all the RootViews being displayed
by the Application. This vector is for reading only - do not
modify.
externalWindows
public Vector externalWindows()
- Returns a Vector containing all the ExternalWindows being displayed
by the Application. This Vector is for reading only - do not
modify.
willProcessEvent
public void willProcessEvent(Event anEvent)
- Called before the EventLoop processes anEvent.
The default implementation does nothing.
didProcessEvent
public void didProcessEvent(Event anEvent)
- Called after the EventLoop has processed anEvent.
The default implementation draws all dirty Views. If
you subclass this method, you should call
super.didProcessEvent() at the end of your implementation.
keyDown
public void keyDown(KeyEvent event)
- Subclassers can override to catch key down Events when there's no
focused view.
keyUp
public void keyUp(KeyEvent event)
- Subclassers can override to catch key up Events when there's no
focused view.
performCommandAndWait
public void performCommandAndWait(Target target,
String command,
Object data)
- Causes target to receive a performCommand() message
with command and object, from the Application's
main thread using the Application's EventLoop. This method will not
return until the command has been performed. It can only be called
from threads other than the main thread.
- See Also:
- eventLoop, mainThread
performCommandLater
public void performCommandLater(Target target,
String command,
Object data,
boolean ignorePrevious)
- Causes target to receive a performCommand() message
with command and object, after the current Event and
others in the Application's EventLoop have been processed. If
ignorePrevious is true, this method disposes of all
pending requests with the same target and command.
- See Also:
- eventLoop
performCommandLater
public void performCommandLater(Target target,
String command,
Object data)
- Causes target to receive a performCommand() message
with command and object, after the current Event and
others in the Application's EventLoop have been processed.
Equivalent to the code:
performCommandLater(target, command, data, false)
- See Also:
- performCommandLater
createApplet
protected FoundationApplet createApplet()
- Creates and returns the Application's Applet.
This method will only be called in a stand-alone application.
Application subclasses can override this method to provide a
custom subclass of FoundationApplet. This Applet must have been
added to a java.awt.Frame and have an AppletStub.
- See Also:
- FoundationApplet, Frame, AppletStub
addObserver
public void addObserver(ApplicationObserver observer)
- Adds observer as an object that will receive notifications
when the Application's running state changes. An observer
might be interested in learning when the HTML page containing the
Application is no longer visible, for example. See the
ApplicationObserver interface for more information.
- See Also:
- ApplicationObserver, removeObserver
removeObserver
public void removeObserver(ApplicationObserver observer)
- Removes observer from the group of objects interested in
notifications of changes in the Application's running state.
- See Also:
- addObserver
appletStarted
public void appletStarted()
- Called from an Applet's start() method. Notifies all
ApplicationObservers that the Application has resumed.
Normally called from FoundationApplet.
appletStopped
public void appletStopped()
- Called from an Applet's stop() method. Notifies all
ApplicationObservers that the Application has paused.
Normally called from FoundationApplet.
processEvent
public void processEvent(Event event)
- Processes Application-specific Events.
isRunning
public boolean isRunning()
- Returns true if the Application's EventLoop is
currently running.
isPaused
public boolean isPaused()
- Returns true if the Application is currently paused.
Applications pause when their Applet's HTML page becomes hidden.
All Packages Class Hierarchy This Package Previous Next Index