Package org.apache.pivot.wtk.content
Class TableViewMultiCellRenderer
- java.lang.Object
-
- org.apache.pivot.wtk.content.TableViewMultiCellRenderer
-
- All Implemented Interfaces:
ConstrainedVisual
,Renderer
,TableView.CellRenderer
,Visual
public class TableViewMultiCellRenderer extends java.lang.Object implements TableView.CellRenderer
Table cell renderer that supports dynamic rendering based on the type of content being rendered.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TableViewMultiCellRenderer.RendererMapping
Maps the type of value being rendered (the value class) to a specific cell renderer.
-
Constructor Summary
Constructors Constructor Description TableViewMultiCellRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBaseline()
Returns the visual's baseline.int
getBaseline(int widthArgument, int heightArgument)
Returns the baseline for a given width and height.TableView.CellRenderer
getDefaultRenderer()
int
getHeight()
Returns the visual's height.int
getPreferredHeight(int widthArgument)
Returns the visual's preferred height given the provided width constraint.Dimensions
getPreferredSize()
Returns the visual's unconstrained preferred size.int
getPreferredWidth(int heightArgument)
Returns the visual's preferred width given the provided height constraint.Sequence<TableViewMultiCellRenderer.RendererMapping>
getRendererMappings()
Dictionary<java.lang.String,java.lang.Object>
getStyles()
int
getWidth()
Returns the visual's width.void
paint(java.awt.Graphics2D graphics)
Paints the visual.void
render(java.lang.Object row, int rowIndex, int columnIndex, TableView tableView, java.lang.String columnName, boolean selected, boolean highlighted, boolean disabled)
Prepares the renderer for layout or paint.void
setDefaultRenderer(TableView.CellRenderer defaultRenderer)
void
setSize(int width, int height)
Sets the visual's render size.java.lang.String
toString(java.lang.Object row, java.lang.String columnName)
Converts table view cell data to a string representation.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pivot.wtk.ConstrainedVisual
setSize
-
-
-
-
Method Detail
-
getWidth
public int getWidth()
Description copied from interface:Visual
Returns the visual's width.
-
getHeight
public int getHeight()
Description copied from interface:Visual
Returns the visual's height.
-
getBaseline
public int getBaseline()
Description copied from interface:Visual
Returns the visual's baseline.- Specified by:
getBaseline
in interfaceVisual
- Returns:
- The baseline relative to the origin of the visual, or
-1
if this visual does not have a baseline.
-
paint
public void paint(java.awt.Graphics2D graphics)
Description copied from interface:Visual
Paints the visual.
-
setSize
public void setSize(int width, int height)
Description copied from interface:ConstrainedVisual
Sets the visual's render size.- Specified by:
setSize
in interfaceConstrainedVisual
- Parameters:
width
- The visual's new width.height
- The visual's new height.
-
getPreferredWidth
public int getPreferredWidth(int heightArgument)
Description copied from interface:ConstrainedVisual
Returns the visual's preferred width given the provided height constraint.- Specified by:
getPreferredWidth
in interfaceConstrainedVisual
- Parameters:
heightArgument
- The height by which to constrain the preferred width, or-1
for no constraint.- Returns:
- The preferred width given the height constraint.
-
getPreferredHeight
public int getPreferredHeight(int widthArgument)
Description copied from interface:ConstrainedVisual
Returns the visual's preferred height given the provided width constraint.- Specified by:
getPreferredHeight
in interfaceConstrainedVisual
- Parameters:
widthArgument
- The width by which to constrain the preferred height, or-1
for no constraint.- Returns:
- The preferred height given the width constraint.
-
getPreferredSize
public Dimensions getPreferredSize()
Description copied from interface:ConstrainedVisual
Returns the visual's unconstrained preferred size.- Specified by:
getPreferredSize
in interfaceConstrainedVisual
- Returns:
- The unconstrained preferred size for this component.
-
getBaseline
public int getBaseline(int widthArgument, int heightArgument)
Description copied from interface:ConstrainedVisual
Returns the baseline for a given width and height.- Specified by:
getBaseline
in interfaceConstrainedVisual
- Parameters:
widthArgument
- Constrained width to compute the baseline for.heightArgument
- Constrained height to compute the baseline for.- Returns:
- The baseline relative to the origin of this visual, or
-1
if this visual does not have a baseline.
-
getStyles
public Dictionary<java.lang.String,java.lang.Object> getStyles()
-
render
public void render(java.lang.Object row, int rowIndex, int columnIndex, TableView tableView, java.lang.String columnName, boolean selected, boolean highlighted, boolean disabled)
Description copied from interface:TableView.CellRenderer
Prepares the renderer for layout or paint.- Specified by:
render
in interfaceTableView.CellRenderer
- Parameters:
row
- The row to render, ornull
if called to calculate preferred height for skins that assume a fixed renderer height.rowIndex
- The index of the row being rendered, or-1
ifvalue
isnull
.columnIndex
- The index of the column being rendered.tableView
- The host component.columnName
- The name of the column being rendered.selected
- Iftrue
, the row is selected.highlighted
- Iftrue
, the row is highlighted.disabled
- Iftrue
, the row is disabled.
-
toString
public java.lang.String toString(java.lang.Object row, java.lang.String columnName)
Description copied from interface:TableView.CellRenderer
Converts table view cell data to a string representation.- Specified by:
toString
in interfaceTableView.CellRenderer
- Parameters:
row
- The row object.columnName
- The name of the column.- Returns:
- The cell data's string representation, or
null
if the data does not have a string representation.Note that this method may be called often during keyboard navigation, so implementations should avoid unnecessary string allocations.
-
getDefaultRenderer
public TableView.CellRenderer getDefaultRenderer()
-
setDefaultRenderer
public void setDefaultRenderer(TableView.CellRenderer defaultRenderer)
-
getRendererMappings
public Sequence<TableViewMultiCellRenderer.RendererMapping> getRendererMappings()
-
-