DESY ACOP Beans Home

com.cosylab.gui.components.table.cells
Class TableCell

java.lang.Object
  extended by com.cosylab.gui.components.table.cells.TableCell
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
BooleanCell, DeviceCell, NumericCell, StringCell, StringSeqCell

public class TableCell
extends java.lang.Object
implements java.lang.Comparable

TableCell is most basic kind of table cells, which has own renderers and editors in com.cosylab.gui.components.table.renderers.

This cell may contain arbitrary set of characteristics. They hint renderers, how to display particular cell. Consult JavaDoc of particular cell to see which characteristics are supported and compatible with available renderers.

User of this cell migth decide to define values for following characteristics: TIMEOUT, ERROR, SUSPENDED, OUT_OF_BOUNDS.

Note that characteristic map is optimized for number of characteristics up to 10 because is implemented around linear array.

Note that all characteristics are optional. If they are null, renderers will try best to use value without them.

Version:
$id$
Author:
Igor Kriznar

Field Summary
static java.lang.String ALARM
          Characteristic name for alarm state, value must be Boolean.TRUE if data source is in alarm condition.
protected  Command[] commands
           
protected  java.lang.Object dataSource
           
static java.lang.String ERROR
          Characteristic name for error state, value must be Boolean.TRUE if data source is in error condition.
protected  java.lang.String identifier
           
static java.lang.String OUT_OF_BOUNDS
          Characteristic name for out of bouds value state, when cell value is out of designated value range, characteristic value must be Boolean.TRUE.
static java.lang.String SEVERITY
          Characteristic name for severity of alarm or error state.
static java.lang.String SUSPENDED
          Characteristic name for suspended state, value must be Boolean.TRUE if data source is in suspended condition (eg.
static java.lang.String TIMEOUT
          Characteristic name for timeout state, value must be Boolean.TRUE if data source in timeout.
protected  long timestamp
           
static java.lang.String TOOLTIP
          Characteristic name for tooltip.
protected  java.lang.Object value
           
static java.lang.String WARNING
          Characteristic name for warning state, value must be Boolean.TRUE if value is out of bounds or source is in warning condition.
 
Constructor Summary
protected TableCell()
          Creates new noninitialized instance of cell proxy.
  TableCell(java.lang.String identifier, java.lang.Object dataSource, java.lang.Object value, Command[] commands)
          Creates a new TableCell object.
 
Method Summary
 void addSupportedCharacteristic(java.lang.String name)
          DOCUMENT ME!
 int compareTo(java.lang.Object o)
           
 java.lang.Object getCharacteristic(java.lang.String name)
          Return scharacteristic value with specific name.
 java.lang.Object getCharacteristic(java.lang.String name, java.lang.Object defaultValue)
          Return scharacteristic value with specific name.
 java.util.Map<java.lang.String,java.lang.Object> getCharacteristics()
          Return map with all characteristics.
 Command[] getCommands()
          Returns commands, which can be executed on this cell.
 java.lang.Object getDataSource()
          Object which deliveres values for this cell.
 java.lang.String getIdentifier()
          Generally expected to be unique string within context of current table.
 java.lang.String[] getSupportedCharacteristics()
          DOCUMENT ME!
 long getTimestamp()
          Returns time of latest change of value.
 java.lang.String getTooltip()
          Return tooltip value or null if none is set.
 java.lang.Object getValue()
          Return tooltip value or null if none is set.
 boolean isAlarm()
          Returns true if ALARM characteristic is true.
 boolean isError()
          Returns true if ERROR characteristic is true.
 boolean isOutOfBounds()
          Returns true if OUT_OF_BOUNDS characteristic is true.
 boolean isSuspended()
          Returns true if SUSPENDED characteristic is true.
 boolean isTimeout()
          Returns true if TIMEOUT characteristic is true.
 boolean isWarning()
          Returns true if WARNING characteristic is true.
 void putAllCharacteristics(java.util.Map<java.lang.String,java.lang.Object> characteristics)
          Puts all characteristics to this cell.
 java.lang.Object putCharacteristic(java.lang.String name, java.lang.Object value)
          Puts new characteristic value with provided name.
 void removeSupportedCharacteristic(java.lang.String name)
          DOCUMENT ME!
 void setTimestamp(long timestamp)
          Sets time of latest change of value.
 void setValue(java.lang.Object newValue)
          Sets new value to this cell.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TOOLTIP

public static final java.lang.String TOOLTIP
Characteristic name for tooltip.

See Also:
Constant Field Values

OUT_OF_BOUNDS

public static final java.lang.String OUT_OF_BOUNDS
Characteristic name for out of bouds value state, when cell value is out of designated value range, characteristic value must be Boolean.TRUE.

See Also:
Constant Field Values

TIMEOUT

public static final java.lang.String TIMEOUT
Characteristic name for timeout state, value must be Boolean.TRUE if data source in timeout.

See Also:
Constant Field Values

ERROR

public static final java.lang.String ERROR
Characteristic name for error state, value must be Boolean.TRUE if data source is in error condition.

See Also:
Constant Field Values

ALARM

public static final java.lang.String ALARM
Characteristic name for alarm state, value must be Boolean.TRUE if data source is in alarm condition.

See Also:
Constant Field Values

WARNING

public static final java.lang.String WARNING
Characteristic name for warning state, value must be Boolean.TRUE if value is out of bounds or source is in warning condition.

See Also:
Constant Field Values

SEVERITY

public static final java.lang.String SEVERITY
Characteristic name for severity of alarm or error state.

See Also:
Constant Field Values

SUSPENDED

public static final java.lang.String SUSPENDED
Characteristic name for suspended state, value must be Boolean.TRUE if data source is in suspended condition (eg. not initialized).

See Also:
Constant Field Values

value

protected java.lang.Object value

dataSource

protected java.lang.Object dataSource

commands

protected Command[] commands

identifier

protected java.lang.String identifier

timestamp

protected long timestamp
Constructor Detail

TableCell

protected TableCell()
Creates new noninitialized instance of cell proxy.


TableCell

public TableCell(java.lang.String identifier,
                 java.lang.Object dataSource,
                 java.lang.Object value,
                 Command[] commands)
Creates a new TableCell object.

Parameters:
identifier - unique string within context of current table
dataSource - object which provides values for this cell
value - a cells value
commands - commands, which can be executed on this cell
Method Detail

getCommands

public Command[] getCommands()
Returns commands, which can be executed on this cell.

Returns:
commands, which can be executed on this cell

getDataSource

public java.lang.Object getDataSource()
Object which deliveres values for this cell.

Returns:
objects which deliveres values to this cell

getIdentifier

public java.lang.String getIdentifier()
Generally expected to be unique string within context of current table.

Returns:
unique string within context of current table

getTooltip

public java.lang.String getTooltip()
Return tooltip value or null if none is set.

Returns:
tooltip

getValue

public java.lang.Object getValue()
Return tooltip value or null if none is set.

Returns:
tooltip

setValue

public void setValue(java.lang.Object newValue)
Sets new value to this cell.

Parameters:
newValue -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getCharacteristic

public java.lang.Object getCharacteristic(java.lang.String name)
Return scharacteristic value with specific name.

Parameters:
name - a name of requested characteristic
Returns:
characteristic value, or null if not defined

getCharacteristic

public java.lang.Object getCharacteristic(java.lang.String name,
                                          java.lang.Object defaultValue)
Return scharacteristic value with specific name.

Parameters:
name - a name of requested characteristic
defaultValue - DOCUMENT ME!
Returns:
characteristic value, or null if not defined

putCharacteristic

public java.lang.Object putCharacteristic(java.lang.String name,
                                          java.lang.Object value)
Puts new characteristic value with provided name.

Parameters:
name - characteristic name
value - new characteristic value
Returns:
old characteristic value, or null if none

putAllCharacteristics

public void putAllCharacteristics(java.util.Map<java.lang.String,java.lang.Object> characteristics)
Puts all characteristics to this cell.

Parameters:
characteristics - Map with characteristics

getCharacteristics

public java.util.Map<java.lang.String,java.lang.Object> getCharacteristics()
Return map with all characteristics.

Returns:
map with all characteristics

getTimestamp

public long getTimestamp()
Returns time of latest change of value.

Returns:
time of latest change of value

setTimestamp

public void setTimestamp(long timestamp)
Sets time of latest change of value.

Parameters:
timestamp - time of latest change

isError

public boolean isError()
Returns true if ERROR characteristic is true.

Returns:
true if ERROR characteristic is true

isAlarm

public boolean isAlarm()
Returns true if ALARM characteristic is true.

Returns:
true if ALARM characteristic is true

isWarning

public boolean isWarning()
Returns true if WARNING characteristic is true.

Returns:
true if WARNING characteristic is true

isTimeout

public boolean isTimeout()
Returns true if TIMEOUT characteristic is true.

Returns:
true if TIMEOUT characteristic is true

isSuspended

public boolean isSuspended()
Returns true if SUSPENDED characteristic is true.

Returns:
true if SUSPENDED characteristic is true

isOutOfBounds

public boolean isOutOfBounds()
Returns true if OUT_OF_BOUNDS characteristic is true.

Returns:
true if OUT_OF_BOUNDS characteristic is true

getSupportedCharacteristics

public java.lang.String[] getSupportedCharacteristics()
DOCUMENT ME!

Returns:
DOCUMENT ME!

addSupportedCharacteristic

public void addSupportedCharacteristic(java.lang.String name)
DOCUMENT ME!

Parameters:
name - DOCUMENT ME!

removeSupportedCharacteristic

public void removeSupportedCharacteristic(java.lang.String name)
DOCUMENT ME!

Parameters:
name - DOCUMENT ME!

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable


Copyright © 2010. All Rights Reserved.