com.sas.table
Class Column

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

public class Column

Represents a column in a TableView.

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

See Also:
TableView, Row, ColumnStyle

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
Column(TableView table, int index)
          Constructor.
 
Method Summary
 boolean contains(DataCell cell)
          Test for the presence of a cell in the column.
 int count(int maxCount)
          Returns the number of cells in the column, 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(Column other)
          Compares this and a given column for equality.
 DataCell getCell(int rowIndex)
          Returns the cell at a given row index.
 com.sas.collection.StaticPropertyBagInterface getDefaultStyle()
          Returns the table view's default column style.
 int getIndex()
          Returns the column's one-based position in the table view's model.
 LabelCell getLabel()
          Returns the label associated with the column.
 int getMaxPosition()
          Returns the right edge of the table.
 com.sas.collection.StaticPropertyBagInterface getModelDefaultStyle()
          Returns the table view's model's default column style.
 java.lang.String getPixelUnit()
          Returns the pixel unit that getSize is in terms of.
 int getRightEdge()
          Returns the x-coordinate of the right side of the column (relative to the top-left corner of the table) when displayed is true; it is undefined when displayed is false.
protected  CellVector getThisCellVector()
          Returns the CellVector instance to delegate all variable access to.
protected  Column getThisColumn()
          Returns the Column instance to delegate all variable access to.
 int getWidth()
          Alias for "getSize()".
 boolean isHeld()
          Indicates whether the column is "held".
 boolean isSelected()
          Returns whether or not the column is selected in the table.
 boolean isTransient()
          Indicates whether the column is transient.
 Column nextColumn()
          Returns the next column 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 Column that follows this.
protected  CellVector onPrevious()
          Framework method called by previous for determining the Column that precedes this.
protected  void onResized()
          Framework method called by setSize to notify subclasses of a change in size.
 Column previousColumn()
          Returns the previous column if any, otherwise null.
 void refresh(int flags)
          Refreshes the column's cells to their state as maintained by the table view's model.
 void repaint()
          Repaints the column.
 void setObsolete()
          Indicates that the column 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

Column

public Column(TableView table,
              int index)
Constructor.

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

contains

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

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 column, 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 column.
See Also:
StaticTableInterface.countRows(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 Column and equals((Column)obj) returns true; false otherwise.

equals

public boolean equals(Column other)
Compares this and a given column for equality.

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

getCell

public DataCell getCell(int rowIndex)
Returns the cell at a given row index.

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

getDefaultStyle

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

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

getIndex

public int getIndex()
Returns the column'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 column.

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

getMaxPosition

public int getMaxPosition()
Returns the right 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 column 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:
"px".

getRightEdge

public int getRightEdge()
Returns the x-coordinate of the right side of the column (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 rightEdge property in pixels.

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()

getThisColumn

protected final Column getThisColumn()
Returns the Column 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()

getWidth

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

Returns:
The column's width in pixels.

isHeld

public boolean isHeld()
Indicates whether the column is "held". A held column 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 column is held and false otherwise.
See Also:
TableView.getHeldColumns()

isSelected

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

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

isTransient

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

Augments super to treat columns with intransient labels as intransient.

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

nextColumn

public Column nextColumn()
Returns the next column if any, otherwise null.

Returns:
The Column 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 column in.
Returns:
The column's preferred size (width) in x-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 column.
Throws:
TableException - Propagated from call to model.
See Also:
TableElement.getModelStyle()

onNext

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

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

onPrevious

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

Specified by:
onPrevious in class CellVector
Returns:
The Column 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)

previousColumn

public Column previousColumn()
Returns the previous column if any, otherwise null.

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

refresh

public void refresh(int flags)
Refreshes the column'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 column. Nothing happens if displayed is false.


setObsolete

public void setObsolete()
Indicates that the column 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.