com.sas.table
Class CellSelection

com.sas.table.CellSelection
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.collection.ContentsChangedSource, com.sas.collection.StaticCollectionInterface, com.sas.models.SelectionInterface, com.sas.models.StaticSelectionInterface, com.sas.PublicClonable, TableElementInterface, com.sas.util.Countable, com.sas.util.Enumerable, java.lang.Cloneable

public class CellSelection

Represents a contiguous range of cells in a TableView.

See Also:
Selection, CellVectorSelection, ColumnSelection, RowSelection

Field Summary
 
Fields inherited from interface com.sas.table.TableElementInterface
REFRESH_ALL, REFRESH_DATA, REFRESH_DATA_STYLE, REFRESH_LABEL, REFRESH_LABEL_STYLE, REFRESH_STYLE
 
Constructor Summary
CellSelection(DataCell anchor)
          Alias for CellSelection(anchor, anchor).
CellSelection(DataCell anchor, DataCell end)
          Constructs a new selection with the given extent.
 
Method Summary
 boolean contains(java.lang.Object item)
          Test for the presence of an item in the selection.
 int count()
          Returns the number of items in the selection.
 ColumnSelection getColumns()
          Returns the set of columns associated with this selection.
 java.awt.Rectangle getDisplayedBounds()
          Returns a rectangle that represents the displayed area of the selection in the table view.
 java.util.Enumeration getItems()
          Returns an enumeration of all the items in the selection.
 RowSelection getRows()
          Returns the set of rows associated with this selection.
protected  Selection newSelection(TableElement anchor, TableElement end)
          Creates a new selection of the same class, but with different items.
protected  void onEndChanged(TableElement oldValue, TableElement newValue)
          Called by setEnd() to notify subclasses of a change to the end.
 void setEnd(java.lang.Object newValue)
          Specifies the object that defines the unanchored or floating end of the selection.
 
Methods inherited from class com.sas.table.Selection
addContentsChangedListener, addPropertyChangeListener, apply, clone, fireContentsChanged, firePropertyChange, firePropertyChange, getAnchor, getEnd, getTableView, isDisplayed, isModified, isSelected, refresh, removeContentsChangedListener, removePropertyChangeListener, repaint
 

Constructor Detail

CellSelection

public CellSelection(DataCell anchor)
Alias for CellSelection(anchor, anchor).

Parameters:
anchor - The value to assign the anchor property.

CellSelection

public CellSelection(DataCell anchor,
                     DataCell end)
Constructs a new selection with the given extent.

Parameters:
anchor - The value to assign the anchor property.
end - The value to assign the end property.
See Also:
Selection.getAnchor(), Selection.getEnd()
Method Detail

count

public int count()
Returns the number of items in the selection.

Specified by:
count in interface com.sas.util.Countable
Specified by:
count in class Selection
Returns:
The number of items in the selection.

contains

public boolean contains(java.lang.Object item)
Test for the presence of an item in the selection.

Specified by:
contains in interface com.sas.collection.StaticCollectionInterface
Specified by:
contains in interface com.sas.models.StaticSelectionInterface
Specified by:
contains in class Selection
Parameters:
item - The item to search for.
Returns:
true if the selection contains the item and false otherwise.
Throws:
java.lang.ClassCastException - If item is not a DataCell.

getColumns

public ColumnSelection getColumns()
Returns the set of columns associated with this selection.

Returns:
A ColumnSelection representing the set of columns, if any; otherwise null will be returned.

getDisplayedBounds

public java.awt.Rectangle getDisplayedBounds()
Returns a rectangle that represents the displayed area of the selection in the table view. The rectangle will be empty (have a width and height of zero) when no part of the selection is displayed.

Specified by:
getDisplayedBounds in class Selection
Returns:
The displayed location and size of the selection.
See Also:
Selection.isDisplayed()

getItems

public java.util.Enumeration getItems()
Returns an enumeration of all the items in the selection.

Specified by:
getItems in interface com.sas.util.Enumerable
Specified by:
getItems in class Selection
Returns:
An enumeration of the selection's items.

getRows

public RowSelection getRows()
Returns the set of rows associated with this selection.

Returns:
A RowSelection representing the set of rows, if any; otherwise null will be returned.

setEnd

public void setEnd(java.lang.Object newValue)
Specifies the object that defines the unanchored or floating end of the selection. Ensures that the new value is a DataCell and calls super.

Specified by:
setEnd in interface com.sas.models.SelectionInterface
Overrides:
setEnd in class Selection
Parameters:
newValue - The new value to assign the end property.
Throws:
java.lang.ClassCastException - If newValue is not a DataCell.
See Also:
Selection.getEnd(), Selection.onEndChanged(com.sas.table.TableElement, com.sas.table.TableElement), Selection.addContentsChangedListener(com.sas.collection.ContentsChangedListener)

newSelection

protected Selection newSelection(TableElement anchor,
                                 TableElement end)
Creates a new selection of the same class, but with different items. Allows a base class operation to create a new subclass instance.

Specified by:
newSelection in class Selection
Parameters:
anchor - The value to assign the anchor property.
end - The value to assign the end property.
Returns:
A new selection with the same class as this, but with different items.
See Also:
Selection.clone()

onEndChanged

protected void onEndChanged(TableElement oldValue,
                            TableElement newValue)
Called by setEnd() to notify subclasses of a change to the end. Overrides super to fire a SelectionChangedEvent.

Overrides:
onEndChanged in class Selection
Parameters:
oldValue - The previous value of end.
newValue - The current value of end.
See Also:
Selection.setEnd(java.lang.Object), Selection.fireContentsChanged(com.sas.collection.ContentsChangedEvent)



Copyright © 2009 SAS Institute Inc. All Rights Reserved.