JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.table
Interface SelectionModel

All Superinterfaces:
Moveable
All Known Implementing Classes:
JCSelection

public interface SelectionModel
extends Moveable

The SelectionModel interface represents the current cell selection state in Table. Although a default implementation is supplied that supports NONE, SINGLE, RANGE and MULTIRANGE selection, the model opens up possibilities that previously could only be down through the JCSelectListener interface.


Field Summary
static int ADD
          Constant that indicates that the cell range will be added as a new range to the selection.
static int DESELECT
          Constant that indicates that the given cell range is being deselected.
static int END
          Constant that indicates that the given cell is the end of selection.
static int EXTEND
          Constant that indicates that the given cell will be extend to the current selection.
static int SELECT
          Constant that indicates that the cell range represents the start of selection.
static int SELECT_MULTIRANGE
          A SelectionPolicy constant that indicates that multiple ranges of cells, rows or columns may be selected.
static int SELECT_NONE
          A SelectionPolicy constant that indicates that no selection is allowed.
static int SELECT_RANGE
          A SelectionPolicy constant that indicates that a range of cells, rows or columnsmay be selected.
static int SELECT_SINGLE
          A SelectionPolicy constant that indicates that a single cell may be selected.
 
Method Summary
 boolean addColumnSelection(int start_column, int end_column)
          Adds a range of columns to the selection.
 boolean addRowSelection(int start_row, int end_row)
          Adds a range of rows to the selection.
 boolean addSelection(int start_row, int start_column, int end_row, int end_column)
          Adds a range of cells to the selection.
 boolean addSelection(com.klg.jclass.table.JCCellRange selection)
          Adds a JCCellRange to the selection.
 void cleanup()
          Removes duplicate ranges from the selection.
 void clearSelection()
          Clears all selected cells.
 boolean extendSelection(int row, int column)
          Extends the current selection to the given row and column.
 Collection getSelectedCells()
          Returns a Collection containing all of the selected regions as JCCellRange objects.
 int getSelectionPolicy()
          Returns the policy of selection supported by the model.
 com.klg.jclass.table.JCTable getTable()
          Returns the JCTable controlled by the SelectionModel.
 boolean isSelected(int row, int column)
          Returns true if the given row/column is selected.
 boolean select(int state, int row, int column)
          Adds, extends, deselected or ends a selection based on a row or column.
 boolean selectAll()
          Selects all cells.
 boolean setColumnSelection(int start_column, int end_column)
          Sets a range of columns as the current selection.
 boolean setRowSelection(int start_row, int end_row)
          Sets a range of rows as the current selection.
 boolean setSelection(Collection selected_cells)
          Sets the selection to a Collection of JCCellRange objects.
 boolean setSelection(int start_row, int start_column, int end_row, int end_column)
          Sets a range of cells as the current selection.
 boolean setSelection(com.klg.jclass.table.JCCellRange selection)
          Sets the selection to a JCCellRange.
 void setSelectionPolicy(int value)
          Sets the policy of selection supported by the model.
 void setTable(com.klg.jclass.table.JCTable table)
          Sets the JCTable controlled by the SelectionModel.
 
Methods inherited from interface com.klg.jclass.table.Moveable
moveColumns, moveRows, remapColumns, remapRows, shiftColumn, shiftRow, swapColumns, swapRows
 

Field Detail

SELECT

public static final int SELECT
Constant that indicates that the cell range represents the start of selection.

See Also:
Constant Field Values

ADD

public static final int ADD
Constant that indicates that the cell range will be added as a new range to the selection.

See Also:
Constant Field Values

EXTEND

public static final int EXTEND
Constant that indicates that the given cell will be extend to the current selection.

See Also:
Constant Field Values

DESELECT

public static final int DESELECT
Constant that indicates that the given cell range is being deselected.

See Also:
Constant Field Values

END

public static final int END
Constant that indicates that the given cell is the end of selection.

See Also:
Constant Field Values

SELECT_NONE

public static final int SELECT_NONE
A SelectionPolicy constant that indicates that no selection is allowed.

See Also:
Constant Field Values

SELECT_SINGLE

public static final int SELECT_SINGLE
A SelectionPolicy constant that indicates that a single cell may be selected.

See Also:
Constant Field Values

SELECT_RANGE

public static final int SELECT_RANGE
A SelectionPolicy constant that indicates that a range of cells, rows or columnsmay be selected.

See Also:
Constant Field Values

SELECT_MULTIRANGE

public static final int SELECT_MULTIRANGE
A SelectionPolicy constant that indicates that multiple ranges of cells, rows or columns may be selected.

See Also:
Constant Field Values
Method Detail

getTable

public com.klg.jclass.table.JCTable getTable()
Returns the JCTable controlled by the SelectionModel.


setTable

public void setTable(com.klg.jclass.table.JCTable table)
Sets the JCTable controlled by the SelectionModel.


getSelectionPolicy

public int getSelectionPolicy()
Returns the policy of selection supported by the model. Valid policies are SELECT_NONE, SELECT_SINGLE, SELECT_RANGE, and SELECT_MULTIRANGE.


setSelectionPolicy

public void setSelectionPolicy(int value)
Sets the policy of selection supported by the model. Valid policies are SELECT_NONE, SELECT_SINGLE, SELECT_RANGE, and SELECT_MULTIRANGE.


addColumnSelection

public boolean addColumnSelection(int start_column,
                                  int end_column)
Adds a range of columns to the selection.

Returns:
true if the model supports multi-range column selection.

addRowSelection

public boolean addRowSelection(int start_row,
                               int end_row)
Adds a range of rows to the selection.

Returns:
true if the model supports multi-range row selection.

addSelection

public boolean addSelection(int start_row,
                            int start_column,
                            int end_row,
                            int end_column)
Adds a range of cells to the selection.

Returns:
true if the model supports multi-range selection.

addSelection

public boolean addSelection(com.klg.jclass.table.JCCellRange selection)
Adds a JCCellRange to the selection.

Returns:
true if the model supports multi-range selection.

cleanup

public void cleanup()
Removes duplicate ranges from the selection.


clearSelection

public void clearSelection()
Clears all selected cells.


extendSelection

public boolean extendSelection(int row,
                               int column)
Extends the current selection to the given row and column.

Returns:
true if the model supports range or multi-range selection.

getSelectedCells

public Collection getSelectedCells()
Returns a Collection containing all of the selected regions as JCCellRange objects.


isSelected

public boolean isSelected(int row,
                          int column)
Returns true if the given row/column is selected.


selectAll

public boolean selectAll()
Selects all cells.


setColumnSelection

public boolean setColumnSelection(int start_column,
                                  int end_column)
Sets a range of columns as the current selection.

Returns:
true if the model supports column selection.

setRowSelection

public boolean setRowSelection(int start_row,
                               int end_row)
Sets a range of rows as the current selection.

Returns:
true if the model supports row selection.

setSelection

public boolean setSelection(int start_row,
                            int start_column,
                            int end_row,
                            int end_column)
Sets a range of cells as the current selection.

Returns:
true if the model supports range or multi-range selection.

setSelection

public boolean setSelection(Collection selected_cells)
Sets the selection to a Collection of JCCellRange objects.

Returns:
true if the model supports the selection.

setSelection

public boolean setSelection(com.klg.jclass.table.JCCellRange selection)
Sets the selection to a JCCellRange.

Returns:
true if the model supports the selection.

select

public boolean select(int state,
                      int row,
                      int column)
Adds, extends, deselected or ends a selection based on a row or column. This method is called by the mouse and key process handler and should not be used for programmatic manipulation of selected regions.

Returns:
true if the model supports the selection.

Copyright © 2004 Quest Software Inc..
All rights reserved.