de.matthiasmann.twl.model
Class DefaultTableSelectionModel

java.lang.Object
  extended by de.matthiasmann.twl.model.AbstractTableSelectionModel
      extended by de.matthiasmann.twl.model.DefaultTableSelectionModel
All Implemented Interfaces:
TableSelectionModel

public class DefaultTableSelectionModel
extends AbstractTableSelectionModel

A table selection model for multi selection


Field Summary
 
Fields inherited from class de.matthiasmann.twl.model.AbstractTableSelectionModel
anchorIndex, leadIndex, selectionChangeListener
 
Constructor Summary
DefaultTableSelectionModel()
           
 
Method Summary
 void addSelection(int index0, int index1)
          Adds the given interval (both indices inclusive) to the selection.
 void clearSelection()
           
 int getFirstSelected()
           
 int getLastSelected()
           
 int[] getSelection()
           
 boolean hasSelection()
           
 void invertSelection(int index0, int index1)
          Inverts the given interval (both indices inclusive) in the selection.
 boolean isSelected(int index)
           
 void removeSelection(int index0, int index1)
          Removes the given interval (both indices inclusive) from the selection.
 void rowsDeleted(int index, int count)
           
 void rowsInserted(int index, int count)
           
 void setSelection(int index0, int index1)
          Sets the selection to the given interval (both indices inclusive).
 
Methods inherited from class de.matthiasmann.twl.model.AbstractTableSelectionModel
addSelectionChangeListener, fireSelectionChange, getAnchorIndex, getLeadIndex, removeSelectionChangeListener, setAnchorIndex, setLeadIndex, updateLeadAndAnchor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTableSelectionModel

public DefaultTableSelectionModel()
Method Detail

getFirstSelected

public int getFirstSelected()

getLastSelected

public int getLastSelected()

hasSelection

public boolean hasSelection()

isSelected

public boolean isSelected(int index)

clearSelection

public void clearSelection()

setSelection

public void setSelection(int index0,
                         int index1)
Description copied from interface: TableSelectionModel
Sets the selection to the given interval (both indices inclusive). Single selection should use index1.

Parameters:
index0 - the start index of the interval.
index1 - the end index of the interval.

addSelection

public void addSelection(int index0,
                         int index1)
Description copied from interface: TableSelectionModel
Adds the given interval (both indices inclusive) to the selection. Single selection should use index1.

Parameters:
index0 - the start index of the interval.
index1 - the end index of the interval.

invertSelection

public void invertSelection(int index0,
                            int index1)
Description copied from interface: TableSelectionModel
Inverts the given interval (both indices inclusive) in the selection. Single selection should use index1.

Parameters:
index0 - the start index of the interval.
index1 - the end index of the interval.

removeSelection

public void removeSelection(int index0,
                            int index1)
Description copied from interface: TableSelectionModel
Removes the given interval (both indices inclusive) from the selection. Single selection should clear the selection.

Parameters:
index0 - the start index of the interval.
index1 - the end index of the interval.

getSelection

public int[] getSelection()

rowsInserted

public void rowsInserted(int index,
                         int count)
Specified by:
rowsInserted in interface TableSelectionModel
Overrides:
rowsInserted in class AbstractTableSelectionModel

rowsDeleted

public void rowsDeleted(int index,
                        int count)
Specified by:
rowsDeleted in interface TableSelectionModel
Overrides:
rowsDeleted in class AbstractTableSelectionModel