com.sas.table
Class LabelCell

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

public class LabelCell

Represents a label cell in a TableView.

See Also:
TableView, DataCell

Field Summary
static LabelCellTypeInterface COLUMN_LABEL
          Column label constant to pass as labelType parameter to constructor.
static LabelCellTypeInterface ORIGIN_LABEL
          Origin label constant to pass as labelType parameter to constructor.
static LabelCellTypeInterface ROW_LABEL
          Row label constant to pass as labelType parameter to constructor.
 
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
LabelCell(TableView table, LabelCellTypeInterface labelType, java.lang.Object child)
          Constructor.
 
Method Summary
 boolean equals(Cell obj)
          Compares this and a given cell for equality.
 boolean equals(LabelCell other)
          Compares this and a given label cell for equality.
 java.lang.Object getChild()
          Returns the child associated with this label, i-e. the thing being labeled.
 com.sas.collection.StaticPropertyBagInterface getDefaultStyle()
          Returns the table view's default label style.
 int getDisplayedHeight()
          Returns the vertical size of the area allotted to the label in the table's current display.
 int getDisplayedWidth()
          Returns the horizontal size of the area allotted to the label in the table's current display.
 int getHeight()
          Returns the vertical extent of the label.
 int getHorizontalPosition()
          Returns the x-coordinate of the top-left corner of the label (relative to the top-left corner of the table).
 LabelCellTypeInterface getLabelType()
          The type (e.g.
 com.sas.collection.StaticPropertyBagInterface getModelDefaultStyle()
          Returns the table view's model's default label style.
 java.lang.Class getObjectDataClass()
          Returns the class of the cell's data.
protected  Cell getThisCell()
          Returns the Cell instance to delegate all variable access to.
protected  LabelCell getThisLabelCell()
          Returns the LabelCell instance to delegate all variable access to.
 int getVerticalPosition()
          Returns the y-coordinate of the top-left corner of the label (relative to the top-left corner of the table).
 int getWidth()
          Returns the horizontal extent of the label.
 int hashCode()
          Returns a hash code value for the label.
 boolean isColumnLabel()
          Alias for "getLabelType() == COLUMN_LABEL".
 boolean isDisplayed()
          Returns true if the label 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 true.
 boolean isOriginLabel()
          Alias for "getLabelType() == ORIGIN_LABEL".
 boolean isRowLabel()
          Alias for "getLabelType() == ROW_LABEL".
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  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 label's view with data from the table's model.
protected  java.lang.String[] onGetTypes()
          Cell framework method for initializing the label's type(s) from the table's model.
protected  void onWriteObjectData()
          Cell framework method for writing the label's data to the table's model.
 void setObsolete()
          Indicates that the label 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, onGetFormattedData, onPaintBackground, onPaintBorder, onPaintForeground, 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
 

Field Detail

COLUMN_LABEL

public static final LabelCellTypeInterface COLUMN_LABEL
Column label constant to pass as labelType parameter to constructor.

See Also:
LabelCell(com.sas.table.TableView, com.sas.table.LabelCellTypeInterface, java.lang.Object)

ROW_LABEL

public static final LabelCellTypeInterface ROW_LABEL
Row label constant to pass as labelType parameter to constructor.

See Also:
LabelCell(com.sas.table.TableView, com.sas.table.LabelCellTypeInterface, java.lang.Object)

ORIGIN_LABEL

public static final LabelCellTypeInterface ORIGIN_LABEL
Origin label constant to pass as labelType parameter to constructor. The origin label is the label cell at the intersection of the column and row label areas (usually the upper-left corner of the table).

See Also:
LabelCell(com.sas.table.TableView, com.sas.table.LabelCellTypeInterface, java.lang.Object)
Constructor Detail

LabelCell

public LabelCell(TableView table,
                 LabelCellTypeInterface labelType,
                 java.lang.Object child)
Constructor.

Parameters:
table - The TableView instance that contains this label.
labelType - The type (e.g. COLUMN_LABEL, ROW_LABEL, ORIGIN_LABEL) of label to create.
child - The item being labeled. If labelType is COLUMN_LABEL, child should be a Column. If labelType is ROW_LABEL, child should be a Row. If labelType is ORIGIN_LABEL, child should be null.
See Also:
COLUMN_LABEL, ROW_LABEL, ORIGIN_LABEL
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 LabelCell and equals((LabelCell)obj) returns true; false otherwise.

equals

public boolean equals(LabelCell other)
Compares this and a given label cell for equality.

Returns:
true if this label cell has the same tableView and an equivalent child as other; false otherwise.

getChild

public final java.lang.Object getChild()
Returns the child associated with this label, i-e. the thing being labeled.

If getLabelType() is COLUMN_LABEL, child will be a Column. If getLabelType() is ROW_LABEL, child will be a Row. If getLabelType() is ORIGIN_LABEL, child will be null. User-defined or subclass-defined types will have different child class relationships; refer to documentation on those types for details.

Returns:
The value of the child property.
See Also:
getLabelType(), Column, Row

getDefaultStyle

public com.sas.collection.StaticPropertyBagInterface getDefaultStyle()
Returns the table view's default label 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 label 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 label 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 label.

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 label (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.

getObjectDataClass

public java.lang.Class getObjectDataClass()
Returns the class of the cell's data.

Specified by:
getObjectDataClass in class Cell
Returns:
The class of the cell's data.

getModelDefaultStyle

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

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

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

getThisLabelCell

protected LabelCell getThisLabelCell()
Returns the LabelCell 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()

getLabelType

public final LabelCellTypeInterface getLabelType()
The type (e.g. COLUMN_LABEL, ROW_LABEL, ORIGIN_LABEL) of the label. The label type is determined at construction.

Returns:
The value of the labelType property.
See Also:
LabelCell(com.sas.table.TableView, com.sas.table.LabelCellTypeInterface, java.lang.Object)

getVerticalPosition

public int getVerticalPosition()
Returns the y-coordinate of the top-left corner of the label (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 label.

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

hashCode

public int hashCode()
Returns a hash code value for the label.

Overrides:
hashCode in class java.lang.Object
Returns:
Delegates to getChild().hashCode() if the child isn't null; else to super.hashCode().
See Also:
equals(com.sas.table.Cell)

isColumnLabel

public final boolean isColumnLabel()
Alias for "getLabelType() == COLUMN_LABEL".


isDisplayed

public boolean isDisplayed()
Returns true if the label 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 true.

Specified by:
isLabel in class Cell
Returns:
True.

isOriginLabel

public final boolean isOriginLabel()
Alias for "getLabelType() == ORIGIN_LABEL".


isRowLabel

public final boolean isRowLabel()
Alias for "getLabelType() == ROW_LABEL".


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)

onGetObjectData

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

Specified by:
onGetObjectData in class Cell
Returns:
Model supplied data for label.
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 label.
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 label's type(s) from the table's model.

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

onWriteObjectData

protected void onWriteObjectData()
                          throws com.sas.table.TableException
Cell framework method for writing the label'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 label 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.