WebForm

General

WebForm is the top-level container in all W4 Toolkit applications. A W4 Toolkit application consists of one or more WebForms with user interface components (widgets) that display information to the user and react to user action (like mouse clicks etc.).

Roughly, a WebForm corresponds to a html page that is displayed in the browser window. A WebForm may open another WebForm in the same window (see setActiveForm()), or open another WebForm in a new browser window (see setShowInNewWindow(boolean)). It usually contains widgets like WebLabels, WebButtons etc.

Usage

To implement a WebForm, extend this class and implement the abstract method setWebComponents(). When the WebForm is created, setWebComponents() is called automatically.
(When you visually edit a WebForm in W4T Eclipse, setWebComponents() is automatically generated for you.)
    public class MyWebForm extends WebForm {
 
      // your field declarations here

      protected void setWebComponents() throws Exception {
        // your initialisation code here
      }
    }
For more information on how to place components on a WebForm and how to arrange them using layout managers, see WebContainer.

WebForm instances are not created with the new-Operator, but must be loaded with the factory method W4TContext.loadForm(String) instead. Thus obtaining a WebForm instance works like this:


   // create an instance of MyForm and register it with the W4T System
   WebForm wf = W4TContext.loadForm( "com.mycorp.w4tapp.MyForm" );
   // cast into a MyForm, if needed
   MyForm myForm = ( MyForm )wf;

Example

Here you can find an example how to create a new window from a WebForm, or how to branch from one WebForm to another.

API documentation

The API documentation for WebForm can be found here.