Skip to content

WApplication

Mark Reeves edited this page Jan 3, 2018 · 9 revisions

WApplication is the fundamental WComponent of each application. All WComponents in an application are added to WApplication or a descendant of WApplication.

Creating WApplication

The application's primary UI class should extend WApplication. All other components are then added to this extension of WApplication.

public class MyApp extends WApplication {
  // do stuff
}

UI aspects of WApplication

Warning of unsaved changes

If the current process is the second or subsequent step of a multi-step process and the first step has not yet been committed to the database then the user should be warned if they invoke a cancel Action such as through WCanceButton or a WMenuItem in the cancel state. This can be done by setting the WApplication's unsavedChanges flag:

// assume WApplication application has been instantiated

// to set the unsavedChanges property
application.setUnsavedChanges(true);

// to clear the unsavedChanges property
application.setUnsavedChanges(false);

Default focus

A WApplication may request that focus is set to a particular component on page load. This is actually done on the component to focus but is submitted to the client on the application. This is set automatically under some conditions.

Default focus is not set directly on an instance of WApplication: the focus request is set by calling .setFocussed() on the instance of the component to focus. See Setting focus for more information.

HTML output

WApplication outputs a HTML form element.

Further information

Clone this wiki locally