JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.table
Class BaseDataView

java.lang.Object
  |
  +--com.klg.jclass.table.BaseDataView
All Implemented Interfaces:
DataViewModel, EventListener, JCTableDataListener, JCTableDataModel, Serializable, TableDataModel
Direct Known Subclasses:
TableDataView

public abstract class BaseDataView
extends Object
implements DataViewModel, Serializable

The BaseDataView class implements all DataViewModel methods that control editors and renderers.

Since:
JClass 4.0K for Java 2. If you are using JClass 4.0J, which is based on JDK 1.1, some of the return types for this class' fields or methods are based on the corresponding com.sun.java.util class.
See Also:
Serialized Form

Field Summary
protected  Hashtable editors
           
protected  Hashtable renderers
           
protected  com.klg.jclass.table.JCTable table
           
 
Constructor Summary
BaseDataView()
          Creates a BaseDataView instance that initializes the editor and renderer tables with defaults settings but does not link it to table.
BaseDataView(com.klg.jclass.table.JCTable table)
          Creates a BaseDataView instance and initializes the editor and renderer tables with default settings.
 
Method Summary
abstract  void dataChanged(com.klg.jclass.table.JCTableDataEvent e)
          Method to change the data based on the passed in event
 com.klg.jclass.cell.JCCellEditor getCellEditor(Class type)
          Returns the cell editor given a data type class.
 com.klg.jclass.cell.JCCellEditor getCellEditor(int row, int column)
          Returns the cell editor for a row/column.
 com.klg.jclass.cell.JCCellEditor getCellEditor(Object o)
          Returns the cell editor given an object.
 com.klg.jclass.cell.JCCellRenderer getCellRenderer(Class type)
          Returns the cell renderer given a data type class.
 com.klg.jclass.cell.JCCellRenderer getCellRenderer(int row, int column)
          Returns the cell renderer for a row/column.
 com.klg.jclass.cell.JCCellRenderer getCellRenderer(int row, int column, Object o)
          Returns the cell renderer for a row/column given the data for the cell.
 com.klg.jclass.cell.JCCellRenderer getCellRenderer(Object o)
          Returns the cell renderer given an object.
abstract  com.klg.jclass.table.TableDataModel getDataSource()
          Returns the bound data source.
 Hashtable getEditorsTable()
          Returns a Hashtable of object to editor mappings.
abstract  Object getObject(int row, int column)
          Returns the object given a row or column.
 Hashtable getRenderersTable()
          Returns a Hashtable of object to renderer mappings.
 com.klg.jclass.table.JCTable getTable()
          Returns the JCTable controlled by the DataView.
abstract  Object getTableColumnLabel(int column)
          Returns the value for the column label at the specified column.
abstract  Object getTableDataItem(int row, int column)
          Returns the value for the cell at the specified location.
abstract  Object getTableRowLabel(int row)
          Returns the value for the row label at the specified row.
abstract  boolean isEditable()
          Returns true if the data source implements EditableTableData.
protected  void loadFieldEditors(Hashtable ht)
          Loads the special field renderers designed for use with JCTable.
protected  void loadFieldRenderers(Hashtable ht)
          Loads the special field renderers designed for use with JCTable.
abstract  void setDataSource(com.klg.jclass.table.TableDataModel tableData)
          Sets the bound data source.
 void setEditorsTable(Hashtable ht)
          Sets the Hashtable for object to editor mappings.
 void setRenderersTable(Hashtable ht)
          Sets the Hashtable of object to renderer mappings.
 void setTable(com.klg.jclass.table.JCTable table)
          Sets the JCTable controlled by the DataView.
abstract  boolean setTableDataItem(Object o, int row, int column)
          Sets the cell value for editable data sources.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.klg.jclass.table.TableDataModel
addTableDataListener, removeTableDataListener
 
Methods inherited from interface com.klg.jclass.util.JCTableDataModel
getNumColumns, getNumRows
 

Field Detail

table

protected com.klg.jclass.table.JCTable table

renderers

protected Hashtable renderers

editors

protected Hashtable editors
Constructor Detail

BaseDataView

public BaseDataView()
Creates a BaseDataView instance that initializes the editor and renderer tables with defaults settings but does not link it to table.


BaseDataView

public BaseDataView(com.klg.jclass.table.JCTable table)
Creates a BaseDataView instance and initializes the editor and renderer tables with default settings.

Parameters:
table - The table controlled by this DataView.
Method Detail

getTable

public com.klg.jclass.table.JCTable getTable()
Returns the JCTable controlled by the DataView.

Specified by:
getTable in interface DataViewModel
Returns:
The current table controlled by this DataView.

setTable

public void setTable(com.klg.jclass.table.JCTable table)
Sets the JCTable controlled by the DataView.

Specified by:
setTable in interface DataViewModel
Parameters:
table - The new table for this DataView

getCellRenderer

public com.klg.jclass.cell.JCCellRenderer getCellRenderer(int row,
                                                          int column)
Returns the cell renderer for a row/column.

Specified by:
getCellRenderer in interface DataViewModel
Parameters:
row - The row index
column - The column index
Returns:
The cell renderer for the given row and column.

getCellRenderer

public com.klg.jclass.cell.JCCellRenderer getCellRenderer(int row,
                                                          int column,
                                                          Object o)
Returns the cell renderer for a row/column given the data for the cell.

Specified by:
getCellRenderer in interface DataViewModel
Parameters:
row - The row index
column - The column index
o - The data in the cell indexed by row and column
Returns:
The cell renderer based on the data in the cell given the row and column indicies

getCellRenderer

public com.klg.jclass.cell.JCCellRenderer getCellRenderer(Class type)
Returns the cell renderer given a data type class. This looks in the EditorRenderRegistry if there isn't one already in the renderer cache.

Parameters:
type - The class type of the required renderer
Returns:
The cell renderer based on the class type

getCellRenderer

public com.klg.jclass.cell.JCCellRenderer getCellRenderer(Object o)
Returns the cell renderer given an object. If the object isn't null, it just returns the renderer for the class type of the object.

Specified by:
getCellRenderer in interface DataViewModel
Parameters:
o - The object the cell renderer needs to render
Returns:
The cell renderer based on the object.

getRenderersTable

public Hashtable getRenderersTable()
Returns a Hashtable of object to renderer mappings.

Specified by:
getRenderersTable in interface DataViewModel
Returns:
The current renderer cache

setRenderersTable

public void setRenderersTable(Hashtable ht)
Sets the Hashtable of object to renderer mappings.

Specified by:
setRenderersTable in interface DataViewModel
Parameters:
ht - The new renderer cache

getCellEditor

public com.klg.jclass.cell.JCCellEditor getCellEditor(int row,
                                                      int column)
Returns the cell editor for a row/column.

Specified by:
getCellEditor in interface DataViewModel
Parameters:
row - The row index
column - The column index
Returns:
The cell editor for the given row and column

getCellEditor

public com.klg.jclass.cell.JCCellEditor getCellEditor(Class type)
Returns the cell editor given a data type class.

Parameters:
type - The class type of the required cell editor
Returns:
The cell editor based on the give class type

getCellEditor

public com.klg.jclass.cell.JCCellEditor getCellEditor(Object o)
Returns the cell editor given an object.

Specified by:
getCellEditor in interface DataViewModel
Parameters:
o - The object for which a cell editor is required
Returns:
The cell editor based on the given object

getEditorsTable

public Hashtable getEditorsTable()
Returns a Hashtable of object to editor mappings.

Specified by:
getEditorsTable in interface DataViewModel
Returns:
The current editor cache

setEditorsTable

public void setEditorsTable(Hashtable ht)
Sets the Hashtable for object to editor mappings.

Specified by:
setEditorsTable in interface DataViewModel
Parameters:
ht - The new eidtor cache

loadFieldRenderers

protected void loadFieldRenderers(Hashtable ht)
Loads the special field renderers designed for use with JCTable. This method no longer does anything as of JClass 4.0. Its around for backwards compatibility only.

Parameters:
ht - The hashtable to which the field renderers are to be added

loadFieldEditors

protected void loadFieldEditors(Hashtable ht)
Loads the special field renderers designed for use with JCTable. This method no longer does anything as of JClass 4.0. Its around for backwards compatibility only.

Parameters:
ht - The hashtable to which the field editors are to be added

setDataSource

public abstract void setDataSource(com.klg.jclass.table.TableDataModel tableData)
Sets the bound data source.

Specified by:
setDataSource in interface DataViewModel
Parameters:
tableData - The new bound data source

getDataSource

public abstract com.klg.jclass.table.TableDataModel getDataSource()
Returns the bound data source.

Specified by:
getDataSource in interface DataViewModel
Returns:
The current bound data source

isEditable

public abstract boolean isEditable()
Returns true if the data source implements EditableTableData.

Specified by:
isEditable in interface DataViewModel
Returns:
Is the data source editable?

getObject

public abstract Object getObject(int row,
                                 int column)
Returns the object given a row or column. This convenience method handles both cells and labels.

Specified by:
getObject in interface DataViewModel
Parameters:
row - The row index
column - The column index
Returns:
The data object based on the given row and column

setTableDataItem

public abstract boolean setTableDataItem(Object o,
                                         int row,
                                         int column)
Sets the cell value for editable data sources.

Specified by:
setTableDataItem in interface DataViewModel
Parameters:
o - The new cell value
row - The row index
column - The column index
Returns:
The status of the edit. Note that if the datasource is not editable, no edit is done and true is returned.

getTableDataItem

public abstract Object getTableDataItem(int row,
                                        int column)
Returns the value for the cell at the specified location.

Specified by:
getTableDataItem in interface JCTableDataModel
Parameters:
row - The row index
column - The column index
Returns:
The data object based on the given row and column

getTableRowLabel

public abstract Object getTableRowLabel(int row)
Returns the value for the row label at the specified row.

Specified by:
getTableRowLabel in interface JCTableDataModel
Parameters:
row - The row index
Returns:
The label value for the given row

getTableColumnLabel

public abstract Object getTableColumnLabel(int column)
Returns the value for the column label at the specified column.

Specified by:
getTableColumnLabel in interface JCTableDataModel
Parameters:
column - The column index
Returns:
The label value for the given column

dataChanged

public abstract void dataChanged(com.klg.jclass.table.JCTableDataEvent e)
Method to change the data based on the passed in event

Specified by:
dataChanged in interface JCTableDataListener
Parameters:
e - The event used to change the data

Copyright © 2004 Quest Software Inc..
All rights reserved.