Widget-Child.js revision 0c7476a63b7d7b81ade0fbc59f7b18b15b2fd4c8
/**
* Provides an extension enabling a Widget to be a child of another Widget.
*
* @module widget-child
*/
/**
* Widget extension providing functionality enabling a Widget to be a
* child of another Widget.
*
* @class WidgetChild
* @param {Object} config User configuration object.
*/
function Child() {
}
/**
* @attribute selected
* @type Number
* @default 0
*
* @description Number indicating if the Widget is selected. Possible
* values are:
* <dl>
* <dt>0</dt> <dd>(Default) Not selected</dd>
* <dt>1</dt> <dd>Partially selected</dd>
* <dt>2</dt> <dd>Fully selected</dd>
* </dl>
*/
selected: {
value: 0,
},
/**
* @attribute index
* @type Number
* @readOnly
*
* @description Number representing the Widget's ordinal position in its
* parent Widget.
*/
index: {
readOnly: true,
getter: function () {
if (parent) {
if (this == items[i]) {
index = i;
break;
}
}
}
return index;
}
},
/**
* @attribute parent
* @type Widget
* @readOnly
*
* @description Retrieves the parent of the Widget in the object hierarchy.
*/
parent: {
readOnly: true
},
/**
* @attribute depth
* @type Number
* @default -1
* @readOnly
*
* @description Number representing the depth of this Widget in the object
* hierarchy.
*/
depth: {
value: -1,
readOnly: true,
getter: function () {
depth = -1;
while (parent) {
}
return depth;
}
},
/**
* @attribute root
* @type Widget
* @readOnly
*
* @description Returns the root Widget in the object hierarchy.
*/
root: {
readOnly: true,
getter: function () {
};
return getParent(this);
}
}
};
// Override of Widget's implementation of _getRootNode() to ensure that
// all event listeners are bound to the Widget's topmost DOM element.
// This ensures that the firing of each type of Widget UI event (click,
// mousedown, etc.) is facilitated by a single, top-level, delegated DOM
// event listener.
_getRootNode: function () {
if (root) {
}
return returnVal;
},
/**
* @method next
* @description Returns the Widget's next sibling.
* @return {Widget} Widget instance.
*/
next: function () {
if (parent) {
}
return sibling;
},
/**
* @method previous
* @description Returns the Widget's previous sibling.
* @return {Widget} Widget instance.
*/
previous: function () {
}
return sibling;
},
// Override of Y.WidgetParent.remove()
// Sugar implementation allowing a child to remove itself from its parent.
var parent;
}
else {
if (parent) {
}
}
},
/**
* @method isRoot
* @description Determines if the Widget is the root Widget in the
* object hierarchy.
* @return {Boolean} Boolean indicating if Widget is the root Widget in the
* object hierarchy.
*/
isRoot: function () {
return (this == this.get("root"));
},
/**
* @method isRoot
* @description Returns the Widget instance at the specified depth.
* @return {Widget} Widget instance.
*/
var parent;
}
}
return parent;
}
};
Y.WidgetChild = Child;