Table Of Contents

Application Packaging Standard

Last updated 18-Mar-2019

aps/PageContainer

The root container for a page and thus it should be the only one in a page.

See the specification for more information.

Compatibility

All user panels - CP and UX1

Overview

For correct functioning of the user interface, all widgets regardless of the way they are declared, must be placed inside the root aps/PageContainer considered in this document.

Find the nested rules in the recommended Widget Hierarchy.

Process Messages

The root container contains a MessageList property that is a pointer to the list of messages displayed on the screen. If you want to output a certain message to the screen, you need to get the list of messages using the get method and add a new message to the list. To clear all messages from the list, you may use the removeAll method.

require(["aps/PageContainer", "aps/Message", "aps/ready!"],
      function(PageContainer, Message){
         var page = new PageContainer({}, "mainPage");

         page.get("messageList").addChild(new Message({
            description:   "Text <a href=\"javascript:void(0)\">Link</a>",
            type:          "progress"
         }));

         page.startup();

         setTimeout(function(){
//            page.get("messageList").removeAll();  // Uncomment to remove message
            page.get("messageList").addChild(new Message({
               description:   "Text<a href=\"javascript:void(0)\">Link</a>",
               type:          "error"
            }));
         }, 1000);
});
<div id="mainPage"></div>

For more detailed information about working with the aps/MessageList and aps/Message widgets see the aps/MessageList document.

Validate

If your view has input widgets and you want to check correctness of the input data, you just need to call the validate method of the aps/PageContainer widget. If the data are correct, the method returns true, otherwise the method returns false and sets focus on the element where the user made a mistake while inputting data.

Examples

Use Widget Loader

RUN DEMO

require(["aps/load", "aps/ready!"],
function(load){
    load([ "aps/PageContainer", [
        ["aps/Panel", [
            [ "aps/Container", {
                title:   "Management of access to the server over SSH "
            },[
                [ "aps/RadioButton", {
                    description: "Not allowed",
                    checked: "checked",
                    name: "allow"
                }],
                [ "aps/RadioButton", {
                    description: "Can allow access only to a chrooted"+
                        "environment", name: "allow"
                }],
                [ "aps/RadioButton", {
                    description: "Can allow access to any type of shell",
                    name: "allow"
                }]
    ]]]]]]);
});

Use Widget Constructor

RUN DEMO

require([
    "aps/PageContainer",
       "aps/Panel",
       "aps/Container",
       "aps/RadioButton",
       "aps/ready!"],
   function(PageContainer, Panel, Container, RadioButton) {
       var page = new PageContainer();
       var panel = new Panel();
       var con = new Container({
           title: "Management of access to the server over SSH "
       });
	page.addChild(panel);
	panel.addChild(con);
       con.addChild(new RadioButton({
           description: "Not allowed",
           checked: "checked",
           name: "allow"
       }));
       con.addChild(new RadioButton({
           description: "Can allow access only to a chrooted" + "environment",
           name: "allow"
       }));
       con.addChild(new RadioButton({
           description: "Can allow access to any type of shell",
           name: "allow"
       }));
       page.placeAt("mainPage");
   });

Public Properties

PROPERTY TYPE DEFAULT DESCRIPTION
messageList object null Singleton list of messages.

messageList object

Singleton list of messages. Default value: null.

Public Methods

METHOD RETURN DESCRIPTION
addChild (child, insertIndex)
undefined
Makes the given widget a child of this widget
destroy ()
undefined
Destroys this widget, but not its descendants
focus ()
aps/_containerbase
function
Focusing the focusable child
getChildren ()
array
Returns all direct children of this widget, i
placeAt ()
dijit/_widgetbase
function
Place this widget somewhere in the DOM based on standard dojo/dom-construct::place() conventions
removeAll ()
undefined
Remove all children in the widget
removeChild (widget)
undefined
Removes the passed widget instance from this widget and destroys it
reset ()
undefined
Resets the widget
startup ()
undefined
Processing after the DOM fragment is added to the document
validate ()
boolean
Called by oninit, onblur, and onkeypress

addChild

Makes the given widget a child of this widget. Inserts specified child widget’s dom node as a child of this widget’s container node, and possibly does other processing (such as layout).

Return: undefined

ARGUMENT TYPE DESCRIPTION
child
Widget
Child widget
insertIndex
Number
String
Position child in the parent widget

destroy

Destroys this widget, but not its descendants. Descendants are the widgets inside this.containerNode. Will also destroy any resources (including widgets) registered via this.own().

Return: undefined

focus

Focusing the focusable child

Return: aps/_containerbase function

getChildren

Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it returns not all descendetns, but only the direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

Note the returned array is a simple array. The application code should not assume existence of methods like forEach().

Return: array

placeAt

Place this widget somewhere in the DOM based on standard dojo/dom-construct::place() conventions. A convenience function providing a simple shorthand mechanism to put an existing (or newly created) widget somewhere in the DOM, and allow chaining.

Return: dijit/_widgetbase function

removeAll

Remove all children in the widget.

Return: undefined

removeChild

Removes the passed widget instance from this widget and destroys it. You can also pass in an integer indicating the index within the container to remove (ie, removeChild(5) removes the sixth widget).

Return: undefined

ARGUMENT TYPE DESCRIPTION
widget
Widget
Int
Child widget or index

reset

Resets the widget.

Return: undefined

startup

Processing after the DOM fragment is added to the document. Called after a widget and its children have been created and added to the page and all related widgets have finished their creation cycle, that is after the postCreate() function is successfully completed for each of the related widgets. Note that startup() may be called while the widget is still hidden.

Return: undefined

validate

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

Return: boolean