top

CAPH.WUI.WIDGET.CAROUSEL

Carousel represents a container that consists of many rectangle pages, the pages distributes averagely from left to right, or from top to bottom on the screen.
 - One page(the 2nd page) is flat to user, and this page is fully presented to user. Other pages have a rotation angle along the y-axis or x-axis(depends on the container is horizontal or vertical),  so the pages look not fully presented. A user could make the pages transfer circularly and alternately in the meantime, one page would be at the place of its previous page's place or next page's place, and the last one would replace the first one, but the second page is always flat. The effect looks like the carousel of amusement park, so the container is called 'carousel'.
 - Each page could add sub widget on it.


Constructor

Carousel

Description
The constructor of carousel component, in order to create carousel object.
Parameters
obj Objectthe options are some properties to a json object, some options is the same as parent class view, other different as below: frame.maxsize(Number),frame.isVertical(Boolean)
Emulator SupportY
SDK ConstraintNone
Example
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var carousel = new Carousel(opt);

Methods

addItem

Description
Add a new widget to an existing page of the container. The widget would be painted to the page.
Parameters
■index
  - Number
  - The index of the page ready to add widgets. e.g. 1.       

■pageItem 
  - Object 
  - An existing widget to be added to the page.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var Box  = caph.wui.widget.Box;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
var box = new Box();
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.addItem(0, box);

addItemList

Description
Add a list of widgets to an existing page of the container.
Parameters
■itemList
  - Array
  - It should be a array of component. e.g. [image1,image2]

■index
  - Number
  - The page number of the carousel. The index should between 0 to the max number of the carousel.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var Box  = caph.wui.widget.Box;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
var box = new Box();
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.addItemList([box], 0);

setIndex

Description
Make the page whose index is 'tarIdx' facing to user, with no animation.
Parameters
■tarIdx
  - Number
  - The index of the page that to be flat shown to users. If null, 0 would be set.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var Box  = caph.wui.widget.Box;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
var box = new Box();
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.setIndex(1);

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel();
carousel.setOptions(opt);
carousel.setCenterPosition (500, 500, 1);
carousel.render(uicontext);

setAbsolutePosition

Description
Sets absolute position of widget in the screen, x,y value of the top and left of the screen is (0,16).
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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setAbsolutePosition (500, 500, 1);
carousel.render(uicontext);

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,10).
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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setCenterPosition (500, 500, 1);
carousel.render(uicontext);

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setCenterPosition (500, 500, 1);
carousel.render(uicontext);
carousel.destroy();

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,16).
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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setCenterPosition (500, 500, 1);
carousel.render(uicontext);
var pos =carousel.getCenterPosition();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.addCls('abc');
carousel.removeCls('abc');
carousel.render(uicontext);

addCls

Description
Add specified css class for the label in the tag, which is convert from the input text, when css is added successfully, new style will apply on the
Parameters
■cls
  - String
  - The class name for the current widget.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.addCls('abc');
carousel.render(uicontext);

render

Description
All widget inherits View's render method. But, Carousel widget defined a new render method.
Parameters
■obj
  - 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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);

removeItem

Description
Remove a widget on an existing page of the container. The widget would disappear from the page that it was rendered of container.
Parameters
■index
  - Number
  - The index of item to be removed. 
      
■pageIndex
  - Number
  - The index of page that contains the item to be removed.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.addItemList([box], 0);
carousel.removeItem(0, 0);

addPage

Description
Add a new page to the container. The new add page would be placed at the last of existing pages, the index of the page is one more than the maximum index of all pages.
Parameters
■pageContent  (Optional)
  - Array
  - An existing widget to be painted to the page that to be added.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.addPage();

addPageChangeListener

Description
Add a function to monitor the current shown page switching. The function will be called when current page is changed.
Parameters
■pcb  (Optional)
  - Function
  - Successful Occurs when current shown page is switched.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.addPageChangeListener(function(){console.log('pcb')});

addStartPageChangeListener

Description
Add a function to monitor the initial shown page switching. The function will be called when current page begin to change.
Parameters
■pcb  (Optional)
  - Function
  - Occurs when current the initial shown page is switched.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.addStartPageChangeListener(function(){console.log('pcb')});

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.blur();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.click();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.disable();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.disable();
var isEnable = carousel.isEnable();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.disableHighLight();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.disableHighLight();
carousel.enableHighLight();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.enable();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.focus();

hide

Description
Hides widget to make it invisible on the screen, registered listeners for this are invoked, if duration is greater than 2 , 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 milliseconds.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.hide();

next

Description
Make the page in the latter shown to user. The current page will disappear with an animation, and the latter shown page will show in front of screen with an animation
Parameters
■count 
  - Number
  - Which page in the previous of current shown page to be shown. e.g. 1 means the next one page, 2 means the second page latter.
       
■cbk  (Optional)
  - Function
  - Successful occurs after the target page shown to users successfully.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.next(1);

prev

Description
Make the page in the previous shown to user. The current page will disappear with an animation, and the latter shown page will show in front of screen with an animation.
Parameters
■count 
  - Number
  - Which page in the previous of current shown page to be shown. e.g. 1 means the last one page, 2 means the sencond page previous.
       
■cbk  (Optional)
  - Function
  - Successful occurs after the target page shown to users successfully.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.prev(1);

removePage

Description
Remove a page from the container by its index, the latter pages would fill up the blank of the removed page, and the latter pages' index minus 1 in order.
Parameters
■index
  - Number
  - The index of the page ready to add widgets. e.g. 1.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.removePage(3);

setCurIndex

Description
Make the page whose index is 'tarIdx' facing to user , with rotate animation.
Parameters
■tarIdx
  - Number
  - The index of the page that to be flat shown to users.       

■scb  (Optional)
  - Function
  - Successful occurs after the target page shown to users successfully.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.setCurIndex(1);

getCurIndex

Description
Get the index of page which is now fully shown to users.
Parameters
■Void
Return■index
  - Number
  - The index of the page which is now fully shown to users.
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.setCurIndex(1);
var curI = carousel.getCurIndex();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.setOpacity(0.6);

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.setOpacity(0.6);
var opa = carousel.getOpacity();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.setRotation(0 ,0, 0);

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.setRotation(0 ,0, 0);
var rot = carousel.getRotation();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.setScale(1, 1, 1);

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.setScale(1, 1, 1);
var scale = carousel.getScale();

show

Description
Shows the widget to make it visible on the screen, registed listeners for this are invoked, if duration is greater than 15, 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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
carousel.show();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
var child = carousel.getChildNodes();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
var ctype = carousel.getCType();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
var dom = carousel.getDomEl();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
var func = function(){
  console.log('preclick');
};
carousel.addEventListener('preclick', func);

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
var func = function(){
  console.log('preclick');
};
carousel.addEventListener('preclick', func);
carousel.removeEventListener('preclick', func);

isSpinning

Description
Return true if the carousel is spinning.
Parameters
■Void
Return■Boolean
  - Indicates whether the carousel is spinning, if it is spinning, return true.
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
var isSpin = carousel.isSpinning();

isVisible

Description
Indicates whether the widget is visible or not.
Parameters
■Void
Return■Boolean
  - true : visible
  - false : otherwise
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
var isVisible = carousel.isVisible();

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 UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
var obj = carousel.clone();

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 UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
var obj = carousel.clone();
var isEqual = obj.equals(carousel);

getCurPage

Description
Get the current page.
Parameters
■Void
Return■Number 
  - The index of the page which is now fully shown to users.
Emulator SupportY
SDK Constraintnone
Example
var UIContext = caph.wui.widget.UIContext;
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
var page = carousel.getCurPage();

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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
var parent = carousel.getParentNode();

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,16).
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 Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var uicontext   = new UIContext();
var carousel = new Carousel(opt);
carousel.setPosition (500, 500, 1);
carousel.render(uicontext);
var pos =carousel.getPosition();

Carousel

Description
(Constructor) The constructor of carousel component, in order to create carousel object.
Parameters
■options (Optional)
  - Object
  - the options are some properties to a json object, some options is the same as parent class view, other different as below: frame.maxsize(Number),frame.isVertical(Boolean)
Return■Object
  - instance of carousel
Emulator SupportY
SDK Constraintnone
Example
var Carousel  = caph.wui.widget.Carousel;
var opt = {
  frame: {
    width: 800,
    height: 500,
    maxsize: 4,
    isVertical: false
  }
};
var carousel = new Carousel(opt);