|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.core.data.renderer.DefaultDataValueRendererFamily
public class DefaultDataValueRendererFamily
Default container for DataValueRenderer
. This implementation
only has one renderer type, i.e. DefaultDataValueRenderer
.
If you intend to derive this class, you should consider to override the
methods getNrAvailableRenderer
,
getRendererDescription
, and getRenderer
.
DefaultDataValueRenderer
Field Summary |
---|
Fields inherited from interface org.knime.core.data.renderer.DataValueRenderer |
---|
PROPERTY_PREFERRED_RENDERER |
Constructor Summary | |
---|---|
DefaultDataValueRendererFamily()
Constructor that uses a single default renderer with a default description, i.e. |
|
DefaultDataValueRendererFamily(DataValueRenderer... renderers)
Constructs a renderer family given a set of renders and their description. |
Method Summary | |
---|---|
boolean |
accepts(DataColumnSpec spec)
Is this renderer instance able to render the content of the column given by spec . |
boolean |
accepts(String desc,
DataColumnSpec spec)
Delegates to renderer. |
static DataValueRendererFamily |
findRendererFamily(Class<?> cellClass)
Helper method to get the renderer family for a particular DataCell class. |
String |
getDescription()
Get a description for this renderer implementation. |
Component |
getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
Render this object in the list using the current renderer. |
Dimension |
getPreferredSize()
Get the dimension which the renderer component will preferably occupy. |
Component |
getRendererComponent(Object val)
Get a component that visualizes a given object. |
String[] |
getRendererDescriptions()
Get a "unique" description for all renderer that are available in this family. |
Component |
getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
Render this object in a table using the current renderer. |
void |
setActiveRenderer(String description)
Set the currently active renderer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultDataValueRendererFamily()
DefaultDataValueRenderer
,
description: "Default Renderer"
public DefaultDataValueRendererFamily(DataValueRenderer... renderers)
renderers
- Set of all available renderer.
NullPointerException
- If the argument is null
or
any entry is null
.
IllegalArgumentException
- If the array is empty.Method Detail |
---|
public static final DataValueRendererFamily findRendererFamily(Class<?> cellClass)
DataCell
class. This method uses java reflection to invoke
the static getNewRenderer
method in the appropriate
DataCell
.
If this fail, an error message is printed to standard error output and a
new DefaultDataValueRendererFamily
is returned.
cellClass
- The class of the DataCell
of interest.
getNewRenderer
method. If this method is not defined the super class of the cell
is used (at latest DataCell
itself should have an
renderer)
IllegalArgumentException
- If the argument is not a subclass of
DataCell
NullPointerException
- If the argument is null
.public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
getListCellRendererComponent
in interface ListCellRenderer
ListCellRenderer.getListCellRendererComponent(
javax.swing.JList, java.lang.Object, int, boolean, boolean)
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
getTableCellRendererComponent
in interface TableCellRenderer
TableCellRenderer.getTableCellRendererComponent(
javax.swing.JTable, java.lang.Object, boolean, boolean, int, int)
public Dimension getPreferredSize()
getPreferredSize
in interface DataValueRenderer
public String[] getRendererDescriptions()
getRendererDescriptions
in interface DataValueRendererFamily
public void setActiveRenderer(String description)
getRendererDescription()
. If it
is not this method won't do anything.
setActiveRenderer
in interface DataValueRendererFamily
description
- The ID of the renderer to be used.public String getDescription()
getDescription
in interface DataValueRenderer
public 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.
getRendererComponent
in interface DataValueRenderer
val
- The value to render
val
.public boolean accepts(String desc, DataColumnSpec spec)
accepts
in interface DataValueRendererFamily
desc
- The description of the renderer.spec
- The column spec to check.
DataValueRendererFamily.accepts(String, DataColumnSpec)
public 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.
accepts
in interface DataValueRenderer
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 |