com.sas.table
Class DataCell

com.sas.table.DataCell
All Implemented Interfaces:
TableElementInterface

public class DataCell

Represents a data cell in a TableView.

See Also:
TableView, LabelCell

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
DataCell(TableView table, Row row, Column column)
          Constructor.
 
Method Summary
 boolean equals(Cell obj)
          Compares this and a given cell for equality.
 boolean equals(DataCell other)
          Compares this and a given data cell for equality.
 Column getColumn()
          Returns the column that contains this cell.
 com.sas.collection.StaticPropertyBagInterface getDefaultStyle()
          Returns the table view's default cell style.
 int getDisplayedHeight()
          Returns the vertical size of the area allotted to the cell in the table's current display.
 int getDisplayedWidth()
          Returns the horizontal size of the area allotted to the cell in the table's current display.
 int getHeight()
          Returns the vertical extent of the cell.
 int getHorizontalPosition()
          Returns the x-coordinate of the top-left corner of the cell (relative to the top-left corner of the table).
 com.sas.collection.StaticPropertyBagInterface getModelDefaultStyle()
          Returns the table view's model's default cell style.
 java.lang.Class getObjectDataClass()
          Returns the class of the cell's data.
 Row getRow()
          Returns the row that contains this cell.
protected  Cell getThisCell()
          Returns the Cell instance to delegate all variable access to.
protected  DataCell getThisDataCell()
          Returns the DataCell instance to delegate all variable access to.
 int getVerticalPosition()
          Returns the y-coordinate of the top-left corner of the cell (relative to the top-left corner of the table).
 int getWidth()
          Returns the horizontal extent of the cell.
 boolean isDisplayed()
          Returns true if the cell is shown in the table's current view, and false otherwise, i.e. if the table has to be scrolled to see it.
 boolean isLabel()
          Override of Cell.isLabel() to return false.
protected  void onGetEffectiveStylePropertyBag(java.lang.String propertyID, com.sas.collection.PropertyBagInterface bag)
          TableElement framework method for determining the effective value of a style property of type StaticPropertyBagInterface.
protected  java.lang.Object onGetEffectiveStylePropertyValue(java.lang.String propertyID, java.lang.Object defaultValue)
          TableElement framework method for determining the effective value of a style property.
protected  java.lang.String onGetFormattedData()
          Cell framework method for seeding the cell's view with formatted data from the table's model.
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  java.lang.Object onGetObjectData()
          Cell framework method for seeding the cell's view with data from the table's model.
protected  java.lang.String[] onGetTypes()
          Cell framework method for initializing the cell's type(s) from the table's model.
protected  void onPaintForeground(java.awt.Graphics g, int width, int height)
          Cell.paint framework method for painting the cell's foreground.
protected  void onWriteObjectData()
          Cell framework method for writing the cell's data to the table's model.
 void setObsolete()
          Indicates that the data cell should be considered obsolete.
 
Methods inherited from class com.sas.table.Cell
equals, getActiveState, getBounds, getDisplayedBounds, getEffectiveFont, getEffectiveStylePropertyBag, getEffectiveStylePropertyValue, getGraphics, getInsets, getMinimumHeight, getMinimumWidth, getModelTypes, getModelTypeStyles, getObjectData, getPreferredHeight, getPreferredHeight, getPreferredWidth, getPreferredWidth, getThis, getView, isActivated, isDataInvalid, isKeyHandled, isModified, isMouseCaptured, isSelected, onPaintBackground, onPaintBorder, paint, processFocusEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, refresh, repaint, repaint, setActiveState, setActiveState, setKeyHandled, setModified, setMouseCaptured, writeObjectData
 
Methods inherited from class com.sas.table.TableElement
equals, getModelStyle, getStyle, getTableView, isCurrent, isTransient, setStyle
 

Constructor Detail

DataCell

public DataCell(TableView table,
                Row row,
                Column column)
Constructor.

Parameters:
table - The TableView instance that contains this cell.
row - The row that contains this cell.
column - The column that contains this cell.
Method Detail

equals

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

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

equals

public boolean equals(DataCell other)
Compares this and a given data cell for equality.

Returns:
true if this data cell has the same tableView and an equivalent column and row as other; false otherwise.

getColumn

public final Column getColumn()
Returns the column that contains this cell.

Returns:
The value of the column property (will never be null).

getDefaultStyle

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

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

getDisplayedHeight

public int getDisplayedHeight()
Returns the vertical size of the area allotted to the cell in the table's current display. displayedHeight is always less than or equal to height.

Specified by:
getDisplayedHeight in class Cell
Returns:
The value of the displayedHeight property in pixels.
See Also:
getHeight()

getDisplayedWidth

public int getDisplayedWidth()
Returns the horizontal size of the area allotted to the cell in the table's current display. displayedWidth is always less than or equal to width.

Specified by:
getDisplayedWidth in class Cell
Returns:
The value of the displayedWidth property in pixels.
See Also:
getWidth()

getHeight

public int getHeight()
Returns the vertical extent of the cell.

Specified by:
getHeight in class Cell
Returns:
The value of the height property in pixels.
See Also:
Cell.getDisplayedHeight()

getHorizontalPosition

public int getHorizontalPosition()
Returns the x-coordinate of the top-left corner of the cell (relative to the top-left corner of the table). Note, it is undefined when displayed is false.

Specified by:
getHorizontalPosition in class Cell
Returns:
The value of the horizontalPosition property in pixels.

getModelDefaultStyle

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

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

getObjectDataClass

public java.lang.Class getObjectDataClass()
                                   throws com.sas.table.TableException
Returns the class of the cell's data.

Specified by:
getObjectDataClass in class Cell
Returns:
The class of the cell's data.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).

getRow

public final Row getRow()
Returns the row that contains this cell.

Returns:
The value of the row property (will never be null).

getThisCell

protected final Cell getThisCell()
Returns the Cell 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:
getThisCell in class Cell
Returns:
The proxy for accessing our variables.
See Also:
setObsolete()

getThisDataCell

protected final DataCell getThisDataCell()
Returns the DataCell 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()

getVerticalPosition

public int getVerticalPosition()
Returns the y-coordinate of the top-left corner of the cell (relative to the top-left corner of the table). Note, it is undefined when displayed is false.

Specified by:
getVerticalPosition in class Cell
Returns:
The value of the verticalPosition property in pixels.

getWidth

public int getWidth()
Returns the horizontal extent of the cell.

Specified by:
getWidth in class Cell
Returns:
The value of the width property in pixels.
See Also:
Cell.getDisplayedWidth()

isDisplayed

public boolean isDisplayed()
Returns true if the cell is shown in the table's current view, and false otherwise, i.e. if the table has to be scrolled to see it.

Returns:
The value of the displayed property.

isLabel

public final boolean isLabel()
Override of Cell.isLabel() to return false.

Specified by:
isLabel in class Cell
Returns:
The value of the label property.

onGetEffectiveStylePropertyBag

protected void onGetEffectiveStylePropertyBag(java.lang.String propertyID,
                                              com.sas.collection.PropertyBagInterface bag)
TableElement framework method for determining the effective value of a style property of type StaticPropertyBagInterface. Overrides should always call super (usually last).

Overrides:
onGetEffectiveStylePropertyBag in class TableElement
Parameters:
propertyID - An interned String (see String.intern()) which identifies a property of type PropertyBagInterface, for example, CellStyle.FONT_STYLE.
bag - The bag to fill with the effective values of the subproperties associated with propertyID.
See Also:
TableElement.getEffectiveStylePropertyBag(java.lang.String, com.sas.collection.PropertyBagInterface, boolean)

onGetEffectiveStylePropertyValue

protected java.lang.Object onGetEffectiveStylePropertyValue(java.lang.String propertyID,
                                                            java.lang.Object defaultValue)
TableElement framework method for determining the effective value of a style property. Overrides should call super if and only if value not found at their level.

Overrides:
onGetEffectiveStylePropertyValue in class TableElement
Parameters:
propertyID - An interned String (see String.intern()) which identifies the property, for example, CellStyle.FOREGROUND_COLOR.
defaultValue - Value to return if no value is found for the property.
Returns:
The effective property value.
See Also:
TableElement.getEffectiveStylePropertyValue(java.lang.String, java.lang.Object)

onGetFormattedData

protected java.lang.String onGetFormattedData()
                                       throws com.sas.table.TableException
Cell framework method for seeding the cell's view with formatted data from the table's model.

Overrides:
onGetFormattedData in class Cell
Returns:
Model supplied formatted data for cell.
Throws:
TableException - Propagated from call to model.

onGetObjectData

protected java.lang.Object onGetObjectData()
                                    throws com.sas.table.TableException
Cell framework method for seeding the cell's view with data from the table's model.

Specified by:
onGetObjectData in class Cell
Returns:
Model supplied data for cell.
Throws:
TableException - Propagated from call to model.

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 cell.
Throws:
TableException - Propagated from call to model.
See Also:
TableElement.getModelStyle()

onGetTypes

protected java.lang.String[] onGetTypes()
                                 throws com.sas.table.TableException
Cell framework method for initializing the cell's type(s) from the table's model.

Specified by:
onGetTypes in class Cell
Returns:
Model supplied types for cell.
Throws:
TableException - Propagated from call to model.

onPaintForeground

protected void onPaintForeground(java.awt.Graphics g,
                                 int width,
                                 int height)
                          throws com.sas.table.TableException
Cell.paint framework method for painting the cell's foreground.

Overrides:
onPaintForeground in class Cell
Parameters:
g - The graphics context to use for painting. Painting should be done relative to (0, 0).
width - The paintable width of the graphics context.
height - The paintable height of the graphics context.
Throws:
TableException - Can arrise from a call to getView.

onWriteObjectData

protected void onWriteObjectData()
                          throws com.sas.table.TableException
Cell framework method for writing the cell's data to the table's model.

Specified by:
onWriteObjectData in class Cell
Throws:
TableException - Propagated from call to model.

setObsolete

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

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



Copyright © 2009 SAS Institute Inc. All Rights Reserved.