|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A model for the selection of cells inside a grid.
This also act as as a source of GridSelectionEvent
s.
Inner Class Summary | |
static class |
GridSelectionModel.Factory
A factory to create default GridSelectionModel objects. |
Fields inherited from class com.eliad.util.RulerConstants |
AUTO_RESIZE_ALL,
AUTO_RESIZE_LAST,
AUTO_RESIZE_NEXT,
AUTO_RESIZE_OFF,
AUTO_RESIZE_SUBSEQUENT,
HORIZONTAL,
VERTICAL |
Method Summary | |
void |
addGridSelectionListener(GridSelectionListener l)
Adds a listener to the list that's notified each time a change to the selection model occurs. |
void |
addSelectionRange(int topRow,
int leftColumn,
int bottomRow,
int rightColumn)
Changes the selection to be all the points whose row number is between anchorRow and leadRow included and whose column number is between anchorColumn and leadColumn included. |
void |
changeSelectionRange(int oldTopRow,
int oldLeftColumn,
int oldBottomRow,
int oldRightColumn,
int newTopRow,
int newLeftColumn,
int newBottomRow,
int newRightColumn,
boolean clearFirst)
Extends the selection. |
void |
clearSelection()
Changes the selection to the empty set. |
int |
getAnchorColumn()
Returns the leftmost coordinate of the anchor column. |
int |
getAnchorRow()
Returns the top coordinate of the anchor row. |
int |
getFirstSelectedColumn()
Retrieves the index of the first column where at least one cell is selected. shortcut for getFirstSelectedItem(HORIZONTAL) |
int |
getFirstSelectedItem(int orientation)
Retrieves the index of the first row/column where at least one unit is selected. |
int |
getFirstSelectedRow()
Retrieves the index of the first row where at least one cell is selected. shortcut for getFirstSelectedItem(VERTICAL) |
int |
getLastSelectedColumn()
Retrieves the index of the last column where at least one cell is selected. shortcut for getLastSelectedItem(HORIZONTAL) |
int |
getLastSelectedItem(int orientation)
Retrieves the index of the last row/column where at least one unit is selected. |
int |
getLastSelectedRow()
Retrieves the index of the last row where at least one cell is selected. shortcut for getLastSelectedItem(VERTICAL) |
int |
getLeadColumn()
Returns the rightmost coordinate of the lead column. |
int |
getLeadRow()
Returns the bottom coordinate of the lead row. |
int |
getSelectionCount()
Returns the number of selected units |
int |
getSelectionPolicy()
Gets the selection policy. |
int |
getSelectionUnit()
Gets the selection unit. |
boolean |
getValueIsAdjusting()
Returns true if the value is undergoing a series of changes. |
void |
insertColumns(int column,
int length)
Inserts length columns before column .
|
void |
insertRows(int row,
int length)
Inserts length rows before row .
|
boolean |
isSelected(int row,
int column)
Returns true if the specified unit is selected. |
boolean |
isSelectionEmpty()
Returns true if no cells are selected. |
java.util.Iterator |
iterator()
This method returns a non-null iterator for the individual selected units. |
void |
removeColumns(int column,
int length)
Removes length columns beginning at column . |
void |
removeGridSelectionListener(GridSelectionListener l)
Removes a listener from the list that's notified each time a change to the selection model occurs. |
void |
removeRows(int row,
int length)
Removes length rows beginning at row . |
void |
removeSelectionRange(int topRow,
int leftColumn,
int bottomRow,
int rightColumn)
Changes the selection to be the set difference of all the points whose row number is between anchorRow and leadRow included and whose column number is between anchorColumn and leadColumn included. |
void |
setAnchor(int topRow,
int leftColumn)
Sets the anchor selection point. |
void |
setLead(int topRow,
int leftColumn)
Sets the lead selection point. |
void |
setSelectionPolicy(int policy)
Sets the selection policy. |
void |
setSelectionRange(int topRow,
int leftColumn,
int bottomRow,
int leadColumn)
Changes the selection to be all the points whose row number is between anchorRow and leadRow included and whose column number is between anchorColumn and leadColumn included. |
void |
setSelectionUnit(int unit)
Sets the selection unit. |
void |
setValueIsAdjusting(boolean isAdjusting)
This property is true if upcoming changes to the value of the model should be considered a single event. |
Method Detail |
public int getSelectionUnit()
public void setSelectionUnit(int unit)
GridSelectionConstants.UNIT_CELL
The unit of selection is the cell
GridSelectionConstants.UNIT_ROW
The unit of selection is the row
GridSelectionConstants.UNIT_COLUMN
The unit of selection is the column
getSelectionUnit()
public int getSelectionPolicy()
setSelectionPolicy(int)
public void setSelectionPolicy(int policy)
GridSelectionConstants.POLICY_SINGLE
Only one unit can be selected at a time. In this
mode the setSelectionRange and addSelectionRange
methods are equivalent, and only the "lead"
point is used.GridSelectionConstants.POLICY_RANGE
One continuous unit range can be selected at a time.
In this mode setSelectionRange and addSelectionRange
are equivalent.GridSelectionConstants.POLICY_MULTIRANGE
In this mode, there's no restriction on what can be selected.public boolean isSelectionEmpty()
public boolean isSelected(int row, int column)
row
- the row of the queried unit, ignored if the unit is COLUMNcolumn
- the column of the queried unit, ignored if the unit is ROWpublic int getSelectionCount()
public int getFirstSelectedItem(int orientation)
public int getLastSelectedItem(int orientation)
public int getFirstSelectedRow()
public int getFirstSelectedColumn()
public int getLastSelectedRow()
public int getLastSelectedColumn()
public java.util.Iterator iterator()
public void clearSelection()
GridSelectionListener
.addGridSelectionListener(com.eliad.model.GridSelectionListener)
public void setSelectionRange(int topRow, int leftColumn, int bottomRow, int leadColumn)
GridSelectionListener
.
If the mode is GridSelectionConstants.SINGLE_CELL_SELECTION
range will be restrained to its top-left cell.
anchorRow
- one row boundary of the selected rangeanchorColumn
- one column boundary of the selected rangeleadRow
- the other row boundary of the selected rangeleadColumn
- the other column boundary of the selected rangeaddGridSelectionListener(com.eliad.model.GridSelectionListener)
public void addSelectionRange(int topRow, int leftColumn, int bottomRow, int rightColumn)
GridSelectionListener
.
If the mode is not GridSelectionConstants.MULTIPLE_RECTANGLE_SELECTION
the resulting selection set may be reshaped to conform.anchorRow
- one row boundary of the added rangeanchorColumn
- one column boundary of the added rangeleadRow
- the other row boundary of the added rangeleadColumn
- the other column boundary of the added rangeaddGridSelectionListener(com.eliad.model.GridSelectionListener)
public void removeSelectionRange(int topRow, int leftColumn, int bottomRow, int rightColumn)
GridSelectionListener
.
If the mode is not GridSelectionConstants.MULTIPLE_RECTANGLE_SELECTION
the resulting selection set may be reshaped to conform.anchorRow
- one row boundary of the removed rangeanchorColumn
- one column boundary of the removed rangeleadRow
- the other row boundary of the removed rangeleadColumn
- the other column boundary of the removed rangeaddGridSelectionListener(com.eliad.model.GridSelectionListener)
public void changeSelectionRange(int oldTopRow, int oldLeftColumn, int oldBottomRow, int oldRightColumn, int newTopRow, int newLeftColumn, int newBottomRow, int newRightColumn, boolean clearFirst)
getLeadRow()
,
getLeadColumn()
public void insertRows(int row, int length)
length
rows before row
.
Sets the newly inserted cells as selected if atleast one of the following conditions is respected:
the cell is inside a selected column;
the cell at (row-1
-1,column) exists and is selected;
the whole row is inside the selection.
This method is typically called to synchronize the selection model with a corresponding change
in the data model.row
- the insertion position.length
- the number of rows to insert.public void insertColumns(int column, int length)
length
columns before column
.
Sets the newly inserted cells as selected if atleast one of the following conditions is respected:
the cell is inside a selected row;
the cell at (row,column-1
) exists and is selected;
the whole column is inside the selection.
This method is typically called to synchronize the selection model with a corresponding change
in the data model.column
- the insertion position.length
- the number of columns to insert.public void removeRows(int row, int length)
length
rows beginning at row
. This is typically
called to sync the selection model with a corresponding change
in the data model.row
- the deletion position.length
- the number of rows to remove.-1 means remove all rows.public void removeColumns(int column, int length)
length
columns beginning at column
. This is typically
called to sync the selection model with a corresponding change
in the data model.column
- the deletion position.length
- the number of columns to remove. -1 means remove all rows.public boolean getValueIsAdjusting()
setValueIsAdjusting(boolean)
public void setValueIsAdjusting(boolean isAdjusting)
valueIsAdjusting
- The new value of the property.getValueIsAdjusting()
public int getAnchorRow()
getLeadRow()
,
setSelectionRange(int, int, int, int)
,
addSelectionRange(int, int, int, int)
public int getAnchorColumn()
getLeadColumn()
,
setSelectionRange(int, int, int, int)
,
addSelectionRange(int, int, int, int)
public int getLeadRow()
getAnchorRow()
,
setSelectionRange(int, int, int, int)
,
addSelectionRange(int, int, int, int)
public int getLeadColumn()
getAnchorColumn()
,
setSelectionRange(int, int, int, int)
,
addSelectionRange(int, int, int, int)
public void setAnchor(int topRow, int leftColumn)
getAnchorRow()
,
getAnchorColumn()
public void setLead(int topRow, int leftColumn)
getLeadRow()
,
getLeadColumn()
public void addGridSelectionListener(GridSelectionListener l)
l
- the GridSelectionListener
public void removeGridSelectionListener(GridSelectionListener l)
l
- the GridSelectionListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |