com.sas.table
Interface CellViewInterface

All Superinterfaces:
com.sas.lang.ObjectDataInterface
All Known Implementing Classes:
CellView, CheckBoxCell, TextCell, TransformTextCell

public interface CellViewInterface
extends com.sas.lang.ObjectDataInterface

Defines the required interface for TableView cell views.

Cell views are the views used to format, display, and edit the data associated with TableView cells. Different data types require different viewers. For example, a different view is needed to display image data than to display string data.

Cell views must provide a default (no argument) constructor so that they can be instantiated via Class.newInstance.

See Also:
Cell.getView(), CellStyle.VIEW_CLASS, CellView, TableView, TextCell

Field Summary
static int FORMATTED_DATA
          Formatted data constant; potential return value from getPreferredInputType and getPreferredOutputType.
static int RAW_DATA
          Raw data constant; potential return value from getPreferredInputType and getPreferredOutputType.
 
Method Summary
 Cell getCell()
          Returns the Cell this view is associated with.
 java.lang.String getFormattedData()
          Returns the cell view's data as a formatted string.
 int getMinimumHeight(java.awt.Graphics g)
          Returns the minimum amount of vertical space needed to display the cell in the given graphics context.
 int getMinimumWidth(java.awt.Graphics g)
          Returns the minimum amount of horizontal space needed to display the cell in the given graphics context.
 int getPreferredHeight(java.awt.Graphics g, int widthConstraint)
          Returns the preferred amount of vertical space needed to display the cell in the given graphics context.
 int getPreferredInputType()
          Returns the preferred input type, RAW_DATA or FORMATTED_DATA, of the cell view's data.
 int getPreferredOutputType()
          Returns the preferred output type, RAW_DATA or FORMATTED_DATA, of the cell view's data.
 int getPreferredWidth(java.awt.Graphics g, int heightConstraint)
          Returns the preferred amount of horizontal space needed to display the cell in the given graphics context.
 boolean isPartiallyDisplayed()
          Indicates whether the cell's contents are currently displayed by the table view, but also clipped.
 void onActiveStateChanged(int oldValue, int newValue, java.awt.Point point)
          Notifies the view of a change to Cell.activeState.
 void paint(java.awt.Graphics g)
          Paints the cell view.
 void processFocusEvent(java.awt.event.FocusEvent event)
          Processes focus events.
 void processKeyEvent(java.awt.event.KeyEvent event)
          Processes key events.
 void processMouseEvent(java.awt.event.MouseEvent event)
          Processes mouse events.
 void processMouseMotionEvent(java.awt.event.MouseEvent event)
          Processes mouse motion events.
 void setCell(Cell cell)
          Informs the view of the cell that owns it.
 void setFormattedData(java.lang.String data)
          Sets the cell view's data from a formatted string.
 

Field Detail

RAW_DATA

static final int RAW_DATA
Raw data constant; potential return value from getPreferredInputType and getPreferredOutputType.

See Also:
Constant Field Values

FORMATTED_DATA

static final int FORMATTED_DATA
Formatted data constant; potential return value from getPreferredInputType and getPreferredOutputType.

See Also:
Constant Field Values
Method Detail

getCell

Cell getCell()
Returns the Cell this view is associated with.

Returns:
The Cell passed to initialize.
See Also:
setCell(com.sas.table.Cell)

getFormattedData

java.lang.String getFormattedData()
Returns the cell view's data as a formatted string. Should be called instead of getObjectData when the preferred output type is FORMATTED_DATA.

Returns:
The formatted data String.
See Also:
setFormattedData(java.lang.String)

getMinimumHeight

int getMinimumHeight(java.awt.Graphics g)
Returns the minimum amount of vertical space needed to display the cell in the given graphics context.

Parameters:
g - The graphics context to measure the cell in.
Returns:
The cell's minimum height in pixels.

getMinimumWidth

int getMinimumWidth(java.awt.Graphics g)
Returns the minimum amount of horizontal space needed to display the cell in the given graphics context.

Parameters:
g - The graphics context to measure the cell in.
Returns:
The cell's minimum width in pixels.

getPreferredHeight

int getPreferredHeight(java.awt.Graphics g,
                       int widthConstraint)
Returns the preferred amount of vertical space needed to display the cell in the given graphics context. The width parameter allows the question "assuming this much horizontal space, how tall would the cell be" to be answered.

Parameters:
g - The graphics context to measure the cell in.
widthConstraint - The width (in pixels) to constrain by. Specify -1 to not constrain.
Returns:
The cell's preferred height in pixels.

getPreferredInputType

int getPreferredInputType()
Returns the preferred input type, RAW_DATA or FORMATTED_DATA, of the cell view's data. If RAW_DATA is returned, then setObjectData should be used to specify the cell view's data, otherwise use setFormattedData.

Returns:
RAW_DATA or FORMATTED_DATA.

getPreferredOutputType

int getPreferredOutputType()
Returns the preferred output type, RAW_DATA or FORMATTED_DATA, of the cell view's data. If RAW_DATA is returned, then getObjectData should be used to query the cell view's data, otherwise use getFormattedData.

Returns:
RAW_DATA or FORMATTED_DATA.

getPreferredWidth

int getPreferredWidth(java.awt.Graphics g,
                      int heightConstraint)
Returns the preferred amount of horizontal space needed to display the cell in the given graphics context. The height parameter allows the question "assuming this much vertical space, how wide would the cell be" to be answered.

Parameters:
g - The graphics context to measure the cell in.
heightConstraint - The height (in pixels) to constrain by. Specify -1 to not constrain.
Returns:
The cell's preferred width in pixels.

isPartiallyDisplayed

boolean isPartiallyDisplayed()
Indicates whether the cell's contents are currently displayed by the table view, but also clipped. In other words, the cell is scrolled into view but its contents are clipped within its current bounds

Returns:
true if the cell's contents are displayed but clipped, and false otherwise.

onActiveStateChanged

void onActiveStateChanged(int oldValue,
                          int newValue,
                          java.awt.Point point)
Notifies the view of a change to Cell.activeState.

Parameters:
oldValue - The previous value of Cell.activeState.
newValue - The new value of Cell.activeState.
point - Optional xy-coordinate (relative to the view's origin) where the activation was initiated. Could be used to position a text cursor, for example.

paint

void paint(java.awt.Graphics g)
Paints the cell view. Implementation should utilize the Cell instance passed to initialize to determine formatting properties like color, font, and justification.

Parameters:
g - The graphics context to use for painting.

processFocusEvent

void processFocusEvent(java.awt.event.FocusEvent event)
Processes focus events.

Parameters:
event - The focus event.

processKeyEvent

void processKeyEvent(java.awt.event.KeyEvent event)
Processes key events.

Parameters:
event - The key event.

processMouseEvent

void processMouseEvent(java.awt.event.MouseEvent event)
Processes mouse events.

Parameters:
event - The mouse event.

processMouseMotionEvent

void processMouseMotionEvent(java.awt.event.MouseEvent event)
Processes mouse motion events.

Parameters:
event - The mouse motion event.

setCell

void setCell(Cell cell)
Informs the view of the cell that owns it. The view can use cell as a source of services such as what formatting properties to use (font, color, justification, margins, etc.). Normally setCell is called once immediately after the view is constructed.

Parameters:
cell - Cell instance that owns this view.
See Also:
getCell()

setFormattedData

void setFormattedData(java.lang.String data)
Sets the cell view's data from a formatted string. Should be called instead of setObjectData when the preferred input type is FORMATTED_DATA.

Parameters:
data - The formatted data String.
See Also:
getFormattedData()



Copyright © 2009 SAS Institute Inc. All Rights Reserved.