net.sf.jguiraffe.gui.platform.swing.builder.components.table
Class SwingTableCellRenderer

java.lang.Object
  extended by net.sf.jguiraffe.gui.platform.swing.builder.components.table.SwingTableCellRenderer
All Implemented Interfaces:
javax.swing.table.TableCellRenderer

 class SwingTableCellRenderer
extends java.lang.Object
implements javax.swing.table.TableCellRenderer

A specialized renderer implementation that is used for table columns that define their own custom renderer component.

This class is the counterpart of SwingTableCellEditor for custom renderers. Its task is to extract the renderer component of a column from the table definition and to initialize it.

Version:
$Id: SwingTableCellRenderer.java 58 2007-04-15 16:34:21Z oheger $
Author:
Oliver Heger

Constructor Summary
SwingTableCellRenderer(SwingTableModel tabModel)
          Creates a new instance of SwingTableCellRenderer.
 
Method Summary
 SwingTableModel getModel()
          Returns a reference to the associated table model.
 java.awt.Component getTableCellRendererComponent(javax.swing.JTable table, java.lang.Object value, boolean selected, boolean focused, int row, int col)
          Returns the renderer component for the specified cell.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwingTableCellRenderer

public SwingTableCellRenderer(SwingTableModel tabModel)
Creates a new instance of SwingTableCellRenderer.

Parameters:
tabModel - the associated table model
Method Detail

getModel

public SwingTableModel getModel()
Returns a reference to the associated table model.

Returns:
the table model

getTableCellRendererComponent

public java.awt.Component getTableCellRendererComponent(javax.swing.JTable table,
                                                        java.lang.Object value,
                                                        boolean selected,
                                                        boolean focused,
                                                        int row,
                                                        int col)
Returns the renderer component for the specified cell. This implementation fetches the TableColumn tag from the associated table model and obtains the renderer component from it. The TableSelectionHandler for renderers will be invoked to initialize the component. Note that there is no need to explicitely set the value because this was already done through the renderer Form of the table component.

Specified by:
getTableCellRendererComponent in interface javax.swing.table.TableCellRenderer
Parameters:
table - the table object
value - the current value
selected - a flag whether the cell is selected
focused - a flag whether the cell has the focus
row - the current row
col - the current column
Returns:
the component to be used as cell renderer


Copyright 2007 null. All Rights Reserved.