Package com.im.ijc.core.api.canvas
Interface CanvasCellHandler
-
public interface CanvasCellHandler
Canvas table cell handler - Java API. Supports custom drawing functionality - for example can draw molecule mass spectrum, custom charts, etc. Must be implemented as a NetbeansServiceProvider
to be found.Example implementation:
@ServiceProvider(service = CanvasCellHandler.class) public class ExampleCell implements CanvasCellHandler { @Override public void onPaintComponent(Graphics g, DefaultTableCellRenderer cell, Object value) { g.setColor(Color.blue); g.fillRect(0, 0, cell.getWidth() / 2, cell.getHeight() / 2); } }
- Since:
- 20.18.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.awt.Color
getBackground(java.lang.Object value)
Background color based on a cell value.default java.lang.String
getDefaultConfig()
When this cell renderer is chosen, default configuration is setup if notnull
.default java.lang.String
getToolTipText(java.lang.Object value)
Tooltip based on a cell value.default java.lang.Object
getValue(java.lang.Object value)
Temporary method used for printing table cell values.void
onPaintComponent(java.awt.Graphics g, javax.swing.table.DefaultTableCellRenderer cell, java.lang.Object value)
Called duringpaintComponent()
of a table cell.default void
setConfig(java.util.Map<java.lang.String,java.lang.Object> config)
Passes renderer configuration which was set in Column renderer customizer.default void
setField(com.im.df.api.ddl.DFField field)
Passes field bound to a table column.default void
setResultSet(com.im.df.api.dml.DFResultSet resultSet)
Passes current result set.default boolean
supportsMimeType(java.lang.String type)
Chooses this cell renderer if bound field has matching Mime type.default boolean
supportsType(java.lang.Class fieldClass)
Chooses this cell renderer if bound field has matching data type field class.
-
-
-
Method Detail
-
supportsType
default boolean supportsType(java.lang.Class fieldClass)
Chooses this cell renderer if bound field has matching data type field class.- Parameters:
fieldClass
- Field class - for example CustomData.class- Returns:
true
if this cell renderer supports given field class, otherwisefalse
-
supportsMimeType
default boolean supportsMimeType(java.lang.String type)
Chooses this cell renderer if bound field has matching Mime type.- Parameters:
type
- Mime type - for example text/mass-spectrum- Returns:
true
if this cell renderer supports given Mime type, otherwisefalse
-
getDefaultConfig
default java.lang.String getDefaultConfig()
When this cell renderer is chosen, default configuration is setup if notnull
.- Returns:
- default configuration as JSON string or
null
-
setConfig
default void setConfig(java.util.Map<java.lang.String,java.lang.Object> config)
Passes renderer configuration which was set in Column renderer customizer.- Parameters:
config
- key-value configuration
-
setField
default void setField(com.im.df.api.ddl.DFField field)
Passes field bound to a table column.- Parameters:
field
- bound field
-
setResultSet
default void setResultSet(com.im.df.api.dml.DFResultSet resultSet)
Passes current result set. Contains vertex state with information about ids, selected ids, sort, etc. Allows to get child ids and data.- Parameters:
resultSet
- current result set
-
getValue
default java.lang.Object getValue(java.lang.Object value)
Temporary method used for printing table cell values. Useful when data is stored in child entities. Will be removed in the future as soon as new type ofDFField
, which gets child entity data, is implemented. Calculated fields are not sufficient for all kind of cases and do not support Java handlers.- Parameters:
value
- rendered or printed value- Returns:
- new value containing additional information - e.g. child entity data
-
getToolTipText
default java.lang.String getToolTipText(java.lang.Object value)
Tooltip based on a cell value.- Parameters:
value
- cell value- Returns:
- tooltip text or
null
-
getBackground
default java.awt.Color getBackground(java.lang.Object value)
Background color based on a cell value.- Parameters:
value
- cell value- Returns:
- background color or
null
-
onPaintComponent
void onPaintComponent(java.awt.Graphics g, javax.swing.table.DefaultTableCellRenderer cell, java.lang.Object value)
Called duringpaintComponent()
of a table cell. Allows to implement custom drawing functionality.- Parameters:
g
- JavaGraphics
cell
- this cell component based on aJLabel
value
- cell value
-
-