|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DataValueRenderer
General interface for classes that are able to render special derivatives of
DataValue
.
This interface extends TableCellRenderer
and
ListCellRenderer
. Thus, it can be easily used in lists and
tables. The preferred way of instantiating an object of a renderer is to use
a DataValueRendererFamily
.
DataValue
,
DataValueRendererFamily
Field Summary | |
---|---|
static String |
PROPERTY_PREFERRED_RENDERER
The property identifier that is read from, for instance the table view to determine which particular renderer (from the set of available renderers to a column) is to be used. |
Method Summary | |
---|---|
boolean |
accepts(DataColumnSpec spec)
Is this renderer instance able to render the content of the column given by spec . |
String |
getDescription()
Get a description for this renderer implementation. |
Dimension |
getPreferredSize()
Get the dimension which the renderer component will preferably occupy. |
Component |
getRendererComponent(Object val)
Get a component that visualizes a given object. |
Methods inherited from interface javax.swing.table.TableCellRenderer |
---|
getTableCellRendererComponent |
Methods inherited from interface javax.swing.ListCellRenderer |
---|
getListCellRendererComponent |
Field Detail |
---|
static final String PROPERTY_PREFERRED_RENDERER
DataColumnSpec's
domain information
and should map to the description string of the
renderer. A sample code that sets this property on a newly created
double column to use the bar renderer is as follows:
DataColumnSpecCreator creator = new DataColumnSpecCreator( newName, DoubleCell.TYPE); creator.setProperties(new DataColumnProperties( Collections.singletonMap( DataValueRenderer.PROPERTY_PREFERRED_RENDERER, DoubleBarRenderer.DESCRIPTION))); creator.setDomain(new DataColumnDomainCreator( new DoubleCell(0.0), new DoubleCell(1.0)).createDomain()); DataColumnSpec spec = creator.createSpec();
Keep in mind that setting the preferred renderer to an instance
that inherently depends on proper domain information to be available
(for instance [0,1]) requires the spec's DataColumnDomain
to be set appropriately.
Method Detail |
---|
String getDescription()
Dimension getPreferredSize()
Component getRendererComponent(Object val)
DataCell
implementing the underlying
DataValue
interface. The implementation, however, needs to
handle other cases as well, such as null
arguments,
missing DataCell
or generic objects.
val
- The value to render
val
.boolean accepts(DataColumnSpec spec)
spec
. Most implementations will return
true
here but some may require some properties to be
set, for instance a molecule renderer needs to have 2D coordinates
in the column.
Note: This method is not used to test whether arbitrary types can be renderer by this renderer instance but rather if the specific runtime column spec (containing the type) is appropriate, for instance contains domain information or certain properties are set.
spec
- The column spec to check.
true
if this renderer can be chosen to render
the content of the column.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |