# Yahoo! UI Library

### widget-position 3.0.0b1

Yahoo! UI Library > widget-position > WidgetPosition
Search:
Filters Show Private Show Protected Show Deprecated

## Class WidgetPosition

Widget extension, which can be used to add positioning support to the base Widget class, through the Base.build method.

### Properties

#### WidgetPosition.ATTRS - `static Object`

Static property used to define the default attribute configuration introduced by WidgetPosition.

#### WidgetPosition.POSITIONED_CLASS_NAME - `static String`

Default class used to mark the boundingBox of a positioned widget.
Default Value: "yui-widget-positioned"

### Methods

#### _afterXYChange

`protected void _afterXYChange ( e )`
Default attribute change listener for the xy attribute, responsible for updating the UI, in response to attribute changes.

Parameters:
  `e <EventFacade>` The event facade for the attribute change

Returns: `void`

#### _bindUIPosition

`protected void _bindUIPosition ( )`
Binds event listeners responsible for updating the UI state in response to Widget position related state changes.

This method in invoked after bindUI is invoked for the Widget class using YUI's aop infrastructure.

Returns: `void`

#### _getX

`Number _getX ( )`
Default getter for the X attribute. The value is retrieved from the XY attribute, which is the sole store for the XY state.

Returns: `Number`
  The X page co-ordinate value

#### _getY

`Number _getY ( )`
Default getter for the Y attribute. The value is retrieved from the XY attribute, which is the sole store for the XY state.

Returns: `Number`
  The Y page co-ordinate value

#### _renderUIPosition

`protected void _renderUIPosition ( )`
Creates/Initializes the DOM to support xy page positioning.

This method in invoked after renderUI is invoked for the Widget class using YUI's aop infrastructure.

Returns: `void`

#### _setX

`void _setX ( val )`
Default setter for the X attribute. The setter passes the X value through to the XY attribute, which is the sole store for the XY state.

Parameters:
  `val <Number>` The X page co-ordinate value

Returns: `void`

#### _setY

`void _setY ( val )`
Default setter for the Y attribute. The setter passes the Y value through to the XY attribute, which is the sole store for the XY state.

Parameters:
  `val <Number>` The Y page co-ordinate value

Returns: `void`

#### _syncUIPosition

`protected void _syncUIPosition ( )`
Synchronizes the UI to match the Widgets xy page position state.

This method in invoked after syncUI is invoked for the Widget class using YUI's aop infrastructure.

Returns: `void`

#### _uiSetXY

`protected void _uiSetXY ( val )`
Updates the UI to reflect the XY page co-ordinates passed in.

Parameters:
  `val <String>` The XY page co-ordinates value to be reflected in the UI

Returns: `void`

#### _validateXY

`boolean _validateXY ( val )`
Default validator for the XY attribute

Parameters:
  `val <Array>` The XY page co-ordinate value which is being set.

Returns: `boolean`
  true if valid, false if not.

#### move

`void move ( x , y , x, )`
Moves the Widget to the specified page xy co-ordinate position.

Parameters:
  `x <Number>` The new x position
  `y <Number>` The new y position

  Or

  `x, <Array>` y values passed as an array ([x, y]), to support simple pass through of Node.getXY results

Returns: `void`

#### syncXY

`void syncXY ( )`
Synchronizes the Panel's "xy", "x", and "y" properties with the Widget's position in the DOM.

Returns: `void`

### Events

#### xChange

`xChange ( event )`
Fires when the value for the configuration attribute 'x' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### xyChange

`xyChange ( event )`
Fires when the value for the configuration attribute 'xy' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### yChange

`yChange ( event )`
Fires when the value for the configuration attribute 'y' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

### Configuration Attributes

#### x `- number`

Page X co-ordinate for the widget. This attribute acts as a facade for the xy attribute. Changes in position can be monitored by listening for xyChange events.
Default Value: 0

#### xy `- Array`

Page XY co-ordinate pair for the widget.
Default Value: [0,0]

#### y `- number`

Page Y co-ordinate for the widget. This attribute acts as a facade for the xy attribute. Changes in position can be monitored by listening for xyChange events.
Default Value: 0

Copyright © 2009 Yahoo! Inc. All rights reserved.