pp108 : Application

Application

 

The application component models a single application in the Process Platform Ajax Toolkit framework. All HTML pages in Process Platform Ajax Toolkit that comply with the framework are linked to a JScript file called application.js. When this file is linked to the HTML page, the application component gets attached to the page automatically.

HTML

<script src='/cordys/wcp/application.js'></script>

To render the Web application's content in all browsers, you must specify a DOCTYPE for the HTML pages.

HTML

<!DOCTYPE HTML PUBLIC'-//W3C//DTD HTML 4.01 Transitional//EN''http://www.w3.org/TR/html4/loose.dtd'>

Through the application object, the user can also import a library to the web page associated with that object. Once a library is imported to a page, all properties, methods, and events that are in the library are made available to the web page.

Application Framework Flow

  1. When the HTML page is opened, the application component searches for a root application. If the HTML page is itself the root application, then the application component loads the system component. Otherwise, it loads the application library. It also loads the event library, which helps in implementing events.
  2. In the Process Platform framework, an application is opened by calling the select method of the application object (which internally calls the select method of the system component), and passing an application definition to it. The application thus opened, is launched in a container, supplied by the system component. This container provides the application with some additional user interface (or GUI) elements such as the title bar, the close button, the maximize button, and so on. The container provides this additional GUI by using the guiRepresentation component which is available in the framework. Each application is uniquely identified by an ID called applicationID, which is provided in the application definition. The framework uses the same application ID for creating the container for the application. Thus, an application can also be referenced through its container.
  3. Once the application is loaded, the application component checks all the HTML objects on the page, and loads the appropriate libraries attached to them. Then it fires the onapplicationready event, and then the select event based on the data available in the URL.
  4. The component then sets the application state as loaded.

The various properties, methods, and events defined for this component are as follows:

Table 1. List of Attributes

Attribute

Property

Description

appPalettes

appPalettes

Array that contains references to the container objects of all registered AppPalettes in the application. The array is indexed based on AppPalette IDs. This property is READ-ONLY.

container

container

Object that contains a handle to the container of the application. The property is READ-ONLY.

organization

organization

String that contains the distinguished name of the current organizational context in which the application is running

Table 2. List of Methods

Method

Description

addLibrary(url, object)

This method adds the specified library to the object that is passed as a parameter. This method is DEPRECATED. Use the addType()method instead.

addType(object, type)

This method adds the specified type to the object that is passed as a parameter.

confirm (sMessage, [bCancelable], [fpCallBackHandler], [bOnCordysRoot], [sTitle])

Displays confirmation messages. You need to specify the message that is required to proceed to the next step of a procedure.

getLogger()

Returns a Logger object.

getParameter(paramName, defaultValue)

Returns the value of the parameter if the parameter is present in the URL of the window.

  • paramName: Denotes the name of the parameter searched.
  • defaultValue: Is an optional parameter returned by the method if the parameter is not found in the URL.

getStatus()

Returns the last-set status message.

getRegion(sRegionId)

Gets the region for which the ID is defined in the application. If not already present, gets the region in the floating state.

inform (sMessage,[sTitle],[oControl],[oFeedbackObject])

Displays information messages such as messages that confirm successful validations and process completions.

importLibrary(url)

This method can be used to import a library to an application; that is, all the functions of the imported library will be available on the application window.

inherit(subclass, superclass)

This method inherits a subclass from the superclass. It copies all the function pointers of the superclass onto the subclass, unless they are overridden by the subclass.

initializeHTMLElements(htmlElement)

This method adds the Process Platform libraries to the HTML elements (if applicable).

launchDebugger(xml, caption, busdataisland)

Pops up any XML message in the debugger window of Process Platform Ajax Toolkit. This window opens as a Modal application. It is possible to view the XML messages only when the property debug is set to true.

loadAppPalette(oAppPaletteDefinition, data, fpCallbackFunctionHandler)

Starts an AppPalette and loads the container of the AppPalette in the specified region. If the AppPalette is already started, it brings the container of that AppPalette to focus. If specified region is not defined in an application, the AppPalette displays in the floating state.

loadAppPaletteContent(sRegionId, sAppPaletteId, htmlContent, oAppPaletteProperties)

Starts an AppPalette and sets HTML content in the container of the AppPalette.

log(sLogLevel, sLogMessage)

  • sLogLevel: String that mentions the log severity of the message. It accepts values such as DEBUG, INFO, WARN, ERROR, and FATAL.
  • sLogMessage: String that holds the message to be logged.

notify (sMessage,[sTitle],[oControl],[oFeedbackObject])

Displays notification messages such as validation messages and process-completion indicators.

prompt (sMessage, [sDefaultValue], [fpCallBackHandler], [bOnCordysRoot], [sTitle])

Displays prompt messages that require inputs from the user.

removeLibrary(url, object)

This method removes the specified library from the object that is passed as a parameter. Use the removeType() method instead.

removeType(object, Type)

This method removes the specified type from the object that is passed as a parameter.

select

Starts an application and loads the container of an application. If the application is already started, it brings the container of that application to focus.

setDialogSize(dialogWidth, dialogHeight)

Enables you to set the width and height of a dialog box after it is opened.

setDialogTitle(caption, description)

Sets the title of a dialog box after it is opened.

setStatus()

Displays timely status updates and status messages in an application.

showBusy(bShow, [sMessage])

This method displays a screen to block the users from performing any operation on the application.

  • bShow - Boolean. Mandatory. True - displays the busy screen; False - removes the busy screen.
  • sMessage - String. You can provide the message to be displayed while displaying the busy screen. The default text is 'Loading...'.

showDialog (oApplicationDefinition,[oData],[fpApplicationCallback], [fpCallBackHandler], [bOnCordysRoot])

Displays a dialog box.

showError (sMessage,[sTitle],[oControl],[oFeedbackObject])

Displays error messages.

showSOAPFault(oSOAPFaultEvent)

Displays SOAP faults.

Table 3. List of Events

Event

Description

onapplicationblur

Fires when an application loses its focus.

onapplicationfocus

Fires when an application receives focus.

onapplicationselect

Fires when the select method of an application is called.

onapplicationready

Fires when an application is loaded completely. After loading the state of an application becomes loaded.

onbeforeapplicationclose

Fires before an application is closed.

onselect

Fires for every time the select method of an application is called. This event is DEPRECATED. Use onapplicationselect instead.

The EventObject that is created when an event is fired can be accessed using application.<event>.

The application component also helps in debugging activities. This is achieved by use of the launchDebugger() method of the application component, which can be used to launch the debugger window. This debugger tracks all the SOAP requests that are sent to the back end, and also the responses that are returned to the browser.

The spy window is another tool, which can be used with the help of the application component. The applications can send debug messages to this spy window, which is opened in the sub frame of Explorer. For using the spy tool, the applications should set the spyActive attribute to true. Through these spy messages, the developer can track the execution of code in the applications.

The following are the properties and methods exposed by the application component for debugging applications.

Table 4. List of Attributes (for debugging applications)

Attribute

Property

Description

debug

debug

Boolean that indicates whether applications can be debugged or not.

  • true: Applications can be debugged. When this is true, it is possible to see the requests and responses sent from and to the Busdataisland and Bustransactions. This is made possible by popping up the XML used for transaction using the popupXML method.
  • false: Default. Applications cannot be debugged.

spyActive

 

Boolean that indicates whether the Spy window is active to send and receive spy messages from applications.

  • true: Spy window is active. A Spy application appears in the sub frame of the Process Platform Ajax Toolkit application framework, where spy messages sent through the browser using the spy method can be seen.
  • false: Default. Spy window is inactive. Spy messages cannot be seen when this value is set for this property.
Table 5. List of Methods (for debugging applications)

Method

Description

setSpyActive

Sets the value of the spyActive property. This is a Boolean value that indicates whether the Spy window is active to send and receive spy messages from applications.

true

Spy window is active. A Spy application appears in the sub frame of the Process Platform Ajax Toolkit application framework, where spy messages sent through the browser using thespymethod can be seen.

false

Default. Spy window is inactive. Spy messages cannot be seen when this value is set for this property.

spy

Sends the spy message to the browser. It is possible to view the spy messages only when the spyActive property is set to true.

Note:
Process Platform Ajax Toolkit framework will not work for windows opened with showModalDialog() method of the window object. To open a modal window, it is recommended to use the showDialog() method of the application component instead.

Related information

Process Platform Ajax Toolkit Architecture
Overview of Process Platform Ajax Toolkit