javax.rad.model
Interface IDataBook

All Superinterfaces:
Comparable<IDataRow>, IChangeableDataRow, IDataPage, IDataRow, INamedObject
All Known Implementing Classes:
MemDataBook, RemoteDataBook

public interface IDataBook
extends IChangeableDataRow, IDataPage, INamedObject

The IDataBook is a storage independent table, and handles all operations to load, save and manipulate table oriented data.
An IDataBook has at least one IDataPage to store all IDataRow's of this IDataBook. If an IDataBook 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 IDataBook is also a IChangeableDataRow, the selected row of the IDataBook.

See Also:
IDataPage, IRowDefinition, IChangeableDataRow, IDataSource

Nested Class Summary
static class IDataBook.SelectionMode
          The IDataBook selection modes specify which row should be selected after reload or after the master row has changed.
static class IDataBook.WriteBackIsolationLevel
          The IDataBook (and IDataSourrce as Default) write back isolations levels, specify when the changes in the IDataBook should be implicit write back to the storage.
 
Method Summary
 void addDetailDataBook(IDataBook pDataBook)
          Registered a new detail IDataBook to this master IDataBook.
 void close()
          Closes the IDataBook.
 void delete()
          It deletes the selected DataRow.
 void deleteAllDataRows()
          It deletes all DataRows.
 DataBookHandler eventAfterColumnSelected()
          Gets the EventHandler for after column selected event.
 DataBookHandler eventAfterDeleted()
          Gets the EventHandler for after deleted event.
 DataBookHandler eventAfterDeleting()
          Gets the EventHandler for after deleting event.
 DataBookHandler eventAfterInserted()
          Gets the EventHandler for after inserted event.
 DataBookHandler eventAfterInserting()
          Gets the EventHandler for after inserting event.
 DataBookHandler eventAfterReload()
          Gets the EventHandler for after reload event.
 DataBookHandler eventAfterRestore()
          Gets the EventHandler for after restore event.
 DataBookHandler eventAfterRowSelected()
          Gets the EventHandler for after row selected event.
 DataBookHandler eventAfterUpdated()
          Gets the EventHandler for after updated event.
 DataBookHandler eventAfterUpdating()
          Gets the EventHandler for after updating event.
 DataBookHandler eventBeforeColumnSelected()
          Gets the EventHandler for before column selected event.
 DataBookHandler eventBeforeDeleted()
          Gets the EventHandler for before deleted event.
 DataBookHandler eventBeforeDeleting()
          Gets the EventHandler for before deleting event.
 DataBookHandler eventBeforeInserted()
          Gets the EventHandler for before inserted event.
 DataBookHandler eventBeforeInserting()
          Gets the EventHandler for before inserting event.
 DataBookHandler eventBeforeReload()
          Gets the EventHandler for before reload event.
 DataBookHandler eventBeforeRestore()
          Gets the EventHandler for before restore event.
 DataBookHandler eventBeforeRowSelected()
          Gets the EventHandler for before row selected event.
 DataBookHandler eventBeforeUpdated()
          Gets the EventHandler for before updated event.
 DataBookHandler eventBeforeUpdating()
          Gets the EventHandler for before updating event.
 IDataPage getDataPage(IDataRow pMasterRow)
          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 root row.
 IDataPage getDataPage(TreePath pTreePath)
          Gets the IDataPage for the given TreePath.
 IDataPage getDataPageWithRootRow(IDataRow pRootRow)
          Returns the corresponding IDataPage to specified root row from the root DataBook.
 IDataSource getDataSource()
          Returns the IDataSource for this IDataBook.
 IDataBook[] getDetailDataBooks()
          Returns all detail IDataBooks to the master IDataBook.
 ICondition getFilter()
          Returns the filter for this IDataBook.
 ReferenceDefinition getMasterReference()
          Returns the ReferenceDefinition to the master IDataBook.
 String getName()
          Returns the IDataBook name.
 ReferenceDefinition getRootReference()
          Gets the tree root reference.
 String getSelectedColumn()
          Returns the selected column in the IDataBook.
 int getSelectedRow()
          Returns the selected row index in the IDataBook.
 IDataBook.SelectionMode getSelectionMode()
          Returns the selection mode for this IDataBook.
 SortDefinition getSort()
          Returns the sort order for this IDataBook.
 TreePath getTreePath()
          Gets the tree current tree path.
 IDataBook.WriteBackIsolationLevel getWritebackIsolationLevel()
          Returns the current write back isolation level.
 boolean hasDataPage(IDataRow pMasterDataRow)
          Returns true if an IDataPage to specified master row from the master DataBook exists.
 int insert(boolean pBeforeRow)
          It inserts a new IDataRow.
 boolean isDeleteAllowed()
          Returns true if delete is allowed on this IDataBook.
 boolean isDeleteCascade()
          Returns true if all rows of this detail table should be deleted, when the master row is deleted.
 boolean isDeleteEnabled()
          Returns true if delete is enabled on this IDataBook.
 boolean isInsertAllowed()
          Returns true if insert is allowed on this IDataBook.
 boolean isInsertEnabled()
          Returns true if insert is enabled on this IDataBook.
 boolean isOpen()
          Returns true if the IDataBook is opened.
 boolean isOutOfSync()
          Gets true, if the IDataBook is not yet initialized after a reload.
 boolean isReadonly()
          Returns true if this IDataBook is read only.
 boolean isSelfJoined()
          True, if this IDataBook is self joined.
 boolean isUpdateAllowed()
          Returns true if update is allowed on this IDataBook.
 boolean isUpdateEnabled()
          Returns true if update is enabled on this IDataBook.
 void notifyDetailChanged()
          It sets the selected row in master, that one or more details rows (from DetailDataBooks) are changed.
 void notifyMasterChanged()
          Has to be called from the master, if the master changed, to notify all detail IDataBooks.
 void open()
          Opens the IDataBook.
 void reload()
          It refreshs all IDataRow's in the IDataBook, like the was before the changes, get the data again from the storage It selects the same row (over primary key) if the SelectionMode == CURRENT_ROW in the IDataBook.
 void reload(IDataBook.SelectionMode pSelectionMode)
          It refreshs all IDataRow's in the IDataBook, like the was before the changes, get the data again from the storage and selects the row with the specified SelectionMode.
 void removeDataPage(IDataRow pMasterDataRow, TreePath pTreePath)
          Removes the DataPage to the specified master DataRow or TreePath.
 void removeDetailDataBook(IDataBook pDataBook)
          Unregister a detail IDataBook from this master IDataBook.
 void restoreAllRows()
          It restores all IDataRow's, like the was before the changes.
 void restoreSelectedRow()
          It restores the selected IDataRow, like the was before the changes.
 void saveAllRows()
          It stores all changes in the IDataRow's to the IDataSource.
 void saveDataPage()
          Saves all rows in the current DataPage.
 void saveSelectedRow()
          It stores all changes in the selected IDataRow.
 void setDataSource(IDataSource pDataSource)
          Sets the IDataSource for this IDataBook.
 void setDeleteCascade(boolean pDeleteCascade)
          Sets if all rows of this detail table should be deleted, when the master row is deleted.
 void setDeleteEnabled(boolean pDeleteEnabled)
          Sets whether delete is enabled on this IDataBook.
 void setFilter(ICondition pFilter)
          Sets the filter for this IDataBook.
 void setInsertEnabled(boolean pInsertEnabled)
          Sets whether insert is enabled on this IDataBook.
 void setMasterReference(ReferenceDefinition pReferenceDefinitionToMasterBook)
          Sets the master IDataBook to this detail IDataBook over a ReferenceDefinition.
 void setName(String pName)
          Set the name of the IDataBook.
 void setReadOnly(boolean pReadOnlyEnabled)
          Sets whether this IDataBook is read only.
 void setRootReference(ReferenceDefinition pReferenceDefinition)
          Sets the tree root reference.
 void setRowDefinition(IRowDefinition pRowDefinition)
          Sets the IRowDefinition of the IDataBook.
 void setSelectedColumn(String pSelectedColumn)
          Sets the selected column in the IDataBook.
 void setSelectedRow(int pDataRowIndex)
          Sets the selected row index in the IDataBook.
 void setSelectionMode(IDataBook.SelectionMode pSelectionMode)
          Sets the one of the following selection mode for this IDataBook.
 void setSort(SortDefinition pSort)
          Sets the sort order for this IDataBook.
 void setTreePath(TreePath pTreePath)
          Sets the tree current tree path.
 void setUpdateEnabled(boolean pUpdateEnabled)
          Sets whether update is enabled on this IDataBook.
 void setWritebackIsolationLevel(IDataBook.WriteBackIsolationLevel pIsolationLevel)
          Sets when the IDataSource needs to write back the data to the storage.
 void update()
          It sets the selected row as UPDATING.
 
Methods inherited from interface javax.rad.model.IChangeableDataRow
getDataPage, getOriginalRow, getRowIndex, getUID, isDeleting, isDetailChanged, isInserting, isUpdating, isWritableColumnChanged
 
Methods inherited from interface javax.rad.model.IDataRow
addControl, compareTo, createDataRow, createEmptyRow, equals, eventValuesChanged, getControls, getRowDefinition, getValue, getValue, getValueAsString, getValues, getValuesAsString, removeControl, setValue, setValues
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface javax.rad.model.IDataPage
fetchAll, getChangedDataRows, getDataBook, getDataRow, getMasterDataRow, getRowCount, isAllFetched, searchNext, searchNext, searchPrevious, searchPrevious
 

Method Detail

setRowDefinition

void setRowDefinition(IRowDefinition pRowDefinition)
                      throws ModelException
Sets the IRowDefinition of the IDataBook.

Parameters:
pRowDefinition - the new IRowDefinition
Throws:
ModelException - if the IRowDefinition is empty

setDataSource

void setDataSource(IDataSource pDataSource)
                   throws ModelException
Sets the IDataSource for this IDataBook.
The IDataSource defines the access to the storage like DB, XML, ...

Parameters:
pDataSource - the IDataSource to use for load/save data
Throws:
ModelException - if the IDataBook is already opened. -> Not allowed
See Also:
IDataSource

getDataSource

IDataSource getDataSource()
Returns the IDataSource for this IDataBook.

Returns:
the IDataSource for this IDataBook.

setName

void setName(String pName)
             throws ModelException
Set the name of the IDataBook.

Specified by:
setName in interface INamedObject
Parameters:
pName - IDataBook name
Throws:
ModelException - if the IDataBook is already opened. -> Not allowed

getName

String getName()
Returns the IDataBook name.

Specified by:
getName in interface INamedObject
Returns:
the IDataBook name.

setWritebackIsolationLevel

void setWritebackIsolationLevel(IDataBook.WriteBackIsolationLevel pIsolationLevel)
Sets when the IDataSource needs to write back the data to the storage.
The default write back isolation level is DATA_ROW.

Parameters:
pIsolationLevel - the new write back isolation level.
See Also:
IDataBook.WriteBackIsolationLevel

getWritebackIsolationLevel

IDataBook.WriteBackIsolationLevel getWritebackIsolationLevel()
Returns the current write back isolation level.

Returns:
the current write back isolation level.

setMasterReference

void setMasterReference(ReferenceDefinition pReferenceDefinitionToMasterBook)
                        throws ModelException
Sets the master IDataBook to this detail IDataBook over a ReferenceDefinition.

Parameters:
pReferenceDefinitionToMasterBook - the ReferenceDefinition to the master IDataBook.
Throws:
ModelException - if the IDataBook is open
See Also:
ReferenceDefinition

getMasterReference

ReferenceDefinition getMasterReference()
Returns the ReferenceDefinition to the master IDataBook.

Returns:
the ReferenceDefinition to the master IDataBook.

isSelfJoined

boolean isSelfJoined()
True, if this IDataBook is self joined.

Returns:
True, if this IDataBook is self joined.

getDataPage

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

Parameters:
pTreePath - the TreePath.
Returns:
gets the tree root reference.
Throws:
ModelException - if the pRootRow or pTreePath don't contains the master columns from the master ReferenceDefinition

getDataPage

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

Parameters:
pRootRow - the root row.
pTreePath - the TreePath.
Returns:
gets the tree root reference.
Throws:
ModelException - if the pRootRow or pTreePath don't contains the master columns from the master ReferenceDefinition

getDataPageWithRootRow

IDataPage getDataPageWithRootRow(IDataRow pRootRow)
                                 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.

Parameters:
pRootRow - 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

ReferenceDefinition getRootReference()
Gets the tree root reference.

Returns:
gets the tree root reference.

setRootReference

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

Parameters:
pReferenceDefinition - the tree root reference.
Throws:
ModelException - if the IDataBook is open

getTreePath

TreePath getTreePath()
Gets the tree current tree path.

Returns:
gets the tree root refernce.

setTreePath

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

Parameters:
pTreePath - the tree root reference.
Throws:
ModelException - if the IDataBook is open

getDataPage

IDataPage getDataPage(IDataRow pMasterRow)
                      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.

Parameters:
pMasterRow - 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

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

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

getSelectionMode

IDataBook.SelectionMode getSelectionMode()
Returns the selection mode for this IDataBook.

Returns:
the selection mode for this IDataBook.

setSelectionMode

void setSelectionMode(IDataBook.SelectionMode pSelectionMode)
Sets the one of the following selection mode for this IDataBook.
DESELECTED means, that after reload or change of the master row, that no row (-1) will be selected.
FIRST_ROW means, that after reload or change of the master row, that the first row (0) will be selected.
CURRENT_ROW means, that after reload or change of the master row, that the current row (last selected row)
or if not possible the first row (0) will be selected.

Parameters:
pSelectionMode - the selection mode for this IDataBook.

setSelectedRow

void setSelectedRow(int pDataRowIndex)
                    throws ModelException
Sets the selected row index in the IDataBook.
If the row is not in memory, it is loaded from the storage.

The write back isolation level needs to be considered. This means if the level is WriteBackIsolationLevel.DATA_ROW, the dataSource.storeAllDataBooks() method needs to be called.
Implementations need to handle master-detail IDataBook behavior.

Events:
Before the selected row is changed, the IControl.saveEditing() event is called.
Before the selected row is changed, the IDataBookListener.BEFORE_ROW_SELECTED event is raised.
After the selected row is changed, the IDataBookListener.AFTER_ROW_SELECTED event is raised.
After the selected row is changed, all registered IControls get called the notifyRepaint() method.

Parameters:
pDataRowIndex - the selected row index in the IDataBook.
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.

getSelectedRow

int getSelectedRow()
                   throws ModelException
Returns the selected row index in the IDataBook.
This should be used from the GUI controls to show which one is selected.

Returns:
the selected row index in the IDataBook or -1 if no row is selected.
Throws:
ModelException - if a exception occurs during synchronize.

setSelectedColumn

void setSelectedColumn(String pSelectedColumn)
                       throws ModelException
Sets the selected column in the IDataBook.
Events:
Before the selected column is changed, the IDataBookListener.BEFORE_COLUMN_SELECTED event is raised.
After the selected row is changed, the IDataBookListener.AFTER_COLUMN_SELECTED event is raised.

Parameters:
pSelectedColumn - the selected column in the IDataBook.
Throws:
ModelException - if the column does not exist. or if the IDataBook isn't open or the master IDataBook has no selected row.

getSelectedColumn

String getSelectedColumn()
                         throws ModelException
Returns the selected column in the IDataBook.
This should be used from the GUI controls to show which one is selected.

Returns:
the selected column in the IDataBook.
Throws:
ModelException - if a exception occurs during synchronize.

setDeleteCascade

void setDeleteCascade(boolean pDeleteCascade)
Sets if all rows of this detail table should be deleted, when the master row is deleted.

Parameters:
pDeleteCascade - the value true means, delete the rows.

isDeleteCascade

boolean isDeleteCascade()
Returns true if all rows of this detail table should be deleted, when the master row is deleted.

Returns:
true if all rows of this detail table should be deleted, when the master row is deleted.

isInsertAllowed

boolean isInsertAllowed()
                        throws ModelException
Returns true if insert is allowed on this IDataBook. Its the case if isInsertEnabled()==true and a insert is possible.

Returns:
true if insert is allowed on this IDataBook.
Throws:
ModelException - if insert is not possible because row access failed

isInsertEnabled

boolean isInsertEnabled()
                        throws ModelException
Returns true if insert is enabled on this IDataBook.

Returns:
true if insert is enabled on this IDataBook.
Throws:
ModelException - if insert is not possible because row access failed

setInsertEnabled

void setInsertEnabled(boolean pInsertEnabled)
Sets whether insert is enabled on this IDataBook.

Parameters:
pInsertEnabled - true if insert is allowed on this IDataBook.

isUpdateAllowed

boolean isUpdateAllowed()
                        throws ModelException
Returns true if update is allowed on this IDataBook. Its the case if isUpdateEnabled()==true and a update is possible. (e.g. getSelectedRow() != -1)

Returns:
true if update is allowed on this IDataBook.
Throws:
ModelException - if update is not possible because row access failed

isUpdateEnabled

boolean isUpdateEnabled()
                        throws ModelException
Returns true if update is enabled on this IDataBook.

Returns:
true if update is enabled on this IDataBook.
Throws:
ModelException - if update is not possible because row access failed

setUpdateEnabled

void setUpdateEnabled(boolean pUpdateEnabled)
Sets whether update is enabled on this IDataBook.

Parameters:
pUpdateEnabled - true if update is enabled on this IDataBook.

isDeleteAllowed

boolean isDeleteAllowed()
                        throws ModelException
Returns true if delete is allowed on this IDataBook. Its the case if isDeleteEnabled()==true and a delete is possible. (e.g. getSelectedRow() != -1)

Returns:
true if delete is allowed on this IDataBook.
Throws:
ModelException - if delete is not possible because row access failed

isDeleteEnabled

boolean isDeleteEnabled()
                        throws ModelException
Returns true if delete is enabled on this IDataBook.

Returns:
true if delete is enabled on this IDataBook.
Throws:
ModelException - if delete is not possible because row access failed

setDeleteEnabled

void setDeleteEnabled(boolean pDeleteEnabled)
Sets whether delete is enabled on this IDataBook.

Parameters:
pDeleteEnabled - true if delete is enabled on this IDataBook.

isReadonly

boolean isReadonly()
Returns true if this IDataBook is read only.

Returns:
true if this IDataBook is read only.

setReadOnly

void setReadOnly(boolean pReadOnlyEnabled)
                 throws ModelException
Sets whether this IDataBook is read only.

Parameters:
pReadOnlyEnabled - true if this IDataBook is read only.
Throws:
ModelException - if the DataBook cannot be set read only.

isOpen

boolean isOpen()
Returns true if the IDataBook is opened.

Returns:
true if the IDataBook is opened.

open

void open()
          throws ModelException
Opens the IDataBook. AbstractStorage oriented implementations should open the storage (DB, XML, File) and load the Meta data/defaulting the RowDefinition.

Throws:
ModelException - if the IDataBook couldn't be opened, because of empty storage unit name, empty IDataSource, missing RowDefinition or failed DataPage creation

close

void close()
Closes the IDataBook. AbstractStorage oriented implementations should close the storage (DB, XML, file).


insert

int insert(boolean pBeforeRow)
           throws ModelException
It inserts a new IDataRow. If bBeforeRow is true, it will be inserted before the selected IDataRow, otherwise after that.

Events:
It calls on all registered IControls, the saveEditing() method to store data first from the ui to the IDataBook.
Before the insert of the new row, the IDataBookListener.BEFORE_INSERTING event is raised.
Check the write back isolation level and consider to call saveAllDataBooks(). After the insert of the new row, the IDataBookListener.AFTER_INSERTING event is raised.
After the selected row is changed, the IDataBookListener.AFTER_ROW_SELECTED event is raised.
After the selected row is changed, all registered IControls get called the notifyRepaint() method.
After the selected row is changed, all registered IControls of detail DataBooks get called the notifyRepaint() method.

Parameters:
pBeforeRow - specifies if the IDataRow is inserted before or after the selected IDataRow
Returns:
the index where the new IDataRow is placed
Throws:
ModelException - if the IDataRow can not be inserted or the ReferenceDefinition is wrong or if not all changes could be written to the storage (maybe implicit dataSource.storeAllDataBooks(), because of WritebackIsolationLevel insert change the selected row implicit!)

update

void update()
            throws ModelException
It sets the selected row as UPDATING. That method will be implicit called from from the GUI controls, when the editing is started or when setValue(e)() is called. DB implementations should Lock and refetch the selected row.

Events:
Before the update() is done, the IDataBookListener.BEFORE_UPDATING event is raised.
After the update() is done, the IDataBookListener.AFTER_UPDATING event is raised.

Throws:
ModelException - if problem with the locking in the storage happens.

delete

void delete()
            throws ModelException
It deletes the selected DataRow.

Events:
Before the delete of the selected row is done, the IDataBookListener.BEFORE_DELETING event is raised.
Events, if Detail DataBooks with rows exist:
Before the delete each row is done, the IDataBookListener.BEFORE_DELETING event is raised.
After the delete each row is done, the IDataBookListener.AFTER_DELETING event is raised.
After the deletes all registered IControls get called the notifyRepaint() method.
After the delete of the selected row is done, the IDataBookListener.AFTER_DELETING event is raised.
After the delete of the selected row is done, all registered IControls get called the notifyRepaint() method.

If the selected row was before the delete INSERTING, then the IDataBookListener.AFTER_ROW_SELECTED event is raised, because the selected row content wise changed.

Throws:
ModelException - if not all changes could be written to the storage (maybe implicit save(), because of WritebackIsolationLevel)

notifyDetailChanged

void notifyDetailChanged()
It sets the selected row in master, that one or more details rows (from DetailDataBooks) are changed.


saveSelectedRow

void saveSelectedRow()
                     throws ModelException
It stores all changes in the selected IDataRow.

Events:
It calls before the store on all registered IComponents the saveEditing() method, to set all changes to the DataBook before the store operation.
If the selected row is INSERTING the IDataBookListener.BEFORE_INSERTED and IDataBookListener.AFTER_INSERTED event will be raised. If the selected row is UPDATING the IDataBookListener.BEFORE_UPDATED and IDataBookListener.AFTER_UPDATED event will be raised. If the selected row is DELETING the IDataBookListener.BEFORE_DELETED and IDataBookListener.AFTER_DELETED event will be raised. After the store, all registered IControls get called the notifyRepaint() method.

Throws:
ModelException - if an ModelException happens during store operation.

restoreSelectedRow

void restoreSelectedRow()
                        throws ModelException
It restores the selected IDataRow, like the was before the changes.

Events:
It calls before the restore on all registered IComponents the cancelEditing() method, to cancel the editing mode of the GUI control.
Before the restore, the IDataBookListener.BEFORE_RESTORE event is raised.
If the row isInserting then an IDataBookListener.AFTER_ROW_SELECTED will be raised
After the restore, the IDataBookListener.AFTER_RESTORE event is raised.
After the restore, all registered IControls get called the notifyRepaint() method.

Throws:
ModelException - if an ModelException happens during undo the changes.

restoreAllRows

void restoreAllRows()
                    throws ModelException
It restores all IDataRow's, like the was before the changes.

Events:
It calls before the restore all, on all registered IComponents the cancelEditing() method, to cancel the editing mode of the GUI control.
It calls restore on the current selected row and then for all other changed rows. Before each restore, the setSelectedRow method with all events is called.

That means that for each changed row following Events occur:

After the restore all rows, all registered IControls get called the notifyRepaint() method.

Throws:
ModelException - if an ModelException happens during undo the changes.

isOutOfSync

boolean isOutOfSync()
Gets true, if the IDataBook is not yet initialized after a reload. This can be used by controls to optimize fetch on demand.

Returns:
true, if the IDataBook is not yet initialized after a reload.

reload

void reload()
            throws ModelException
It refreshs all IDataRow's in the IDataBook, like the was before the changes, get the data again from the storage It selects the same row (over primary key) if the SelectionMode == CURRENT_ROW in the IDataBook. It selects the first row if the SelectionMode == FIRST_ROW in the IDataBook.

Events:
It calls before the refresh, on all registered IComponents the cancelEditing() method, to cancel the editing mode of the GUI control.
Before the refresh, the IDataBookListener.BEFORE_RELOAD event is raised.
After the refresh, the IDataBookListener.AFTER_RELOAD event is raised.
After the refresh, all registered IControls get called the notifyRepaint() method.

Throws:
ModelException - if an DataSourceException happens during get the requested row.

reload

void reload(IDataBook.SelectionMode pSelectionMode)
            throws ModelException
It refreshs all IDataRow's in the IDataBook, like the was before the changes, get the data again from the storage and selects the row with the specified SelectionMode. It selects the same row (PK, ID) if the specified SelectionMode == CURRENT_ROW. It selects the first row if the specified SelectionMode == FIRST_ROW.

Events:
It calls before the refresh, on all registered IComponents the cancelEditing() method, to cancel the editing mode of the GUI control.
Before the refresh, the IDataBookListener.BEFORE_RELOAD event is raised.
After the refresh, the IDataBookListener.AFTER_RELOAD event is raised.
After the refresh, all registered IControls get called the notifyRepaint() method.

Parameters:
pSelectionMode - the Selection mode to use
Throws:
ModelException - if an DataSourceException happens during get the requested row.

setFilter

void setFilter(ICondition pFilter)
               throws ModelException
Sets the filter for this IDataBook.
A filter consist of one ore more ICondition's. It stores first all changes, and then sets the new filter.

Parameters:
pFilter - the Filter with all ICondition's.
Throws:
ModelException - if the IDataBook couldn't stored.
See Also:
ICondition

getFilter

ICondition getFilter()
Returns the filter for this IDataBook.

Returns:
the filter for this IDataBook.

setSort

void setSort(SortDefinition pSort)
             throws ModelException
Sets the sort order for this IDataBook.
It stores first all changes, and then sets the new sort order, and get the rows from the storage or sort it in memory.

Parameters:
pSort - the sort order for this IDataBook
Throws:
ModelException - if the IDataBook couldn't stored.
See Also:
SortDefinition

getSort

SortDefinition getSort()
Returns the sort order for this IDataBook.

Returns:
the sort order for this IDataBook.

addDetailDataBook

void addDetailDataBook(IDataBook pDataBook)
Registered a new detail IDataBook to this master IDataBook.

Parameters:
pDataBook - the detail DataBook to use

removeDetailDataBook

void removeDetailDataBook(IDataBook pDataBook)
Unregister a detail IDataBook from this master IDataBook.

Parameters:
pDataBook - the detail IDataBook to use

getDetailDataBooks

IDataBook[] getDetailDataBooks()
Returns all detail IDataBooks to the master IDataBook.

Returns:
all detail IDataBooks to the master IDataBook.

notifyMasterChanged

void notifyMasterChanged()
Has to be called from the master, if the master changed, to notify all detail IDataBooks.


eventBeforeRowSelected

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

Returns:
the EventHandler for before row selected event.

eventAfterRowSelected

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

Returns:
the EventHandler for after row selected event.

eventBeforeInserting

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

Returns:
the EventHandler for before inserting event.

eventAfterInserting

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

Returns:
the EventHandler for after inserting event.

eventBeforeInserted

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

Returns:
the EventHandler for before inserted event.

eventAfterInserted

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

Returns:
the EventHandler for after inserted event.

eventBeforeUpdating

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

Returns:
the EventHandler for before updating event.

eventAfterUpdating

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

Returns:
the EventHandler for after updating event.

eventBeforeUpdated

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

Returns:
the EventHandler for before updated event.

eventAfterUpdated

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

Returns:
the EventHandler for after updated event.

eventBeforeDeleting

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

Returns:
the EventHandler for before deleting event.

eventAfterDeleting

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

Returns:
the EventHandler for after deleting event.

eventBeforeDeleted

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

Returns:
the EventHandler for before deleted event.

eventAfterDeleted

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

Returns:
the EventHandler for after deleted event.

eventBeforeRestore

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

Returns:
the EventHandler for before restore event.

eventAfterRestore

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

Returns:
the EventHandler for after restore event.

eventBeforeReload

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

Returns:
the EventHandler for before reload event.

eventAfterReload

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

Returns:
the EventHandler for after reload event.

eventBeforeColumnSelected

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

Returns:
the EventHandler for before column selected event.

eventAfterColumnSelected

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

Returns:
the EventHandler for after column selected event.

saveAllRows

void saveAllRows()
                 throws ModelException
It stores all changes in the IDataRow's to the IDataSource.

Events:
It calls before the store on all registered IComponents the saveEditing() method, to set all changes to the DataBook before the store operation.
Before the store on a row is done, the row will be selected and the usual XX_ROW_SELECTED events will be raised. For each delete will be the same events raised, like at the saveSelectedRow() method. After the store, all registered IControls get called the notifyRepaint() method.

Throws:
ModelException - if an ModelException happens during store operation.

deleteAllDataRows

void deleteAllDataRows()
                       throws ModelException
It deletes all DataRows.

Before the delete on a row is done, the row will be selected and the usual XX_ROW_SELECTED events will be raised. For each delete will be the same events raised, like at the delete() method.

Throws:
ModelException - if not all changes could be written to the storage (maybe implicit save(), because of WritebackIsolationLevel)
See Also:
setSelectedRow(int), delete()

removeDataPage

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.

Parameters:
pMasterDataRow - the MasterDataRow to use.
pTreePath - the TreePath to use.
Throws:
ModelException - if the remove of the DataPage didn't worked out.

saveDataPage

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

Throws:
ModelException - if saveSelected() fails


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.