JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.datasource.util
Class DataBinding

java.lang.Object
  |
  +--com.klg.jclass.datasource.util.DataBinding
All Implemented Interfaces:
DataModelListener, EventListener, ReadOnlyBindingListener, Serializable
Direct Known Subclasses:
ColumnDataBinding, NavigatorDataBinding

public abstract class DataBinding
extends Object
implements DataModelListener, Serializable

Abstract class to aid in binding to a particular meta-data level in a given data source

See Also:
Serialized Form

Field Summary
protected  com.klg.jclass.datasource.BindingModel binding
           
protected  Component component
           
protected  String dataBinding
           
static String PATH_DELIMITER
           
static String SOURCE_DELIMITER
           
 
Constructor Summary
DataBinding(Component component)
           
DataBinding(Component component, com.klg.jclass.datasource.BindingModel binding)
           
 
Method Summary
 void afterChangeOfRowData(com.klg.jclass.datasource.DataModelEvent e)
          A row has changed, re-read all its cells and its status to reflect the new values.
 void afterDeleteRow(com.klg.jclass.datasource.DataModelEvent e)
          Removes the row from the display.
 void afterInsertRow(com.klg.jclass.datasource.DataModelEvent e)
          A new row has been added to the datasource.
 void afterMoveToCurrentRow(com.klg.jclass.datasource.DataModelEvent e)
          The global cursor has moved to a new row.
 void afterRequeryRowAndDetails(com.klg.jclass.datasource.DataModelEvent e)
          Re-reads the indicated row and refresh all open children under this row.
 void afterRequeryTable(com.klg.jclass.datasource.DataModelEvent e)
          Re-read this table and refresh all open children in this table.
 void afterReset(com.klg.jclass.datasource.DataModelEvent e)
          Listeners must close all expanded views and reset/reread the root node.
 void beforeCancelAll(com.klg.jclass.datasource.DataModelEvent e)
          Called before all changes are cancelled.
 void beforeCancelRowChanges(com.klg.jclass.datasource.DataModelEvent e)
          Called before all edits to a row are undone.
 void beforeCommitAll(com.klg.jclass.datasource.DataModelEvent e)
          Called before all changes are committed.
 void beforeCommitConditional(com.klg.jclass.datasource.DataModelEvent e)
          Called when the root-level bookmark for a subtree changes.
 void beforeCommitRow(com.klg.jclass.datasource.DataModelEvent e)
          Called before single row is committed to data source.
protected abstract  boolean beforeCurrentRowChange()
          Checks if all listeners have accepted the move.
 void beforeDeleteRow(com.klg.jclass.datasource.DataModelEvent e)
          Called before a row is [logically] deleted.
 void beforeDeleteTable(com.klg.jclass.datasource.DataModelEvent e)
          The indicated DataTable will be deleted and flushed from the cache.
 void beforeEditCell(com.klg.jclass.datasource.DataModelEvent e)
          Called before a cell is edited.
 void beforeInsertRow(com.klg.jclass.datasource.DataModelEvent e)
          Called before a row is inserted.
 void beforeMoveToCurrentRow(com.klg.jclass.datasource.DataModelEvent e)
          The global cursor will move to a new row.
 void beforeRequery(com.klg.jclass.datasource.DataModelEvent e)
          Called when either DataTableModel.requeryRowAndDetails() or DataTableModel.requeryRow() is called.
 void beforeReset(com.klg.jclass.datasource.DataModelEvent e)
          Called before entire grid is reset.
 void beginEvents(com.klg.jclass.datasource.DataModelEvent e)
          Notification that multiple events are coming.
protected abstract  void cellDataChanged(int rowIndex, String columnName)
          Must be called after a single cell value was changed.
protected  void checkDataTableChanged()
          Process a move to row for any metadata level.
protected  void checkDataTableChanged(com.klg.jclass.datasource.DataModelEvent event)
          Process a move to row for any metadata level
protected abstract  void currentRowChanged(int rowIndex)
          Changes the current row in the component.
 void dispose()
          If the DataBinding is attached to a DataModel object, remove it from the DataModel's DataModelListener list.
 void endEvents(com.klg.jclass.datasource.DataModelEvent e)
          Notification that multiple events are complete.
protected  void finalize()
          Allows the DataBinding to clean up any references.
 com.klg.jclass.datasource.BindingModel getBinding()
          Return the BindingModel for this data binding object.
 Component getComponent()
          Returns the component this object is bound to
 int getCurrentRowIndex()
          Returns current zero-based row index for the DataTableModel instance.
 String getDataBinding()
          Return the hierarchy string for this level.
 int getJavaColumnType(String columnName)
          Returns the JavaColumnType for the column.
 Object getNativeMetaData()
           
 int getNumColumns()
          Returns the number of rows the data source table contains.
 int getNumRows()
          Returns the number of rows the data source table contains.
 String getTableColumnLabel(int columnIndex)
          Returns the value for the column label at the specified column.
protected  void handleCancellingBeforeEvents(com.klg.jclass.datasource.DataModelEvent e)
           
protected  void handleCheckingAfterEvents(com.klg.jclass.datasource.DataModelEvent e)
           
 void initialize(com.klg.jclass.datasource.DataModelEvent e)
          For internal use only Used by the JCData bean.
 boolean isColumnEditable(String columnName)
          Determines whether the column can be edited.
 boolean isDataAvailable()
          Returns the state of the data binding.
protected  void moveToBestRowAfterDelete(com.klg.jclass.datasource.DataModelEvent event)
          Determines the best row to move to after a row delete has been committed (or logically deleted with ShowDeletedRows false).
protected  boolean moveToRowIndex(int rowIndex)
          Sets DataModel current row.
 void originatorNavigateRow(com.klg.jclass.datasource.DataModelEvent e)
          The current row has been deleted and the originator of the deletion should now reposition the global cursor to a new, valid row.
protected  void processException(com.klg.jclass.datasource.DataModelException exception)
           
protected abstract  void rowDataChanged(int rowIndex)
          Must be called after row data were changed.
protected abstract  void rowDeleted()
          Must be called after a row was deleted.
protected abstract  void rowInserted()
          Must be called after a row was inserted.
protected abstract  void setDataAvailable(boolean state)
          Called whenever the DataTableModel changes to an invalid or valid state.
 void setDataBinding(com.klg.jclass.datasource.BindingModel binding)
          Sets up parameters to bind the DataBinding to a MetaDataMode in the given DataModel.
 void setDataBinding(com.klg.jclass.datasource.DataModel dataModel, com.klg.jclass.datasource.MetaDataModel metaDataModel)
           
 void setDataBinding(com.klg.jclass.datasource.DataModel dataModel, String metaDescription)
          Sets the data source to a DataModel and binds the MetaData to the MetaDataModel represented by a "path" of MetaDataModel descriptions separated by '|' (e.g.
 void setDataBinding(String data_binding)
          Returns the data binding hierarchy string, starting from a data model instance name and containing full sequence of MetaDataModel levels starting from the root to the level the table is bound with.
 void setDataBindingInternalBegin(com.klg.jclass.datasource.BindingModel binding)
          When overriding setDataBinding() it is necessary to call this method first.
 void setDataBindingInternalEnd()
          When overriding setDataBinding() it is necessary to call this method just before returning
protected abstract  void tableChanged()
          Process a change in the data
protected  void toggleDataAvailableState()
          Checks the new data available state to determine whether a setDataAvailable call is made.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

binding

protected com.klg.jclass.datasource.BindingModel binding

component

protected Component component

dataBinding

protected String dataBinding

PATH_DELIMITER

public static final String PATH_DELIMITER
See Also:
Constant Field Values

SOURCE_DELIMITER

public static final String SOURCE_DELIMITER
See Also:
Constant Field Values
Constructor Detail

DataBinding

public DataBinding(Component component)

DataBinding

public DataBinding(Component component,
                   com.klg.jclass.datasource.BindingModel binding)
Method Detail

finalize

protected void finalize()
                 throws Throwable
Allows the DataBinding to clean up any references.

Overrides:
finalize in class Object
Throws:
Throwable - If an exception occurs.

dispose

public void dispose()
If the DataBinding is attached to a DataModel object, remove it from the DataModel's DataModelListener list.


getComponent

public Component getComponent()
Returns the component this object is bound to


setDataBinding

public void setDataBinding(com.klg.jclass.datasource.DataModel dataModel,
                           String metaDescription)
Sets the data source to a DataModel and binds the MetaData to the MetaDataModel represented by a "path" of MetaDataModel descriptions separated by '|' (e.g. Orders|Customers).


setDataBinding

public void setDataBinding(String data_binding)
Returns the data binding hierarchy string, starting from a data model instance name and containing full sequence of MetaDataModel levels starting from the root to the level the table is bound with.

See Also:
NodeProperties.setDataSource(java.lang.Object), setDataBinding(com.klg.jclass.datasource.DataModel, java.lang.String)

getDataBinding

public String getDataBinding()
Return the hierarchy string for this level.

Returns:
the string which indicates the hierarchy for this level.

getBinding

public com.klg.jclass.datasource.BindingModel getBinding()
Return the BindingModel for this data binding object.

Returns:
the BindingModel for this component.

setDataBinding

public void setDataBinding(com.klg.jclass.datasource.BindingModel binding)
Sets up parameters to bind the DataBinding to a MetaDataMode in the given DataModel.


setDataBinding

public void setDataBinding(com.klg.jclass.datasource.DataModel dataModel,
                           com.klg.jclass.datasource.MetaDataModel metaDataModel)

setDataBindingInternalBegin

public void setDataBindingInternalBegin(com.klg.jclass.datasource.BindingModel binding)
When overriding setDataBinding() it is necessary to call this method first.

Sets up parameters to bind the DataBinding to a MetaDataModel in the given DataModel.


setDataBindingInternalEnd

public void setDataBindingInternalEnd()
When overriding setDataBinding() it is necessary to call this method just before returning


getNativeMetaData

public Object getNativeMetaData()

getNumRows

public int getNumRows()
Returns the number of rows the data source table contains. Must not be called if the data are not available.


getNumColumns

public int getNumColumns()
Returns the number of rows the data source table contains. Must not be called if the data source is disabled.


beforeInsertRow

public void beforeInsertRow(com.klg.jclass.datasource.DataModelEvent e)
Called before a row is inserted. Can be cancelled. If not cancelled will be followed by afterInsertRow().

Specified by:
beforeInsertRow in interface DataModelListener
See Also:
DataTableModel.addRow(com.klg.jclass.datasource.DataModelListener)

beforeReset

public void beforeReset(com.klg.jclass.datasource.DataModelEvent e)
Called before entire grid is reset. Can be cancelled. If not cancelled will be followed by afterReset(). This will result from a call to DataModel.requeryAll().

Specified by:
beforeReset in interface DataModelListener
See Also:
DataModel.requeryAll(com.klg.jclass.datasource.DataModelListener)

beforeRequery

public void beforeRequery(com.klg.jclass.datasource.DataModelEvent e)
Called when either DataTableModel.requeryRowAndDetails() or DataTableModel.requeryRow() is called. If not cancelled will be followed by an,

Specified by:
beforeRequery in interface DataModelListener
See Also:
DataTableModel.requeryRow(com.klg.jclass.datasource.DataModelListener, long), DataTableModel.requeryRowAndDetails(com.klg.jclass.datasource.DataModelListener, long)

beforeEditCell

public void beforeEditCell(com.klg.jclass.datasource.DataModelEvent e)
Called before a cell is edited. Can be cancelled.

Specified by:
beforeEditCell in interface DataModelListener
See Also:
DataTableModel.updateCell(com.klg.jclass.datasource.DataModelListener, long, java.lang.String, java.lang.Object)

beforeDeleteRow

public void beforeDeleteRow(com.klg.jclass.datasource.DataModelEvent e)
Called before a row is [logically] deleted. Can be cancelled. If not cancelled will be followed by an afterDeleteRow90 or a afterChangeOfRowData() if the commit policy is COMMIT_MANUALLY or COMMIT_LEAVING_ANCESTOR.

Specified by:
beforeDeleteRow in interface DataModelListener
See Also:
DataTableModel.deleteRow(com.klg.jclass.datasource.DataModelListener, long), MetaDataModel.getCommitPolicy()

beforeCommitAll

public void beforeCommitAll(com.klg.jclass.datasource.DataModelEvent e)
Called before all changes are committed. Can be cancelled. All modified, deleted and inserted rows at all levels are about to be committed. beforeDeleteRow() and afterChangeOfRowData() will follow depending on the operations performed on the modified rows being saved. Results from a call to DataModel.updateAll.

Specified by:
beforeCommitAll in interface DataModelListener
See Also:
DataModel.updateAll(com.klg.jclass.datasource.DataModelListener)

beforeCancelAll

public void beforeCancelAll(com.klg.jclass.datasource.DataModelEvent e)
Called before all changes are cancelled. Can be cancelled. afterInsertRow() and afterChangeOfRowData() can follow this event.

Specified by:
beforeCancelAll in interface DataModelListener
See Also:
DataModel.cancelAll(com.klg.jclass.datasource.DataModelListener)

beforeCancelRowChanges

public void beforeCancelRowChanges(com.klg.jclass.datasource.DataModelEvent e)
Called before all edits to a row are undone. Can be cancelled An afterDeleteRow() or afterChangeOfRowData() will follow.

Specified by:
beforeCancelRowChanges in interface DataModelListener
See Also:
DataTableModel.cancelRowChanges(com.klg.jclass.datasource.DataModelListener, long)

beforeCommitConditional

public void beforeCommitConditional(com.klg.jclass.datasource.DataModelEvent e)
Called when the root-level bookmark for a subtree changes. When this happens those nodes in the previous subtree which are not COMMIT_MANUALLY are committed. Can be cancelled. If cancelled the cursor moves but the changes are automatically committed.

Specified by:
beforeCommitConditional in interface DataModelListener

beforeCommitRow

public void beforeCommitRow(com.klg.jclass.datasource.DataModelEvent e)
Called before single row is committed to data source. Can be cancelled in which case the row edits are not written to the datasource and the rows status remains modified. afterDeleteRow() or afterChangeOfRowData() will follow depending on the status of the row to be committed.

Specified by:
beforeCommitRow in interface DataModelListener
See Also:
DataTableModel.commitRow(com.klg.jclass.datasource.DataModelListener, long)

beforeMoveToCurrentRow

public void beforeMoveToCurrentRow(com.klg.jclass.datasource.DataModelEvent e)
The global cursor will move to a new row. Can be cancelled.

Specified by:
beforeMoveToCurrentRow in interface DataModelListener

beforeDeleteTable

public void beforeDeleteTable(com.klg.jclass.datasource.DataModelEvent e)
The indicated DataTable will be deleted and flushed from the cache. Can be cancelled.

Specified by:
beforeDeleteTable in interface DataModelListener

afterChangeOfRowData

public void afterChangeOfRowData(com.klg.jclass.datasource.DataModelEvent e)
A row has changed, re-read all its cells and its status to reflect the new values. If this event is the result of a cell edit call DataModelEvent.getColumn() to get the name of the column which changed. If getColumn() returns "", re-read the entire row. Called when

Specified by:
afterChangeOfRowData in interface ReadOnlyBindingListener

afterInsertRow

public void afterInsertRow(com.klg.jclass.datasource.DataModelEvent e)
A new row has been added to the datasource. Listeners need to display the row. Rows are always added to the end of DataTableModels.

Specified by:
afterInsertRow in interface ReadOnlyBindingListener

afterDeleteRow

public void afterDeleteRow(com.klg.jclass.datasource.DataModelEvent e)
Removes the row from the display. A row has been physically deleted and needs to be removed from the display or has been logically deleted but the showDeletedRows property has been set to false. Called when,

Specified by:
afterDeleteRow in interface ReadOnlyBindingListener

afterReset

public void afterReset(com.klg.jclass.datasource.DataModelEvent e)
Listeners must close all expanded views and reset/reread the root node. The previous pointer to the root node is no longer valid. Call DataModel.getDataTableTree().getRoot() for the new root table. Called when the datasource has been reset.

Specified by:
afterReset in interface ReadOnlyBindingListener
See Also:
DataModel.requeryAll(com.klg.jclass.datasource.DataModelListener)

afterMoveToCurrentRow

public void afterMoveToCurrentRow(com.klg.jclass.datasource.DataModelEvent e)
The global cursor has moved to a new row. Listeners should position their cursor on the indicated row. In a master-detail relationship child levels should refresh themselves to reflect data sets which correspond to the new parent row by calling DataModel.getCurrentDataTable() or for field controls, DataModel.getCurrentDataItem().

Specified by:
afterMoveToCurrentRow in interface ReadOnlyBindingListener

afterRequeryRowAndDetails

public void afterRequeryRowAndDetails(com.klg.jclass.datasource.DataModelEvent e)
Re-reads the indicated row and refresh all open children under this row.

Specified by:
afterRequeryRowAndDetails in interface ReadOnlyBindingListener

afterRequeryTable

public void afterRequeryTable(com.klg.jclass.datasource.DataModelEvent e)
Re-read this table and refresh all open children in this table.

Specified by:
afterRequeryTable in interface ReadOnlyBindingListener

beginEvents

public void beginEvents(com.klg.jclass.datasource.DataModelEvent e)
Notification that multiple events are coming. Multiple events will be nested between beginEvents() and endEvents(). Allows listeners to treat the events as a batch, to, for example, reduce repaints.

Specified by:
beginEvents in interface ReadOnlyBindingListener

endEvents

public void endEvents(com.klg.jclass.datasource.DataModelEvent e)
Notification that multiple events are complete. Multiple events will be nested between beginEvents() and endEvents(). Allows listeners to treat the events as a batch, to, for example, reduce repaints. Called when

Specified by:
endEvents in interface ReadOnlyBindingListener

originatorNavigateRow

public void originatorNavigateRow(com.klg.jclass.datasource.DataModelEvent e)
The current row has been deleted and the originator of the deletion should now reposition the global cursor to a new, valid row.

Specified by:
originatorNavigateRow in interface DataModelListener

initialize

public void initialize(com.klg.jclass.datasource.DataModelEvent e)
For internal use only Used by the JCData bean.

Specified by:
initialize in interface ReadOnlyBindingListener

handleCancellingBeforeEvents

protected void handleCancellingBeforeEvents(com.klg.jclass.datasource.DataModelEvent e)

handleCheckingAfterEvents

protected void handleCheckingAfterEvents(com.klg.jclass.datasource.DataModelEvent e)

tableChanged

protected abstract void tableChanged()
Process a change in the data


rowDataChanged

protected abstract void rowDataChanged(int rowIndex)
Must be called after row data were changed.


cellDataChanged

protected abstract void cellDataChanged(int rowIndex,
                                        String columnName)
Must be called after a single cell value was changed.


currentRowChanged

protected abstract void currentRowChanged(int rowIndex)
Changes the current row in the component.


beforeCurrentRowChange

protected abstract boolean beforeCurrentRowChange()
Checks if all listeners have accepted the move.


rowInserted

protected abstract void rowInserted()
Must be called after a row was inserted.


rowDeleted

protected abstract void rowDeleted()
Must be called after a row was deleted.


setDataAvailable

protected abstract void setDataAvailable(boolean state)
Called whenever the DataTableModel changes to an invalid or valid state. State is invalid when there is no DataTableModel associated with the MetaDataModel.


isDataAvailable

public boolean isDataAvailable()
Returns the state of the data binding. State will be enabled when a valid DataTableModel exists.


checkDataTableChanged

protected void checkDataTableChanged()
Process a move to row for any metadata level.


checkDataTableChanged

protected void checkDataTableChanged(com.klg.jclass.datasource.DataModelEvent event)
Process a move to row for any metadata level


moveToBestRowAfterDelete

protected void moveToBestRowAfterDelete(com.klg.jclass.datasource.DataModelEvent event)
Determines the best row to move to after a row delete has been committed (or logically deleted with ShowDeletedRows false). This should only be called by the originator of the action that forced the commit. For all rows but the last, the next row becomes current after a delete. If the deleted row is the last row, the previous row becomes current. If there are no rows left after the delete, the parent record of the table becomes current (if there is a parent).


getCurrentRowIndex

public int getCurrentRowIndex()
Returns current zero-based row index for the DataTableModel instance.

Returns:
-1 if current bookmark is invalid.

moveToRowIndex

protected boolean moveToRowIndex(int rowIndex)
Sets DataModel current row.


toggleDataAvailableState

protected void toggleDataAvailableState()
Checks the new data available state to determine whether a setDataAvailable call is made.


getTableColumnLabel

public String getTableColumnLabel(int columnIndex)
Returns the value for the column label at the specified column.

Returns:
true if the column can be edited; false otherwise. Must not be called if the data source is disabled.

getJavaColumnType

public int getJavaColumnType(String columnName)
Returns the JavaColumnType for the column. Must not be called if the data source is disabled.


isColumnEditable

public boolean isColumnEditable(String columnName)
Determines whether the column can be edited.

Parameters:
columnName - the column name string.
Returns:
true if the column can be edited; false otherwise. Must not be called if the data source is disabled.

processException

protected void processException(com.klg.jclass.datasource.DataModelException exception)

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