aps/View

Abstract class for inheritance.

An application must use this class as the base of inheritance for its custom screens.

Parameters

ARGUMENT

TYPE

DESCRIPTION

params

Object

Specifies properties of the new view.

Examples

define([
    "dojo/_base/declare",
    "aps/_View"
], function (declare, _View) {
return declare(_View, {
    init: function () {
    },
    onShow: function () {
    }
});
});

Public Properties

PROPERTY

TYPE

DEFAULT

DESCRIPTION

description

string

“”

Screen description that (if not empty) overrides the description declared in APP-META.

label

string

“”

Screen label that (if not empty) overrides the label declared in APP-META.

visible

boolean

false

Visibility flag. Property is readonly.

description string

Screen description that (if not empty) overrides the description declared in APP-META.xml. Default value: “”.

label string

Screen label that (if not empty) overrides the label declared in APP-META.xml. Default value: “”.

visible boolean readonly

Visibility flag. Default value: false.

Public Methods

METHOD

RETURN

DESCRIPTION

buildStaticURL (staticFile)

string

Generates the URL for the spceified static file

buttonState (type, params)

undefined

Changes state of a navigation button

byId (id)

widget

Looks up for widget by the generated id, then by the given id

genId (localId)

string

Generates a widget ID unique in scope of the application

getChildren ()

array

Returns all direct children of this widget

init ()

any

The init method is called on loading a view and usually is used to initialize the widget properties

reset ()

undefined

Resets value and state to what it was at initialization for all children of this view

validate ()

boolean

Called by oninit, onblur, and onkeypress

buildStaticURL

Generates the URL for the spceified static file. Uses the package ID and file name to generate URL.

Return: string

ARGUMENT

TYPE

DESCRIPTION

staticFile

String

Name of a static file inside of the package.

buttonState

Changes state of a navigation button. Finds a navigation button by type and setting properties from params.

Return: undefined

ARGUMENT

TYPE

DESCRIPTION

type

String

Callback

params

Object

An object with the following properties:

byId

Looks up for widget by the generated id, then by the given id.

Return: widget

ARGUMENT

TYPE

DESCRIPTION

id

Number

The identity to use to delete the object

genId

Generates a widget ID unique in scope of the application.

Return: string

ARGUMENT

TYPE

DESCRIPTION

localId

String

Local ID of the widget, unique in scope of the view.

getChildren

Returns all direct children of this widget. Returns all widgets underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

Return: array

init

The init method is called on loading a view and usually is used to initialize the widget properties. It is not called, when navigating to the view for the second and all subsequent times. The method initiates widgets and returns widget definition without loading the widgets. The control panel loads the widgets and only after that calls the onShow method. This method can return an array containing definition of widgets that the aps/load method can use. In this case, the lifecycle init => onShow => onContext methods will wait for resolving of the aps/load promise.

Return: any

reset

Resets value and state to what it was at initialization for all children of this view.

Return: undefined

validate

Called by oninit, onblur, and onkeypress. Show missing or invalid messages if appropriate, and highlight textbox field.

Return: boolean

Public Events

EVENT

RETURN

DESCRIPTION

onCancel ()

undefined

An event handler called from the control panel, when a user clicks on the “Cancel” navigation button

onContext ()

undefined

This handler is called once the _aps

onHide ()

undefined

This handler is called when a user leaves this view

onPrev ()

undefined

An event handler called from the control panel, when a user clicks on the “Previous” navigation button

onShow ()

any

This handler is called before making the view visible

onSubmit ()

undefined

An event handler called from the control panel, when a user clicks on the “Submit” navigation button

onCancel

An event handler called from the control panel, when a user clicks on the “Cancel” navigation button.

onContext

This handler is called once the _aps.context_ is received. The method can return a promise (dojo/deferred). In this case the lifecycle init => onShow => onContext methods will wait for the resolving of the promise.

onHide

This handler is called when a user leaves this view.

onPrev

An event handler called from the control panel, when a user clicks on the “Previous” navigation button.

onShow

This handler is called before making the view visible. It can return a promise (dojo/deferred). In this case the lifecycle init => onShow => onContext methods will wait for the resolving of the promise.

onSubmit

An event handler called from the control panel, when a user clicks on the “Submit” navigation button.