Up: W3Kit Class Reference


Superclass: Application or X11_Application

The W3Application object is the central actor in a W3Kit application. It handles communications with HTTP and display servers, and coordinates the saving, restoring, and updating of the state of application objects. Application state is updated through a simulated "event loop".

The W3Application object is created from the program arguments, which might for example specify which X11 display to use. The returned W3Application is also stored in the global variable W3App.

+ newArgc:(int)argc argv:(char **)argv;
- free;
- (BOOL)isBootstrap;
- (const char *)appTitle; // -appName for human consumption

Essential State

The W3Application has a "contents" object which contains all of the stateful objects in the application (for example, all the interface widgets), and is responsible for the contents of the Fill-Out Form.

The contents can be generated either from scratch or from a past run. If generated from scratch they can be sent to the W3Application using setContents:. The -loadFromHttp method exhumes the "essential state" of the contents from the CGI POST data on the standard input.

- loadFromHttp;
- setContents:anHtmlOutput;
- contents;

Non-essential State

The simulated event loop is used to set the "non-essential" state of widgets, that is, state that will be continually refreshed by user input in the Fill-Out Form.

The event loop is put in motion with the run message; calling the stop message from within the event loop causes run to return before the next event is dispatched.

- run;
- stop;
- (BOOL)sendAction:(SEL)aSelector to:aTarget from:sender;

Returning Application Output

Out-of-line Results

At any time before HTML printing begins, the -terminateWithDocument: method can used to return out-of-line results (such as an image) instead of a new Fill-Out Form. The result document given to this message should be a W3Document object.

- terminateWithHtmlError:(const char *)format,...;
- terminateWithDocument:theResult;

In-line Results

The printHtml method starts the whole process, freezing the current application state for caching in the new Form. The printf: method will be most useful for Form layout.

Note that "submit" buttons can be manipulated as full-fledged widgets via the W3Button class. However, the "reset" buttons can only be generated through the methods below.

- printHtml;
- printf:(const char *)format,...;
- printHtmlResetButton;
- printHtmlResetButtonWithStringValue:(const char *)value;
- printHtmlSubmitButton;
- printHtmlSubmitButtonWithStringValue:(const char *)value;
- printHtmlHeader;
- printHtmlTrailer;
- printHtmlInputNameFor:anHtmlInput;
Because HTML 1.8 (for example, X Mosaic) and HTML+ differ in the way that graphical inputs are specified, graphical widgets should use the imageInputType method below to implement inputType (see W3Input).

If the HTTP server running the application is CGI/1.1 compatible (for example, NCSA HTTPD 1.2 or later), then the application can tell which client is invoking it, and change conventions accordingly. If the server is only CGI/1.0 compatible, the conventions of HTML 1.8 are assumed.

- (const char *)imageInputType;
This method returns the current output document as a W3Document.

- currentDocument;

Up: W3Kit Class Reference

[HOME] The Geometry Center Home Page

Author: Paul Burchard
Comments to: webmaster@geom.umn.edu
Created: Apr 18 1994 --- Last modified: Jun 18 1996