public class ClosureRenderer
extends Object
implements ListCellRenderer, TableCellRenderer, TreeCellRenderer
Shared Swing renderer that delegates rendering customization to a Groovy closure.
| Constructor and description |
|---|
ClosureRenderer()Creates a renderer with no update closure. |
ClosureRenderer(Closure c)Creates a renderer that delegates to the supplied closure. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public List |
getChildren()Returns the renderer children exposed to the update closure. |
|
public int |
getColumn()Returns the current column index. |
|
public JList |
getList()Returns the current list being rendered. |
|
public Component |
getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)Prepares list-rendering state and delegates component creation to render(). |
|
public int |
getRow()Returns the current row index. |
|
public JTable |
getTable()Returns the current table being rendered. |
|
public Component |
getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)Prepares table-rendering state and delegates component creation to render(). |
|
public JTree |
getTree()Returns the current tree being rendered. |
|
public Component |
getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)Prepares tree-rendering state and delegates component creation to render(). |
|
public Closure |
getUpdate()Returns the update closure invoked during rendering. |
|
public Object |
getValue()Returns the current cell value. |
|
public boolean |
isDefaultRenderer()Returns whether the default renderer was used as the base renderer. |
|
public boolean |
isExpanded()Returns whether the current tree node is expanded. |
|
public boolean |
isFocused()Returns whether the current cell has focus. |
|
public boolean |
isLeaf()Returns whether the current tree node is a leaf. |
|
public boolean |
isSelected()Returns whether the current cell is selected. |
|
public boolean |
isTableHeader()Returns whether table rendering uses the table-header renderer. |
|
public void |
setTableHeader(boolean tableHeader)Configures whether table rendering should use the table-header renderer. |
|
public void |
setUpdate(Closure update)Sets the update closure invoked during rendering. |
Creates a renderer with no update closure.
Creates a renderer that delegates to the supplied closure.
c - the update closureReturns the renderer children exposed to the update closure.
Returns the current column index.
-1Returns the current list being rendered.
nullPrepares list-rendering state and delegates component creation to render().
list - the list being renderedvalue - the current cell valueindex - the list index being renderedisSelected - whether the cell is selectedcellHasFocus - whether the cell has focusReturns the current row index.
Returns the current table being rendered.
nullPrepares table-rendering state and delegates component creation to render().
table - the table being renderedvalue - the current cell valueisSelected - whether the cell is selectedhasFocus - whether the cell has focusrow - the model row being renderedcolumn - the model column being renderedReturns the current tree being rendered.
nullPrepares tree-rendering state and delegates component creation to render().
tree - the tree being renderedvalue - the current node valueselected - whether the row is selectedexpanded - whether the node is expandedleaf - whether the node is a leafrow - the tree row being renderedhasFocus - whether the row has focusReturns the update closure invoked during rendering.
Returns the current cell value.
Returns whether the default renderer was used as the base renderer.
true when the default renderer provided the base componentReturns whether the current tree node is expanded.
true when the current node is expandedReturns whether the current cell has focus.
true when the current cell has focusReturns whether the current tree node is a leaf.
true when the current node is a leafReturns whether the current cell is selected.
true when the current cell is selectedReturns whether table rendering uses the table-header renderer.
true when header rendering is enabledConfigures whether table rendering should use the table-header renderer.
tableHeader - true to render using the table-header rendererSets the update closure invoked during rendering.
update - the update closureCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.