com.extjs.gxt.ui.client.widget.selection
Class AbstractSelectionModel<C extends Container<T>,T extends Component>

java.lang.Object
  extended by com.extjs.gxt.ui.client.widget.selection.AbstractSelectionModel<C,T>
Type Parameters:
C - the container type
T - the container item type
All Implemented Interfaces:
Listener<ContainerEvent>, SelectionModel<C,T>, java.util.EventListener
Direct Known Subclasses:
DataListSelectionModel, DataView.DataViewSelectionModel, TableSelectionModel, TreeSelectionModel

public abstract class AbstractSelectionModel<C extends Container<T>,T extends Component>
extends java.lang.Object
implements SelectionModel<C,T>, Listener<ContainerEvent>

Concrete selection model. 3 selection models are supported:


Constructor Summary
AbstractSelectionModel()
          Creates a new single-select selection model.
AbstractSelectionModel(Style.SelectionMode mode)
          Creates a new selection model.
 
Method Summary
 void bind(C container)
          Binds the selection model to the container.
 void deselect(int index)
          Deselects the item at the given index.
 void deselect(int start, int end)
          Deselects the range.
 void deselect(java.util.List<T> items)
          Deselects the items.
 void deselect(T... items)
          Deselects the items.
 void deselect(T item)
          Deselects the item.
 void deselectAll()
          Deselects all selections.
 T getSelectedItem()
          Returns the selected item.
 java.util.List<T> getSelectedItems()
          Returns the selected items.
 Style.SelectionMode getSelectionMode()
          Returns the selection mode.
 void handleEvent(ContainerEvent ce)
          Sent when an event that the listener has registered for occurs.
 boolean isLocked()
          Returns true if selections are locked.
 boolean isSelected(T item)
          Returns true if the item is selcted.
 void refresh()
          Refreshes the current selections.
 void select(int index)
          Selects the item at the given index.
 void select(int start, int end)
          Selects the range.
 void select(java.util.List<T> items)
          Selects the items.
 void select(T... items)
          Selects the items.
 void select(T item)
          Selects the item.
 void selectAll()
          Selets all items.
 void setLocked(boolean locked)
          Sets whether selections are locked.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSelectionModel

public AbstractSelectionModel()
Creates a new single-select selection model.


AbstractSelectionModel

public AbstractSelectionModel(Style.SelectionMode mode)
Creates a new selection model.

Parameters:
mode - the selection mode
Method Detail

bind

public void bind(C container)
Description copied from interface: SelectionModel
Binds the selection model to the container.

Specified by:
bind in interface SelectionModel<C extends Container<T>,T extends Component>
Parameters:
container - the container

deselect

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

Specified by:
deselect in interface SelectionModel<C extends Container<T>,T extends Component>
Parameters:
index - the index of the item to be deselected

deselect

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

Specified by:
deselect in interface SelectionModel<C extends Container<T>,T extends Component>
Parameters:
start - the start index
end - the end index

deselect

public void deselect(java.util.List<T> items)
Description copied from interface: SelectionModel
Deselects the items.

Specified by:
deselect in interface SelectionModel<C extends Container<T>,T extends Component>
Parameters:
items - the item

deselect

public void deselect(T... items)
Description copied from interface: SelectionModel
Deselects the items.

Specified by:
deselect in interface SelectionModel<C extends Container<T>,T extends Component>
Parameters:
items - the items to deselect

deselect

public void deselect(T item)
Description copied from interface: SelectionModel
Deselects the item.

Specified by:
deselect in interface SelectionModel<C extends Container<T>,T extends Component>
Parameters:
item - the item to be deselected

deselectAll

public void deselectAll()
Description copied from interface: SelectionModel
Deselects all selections.

Specified by:
deselectAll in interface SelectionModel<C extends Container<T>,T extends Component>

getSelectedItem

public T getSelectedItem()
Description copied from interface: SelectionModel
Returns the selected item.

Specified by:
getSelectedItem in interface SelectionModel<C extends Container<T>,T extends Component>

getSelectedItems

public java.util.List<T> getSelectedItems()
Description copied from interface: SelectionModel
Returns the selected items.

Specified by:
getSelectedItems in interface SelectionModel<C extends Container<T>,T extends Component>

getSelectionMode

public Style.SelectionMode getSelectionMode()
Returns the selection mode.

Returns:
the selection mode

handleEvent

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

Specified by:
handleEvent in interface Listener<ContainerEvent>
Parameters:
ce - the event which occurred

isLocked

public boolean isLocked()
Returns true if selections are locked.

Returns:
the locked state

isSelected

public boolean isSelected(T item)
Description copied from interface: SelectionModel
Returns true if the item is selcted.

Specified by:
isSelected in interface SelectionModel<C extends Container<T>,T extends Component>
Parameters:
item - the item
Returns:
true if selected

refresh

public void refresh()
Description copied from interface: SelectionModel
Refreshes the current selections.

Specified by:
refresh in interface SelectionModel<C extends Container<T>,T extends Component>

select

public void select(int index)
Description copied from interface: SelectionModel
Selects the item at the given index.

Specified by:
select in interface SelectionModel<C extends Container<T>,T extends Component>
Parameters:
index - the index of the item to be selected

select

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

Specified by:
select in interface SelectionModel<C extends Container<T>,T extends Component>
Parameters:
start - the start index
end - the end index

select

public void select(java.util.List<T> items)
Description copied from interface: SelectionModel
Selects the items. Selects the first item for single-select.

Specified by:
select in interface SelectionModel<C extends Container<T>,T extends Component>
Parameters:
items - the items to select

select

public void select(T... items)
Description copied from interface: SelectionModel
Selects the items. Selects the first item for single-select.

Specified by:
select in interface SelectionModel<C extends Container<T>,T extends Component>
Parameters:
items - the items

select

public void select(T item)
Description copied from interface: SelectionModel
Selects the item.

Specified by:
select in interface SelectionModel<C extends Container<T>,T extends Component>
Parameters:
item - the item

selectAll

public void selectAll()
Description copied from interface: SelectionModel
Selets all items.

Specified by:
selectAll in interface SelectionModel<C extends Container<T>,T extends Component>

setLocked

public void setLocked(boolean locked)
Sets whether selections are locked.

Parameters:
locked - true to lock