Manages selection among a series of objects.
Selection managers manage selection among a series of objects. They enable standard control and shift click modifiers to aid range selection. Selection managers provide methods to manipulate, add to and clear the selection. For example:
<canvas>
<dataset name="fruits">
<fruit>Oranges</fruit>
<fruit>Apples</fruit>
<fruit>Bananas</fruit>
<fruit>Grapes</fruit>
<fruit>Kiwis</fruit>
<fruit>Papayas</fruit>
<fruit>Watermelon</fruit>
<fruit>Strawberries</fruit>
<fruit>Cherries</fruit>
</dataset>
<simplelayout/>
<text>Select a series of items below. The control and shift-click modifiers
help select ranges.</text>
<view name="fruitlist">
<selectionmanager name="selector" toggle="true"/>
<simplelayout/>
<view name ="listitem"
datapath="fruits:/fruit"
onclick="parent.selector.select(this);">
<text name="txt" datapath="text()"/>
<method name="setSelected" args="amselected">
if (amselected) {
var txtColor = 0xFFFFFF;
var bgcolor = 0x999999;
} else {
var txtColor = 0x000000;
var bgcolor = 0xFFFFFF;
}
this.setBGColor( bgcolor );
this.txt.setAttribute('fgcolor', txtColor);
</method>
</view>
<method name="deleteSelected">
<![CDATA[
var csel = this.selector.getSelection();
for (var i = 0; i < csel.length; i++) {
csel[i].destroy();
}
this.selector.clearSelection();
]]>
</method>
</view>
<button onclick="fruitlist.deleteSelected();">Delete selection</button>
</canvas>
| Attributes | |||||
| Name | Usage | Type (Tag) | Type (JS) | Default | Category |
| sel | JS only | readonly | |||
The name of the method to call on an object
when an object's selectedness changes. The method is called with a single Boolean argument. The default value for this
field is setSelected. |
|||||
|
|
|||||
| selected | JS only | readonly | |||
| An array that represents the current selection | |||||
|
|
|||||
| selectedHash | JS only | readonly | |||
| A hash of currently selected objects (by UID) | |||||
|
|
|||||
| toggle | Tag & JS | boolean | Boolean | readonly | |
| If true, a re-selected element will lose the selection. | |||||
|
|
|||||
class, classroot, cloneManager, datapath, defaultplacement, id, ignoreAttribute, ignoreplacement, immediateparent, initstage, name, nodeLevel, onconstruct, oninit, parent, placement, subnodes
| clearSelection() | ||
| LzSelectionManager.clearSelection() | ||
|
Unselects any selected objects. |
||
|
|
| getSelection() | ||
| LzSelectionManager.getSelection() | ||
|
Returns an array representing the current selection. |
||
| Returns | ||
| Type | Desc | |
| Array | An array representing the current selection. | |
|
|
||
| isMultiSelect() | ||
| LzSelectionManager.isMultiSelect() | ||
|
Determines whether the an additional selection should be multi-selected or should replace the existing selection |
||
| Returns | ||
| Type | Desc | |
| Boolean | If true, multi select. If false, don't multi select | |
|
|
||
| isRangeSelect() | ||
| LzSelectionManager.isRangeSelect() | ||
|
Determines whether the an additional selection should be range-selected or should replace the existing selection |
||
| Returns | ||
| Type | Desc | |
| Boolean | If true, range select. If false, don't range select | |
|
|
||
| isSelected() | ||
| LzSelectionManager.isSelected(o) | ||
|
Tests for selectedness of input. |
||
| Parameters | ||
| Name | Type | Desc |
| o | The object to test for selectedness. | |
| Returns | ||
| Type | Desc | |
| The selectedness of the input object. | ||
|
|
||
| select() | ||
| LzSelectionManager.select(o) | ||
|
Called with a new member to be selected. |
||
| Parameters | ||
| Name | Type | Desc |
| o | The new element that got selected. | |
|
|
||
| unselect() | ||
| LzSelectionManager.unselect(o) | ||
|
Unselects the given object. |
||
| Parameters | ||
| Name | Type | Desc |
| o | The object to make unselected | |
|
|
||
animate, applyConstraint, applyData, childOf, completeInstantiation, construct, createChildren, dataBindAttribute, destroy, determinePlacement, getAttribute, getOption, getUID, init, lookupSourceLocator, searchImmediateSubnodes, searchSubnodes, setAttribute, setDatapath, setID, setName, setOption
| Events |
Copyright © 2002-2007 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.