Name

selectionmanager (LzSelectionManager) — Manages selection among a series of objects.

Synopsis

LZX: selectionmanager
JavaScript: LzSelectionManager
Type: Class
Access: private
Topic: LFC.Helpers
Declared in: WEB-INF/lps/lfc/helpers/LzSelectionManager.lzs

Description

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>
 

Superclass Chain

node (LzNode) » selectionmanager (LzSelectionManager)

Known Subclasses

Known Direct Subclasses: dataselectionmanager (LzDataSelectionManager)

Details

Initial Attributes (2)

Initial Attributes are given as attributes in LZX but are not generally available as properties in JavaScript.

selFuncName
<attribute name="selFuncName" type="boolean" />
The name of the method to call (with true or false to represent selectedness) when an element changes its selectedness
toggle
<attribute name="toggle" type="boolean" />
If true, a re-selected element will lose the selection.

Properties (3)

sel
<attribute name="sel" type="string" />
public var sel : String;
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
<attribute name="selected" type="array" />
public var selected : Array;
An array that represents the current selection
selectedHash
<attribute name="selectedHash" type="object" />
public var selectedHash : Object;
A hash of currently selected objects (by UID)

Methods (11)

clearSelection()
<method name="clearSelection" />
public function clearSelection();
Unselects any selected objects.
construct()
<method name="construct" args="view, args" />
private function construct(view : LzView, args : Object);
getSelection()
<method name="getSelection" />
public function getSelection() : Array;
Returns an array representing the current selection.
isMultiSelect()
<method name="isMultiSelect" />
protected function isMultiSelect() : Boolean;
Determines whether the an additional selection should be multi-selected or should replace the existing selection
isRangeSelect()
<method name="isRangeSelect" />
protected function isRangeSelect() : Boolean;
Determines whether the an additional selection should be range-selected or should replace the existing selection
isSelected()
<method name="isSelected" args="o" />
public function isSelected(o);
Tests for selectedness of input.
makeSelected()
<method name="makeSelected" args="s" />
private function makeSelected(s);
Makes the given object selected.
select()
<method name="select" args="o" />
public function select(o);
Called with a new member to be selected.
selectRange()
<method name="selectRange" args="s, e" />
private function selectRange(s, e);
toString()
<method name="toString" />
public function toString();
unselect()
<method name="unselect" args="o" />
protected function unselect(o);
Unselects the given object.

LZX Synopsis

<class name="LzSelectionManager" extends=" LzNode ">
  <attribute name=" sel " type="string" />
  <attribute name=" selected " type="array" />
  <attribute name=" selectedHash " type="object" />
  <method name=" clearSelection " />
  <method name=" construct " args="view, args" />
  <method name=" getSelection " />
  <method name=" isMultiSelect " />
  <method name=" isRangeSelect " />
  <method name=" isSelected " args="o" />
  <method name=" makeSelected " args="s" />
  <method name=" select " args="o" />
  <method name=" selectRange " args="s, e" />
  <method name=" toString " />
  <method name=" unselect " args="o" />
</class>

JavaScript Synopsis

private LzSelectionManager extends  LzNode  {
  public var sel  : String;
  public var selected  : Array;
  public var selectedHash  : Object;
  prototype public function clearSelection ();
  prototype private function construct (view : LzView, args : Object);
  prototype public function getSelection () : Array;
  prototype protected function isMultiSelect () : Boolean;
  prototype protected function isRangeSelect () : Boolean;
  prototype public function isSelected (o);
  prototype private function makeSelected (s);
  prototype public function select (o);
  prototype private function selectRange (s, e);
  prototype public function toString ();
  prototype protected function unselect (o);
}