com.sas.table
Class Row

com.sas.table.Row
All Implemented Interfaces:
TableElementInterface, com.sas.util.Countable

public class Row

Represents a row in a TableView.

A Row is essentially an array of cells with properties and methods for introspecting and manipulating the row itself. The properties include an integer index to uniquely identify the row, a label, a style, a position, and a size.

See Also:
TableView, Column, RowStyle

Field Summary
 
Fields inherited from class com.sas.table.TableElement
emptyModelTypesArray, emptyModelTypeStylesArray, tableView
 
Fields inherited from interface com.sas.table.TableElementInterface
REFRESH_ALL, REFRESH_DATA, REFRESH_DATA_STYLE, REFRESH_LABEL, REFRESH_LABEL_STYLE, REFRESH_STYLE
 
Constructor Summary
Row(TableView table, int index)
          Constructor.
 
Method Summary
 boolean contains(DataCell cell)
          Test for the presence of a cell in the row.
 int count(int maxCount)
          Returns the number of cells in the row, not including the label, up to a specified count if the real number is not readily determined.
 boolean equals(CellVector obj)
          Compares this and a given cell vector for equality.
 boolean equals(Row other)
          Compares this and a given row for equality.
 int getBottomEdge()
          Returns the y-coordinate of the bottom side of the row (relative to the top-left corner of the table) when displayed is true; it is undefined when displayed is false.
 DataCell getCell(int colIndex)
          Returns the cell at a given column index.
 com.sas.collection.StaticPropertyBagInterface getDefaultStyle()
          Returns the table view's default row style.
 int getHeight()
          Alias for "getSize()".
 int getIndex()
          Returns the row's one-based position in the table view's model.
 LabelCell getLabel()
          Returns the label associated with the row.
 int getMaxPosition()
          Returns the bottom edge of the table.
 com.sas.collection.StaticPropertyBagInterface getModelDefaultStyle()
          Returns the table view's model's default row style.
 java.lang.String getPixelUnit()
          Returns the pixel unit that getSize is in terms of.
protected  CellVector getThisCellVector()
          Returns the CellVector instance to delegate all variable access to.
protected  Row getThisRow()
          Returns the Row instance to delegate all variable access to.
 boolean isHeld()
          Indicates whether the row is "held".
 boolean isSelected()
          Returns whether or not the row is selected in the table.
 boolean isTransient()
          Indicates whether the row is transient.
 Row nextRow()
          Returns the next row if any, otherwise null.
protected  int onComputePreferredSize(java.awt.Graphics g)
          Framework method called by computePreferredSize.
protected  com.sas.collection.StaticPropertyBagInterface onGetModelStyle()
          TableElement framework method for querying the table view's model for any style properties associated with the element.
protected  CellVector onNext()
          Framework method called by next for determining the Row that follows this.
protected  CellVector onPrevious()
          Framework method called by previous for determining the Row that precedes this.
protected  void onResized()
          Framework method called by setSize to notify subclasses of a change in size.
 Row previousRow()
          Returns the previous row if any, otherwise null.
 void refresh(int flags)
          Refreshes the row's cells to their state as maintained by the table view's model.
 void repaint()
          Repaints the row.
 void setObsolete()
          Indicates that the row should be considered obsolete.
 
Methods inherited from class com.sas.table.CellVector
computePreferredSize, contains, contains, count, equals, getCellsToSizeCount, getDisplayedSize, getModelTypes, getModelTypeStyles, getPosition, getPreferredSize, getSize, getThis, hashCode, isDisplayed, isModified, isPartiallyDisplayed, isResizable, isResized, next, previous, remeasure, resize, resize, setPreferredSize, setSize
 
Methods inherited from class com.sas.table.TableElement
equals, getEffectiveStylePropertyBag, getEffectiveStylePropertyValue, getModelStyle, getStyle, getTableView, isCurrent, onGetEffectiveStylePropertyBag, onGetEffectiveStylePropertyValue, setStyle
 

Constructor Detail

Row

public Row(TableView table,
           int index)
Constructor.

Parameters:
table - The TableView instance that contains this row.
index - The one-based position of the row in the table view's model.
Method Detail

contains

public boolean contains(DataCell cell)
Test for the presence of a cell in the row.

Specified by:
contains in class CellVector
Parameters:
cell - The cell to check for.

count

public int count(int maxCount)
Returns the number of cells in the row, not including the label, up to a specified count if the real number is not readily determined.

Specified by:
count in class CellVector
Parameters:
maxCount - Defines a limiting factor for cases where the number of cells is not readily determined. Such a case is a function of the table view's model. maxCount allows you to limit how much computation is done. If the count is already known to be larger than maxCount without doing any computation, then the larger number is returned. Specifying a maxCount of zero will force the computation of the total count no matter the cost.
Returns:
The number of cells in the row.
See Also:
StaticTableInterface.countColumns(int)

equals

public final boolean equals(CellVector obj)
Compares this and a given cell vector for equality.

Specified by:
equals in class CellVector
Returns:
true if obj is a Row and equals((Row)obj) returns true; false otherwise.

equals

public boolean equals(Row other)
Compares this and a given row for equality.

Returns:
true if this row has the same index and tableView as other; false otherwise.

getBottomEdge

public int getBottomEdge()
Returns the y-coordinate of the bottom side of the row (relative to the top-left corner of the table) when displayed is true; it is undefined when displayed is false.

Returns:
The value of the bottomEdge property in pixels.

getCell

public DataCell getCell(int colIndex)
Returns the cell at a given column index.

Specified by:
getCell in class CellVector
Parameters:
colIndex - A one-based index that identifies the cell's column.
Returns:
The cell associated with colIndex.
Throws:
java.lang.IndexOutOfBoundsException - If colIndex is not in the range [1, count()].

getDefaultStyle

public com.sas.collection.StaticPropertyBagInterface getDefaultStyle()
Returns the table view's default row style.

Specified by:
getDefaultStyle in class TableElement
Returns:
The value of the defaultStyle property (will never be null).
See Also:
getModelDefaultStyle()

getHeight

public final int getHeight()
Alias for "getSize()".

Returns:
The row's height in pixels.

getIndex

public int getIndex()
Returns the row's one-based position in the table view's model.

Specified by:
getIndex in class CellVector
Returns:
The value of the index property.

getLabel

public LabelCell getLabel()
Returns the label associated with the row.

Specified by:
getLabel in class CellVector
Returns:
The value of the label property; will never be null.

getMaxPosition

public int getMaxPosition()
Returns the bottom edge of the table.

Specified by:
getMaxPosition in class CellVector
Returns:
The value of the maxPosition property in pixels.

getModelDefaultStyle

public com.sas.collection.StaticPropertyBagInterface getModelDefaultStyle()
Returns the table view's model's default row style.

Specified by:
getModelDefaultStyle in class TableElement
Returns:
The value of the modelDefaultStyle property.
See Also:
getDefaultStyle()

getPixelUnit

public java.lang.String getPixelUnit()
Returns the pixel unit that getSize is in terms of.

Specified by:
getPixelUnit in class CellVector
Returns:
"py".

getThisCellVector

protected final CellVector getThisCellVector()
Returns the CellVector instance to delegate all variable access to. Usually the instance will be this, but if this has been obsoleted then a different, but equivalent, instance will be returned.

Specified by:
getThisCellVector in class CellVector
Returns:
The proxy for accessing our variables.
See Also:
setObsolete()

getThisRow

protected final Row getThisRow()
Returns the Row instance to delegate all variable access to. Usually the instance will be this, but if this has been obsoleted then a different, but equivalent, instance will be returned.

Returns:
The proxy for accessing our variables.
See Also:
setObsolete()

isHeld

public boolean isHeld()
Indicates whether the row is "held". A held row is one that has been made non-scrollable and is thus always, space permitting, displayed; i.e. it is never scrolled out of view.

Specified by:
isHeld in class CellVector
Returns:
true if the row is held and false otherwise.
See Also:
TableView.getHeldRows()

isSelected

public boolean isSelected()
Returns whether or not the row is selected in the table. Implementation note: Row does not maintain its own selected state, but instead delegates to tableView.isRowSelected(this).

Returns:
true if the row is selected, false otherwise.

isTransient

public boolean isTransient()
Indicates whether the row is transient. See TableElement.isTransient() for a definition of "transient".

Augments super to treat rows with intransient labels or cells as intransient.

Overrides:
isTransient in class CellVector
Returns:
true if the row is transient, and false otherwise.
See Also:
TableElement.isTransient()

nextRow

public Row nextRow()
Returns the next row if any, otherwise null.

Returns:
The Row that follows this one or null.
See Also:
CellVector.previous()

onComputePreferredSize

protected int onComputePreferredSize(java.awt.Graphics g)
Framework method called by computePreferredSize.

Specified by:
onComputePreferredSize in class CellVector
Parameters:
g - The graphics context to measure the row in.
Returns:
The row's preferred size (height) in y-pixels.
See Also:
CellVector.computePreferredSize(java.awt.Graphics)

onGetModelStyle

protected com.sas.collection.StaticPropertyBagInterface onGetModelStyle()
                                                                 throws com.sas.table.TableException
TableElement framework method for querying the table view's model for any style properties associated with the element.

Specified by:
onGetModelStyle in class TableElement
Returns:
Any model supplied style properties for the row.
Throws:
TableException - Propagated from call to model.
See Also:
TableElement.getModelStyle()

onNext

protected CellVector onNext()
Framework method called by next for determining the Row that follows this.

Specified by:
onNext in class CellVector
Returns:
The Row that follows this one or null.
See Also:
CellVector.next()

onPrevious

protected CellVector onPrevious()
Framework method called by previous for determining the Row that precedes this.

Specified by:
onPrevious in class CellVector
Returns:
The Row that precedes this one or null.
See Also:
CellVector.previous()

onResized

protected void onResized()
Framework method called by setSize to notify subclasses of a change in size.

Specified by:
onResized in class CellVector
See Also:
CellVector.setSize(int)

previousRow

public Row previousRow()
Returns the previous row if any, otherwise null.

Returns:
The Row that precedes this one or null.
See Also:
CellVector.next()

refresh

public void refresh(int flags)
Refreshes the row's cells to their state as maintained by the table view's model. What gets refreshed -- data and/or style information -- is controlled by flags. Includes a call to repaint().

Specified by:
refresh in interface TableElementInterface
Overrides:
refresh in class TableElement
Parameters:
flags - Bitmask of REFRESH_* flags.

repaint

public void repaint()
Repaints the row. Nothing happens if displayed is false.


setObsolete

public void setObsolete()
Indicates that the row should be considered obsolete. See TableElement.setObsolete() for a definition of "obsolete".

Specified by:
setObsolete in class TableElement
See Also:
TableElement.isTransient(), TableElement.equals(java.lang.Object)



Copyright © 2009 SAS Institute Inc. All Rights Reserved.