com.sas.table
Class CellView

com.sas.table.CellView
All Implemented Interfaces:
com.sas.lang.ObjectDataInterface, CellViewInterface
Direct Known Subclasses:
TextCell

public abstract class CellView
implements CellViewInterface

Defines an abstract base class for implementations of CellViewInterface. Default behavior is provided where possible. A method stub is provided for methods that won't be supported by all subclasses, e.g. processKeyEvent. Methods that are required by subclasses are defined as abstract, e.g. paint. See CellViewInterface for more information about cell views.

See Also:
Cell, CellStyle, CellViewInterface, TableView, TextCell

Field Summary
protected  Cell cell
          Alias for "getCell()".
 
Fields inherited from interface com.sas.table.CellViewInterface
FORMATTED_DATA, RAW_DATA
 
Constructor Summary
CellView()
           
 
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 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.
 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 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.
 
Methods inherited from interface com.sas.table.CellViewInterface
getPreferredHeight, getPreferredWidth, paint
 

Field Detail

cell

protected Cell cell
Alias for "getCell()".

Constructor Detail

CellView

public CellView()
Method Detail

getCell

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

Specified by:
getCell in interface CellViewInterface
Returns:
The Cell passed to initialize.
See Also:
setCell(com.sas.table.Cell)

getFormattedData

public 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.

Specified by:
getFormattedData in interface CellViewInterface
Returns:
It doesn't. It throws IllegalStateException since the default preferredOutputType is RAW_DATA. Thus, subclasses that support formatted data should override this method.
See Also:
setFormattedData(java.lang.String)

getMinimumHeight

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

Specified by:
getMinimumHeight in interface CellViewInterface
Parameters:
g - The graphics context to measure the cell in.
Returns:
"getPreferredHeight (g, -1)".

getMinimumWidth

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

Specified by:
getMinimumWidth in interface CellViewInterface
Parameters:
g - The graphics context to measure the cell in.
Returns:
"getPreferredWidth (g, -1)".

getPreferredInputType

public 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.

Specified by:
getPreferredInputType in interface CellViewInterface
Returns:
RAW_DATA.

getPreferredOutputType

public 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.

Specified by:
getPreferredOutputType in interface CellViewInterface
Returns:
RAW_DATA.

isPartiallyDisplayed

public 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

Specified by:
isPartiallyDisplayed in interface CellViewInterface
Returns:
true if the cell's contents are displayed but clipped, and false otherwise.

onActiveStateChanged

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

Specified by:
onActiveStateChanged in interface CellViewInterface
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.

processFocusEvent

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

Specified by:
processFocusEvent in interface CellViewInterface
Parameters:
event - The focus event.

processKeyEvent

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

Specified by:
processKeyEvent in interface CellViewInterface
Parameters:
event - The key event.

processMouseEvent

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

Specified by:
processMouseEvent in interface CellViewInterface
Parameters:
event - The mouse event.

processMouseMotionEvent

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

Specified by:
processMouseMotionEvent in interface CellViewInterface
Parameters:
event - The mouse motion event.

setCell

public 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.

Specified by:
setCell in interface CellViewInterface
Parameters:
cell - Cell instance that owns this view.
See Also:
getCell()

setFormattedData

public 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. This implementation throws IllegalStateException since the default preferredInputType is RAW_DATA.

Specified by:
setFormattedData in interface CellViewInterface
Parameters:
data - The formatted data String.
See Also:
getFormattedData()



Copyright © 2009 SAS Institute Inc. All Rights Reserved.