com.extjs.gxt.ui.client.widget.treepanel
Class TreePanelSelectionModel<M extends ModelData>

java.lang.Object
  extended by com.extjs.gxt.ui.client.event.BaseObservable
      extended by com.extjs.gxt.ui.client.widget.selection.AbstractStoreSelectionModel<M>
          extended by com.extjs.gxt.ui.client.widget.treepanel.TreePanelSelectionModel<M>
Type Parameters:
M - the model type
All Implemented Interfaces:
Listener<TreePanelEvent>, Observable, SelectionProvider<M>, StoreSelectionModel<M>, java.util.EventListener

public class TreePanelSelectionModel<M extends ModelData>
extends AbstractStoreSelectionModel<M>
implements Listener<TreePanelEvent>

TreePanel selection model.


Field Summary
protected  KeyNav<TreePanelEvent<M>> keyNav
           
protected  TreePanel tree
           
protected  TreeStore<M> treeStore
           
 
Fields inherited from class com.extjs.gxt.ui.client.widget.selection.AbstractStoreSelectionModel
lastSelected, locked, selected, selectionMode, store, storeListener
 
Constructor Summary
TreePanelSelectionModel()
           
 
Method Summary
 void bindTree(TreePanel tree)
           
 void deselect(int index)
          Deselects the item at the given index.
 void deselect(int start, int end)
          Deselects the range.
 void handleEvent(TreePanelEvent tpe)
          Sent when an event that the listener has registered for occurs.
 boolean isSelected(M item)
          Returns true if the item is selected.
protected  M next()
           
protected  void onKeyDown(TreePanelEvent<M> e)
           
protected  void onKeyLeft(TreePanelEvent<M> ce)
           
protected  void onKeyRight(TreePanelEvent<M> ce)
           
protected  void onKeyUp(TreePanelEvent<M> e)
           
protected  void onMouseClick(TreePanelEvent e)
           
protected  void onMouseDown(TreePanelEvent be)
           
protected  void onSelectChange(M model, boolean select)
           
protected  M prev()
           
 void select(int start, int end, boolean keepExisting)
          Selects the range.
 void selectNext()
          Selects the item below the selected item in the tree, intelligently walking the nodes.
 void selectPrevious()
          Selects the item above the selected item in the tree, intelligently walking the nodes.
 
Methods inherited from class com.extjs.gxt.ui.client.widget.selection.AbstractStoreSelectionModel
addSelectionChangedListener, bind, deselect, deselect, deselect, deselectAll, doDeselect, doMultiSelect, doSelect, doSingleSelect, fireSelectionChange, getLastFocused, getSelectedItem, getSelectedItems, getSelection, getSelectionMode, isLocked, onAdd, onClear, onLastFocusChanged, onRemove, onUpdate, refresh, removeSelectionListener, select, select, select, select, selectAll, setLastFocused, setLocked, setSelection, setSelectionMode
 
Methods inherited from class com.extjs.gxt.ui.client.event.BaseObservable
addListener, callListener, fireEvent, fireEvent, getFiresEvents, getListeners, hasActiveEvent, hasListeners, hasListeners, removeAllListeners, removeListener, setFiresEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyNav

protected KeyNav<TreePanelEvent<M extends ModelData>> keyNav

tree

protected TreePanel tree

treeStore

protected TreeStore<M extends ModelData> treeStore
Constructor Detail

TreePanelSelectionModel

public TreePanelSelectionModel()
Method Detail

bindTree

public void bindTree(TreePanel tree)

deselect

public void deselect(int index)
Description copied from interface: StoreSelectionModel
Deselects the item at the given index.

Specified by:
deselect in interface StoreSelectionModel<M extends ModelData>
Overrides:
deselect in class AbstractStoreSelectionModel<M extends ModelData>
Parameters:
index - the index of the item to be deselected

deselect

public void deselect(int start,
                     int end)
Description copied from interface: StoreSelectionModel
Deselects the range.

Specified by:
deselect in interface StoreSelectionModel<M extends ModelData>
Overrides:
deselect in class AbstractStoreSelectionModel<M extends ModelData>
Parameters:
start - the start index
end - the end index

handleEvent

public void handleEvent(TreePanelEvent tpe)
Description copied from interface: Listener
Sent when an event that the listener has registered for occurs.

Specified by:
handleEvent in interface Listener<TreePanelEvent>
Parameters:
tpe - the event which occurred

isSelected

public boolean isSelected(M item)
Description copied from interface: StoreSelectionModel
Returns true if the item is selected.

Specified by:
isSelected in interface StoreSelectionModel<M extends ModelData>
Overrides:
isSelected in class AbstractStoreSelectionModel<M extends ModelData>
Parameters:
item - the item
Returns:
true if selected

select

public void select(int start,
                   int end,
                   boolean keepExisting)
Description copied from interface: StoreSelectionModel
Selects the range.

Specified by:
select in interface StoreSelectionModel<M extends ModelData>
Overrides:
select in class AbstractStoreSelectionModel<M extends ModelData>
Parameters:
start - the start index
end - the end index
keepExisting - true to keep existing selected

selectNext

public void selectNext()
Selects the item below the selected item in the tree, intelligently walking the nodes.


selectPrevious

public void selectPrevious()
Selects the item above the selected item in the tree, intelligently walking the nodes.


next

protected M next()

onKeyDown

protected void onKeyDown(TreePanelEvent<M> e)

onKeyLeft

protected void onKeyLeft(TreePanelEvent<M> ce)

onKeyRight

protected void onKeyRight(TreePanelEvent<M> ce)

onKeyUp

protected void onKeyUp(TreePanelEvent<M> e)

onMouseClick

protected void onMouseClick(TreePanelEvent e)

onMouseDown

protected void onMouseDown(TreePanelEvent be)

onSelectChange

protected void onSelectChange(M model,
                              boolean select)
Specified by:
onSelectChange in class AbstractStoreSelectionModel<M extends ModelData>

prev

protected M prev()