@qooxdoo/framework
Version:
The JS Framework for Coders
110 lines (91 loc) • 2.78 kB
JavaScript
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2009 1&1 Internet AG, Germany, http://www.1und1.de
License:
MIT: https://opensource.org/licenses/MIT
See the LICENSE file in the project's top-level directory for details.
Authors:
* Christian Hagendorn (chris_schmidt)
* Martin Wittemann (martinwittemann)
************************************************************************ */
/**
* Each object, which should support single selection have to
* implement this interface.
*/
qx.Interface.define("qx.ui.core.ISingleSelection",
{
/*
*****************************************************************************
EVENTS
*****************************************************************************
*/
events :
{
/** Fires after the selection was modified */
"changeSelection" : "qx.event.type.Data"
},
/*
*****************************************************************************
MEMBERS
*****************************************************************************
*/
members :
{
/**
* Returns an array of currently selected items.
*
* Note: The result is only a set of selected items, so the order can
* differ from the sequence in which the items were added.
*
* @return {qx.ui.core.Widget[]} List of items.
*/
getSelection : function() {
return true;
},
/**
* Replaces current selection with the given items.
*
* @param items {qx.ui.core.Widget[]} Items to select.
* @throws {Error} if the item is not a child element.
*/
setSelection : function(items) {
return arguments.length == 1;
},
/**
* Clears the whole selection at once.
*/
resetSelection : function() {
return true;
},
/**
* Detects whether the given item is currently selected.
*
* @param item {qx.ui.core.Widget} Any valid selectable item
* @return {Boolean} Whether the item is selected.
* @throws {Error} if the item is not a child element.
*/
isSelected : function(item) {
return arguments.length == 1;
},
/**
* Whether the selection is empty.
*
* @return {Boolean} Whether the selection is empty.
*/
isSelectionEmpty : function() {
return true;
},
/**
* Returns all elements which are selectable.
*
* @param all {Boolean} true for all selectables, false for the
* selectables the user can interactively select
* @return {qx.ui.core.Widget[]} The contained items.
*/
getSelectables: function(all) {
return arguments.length == 1;
}
}
});