net.sf.jga.swing
Class GenericTableColumn<R,C>

java.lang.Object
  extended by javax.swing.table.TableColumn
      extended by net.sf.jga.swing.GenericTableColumn<R,C>
All Implemented Interfaces:
java.io.Serializable

public class GenericTableColumn<R,C>
extends javax.swing.table.TableColumn

Column class used in conjunction with GenericTableModel. It is up to the user to ensure that the contents of the list are of the correct type, otherwise, a ClassCastException will be thrown during the component's paint routine.

Copyright © 2003-2005 David A. Hall

Author:
David A. Hall
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.TableColumn
CELL_RENDERER_PROPERTY, cellEditor, cellRenderer, COLUMN_WIDTH_PROPERTY, HEADER_RENDERER_PROPERTY, HEADER_VALUE_PROPERTY, headerRenderer, headerValue, identifier, isResizable, maxWidth, minWidth, modelIndex, resizedPostingDisableCount, width
 
Constructor Summary
GenericTableColumn(java.lang.Class<C> coltype, UnaryFunctor<R,C> getFn)
          Builds a read-only column that will apply the given functor to objects of the given class to get the value of specific cells.
GenericTableColumn(java.lang.Class<C> coltype, UnaryFunctor<R,C> getFn, BinaryFunctor<R,C,C> setFn)
          Builds a potentially editable column that will apply the given functors to objects of the given class to get and set the value of specific cells.
GenericTableColumn(java.lang.Class<C> coltype, UnaryFunctor<R,C> getFn, BinaryFunctor<R,C,C> setFn, javax.swing.table.TableCellRenderer renderer, javax.swing.table.TableCellEditor editor)
          Builds a potentially editable column that will apply the given functors to objects of the given class to get and set the value of specific cells.
GenericTableColumn(java.lang.Class<C> coltype, UnaryFunctor<R,C> getFn, BinaryFunctor<R,C,C> setFn, UnaryFunctor<C,java.lang.String> formatter, UnaryFunctor<java.lang.String,C> parser)
          Builds a potentially editable column that will apply the given functors to objects of the given class to get and set the value of specific cells.
 
Method Summary
 java.lang.Class<C> getColumnClass()
           
 C getValueAt(R rowvalue)
           
 boolean isEditable()
           
 void setValueAt(R rowvalue, java.lang.Object obj)
           
 java.lang.String toString()
           
 
Methods inherited from class javax.swing.table.TableColumn
addPropertyChangeListener, createDefaultHeaderRenderer, disableResizedPosting, enableResizedPosting, getCellEditor, getCellRenderer, getHeaderRenderer, getHeaderValue, getIdentifier, getMaxWidth, getMinWidth, getModelIndex, getPreferredWidth, getPropertyChangeListeners, getResizable, getWidth, removePropertyChangeListener, setCellEditor, setCellRenderer, setHeaderRenderer, setHeaderValue, setIdentifier, setMaxWidth, setMinWidth, setModelIndex, setPreferredWidth, setResizable, setWidth, sizeWidthToFit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GenericTableColumn

public GenericTableColumn(java.lang.Class<C> coltype,
                          UnaryFunctor<R,C> getFn)
Builds a read-only column that will apply the given functor to objects of the given class to get the value of specific cells. A default table renderer will be used, as defined by the Table that uses this column.


GenericTableColumn

public GenericTableColumn(java.lang.Class<C> coltype,
                          UnaryFunctor<R,C> getFn,
                          BinaryFunctor<R,C,C> setFn)
Builds a potentially editable column that will apply the given functors to objects of the given class to get and set the value of specific cells. The setFn can be null: if it is, then this column will not be editable. A default table renderer and editor will be used, as defined by the Table that uses this column.


GenericTableColumn

public GenericTableColumn(java.lang.Class<C> coltype,
                          UnaryFunctor<R,C> getFn,
                          BinaryFunctor<R,C,C> setFn,
                          UnaryFunctor<C,java.lang.String> formatter,
                          UnaryFunctor<java.lang.String,C> parser)
Builds a potentially editable column that will apply the given functors to objects of the given class to get and set the value of specific cells. The setFn can be null: if it is, then this column will not be editable. The formatter will be used to build a GenericTableCellRenderer for the column if it is non-null. If formatter, parser, and setFn are all non-null, then a GenericCellEditor will be built for this column. If any of these fields are null, the the Table that uses this column will supply the default renderer/editor.


GenericTableColumn

public GenericTableColumn(java.lang.Class<C> coltype,
                          UnaryFunctor<R,C> getFn,
                          BinaryFunctor<R,C,C> setFn,
                          javax.swing.table.TableCellRenderer renderer,
                          javax.swing.table.TableCellEditor editor)
Builds a potentially editable column that will apply the given functors to objects of the given class to get and set the value of specific cells. The setFn can be null: if it is, then this column will not be editable. Either the renderer or editor may be null: the Table will supply the default renderer/editor in this case. Note that if the setFn is null, there will be no editor configured (as it would never be called anyway).

Method Detail

getValueAt

public C getValueAt(R rowvalue)

setValueAt

public void setValueAt(R rowvalue,
                       java.lang.Object obj)

isEditable

public boolean isEditable()

getColumnClass

public java.lang.Class<C> getColumnClass()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2002-2006 David A. Hall. All Rights Reserved.