com.sibvisions.rad.model.mem
Class MemDataBook

java.lang.Object
  extended by com.sibvisions.rad.model.mem.DataRow
      extended by com.sibvisions.rad.model.mem.ChangeableDataRow
          extended by com.sibvisions.rad.model.mem.MemDataBook
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<IDataRow>, IChangeableDataRow, IDataBook, IDataPage, IDataRow, INamedObject
Direct Known Subclasses:
RemoteDataBook

public class MemDataBook
extends ChangeableDataRow
implements IDataBook

The MemDataBook is a storage independent table, and handles all operations to load, save and manipulate table oriented data.
An MemDataBook has at least one MemDataPage to store all DataRow's of this MemDataBook. If an MemDataBook has detail IDataBook's, it handles for each detail IDataBook the IDataPage's. Thats necessary because every change of the selected IDataRow needs to initiate the change of the corresponding details. So the IDataBook adds the appropriate IDataPage's into the detail IDataBook's.
The MemDataBook is also a IChangeableDataRow, the selected row of the MemDataBook.

See Also:
MemDataPage, IDataPage, IDataBook, IRowDefinition, IChangeableDataRow, IDataSource, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.rad.model.IDataBook
IDataBook.SelectionMode, IDataBook.WriteBackIsolationLevel
 
Field Summary
protected  boolean bMemFilter
          Determines if the filter should be made in memory.
protected  boolean bMemSort
          Determines if the sort should be made in memory.
protected  IDataBook rootDataBook
          The root data book.
protected  DataRow rowInstance1
          Optimization for fast row access with singleton instance of data row for search, filter, sort.
protected  DataRow rowInstance2
          Optimization for fast row access with singleton instance of data row for search, filter, sort.
 
Fields inherited from class com.sibvisions.rad.model.mem.ChangeableDataRow
DELETING, DETAILS_CHANGED, dpDataPage, INSERTING, INTERNAL_OFFSET, iRowIndex, UPDATING, WRITABLE_COLUMN_CHANGED
 
Fields inherited from class com.sibvisions.rad.model.mem.DataRow
oaStorage, rdRowDefinition
 
Constructor Summary
MemDataBook()
          Contructs a new MemDataBook with an empty RowDefinition.
MemDataBook(RowDefinition pRowDefinition)
          Constructs a new MemDataBook with the given RowDefinition.
 
Method Summary
 void addControl(IControl pControl)
          Adds the given IControl to this IDataRow as control.
 void addDetailDataBook(IDataBook pDetailDataBook)
          Registers the given IDataBook as a detail IDataBook.
protected  void calculateRow()
          Calculates the given row.
 void cancelEditingControls()
          Informs all registered controls that they should cancel any pending editing operation and revert to the values in this IDataRow.
protected  void clear()
          It clears the AbstractStorage of the MemDataBook.
protected  void clearCurrentDataPage()
          It clears the AbstractStorage of the MemDataBook.
protected  void clearFilterSortInCurrentMemDataPage()
          It clears all mem filter sorts in the MemDataPages.
protected  void clearFilterSortInMemDataPages()
          It clears all mem filter sorts in the MemDataPages.
 void close()
          Closes this IDataBook.
protected  MemDataPage createAndCacheDataPage(IDataRow pMasterDataRow)
          It constructs a new MemDataPage and puts it in the datapage cache.
protected  MemDataPage createDataPage(IDataRow pMasterDataRow)
          It constructs a new MemDataPage.
 IDataRow createDataRow(java.lang.String[] pColumnNames)
          Creates and returns a new IDataRow which only contains the specified columns and their values.
static IReadOnlyChecker createReadOnlyChecker(java.lang.Object pReadOnlyCheckerObject, java.lang.String pMethodName)
          Creates a read only checkerr instance with the given object and method name.
static IRowCalculator createRowCalculator(java.lang.Object pRowCalculatorObject, java.lang.String pMethodName)
          Creates a row calculator instance with the given object and method name.
 void delete()
          Deletes the currently selected row.
 void deleteAllDataRows()
          Deprecated. 
 void deleteAllRows()
          Deletes all IDataRows which are currently available, it is the same as IDataBook.delete() except that it is a mass operation on all rows.
 DataBookHandler eventAfterColumnSelected()
          Gets the DataBookHandler for after column selected event.
 DataBookHandler eventAfterDeleted()
          Gets the DataBookHandler for after deleted event.
 DataBookHandler eventAfterDeleting()
          Gets the DataBookHandler for after deleting event.
 DataBookHandler eventAfterFilterChanged()
          Gets the DataBookHandler for after filter changed event.
 DataBookHandler eventAfterInserted()
          Gets the DataBookHandler for after inserted event.
 DataBookHandler eventAfterInserting()
          Gets the DataBookHandler for after inserting event.
 DataBookHandler eventAfterReload()
          Gets the DataBookHandler for after reload event.
 DataBookHandler eventAfterRestore()
          Gets the DataBookHandler for after restore event.
 DataBookHandler eventAfterRowSelected()
          Gets the DataBookHandler for after row selected event.
 DataBookHandler eventAfterSortChanged()
          Gets the DataBookHandler for after sort changed event.
 DataBookHandler eventAfterUpdated()
          Gets the DataBookHandler for after updated event.
 DataBookHandler eventAfterUpdating()
          Gets the DataBookHandler for after updating event.
 DataBookHandler eventBeforeColumnSelected()
          Gets the DataBookHandler for before column selected event.
 DataBookHandler eventBeforeDeleted()
          Gets the DataBookHandler for before deleted event.
 DataBookHandler eventBeforeDeleting()
          Gets the DataBookHandler for before deleting event.
 DataBookHandler eventBeforeFilterChanged()
          Gets the DataBookHandler for before filter changed event.
 DataBookHandler eventBeforeInserted()
          Gets the DataBookHandler for before inserted event.
 DataBookHandler eventBeforeInserting()
          Gets the DataBookHandler for before inserting event.
 DataBookHandler eventBeforeReload()
          Gets the DataBookHandler for before reload event.
 DataBookHandler eventBeforeRestore()
          Gets the DataBookHandler for before restore event.
 DataBookHandler eventBeforeRowSelected()
          Gets the DataBookHandler for before row selected event.
 DataBookHandler eventBeforeSortChanged()
          Gets the DataBookHandler for before sort changed event.
 DataBookHandler eventBeforeUpdated()
          Gets the DataBookHandler for before updated event.
 DataBookHandler eventBeforeUpdating()
          Gets the DataBookHandler for before updating event.
protected  void executeDelete(IChangeableDataRow pDataRow)
          Its called when the deleting DataRow (delete row) should be deleted.
protected  IDataRow executeInsert(IChangeableDataRow pDataRow)
          Its called when the inserting DataRow (new row) should be inserted.
protected  IDataRow executeLockAndRefetch(IChangeableDataRow pDataRow)
          Its called before the DataRow (existing row) will be changed.
protected  void executeRefresh()
          It will be called, when the MemDataBook will be completely refreshed.
protected  void executeRefreshDataPage()
          It will be called, when the MemDataBook will be completely refreshed.
protected  IDataRow executeUpdate(IChangeableDataRow pDataRow)
          Its called when the updating DataRow (changed row) should be updated Derived classed should override this to implemented the needed functionality.
 void fetchAll()
          Fetches all IDataRows from the storage.
protected  void finalize()
          
 ChangeableDataRow getAdditionalDataRow()
          Returns the additional data row.
 int[] getChangedDataRows()
          Deprecated. 
 int[] getChangedRows()
          Gets an int array containing the indexes of all changed IDataRow s.
 IDataBook getDataBook()
          Gets the parent IDataBook.
 IDataPage getDataPage()
          Gets the parent IDataPage.
 IDataPage getDataPage(IDataRow pMasterDataRow)
          Returns the corresponding IDataPage to specified master row from the master DataBook.
 IDataPage getDataPage(IDataRow pRootRow, TreePath pTreePath)
          Gets the IDataPage for the given TreePath and the given root row.
 IDataPage getDataPage(TreePath pTreePath)
          Gets the IDataPage for the given TreePath.
 IDataPage getDataPageWithRootRow(IDataRow pRootDataRow)
          Returns the corresponding IDataPage to specified root row from the root DataBook.
 IChangeableDataRow getDataRow(int pDataRowIndex)
          Gets a copy of the IChangeableDataRow at the specified index.
 IDataSource getDataSource()
          Gets the IDataSource that is used.
 IDataBook[] getDetailDataBooks()
          Gets all detail IDataBooks as array.
 int getEstimatedRowCount()
          Returns the row count in IDBAccess for this RemoteDataBook.
 ICondition getFilter()
          Gets the used filter.
 IDataRow getMasterDataRow()
          Gets the corresponding master row.
 ReferenceDefinition getMasterReference()
          Gets the master reference that is used.
 java.lang.String getName()
          Gets the name that is used.
 IDataRow getOriginalDataRow()
          Gets the original IDataRow, before any changes were performed.
 int getReadAhead()
          Returns the count of rows which are read ahead from the IDBAccess.
 IReadOnlyChecker getReadOnlyChecker()
          Gets the IReadOnlyChecker.
 IDataBook getRootDataBook()
          Gets the root data book.
protected  IDataBook getRootDataBookIntern()
          Evaluates the current root data book.
 ReferenceDefinition getRootReference()
          Gets the tree root reference.
 IRowCalculator getRowCalculator()
          Gets the IRowCalculator.
 int getRowCount()
          Gets the number of rows which are currently held.
 IRowDefinition getRowDefinition()
          Gets the IRowDefinition that is used.
 int getRowIndex()
          Gets the row index within the parent IDataPage.
 java.lang.String getSelectedColumn()
          Gets the name of the selected column.
 int getSelectedDataPageRow()
          Returns the selected row index relatively to the current IDataPage.
 int getSelectedRow()
          Gets the index of the selected row.
 IDataBook.SelectionMode getSelectionMode()
          Gets the IDataBook.SelectionMode that is used.
 SortDefinition getSort()
          Gets the used SortDefinition.
 TreePath getTreePath()
          Gets the tree current tree path.
 java.lang.Object getUID()
          Gets the internal unique identifier for this IDataRow.
 java.lang.Object getValue(int pColumnIndex)
          Returns the value of the column by index.
 java.lang.Object getValue(java.lang.String pColumnName)
          Returns the value of the named column.
 java.lang.Object[] getValues(java.lang.String[] pColumnNames)
          Gets the values from all specified columns as an Object array.
 IDataBook.WriteBackIsolationLevel getWritebackIsolationLevel()
          Gets the IDataBook.WriteBackIsolationLevel that is used.
 boolean hasChanges()
          Checks if the databook has changes.
 boolean hasDataPage(IDataRow pMasterDataRow)
          Returns true if an IDataPage to specified master row from the master DataBook exists.
 boolean hasDataPage(IDataRow pRootDataRow, TreePath pTreePath)
          Returns true if an IDataPage to specified root row and TreePath from the master DataBook exists.
 int insert(boolean pBeforeRow)
          Inserts a new IDataRow at the current position.
protected  void invokeTreeCancelEditingControls()
          Its invokes for each IComponent the cancelEditing() method.
protected  void invokeTreeSaveEditingControls()
          It invokes for each IComponent the saveEditing() method.
 boolean isAdditionalDataRowVisible()
          True, if the additional data row is visible.
 boolean isAllFetched()
          Gets if all IDataRows have been fetched from the storage, and there is nothing more to fetch.
protected  boolean isDataPageRefetchPossible()
          This function is used for rehashing data pages after insert of the master row.
 boolean isDeleteAllowed()
          Gets if it is possible to delete an already existing row.
 boolean isDeleteCascade()
          Gets if a delete on a master IDataBook should also delete all rows associated with the master row in this IDataBook.
 boolean isDeleteEnabled()
          Gets if deleting a row is enabled.
 boolean isDeleting()
          Gets if this row is currently being deleted, which means that it has been removed/deleted but this action has not yet been finalized.
 boolean isDetailChanged()
          Gets if any associated detail rows have been modified.
 boolean isInsertAllowed()
          Gets if it is possible to IDataBook.insert(boolean) a new row.
 boolean isInsertEnabled()
          Gets if inserting is enabled.
 boolean isInserting()
          Gets if this row is currently being inserted, which means that it has been created but has not yet been saved/finalized.
 boolean isLockAndRefetchEnabled()
          Returns true if lock and refetch is enabled.
protected  boolean isMemFilter()
          Returns true if the filter is handled in memory.
protected  boolean isMemSort()
          Returns true if the sort is handled in memory.
 boolean isOpen()
          Gets if this IDataBook is open.
 boolean isOutOfSync()
          Gets if this IDataBook is out of sync with its master.
 boolean isReadOnly()
          Gets if this IDataBook is read only.
 boolean isSelfJoined()
          Gets if this IDataBook has been joined with itself.
 boolean isSortDataRowOnSave()
          Is true, if the current saved row should be moved to the correct possition according to the set SortDefinition.
 boolean isUpdateAllowed()
          Gets if it is possible to update an already existing row.
 boolean isUpdateEnabled()
          Gets if IDataRow.setValue(String, Object) updating a row is enabled.
 boolean isUpdating()
          Gets if this row is currently being updated, which means that its values are changed but these changes have not yet been saved/finalized.
 boolean isWritableColumnChanged()
          Gets if there was a writeable column changed.
protected  boolean isWritebackEnabled()
          Returns true if this data book should write its changes to the storage.
protected  SortDefinition keepSortableColumns(SortDefinition pSortDefinition)
          Returns a new SortDefinition with only the ColumnDefinition.isSortable() columns from the given SortDefinition.
 void notifyDetailChanged()
          Notifies the master IDataBook that one or more detail rows have changed.
 void notifyMasterChanged()
          Notifies this IDataBook that its master IDataBook has changed.
 void notifyRepaintControls()
          Informs all registered controls that there are new values and that they must redraw themselves.
 void open()
          Opens this IDataBook.
 void reload()
          Reloads all rows from the storage, any changes are discarded.
 void reload(IDataBook.SelectionMode pSelectionMode)
          Reloads all rows from the storage (any changes are discarded) and applies the given IDataBook.SelectionMode to this reload operation.
 void reloadDataPage(IDataBook.SelectionMode pSelectionMode)
          Reload the current DataPage with the pSelectionMode.
protected  void reloadIntern()
          Reloads without sending before reload event.
 void removeDataPage(IDataRow pMasterDataRow, TreePath pTreePath)
          Removes the DataPage to the specified master DataRow or TreePath. e.g.
 void removeDetailDataBook(IDataBook pDetailDataBook)
          Unregisters the given IDataBook as a detail IDataBook.
 void restoreAllRows()
          Restores all rows to a state without changes.
 void restoreDataPage()
          Restores all rows in the current DataPage.
 void restoreSelectedRow()
          Restores the currently selected row to a state without changes.
 void saveAllRows()
          Saves all IDataRows which have been changed, it is the same as IDataBook.saveSelectedRow() except that it is a mass operation on all rows.
 void saveDataPage()
          Saves all rows in the current DataPage.
 void saveEditingControls()
          Informs all registered controls that they should save their values.
 void saveSelectedRow()
          Saves the currently selected row.
 int searchNext(ICondition pCondition)
          Searches for the first occurrence of an IDataRow which matches the given ICondition and returns its index.
 int searchNext(ICondition pCondition, int pRowNum)
          Searches for the next occurrence of an IDataRow which matches the given ICondition and returns its index.
 int searchPrevious(ICondition pCondition)
          Searches for the last occurrence of an IDataRow which matches the given ICondition and returns its index.
 int searchPrevious(ICondition pCondition, int pRowNum)
          Searches for the previous occurrence of an IDataRow which matches the given ICondition and returns its index.
 void setAdditionalDataRowVisible(boolean pVisible)
          Set true, if the additional data row is visible.
 void setDataSource(IDataSource pDataSource)
          Sets the IDataSource to use, which allows the IDataBook to retrieve and set data.
 void setDeleteCascade(boolean pDeleteCascade)
          Sets if a delete on a master IDataBook should also delete all rows associated with the master row in this IDataBook.
 void setDeleteEnabled(boolean pDeleteEnabled)
          Sets if deleting a row is enabled.
 void setFilter(ICondition pFilter)
          Sets the filter that is used.
 void setInsertEnabled(boolean pInsertEnabled)
          Sets if inserting is enabled.
 void setLockAndRefetchEnabled(boolean pLockAndRefetchEnabled)
          Sets whether if lock and refetch is enabled.
 void setMasterReference(ReferenceDefinition pMasterReference)
          Sets the master reference that is going to be used.
protected  void setMemFilter(boolean pMemFilter)
          Sets if the sort is handled in memory.
protected  void setMemSort(boolean pMemSort)
          Sets if the sort is handled in memory.
 void setName(java.lang.String pName)
          Sets the name to use.
 void setReadAhead(int pReadAheadRowCount)
          Sets the count of rows which are read ahead from the IDBAccess.
 void setReadOnly(boolean pReadOnly)
          Sets if this IDataBook is read only.
 void setReadOnlyChecker(IReadOnlyChecker pReadOnlyChecker)
          Sets the IReadOnlyChecker.
 void setReadOnlyChecker(java.lang.Object pReadOnlyCheckerObject, java.lang.String pMethodName)
          Sets the read only checker.
 void setReadOnlyWithoutSave(boolean pReadOnly)
          Sets the databook readonly but does not automatically save.
 void setRootReference(ReferenceDefinition pTreeRootReference)
          Sets the tree root reference.
 void setRowCalculator(IRowCalculator pRowCalculator)
          Sets the IRowCalculator.
 void setRowCalculator(java.lang.Object pRowCalculatorObject, java.lang.String pMethodName)
          Sets the row calculator.
 void setRowDefinition(IRowDefinition pRowDefinition)
          Sets the RowDefinition to use.
 void setSelectedColumn(java.lang.String pColumnName)
          Sets the selected column based on the given name.
 void setSelectedDataPageRow(int pDataRowIndex)
          Sets the selected row index relatively to the current IDataPage.
 void setSelectedRow(int pDataRowIndex)
          Sets the selected IDataRow to the given index.
protected  void setSelectedRowInternal(int pDataRowIndex)
          Sets the selected row with throwing any changed events.
 void setSelectionMode(IDataBook.SelectionMode pSelectionMode)
          Sets the IDataBook.SelectionMode that should be used.
 void setSort(SortDefinition pSort)
          Sets the SortDefinition that is used.
 void setSortDataRowOnSave(boolean pSortDataRowOnSave)
          Is true, if the current saved row should be moved to the correct possition according to the set SortDefinition.
 void setTreePath(TreePath pTreePath)
          Sets the tree current tree path.
 void setUpdateEnabled(boolean pUpdateEnabled)
          Sets if IDataRow.setValue(String, Object) updating a row is enabled.
 void setValue(java.lang.String pColumnName, java.lang.Object pValue)
          Sets the value of the named column.
 void setValues(java.lang.String[] pColumnNames, java.lang.Object[] pValues)
          Sets all columns of the given names to the given values.
protected  void setWritebackEnabled(boolean pWritebackEnabled)
          Sets if this data book should write back its changes to the storage.
 void setWritebackIsolationLevel(IDataBook.WriteBackIsolationLevel pIsolationLevel)
          Sets the IDataBook.WriteBackIsolationLevel to use.
protected  void store()
          It stores the changes in memory as stored.
 java.lang.String toString()
          
 void update()
          Sets the currently selected row as "updating".
 
Methods inherited from class com.sibvisions.rad.model.mem.ChangeableDataRow
getOriginalRow, restore, setDeleting, setDetailChanged, setInserting, setUID, setUpdating, setValueIntern
 
Methods inherited from class com.sibvisions.rad.model.mem.DataRow
compareTo, compareTo, createEmptyDataRow, createEmptyRow, equals, equals, eventValuesChanged, eventValuesChanged, getControls, getValueAsString, getValuesAsString, hasControls, hashCode, invokeCancelEditingControls, invokeRepaintListeners, invokeSaveEditingControls, removeControl, setDefaultValues, setValuesIntern
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.rad.model.IChangeableDataRow
getOriginalRow
 
Methods inherited from interface javax.rad.model.IDataRow
compareTo, createEmptyDataRow, createEmptyRow, equals, eventValuesChanged, eventValuesChanged, getControls, getValueAsString, getValuesAsString, removeControl
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

bMemSort

protected boolean bMemSort
Determines if the sort should be made in memory.


bMemFilter

protected boolean bMemFilter
Determines if the filter should be made in memory.


rowInstance1

protected DataRow rowInstance1
Optimization for fast row access with singleton instance of data row for search, filter, sort.


rowInstance2

protected DataRow rowInstance2
Optimization for fast row access with singleton instance of data row for search, filter, sort.


rootDataBook

protected IDataBook rootDataBook
The root data book.

Constructor Detail

MemDataBook

public MemDataBook()
Contructs a new MemDataBook with an empty RowDefinition.


MemDataBook

public MemDataBook(RowDefinition pRowDefinition)
Constructs a new MemDataBook with the given RowDefinition.

Parameters:
pRowDefinition - the row definition for the data book
Method Detail

getDataBook

public IDataBook getDataBook()
Gets the parent IDataBook.

Specified by:
getDataBook in interface IDataPage
Returns:
Gets the parent IDataBook.

getName

public java.lang.String getName()
Gets the name that is used.

Specified by:
getName in interface IDataBook
Specified by:
getName in interface INamedObject
Returns:
the name that is used.
See Also:
IDataBook.setName(String)

setName

public void setName(java.lang.String pName)
             throws ModelException
Sets the name to use.

The name can only be set if the IDataBook is not already open.

Specified by:
setName in interface IDataBook
Specified by:
setName in interface INamedObject
Parameters:
pName - the name to use.
Throws:
ModelException - if the IDataBook is already open.
See Also:
IDataBook.getName()

setWritebackIsolationLevel

public void setWritebackIsolationLevel(IDataBook.WriteBackIsolationLevel pIsolationLevel)
                                throws ModelException
Sets the IDataBook.WriteBackIsolationLevel to use.

The default value should be IDataBook.WriteBackIsolationLevel.DATA_ROW.

Specified by:
setWritebackIsolationLevel in interface IDataBook
Parameters:
pIsolationLevel - the IDataBook.WriteBackIsolationLevel to use.
Throws:
ModelException - if setting DATAROW level fails, because saveAllRows fails.
See Also:
IDataBook.getWritebackIsolationLevel(), IDataBook.WriteBackIsolationLevel

getWritebackIsolationLevel

public IDataBook.WriteBackIsolationLevel getWritebackIsolationLevel()
Gets the IDataBook.WriteBackIsolationLevel that is used.

The default value should be IDataBook.WriteBackIsolationLevel.DATA_ROW.

Specified by:
getWritebackIsolationLevel in interface IDataBook
Returns:
the IDataBook.WriteBackIsolationLevel that is used.
See Also:
IDataBook.setWritebackIsolationLevel(WriteBackIsolationLevel), IDataBook.WriteBackIsolationLevel

setRowDefinition

public void setRowDefinition(IRowDefinition pRowDefinition)
                      throws ModelException
Sets the RowDefinition to use.

The IRowDefinition contains all the information about the columns and it can only be set if the IDataBook is not already open.

Specified by:
setRowDefinition in interface IDataBook
Parameters:
pRowDefinition - the RowDefinition to use.
Throws:
ModelException - if the IDataBook is already open.
See Also:
IDataRow.getRowDefinition(), IRowDefinition

getDataSource

public IDataSource getDataSource()
Gets the IDataSource that is used.

Specified by:
getDataSource in interface IDataBook
Returns:
the IDataSource that is used.
See Also:
IDataBook.setDataSource(IDataSource), IDataSource

setDataSource

public void setDataSource(IDataSource pDataSource)
                   throws ModelException
Sets the IDataSource to use, which allows the IDataBook to retrieve and set data.

The IDataSource can only be set if the IDataBook is not already open.

Specified by:
setDataSource in interface IDataBook
Parameters:
pDataSource - the IDataSource to use.
Throws:
ModelException - if the IDataBook is already open.
See Also:
IDataBook.getDataSource(), IDataSource

getMasterReference

public ReferenceDefinition getMasterReference()
Gets the master reference that is used.

The master reference defines that this IDataBook is a detail of the defined master. If the masters selection changes, the current IDataPage will change accordingly.

Specified by:
getMasterReference in interface IDataBook
Returns:
the master reference that is used.

setMasterReference

public void setMasterReference(ReferenceDefinition pMasterReference)
                        throws ModelException
Sets the master reference that is going to be used.

The master reference defines that this IDataBook is a detail of the defined master. If the masters selection changes, the current IDataPage will change accordingly. The master will also be notified if any change that occurs (like that a row is inserted / updated / deleted.

The master reference can only be set if the IDataBook is not already open.

Specified by:
setMasterReference in interface IDataBook
Parameters:
pMasterReference - the master reference that is going to be used.
Throws:
ModelException - if the IDataBook is already open.
See Also:
IDataBook.getMasterReference(), ReferenceDefinition

isSelfJoined

public boolean isSelfJoined()
Gets if this IDataBook has been joined with itself.

Specified by:
isSelfJoined in interface IDataBook
Returns:
true if this IDataBook has been joined with itself.

getDataPage

public IDataPage getDataPage(TreePath pTreePath)
                      throws ModelException
Gets the IDataPage for the given TreePath.

Specified by:
getDataPage in interface IDataBook
Parameters:
pTreePath - the TreePath.
Returns:
the IDataPage for the given TreePath.
Throws:
ModelException - if the pRootRow or pTreePath don't contains the master columns from the master ReferenceDefinition

getDataPage

public IDataPage getDataPage(IDataRow pRootRow,
                             TreePath pTreePath)
                      throws ModelException
Gets the IDataPage for the given TreePath and the given root row.

Specified by:
getDataPage in interface IDataBook
Parameters:
pRootRow - the root row.
pTreePath - the TreePath.
Returns:
the IDataPage for the given TreePath and root row.
Throws:
ModelException - if the pRootRow or pTreePath don't contains the master columns from the master ReferenceDefinition

getDataPageWithRootRow

public IDataPage getDataPageWithRootRow(IDataRow pRootDataRow)
                                 throws ModelException
Returns the corresponding IDataPage to specified root row from the root DataBook. If it doesn't exists, it will be created and returned.

Specified by:
getDataPageWithRootRow in interface IDataBook
Parameters:
pRootDataRow - the root IDataRow of the root DataBook.
Returns:
the corresponding IDataPage to specified master row from the master DataBook.
Throws:
ModelException - if the pRootRow don't contains the master columns from the master ReferenceDefinition

getRootReference

public ReferenceDefinition getRootReference()
Gets the tree root reference.

Specified by:
getRootReference in interface IDataBook
Returns:
gets the tree root reference.

setRootReference

public void setRootReference(ReferenceDefinition pTreeRootReference)
                      throws ModelException
Sets the tree root reference.

Specified by:
setRootReference in interface IDataBook
Parameters:
pTreeRootReference - the tree root reference.
Throws:
ModelException - if the IDataBook is open

getTreePath

public TreePath getTreePath()
Gets the tree current tree path.

Specified by:
getTreePath in interface IDataBook
Returns:
gets the tree root refernce.

setTreePath

public void setTreePath(TreePath pTreePath)
                 throws ModelException
Sets the tree current tree path.

Specified by:
setTreePath in interface IDataBook
Parameters:
pTreePath - the tree root reference.
Throws:
ModelException - if the IDataBook is open

notifyMasterChanged

public void notifyMasterChanged()
Notifies this IDataBook that its master IDataBook has changed.

Specified by:
notifyMasterChanged in interface IDataBook

removeDataPage

public void removeDataPage(IDataRow pMasterDataRow,
                           TreePath pTreePath)
                    throws ModelException
Removes the DataPage to the specified master DataRow or TreePath. e.g. used to delete all DataPages to the master.

Specified by:
removeDataPage in interface IDataBook
Parameters:
pMasterDataRow - the MasterDataRow to use.
pTreePath - the TreePath to use.
Throws:
ModelException - if the remove of the DataPage didn't worked out.

getSelectionMode

public IDataBook.SelectionMode getSelectionMode()
Gets the IDataBook.SelectionMode that is used.

Specified by:
getSelectionMode in interface IDataBook
Returns:
the IDataBook.SelectionMode that is used.
See Also:
IDataBook.setSelectionMode(SelectionMode)

setSelectionMode

public void setSelectionMode(IDataBook.SelectionMode pSelectionMode)
Sets the IDataBook.SelectionMode that should be used.

Specified by:
setSelectionMode in interface IDataBook
Parameters:
pSelectionMode - the IDataBook.SelectionMode that should be used.
See Also:
IDataBook.getSelectionMode()

isInsertAllowed

public boolean isInsertAllowed()
Gets if it is possible to IDataBook.insert(boolean) a new row.

An insert might not be possible if it is either disabled or if the storage does not allow an insert.

Specified by:
isInsertAllowed in interface IDataBook
Returns:
true if it is possible to IDataBook.insert(boolean) a row.
See Also:
IDataBook.isInsertEnabled(), IDataBook.setInsertEnabled(boolean)

isInsertEnabled

public boolean isInsertEnabled()
Gets if inserting is enabled.

Specified by:
isInsertEnabled in interface IDataBook
Returns:
true if inserting is enabled.
See Also:
IDataBook.isInsertAllowed(), IDataBook.setInsertEnabled(boolean)

setInsertEnabled

public void setInsertEnabled(boolean pInsertEnabled)
Sets if inserting is enabled.

Specified by:
setInsertEnabled in interface IDataBook
Parameters:
pInsertEnabled - true if inserting is enabled.
See Also:
IDataBook.isInsertAllowed(), IDataBook.isInsertEnabled()

isUpdateAllowed

public boolean isUpdateAllowed()
                        throws ModelException
Gets if it is possible to update an already existing row.

An update might not be possible of the it is either disabled, no no row is selected or if the storage does not allow an update.

Specified by:
isUpdateAllowed in interface IDataBook
Returns:
true if it is possible to update a row.
Throws:
ModelException - if the state could not be determined.
See Also:
IDataBook.isUpdateEnabled(), IDataBook.setUpdateEnabled(boolean)

isUpdateEnabled

public boolean isUpdateEnabled()
                        throws ModelException
Gets if IDataRow.setValue(String, Object) updating a row is enabled.

Specified by:
isUpdateEnabled in interface IDataBook
Returns:
true if IDataRow.setValue(String, Object) updating a row is enabled.
Throws:
ModelException - if the state could not be determined.
See Also:
IDataBook.isUpdateAllowed(), IDataBook.setUpdateEnabled(boolean)

setUpdateEnabled

public void setUpdateEnabled(boolean pUpdateEnabled)
Sets if IDataRow.setValue(String, Object) updating a row is enabled.

Specified by:
setUpdateEnabled in interface IDataBook
Parameters:
pUpdateEnabled - true if IDataRow.setValue(String, Object) updating a row is enabled.
See Also:
IDataBook.isUpdateAllowed(), IDataBook.isUpdateEnabled()

isDeleteAllowed

public boolean isDeleteAllowed()
                        throws ModelException
Gets if it is possible to delete an already existing row.

A delete might not be possible of the it is either disabled, no no row is selected or if the storage does not allow a delete.

Specified by:
isDeleteAllowed in interface IDataBook
Returns:
true if it is possible to delete a row.
Throws:
ModelException - if the state could not be determined.
See Also:
IDataBook.isDeleteEnabled(), IDataBook.setDeleteEnabled(boolean)

isDeleteEnabled

public boolean isDeleteEnabled()
                        throws ModelException
Gets if deleting a row is enabled.

Specified by:
isDeleteEnabled in interface IDataBook
Returns:
true if deleting a row is enabled.
Throws:
ModelException - if the state could not be determined.
See Also:
IDataBook.isDeleteAllowed(), IDataBook.setDeleteCascade(boolean)

setDeleteEnabled

public void setDeleteEnabled(boolean pDeleteEnabled)
Sets if deleting a row is enabled.

Specified by:
setDeleteEnabled in interface IDataBook
Parameters:
pDeleteEnabled - true if deleting a row is enabled.
See Also:
IDataBook.isDeleteAllowed(), IDataBook.isDeleteEnabled()

isReadOnly

public boolean isReadOnly()
Gets if this IDataBook is read only.

Specified by:
isReadOnly in interface IDataBook
Returns:
true this IDataBook is read only.
See Also:
IDataBook.setReadOnly(boolean)

setReadOnly

public void setReadOnly(boolean pReadOnly)
                 throws ModelException
Sets if this IDataBook is read only.

If there are changes and the IDataBook is set to read only, the changed data is saved.

Specified by:
setReadOnly in interface IDataBook
Parameters:
pReadOnly - true if this IDataBook is read only.
Throws:
ModelException - if saving any changes failed.
See Also:
IDataBook.isReadOnly()

isOpen

public boolean isOpen()
Gets if this IDataBook is open.

Specified by:
isOpen in interface IDataBook
Returns:
true if this IDataBook is open.
See Also:
IDataBook.open()

open

public void open()
          throws ModelException
Opens this IDataBook.

"Open" means that all actions are performed which are needed to deliver data to the user, an IDataBook that is open can be used for querying and changing data.

Implementations should perform all needed set up work in this method (like reading metadata from the storage).

Specified by:
open in interface IDataBook
Throws:
ModelException - if there is no name set, or if there is no column in the row definition, or if there is no IDataBook.getDataSource() set.

close

public void close()
Closes this IDataBook.

A closed IDataBook has the same state as an not open IDataBook. It can't be used to query or change data, but it can be reopened.

Implementations should performs all clean up in this method and the (cached) data can be discarded at this point.

Specified by:
close in interface IDataBook

getRowCount

public int getRowCount()
                throws ModelException
Gets the number of rows which are currently held.

Specified by:
getRowCount in interface IDataPage
Returns:
the number of rows which are currently held.
Throws:
ModelException - if the number of rows could not be determined.

getSelectedRow

public int getSelectedRow()
                   throws ModelException
Gets the index of the selected row.

The index might -1 if there is no row selected or if this IDataBook is not IDataBook.isOpen().

Specified by:
getSelectedRow in interface IDataBook
Returns:
the index of the selected row, -1 if there is none selected or the IDataBook is not open.
Throws:
ModelException - if the synchronization with the master failed.
See Also:
IDataBook.setSelectedRow(int)

setSelectedRow

public void setSelectedRow(int pDataRowIndex)
                    throws ModelException
Sets the selected IDataRow to the given index. If the given index is less than zero or greater than the number of rows available, no row will be selected (if there is already a row selected, it will be unselected).

If the row at the given index is currently not in memory, it will be loaded from the storage.

Depending on the set IDataBook.WriteBackIsolationLevel changing the selection might save the previously selected row to the storage.

Before the selection is changed the IControl.saveEditing() method of all registered IControls is invoked. Afterwards the IDataBook.eventBeforeRowSelected() and IDataBook.eventAfterRowSelected() events are fired in this order. The last action is that the IControl.notifyRepaint() method of all registered IControls is invoked.

Specified by:
setSelectedRow in interface IDataBook
Parameters:
pDataRowIndex - the index of the IDataRow to select. If it is less than zero or greater than the number of rows available, no row will be selected and an eventually already selected row will be unselected.
Throws:
ModelException - if the IDataBook is not open or if the IDataRow at the given index could not be fetched from the storage or if the master IDataBook does not have a selected row or if the synchronization with the master failed.
See Also:
IDataBook.getSelectedRow()

getSelectedColumn

public java.lang.String getSelectedColumn()
                                   throws ModelException
Gets the name of the selected column.

The returned name might be null if there is no column selected.

Specified by:
getSelectedColumn in interface IDataBook
Returns:
the name of the selected column, null if there is none selected.
Throws:
ModelException - if the synchronization with the master failed.
See Also:
IDataBook.setSelectedColumn(String)

setSelectedColumn

public void setSelectedColumn(java.lang.String pColumnName)
                       throws ModelException
Sets the selected column based on the given name.

If the given column name is null no column is selected (if there is already a row selected, it will be unselected).

Before the selection changes the IDataBook.eventBeforeColumnSelected() is fired and afterwards the IDataBook.eventAfterColumnSelected() is fired.

Specified by:
setSelectedColumn in interface IDataBook
Parameters:
pColumnName - the name of the column to select, can be null to remove the selection (if any).
Throws:
ModelException - if the IDataBook is not open or if there is no column with the given name or if synchronization with the master failed.
See Also:
IDataBook.getSelectedColumn()

isDeleteCascade

public boolean isDeleteCascade()
Gets if a delete on a master IDataBook should also delete all rows associated with the master row in this IDataBook.

Specified by:
isDeleteCascade in interface IDataBook
Returns:
true if the rows in this IDataBook should be deleted if the master row is deleted.
See Also:
IDataBook.setDeleteCascade(boolean)

setDeleteCascade

public void setDeleteCascade(boolean pDeleteCascade)
Sets if a delete on a master IDataBook should also delete all rows associated with the master row in this IDataBook.

Specified by:
setDeleteCascade in interface IDataBook
Parameters:
pDeleteCascade - true if the rows in this IDataBook should be deleted if the master row is deleted.
See Also:
IDataBook.isDeleteCascade()

insert

public int insert(boolean pBeforeRow)
           throws ModelException
Inserts a new IDataRow at the current position. If there is currently no IDataRow is selected the row will be inserted at the beginning. After this operation the new IDataRow will be selected.

Note that this is an selected row changing operation.

The following events are fired in the following order:

  1. IControl.saveEditing() is invoked on all registered IControls.
  2. IDataBook.eventBeforeInserting()
  3. IDataBook.eventAfterInserting()
  4. IDataBook.eventAfterRowSelected()
  5. IControl.notifyRepaint() is invoked on all registered IControls.

Specified by:
insert in interface IDataBook
Parameters:
pBeforeRow - if the new row should be inserted before the current selection.
Returns:
the index at which the new row has been inserted.
Throws:
ModelException - if the IDataBook is not open, or if saving of already existing changes failed, or if IDataBook.isInsertAllowed() is disabled, or if saving the row to the storage failed.

update

public void update()
            throws ModelException
Sets the currently selected row as "updating". This also happens implicitly if a value is set. If there is no row selected a ModelException is thrown.

The storage might want to reload and eventually lock the row that is being updated.

Before the update is executed the IDataBook.eventBeforeUpdating() is fired and afterwards the IDataBook.eventAfterUpdating() is fired.

Specified by:
update in interface IDataBook
Throws:
ModelException - if the IDataBook is not open, or if IDataBook.isUpdateAllowed() is disabled (for example no row is selected), or if there was an error when setting the state.

delete

public void delete()
            throws ModelException
Deletes the currently selected row. If there is no row selected, a ModelException is thrown. It deletes the selected.

Before the delete is executed the IDataBook.eventBeforeDeleting() is fired and afterwards the IDataBook.eventAfterDeleting() is fired. As the row has been deleted at that point, the selected row is changed to the next row.

Specified by:
delete in interface IDataBook
Throws:
ModelException - if the IDataBook is not open, or if IDataBook.isDeleteAllowed() is disabled (for example no row is selected), or if there was an error when setting the state.

deleteAllDataRows

@Deprecated
public void deleteAllDataRows()
                       throws ModelException
Deprecated. 

Deletes all IDataRows which are currently available, it is the same as IDataBook.delete() except that it is a mass operation on all rows.

Deleting all rows does only delete the currently available rows, rows which do not match the currently applied filter will not be deleted.

First the row is selected and afterwards deleted.

These events are fired for all rows.

Specified by:
deleteAllDataRows in interface IDataBook
Throws:
ModelException - if the IDataBook is not open or if the changes (because of the selection change) could not be saved.
See Also:
IDataBook.delete()

deleteAllRows

public void deleteAllRows()
                   throws ModelException
Deletes all IDataRows which are currently available, it is the same as IDataBook.delete() except that it is a mass operation on all rows.

Deleting all rows does only delete the currently available rows, rows which do not match the currently applied filter will not be deleted.

First the row is selected and afterwards deleted.

These events are fired for all rows.

Specified by:
deleteAllRows in interface IDataBook
Throws:
ModelException - if the IDataBook is not open or if the changes (because of the selection change) could not be saved.
See Also:
IDataBook.delete()

notifyDetailChanged

public void notifyDetailChanged()
Notifies the master IDataBook that one or more detail rows have changed.

Specified by:
notifyDetailChanged in interface IDataBook

getDataRow

public IChangeableDataRow getDataRow(int pDataRowIndex)
                              throws ModelException
Gets a copy of the IChangeableDataRow at the specified index. Returns null if there is no row at the specified index.

If the row is currently not in memory, it will be fetched from the underlying storage.

Specified by:
getDataRow in interface IDataPage
Parameters:
pDataRowIndex - the index of the IChangeableDataRow to get.
Returns:
a copy of the IChangeableDataRow at the specified index, null if there is no row at the specified index.
Throws:
ModelException - if the IChangeableDataRow at the specified index can no be got.

getAdditionalDataRow

public ChangeableDataRow getAdditionalDataRow()
                                       throws ModelException
Returns the additional data row. The additional data row is only in memory. If it is set to visible, it is shown as first row. All controls will show the content of this data row, if selected.

Specified by:
getAdditionalDataRow in interface IDataBook
Returns:
the additional data row.
Throws:
ModelException - if the data book is not open.

isAdditionalDataRowVisible

public boolean isAdditionalDataRowVisible()
True, if the additional data row is visible. The data row is available in row number 0.

Specified by:
isAdditionalDataRowVisible in interface IDataBook
Returns:
true, if the additional data row is visible.

setAdditionalDataRowVisible

public void setAdditionalDataRowVisible(boolean pVisible)
Set true, if the additional data row is visible. The data row is available in row number 0.

Specified by:
setAdditionalDataRowVisible in interface IDataBook
Parameters:
pVisible - true, if the additional data row is visible.

getSelectedDataPageRow

public int getSelectedDataPageRow()
                           throws ModelException
Returns the selected row index relatively to the current IDataPage.
This should be used from the tree controls to show which one is selected. The difference is due to a visible additional row. In case is is visible, setSelectedRow(1) is equal to setSelectedRowInPage(0).

Specified by:
getSelectedDataPageRow in interface IDataBook
Returns:
the selected row index relatively to the current IDataPage.
Throws:
ModelException - if a exception occurs during synchronize.

setSelectedDataPageRow

public void setSelectedDataPageRow(int pDataRowIndex)
                            throws ModelException
Sets the selected row index relatively to the current IDataPage.
This should be used from the tree controls to show which one is selected. The difference is due to a visible additional row. In case is is visible, setSelectedRow(1) is equal to setSelectedRowInPage(0).

Specified by:
setSelectedDataPageRow in interface IDataBook
Parameters:
pDataRowIndex - the selected row index relatively to the current IDataPage.
Throws:
ModelException - if the row with the iDataRowIndex couldn't get from the storage or if the IDataBook isn't open or the master IDataBook has no selected row.

getOriginalDataRow

public IDataRow getOriginalDataRow()
                            throws ModelException
Gets the original IDataRow, before any changes were performed.

Specified by:
getOriginalDataRow in interface IChangeableDataRow
Overrides:
getOriginalDataRow in class ChangeableDataRow
Returns:
the original IDataRow, before any changes were performed.
Throws:
ModelException - if the original IDataRow could not be got.

isWritableColumnChanged

public boolean isWritableColumnChanged()
                                throws ModelException
Gets if there was a writeable column changed. A writeable column is a column which can be written to/saved.

Specified by:
isWritableColumnChanged in interface IChangeableDataRow
Overrides:
isWritableColumnChanged in class ChangeableDataRow
Returns:
true if there was a writeable column changed.
Throws:
ModelException - if the state could not be determined.

isDeleting

public boolean isDeleting()
                   throws ModelException
Gets if this row is currently being deleted, which means that it has been removed/deleted but this action has not yet been finalized.

Specified by:
isDeleting in interface IChangeableDataRow
Overrides:
isDeleting in class ChangeableDataRow
Returns:
if this row is currently being deleted.
Throws:
ModelException - if the state could not be determined.

isUpdating

public boolean isUpdating()
                   throws ModelException
Gets if this row is currently being updated, which means that its values are changed but these changes have not yet been saved/finalized.

Specified by:
isUpdating in interface IChangeableDataRow
Overrides:
isUpdating in class ChangeableDataRow
Returns:
true if this row is currently being changed.
Throws:
ModelException - if the state could not be determined.

isInserting

public boolean isInserting()
                    throws ModelException
Gets if this row is currently being inserted, which means that it has been created but has not yet been saved/finalized.

Specified by:
isInserting in interface IChangeableDataRow
Overrides:
isInserting in class ChangeableDataRow
Returns:
true if this row is currently being inserted.
Throws:
ModelException - if the state could not be determined.

isDetailChanged

public boolean isDetailChanged()
                        throws ModelException
Gets if any associated detail rows have been modified. A modified row has either been updated, deleted or was inserted.

Specified by:
isDetailChanged in interface IChangeableDataRow
Overrides:
isDetailChanged in class ChangeableDataRow
Returns:
true if any associated detail rows have been modified.
Throws:
ModelException - if the state of the detail rows could not be determined.

getUID

public java.lang.Object getUID()
                        throws ModelException
Gets the internal unique identifier for this IDataRow.

Specified by:
getUID in interface IChangeableDataRow
Overrides:
getUID in class ChangeableDataRow
Returns:
the internal unique identifier for this IDataRow.
Throws:
ModelException - if the unique identifier could not be determined.

getFilter

public ICondition getFilter()
Gets the used filter. Can be null if none is used or set.

Specified by:
getFilter in interface IDataBook
Returns:
the used filter, null if none used or set.
See Also:
IDataBook.setFilter(ICondition), ICondition

setFilter

public void setFilter(ICondition pFilter)
               throws ModelException
Sets the filter that is used. If the given filter is null no filter will be applied to the data.

This call is schematically equal to IDataBook.reload() with the exception that changes are saved before the filter is applied.

Specified by:
setFilter in interface IDataBook
Parameters:
pFilter - the filter to apply.
Throws:
ModelException - if the IDataBook is not open or the data could not be reloaded.
See Also:
IDataBook.getFilter(), ICondition

getSort

public SortDefinition getSort()
Gets the used SortDefinition. Can be null if there is none set or used.

Specified by:
getSort in interface IDataBook
Returns:
the used SortDefinition, null if there is none set or used.
See Also:
IDataBook.setSort(SortDefinition), SortDefinition

setSort

public void setSort(SortDefinition pSort)
             throws ModelException
Sets the SortDefinition that is used. The given SortDefinition can be null for no sorting.

This is schematically equal top IDataBook.setFilter(ICondition).

Specified by:
setSort in interface IDataBook
Parameters:
pSort - the SortDefinition to use. Can be null for no sorting.
Throws:
ModelException - if the changes could not be stored.
See Also:
IDataBook.getSort(), SortDefinition

reload

public void reload()
            throws ModelException
Reloads all rows from the storage, any changes are discarded.

If the backing instance is a database, it means that all data has to be refetched from the database.

Before the reload the IControl.cancelEditing() of all registered IControls is invoked. After that the IDataBook.eventBeforeReload() is fired and afterwards the IDataBook.eventAfterReload(). Afterwards the IControl.notifyRepaint() method of all registered IControls is invoked.

Specified by:
reload in interface IDataBook
Throws:
ModelException - if the IDataBook is not open or if the reload failed.
See Also:
IDataBook.reload(SelectionMode)

reload

public void reload(IDataBook.SelectionMode pSelectionMode)
            throws ModelException
Reloads all rows from the storage (any changes are discarded) and applies the given IDataBook.SelectionMode to this reload operation.

If the backing instance is a database, it means that all data has to be refetched from the database.

Before the reload the IControl.cancelEditing() of all registered IControls is invoked. After that the IDataBook.eventBeforeReload() is fired and afterwards the IDataBook.eventAfterReload(). Afterwards the IControl.notifyRepaint() method of all registered IControls is invoked.

Specified by:
reload in interface IDataBook
Parameters:
pSelectionMode - the Selection mode to use
Throws:
ModelException - if the IDataBook is not open or if the reload failed.
See Also:
IDataBook.reload()

restoreSelectedRow

public void restoreSelectedRow()
                        throws ModelException
Restores the currently selected row to a state without changes. If there is no row selected, nothing happens.

"Restoring" means that all changes made by the user are reverted, if this IDataBook is backed by a database it would mean to refetch the row.

Before the restore the IDataBook.eventBeforeRestore() is fired and afterwards the IDataBook.eventAfterRestore() is fired. Afterwards the IControl.notifyRepaint() method of all registered IControls is invoked.

Specified by:
restoreSelectedRow in interface IDataBook
Throws:
ModelException - if the IDataBook is not open or if the row could not be restored.
See Also:
IDataBook.restoreAllRows()

restoreAllRows

public void restoreAllRows()
                    throws ModelException
Restores all rows to a state without changes.

"Restoring" means that all changes made by the user are reverted, if this IDataBook is backed by a database it would mean to refetch the row.

Restoring all rows does restore all rows, including those which do not match the currently set filter.

Before the restore of each row the IDataBook.eventBeforeRestore() is fired and afterwards the IDataBook.eventAfterRestore() is fired. Afterwards the IControl.notifyRepaint() method of all registered IControls is invoked.

Specified by:
restoreAllRows in interface IDataBook
Throws:
ModelException - if the IDataBook is not open or if the row could not be restored.
See Also:
IDataBook.restoreSelectedRow()

saveSelectedRow

public void saveSelectedRow()
                     throws ModelException
Saves the currently selected row. If there is no row selected nothing happens.

Depending on the state of the row, either IDataBook.eventBeforeInserted()/ IDataBook.eventAfterInserted(), IDataBook.eventBeforeUpdated()/ IDataBook.eventAfterUpdated() or IDataBook.eventBeforeDeleted()/ IDataBook.eventAfterDeleted() are fired. Afterwards the IControl.notifyRepaint() method of all registered IControls is invoked.

Specified by:
saveSelectedRow in interface IDataBook
Throws:
ModelException - if the IDataBook is not open or if the changes could not be saved.
See Also:
IDataBook.saveAllRows()

saveDataPage

public void saveDataPage()
                  throws ModelException
Saves all rows in the current DataPage.

Specified by:
saveDataPage in interface IDataBook
Throws:
ModelException - if saveSelected() fails

saveAllRows

public void saveAllRows()
                 throws ModelException
Saves all IDataRows which have been changed, it is the same as IDataBook.saveSelectedRow() except that it is a mass operation on all rows.

Saving all rows does save all rows, including those which do not match the currently set filter.

Depending on the state of the rows, either IDataBook.eventBeforeInserted() / IDataBook.eventAfterInserted(), IDataBook.eventBeforeUpdated()/ IDataBook.eventAfterUpdated() or IDataBook.eventBeforeDeleted()/ IDataBook.eventAfterDeleted() are fired. Afterwards the IControl.notifyRepaint() method of all registered IControls is invoked.

These events are fired for all changed rows.

Specified by:
saveAllRows in interface IDataBook
Throws:
ModelException - if the IDataBook is not open or if the changes could not be saved.
See Also:
IDataBook.saveSelectedRow()

isOutOfSync

public boolean isOutOfSync()
Gets if this IDataBook is out of sync with its master.

Specified by:
isOutOfSync in interface IDataBook
Returns:
true if this IDataBook is out of sync with its master.

isAllFetched

public boolean isAllFetched()
                     throws ModelException
Gets if all IDataRows have been fetched from the storage, and there is nothing more to fetch.

Specified by:
isAllFetched in interface IDataPage
Returns:
true if all IDataRows have been fetched.
Throws:
ModelException - if determining if all IDataRows have been fetched failed.

fetchAll

public void fetchAll()
              throws ModelException
Fetches all IDataRows from the storage.

Specified by:
fetchAll in interface IDataPage
Throws:
ModelException - if there is a problem while fetching the rows.

getMasterDataRow

public IDataRow getMasterDataRow()
                          throws ModelException
Gets the corresponding master row.

Specified by:
getMasterDataRow in interface IDataPage
Returns:
the corresponding master row.
Throws:
ModelException - if the master row could not be fetched for some reason.

addDetailDataBook

public void addDetailDataBook(IDataBook pDetailDataBook)
Registers the given IDataBook as a detail IDataBook.

Specified by:
addDetailDataBook in interface IDataBook
Parameters:
pDetailDataBook - the IDataBook to register as a detail IDataBook.
See Also:
IDataBook.removeDetailDataBook(IDataBook), IDataBook.getDetailDataBooks()

removeDetailDataBook

public void removeDetailDataBook(IDataBook pDetailDataBook)
Unregisters the given IDataBook as a detail IDataBook.

Specified by:
removeDetailDataBook in interface IDataBook
Parameters:
pDetailDataBook - the IDataBook to unregister as a detail IDataBook.
See Also:
IDataBook.addDetailDataBook(IDataBook), IDataBook.getDetailDataBooks()

getDetailDataBooks

public IDataBook[] getDetailDataBooks()
Gets all detail IDataBooks as array. The returned array might be empty if there are no detail IDataBooks.

Specified by:
getDetailDataBooks in interface IDataBook
Returns:
all detail IDataBooks as array, the array might be empty if there are none.
See Also:
IDataBook.addDetailDataBook(IDataBook), IDataBook.removeDetailDataBook(IDataBook)

getChangedDataRows

@Deprecated
public int[] getChangedDataRows()
                         throws ModelException
Deprecated. 

Gets an int array containing the indexes of all changed IDataRow s. Returns an empty array if there are no changed IDataRows.

Specified by:
getChangedDataRows in interface IDataPage
Returns:
an int array containing the indexes of all changed IDataRows. An empty array if there are no changes.
Throws:
ModelException - if a exception occurs during synchronize.

getChangedRows

public int[] getChangedRows()
                     throws ModelException
Gets an int array containing the indexes of all changed IDataRow s. Returns an empty array if there are no changed IDataRows.

Specified by:
getChangedRows in interface IDataPage
Returns:
an int array containing the indexes of all changed IDataRows. An empty array if there are no changes.
Throws:
ModelException - if a exception occurs during synchronize.

getDataPage

public IDataPage getDataPage(IDataRow pMasterDataRow)
                      throws ModelException
Returns the corresponding IDataPage to specified master row from the master DataBook. If it doesn't exists, it will be created and returned.

Specified by:
getDataPage in interface IDataBook
Parameters:
pMasterDataRow - the master IDataRow of the master DataBook.
Returns:
the corresponding IDataPage to specified master row from the master DataBook.
Throws:
ModelException - if the pMasterRow don't contains the master columns from the master ReferenceDefinition

hasDataPage

public boolean hasDataPage(IDataRow pMasterDataRow)
                    throws ModelException
Returns true if an IDataPage to specified master row from the master DataBook exists.

Specified by:
hasDataPage in interface IDataBook
Parameters:
pMasterDataRow - the master IDataRow of the master DataBook.
Returns:
true if an IDataPage to specified master row from the master DataBook exists.
Throws:
ModelException - if the pMasterRow don't contains the master columns from the master ReferenceDefinition

searchNext

public int searchNext(ICondition pCondition)
               throws ModelException
Searches for the first occurrence of an IDataRow which matches the given ICondition and returns its index. -1 is returned if there is no IDataRow that matches.

This method might fetch more rows from the storage as needed.

Specified by:
searchNext in interface IDataPage
Parameters:
pCondition - the ICondition.
Returns:
the index of the first matching IDataRow, -1 if there is none.
Throws:
ModelException - if searching through and/or fetching the IDataRows failed.

searchNext

public int searchNext(ICondition pCondition,
                      int pRowNum)
               throws ModelException
Searches for the next occurrence of an IDataRow which matches the given ICondition and returns its index. The search is started at the given index. -1 is returned if there is no IDataRow that matches.

This method might fetch more rows from the storage as needed.

Specified by:
searchNext in interface IDataPage
Parameters:
pCondition - the ICondition.
pRowNum - the index at which to start, inclusive.
Returns:
the index of the next matching IDataRow, -1 if there is none.
Throws:
ModelException - if searching through and/or fetching the IDataRows failed.

searchPrevious

public int searchPrevious(ICondition pCondition)
                   throws ModelException
Searches for the last occurrence of an IDataRow which matches the given ICondition and returns its index. -1 is returned if there is no IDataRow that matches.

This method might fetch more rows from the storage as needed.

Specified by:
searchPrevious in interface IDataPage
Parameters:
pCondition - the ICondition.
Returns:
the index of the last matching IDataRow, -1 if there is none.
Throws:
ModelException - if searching through and/or fetching the IDataRows failed.

searchPrevious

public int searchPrevious(ICondition pCondition,
                          int pRowNum)
                   throws ModelException
Searches for the previous occurrence of an IDataRow which matches the given ICondition and returns its index. The search is started at the given index. -1 is returned if there is no IDataRow that matches.

This method might fetch more rows from the storage as needed.

Specified by:
searchPrevious in interface IDataPage
Parameters:
pCondition - the ICondition.
pRowNum - the index at which to start, exclusive.
Returns:
the index of the previous matching IDataRow, -1 if there is none.
Throws:
ModelException - if searching through and/or fetching the IDataRows failed.

getRowCalculator

public IRowCalculator getRowCalculator()
Gets the IRowCalculator.

Specified by:
getRowCalculator in interface IDataBook
Returns:
the IRowCalculator.

setRowCalculator

public void setRowCalculator(IRowCalculator pRowCalculator)
Sets the IRowCalculator.

Specified by:
setRowCalculator in interface IDataBook
Parameters:
pRowCalculator - the IRowCalculator.

setRowCalculator

public void setRowCalculator(java.lang.Object pRowCalculatorObject,
                             java.lang.String pMethodName)
Sets the row calculator.

Parameters:
pRowCalculatorObject - the object.
pMethodName - the method name.

createRowCalculator

public static IRowCalculator createRowCalculator(java.lang.Object pRowCalculatorObject,
                                                 java.lang.String pMethodName)
Creates a row calculator instance with the given object and method name.

Parameters:
pRowCalculatorObject - the object.
pMethodName - the method name.
Returns:
the row calculator

calculateRow

protected void calculateRow()
Calculates the given row.


getReadOnlyChecker

public IReadOnlyChecker getReadOnlyChecker()
Gets the IReadOnlyChecker.

Specified by:
getReadOnlyChecker in interface IDataBook
Returns:
the IReadOnlyChecker.

setReadOnlyChecker

public void setReadOnlyChecker(IReadOnlyChecker pReadOnlyChecker)
Sets the IReadOnlyChecker.

Specified by:
setReadOnlyChecker in interface IDataBook
Parameters:
pReadOnlyChecker - the IReadOnlyChecker..

setReadOnlyChecker

public void setReadOnlyChecker(java.lang.Object pReadOnlyCheckerObject,
                               java.lang.String pMethodName)
Sets the read only checker.

Parameters:
pReadOnlyCheckerObject - the object.
pMethodName - the method name.

createReadOnlyChecker

public static IReadOnlyChecker createReadOnlyChecker(java.lang.Object pReadOnlyCheckerObject,
                                                     java.lang.String pMethodName)
Creates a read only checkerr instance with the given object and method name.

Parameters:
pReadOnlyCheckerObject - the object.
pMethodName - the method name.
Returns:
the row calculator

eventBeforeRowSelected

public DataBookHandler eventBeforeRowSelected()
Gets the DataBookHandler for before row selected event.

This event is fired before the selection of the current row changes.

This event fires every time the selection changes, not just if the selection is changed by the user.

Specified by:
eventBeforeRowSelected in interface IDataBook
Returns:
the DataBookHandler for before row selected event.

eventAfterRowSelected

public DataBookHandler eventAfterRowSelected()
Gets the DataBookHandler for after row selected event.

This event is fired after the selection of the current row changes.

This event fires every time the selection changes, not just if the selection is changed by the user.

Specified by:
eventAfterRowSelected in interface IDataBook
Returns:
the DataBookHandler for after row selected event.

eventBeforeInserting

public DataBookHandler eventBeforeInserting()
Gets the DataBookHandler for before inserting event.

This event is fired before a new row is inserted .

Specified by:
eventBeforeInserting in interface IDataBook
Returns:
the DataBookHandler for before inserting event.

eventAfterInserting

public DataBookHandler eventAfterInserting()
Gets the DataBookHandler for after inserting event.

This event is fired after a new row is inserted.

Specified by:
eventAfterInserting in interface IDataBook
Returns:
the DataBookHandler for after inserting event.

eventBeforeInserted

public DataBookHandler eventBeforeInserted()
Gets the DataBookHandler for before inserted event.

This event is fired before an inserted row is saved.

Specified by:
eventBeforeInserted in interface IDataBook
Returns:
the DataBookHandler for before inserted event.

eventAfterInserted

public DataBookHandler eventAfterInserted()
Gets the DataBookHandler for after inserted event.

This event is fired after an inserted row is saved.

Specified by:
eventAfterInserted in interface IDataBook
Returns:
the DataBookHandler for after inserted event.

eventBeforeUpdating

public DataBookHandler eventBeforeUpdating()
Gets the DataBookHandler for before updating event.

This event is fired before a row is updated.

Specified by:
eventBeforeUpdating in interface IDataBook
Returns:
the DataBookHandler for before updating event.

eventAfterUpdating

public DataBookHandler eventAfterUpdating()
Gets the DataBookHandler for after updating event.

This event is fired after a row is updated.

Specified by:
eventAfterUpdating in interface IDataBook
Returns:
the DataBookHandler for after updating event.

eventBeforeUpdated

public DataBookHandler eventBeforeUpdated()
Gets the DataBookHandler for before updated event.

This event is fired before an updated row is saved.

Specified by:
eventBeforeUpdated in interface IDataBook
Returns:
the DataBookHandler for before updated event.

eventAfterUpdated

public DataBookHandler eventAfterUpdated()
Gets the DataBookHandler for after updated event.

This event is fired after an updated row is saved.

Specified by:
eventAfterUpdated in interface IDataBook
Returns:
the DataBookHandler for after updated event.

eventBeforeDeleting

public DataBookHandler eventBeforeDeleting()
Gets the DataBookHandler for before deleting event.

This event is fired before a row is deleted.

Specified by:
eventBeforeDeleting in interface IDataBook
Returns:
the DataBookHandler for before deleting event.

eventAfterDeleting

public DataBookHandler eventAfterDeleting()
Gets the DataBookHandler for after deleting event.

This event is fired after a row is deleted.

Specified by:
eventAfterDeleting in interface IDataBook
Returns:
the DataBookHandler for after deleting event.

eventBeforeDeleted

public DataBookHandler eventBeforeDeleted()
Gets the DataBookHandler for before deleted event.

This event is fired before a deleted row is saved.

Specified by:
eventBeforeDeleted in interface IDataBook
Returns:
the DataBookHandler for before deleted event.

eventAfterDeleted

public DataBookHandler eventAfterDeleted()
Gets the DataBookHandler for after deleted event.

This event is fired after a deleted row is saved.

Specified by:
eventAfterDeleted in interface IDataBook
Returns:
the DataBookHandler for after deleted event.

eventBeforeRestore

public DataBookHandler eventBeforeRestore()
Gets the DataBookHandler for before restore event.

This event is fired before a row is restored.

Specified by:
eventBeforeRestore in interface IDataBook
Returns:
the DataBookHandler for before restore event.

eventAfterRestore

public DataBookHandler eventAfterRestore()
Gets the DataBookHandler for after restore event.

This event is fired after a row is restored .

Specified by:
eventAfterRestore in interface IDataBook
Returns:
the DataBookHandler for after restore event.

eventBeforeReload

public DataBookHandler eventBeforeReload()
Gets the DataBookHandler for before reload event.

This event is fired before the IDataBook is reloaded.

Specified by:
eventBeforeReload in interface IDataBook
Returns:
the DataBookHandler for before reload event.

eventAfterReload

public DataBookHandler eventAfterReload()
Gets the DataBookHandler for after reload event.

This event is fired after the IDataBook is reloaded.

Specified by:
eventAfterReload in interface IDataBook
Returns:
the DataBookHandler for after reload event.

eventBeforeFilterChanged

public DataBookHandler eventBeforeFilterChanged()
Gets the DataBookHandler for before filter changed event.

This event is fired before the filter changes.

Specified by:
eventBeforeFilterChanged in interface IDataBook
Returns:
the DataBookHandler for before filter changed event.

eventAfterFilterChanged

public DataBookHandler eventAfterFilterChanged()
Gets the DataBookHandler for after filter changed event.

This event is fired after the filter changes.

Specified by:
eventAfterFilterChanged in interface IDataBook
Returns:
the DataBookHandler for after filter changed event.

eventBeforeSortChanged

public DataBookHandler eventBeforeSortChanged()
Gets the DataBookHandler for before sort changed event.

This event is fired before the sort changes.

Specified by:
eventBeforeSortChanged in interface IDataBook
Returns:
the DataBookHandler for before sort changed event.

eventAfterSortChanged

public DataBookHandler eventAfterSortChanged()
Gets the DataBookHandler for after sort changed event.

This event is fired afterthe sort changes.

Specified by:
eventAfterSortChanged in interface IDataBook
Returns:
the DataBookHandler for after sort changed event.

eventBeforeColumnSelected

public DataBookHandler eventBeforeColumnSelected()
Gets the DataBookHandler for before column selected event.

This event is fired before the selected column changes.

Specified by:
eventBeforeColumnSelected in interface IDataBook
Returns:
the DataBookHandler for before column selected event.

eventAfterColumnSelected

public DataBookHandler eventAfterColumnSelected()
Gets the DataBookHandler for after column selected event.

This event is fired after the selected column changes.

Specified by:
eventAfterColumnSelected in interface IDataBook
Returns:
the DataBookHandler for after column selected event.

addControl

public void addControl(IControl pControl)
Adds the given IControl to this IDataRow as control.

The registered IControl will be notified of changes in this IDataRow.

Specified by:
addControl in interface IDataRow
Overrides:
addControl in class DataRow
Parameters:
pControl - the IControl to add.
See Also:
IDataRow.removeControl(IControl), IDataRow.getControls()

getRowIndex

public int getRowIndex()
Gets the row index within the parent IDataPage.

Specified by:
getRowIndex in interface IChangeableDataRow
Overrides:
getRowIndex in class ChangeableDataRow
Returns:
the row index inside the parent IDataPage, can be -1 if there is no parent IDataPage.

getDataPage

public IDataPage getDataPage()
Gets the parent IDataPage.

Specified by:
getDataPage in interface IChangeableDataRow
Overrides:
getDataPage in class ChangeableDataRow
Returns:
the the parent IDataPage, can null if there is no parent IDataPage.

finalize

protected void finalize()
                 throws java.lang.Throwable

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

getValue

public java.lang.Object getValue(int pColumnIndex)
                          throws ModelException
Returns the value of the column by index.

Specified by:
getValue in interface IDataRow
Overrides:
getValue in class DataRow
Parameters:
pColumnIndex - the column index.
Returns:
the value of the column.
Throws:
ModelException - if the column index is out of bounds.
See Also:
IDataRow.getValue(String)

getValue

public java.lang.Object getValue(java.lang.String pColumnName)
                          throws ModelException
Returns the value of the named column.

Specified by:
getValue in interface IDataRow
Overrides:
getValue in class DataRow
Parameters:
pColumnName - the name of the column.
Returns:
the value of the named column.
Throws:
ModelException - if there is no column with the given name.
See Also:
IDataRow.getValue(int)

setValue

public void setValue(java.lang.String pColumnName,
                     java.lang.Object pValue)
              throws ModelException
Sets the value of the named column.

After the value has changed the value changed event and value changed (by name) event are invoked and fired. Afterwards all registered IControls are notified of the change by invoking IControl.notifyRepaint().

Specified by:
setValue in interface IDataRow
Overrides:
setValue in class DataRow
Parameters:
pColumnName - the column name.
pValue - the new value for the named column.
Throws:
ModelException - if there is no column with the given name or the given value can not be converted to the IDataType of the column.
See Also:
IDataRow.eventValuesChanged(), IDataRow.eventValuesChanged(String), IDataType.convertToTypeClass(Object)

getValues

public java.lang.Object[] getValues(java.lang.String[] pColumnNames)
                             throws ModelException
Gets the values from all specified columns as an Object array.

Note that the returned Object array does not represent an internal state of the IDataRow. Modifying the array does not change the IDataRow.

Specified by:
getValues in interface IDataRow
Overrides:
getValues in class DataRow
Parameters:
pColumnNames - the names of the columns from which to get the values. Can be null for all columns (which is equal to IRowDefinition.getColumnNames().
Returns:
the values from all specified columns as an Object array.
Throws:
ModelException - if there is no column with one of the specified names.
See Also:
IDataRow.getValue(int), IDataRow.getValue(String)

createDataRow

public IDataRow createDataRow(java.lang.String[] pColumnNames)
                       throws ModelException
Creates and returns a new IDataRow which only contains the specified columns and their values.

Specified by:
createDataRow in interface IDataRow
Overrides:
createDataRow in class DataRow
Parameters:
pColumnNames - a String array of column names. Can be null for all columns (which is equal to IRowDefinition.getColumnNames().
Returns:
a new IDataRow which only contains the specified columns and their values.
Throws:
ModelException - if new IDataRow could not be constructed.

setValues

public void setValues(java.lang.String[] pColumnNames,
                      java.lang.Object[] pValues)
               throws ModelException
Sets all columns of the given names to the given values.

The String array which represents the column names is directly mapped to the Object array which holds the values. So they must be equal in length.

After the value has changed the value changed event and value changed (by name) event are invoked and fired. Afterwards all registered IControls are notified of the change by invoking IControl.notifyRepaint().

Specified by:
setValues in interface IDataRow
Overrides:
setValues in class DataRow
Parameters:
pColumnNames - a String array of the column names. Can be null for all columns (which is equal to IRowDefinition.getColumnNames().
pValues - a Object array of values to set in the corresponding columns.
Throws:
ModelException - if there is no column with one of the specified names or if any of the values could not be converted to the IDataType of the column.
See Also:
IDataRow.eventValuesChanged(), IDataRow.eventValuesChanged(String), IDataRow.setValue(String, Object), IDataType.convertToTypeClass(Object)

toString

public java.lang.String toString()

Overrides:
toString in class ChangeableDataRow

notifyRepaintControls

public void notifyRepaintControls()
Informs all registered controls that there are new values and that they must redraw themselves. For this purpose the IControl.notifyRepaint() method is invoked on all registered IControls.

Specified by:
notifyRepaintControls in interface IDataRow
Overrides:
notifyRepaintControls in class DataRow
See Also:
IControl.notifyRepaint()

saveEditingControls

public void saveEditingControls()
                         throws ModelException
Informs all registered controls that they should save their values. For this purpose the IControl.saveEditing() method is invoked on all registered IControls.

Specified by:
saveEditingControls in interface IDataRow
Overrides:
saveEditingControls in class DataRow
Throws:
ModelException - if saving of any of the registered IControls fails.
See Also:
IControl.notifyRepaint()

cancelEditingControls

public void cancelEditingControls()
Informs all registered controls that they should cancel any pending editing operation and revert to the values in this IDataRow. For this purpose the IControl.cancelEditing() method is invoked on all registered IControls.

Specified by:
cancelEditingControls in interface IDataRow
Overrides:
cancelEditingControls in class DataRow

getRowDefinition

public IRowDefinition getRowDefinition()
Gets the IRowDefinition that is used.

The IRowDefinition contains all the information about the columns.

Specified by:
getRowDefinition in interface IDataRow
Overrides:
getRowDefinition in class DataRow
Returns:
the IRowDefinition that is used.

restoreDataPage

public void restoreDataPage()
                     throws ModelException
Restores all rows in the current DataPage.

Throws:
ModelException - - if an ModelException happens during undo the changes.
See Also:
restoreAllRows()

reloadIntern

protected void reloadIntern()
                     throws ModelException
Reloads without sending before reload event.

Throws:
ModelException - if reloading failed

reloadDataPage

public void reloadDataPage(IDataBook.SelectionMode pSelectionMode)
                    throws ModelException
Reload the current DataPage with the pSelectionMode.

Parameters:
pSelectionMode - pSelectionMode the Selection mode to use
Throws:
ModelException - if an DataSourceException happens during get the requested row.
See Also:
reload(javax.rad.model.IDataBook.SelectionMode)

hasChanges

public boolean hasChanges()
Checks if the databook has changes.

Returns:
true if there are changes

hasDataPage

public boolean hasDataPage(IDataRow pRootDataRow,
                           TreePath pTreePath)
                    throws ModelException
Returns true if an IDataPage to specified root row and TreePath from the master DataBook exists.

Parameters:
pRootDataRow - the root IDataRow of the DataBook to check.
pTreePath - the TreePath to use.
Returns:
true if an IDataPage to specified root row and TreePath from the master DataBook exists.
Throws:
ModelException - if the pRootDataRow don't contains the root columns from the DataBook.

createAndCacheDataPage

protected MemDataPage createAndCacheDataPage(IDataRow pMasterDataRow)
                                      throws ModelException
It constructs a new MemDataPage and puts it in the datapage cache. Derived classed should override this and create the needed IDataPage.

Parameters:
pMasterDataRow - the master IDataRow for this IDataPage.
Returns:
the new MemDataPage to use.
Throws:
ModelException - if getting the UID of the datarow failed.
See Also:
createDataPage(IDataRow)

createDataPage

protected MemDataPage createDataPage(IDataRow pMasterDataRow)
It constructs a new MemDataPage. Its every time used, when a new MemDataPage is necessary. Derived classed should override this and create the needed IDataPage.

Parameters:
pMasterDataRow - the master IDataRow for this IDataPage.
Returns:
the new MemDataPage to use.

isMemSort

protected boolean isMemSort()
Returns true if the sort is handled in memory.

Returns:
true if the sort is handled in memory.

setMemSort

protected void setMemSort(boolean pMemSort)
Sets if the sort is handled in memory.

Parameters:
pMemSort - true if the sort is handled in memory.

isMemFilter

protected boolean isMemFilter()
Returns true if the filter is handled in memory.

Returns:
true if the filter is handled in memory.

setMemFilter

protected void setMemFilter(boolean pMemFilter)
Sets if the sort is handled in memory.

Parameters:
pMemFilter - true if the filter is handled in memory.

isWritebackEnabled

protected boolean isWritebackEnabled()
Returns true if this data book should write its changes to the storage.

Returns:
true to write back all changes, false otherwise.

setWritebackEnabled

protected void setWritebackEnabled(boolean pWritebackEnabled)
Sets if this data book should write back its changes to the storage.

Parameters:
pWritebackEnabled - determines if changes should be written to the store.

isLockAndRefetchEnabled

public boolean isLockAndRefetchEnabled()
Returns true if lock and refetch is enabled.

Returns:
true if lock and refetch is enabled.

setLockAndRefetchEnabled

public void setLockAndRefetchEnabled(boolean pLockAndRefetchEnabled)
Sets whether if lock and refetch is enabled.

Parameters:
pLockAndRefetchEnabled - true if lock and refetch is enabled.

getReadAhead

public int getReadAhead()
Returns the count of rows which are read ahead from the IDBAccess.

Returns:
the count of rows which are read ahead from the IDBAccess.

setReadAhead

public void setReadAhead(int pReadAheadRowCount)
Sets the count of rows which are read ahead from the IDBAccess.

Parameters:
pReadAheadRowCount - the row count to read ahead from the IDBAccess

getEstimatedRowCount

public int getEstimatedRowCount()
                         throws ModelException
Returns the row count in IDBAccess for this RemoteDataBook.

Returns:
the row count of the DataBook.
Throws:
ModelException - the the detail DataBook couldn't synchronized with the master DataBook

isSortDataRowOnSave

public boolean isSortDataRowOnSave()
Is true, if the current saved row should be moved to the correct possition according to the set SortDefinition. Default is true.

Returns:
true, if the current saved row should be moved to the correct possition according to the set SortDefinition.

setSortDataRowOnSave

public void setSortDataRowOnSave(boolean pSortDataRowOnSave)
Is true, if the current saved row should be moved to the correct possition according to the set SortDefinition. Default is true.

Parameters:
pSortDataRowOnSave - true, if the current saved row should be moved to the correct possition according to the set SortDefinition.

executeInsert

protected IDataRow executeInsert(IChangeableDataRow pDataRow)
                          throws ModelException
Its called when the inserting DataRow (new row) should be inserted. Derived classed should override this to implemented the needed functionality. e.g. store the new row in the storage.

Parameters:
pDataRow - the data row to insert
Returns:
the data row with current values from server, or null if the row is unchanged.
Throws:
ModelException - if an ModelException occur during insert.

executeUpdate

protected IDataRow executeUpdate(IChangeableDataRow pDataRow)
                          throws ModelException
Its called when the updating DataRow (changed row) should be updated Derived classed should override this to implemented the needed functionality. e.g. update the old row with the new row in the storage.

Parameters:
pDataRow - the data row to update
Returns:
the data row with current values from server, or null if the row is unchanged.
Throws:
ModelException - if an ModelException occur during update.

executeDelete

protected void executeDelete(IChangeableDataRow pDataRow)
                      throws ModelException
Its called when the deleting DataRow (delete row) should be deleted. Derived classed should override this to implemented the needed functionality. e.g. delete the row in the storage.

Parameters:
pDataRow - the data row to delete
Throws:
ModelException - if an ModelException occur during delete.

executeLockAndRefetch

protected IDataRow executeLockAndRefetch(IChangeableDataRow pDataRow)
                                  throws ModelException
Its called before the DataRow (existing row) will be changed. Derived classed should override this to implemented the needed functionality. e.g. lock and refetch the actual values of the row from storage

Parameters:
pDataRow - the data row to lock
Returns:
the data row with current values from server, or null if the row is unchanged.
Throws:
ModelException - if an ModelException occur during insert.

getRootDataBook

public IDataBook getRootDataBook()
Gets the root data book.

Specified by:
getRootDataBook in interface IDataBook
Returns:
gets the root reference.

getRootDataBookIntern

protected IDataBook getRootDataBookIntern()
Evaluates the current root data book.

Returns:
the root data book.

invokeTreeSaveEditingControls

protected void invokeTreeSaveEditingControls()
                                      throws ModelException
It invokes for each IComponent the saveEditing() method.

Throws:
ModelException - if saving the editors fails.

invokeTreeCancelEditingControls

protected void invokeTreeCancelEditingControls()
Its invokes for each IComponent the cancelEditing() method.


executeRefresh

protected void executeRefresh()
                       throws ModelException
It will be called, when the MemDataBook will be completely refreshed. In the MemDataBook, it does nothing, because all is in memory and not restoreable. Derived classes maybe want to clear the memory.

Throws:
ModelException - if an ModelExcpetion happen during refresh

executeRefreshDataPage

protected void executeRefreshDataPage()
                               throws ModelException
It will be called, when the MemDataBook will be completely refreshed. In the MemDataBook, it does nothing, because all is in memory and not restoreable. Derived classes maybe want to clear the memory.

Throws:
ModelException - if an ModelExcpetion happen during refresh

clear

protected void clear()
              throws ModelException
It clears the AbstractStorage of the MemDataBook. Derived classed maybe need it.

Throws:
ModelException - if an ModelExcpetion happen during refresh

clearCurrentDataPage

protected void clearCurrentDataPage()
                             throws ModelException
It clears the AbstractStorage of the MemDataBook. Derived classed maybe need it.

Throws:
ModelException - if an ModelExcpetion happen during refresh

setSelectedRowInternal

protected void setSelectedRowInternal(int pDataRowIndex)
                               throws ModelException
Sets the selected row with throwing any changed events.

Parameters:
pDataRowIndex - the new row index to use.
Throws:
ModelException - if new row couldn't determined or selected.

keepSortableColumns

protected SortDefinition keepSortableColumns(SortDefinition pSortDefinition)
                                      throws ModelException
Returns a new SortDefinition with only the ColumnDefinition.isSortable() columns from the given SortDefinition.

Parameters:
pSortDefinition - the SortDefinition to process.
Returns:
a new SortDefinition with only ColumnDefinition.isSortable() columns. null if no columns remained or if the given SortDefinition was null or if the this databook is currently not open.
Throws:
ModelException - if accessing the column information failed.

store

protected void store()
              throws ModelException
It stores the changes in memory as stored. That means the changes will be made and the change state of the current DataRow (the DataBook it self) will be removed.

Overrides:
store in class ChangeableDataRow
Throws:
ModelException - if a ModelException occurs.

clearFilterSortInMemDataPages

protected void clearFilterSortInMemDataPages()
                                      throws ModelException
It clears all mem filter sorts in the MemDataPages.

Throws:
ModelException - if a ModelException occurs.

clearFilterSortInCurrentMemDataPage

protected void clearFilterSortInCurrentMemDataPage()
                                            throws ModelException
It clears all mem filter sorts in the MemDataPages.

Throws:
ModelException - if a ModelException occurs.

setReadOnlyWithoutSave

public void setReadOnlyWithoutSave(boolean pReadOnly)
Sets the databook readonly but does not automatically save.

Parameters:
pReadOnly - true to set the databook readonly, false otherwise

isDataPageRefetchPossible

protected boolean isDataPageRefetchPossible()
This function is used for rehashing data pages after insert of the master row. If it is true, the page is dropped, and therefore refetched, if needed.

Returns:
true, the page is dropped, and therefore refetched, if needed.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.