JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.higrid
Class SummaryDataTable

java.lang.Object
  |
  +--javax.swing.tree.DefaultMutableTreeNode
        |
        +--com.klg.jclass.datasource.DataSourceTreeNode
              |
              +--com.klg.jclass.higrid.SummaryDataTable
All Implemented Interfaces:
Cloneable, DataTableModel, MutableTreeNode, Serializable, TreeNode

public class SummaryDataTable
extends DataSourceTreeNode
implements DataTableModel

The data table for a summary row type.

See Also:
Serialized Form

Field Summary
protected  int initialHashtableSize
           
protected  Hashtable internalData
           
 
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
SummaryDataTable(com.klg.jclass.datasource.MetaDataModel footerMetaData, com.klg.jclass.datasource.MetaDataModel beforeDetailsMetaData, com.klg.jclass.datasource.MetaDataModel afterDetailsMetaData)
          SummaryDataTable Constructor.
 
Method Summary
 void absolute(int ordinal_position)
          Move the cursor to this ordinal position.
 long addRow(com.klg.jclass.datasource.DataModelListener originator)
          Adds a row whose status will be INSERTED.
 long addRow(com.klg.jclass.datasource.DataModelListener originator, Object row)
          Adds a populated row whose status will be INSERTED.
 long addRow(com.klg.jclass.datasource.DataModelListener originator, Object row, int status)
          Adds a populated row whose status will be 'status'.
 long addRow(com.klg.jclass.datasource.DataModelListener originator, Object row, int status, int ordinal)
          Adds a populated row whose status will be 'status'.
 void afterLast()
          Position the cursor after the last row.
protected  void aggregateRowNode(com.klg.jclass.higrid.RowNode rootNode, com.klg.jclass.higrid.Aggregate aggregate, com.klg.jclass.higrid.HiGrid grid)
          Perform the aggregation as the data tables are traversed.
 void beforeFirst()
          Position the cursor before the first row.
 void cancelAllRowChanges(com.klg.jclass.datasource.DataModelListener originator)
          Cancel all uncommited rows.
 void cancelRowChanges(com.klg.jclass.datasource.DataModelListener originator, long bookmark)
          Cancel uncommitted row changes.
 void clearEventQueue()
          Recursively clear pending events from a transaction.
 void commitAll(com.klg.jclass.datasource.DataModelListener originator)
          Commit all uncommitted rows.
 boolean commitRow(com.klg.jclass.datasource.DataModelListener originator, long bookmark)
          Commit row.
 void commitSubTree(com.klg.jclass.datasource.DataModelListener originator, long subTreeRootBookmark)
          Commit all pending changes in this subtree.
 void conditionallyCommitYourselfAndChildren(com.klg.jclass.datasource.DataModelListener originator)
          Recurse on this node and each of its children and commit all changes in each if commitPolicy does not equal COMMIT_MANUALLY
 Object createNewRow()
          Creates a new (blank) row that can be used as an argument to one of the addRow() methods.
 com.klg.jclass.datasource.DataTableModel createTable(com.klg.jclass.datasource.DataModelListener originator, long bookmark, TreeNode node)
          Create and return the DataTable which corresponds to the specifed row of this parent for the indicated child MetaData object.
 void deleteCacheChildren(com.klg.jclass.datasource.DataModelListener originator)
          Deletes the subtree of DataTables rooted with this DataTable as its root.
 void deleteRow(com.klg.jclass.datasource.DataModelListener originator, long bookmark)
          Delete a row.
 boolean first()
          Position this table's cursor on the first row.
 void getAncestors(Vector ancestors)
          Return a list of this DataTable's ancestor bookmarks.
protected  com.klg.jclass.higrid.SummaryData getCachedData(int rowIndex, String name)
          Retrieves the cached data for display.
protected  String getCachedDataID(int rowIndex, String name, com.klg.jclass.higrid.RowNode rowNode)
          Retrieves the cached data id.
 long getCurrentBookmark()
          Return the bookmark of the current row.
 int getCursor()
          Gets the cursor of the data table model.
protected  com.klg.jclass.higrid.RowNode getDataSourceRowNode(int metaID, com.klg.jclass.datasource.DataTableModel dataTable, com.klg.jclass.higrid.RowNode rowNode)
          Retrieves the record row node with a data table for the given meta id.
 long[] getDeletedRowBookmarks()
          Return a long array of logically deleted row bookmarks.
 long[] getInsertedRowBookmarks()
          Return a long array of inserted row bookmarks.
 Object getInternalData(Object user)
          For internal use only.
 com.klg.jclass.datasource.MetaDataModel getMetaData()
          Return the MetaDataModel for this table.
 long getParentBookmark()
          Return the parent row for this table.
 Object getResultData(com.klg.jclass.higrid.HiGrid grid, com.klg.jclass.datasource.DataTableModel dataTable, com.klg.jclass.higrid.RowFormat rowFormat, com.klg.jclass.higrid.RowNode rowNode, String name)
          Return a value for given summary column identifier.
protected  Object getResultData(com.klg.jclass.higrid.HiGrid grid, com.klg.jclass.datasource.DataTableModel dataTable, com.klg.jclass.higrid.RowFormat rowFormat, com.klg.jclass.higrid.RowNode rowNode, String name, boolean checkChanged)
          Helper method to support both isResultDataChanged() and getResultData().
 Object getResultData(long bookmark, String column_identifer)
          Return a value for given row_identifier/column_identifier.
 long getRootAncestorBookmark(long bookmark)
          Recurse up the tree and determine the row number of your ultimate ancestor.
 int getRowCount()
          Return the number of rows in this DataTable.
 long getRowIdentifier(int row)
          Return an int which will uniquely identify this row.
 int getRowIndex(long bookmark)
          Given a bookmark, return the zero-relative row index in this table
 int getRowStatus(long bookmark)
          Return the status of a row, will be one of INSERTED, UPDATED, DELETED, COMMITTED.
protected  int getSummaryRow(com.klg.jclass.higrid.RowFormat rowFormat)
          Return the summary row index given the row format type.
 com.klg.jclass.datasource.DataTableModel getTable(long bookmark, TreeNode node)
          Search the existing children of this node for a child node which matches the input criteria.
 long[] getUpdatedRowBookmarks()
          Return a long array of updated row bookmarks.
 Object getUserData(Object user)
          Gets user data.
 boolean isAfterLast()
          Return true if the cursor is positioned afte the last row.
 boolean isBeforeFirst()
          Return true if the cursor is positioned before first row.
 boolean isModified()
          Does this DataTableModel contain any pending inserts, updates or deletes?
protected  boolean isResultDataChanged(com.klg.jclass.higrid.HiGrid grid, com.klg.jclass.datasource.DataTableModel dataTable, com.klg.jclass.higrid.RowFormat rowFormat, com.klg.jclass.higrid.RowNode rowNode, String name)
          Determine if the summary row data has changed in value.
 boolean isSubTreeModified(long subTreeRootBookmark)
          Does the subtree rooted at subTreeRootBookmark contain modified nodes? Modified means it has pending insert, update or delete changes.
 boolean isTableOrChildrenModified()
          Are there any modifications to this table or any of its child nodes?
 boolean last()
          Position this table's cursor on the last row.
 void moveCursorToRow(long bookmark)
          Move the cursor to the row indicated by the bookmark.
 void moveToRow(long bookmark)
          Internal method, do not use.
 boolean next()
          Advance the cursor by one row.
 boolean previous()
          Position this table's cursor to the previous row.
 void processEventQueue(com.klg.jclass.datasource.DataModelListener originator)
          Recursively process pending events from a transaction
 void relative(int rows)
          Move the cursor forward or backward by "n" rows from the current position.
 com.klg.jclass.datasource.DataTableModel requeryLevel()
          Requery a DataTable.
 void requeryRow(com.klg.jclass.datasource.DataModelListener originator, long bookmark)
          Re-reads a row from the originating data source.
 void requeryRowAndDetails(com.klg.jclass.datasource.DataModelListener originator, long bookmark)
          Requery a DataTable row and all children.
 void requeryTable(com.klg.jclass.datasource.DataModelListener originator)
          Requery all rows in this table and collapse its child nodes.
protected  void resetSummaryDataTables(boolean clearCachedData)
          Reset the summary data tables to remove all cached data.
protected  void resetSummaryRow(Vector summaryRow)
           
 void rollbackTransaction()
          Rollback transaction.
protected  void setCachedData(int rowIndex, String name, Object object)
          Stores the cached data for display.
 void setInternalData(Object user, Object data)
          For internal use only.
 void setUserData(Object user, Object data)
          Sets user data.
 boolean tableIsAncestor(com.klg.jclass.datasource.DataTableModel table2)
          Given a DataTable, returns whether it is an ancestor of (or equal to) itself
 void updateCell(com.klg.jclass.datasource.DataModelListener originator, long bookmark, String column_identifer, Object value)
          Update a cell.
 
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
 

Field Detail

internalData

protected Hashtable internalData

initialHashtableSize

protected int initialHashtableSize
Constructor Detail

SummaryDataTable

public SummaryDataTable(com.klg.jclass.datasource.MetaDataModel footerMetaData,
                        com.klg.jclass.datasource.MetaDataModel beforeDetailsMetaData,
                        com.klg.jclass.datasource.MetaDataModel afterDetailsMetaData)
SummaryDataTable Constructor.

Parameters:
footerMetaData - The Footer MetaData for this data table.
beforeDetailsMetaData - The BeforeDetails MetaData for this data table.
afterDetailsMetaData - The AfterDetails MetaData for this data table.
Method Detail

resetSummaryDataTables

protected void resetSummaryDataTables(boolean clearCachedData)
Reset the summary data tables to remove all cached data.

Parameters:
clearCachedData - True if the cached data are to be removed.

resetSummaryRow

protected void resetSummaryRow(Vector summaryRow)

isResultDataChanged

protected boolean isResultDataChanged(com.klg.jclass.higrid.HiGrid grid,
                                      com.klg.jclass.datasource.DataTableModel dataTable,
                                      com.klg.jclass.higrid.RowFormat rowFormat,
                                      com.klg.jclass.higrid.RowNode rowNode,
                                      String name)
Determine if the summary row data has changed in value.

Parameters:
grid - The HiGrid.
rowFormat - The row format for this row.
dataTable - The record type data table.
rowNode - The row node of this row.
name - The summary column identifier.
Returns:
True if a value has changed in the summary row.

getResultData

public Object getResultData(com.klg.jclass.higrid.HiGrid grid,
                            com.klg.jclass.datasource.DataTableModel dataTable,
                            com.klg.jclass.higrid.RowFormat rowFormat,
                            com.klg.jclass.higrid.RowNode rowNode,
                            String name)
Return a value for given summary column identifier.

Parameters:
grid - The HiGrid.
rowFormat - The row format for this row.
dataTable - The record type data table.
rowNode - The row node of this row.
name - The summary column identifier.
Returns:
The Object in the specified cell.

getResultData

protected Object getResultData(com.klg.jclass.higrid.HiGrid grid,
                               com.klg.jclass.datasource.DataTableModel dataTable,
                               com.klg.jclass.higrid.RowFormat rowFormat,
                               com.klg.jclass.higrid.RowNode rowNode,
                               String name,
                               boolean checkChanged)
Helper method to support both isResultDataChanged() and getResultData().

Parameters:
grid - The HiGrid.
rowFormat - The row format for this row.
dataTable - The record type data table.
rowNode - The row node of this row.
name - The summary column identifier.
checkChanged - True if result data changed is to be check.
Returns:
If checkChanged, a null object indicates no changes. If not checkChanged, returns the actual data object.

getSummaryRow

protected int getSummaryRow(com.klg.jclass.higrid.RowFormat rowFormat)
Return the summary row index given the row format type.

Parameters:
rowFormat - The row format.
Returns:
The summary row index.

getCachedDataID

protected String getCachedDataID(int rowIndex,
                                 String name,
                                 com.klg.jclass.higrid.RowNode rowNode)
Retrieves the cached data id.

Parameters:
rowIndex - The row index for the summary data table.
name - The column identifier.
rowNode - The summary row node.
Returns:
The cached data id.

getCachedData

protected com.klg.jclass.higrid.SummaryData getCachedData(int rowIndex,
                                                          String name)
Retrieves the cached data for display.

Parameters:
rowIndex - The row index for the summary data table.
name - The cached data identifier.
Returns:
The cached summary data.

setCachedData

protected void setCachedData(int rowIndex,
                             String name,
                             Object object)
Stores the cached data for display.

Parameters:
rowIndex - The row index for the summary data table.
name - The cached data identifier.
object - The data object.

getDataSourceRowNode

protected com.klg.jclass.higrid.RowNode getDataSourceRowNode(int metaID,
                                                             com.klg.jclass.datasource.DataTableModel dataTable,
                                                             com.klg.jclass.higrid.RowNode rowNode)
Retrieves the record row node with a data table for the given meta id. This is for the non aggregated data source type.

Parameters:
metaID - The meta id of the meta table associated with the data table
dataTable - The current level data table.
rowNode - The row node of the current level.
Returns:
The row node found.

aggregateRowNode

protected void aggregateRowNode(com.klg.jclass.higrid.RowNode rootNode,
                                com.klg.jclass.higrid.Aggregate aggregate,
                                com.klg.jclass.higrid.HiGrid grid)
Perform the aggregation as the data tables are traversed.

Parameters:
rootNode - The starting root row node.
aggregate - The aggregate interface.

getRowCount

public int getRowCount()
Return the number of rows in this DataTable.

Specified by:
getRowCount in interface DataTableModel

getRowStatus

public int getRowStatus(long bookmark)
Return the status of a row, will be one of INSERTED, UPDATED, DELETED, COMMITTED.

Specified by:
getRowStatus in interface DataTableModel
Parameters:
bookmark - a long which uniquely identifies this row
Returns:
an int row status, will be one of INSERTED, UPDATED, DELETED, COMMITTED.

getRowIdentifier

public long getRowIdentifier(int row)
Return an int which will uniquely identify this row. Facilitates sorting: index changes, identifier remains constant.

Specified by:
getRowIdentifier in interface DataTableModel
Returns:
a unique long to identify this row from now on

getResultData

public Object getResultData(long bookmark,
                            String column_identifer)
                     throws DataModelException
Return a value for given row_identifier/column_identifier.

Specified by:
getResultData in interface DataTableModel
Parameters:
bookmark - a long which uniquely identifies this row
Returns:
the Object in the specified cell
Throws:
DataModelException - If getResultData() fails.

createTable

public com.klg.jclass.datasource.DataTableModel createTable(com.klg.jclass.datasource.DataModelListener originator,
                                                            long bookmark,
                                                            TreeNode node)
                                                     throws DataModelException
Create and return the DataTable which corresponds to the specifed row of this parent for the indicated child MetaData object. Always returns a non-null DataTable.

Specified by:
createTable in interface DataTableModel
Parameters:
bookmark - a long which uniquely identifies a row
originator - the DataModelListener which initiated this action
Returns:
the child DataTableModel of results
Throws:
DataModelException - If createTable() fails.
See Also:
getTable(long, javax.swing.tree.TreeNode)

getTable

public com.klg.jclass.datasource.DataTableModel getTable(long bookmark,
                                                         TreeNode node)
Search the existing children of this node for a child node which matches the input criteria. Return that node if it exists, null otherwise.

Specified by:
getTable in interface DataTableModel
Parameters:
bookmark - a long which uniquely identifies a row
Returns:
the DataTable with matching bookmark and MetaDataModel otherwise, null.
See Also:
createTable(com.klg.jclass.datasource.DataModelListener, long, javax.swing.tree.TreeNode)

getMetaData

public com.klg.jclass.datasource.MetaDataModel getMetaData()
Return the MetaDataModel for this table.

Specified by:
getMetaData in interface DataTableModel
Returns:
the MetaDataModel Object for this table

getParentBookmark

public long getParentBookmark()
Return the parent row for this table. This is the immediate parent of this table.

Specified by:
getParentBookmark in interface DataTableModel
Returns:
the bookmark of the parent row for this DataTable
See Also:
getRootAncestorBookmark(long), getAncestors(java.util.Vector)

deleteRow

public void deleteRow(com.klg.jclass.datasource.DataModelListener originator,
                      long bookmark)
               throws DataModelException
Delete 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
Parameters:
bookmark - a unique long indicating the row to be deleted.
originator - the DataModelListener which initiated this action
Throws:
DataModelException - If logical delete fails.

updateCell

public void updateCell(com.klg.jclass.datasource.DataModelListener originator,
                       long bookmark,
                       String column_identifer,
                       Object value)
                throws DataModelException
Update a cell. User has modified a cell. Call this method to inform this data source of that change. This method will then fire a DataTableEvent to inform listeners about this change. Internally a copy of the original row will be maintained which can be used if an update is cancelled. This row's status is set to UPDATED.

Specified by:
updateCell in interface DataTableModel
Parameters:
bookmark - a unique long indicating in which row the change was made
column_identifer - a unique String indicating in which column the change occurred.
value - the Object to be placed in the cell
originator - the DataModelListener which initiated this action
Throws:
DataModelException - If error occurs updating a cell.
See Also:
DataTableAbstractionLayer.setValueAt(long, java.lang.String, java.lang.Object)

commitRow

public boolean commitRow(com.klg.jclass.datasource.DataModelListener originator,
                         long bookmark)
                  throws DataModelException
Commit row. Write row (new and/or modified) to datasource.

Specified by:
commitRow in interface DataTableModel
Parameters:
bookmark - a unique long indicating which row to commit to the datasource.
originator - the DataModelListener which initiated this action
Returns:
true if the commit succeeded, false if failed or was cancelled.
Throws:
DataModelException - If commit fails.
See Also:
DataTableAbstractionLayer.saveRow(long)

commitAll

public void commitAll(com.klg.jclass.datasource.DataModelListener originator)
               throws DataModelException
Commit all uncommitted rows. Call commitRow for each new and/or modified row in this DataTable.

Specified by:
commitAll in interface DataTableModel
Parameters:
originator - the DataModelListener which initiated this action
Throws:
DataModelException - If any row fails to commit.
See Also:
DataModel.updateAll(com.klg.jclass.datasource.DataModelListener)

conditionallyCommitYourselfAndChildren

public void conditionallyCommitYourselfAndChildren(com.klg.jclass.datasource.DataModelListener originator)
Recurse on this node and each of its children and commit all changes in each if commitPolicy does not equal COMMIT_MANUALLY

Specified by:
conditionallyCommitYourselfAndChildren in interface DataTableModel
Parameters:
originator - the DataModelListener which initiated this action

cancelRowChanges

public void cancelRowChanges(com.klg.jclass.datasource.DataModelListener originator,
                             long bookmark)
                      throws DataModelException
Cancel uncommitted row changes. Restore original cell values for this row, or if a new row remove it.

Specified by:
cancelRowChanges in interface DataTableModel
Parameters:
bookmark - a unique long indicating which row to uncommit.
originator - the DataModelListener which initiated this action
Throws:
DataModelException - If an exception occurs while canceling uncommitted rows.
See Also:
DataTableAbstractionLayer.restoreRow(long), DataTableModel.requeryRow(com.klg.jclass.datasource.DataModelListener, long)

cancelAllRowChanges

public void cancelAllRowChanges(com.klg.jclass.datasource.DataModelListener originator)
                         throws DataModelException
Cancel all uncommited rows. Restore original cell values for each uncommited row, for new rows remove them. Calls cancelRow for each uncommited row.

Specified by:
cancelAllRowChanges in interface DataTableModel
Parameters:
originator - the DataModelListener which initiated this action
Throws:
DataModelException - If an exception occurs while canceling uncommitted rows.

rollbackTransaction

public void rollbackTransaction()
Rollback 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.


getRootAncestorBookmark

public long getRootAncestorBookmark(long bookmark)
Recurse up the tree and determine the row number of your ultimate ancestor.

Specified by:
getRootAncestorBookmark in interface DataTableModel
Parameters:
bookmark - a unique long for which the ultimate ancestor bookmark is to be determined
Returns:
a long indicating the bookmark of this DataTable's ultimate ancestor.
See Also:
getAncestors(java.util.Vector)

getAncestors

public void getAncestors(Vector ancestors)
Return a list of this DataTable's ancestor bookmarks. The list is ordered from the root ancestor down to the node above this one.

Specified by:
getAncestors in interface DataTableModel
Parameters:
ancestors - the Vector to be populated with ancestor bookmarks
Returns:
a Vector of ancestor bookmarks.

requeryRowAndDetails

public void requeryRowAndDetails(com.klg.jclass.datasource.DataModelListener originator,
                                 long bookmark)
                          throws DataModelException
Requery a DataTable row and all children. Calls requeryRow() then requeryLevel. Refetches all rows in this DataTable from the originating data source. Then does the same for each of this row's children.

Specified by:
requeryRowAndDetails in interface DataTableModel
Parameters:
originator - the DataModelListener which initiated this action
Returns:
this data table model
Throws:
DataModelException - If requery from server fails.

requeryRow

public void requeryRow(com.klg.jclass.datasource.DataModelListener originator,
                       long bookmark)
                throws DataModelException
Description copied from interface: DataTableModel
Re-reads a row from the originating data source. Calls refreshRow(bookmark), the implementation specific method to refresh a row.

Specified by:
requeryRow in interface DataTableModel
Parameters:
originator - the DataModelListener which initiated this action
bookmark - a long which uniquely identifies a row
Throws:
DataModelException - If requery from server fails.

requeryLevel

public com.klg.jclass.datasource.DataTableModel requeryLevel()
Requery a DataTable. An implementation specific method for cloning rows, must be implemented in the derived class of BaseDataTable. Refetches all rows in this DataTable from the originating data source.

Specified by:
requeryLevel in interface DataTableModel
Returns:
this data table model

first

public boolean first()
Position this table's cursor on the first row.

Specified by:
first in interface DataTableModel

last

public boolean last()
Position this table's cursor on the last row.

Specified by:
last in interface DataTableModel

next

public boolean next()
Advance the cursor by one row. Return true if there was a row to move forward to.

Specified by:
next in interface DataTableModel
Returns:
true if move to next row succeeded.

previous

public boolean previous()
Position this table's cursor to the previous row. Return true if the move succeeds.

Specified by:
previous in interface DataTableModel

beforeFirst

public void beforeFirst()
Position the cursor before the first row.

Specified by:
beforeFirst in interface DataTableModel

afterLast

public void afterLast()
Position the cursor after the last row.

Specified by:
afterLast in interface DataTableModel

isBeforeFirst

public boolean isBeforeFirst()
Return true if the cursor is positioned before first row.

Specified by:
isBeforeFirst in interface DataTableModel
Returns:
true if cursor is positioned before first row, false otherwise.

isAfterLast

public boolean isAfterLast()
Return true if the cursor is positioned afte the last row.

Specified by:
isAfterLast in interface DataTableModel
Returns:
true if the cursor is positioned after the last row, false otherwise.
See Also:
DataTableModel.getCurrentBookmark()

relative

public void relative(int rows)
              throws DataModelException
Move the cursor forward or backward by "n" rows from the current position. Positive numbers move forward, negative backwards.

Specified by:
relative in interface DataTableModel
Throws:
DataModelException - If move fails.
See Also:
DataTableModel.getCurrentBookmark()

absolute

public void absolute(int ordinal_position)
              throws DataModelException
Move the cursor to this ordinal position. Ordinal positions start at 1.

Specified by:
absolute in interface DataTableModel
Parameters:
ordinal_position - an int indicating to which row to move.
Throws:
DataModelException - If the operation fails.
See Also:
DataTableModel.getCurrentBookmark()

getCurrentBookmark

public long getCurrentBookmark()
Return the bookmark of the current row.

Specified by:
getCurrentBookmark in interface DataTableModel
Returns:
the bookmark of the current row.
See Also:
DataTableModel.first(), DataTableModel.last(), DataTableModel.next(), DataTableModel.previous(), DataTableModel.beforeFirst(), DataTableModel.afterLast(), DataTableModel.isBeforeFirst(), DataTableModel.isAfterLast(), DataTableModel.relative(int), DataTableModel.absolute(int), DataModel.moveToRow(com.klg.jclass.datasource.DataModelListener, com.klg.jclass.datasource.DataTableModel, long)

getUserData

public Object getUserData(Object user)
Gets user data. Return the Object which was arbitrarily associated with this table.

Specified by:
getUserData in interface DataTableModel
Parameters:
user - an Object, a reference to the user.
Returns:
the user Object associated with this table.

setUserData

public void setUserData(Object user,
                        Object data)
Sets user data. Allow users to augment this table by associating an arbitrary Object reference with it.

Specified by:
setUserData in interface DataTableModel
Parameters:
user - an Object, a reference to the user.
data - an Object, an arbitrary reference to an Object.

processEventQueue

public void processEventQueue(com.klg.jclass.datasource.DataModelListener originator)
                       throws DataModelException
Recursively process pending events from a transaction

Specified by:
processEventQueue in interface DataTableModel
Parameters:
originator - the DataModelListener which initiated this action
Throws:
DataModelException - If an exception occurs while processing.

clearEventQueue

public void clearEventQueue()
Recursively clear pending events from a transaction. Called when an exception occurs. Events are not dispatched they are simply deleted.

Specified by:
clearEventQueue in interface DataTableModel

moveCursorToRow

public void moveCursorToRow(long bookmark)
                     throws DataModelException
Move the cursor to the row indicated by the bookmark.

Specified by:
moveCursorToRow in interface DataTableModel
Parameters:
bookmark - a long which uniquely identifies a row
Throws:
DataModelException - If move fails.

getCursor

public int getCursor()
Gets the cursor of the data table model.

Specified by:
getCursor in interface DataTableModel

getRowIndex

public int getRowIndex(long bookmark)
Given a bookmark, return the zero-relative row index in this table

Specified by:
getRowIndex in interface DataTableModel
Parameters:
bookmark - a long which uniquely identifies a row
Returns:
rowIndex a int which is the ordinal position of the row in this table

deleteCacheChildren

public void deleteCacheChildren(com.klg.jclass.datasource.DataModelListener originator)
                         throws DataModelException
Deletes the subtree of DataTables rooted with this DataTable as its root.

Specified by:
deleteCacheChildren in interface DataTableModel
Throws:
DataModelException - If an exception occurs while deleting the subtree.
See Also:
MetaDataModel.getCacheChildren()

getInternalData

public Object getInternalData(Object user)
For internal use only. Gets internal data. Return the Object which was arbitrarily associated with this table.

Specified by:
getInternalData in interface DataTableModel
Parameters:
user - an Object, a reference to the user.
Returns:
the internal Object associated with this table.

setInternalData

public void setInternalData(Object user,
                            Object data)
For internal use only. Sets internal data. Allow component writers to augment this table by associating an arbitrary Object reference with it.

Specified by:
setInternalData in interface DataTableModel
Parameters:
user - an Object, a reference to the user.
data - an Object, an arbitrary reference to an Object.

moveToRow

public void moveToRow(long bookmark)
Description copied from interface: DataTableModel
Internal method, do not use. Move the ide cursor to this row.

Specified by:
moveToRow in interface DataTableModel
Parameters:
bookmark - a long which uniquely identifies a row.

isSubTreeModified

public boolean isSubTreeModified(long subTreeRootBookmark)
Does the subtree rooted at subTreeRootBookmark contain modified nodes? Modified means it has pending insert, update or delete changes.

Specified by:
isSubTreeModified in interface DataTableModel
Parameters:
subTreeRootBookmark - a long, the bookmark of the row which is the root of the subtree to be checked.
Returns:
true if this subtree contains at least one modified node, false otherwise.

commitSubTree

public void commitSubTree(com.klg.jclass.datasource.DataModelListener originator,
                          long subTreeRootBookmark)
Commit all pending changes in this subtree.

Specified by:
commitSubTree in interface DataTableModel
Parameters:
subTreeRootBookmark - a long, the bookmark of the row which is the root of the subtree to be checked.
originator - the DataModelListener which initiated this action

isModified

public boolean isModified()
Does this DataTableModel contain any pending inserts, updates or deletes?

Specified by:
isModified in interface DataTableModel
Returns:
true if there are pending modifications, false otherwise.

getUpdatedRowBookmarks

public long[] getUpdatedRowBookmarks()
Return a long array of updated row bookmarks. These are the rows which have updates pending.

Specified by:
getUpdatedRowBookmarks in interface DataTableModel
Returns:
a long[] of updated row bookmarks

getInsertedRowBookmarks

public long[] getInsertedRowBookmarks()
Return a long array of inserted row bookmarks. These are the rows which are inserted into the data model, but not yet persisted.

Specified by:
getInsertedRowBookmarks in interface DataTableModel
Returns:
a long[] of inserted row bookmarks

getDeletedRowBookmarks

public long[] getDeletedRowBookmarks()
Return a long array of logically deleted row bookmarks. These are the rows which are logically deleted, but not yet physically deleted from the originating data source.

Specified by:
getDeletedRowBookmarks in interface DataTableModel
Returns:
a long[] of logically deleted row bookmarks

isTableOrChildrenModified

public boolean isTableOrChildrenModified()
Are there any modifications to this table or any of its child nodes?

Specified by:
isTableOrChildrenModified in interface DataTableModel
Returns:
true if there are modifications to this table or any of its child nodes

tableIsAncestor

public boolean tableIsAncestor(com.klg.jclass.datasource.DataTableModel table2)
Given a DataTable, returns whether it is an ancestor of (or equal to) itself

Specified by:
tableIsAncestor in interface DataTableModel
Parameters:
table2 - a DataTable which may be an ancestor
Returns:
true if the table is an ancestor

addRow

public long addRow(com.klg.jclass.datasource.DataModelListener originator)
            throws DataModelException
Adds a row whose status will be INSERTED. 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.

Fires BEFORE_INSERT_ROW and upon a successful row add AFTER_INSERT_ROW.

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

addRow

public long addRow(com.klg.jclass.datasource.DataModelListener originator,
                   Object row,
                   int status)
            throws DataModelException
Adds a populated row whose status will be 'status'. Adds a pre-populated row whose status is dictated by the 'status' parameter.

Fires BEFORE_INSERT_ROW and upon a successful row add AFTER_INSERT_ROW.

Specified by:
addRow in interface DataTableModel
Parameters:
row - an Object as defined by the interface, but used as an array by this implementation.
status - an int, one of,
  • DataTableModel.COMMITTED
  • DataTableModel.DELETED
  • DataTableModel.INSERTED
Throws:
DataModelException - If row fails to be added.

addRow

public long addRow(com.klg.jclass.datasource.DataModelListener originator,
                   Object row)
            throws DataModelException
Adds a populated row whose status will be INSERTED. Adds a pre-populated row. The record is appended to this ResultSet. The record is saved to datasource when the user commits the surrounding transaction.

Fires BEFORE_INSERT_ROW and upon a successful row add AFTER_INSERT_ROW.

Specified by:
addRow in interface DataTableModel
Parameters:
originator - the DataModelListener which initiated this action
row - an Object as defined by the interface, but used as an array by this implementation.
Throws:
DataModelException - If row fails to be added.

addRow

public long addRow(com.klg.jclass.datasource.DataModelListener originator,
                   Object row,
                   int status,
                   int ordinal)
            throws DataModelException
Adds a populated row whose status will be 'status'. Adds a pre-populated row whose status is dictated by the 'status' parameter.

Fires BEFORE_INSERT_ROW and upon a successful row add AFTER_INSERT_ROW.

Specified by:
addRow in interface DataTableModel
Parameters:
row - an Object as defined by the interface, but used as an array by this implementation.
status - an int, one of,
  • DataTableModel.COMMITTED
  • DataTableModel.DELETED
  • DataTableModel.INSERTED
ordinal - the index position into which the row should be inserted
Throws:
DataModelException - If row fails to be added.

createNewRow

public Object createNewRow()
Creates a new (blank) row that can be used as an argument to one of the addRow() methods.

Specified by:
createNewRow in interface DataTableModel
Returns:
an Object which is the new row just added.

requeryTable

public void requeryTable(com.klg.jclass.datasource.DataModelListener originator)
                  throws DataModelException
Requery all rows in this table and collapse its child nodes.

Specified by:
requeryTable in interface DataTableModel
Parameters:
originator - the DataModelListener which initiated this action
Throws:
DataModelException - If requery fails.

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