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 classTableViewMultiCellRenderer.RendererMappingMaps 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 intgetBaseline()Returns the visual's baseline.intgetBaseline(int widthArgument, int heightArgument)Returns the baseline for a given width and height.TableView.CellRenderergetDefaultRenderer()intgetHeight()Returns the visual's height.intgetPreferredHeight(int widthArgument)Returns the visual's preferred height given the provided width constraint.DimensionsgetPreferredSize()Returns the visual's unconstrained preferred size.intgetPreferredWidth(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()intgetWidth()Returns the visual's width.voidpaint(java.awt.Graphics2D graphics)Paints the visual.voidrender(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.voidsetDefaultRenderer(TableView.CellRenderer defaultRenderer)voidsetSize(int width, int height)Sets the visual's render size.java.lang.StringtoString(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:VisualReturns the visual's width.
-
getHeight
public int getHeight()
Description copied from interface:VisualReturns the visual's height.
-
getBaseline
public int getBaseline()
Description copied from interface:VisualReturns the visual's baseline.- Specified by:
getBaselinein interfaceVisual- Returns:
- The baseline relative to the origin of the visual, or
-1if this visual does not have a baseline.
-
paint
public void paint(java.awt.Graphics2D graphics)
Description copied from interface:VisualPaints the visual.
-
setSize
public void setSize(int width, int height)Description copied from interface:ConstrainedVisualSets the visual's render size.- Specified by:
setSizein interfaceConstrainedVisual- Parameters:
width- The visual's new width.height- The visual's new height.
-
getPreferredWidth
public int getPreferredWidth(int heightArgument)
Description copied from interface:ConstrainedVisualReturns the visual's preferred width given the provided height constraint.- Specified by:
getPreferredWidthin interfaceConstrainedVisual- Parameters:
heightArgument- The height by which to constrain the preferred width, or-1for no constraint.- Returns:
- The preferred width given the height constraint.
-
getPreferredHeight
public int getPreferredHeight(int widthArgument)
Description copied from interface:ConstrainedVisualReturns the visual's preferred height given the provided width constraint.- Specified by:
getPreferredHeightin interfaceConstrainedVisual- Parameters:
widthArgument- The width by which to constrain the preferred height, or-1for no constraint.- Returns:
- The preferred height given the width constraint.
-
getPreferredSize
public Dimensions getPreferredSize()
Description copied from interface:ConstrainedVisualReturns the visual's unconstrained preferred size.- Specified by:
getPreferredSizein interfaceConstrainedVisual- Returns:
- The unconstrained preferred size for this component.
-
getBaseline
public int getBaseline(int widthArgument, int heightArgument)Description copied from interface:ConstrainedVisualReturns the baseline for a given width and height.- Specified by:
getBaselinein 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
-1if 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.CellRendererPrepares the renderer for layout or paint.- Specified by:
renderin interfaceTableView.CellRenderer- Parameters:
row- The row to render, ornullif called to calculate preferred height for skins that assume a fixed renderer height.rowIndex- The index of the row being rendered, or-1ifvalueisnull.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.CellRendererConverts table view cell data to a string representation.- Specified by:
toStringin interfaceTableView.CellRenderer- Parameters:
row- The row object.columnName- The name of the column.- Returns:
- The cell data's string representation, or
nullif 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()
-
-