top

CAPH.WUI.WIDGET.VIEW

View represents basic class for all widgets. All prototype and static members of this class are inherited by all other classes. View provides basic methods and event response. User can implement customizable widget by inheriting this class.


Constructor

View

Description
The constructor of view component, in order to create view object.
Parameters
option Object* id : (Number) The id of widget. * name : (String) The name of widget.
Emulator SupportY
SDK ConstraintNone
Example
var View  = caph.wui.widget.View;
var view = new View();

Methods

setRightWidget

Description
Sets a destination widget for the original widget when doing the right operation.
Parameters
■dest
  - Object
  - the destination widget.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var GridWidget = caph.wui.widget.GridWidget;
var HighLight = caph.wui.widget.HighlightHelper;
var Panel = caph.wui.widget.Panel;
var options = {
        'frame' : {
            'width' :600
            'height' : 700
            'layout' : {
                'row' : 4,
                'column' : 4
            },
        },
        'center-position' :{
         'x':800,
         'y':550,
         'z':1
        },
    };
var page = new UIContext();
var gridwidget = new GridWidget(options);

var itemObjList = [];
var panel;
        for ( i = 0; i <options_Panel.length; i++) {
            panel = new Panel(options_Panel[i]);
            itemObjList.push(panel);
        }
gridwidget.addItemList(itemObjList);
gridwidget.setCurItem(3);
var item = gridwidget.getActiveItem();
gridwidget.render(page);
// Panel is a child class of View
// So, gridwidget.getItem(0) is a kind of View
gridwidget.getItem(0).setRightWidget(gridwidget.getItem(2));
//HighLight
HighLight.init(page);
page.show();
caph.wui.widget.KeyControl.init();

setDownWidget

Description
Sets a destination widget for the original widget when doing the down operation.
Parameters
■dest
  - Object
  - the destination widget.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var GridWidget = caph.wui.widget.GridWidget;
var HighLight = caph.wui.widget.HighlightHelper;
var Panel = caph.wui.widget.Panel;
var options = {
        'frame' : {
            'width' :600
            'height' : 700
            'layout' : {
                'row' : 4,
                'column' : 4
            },
        },
        'center-position' :{
         'x':800,
         'y':550,
         'z':1
        },
    };
var page = new UIContext();
var gridwidget = new GridWidget(options);

var itemObjList = [];
var panel;
        for ( i = 0; i <options_Panel.length; i++) {
            panel = new Panel(options_Panel[i]);
            itemObjList.push(panel);
        }
gridwidget.addItemList(itemObjList);
gridwidget.setCurItem(3);
var item = gridwidget.getActiveItem();
gridwidget.render(page);
// Panel is a child class of View
// So, gridwidget.getItem(1) is a kind of View
gridwidget.getItem(1).setDownWidget(gridwidget.getItem(3));
//HighLight
HighLight.init(page);
page.show();
caph.wui.widget.KeyControl.init();

setBypassWidget

Description
Set the bypass item which does not receive a highlight focus
Parameters
■dest
  - Object
  - the destination widget.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var GridWidget = caph.wui.widget.GridWidget;
var HighLight = caph.wui.widget.HighlightHelper;
var Panel = caph.wui.widget.Panel;
var options = {
        'frame' : {
            'width' :600
            'height' : 700
            'layout' : {
                'row' : 4,
                'column' : 4
            },
        },
        'center-position' :{
         'x':800,
         'y':550,
         'z':1
        },
    };
var page = new UIContext();
var gridwidget = new GridWidget(options);

var itemObjList = [];
var panel;
        for ( i = 0; i <options_Panel.length; i++) {
            panel = new Panel(options_Panel[i]);
            itemObjList.push(panel);
        }
gridwidget.addItemList(itemObjList);
gridwidget.setCurItem(3);
var item = gridwidget.getActiveItem();
gridwidget.render(page);
// Panel is a child class of View
// So, gridwidget.getItem(2) is a kind of View
gridwidget.getItem(2).setBypassWidget(gridwidget.getItem(3));
//HighLight
HighLight.init(page);
page.show();
caph.wui.widget.KeyControl.init();

setLeftWidget

Description
Sets a destination widget for the original widget when doing the left operation.
Parameters
■dest
  - Object
  - the destination widget.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var GridWidget = caph.wui.widget.GridWidget;
var HighLight = caph.wui.widget.HighlightHelper;
var Panel = caph.wui.widget.Panel;
var options = {
        'frame' : {
            'width' :600
            'height' : 700
            'layout' : {
                'row' : 4,
                'column' : 4
            },
        },
        'center-position' :{
         'x':800,
         'y':550,
         'z':1
        },
    };
var page = new UIContext();
var gridwidget = new GridWidget(options);

var itemObjList = [];
var panel;
        for ( i = 0; i <options_Panel.length; i++) {
            panel = new Panel(options_Panel[i]);
            itemObjList.push(panel);
        }
gridwidget.addItemList(itemObjList);
gridwidget.setCurItem(3);
var item = gridwidget.getActiveItem();
gridwidget.render(page);
// Panel is a child class of View
// So, gridwidget.getItem(2) is a kind of View
gridwidget.getItem(2).setLeftWidget(gridwidget.getItem(0));
//HighLight
HighLight.init(page);
page.show();
caph.wui.widget.KeyControl.init();

setUpWidget

Description
Sets a destination widget for the original widget when doing the up operation.
Parameters
■dest
  - Object
  - the destination widget.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var GridWidget = caph.wui.widget.GridWidget;
var HighLight = caph.wui.widget.HighlightHelper;
var Panel = caph.wui.widget.Panel;
var options = {
        'frame' : {
            'width' :600
            'height' : 700
            'layout' : {
                'row' : 4,
                'column' : 4
            },
        },
        'center-position' :{
         'x':800,
         'y':550,
         'z':1
        },
    };
var page = new UIContext();
var gridwidget = new GridWidget(options);

var itemObjList = [];
var panel;
        for ( i = 0; i <options_Panel.length; i++) {
            panel = new Panel(options_Panel[i]);
            itemObjList.push(panel);
        }
gridwidget.addItemList(itemObjList);
gridwidget.setCurItem(3);
var item = gridwidget.getActiveItem();
gridwidget.render(page);
// Panel is a child class of View
// So, gridwidget.getItem(3) is a kind of View
gridwidget.getItem(3).setUpWidget(gridwidget.getItem(1));
//HighLight
HighLight.init(page);
page.show();
caph.wui.widget.KeyControl.init();

getRotation

Description
Returns widget rotation property.
Parameters
■Void
Return■Object
  - Position object, including x, y, z value.                        
   * The x coordinate for rotate position of the view.  
   * The y coordinate for rotate position of the view.       
   * The z coordinate for rotate position of the view.
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition (100, 100, 0);
box.setRotation(0, 0, 0);
var rot = view.getRotation.call(box);

getScale

Description
Returns the scale value of the widget, including x, y, z coordinates.
Parameters
■Void
Return■Object
  - Position object, including x, y, z value.                        
   * The x coordinate for scale position of the view.  
   * The y coordinate for scale position of the view.       
   * The z coordinate for scale position of the view.
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition (100, 100, 0);
box.setScale(0.8, 0.5, 0);
var scale = view.getScale.call(box);

getCenterPosition

Description
Returns center position of the widget in the parent widget, include x,y,z coordinate. x,y value of the top and left of the parent widget is (0,0).
Parameters
■Void
Return■Object
  - Position object, including x, y, z value.                           
   * x : (Number) The x coordinate of 3D object, the unit is pixels.       
   * y : (Number) The y coordinate of 3D object, the unit is pixels.       
   * z : (Number) The z coordinate defines the order of overlap widgets, if z is too big, the widget will display above. e.g. 0, 1, 2 and etc.
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition (100, 100, 0);
var pos = view.getCenterPosition.call(box);

setRotation

Description
Sets rotation of widget , rotation angle of the widget will be changed.
Parameters
■x
  - Number 
  - The x coordinate for rotate position of the view.  
■y
  - Number
  - The y coordinate for rotate position of the view.       
■z
  - Number
  - The z coordinate for rotate position of the view.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition (100, 100, 0);
view.setRotation.call(box, Math.PI/4, 0, 0);

setScale

Description
Sets widget scale value, the display width and height of widget will be changed, but the value of height and width properties will not be modified.
Parameters
■x
  - Number 
  - The x coordinate for scale position of the view.  
■y
  - Number
  - The y coordinate for scale position of the view.       
■z
  - Number
  - The z coordinate for scale position of the view.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition (100, 100, 0);
view.setScale.call(box, 0.8, 0.5, 0);

removeCls

Description
Removes specific css class from current widget, when css is removed successfully, the specified css style will be removed from the widget.
Parameters
■cls
  - String
  - The class name for the current widget.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
box.addCls('myview');
view.removeCls.call(box, 'myview');

isEnable

Description
Returns the current status of widget, return true when the widget is activated.
Parameters
■Void
Return■Boolean
  - true : if enabled
  - false : otherwise
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
box.disable();
var rc = view.isEnable.call(box);

isVisible

Description
Indicates whether the widget is visible or not.
Parameters
■Void
Return■Boolean
  - true : if visible
  - false : otherwise
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
box.hide();
var isVisible = view.isVisible.call(box);

getOpacity

Description
Returns opacity of the widget.
Parameters
■Void
Return■Number
  - Opacity value of the widget,range from 0.0 to 1.0. e.g. 0.5.
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
box.setOpacity(0.5);
var op = view.getOpacity.call(box);

getChildNodes

Description
Returns child nodes of current widget, child nodes are those widgets rendered on the current widget.
Parameters
■Void
Return■Array
  - The child nodes list.
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
var childList = view.getChildNodes.call(box);

getCType

Description
Returns the type of the widget, every widget have different ctype, it is identification of widget.
Parameters
■Void
Return■String
  - CType is widget or animation type, including 'BasicObject','view','UIContext','button', 'box','label','radio','spinner',        'navigator','panel','carousel','colortag','image','checkbox','gridwidget',       'popup','progressbar','dropdown','indicator','highlighthelper','coverflow',    'listwidget','book','domcontainer','imagegallery','sidebar','fade','transfer','rotate','scale','bounce','flip','syncanim','advancedbox'."
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
var ctype = view.getCtype.call(box);

getDomEl

Description
Returns the DOM element of the widget, note that the dom node to be found actually needs to exist (be rendered and etc).
Parameters
■Void
Return■DOM
  - A document element
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
var dom = view.getDomEl.call(box);

removeEventListener

Description
Removes all listeners according the type and event.
Parameters
■type
  - String
  - Listener type of event, including {'onfocus', 'onblur', 'onkeydown'.
   * 'onfocus'- the type of function will be called when the widget is focused.
   * 'onblur'- the type of function will be called when the widget is blurred.
   * 'onkeydown'  - the type of fun}
■func
  - Function
  - The callback to remove
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
var func = function() {
  console.log(1);
}
box.addEventListener('resize', func);
view.removeEventListener.call(box, 'resize', func);

addEventListener

Description
Appends an event handler to the widget.
Parameters
■type
  - String
  - Listener type of event, including {'onfocus', 'onblur', 'onkeydown'.
   * 'onfocus'- the type of function will be called when the widget is focused.
   * 'onblur'- the type of function will be called when the widget is blurred.
   * 'onkeydown'  - the type of fun}
■function
  - Function
  - the callback to add
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
var func = function() {
  console.log(1);
}
view.addEventListener.call(box, 'resize', func);

getParentNode

Description
Returns parent node of current widget, parent node is the widget which the current widget will render on it.
Parameters
■Void
Return■Array
  - The parent node.
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
var parentList = view.getParentNodes.call(box);

addCls

Description
Adds specified css class for current widget, when css is added successfully, new style will apply on the widget.
Parameters
■cls
  - String
  - The class name for the current widget.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
view.addCls.call(box, 'myview');

blur

Description
Blurs the view object, to make the view object lose focus. And if the widget has registered blur listeners, it will be invoked.
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
view.blur.call(box);

click

Description
Clicks the view object, to make the view object selected. And if the widget has registered click listeners, it will be invoked.
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
view.click.call(box);

disable

Description
Disables widget, to make widget not be able to be operated by user.
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
view.disable.call(box);

disableHighLight

Description
Removes the highlight effect on a widget, but still remain the focus effect.
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
view.disableHighLight.call(box);

enable

Description
Enables widget, to make widget be able to be operated by user.
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
view.enable.call(box);

enableHighLight

Description
Recovers the highlight effect on a widget.
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
view.enableHighLight.call(box);

focus

Description
Focuses the view object, to make the view object receive focus. And if the widget has registered focus listeners, it will be invoked.
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
view.focus.call(box);

hide

Description
Hides widget to make it invisible on the screen, registed listeners for this are invoked, if duration is greater than 0 , that is there exists a fade animation, registed listeners will be invoked during the animation.
Parameters
■duration (Optional)
  - Number
  - (ms) If duration is greater than 0, view will have a fade animation to hide itself, the unit is millisconds.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
view.hide.call(box);

setOpacity

Description
Sets opacity of the widget.
Parameters
■opacity
  - Number
  - Opacity value of the widget, range from 0.0 to 1.0. e.g. 0.5.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
view.setOpacity.call(box, 0.5);

show

Description
Shows the widget to make it visible on the screen, registed listeners for this are invoked, if duration is greater than 0, that is there exists a fade animation, registed listeners will be invoked during the animation.
Parameters
■duration (Optional)
  - Number
  - (ms) If greater than 0, view will have a fade animation to show itself, the unit is millisconds.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setCenterPosition(100,100,0);
view.show.call(box);

getPosition

Description
Returns top and left position of widget in the parent widget, include x,y,z coordinate. x,y value of the top and left of the parent widget is (0,0).
Parameters
■Void
Return■Object
  - Position object, including x, y, z value.                        
   * x : (Number) The x coordinate of 3D object, the unit is pixels.       
   * y : (Number) The y coordinate of 3D object, the unit is pixels.       
   * z : (Number) The z coordinate defines the order of overlap widgets, if z is too big, the widget will display above. e.g. 0, 1, 2 and etc.
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
box.setPosition (100, 100, 0);
var pos = view.getPosition.call(box);

setOptions

Description
Sets some properties of the widget that are in the constructor method. The widget will be changed when these properties are set. For example, if width property is set, the width of widget will changed.
Parameters
■options (Optional)
  - Object
   * id : (Number) The id of widget.       
   * name : (String) The name of widget.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
var opt = {'opacity': 0.8};
view.setOptions.call(box, opt);

destroy

Description
Destroys the widget itself, the widget will disappear.
Parameters
■Void
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
view.destroy.call(box);

setAbsolutePosition

Description
Sets absolute position of widget in the screen, x,y value of the top and left of the screen is (0,0).
Parameters
■x
  - Number
  - The x coordinate, can be a percentage or a number ,like 50% or 500,50% means 50% of the screen, the unit is pixel.      
■y
  - Number
  - The y coordinate, can be a percentage or a number ,like 50% or 500,50% means 50% of the screen, the unit is pixel
■z
  - Number
  - The y coordinate, can be a percentage or a number ,like 50% or 500,50% means 50% of the screen, the unit is pixel
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
view.setAbsolutePosition.call(box, 100, 100, 0);

setCenterPosition

Description
Sets center position of the widget in the parent widget, include x,y,z coordinate. x,y value of the top and left of the parent widget is (0,0).
Parameters
■x
  - Number
  - The x coordinate of 3D object, the unit is pixels.       
■y
  - Number
  - The y coordinate of 3D object, the unit is pixels.       
■z
  - Number
  - The z coordinate defines the order of overlap widgets, if z is too big, the widget will display above.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
view.setCenterPosition.call(box, 100, 100, 0);

setPosition

Description
Sets top and left position of widget in the parent widget.
Parameters
■x
  - Number
  - The x coordinate, can be a percentage or a number ,like 50% or 500,50% means 50% of the screen, the unit is pixel.       
■y
  - Number
  - The y coordinate, can be a percentage or a number ,like 50% or 500,50% means 50% of the screen, the unit is pixel   
■z
  - Number
  - The z coordinate, can be a percentage or a number ,like 50% or 500,50% means 50% of the screen, the unit is pixel
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
box.render(uicontext);
view.setPosition.call(box, 100, 100, 0);

render

Description
Renders the current widget to parent widget. Specify an existing widget that this widget will be rendered into. Widget will display in the parent widget and become a child node of the parent widget.
Parameters
■object
  - Json object
  - An existing widget that this widget will be rendered on.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var View  = caph.wui.widget.View;
var Box = caph.wui.widget.Box;;
var uicontext   = new UIContext();
var view = new View();
var box = new Box({
  'frame': {
    'width': 100,
    'height': 100
  }
});
view.render.call(box, uicontext);

clone

Description
Creates and returns clone object from current object, the cloned object will have the same properties and same methods with the current object.
Parameters
■Void
Return■Object
  - The cloned object.
Emulator SupportY
SDK Constraintnone
Example
var View = window.caph.wui.widget.View;
var view = new View();
var obj = view.clone(view);

equals

Description
Compares the contents of two objects using strict equality, objects are considered equal if they both have the same set of properties and the values of those properties are equal.
Parameters
■Object
  - Object
  - The object which wants to compare with current object.
Return■Boolean
  - Indicates whether the two objects are equal, 
  - true : if they are equal, return true. 
  - false : if they aren't equal, return false.
Emulator SupportY
SDK Constraintnone
Example
var View = window.caph.wui.widget.View;
var view = new View();
var obj = view.clone(view);
var isequal = obj.equals(obj);

View

Description
(Constructor) The constructor of view component, in order to create view object.
Parameters
■options (Optional)
  - Object
   * id : (Number) The id of widget.       
   * name : (String) The name of widget.
Return■Object
  - The layout of the widget, including row , column and type which may be vertical, horizontal or grid.
Emulator SupportY
SDK Constraintnone
Example
var View  = caph.wui.widget.View;
var view = new View();