14.Container

14.1FloatingLayer

Table 14-1.Component Description

Summary

Creates a popup-like window within a window.

Features

  • Displayed on the top layer. (useModal)

  • Can be fixed or set as movable. (movable)

Major Usage

  • Popup window

Figure 14-1.FloatingLayer

Table 14-2.Major APIs

API

Description

useModal

  • useModal="true" is to display the FloatingLayer on top of other components.

documentTitle

  • Sets the page title to be displayed on the browser. documentTitle="true" is to display the text set in the title property as the title on the browser. Upon the end user’s clicking the title will be displayed as the browser title.

Figure 14-2.documentTitle="true" Vs. documentTitle="false"

14.2Generator

Table 14-3.Component Description

Summary

Designed to be more efficiently create a group of multiple components.

Features

  • Generates multiple components at the same time.

  • Dynamically adds or deletes the components to be generated.

  • Components contained in the group are controllable through APIs.

Major Usage

Interfaces to generate web UI comprising of multiple components (Example: Adding input boxes)

Figure 14-3.Generator

Table 14-4.Major APIs

API

Description

getChild(index, id)

  • Returns the WebSquare5 component for the given id in the component group of the corresponding index generated by Generator.

getLength()

  • Returns the repetition count of the Generator.

insert()

  • Adds the repetition to the Generator.

removeAll()

  • Removes all components generated.

The following components cannot be repeatedly generated by the Generator:

Chart
GridView
Menu
Switch
TabControl
TreeView
WindowContainer
Generator Vs. Repeat

Generator: Supports dynamic addition and deletion of the components in the group to be automatically generated.
Repeat: Statically generates the component group.

In most cases where web UIs are repeatedly created, the use of the Generator component is recommended.

14.3Group

Table 14-5.Component Description

Summary

Groups multiple components.

Features

  • Initializes the entire components grouped.

  • Calls functions for the entire components grouped.

  • Sets the HTML5 tag.

Major Usage

  • Creation of general layouts.

  • Web UIs with complex structure

Table 14-6.Major APIs

API

Description

init();

  • Initializes all grouped components.

  • Example: group1.init();

invoke();

  • Calls the corresponding function in all components grouped.

  • Example: group1.invoke("setValue", "WebSquare");

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK (/Group/onmouseleave_onmouseenter_Group.xml)

Figure 14-4.YouTube Video (https://youtu.be/F6d6zU6mmtU)

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK
(/AutoComplete/nextTabByEnter_nextTabID_AutoComplete.xml)

14.4ScrollView

Table 14-7.Component Description

Summary

Provides touch scrolling on mobile devices.

Features

Can contain other components like the Group component.

Figure 14-5.ScrollView

14.5SlideHide

Table 14-8.Component Description

Summary

Provides a slider to show or hide the contents.

Features

Displays a define layer through animation depending on the fired event.

In the initial status, only displayed as defined (showSize).

In case a certain event (slideEvent) occurs such as mouse-over, the slide moves by as defined (moveSize) in the defined direction (slideDirection).

Major Usage

Displays UI upon the end user’s placing the mouse. Functions similar to the quick menus.

Figure 14-6.SlideHide

14.6Switch

Table 14-9.Component Description

Summary

In case multiple cases need to be supported, the Switch components allows for creation of separate web UIs for each of the cases.

Features

  • Dynamically displays the web UI for each case.

  • Sliding effects

  • Default UI provided.

  • Drag-and-drop (in browsers)

  • Touch (Mobile)

Major Usage

  • Page or list selection

Application

  • Mobile accessibility

Figure 14-7.Switch

14.7TabControl

Table 14-10.Component Description

Summary

Creates tab-like windows. Drawing a TabControl component will generate one tab and the content area. Each content area can contain other components like the Group component.

Features

  • External XMLs can be included through the src property.

  • Adding a tab with the addTab function, the developer can choose the frame type - IFrame or WFrame.

  • Tab closing button

  • Web Accessibility

  • Keyboard control

Major Usage

Web UI comprising of multiple tabs

Video Guide

14.7.1Tab Frame Type (frameMode)

Table 14-11.frameMode Setting

Option

Description

frameMode="iframe"

  • Creates an IFrame tab.

  • Scope not supported.

frameMode="wframe"

  • Create a WFrame tab.

  • Scope supported.

frameMode="wframePreload"

  • Create a WFrame tab.

  • Scope supported.

wframe vs. wframePreload

In case of alwaysDraw="false", contents are loaded only when the corresponding wframe or wframePreload tab is activated.

However, note the difference between wframe and wframePreload tabs.

frameMode="wframe"
(1) Creates an object only when the tab is activated.
(2) Objects contained in the inactive tabs cannot be referred to.

frameMode="wframePreload"
(1) Sets an object by loading the src page.
(2) No rendering is not made. (Rendering-related APIs such as a background-changing function are not executed.)
(3) As a result, objects in the inactive tab are referable.
Table 14-12.wframe vs. wframePreload (alwaysDraw="false")

Item

wframe

wframePreload

Tab Loading and Page Rendering

First Tab

  • Loading: Initial

  • Rendering: Initial

  • Loading: Initial

  • Rendering: Initial

Other Tabs

  • Loading: Upon tab selection

  • Rendering: Upon tab selection

  • Loading: Initial

  • Rendering: Upon tab selection

Creating objects contained in the tab

Upon the tab being activated

Upon the tab being loaded.

Referring to the objects in the tab

Only objects in the activated tabs are referable.

Objects in inactive tabs are referable.

Code 14-1.Example

// The following is an example. 
// Using the same frameMode is recommended in the TabControl.

<w2:tabControl id="tabControl1">
    <w2:tabs label="tab_iframe" id="tabs1"></w2:tabs>
    <w2:tabs label="tab_wframe" id="tabs2"></w2:tabs>
    <w2:tabs label="tab_wframePreload" id="tabs3"></w2:tabs>
        <w2:content id="content1" alwaysDraw="false" src="sub.xml" 
            frameMode="iframe"></w2:content>
        <w2:content id="content2" alwaysDraw="false" src="sub2.xml" 
            frameMode="wframe" scope="true"></w2:content>
        <w2:content id="content3" alwaysDraw="false" src="sub3.xml" 
            frameMode="wframePreload" scope="true"></w2:content>
</w2:tabControl>

14.7.2Event Loading Sequence

Table 14-13.Script Execution Sequence

Page

initScript

postScript

onpageload

ontabload

TabControl




4


Tab (WFrame)

1

3





Page (XML)



2


Among w2:content properties, initScript/postScript has been deprecated.

14.7.3Adding Tabs (addTab)

WFrame tabs can be created. Note, however, that the scope setting must be added.

Define a JSON-type dataObject containing parameters and pass it when creating a tab.

The passed parameters can be returned by $p.getParameter(name);. In the following example, $p.getParameter("pageParam"); is used to get the name of the src page.

Code 14-2.Dynamic Tab Creation (Example)

tabControl1.addTab("cmcm011", {
    "label": "Common Code",
    "title": "Common Code",
    "openAction": "exist",
    "closable": "true"
}, {
    "src": "CodeManage.xml",
    "frameMode": "wframePreload"
    "scope": true,
    "alwaysDraw": "true",
    "dataObject": {
        "type": "json",
        "name": "pageParam",
        "data": {
            "name": "WebSquare",
            "addr": "Seoul"
        }
    }
});

14.7.3.1Passing Parameters through dataObject

Pass parameters to the new tab added by addTab through the dataObject. On the created tab, check the received parameters through $p.getParameter.

Video Guide

Passing Parameters to Tab

Code 14-3.addTab (Example)

scwin.addTab = function(label, tabId, src) {
    var tabOpt = {
        label: label,
        closable: true,
        addTabIndex: 0
    };
    var contOpt = {
        frameMode: "iframe",
        scope: true,
        src: src,
        alwaysDraw: false,
        title: tabId,
        "dataObject": {
            "type": "json",
            "name": "dataObject",
            "data": {
                "tabId": tabId,
                "src": src,
                "callback": "$p.parent().scwin.tac_main_callback"
            }
        }
    };
    tabControl1.addTab(tabId, tabOpt, contOpt);
}

14.7.3.2Progress Dialog

In case the src page of the WFrame tab contains a submission, the developer can set to display the process window that is generated upon execution of the submission within the WFrame.

Video Guide

Displaying the process message within the WFrame tab (processMsgFrame="true") - TabControl

Moreover, by changing the settings in the Config.xml file, the developer can change the source of the process message.

Video Guide

Changing the source of the process message. (TabControl)

14.7.4Scope Referencing

WFrame tabs can be referred to by getWindow and $p.parent APIs.

Table 14-14.Executing scwin.test1(); of tab1

Script Location

Accessing Method

main()

tabControl1.getWindow("tab1").scwin.test();

wframe1

$p.parent().tabControl1.getWindow("tab1").scwin.test();

14.7.5Changing the src Property

When dynamically changing the path of the content page, use the getFrame API.

Code 14-4.Example

tabControl1.getFrame("tab1").setSrc(
        "/ui/tab2.xml", {
            "dataObject": {
                "type": "json",
                "name": "pageParam",
                "data": {
                    "name": "WebSquare",
                    "addr": "Seoul"
                }
            }
        );

14.7.6When There are Multiple Tabs

14.7.6.1Position of Tabs (tabPosition)

When there are multiple tabs, the developer can decide where to display the tabs by setting the tabPosition property.

Figure 14-8.tabPosition="top"

Figure 14-9.tabPosition="left"

Figure 14-10.tabPosition="right"

Figure 14-11.tabPosition="bottom"

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK (/TabContrl/tabPosition_TabControl/)

Figure 14-12.YouTube Video (https://youtu.be/HXLexQKZUTU)

14.7.6.2Scroll and Tab List (tabScroll="true")

When creating multiple tab, add tabScroll="true" setting to display a scroll and a tab list on the top.

Figure 14-13.tabScroll="false"

Figure 14-14.tabScroll="true"

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK (/TabControl/tabScroll_tabPosition_TabControl/)

Figure 14-15.YouTube Video (https://youtu.be/G2NKZg9n_eM)

14.7.6.3Activating Tab by Scroll Button (changeActiveTab="true")

Setting as tabScroll="true" will display scroll buttons and clicking the scroll button will only show the tab list. Adding changeActiveTab="true" setting, however, will allow the end user to activate a tab on the tab list.

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK(/TabControl/tabScroll_changeActiveTab_TabControl/)

Figure 14-16.YouTube Video (https://youtu.be/srqwDbr70FM)

14.7.6.4Moving Remaining Tabs Forward upon Tab Closing (tabScrollAuto="true")

Moreover, by adding tabScrollAuto="true", the developer can display as many tabs as possible.

Figure 14-17.tabScrollAuto="false"

Figure 14-18.tabScrollAuto="true"

Video Guide and Sample File

Video Guide Adding a scroll and a tab list for multiple tabs. (TabControl)
Sample File

14.7.7Keeping Child Tab Disabled

Setting as keepDisabledTab="true" will keep the child tab disabled regardless of the status of the parent tab.

For example, when a tab in the parent TabControl has a child TabControl, the disabled tab of the child TabControl will remain disabled although the tab of the parent TabControl is activated or enabled.

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK (/TabControl/keepDisabledTab_TabControl/)

Figure 14-19.YouTube Video (https://youtu.be/5BCe5c4avtM)

14.7.8PopUp

14.7.8.1Displaying PopUp in the Specified Frame

When creating a frameMode="wframe" or frameMode="wframePreload" tab and opening a popup on the wframe or wframePreload tab with $open.popUp(), the developer can specify the frame to display the popup. Use $open.popUp() function and options.frameModal option.

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK
(/TabControl/frameMode_tabControl_content_openPopup_frameModal_$p/)

Figure 14-20.YouTube Video (https://youtu.be/dGoIpOaHJcA)

Reference
See Frame Modal Popup (options.frameModal).

14.7.8.2Closing Parent – Child PopUps

The developer can create popups on a tab using $p.openPopup() and can close all child popups and the parent popup.

  1. Note, however, this feature is valid only on the WFrame tabs. Create a frameMode="wframe" or frameMode="wframePreload" tab.

  2. Set the frameModal of the TabControl as "true".

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK(/TabControl/frameModal_TabControl/)

Figure 14-21.YouTube Video (https://youtu.be/eA6lQkcBGsY)

14.7.9Major APIs

Table 14-15.Major APIs

API

Description

useConfirmMessage

  • true is to display a confirmation window upon addition of a tab.

confirmTrueAction

  • Defines the operation upon the end user’s selecting “Confirm”.

    • exist: Displays on the same tab.

    • new : Displays on a new tab.

    • select : Selects the tab of the given id, if exists.

confirmFalseAction

  • Sets the operation upon the end user’s selecting “Cancel”. (exist, new, select)

confirmMessage

  • Sets the confirmation message.

closable

  • Shows the tab-closing icon. (true/false)

  • Added to all tabs or selective tabs.

tabMove

Allows change of the tab orders through drag-and-drop through tabMove="true".

addTab

  • Adds the tab using with the id, and returns the id of the created tab.

deleteTab

  • Deletes the tab of the specified index.

enableTab

  • Enables the tab of the specified index.

getSelectedTabID

  • Returns the ID of the selected tab.

getSelectedTabIndex

  • Returns the index of the selected tab.

getTabIndex

  • Returns the index of the specified tab ID.

getWindow

  • Returns the window content of the specified tab index. Returns the window content of the currently selected tab in case no index is given.

setSelectedTabIndex

  • Selects the tab of the specified index.

deleteAllTabs

  • Closes all tabs at the same time.

onchange(tabID, idx)

  • Triggered upon the end user’s changing the tab.

ontabclick

  • Triggered upon the end user’s clicking the tab.

ontabclose

  • Triggered upon the end user’s clicking the tab closing button.

14.8TableLayout

Table 14-16.Component Description

Summary

To tagname property of the Group, add HTML5 tags (<colgroup>, <tr>, <td>, <th>) and wrap them under <table> tag.

Features

  • Components can be added to each cell in the TableLayout component.

  • The table is easily editable.

Major Usage

  • Forms

Application

Video Guide

Figure 14-22.TableLayout

14.8.1Rendering

Video Guide

Drawing the TableLayout

14.8.2Adaptive Web

Video Guide

Adaptive web through the TableLayout

14.8.3DataCollection Binding and Automatic Component Insertion

  1. Draw a TableLayout component.

  1. Create a DataMap as shown below.

Figure 14-23.DataMap

  1. Drag the DataMap key on the Output tab to a cell in the TableLayout.

  2. Check if the following popup shows up.

  1. Select the component to bind with the DataMap.

Figure 14-24.Component Selection

  1. The following is after the component is bound in each cell. Component key values (Name, Nationality, etc.) are automatically inputted, and the DataMap is also displayed.

Figure 14-25.After Binding

14.9WidgetContainer

Table 14-17.Component Description

Summary

  • Provides multiple web widgets on a single window.

  • UIs including server communication can be used as web widgets.

  • Personalizes the UI layout and the utility use.

  • Newly added to SP2.

Functions

  • Determines the widget position based on the coordinates. (cols, unitHeightPixel)

  • Dynamically creates/adds widgets. (addWidgets)

  • Controls the widget position and the widget size. (Move, Fix, Resize, Minimize/Maximize)

  • Import/Export

    • importWidgets

    • exportWidgets

    • importWidget

    • exportWidget

Features

  • Each widget is managed through a different URL.

  • The user can selectively put the contents on the window.

  • Moves, resizes, minimizes, and maximizes widgets.

  • Uses the WFrame to implement SPA and to more efficiently manage resources.

Related Components

  • WFrame

Video Guide

Video Guide

WidgetContainer

14.9.1Positioning

Code 14-5.Initial State of WidgetContainer.xml

<w2:widgetContainer id="widgetContainer1" cols="8"
    style="width:100%; height:800px;"
    unitHeightPixel="200" mode="pushpull"></w2:widgetContainer>

The WidgetContainer creates a twp-dimensional coordinate system based on cols and unitHeightPixel settings.

Figure 14-26.Coordinate System of the WidgetContainer

Locations and sizes of all widgets contained in the WidgetContainer are decided based on the coordinate system. Adding Widgets When adding widgets, decide the position and the size of the widget using the following options.

Related Options

x: X position

y: Y position

unitWidth: Width on the coordinate system

unitHeight: Height on the coordinate system

Figure 14-27.Determining Widget Positions and Sizes

14.9.2Adding Widgets

The widgets of the WidgetContainer can be dynamically created and added only by the addWidgets function. (Directly adding a widget on the XML file is not allowed.)

The following figure shows basic structure of the widget. The contents part is on the WFrame which carries the XML page (set as the src option.)

Figure 14-28.Widget Structure

Related Functions

addWidgets( optionsArr ): Define a widget to create using options or as an array.

Video Guide

Adding Widgets - WidgetContainer
Table 14-18.optionsArr

Property

Description

Required

unitHeight

Widget height on the coordinate system

O

unitWidth

Widget width on the coordinate system

O

x

x coordinate of the widget

O

y

y coordinate of the widget

O

buttonFormatter

Sets the title button of the widget.

  • useDefault: When set, basic buttons are used. (Basic buttons include Fix, Maximize, Minimize and Close buttons.)

  • id, className, useAPI, isCustom: In case useDefault is not set, a button of the corresponding ID (id) (id) and the class (className) will be created. Upon the user’s clicking, the function defined as the useAPI will be executed. In case of isCustom="true", an onclickcustombtn event will be created for the WidgetContainer for the developer to define the action.


fixed

Fixing status of the widget. (Default: false)

A fixed widget cannot be moved nor resized.


hasTitleBar

Creates a title bar on the widget.

  • true: Create.

  • false: Not create. When there is no title bar, buttons that are provided on the title bar will not be available and the end user cannot also move the widget using the title bar. Access through setTitle or getTitle is not possible either.


id

Widget ID.

All widgets in the WidgetContainer must have a unique ID. However, in case of scope="true", '_' cannot be used.

In case no ID is given, the WidgetContainer will randomly issue an ID.


maximized

Maximizes the widget.

Maximizes according to the maximizeFormatter setting.

The maximized widget is fixed and displayed over other widgets. In this case, the maximized widget and the covered widgets cannot interact each other.


maximizeFormatter

Function or name of the function return the setting related to widget maximization.

The maximization setting has options of 'top', 'bottom', 'left', and 'right' each of which represents the unit to expand in the corresponding direction. However, if the option is not specified or the value is “-1”, the widget will expand to the fullest into the corresponding direction.

When the option value crosses the maximum value, the widget will expand into the opposite direction as much as the exceeding value.

(Default: {top: -1, bottom: -1, left: -1, right: -1})


maximizeonfixed

In case of true widget, maximization through the corresponding button is allowed even when there is fixed: true setting.


minimized

Minimizes the widget.

In case of minimization, only the title will be displayed.


minimizeonfixed

In case of true widget minimization through the corresponding button is allowed even when there is fixed: true setting.


params

User-defined data to save in the widget object. (Default: undefined)

Obtained upon export, and restored with other widget settings upon widget import.


scope

scope feature of the WFrame used in the widget.

(Default: false)


src

Contents to be displayed on the WFrame of the widget. (XML file)

If not specified, an empty screen will be displayed.


title

Widget title


titleClass

Style class to apply to the widget


14.9.3Import/Export

14.9.3.1All Widgets

The developer can export all existing widgets and can also newly add multiple widgets.

Related Functions

importWidgets( jsonArr , clearFlag ): Adds new widgets to the WidgetContainer.

exportWidgets: Exports all widgets currently contained in the WidgetContainer.

Code 14-6.export

var jsonArr = widgetContainer1.exportWidgets();

Code 14-7.export

var jsonArr = widgetContainer1.exportWidgets();

14.9.3.2Individual

The developer can export or import one existing widget.

Related Functions

exportWidget(<widget ID>') : Exports the widget of the corresponding ID.

importWidget( <Widget id>, JSON ): Receives the ID and information of the existing widget in JSON and adds to the WidgetContainer.

Code 14-8.Example

widgetContainer.importWidget('widget1',  { 
    id: 'widget1',
    src:"widget.xml",
    scope:true,
    x:0,
    y:0,
    title:"Individual import",
    }
);

14.9.4Access

14.9.4.1Individual Access

Related Functions

getWidgetById: Returns the widget of the specified ID. (If not exists, null will be returned.)

getWidgetByTitle: Returns the widget of the specified title. (If not exists, null will be returned.)

Code 14-9.Example

var widget0 = widgetContainer1.getWidgetById('widget0');

Code 14-10.Example

var widget0 = widgetContainer1.getWidgetByTitle('Widget 0');

14.9.4.2Accessing Objects in the Widget

Using the following functions, the developer can access the objects within the widget.

Related Functions

setSrc

getObj

getObjList

The following is an example.

Code 14-11.Example

var widget0 = widgetContainer1.getWidgetById('widget0');
widget0.setSrc('other_page.xml');
var myObj = widget0.getObj('myObj');
var objList = widget0.getObjList();
console.log(myObj);
console.log(objList);

14.9.4.3Cross-referencing

When using the scope="true" setting of the WFrame, the WidgetContainer and the widgets contained can refer to each other.

The $p.widget function is designed for widgets only. This function is valid only for the widgets. Use the following functions to get information of the widgets.

Related Functions

$p.widget.getWidgetId(): Returns the widget ID.

$p.widget.getWidgetContainerId(): Returns the ID of the WidgetContainer that contains the widget.

$p.widget.getWidgetContainer(): Returns the WidgetContainer object that manages the widget.

if($p.widget) {
        dataMap1.set( "key1" , $p.widget.getWidgetId() );
    } else {
        dataMap1.set( "key1" , "Not a widget" );
    }
Frequently Used Functions

$p;: Provides utility-like functions.

$p.data;: Controls the DataCollection.

The following is an example to execute a submission in the widget that uses scope="true" setting of the WFrame. In other words, use $p.xxx functions. $p.xxx functions will search submissions in the main area.

Code 14-12.Execution of Submission in the Widget (Example)

scwin.startInit = function() {
    $p.executeSubmission("submission1");
};

scwin.submission1_submitdone = function(e) {
    alert('done');
};

scwin.startInit();

14.9.5Title

14.9.5.1Dynamic Change of Text

Use the following functions to dynamically change the text.

Related Functions

getTitle

setTitle

Code 14-13.Example

var widget0 = widgetContainer1.getWidgetByTitle('widget0');
var title = widget0.getTitle();  // 'widget0'
title += '_MODIFIED';
widget0.setTitle(title);  // 'widget0_MODIFIED'

14.9.5.2Applying Style

Define the style in the <style> tag. When adding a widget through the addWidgets, specify the defined style in the titleClass property. In this way, the developer can create widgets each of which uses different styles.

Code 14-14.Applying Style (Example)

<head>
...
<script type="text/javascript"><![CDATA[
    widgetContainer1.addWidgets({
            title : "Widget  0",
            ...
            titleClass : "w2widget_red",
    });

    widgetContainer1.addWidgets({
        title : "Widget  1",
        ...
        titleClass : "w2widget_red",
    });

    widgetContainer1.addWidgets({
        title : "Widget  2",
        ...
        titleClass : "w2widget_red",
    });

 ]]></script>
</head>
<style>
    .w2widget_red{
        background-color: red;
        height: 50px;
        font-size: 30px;
        color: white;
    }
    
    .w2widget_orange{
        background-color: orange;
    }
    
    .w2widget_green{
        background-color: green;
    }
</style>

Figure 14-29.After Style Applied

14.9.5.3Showing/Hiding Widgets

Using the following APIs, the developer can decide display of all widgets or selected widgets of the WidgetContainer.

Code 14-15.Static Control of Individual Widgets

addWidgets([{
    ...
    hasTitleBar: false,
    ...
}]);

Code16.Static Control of Individual Widgets

showTitle();

Code17.Dynamic Control of All Widgets

enableWidgetTitle();

14.9.6Maximize/Minimize

Double-click each widget to minimize or maximize. However, when the widget is fixed, the widget size will not change.

14.9.7Moving & Resizing

The developer can control moving of all widgets in the WidgetContainer.

Table 14-19.Related APIs


Individual Widget

All Widgets of the WidgetContainer

Static Control

N/A

widgetMove

Dynamic Control

N/A

enableWidgetMove();

The developer can decide whether to allow moving of all or individual widgets in the WidgetContainer using the following APIs.

Table 14-20.Related APIs


Individual Widget

All Widgets of the WidgetContainer

Static Control

N/A

widgetResize

Dynamic Control

setResizable();

enableWodgetResize();

Video Guide

Widget Control - WidgetContainer
Video Guide

Moving and resizing widgets and description of buttons - WidgetContainer

14.9.8Checking and Removing All Widgets

With exportWidgets(); or removeWidgetsAll(); functions, the developer can return or remove all current widgets.

Video Guide

Checking and removing all widgets - WidgetContainer

14.9.9Prevention of Widget Maximization

Video Guide

Preventing widget maximization - WidgetContainer

14.9.10Example

  1. Before adding a widget, set the ID of the WidgetContainer, and specify cols and unitHeightPixel to create a coordinate system.

Code 14-18.Creating WidgetContainer (Example)

<w2:widgetContainer id="widgetContainer1" minUnitWidth="1" widgetMove="" cols="8" horizontalMargin="0" verticalMargin="0" params="false" widgetResize=""mode="pushpull"threshold="null"style="width:100%;height:100%;margin: 20px;" unitHeightPixel="200"></w2:widgetContainer>

The following is when cols="8" & unitHeightPixel="200" are set.

Figure 14-30.Created Coordinate (cols="8" & unitHeightPixel="200")

  1. Add a widget by writing script on the <script> tab as shown below.

Code 14-19.Example (Adding Widgets)

<script type="text/javascript">
    <![CDATA[
        widgetContainer1.addWidgets({
                id : "widget0",
                title : "Widget 0",
                src : "widget0.xml",
                scope : true,
                x : 0,
                y : 0,
                unitWidth : 2,
                unitHeight : 1
            });

            widgetContainer1.addWidgets({
                id : "widget1",
                title : "Widget  1",
                src : null,
                scope : true,
                x : 1,
                y : 1,
                unitWidth : 1,
                unitHeight : 1
            });

            widgetContainer1.addWidgets({
                id : "widget2",
                title : "Widget  2",
                 src : "widget.xml",
                scope : true,
                x : 3,
                y : 0,
                unitWidth : 2,
                unitHeight : 2
            });
    ]]w2widget_red
</script>
  1. Save the changes and refresh the browser to see whether the widget has been successfully added.

Figure 14-31.Created WidgetContainer (Containing Three Widgets)

  1. Using the buttons on the upper-right corner of each widget, check if the following operations are possible:

14.10WindowContainer

Table 14-21.Component Description

Summary

Controls multiple windows through the toolbar.

Features

  • A parent window contains multiple child windows. Supports Multiple Document Interface (MDI).

Video Guide

14.10.1Creating Windows (createWindow())

Table 14-22.Creating and Fixing Windows

Item

Description

Related Functions

  • Create: createWindow

  • Fix: fixWindow

  • Unfix: unfixWindow

  • Create a fixed window: "fixed: true"

Video Guide

Creating windows - WindowContainer
Video Guide

Creating, fixing, unfixing windows, and creating as fixed - WindowContainer

Define a JSON-type dataObject containing parameters and pass it when creating a tab. The passed parameters can be returned by $p.getParameter(name);. In the following example, $p.getParameter("pageParam"); is to get the name of the src page.

Code 14-20.Dynamically Creating Windows

var obj = {
    "title": "wframeWindow1",
    "windowId": "window1",
    "src": "/ui/window1.xml",
    "frameMode": "wframe",
    "dataObject": {
        "type": "json",
        "name": "pageParam",
        "data": {
            "name": "WebSquare",
            "addr": "Seoul"
        }
    }
};
windowContainer1.createWindow(obj);

14.10.1.1Changing the src

When dynamically changing the path of the src page, use the getFrame API.

Code 14-21.Example

windowContainer1.getFrame("window1").setSrc(
        "/ui/tab2.xml", {
            "dataObject": {
                "type": "json",
                "name": "pageParam",
                "data": {
                    "name": "WebSquare",
                    "addr": "Seoul"
                }
            }
        );

14.10.1.2Passing Parameters through dataObject upon Window Creation

Pass parameters to the new window added by createWindow through the dataObject. On the created window, check the received parameters through $p.getParameter.

Video Guide

Passing parameters to the window

Code 14-22.Defining Window Options through dataObject

scwin.createWindow = function(windowIdx) {
    var frameMode = "wframe";
    var windowId = "window" + windowIdx;
    var src = "sub" + windowIdx + ".xml";
    var obj = {
        "title": frameMode + "Window" + windowIdx,
        "windowId": windowId,
        "src": src,
        "frameMode": frameMode,
        "dataObject": {
            "type": "json",
            "name": "dataObject",
            "data": {
                "windowId": windowId,
                "src": src,
                "callback": "$p.parent().scwin.windowContainer1_callback"
            }
        }
    };

    windowContainer1.createWindow(obj);
};undefined
undefined
undefined

undefined14.10.1.3Window Frame Type (undefinedframeMode)undefined

undefined

When creating a new window with the undefinedcreateWindow function, decide the frame type using the undefinedframeMode option.undefined

undefinedundefinedundefinedundefined

Usage

  • createWindow( title , iconUrl , src , windowTitle , windowId ,

openAction , closeAction , windowTooltip, frameMode );

Description

Frame type of the new window ( frameMode)

  • iframe

  • wframe

undefinedundefinedundefinedundefinedundefinedundefinedundefined
Table 14-23. frameModeundefined

Option

Description

frameMode=" iframe"

  • Creates IFrame windows.

  • Scope not supported.

frameMode=" wframe"

  • Creates WFrame windows.

  • Scope supported. (Window is separately created as the scope.)

undefined

undefined14.10.1.4Displaying Process Message on WFrame Windowundefined

undefined

In case the src page of the WFrame window contains a submission, the developer can set to display the process window that is generated upon execution of the submission within the WFrame window.

undefined

Moreover, by changing the settings in the undefined Config.xmlundefinedfile, the developer can change the source of the process message. undefined

undefined
undefinedVideo Guideundefined
undefined
undefined Displaying the process message within the WFrame window (processMsgFrame="true") - WindowContainerundefinedundefined
undefined

Moreover, by changing the settings in the undefined Config.xmlundefinedfile, the developer can change the source of the process message. undefined

undefined
undefinedVideo Guideundefined
undefined
undefined Changing the source of the process message to be displayed within the WFrame window (WindowContainer)undefinedundefined
undefined

undefined14.10.1.5Disabling History Feature of IFrameundefined

undefined

If the WindowContainer contains an IFrame, the developer can control moving to the previous page on the IFrame. When undefinedspaReplaceHistory="true" setting is in use, not the page in the IFrame but the entire browser page will move to the previous page. undefined

undefined
undefinedVideo Guide and Sample Fileundefined
undefined
undefinedVideo Guide - undefinedDisabling the history feature in IFrame (WindowContainer) undefined
undefined Sample Fileundefinedundefined
undefined

undefined14.10.1.6Event Loading Sequenceundefined

undefined

WindowContainer provides undefinedonwindowload/undefinedonwindowunload events. The undefinedonwindowload event of the WindowContainer is fired after undefinedinitScript and undefinedpostScript of the page are called.undefined

undefined

undefined14.10.1.7Referring to Other Windowsundefined

undefined

WFrame window can be referred to through undefinedgetWindow (same as the existing undefinedgetWindowbyWindowID) and undefined$p.parent API.undefined

undefined
undefined

undefined

undefined
undefinedundefinedundefinedundefinedundefinedundefinedundefined
Table 14-24.Executing scwin.test1(); of window1undefined

Script Location

Accessing Method

main()

windowContainer1.getWindow("window1").scwin.test();

wframe1

$p.parent().windowContainer1.getWindow("window1").scwin.test();

undefined

undefined14.10.1.8Setting Default Size of the Windowundefined

undefined

When creating a window with undefinedcreateWindow() function, the developer can define the default width and the default height with undefineddefaultWidth and undefineddefaultHeight.undefined

undefined
undefined

Code 14-23.Exampleundefined

undefined
var winObj = {
    ...
    defaultWidth: "600",
    defaultHeight: "300",
    ...
}
windowContainer1.createWindow(winObj);

When a window is initially created, the window is in maximum size as shown below.

Figure 14-32.Window Initially Created

Clicking the restoration button will restore the window in the size of defaultWidth and defaultHeight.

Figure 14-33.Clicking Window Restoration Button

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK
(/WindowContainer/createWindow_defaultWidth_defaultHeight_WindowContainer/)

Figure 14-34.YouTube Video (https://youtu.be/gx3a9cI8WRg)

14.10.1.9Checking Window Index

With getSelectedIndex() function, the user can check the index of the selected window. Upon every window being created by createWindow() function, the window index increases by “1”, and upon every window being closed, the window index will be recalculated.

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK
(/WindowContainer/getSelectedIndex_WindowContainer.xml)

Figure 14-35.YouTube Video (https://youtu.be/AteLPAoIYK8)

14.10.2PopUp

14.10.2.1Displaying PopUp in the Specified Frame

When creating a frameMode="wframe" window and creating a popup using $open.popUp() on the WFrame window, the developer can specify the frame to display the popup. Use $open.popUp() function with options.frameModal option.

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK
(/WindowContainer/frameMode_windowContainer_window_openPopup_frameModal_$p/)

Figure 14-36.YouTube Video (https://youtu.be/Ch-k_-Vo8Kk)

Reference
See Frame Modal Popup (options.frameModal).

14.10.2.2Closing Parent – Child PopUps

The developer can create popups on a tab using $p.openPopup() and can close all child popups and the parent popup.

  1. Note that this valid only in the WFrame window.

  2. Create a frameMode="wframe" window.

  3. Set the frameModal property of the window as "true".

Code 14-24.Creating WFrame Windows (Example)

windowContainer1.createWindow({
    "title": "PopUp Closing",
    "windowTitle": "PopUp Closing",
    "src": "01_wframe_frameModal.xml",
    "windowId": "window01",
    "frameMode": "wframe",
    "frameModal": "true"
});
Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK
(/WindowContainer/createWindow_frameModal_WindowContainer/)

Figure 14-37.YouTube Video (https://youtu.be/kTIlquVF8yw)

14.10.3Showing Windows

14.10.3.1Arrangement (setArrangeWindows())

setArrangeWindows(); provides four options to arrange windows (vertical, horizontal, cascade, and sequential).

Code 14-25.Example

// (Example 1) 
// window1, window3, and window2 are vertically opened.
windowContainer1.setArrangeWindows("vertical", ["window1", "window3", "window2"]);


// (Example 2) 
// window2, window1, and window3 are horizontally opened.
windowContainer1.setArrangeWindows("horizontal", ["window2", "window1", "window3"]);
Video Guide

Setting how to arrange windows (WindowContainer)

14.10.3.2Automatic Arrangement (autoArrange)

When closing one of the arranged windows, the developer might want the remaining windows to be re-arranged. In this case, use the autoArange property.

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK (/WindowContainer/autoArrange_WindowContainer/)

Figure 14-38.YouTube Video (https://youtu.be/ZuPDYmLdMM0)

14.10.3.3Window Control Icons (controlIconPosition)

With the controlIconPosition property, the developer can decide where to put the window control icons. Note, however, using the controlIconPosition property requires useNameContainer="true" setting.

controlIconPosition

"left" (Default) : Scrolling arrows are on the sides, and the arrangement icons are on the left.

"right" : Scrolling arrows are on the sides, and the arrangement icons are on the right.

"allright" : Scrolling icons are all on the right, and the arrangement icons are also on the right.

Figure 14-39.Window Control Icons (controlIconPosition="allright")

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK
(/WindowContainer/controlIconPosition_useNameContainer_WindowContainer.xml)

Figure 14-40.YouTube Video (https://youtu.be/UX4YEp2obi8)

14.10.3.4Changing Maximum Number of Windows (setWindowMaxNum())

With setWindowMaxNum() function, the developer can set the maximum number of windows that can be created in the WindowContainer.

14.10.3.5Keeping the Window Always Open (stopMinimizeOnNameLayer)

stopMinimizeOnNameLayer="true" is to keep the windows always open regardless of the end user’s clicking the name layer.

Video Guide

Keeping the window always open - WindowContainer

14.10.3.6Window Maximization

The end user can maximize the window by clicking the window maximization button or double-clicking the window tile.

Figure 14-41.Maximization Button and Window Tile

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK
(/WindowContainer/window_maximization_WindowContainer.xml)

Figure 14-42.YouTube Video (https://youtu.be/HlxA08cFll4)

14.10.3.7Window Minimization

The end user can minimize the window by clicking the window minimization button or clicking the name layer.

Figure 14-43.Minimization Button and Name Layer

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK
(/WindowContainer/window_minimization_WindowContainer.xml)

Figure 14-44.YouTube Video (https://youtu.be/5VsjK7ob3qI)

14.10.3.8Display of Window Being Dragged (windowMoveType)

Setting as windowMoveType="overflow" allows the end user to drag the window outside of the WindowContainer and displays the dragged window. In the mean time, setting as windowMoveType="restrict" will allow the end user to drag the window only within the WindowContainer.

Table 14-25.windowMoveType

Item

Decides the position of the dragged window in case the window is dragged outside the WindowContainer.

Description

  • "restrict" (Default) : Limits window dragging within the WindowContainer.

  • "overflow" : The window can be moved outside the WindowContainer.

Figure 14-45.windowMoveType="overflow"

Figure 14-46.windowMoveType="restrict"

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK (/WindowContainer/windowMoveType_WindowContainer/)

Figure 14-47.YouTube Video (https://youtu.be/bRaPG5A6s9U)

14.10.3.9Currently Selected Window

The w2window_selected style class is to differentiate the currently selected window from other windows.

Code 14-26.Example

<style>.w2window_selected {border: solid 2px green;}</style>

When the above style is applied, the current window will have green bold border as shown below.

Figure 14-48.Example – .w2window_selected {border: solid 2px green;}

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK
(/WindowContainer/w2window_selected_WindowContainer.xml)

Figure 14-49.YouTube Video (https://youtu.be/IwIiNZJvo1c)

14.10.4Controlling Windows

14.10.4.1Closing All Windows

Table 14-26.Closing All Windows

Item

Description

Related Properties

  • useFixButton: Creates a fixing pin.

  • closeType: Closes all windows except those with the fixing pin (useFixButton="true").

Video Guide

Closing all windows - WindowContainer

14.10.4.2Closing All Windows Except Specified One (closeOthers())

Using closeOthers() function, the developer can close all windows except the currently selected window or a certain window specified by windowID or uniqueID.

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK (/WindowContainer/closeOthers_WindowContainer.xml)

Figure 14-50.YouTube Video (https://youtu.be/456lXCr-O0Y)

14.10.4.3Prevention of Window Closing

useFixButton="true" is to display the Fix button next to the window name on the name layer.

Also, when useFixbutton="true" and closeType="noneFixedWindow" are used together, the developer can selectively define windows that will not be closed even upon the end user’s clicking Close All button. In other words, some windows may be not closed even upon the end user’s clicking Close All button.

With fixWindow and unfixWindow functions, the developer can dynamically enable/disable the Window Fix button to prevent window closing.

14.10.5Name Layer

14.10.5.1Moving Name Layer (nameLayerMove)

Table 14-27.Moving Name Layer

Item

Description

Related Properties

  • nameLayerMove="true": Name layer can be moved.

  • nameLayerMove="false": Name layer cannot be moved.

Video Guide

Moving the name layer - WindowContainer

14.10.5.2Window Order on the Name Layer (nameLayerMove & nameLayerRearrange)

Setting as nameLayerMove="true" and nameLayerRearrange="true" will move the window fixed by the pin (useFixButton="true") to the first position on the name layer.

When no window, is fixed, the windows will be displayed on the name layer in order of "aaa" "bbb" "ccc".

Figure 14-51.No Window Fixed

In case window "bbb" is fixed in the above, "bbb" window will move to the first position on the name layer.

Figure 14-52.When Window "bbb" Is Fixed

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK
(/WindowContainer/useFixButton_nameLayerRearrange_WindowContainer.xml)

Figure 14-53.YouTube Video (https://youtu.be/BX23wkAgGtQ)

14.10.6Toolbar

14.10.6.1List of the Windows (useWindowScrollButton)

Using the useWindowScrollButton property, the developer can add a button to the toolbar that shows the list of the current windows. Moreover, when displaying the window list button by useWindowScrollButton="true", the developer can limit the row count of the window list through the windowScrollVisibleRowNum property.

Figure 14-54.useWindowScrollButton="true" windowScrollVisibleRowNum="4"

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK
(/WindowContainer/useWindowScrollButton_windowScrollVisibleRowNum_WindowContainer.xml)

Figure 14-55.YouTube Video (https://youtu.be/woovMy277dg)

Sample File

Download from the Internet or
View in WEBSQUARE_DEV_PACK
(/WindowContainer/useWindowScrollButton_WindowContainer.xml)

Figure 14-56.YouTube Video (https://youtu.be/QyALhNlbbWk)