JIDE 3.5.15

com.jidesoft.grid
Class SingleColumn

java.lang.Object
  extended by javax.swing.table.TableColumn
      extended by com.jidesoft.grid.AbstractCalculatedColumn
          extended by com.jidesoft.grid.SingleColumn
All Implemented Interfaces:
CalculatedColumn, Serializable

public class SingleColumn
extends AbstractCalculatedColumn

A direct mapping from a single existing column of a table model. It can be used with CalculatedTableModel to create a completely new table model based on the original table model. The SingleColumn can be created based on the column index or the column name (the first one in case there are duplicated column names) as in the original table model. By default it will gets the same column name and the same column class. However you can define a new column name and a new column class. If the actual model is a ContextSensitiveTableModel, the SingleColumn will automatically find the ConverterContext and EditorContext defined in the ContextSensitiveTableModel and set them.

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
SingleColumn(TableModel model, int columnIndex)
           
SingleColumn(TableModel model, int columnIndex, ObjectGrouper objectGrouper)
           
SingleColumn(TableModel model, int columnIndex, String newColumnName)
           
SingleColumn(TableModel model, int columnIndex, String newColumnName, Class<?> columnClass)
           
SingleColumn(TableModel model, int columnIndex, String newColumnName, ObjectGrouper objectGrouper)
           
SingleColumn(TableModel model, String columnName)
           
SingleColumn(TableModel model, String columnName, ObjectGrouper objectGrouper)
           
SingleColumn(TableModel model, String columnName, String newColumnName)
           
SingleColumn(TableModel model, String columnName, String newColumnName, Class<?> columnClass)
           
SingleColumn(TableModel model, String columnName, String newColumnName, ObjectGrouper objectGrouper)
           
 
Method Summary
 int getColumnIndex()
          Gets the column index as in the actual table model.
 int[] getDependingColumns()
          Gets the depending column index.
 Object getValueAt(int rowIndex)
          Gets the value at the specified row index.
 boolean isCellEditable(int rowIndex)
          Checks if the cell is editable at the specified row index.
 void setColumnIndex(int columnIndex)
          Sets the column index as in the actual table model.
 void setObjectGrouper(ObjectGrouper objectGrouper)
           
 void setValueAt(Object value, int rowIndex)
          Sets the value at the specified row index.
 
Methods inherited from class com.jidesoft.grid.AbstractCalculatedColumn
getActualModel, getColumnClass, getColumnIdentifier, getColumnName, getConverterContext, getEditorContext, getGroupValue, getObjectGrouper, setColumnClass, setColumnName, setConverterContext, setEditorContext
 
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, toString, wait, wait, wait
 

Constructor Detail

SingleColumn

public SingleColumn(TableModel model,
                    int columnIndex)

SingleColumn

public SingleColumn(TableModel model,
                    String columnName)

SingleColumn

public SingleColumn(TableModel model,
                    String columnName,
                    String newColumnName)

SingleColumn

public SingleColumn(TableModel model,
                    int columnIndex,
                    String newColumnName)

SingleColumn

public SingleColumn(TableModel model,
                    int columnIndex,
                    String newColumnName,
                    Class<?> columnClass)

SingleColumn

public SingleColumn(TableModel model,
                    String columnName,
                    String newColumnName,
                    Class<?> columnClass)

SingleColumn

public SingleColumn(TableModel model,
                    int columnIndex,
                    ObjectGrouper objectGrouper)

SingleColumn

public SingleColumn(TableModel model,
                    int columnIndex,
                    String newColumnName,
                    ObjectGrouper objectGrouper)

SingleColumn

public SingleColumn(TableModel model,
                    String columnName,
                    ObjectGrouper objectGrouper)

SingleColumn

public SingleColumn(TableModel model,
                    String columnName,
                    String newColumnName,
                    ObjectGrouper objectGrouper)
Method Detail

getColumnIndex

public int getColumnIndex()
Gets the column index as in the actual table model.

Returns:
the column index as in the actual table model.

setColumnIndex

public void setColumnIndex(int columnIndex)
Sets the column index as in the actual table model. This method will update the column name, column class, converter context and editor context.

Parameters:
columnIndex - the column index as in the actual table model.

setObjectGrouper

public void setObjectGrouper(ObjectGrouper objectGrouper)
Overrides:
setObjectGrouper in class AbstractCalculatedColumn

getValueAt

public Object getValueAt(int rowIndex)
Gets the value at the specified row index.

Parameters:
rowIndex - the row index.
Returns:
the value at the specified row index.

setValueAt

public void setValueAt(Object value,
                       int rowIndex)
Sets the value at the specified row index.

Parameters:
value - a new value at the specified row index.
rowIndex - the row index.

isCellEditable

public boolean isCellEditable(int rowIndex)
Checks if the cell is editable at the specified row index. If getObjectGrouper() is not null, this method will return false as there is usually no way to edit a grouped value (because grouping is one direction). Otherwise, it will return the value from the actual model's isCellEditable method.

Parameters:
rowIndex - the row index.
Returns:
true if the cell is editable. Otherwise false.

getDependingColumns

public int[] getDependingColumns()
Gets the depending column index. By default, it will be getColumnIndex().

Returns:
the depending column index.

JIDE 3.5.15