javax.rad.model
Interface IDataBook

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

public interface IDataBook
extends IChangeableDataRow, IDataPage, INamedObject

The IDataBook is a storage independent representation of table and handles all the operations to load, save and change the data.

An IDataBook does have at least one IDataPage which then holds all the IDataRows.

If the IDataBook has an associated master, the current IDataPage is selected according to the selection in the master databook.

The IDataBook also implements the IChangeableDataRow, which means that the databook is always its own currently selected IDataRow .

See Also:
IDataPage, IRowDefinition, IChangeableDataRow, IDataSource

Nested Class Summary
static class IDataBook.SelectionMode
          The IDataBook.SelectionMode specifies which row should be selected after a reload or after the master row has changed.
static class IDataBook.WriteBackIsolationLevel
          The IDataBook.WriteBackIsolationLevel specifies when the changes in the IDataBook will be (implicitly) saved.
 
Method Summary
 void addDetailDataBook(IDataBook pDataBook)
          Registers the given IDataBook as a detail IDataBook.
 void close()
          Closes this IDataBook.
 void delete()
          Deletes the currently selected row.
 void deleteAllDataRows()
          Deprecated. since 2.5, use deleteAllRows() instead.
 void deleteAllRows()
          Deletes all IDataRows which are currently available, it is the same as 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.
 IDataRow getAdditionalDataRow()
          Returns the additional data row.
 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 the given 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()
          Gets the IDataSource that is used.
 IDataBook[] getDetailDataBooks()
          Gets all detail IDataBooks as array.
 ICondition getFilter()
          Gets the used filter.
 ReferenceDefinition getMasterReference()
          Gets the master reference that is used.
 java.lang.String getName()
          Gets the name that is used.
 IReadOnlyChecker getReadOnlyChecker()
          Gets the IReadOnlyChecker.
 IDataBook getRootDataBook()
          Gets the root data book.
 ReferenceDefinition getRootReference()
          Gets the tree root reference.
 IRowCalculator getRowCalculator()
          Gets the IRowCalculator.
 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.
 IDataBook.WriteBackIsolationLevel getWritebackIsolationLevel()
          Gets the IDataBook.WriteBackIsolationLevel that is used.
 boolean hasDataPage(IDataRow pMasterDataRow)
          Returns true if an IDataPage to specified master row from the master DataBook exists.
 int insert(boolean pBeforeRow)
          Inserts a new IDataRow at the current position.
 boolean isAdditionalDataRowVisible()
          True, if the additional data row is visible.
 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 isInsertAllowed()
          Gets if it is possible to insert(boolean) a new row.
 boolean isInsertEnabled()
          Gets if inserting is enabled.
 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 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.
 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 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 removeDataPage(IDataRow pMasterDataRow, TreePath pTreePath)
          Removes the DataPage to the specified master DataRow or TreePath. e.g.
 void removeDetailDataBook(IDataBook pDataBook)
          Unregisters the given IDataBook as a detail IDataBook.
 void restoreAllRows()
          Restores all rows to a state without changes.
 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 saveSelectedRow() except that it is a mass operation on all rows.
 void saveDataPage()
          Saves all rows in the current DataPage.
 void saveSelectedRow()
          Saves the currently selected row.
 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 setMasterReference(ReferenceDefinition pReferenceDefinitionToMasterBook)
          Sets the master reference that is going to be used.
 void setName(java.lang.String pName)
          Sets the name to use.
 void setReadOnly(boolean pReadOnlyEnabled)
          Sets if this IDataBook is read only.
 void setReadOnlyChecker(IReadOnlyChecker pReadOnlyChecker)
          Sets the IReadOnlyChecker.
 void setRootReference(ReferenceDefinition pReferenceDefinition)
          Sets the tree root reference.
 void setRowCalculator(IRowCalculator pRowCalculator)
          Sets the IRowCalculator.
 void setRowDefinition(IRowDefinition pRowDefinition)
          Sets the RowDefinition to use.
 void setSelectedColumn(java.lang.String pSelectedColumn)
          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.
 void setSelectionMode(IDataBook.SelectionMode pSelectionMode)
          Sets the IDataBook.SelectionMode that should be used.
 void setSort(SortDefinition pSort)
          Sets the SortDefinition that is used.
 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 setWritebackIsolationLevel(IDataBook.WriteBackIsolationLevel pIsolationLevel)
          Sets the IDataBook.WriteBackIsolationLevel to use.
 void update()
          Sets the currently selected row as "updating".
 
Methods inherited from interface javax.rad.model.IChangeableDataRow
getDataPage, getOriginalDataRow, getOriginalRow, getRowIndex, getUID, isDeleting, isDetailChanged, isInserting, isUpdating, isWritableColumnChanged
 
Methods inherited from interface javax.rad.model.IDataRow
addControl, cancelEditingControls, compareTo, createDataRow, createEmptyDataRow, createEmptyRow, equals, eventValuesChanged, eventValuesChanged, getControls, getRowDefinition, getValue, getValue, getValueAsString, getValues, getValuesAsString, notifyRepaintControls, removeControl, saveEditingControls, setValue, setValues
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface javax.rad.model.IDataPage
fetchAll, getChangedDataRows, getChangedRows, getDataBook, getDataRow, getMasterDataRow, getRowCount, isAllFetched, searchNext, searchNext, searchPrevious, searchPrevious
 

Method Detail

setRowDefinition

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.

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

setDataSource

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.

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

getDataSource

IDataSource getDataSource()
Gets the IDataSource that is used.

Returns:
the IDataSource that is used.
See Also:
setDataSource(IDataSource), IDataSource

setName

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 INamedObject
Parameters:
pName - the name to use.
Throws:
ModelException - if the IDataBook is already open.
See Also:
getName()

getName

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

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

setWritebackIsolationLevel

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

The default value should be IDataBook.WriteBackIsolationLevel.DATA_ROW.

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

getWritebackIsolationLevel

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

The default value should be IDataBook.WriteBackIsolationLevel.DATA_ROW.

Returns:
the IDataBook.WriteBackIsolationLevel that is used.
See Also:
setWritebackIsolationLevel(WriteBackIsolationLevel), IDataBook.WriteBackIsolationLevel

setMasterReference

void setMasterReference(ReferenceDefinition pReferenceDefinitionToMasterBook)
                        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.

Parameters:
pReferenceDefinitionToMasterBook - the master reference that is going to be used.
Throws:
ModelException - if the IDataBook is already open.
See Also:
getMasterReference(), ReferenceDefinition

getMasterReference

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.

Returns:
the master reference that is used.

isSelfJoined

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

Returns:
true if this IDataBook has been joined with itself.

getDataPage

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

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

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

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

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.

getRootDataBook

IDataBook getRootDataBook()
Gets the root data book.

Returns:
gets the 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()
Gets the IDataBook.SelectionMode that is used.

Returns:
the IDataBook.SelectionMode that is used.
See Also:
setSelectionMode(SelectionMode)

setSelectionMode

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

Parameters:
pSelectionMode - the IDataBook.SelectionMode that should be used.
See Also:
getSelectionMode()

setSelectedRow

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 eventBeforeRowSelected() and eventAfterRowSelected() events are fired in this order. The last action is that the IControl.notifyRepaint() method of all registered IControls is invoked.

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:
getSelectedRow()

getSelectedRow

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 isOpen().

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:
setSelectedRow(int)

setSelectedColumn

void setSelectedColumn(java.lang.String pSelectedColumn)
                       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 eventBeforeColumnSelected() is fired and afterwards the eventAfterColumnSelected() is fired.

Parameters:
pSelectedColumn - 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:
getSelectedColumn()

getSelectedColumn

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.

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

setDeleteCascade

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.

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

isDeleteCascade

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

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

isInsertAllowed

boolean isInsertAllowed()
                        throws ModelException
Gets if it is possible to 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.

Returns:
true if it is possible to insert(boolean) a row.
Throws:
ModelException - if the state could not be determined.
See Also:
isInsertEnabled(), setInsertEnabled(boolean)

isInsertEnabled

boolean isInsertEnabled()
                        throws ModelException
Gets if inserting is enabled.

Returns:
true if inserting is enabled.
Throws:
ModelException - if the state could not be determined.
See Also:
isInsertAllowed(), setInsertEnabled(boolean)

setInsertEnabled

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

Parameters:
pInsertEnabled - true if inserting is enabled.
See Also:
isInsertAllowed(), isInsertEnabled()

isUpdateAllowed

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.

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

isUpdateEnabled

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

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

setUpdateEnabled

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

Parameters:
pUpdateEnabled - true if IDataRow.setValue(String, Object) updating a row is enabled.
See Also:
isUpdateAllowed(), isUpdateEnabled()

isDeleteAllowed

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.

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

isDeleteEnabled

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

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

setDeleteEnabled

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

Parameters:
pDeleteEnabled - true if deleting a row is enabled.
See Also:
isDeleteAllowed(), isDeleteEnabled()

isReadOnly

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

Returns:
true this IDataBook is read only.
See Also:
setReadOnly(boolean)

setReadOnly

void setReadOnly(boolean pReadOnlyEnabled)
                 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.

Parameters:
pReadOnlyEnabled - true if this IDataBook is read only.
Throws:
ModelException - if saving any changes failed.
See Also:
isReadOnly()

isOpen

boolean isOpen()
Gets if this IDataBook is open.

Returns:
true if this IDataBook is open.
See Also:
open()

open

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).

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

close

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.


insert

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. eventBeforeInserting()
  3. eventAfterInserting()
  4. eventAfterRowSelected()
  5. IControl.notifyRepaint() is invoked on all registered IControls.

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 isInsertAllowed() is disabled, or if saving the row to the storage failed.

update

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 eventBeforeUpdating() is fired and afterwards the eventAfterUpdating() is fired.

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

delete

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 eventBeforeDeleting() is fired and afterwards the eventAfterDeleting() is fired. As the row has been deleted at that point, the selected row is changed to the next row.

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

notifyDetailChanged

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


saveSelectedRow

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 eventBeforeInserted()/ eventAfterInserted(), eventBeforeUpdated()/ eventAfterUpdated() or eventBeforeDeleted()/ eventAfterDeleted() are fired. Afterwards the IControl.notifyRepaint() method of all registered IControls is invoked.

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

restoreSelectedRow

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 eventBeforeRestore() is fired and afterwards the eventAfterRestore() is fired. Afterwards the IControl.notifyRepaint() method of all registered IControls is invoked.

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

restoreAllRows

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 eventBeforeRestore() is fired and afterwards the eventAfterRestore() is fired. Afterwards the IControl.notifyRepaint() method of all registered IControls is invoked.

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

isOutOfSync

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

Returns:
true if this IDataBook is out of sync with its master.

reload

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 eventBeforeReload() is fired and afterwards the eventAfterReload(). Afterwards the IControl.notifyRepaint() method of all registered IControls is invoked.

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

reload

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 eventBeforeReload() is fired and afterwards the eventAfterReload(). Afterwards the IControl.notifyRepaint() method of all registered IControls is invoked.

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

setFilter

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 reload() with the exception that changes are saved before the filter is applied.

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

getFilter

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

Returns:
the used filter, null if none used or set.
See Also:
setFilter(ICondition), ICondition

setSort

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 setFilter(ICondition).

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

getSort

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

Returns:
the used SortDefinition, null if there is none set or used.
See Also:
setSort(SortDefinition), SortDefinition

addDetailDataBook

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

Parameters:
pDataBook - the IDataBook to register as a detail IDataBook.
See Also:
removeDetailDataBook(IDataBook), getDetailDataBooks()

removeDetailDataBook

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

Parameters:
pDataBook - the IDataBook to unregister as a detail IDataBook.
See Also:
addDetailDataBook(IDataBook), getDetailDataBooks()

getDetailDataBooks

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

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

notifyMasterChanged

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


getRowCalculator

IRowCalculator getRowCalculator()
Gets the IRowCalculator.

Returns:
the IRowCalculator.

setRowCalculator

void setRowCalculator(IRowCalculator pRowCalculator)
Sets the IRowCalculator.

Parameters:
pRowCalculator - the IRowCalculator.

getReadOnlyChecker

IReadOnlyChecker getReadOnlyChecker()
Gets the IReadOnlyChecker.

Returns:
the IReadOnlyChecker.

setReadOnlyChecker

void setReadOnlyChecker(IReadOnlyChecker pReadOnlyChecker)
Sets the IReadOnlyChecker.

Parameters:
pReadOnlyChecker - the IReadOnlyChecker..

eventBeforeRowSelected

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.

Returns:
the DataBookHandler for before row selected event.

eventAfterRowSelected

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.

Returns:
the DataBookHandler for after row selected event.

eventBeforeInserting

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

This event is fired before a new row is inserted .

Returns:
the DataBookHandler for before inserting event.

eventAfterInserting

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

This event is fired after a new row is inserted.

Returns:
the DataBookHandler for after inserting event.

eventBeforeInserted

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

This event is fired before an inserted row is saved.

Returns:
the DataBookHandler for before inserted event.

eventAfterInserted

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

This event is fired after an inserted row is saved.

Returns:
the DataBookHandler for after inserted event.

eventBeforeUpdating

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

This event is fired before a row is updated.

Returns:
the DataBookHandler for before updating event.

eventAfterUpdating

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

This event is fired after a row is updated.

Returns:
the DataBookHandler for after updating event.

eventBeforeUpdated

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

This event is fired before an updated row is saved.

Returns:
the DataBookHandler for before updated event.

eventAfterUpdated

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

This event is fired after an updated row is saved.

Returns:
the DataBookHandler for after updated event.

eventBeforeDeleting

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

This event is fired before a row is deleted.

Returns:
the DataBookHandler for before deleting event.

eventAfterDeleting

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

This event is fired after a row is deleted.

Returns:
the DataBookHandler for after deleting event.

eventBeforeDeleted

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

This event is fired before a deleted row is saved.

Returns:
the DataBookHandler for before deleted event.

eventAfterDeleted

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

This event is fired after a deleted row is saved.

Returns:
the DataBookHandler for after deleted event.

eventBeforeRestore

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

This event is fired before a row is restored.

Returns:
the DataBookHandler for before restore event.

eventAfterRestore

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

This event is fired after a row is restored .

Returns:
the DataBookHandler for after restore event.

eventBeforeReload

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

This event is fired before the IDataBook is reloaded.

Returns:
the DataBookHandler for before reload event.

eventAfterReload

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

This event is fired after the IDataBook is reloaded.

Returns:
the DataBookHandler for after reload event.

eventBeforeFilterChanged

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

This event is fired before the filter changes.

Returns:
the DataBookHandler for before filter changed event.

eventAfterFilterChanged

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

This event is fired after the filter changes.

Returns:
the DataBookHandler for after filter changed event.

eventBeforeSortChanged

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

This event is fired before the sort changes.

Returns:
the DataBookHandler for before sort changed event.

eventAfterSortChanged

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

This event is fired afterthe sort changes.

Returns:
the DataBookHandler for after sort changed event.

eventBeforeColumnSelected

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

This event is fired before the selected column changes.

Returns:
the DataBookHandler for before column selected event.

eventAfterColumnSelected

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

This event is fired after the selected column changes.

Returns:
the DataBookHandler for after column selected event.

saveAllRows

void saveAllRows()
                 throws ModelException
Saves all IDataRows which have been changed, it is the same as 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 eventBeforeInserted() / eventAfterInserted(), eventBeforeUpdated()/ eventAfterUpdated() or eventBeforeDeleted()/ eventAfterDeleted() are fired. Afterwards the IControl.notifyRepaint() method of all registered IControls is invoked.

These events are fired for all changed rows.

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

deleteAllDataRows

@Deprecated
void deleteAllDataRows()
                       throws ModelException
Deprecated. since 2.5, use deleteAllRows() instead.

Deletes all IDataRows which are currently available, it is the same as 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.

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

deleteAllRows

void deleteAllRows()
                   throws ModelException
Deletes all IDataRows which are currently available, it is the same as 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.

Throws:
ModelException - if the IDataBook is not open or if the changes (because of the selection change) could not be saved.
See Also:
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

getAdditionalDataRow

IDataRow 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.

Returns:
the additional data row.
Throws:
ModelException - if the data book is not open.

isAdditionalDataRowVisible

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

Returns:
true, if the additional data row is visible.

setAdditionalDataRowVisible

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

Parameters:
pVisible - true, if the additional data row is visible.

setSelectedDataPageRow

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).

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.

getSelectedDataPageRow

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).

Returns:
the selected row index relatively to the current IDataPage.
Throws:
ModelException - if a exception occurs during synchronize.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.