JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.datasource.jbuilder
Class DataTable

java.lang.Object
  |
  +--javax.swing.tree.DefaultMutableTreeNode
        |
        +--com.klg.jclass.datasource.DataSourceTreeNode
              |
              +--com.klg.jclass.datasource.BaseDataTable
                    |
                    +--com.klg.jclass.datasource.IdeDataTable
                          |
                          +--com.klg.jclass.datasource.jbuilder.DataTable
All Implemented Interfaces:
Cloneable, DataModelListener, DataTableAbstractionLayer, DataTableModel, EventListener, IdeDataTableModel, MutableTreeNode, ReadOnlyBindingListener, Serializable, TreeNode

public class DataTable
extends IdeDataTable

This is the JBuilder implementation for data storage for the JClass Outline Grid datamodel. This data model will request data from instances of this table and will manipulate that data through this interface. That is, rows can then be added, deleted or updated through this DataTable.

To allow sorting of rows and columns, all operations access cell data using unique identifiers for rows and columns, rather than their indexes.

See Also:
Serialized Form

Field Summary
protected  com.borland.dx.dataset.DataSet dataSet
           
protected  com.borland.dx.dataset.DataSetView dataSetView
           
protected  boolean eventsOriginallyOn
           
 
Fields inherited from class com.klg.jclass.datasource.IdeDataTable
bookmarkOfLastRowAdded, ideRowIndexToBookmarkMap
 
Fields inherited from class com.klg.jclass.datasource.BaseDataTable
bookmark, currentColumn, cursor, eventQueue, initialHashtableSize, insertedRows, internalData, logicallyDeletedRows, metaData, parentRow, rowCaches, rowIndexBeforeEvent, store, updatedRows, userData
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Fields inherited from interface com.klg.jclass.datasource.DataTableModel
COMMITTED, CURSOR_BEFORE_FIRST, DELETED, INSERTED, NONEXISTENT, ROOT_BOOKMARK, ROW_NOT_FOUND, UPDATED
 
Constructor Summary
DataTable(com.klg.jclass.datasource.jbuilder.MetaData metaData, com.borland.dx.dataset.DataSet dataSet)
           
DataTable(com.klg.jclass.datasource.jbuilder.MetaData metaData, com.borland.dx.dataset.DataSet dataSet, long parentRow)
           
 
Method Summary
 long addRow(com.klg.jclass.datasource.DataModelListener originator)
          Adds a row, overrides BaseDataTable.addRow().
 void cancelRowChanges(com.klg.jclass.datasource.DataModelListener originator, long bookmark)
          Override BaseDataTable.cancelRowChanges.
 boolean commitRow(com.klg.jclass.datasource.DataModelListener originator, long bookmark)
          Commits the row.
 void copyTable()
           
 void deleteRow(com.klg.jclass.datasource.DataModelListener originator, long bookmark)
          Deletes a row.
 Object[] duplicateRow(int rowIndex)
          Duplicate a row.
 Object getCell2(long bookmark, String column_id)
          Duplicate a row.
 com.klg.jclass.datasource.DataTableModel materializeTable(com.klg.jclass.datasource.DataModelListener originator, long bookmark, TreeNode childMetaDataModel)
          Called by DataTableModel.createTable to create a new table based on the input criteria.
 void moveToRow(long bookmark)
          Makes "bookmark" the new current row.
 void refreshRow(long bookmark)
          Re-reads a row from the originating data source.
 com.klg.jclass.datasource.DataTableModel requeryLevel()
          For internal use, do not use.
 void rollbackTransaction()
          Rolls back the transaction.
 void saveRow(long bookmark)
          Saves row changes to originating data source.
 void setValueAt(long bookmark, String col_id, Object value)
          For internal use only.
 
Methods inherited from class com.klg.jclass.datasource.IdeDataTable
addRow2, afterChangeOfRowData, afterDeleteRow, afterInsertRow, afterMoveToCurrentRow, afterRequeryRowAndDetails, afterRequeryTable, afterReset, beforeCancelAll, beforeCancelRowChanges, beforeCommitAll, beforeCommitConditional, beforeCommitRow, beforeDeleteRow, beforeDeleteTable, beforeEditCell, beforeInsertRow, beforeMoveToCurrentRow, beforeRequery, beforeReset, beginEvents, commitRow2, deleteRow2, endEvents, getBookmarkFromIdeIndex, initialize, originatorNavigateRow, removeRowFromIdeMap, requeryFromIdeDataSource, requeryRowAndDetails, setValueAt2
 
Methods inherited from class com.klg.jclass.datasource.BaseDataTable
absolute, addInternalRow, addInternalRow, addRow, addRow, addRow, afterLast, beforeFirst, cancelAllRowChanges, cancelChanges, clearEventQueue, cloneRow, columnModified, commitAll, commitSubTree, conditionallyCommitYourselfAndChildren, createDataTableModelFromProviderData, createNewRow, createTable, deleteCacheChildren, fireDataModelEvent, fireOriginatorDataModelEvent, first, getAncestors, getCell, getCurrentBookmark, getCursor, getDeletedRow, getDeletedRowBookmarks, getInsertedRowBookmarks, getInternalData, getMetaData, getNextBookmark, getOriginalRow, getParentBookmark, getResultData, getRootAncestorBookmark, getRowCount, getRowFromCache, getRowIdentifier, getRowIndex, getRowStatus, getTable, getUpdatedRowBookmarks, getUserData, hasValueChanged, isAfterLast, isBeforeFirst, isModified, isSubTreeModified, isTableOrChildrenModified, last, moveCursorToRow, next, originalCellWasNull, prepareCellUpdate, previous, processEventQueue, recursivelyDeleteChildren, relative, removeRowFromInsertedTable, removeRowFromLogicallyDeletedTable, removeRowFromOriginalRowTable, removeRowFromUpdatedTable, requeryRow, requeryTable, restoreRow, setInternalData, setRowDirty, setUserData, tableIsAncestor, updateCell
 
Methods inherited from class com.klg.jclass.datasource.DataSourceTreeNode
getChildren, getFirstChild, getIterator, getIterator, getIterator, getIterator, getLastChild, getNextChild, getPreviousChild, hasChildren, insert, isChildOf, toString
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstLeaf, getIndex, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.klg.jclass.datasource.DataTableModel
absolute, addRow, addRow, addRow, afterLast, beforeFirst, cancelAllRowChanges, clearEventQueue, commitAll, commitSubTree, conditionallyCommitYourselfAndChildren, createNewRow, createTable, deleteCacheChildren, first, getAncestors, getCurrentBookmark, getCursor, getDeletedRowBookmarks, getInsertedRowBookmarks, getInternalData, getMetaData, getParentBookmark, getResultData, getRootAncestorBookmark, getRowCount, getRowIdentifier, getRowIndex, getRowStatus, getTable, getUpdatedRowBookmarks, getUserData, isAfterLast, isBeforeFirst, isModified, isSubTreeModified, isTableOrChildrenModified, last, moveCursorToRow, next, previous, processEventQueue, relative, requeryRow, requeryTable, setInternalData, setUserData, tableIsAncestor, updateCell
 

Field Detail

dataSet

protected com.borland.dx.dataset.DataSet dataSet

dataSetView

protected com.borland.dx.dataset.DataSetView dataSetView

eventsOriginallyOn

protected boolean eventsOriginallyOn
Constructor Detail

DataTable

public DataTable(com.klg.jclass.datasource.jbuilder.MetaData metaData,
                 com.borland.dx.dataset.DataSet dataSet,
                 long parentRow)

DataTable

public DataTable(com.klg.jclass.datasource.jbuilder.MetaData metaData,
                 com.borland.dx.dataset.DataSet dataSet)
Method Detail

copyTable

public void copyTable()

duplicateRow

public Object[] duplicateRow(int rowIndex)
                      throws DataModelException
Duplicate a row.

Throws:
DataModelException - If duplicate fails.

getCell2

public Object getCell2(long bookmark,
                       String column_id)
                throws DataModelException
Duplicate a row.

Throws:
DataModelException - If get fails.

materializeTable

public com.klg.jclass.datasource.DataTableModel materializeTable(com.klg.jclass.datasource.DataModelListener originator,
                                                                 long bookmark,
                                                                 TreeNode childMetaDataModel)
                                                          throws DataModelException
Called by DataTableModel.createTable to create a new table based on the input criteria.

Specified by:
materializeTable in interface DataTableAbstractionLayer
Overrides:
materializeTable in class BaseDataTable
Parameters:
originator - the DataModelListener which initiated this action
bookmark - a long which uniquely identifies a row
childMetaDataModel - a MetaDataModel, this tells this table what structure the child table it is creating should have
Throws:
DataModelException - If materializeTable fails.

moveToRow

public void moveToRow(long bookmark)
               throws DataModelException
Makes "bookmark" the new current row.

Specified by:
moveToRow in interface DataTableModel
Overrides:
moveToRow in class BaseDataTable
Parameters:
bookmark - an int, unique row identifier
Throws:
DataModelException - If move fails.

addRow

public long addRow(com.klg.jclass.datasource.DataModelListener originator)
            throws DataModelException
Adds a row, overrides BaseDataTable.addRow().

All we do here is call the ide add row, for this will generate an ide add row event, which will cause us to add a row our data model. Avoids double adds.

Adds a blank row into which the user can input column data. The record is appended to this ResultSet. The record is saved to datasource when the user commits the surrounding transaction. * @param originator the DataModelListener which initiated this action

Specified by:
addRow in interface DataTableModel
Overrides:
addRow in class BaseDataTable
Parameters:
originator - the DataModelListener which initiated this action
Throws:
DataModelException - If row fails to be added.

deleteRow

public void deleteRow(com.klg.jclass.datasource.DataModelListener originator,
                      long bookmark)
               throws DataModelException
Description copied from interface: DataTableModel
Deletes a row. Logically deletes a row by setting its status to DELETED. Will be deleted permanently upon commit, or restored on rollback.

Specified by:
deleteRow in interface DataTableModel
Overrides:
deleteRow in class BaseDataTable
Parameters:
originator - the DataModelListener which initiated this action
bookmark - a unique long indicating the row to be deleted.
Throws:
DataModelException - If the row can't be deleted.

commitRow

public boolean commitRow(com.klg.jclass.datasource.DataModelListener originator,
                         long bookmark)
                  throws DataModelException
Description copied from interface: DataTableModel
Commits the row. Writes the row (new and/or modified) to the data source. Calls saveRow(), an implmentation specific method to save a row to the data source.

Specified by:
commitRow in interface DataTableModel
Overrides:
commitRow in class BaseDataTable
Parameters:
originator - the DataModelListener which initiated this action
bookmark - a unique long indicating which row to commit to the datasource.
Returns:
true if commit succeeds, false if it fails or was cancelled.
Throws:
DataModelException - If the row can't be committed.
See Also:
DataTableAbstractionLayer.saveRow(long)

saveRow

public void saveRow(long bookmark)
Saves row changes to originating data source. Called by BaseDataTable.commitRow().

Specified by:
saveRow in interface DataTableAbstractionLayer
Overrides:
saveRow in class BaseDataTable
Parameters:
bookmark - a unique long indicating which row to commit to the datasource.
See Also:
BaseDataTable.commitRow(com.klg.jclass.datasource.DataModelListener, long)

rollbackTransaction

public void rollbackTransaction()
Rolls back the transaction. Request rollback of the transaction surrounding these changes. This method will be called by cancelRowChanges if the commit policy is on a per row basis, or by cancelAllRowChanges if the policy is on multiple rows or manual. The transaction will only be rolled back if there are no other pending changes in the transaction. No explicit "begin" is required since the SQL Standard implicitly starts a "begin" when any change is made.


refreshRow

public void refreshRow(long bookmark)
                throws DataModelException
Re-reads a row from the originating data source.

Specified by:
refreshRow in interface DataTableAbstractionLayer
Overrides:
refreshRow in class BaseDataTable
Parameters:
bookmark - a long which uniquely identifies a row
Throws:
DataModelException - If requery from server fails.
See Also:
DataTableModel.requeryRow(com.klg.jclass.datasource.DataModelListener, long)

setValueAt

public void setValueAt(long bookmark,
                       String col_id,
                       Object value)
                throws DataModelException
For internal use only. Call DataTableModel.updateCell(..) instead. Changes the value of an existing cell. Called by updateCell.

Specified by:
setValueAt in interface DataTableAbstractionLayer
Overrides:
setValueAt in class BaseDataTable
Throws:
DataModelException - If setValueAt fails.
See Also:
DataTableModel.updateCell(com.klg.jclass.datasource.DataModelListener, long, java.lang.String, java.lang.Object)

cancelRowChanges

public void cancelRowChanges(com.klg.jclass.datasource.DataModelListener originator,
                             long bookmark)
                      throws DataModelException
Override BaseDataTable.cancelRowChanges. Cancels uncommited row changes. Restore original cell values for this row.

Specified by:
cancelRowChanges in interface DataTableModel
Overrides:
cancelRowChanges in class BaseDataTable
Parameters:
originator - the DataModelListener which initiated this action
bookmark - a unique long which identifies this row
Throws:
DataModelException - If the changes can't be canceled.
See Also:
DataTableAbstractionLayer.restoreRow(long), DataTableModel.requeryRow(com.klg.jclass.datasource.DataModelListener, long)

requeryLevel

public com.klg.jclass.datasource.DataTableModel requeryLevel()
                                                      throws DataModelException
For internal use, do not use. Requery the root table.

Specified by:
requeryLevel in interface DataTableModel
Overrides:
requeryLevel in class BaseDataTable
Returns:
this data table model
Throws:
DataModelException - If requery fails.

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