|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IDataBook
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
.
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 DataRow s. |
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 |
---|
void setRowDefinition(IRowDefinition pRowDefinition) throws ModelException
IRowDefinition
of the IDataBook
.
pRowDefinition
- the new IRowDefinition
ModelException
- if the IRowDefinition
is emptyvoid setDataSource(IDataSource pDataSource) throws ModelException
IDataSource
for this IDataBook
.IDataSource
defines the access to the storage like DB, XML, ...
pDataSource
- the IDataSource
to use for load/save data
ModelException
- if the IDataBook
is already opened. -> Not allowedIDataSource
IDataSource getDataSource()
IDataSource
for this IDataBook
.
IDataSource
for this IDataBook
.void setName(String pName) throws ModelException
IDataBook
.
setName
in interface INamedObject
pName
- IDataBook
name
ModelException
- if the IDataBook
is already opened. -> Not allowedString getName()
IDataBook
name.
getName
in interface INamedObject
IDataBook
name.void setWritebackIsolationLevel(IDataBook.WriteBackIsolationLevel pIsolationLevel)
IDataSource
needs to write back the
data to the storage.DATA_ROW
.
pIsolationLevel
- the new write back isolation level.IDataBook.WriteBackIsolationLevel
IDataBook.WriteBackIsolationLevel getWritebackIsolationLevel()
void setMasterReference(ReferenceDefinition pReferenceDefinitionToMasterBook) throws ModelException
IDataBook
to this detail IDataBook
over a ReferenceDefinition
.
pReferenceDefinitionToMasterBook
- the ReferenceDefinition
to the master IDataBook
.
ModelException
- if the IDataBook
is openReferenceDefinition
ReferenceDefinition getMasterReference()
ReferenceDefinition
to the master IDataBook
.
ReferenceDefinition
to the master IDataBook
.boolean isSelfJoined()
IDataPage getDataPage(TreePath pTreePath) throws ModelException
pTreePath
- the TreePath.
ModelException
- if the pRootRow or pTreePath don't contains the master columns from the master
ReferenceDefinition
IDataPage getDataPage(IDataRow pRootRow, TreePath pTreePath) throws ModelException
pRootRow
- the root row.pTreePath
- the TreePath.
ModelException
- if the pRootRow or pTreePath don't contains the master columns from the master
ReferenceDefinition
IDataPage getDataPageWithRootRow(IDataRow pRootRow) throws ModelException
IDataPage
to specified root row
from the root DataBook
. If it doesn't exists, it will be created
and returned.
pRootRow
- the root IDataRow
of the root DataBook
.
IDataPage
to specified master row
from the master DataBook
.
ModelException
- if the pRootRow don't contains the master columns from the master
ReferenceDefinition
ReferenceDefinition getRootReference()
void setRootReference(ReferenceDefinition pReferenceDefinition) throws ModelException
pReferenceDefinition
- the tree root reference.
ModelException
- if the IDataBook
is openTreePath getTreePath()
void setTreePath(TreePath pTreePath) throws ModelException
pTreePath
- the tree root reference.
ModelException
- if the IDataBook
is openIDataPage getDataPage(IDataRow pMasterRow) throws ModelException
IDataPage
to specified master row
from the master DataBook
. If it doesn't exists, it will be created
and returned.
pMasterRow
- the master IDataRow
of the master DataBook
.
IDataPage
to specified master row
from the master DataBook
.
ModelException
- if the pMasterRow don't contains the master columns from the master
ReferenceDefinition
boolean hasDataPage(IDataRow pMasterDataRow) throws ModelException
IDataPage
to specified master row
from the master DataBook
exists.
pMasterDataRow
- the master IDataRow
of the master DataBook
.
IDataPage
to specified master row
from the master DataBook
exists.
ModelException
- if the pMasterRow don't contains the master columns from the master
ReferenceDefinition
IDataBook.SelectionMode getSelectionMode()
void setSelectionMode(IDataBook.SelectionMode pSelectionMode)
pSelectionMode
- the selection mode for this IDataBook.void setSelectedRow(int pDataRowIndex) throws ModelException
IDataBook
.WriteBackIsolationLevel.DATA_ROW
, the dataSource.storeAllDataBooks() method
needs to be called.IDataBook
behavior.
pDataRowIndex
- the selected row index in the IDataBook
.
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.int getSelectedRow() throws ModelException
IDataBook
.
IDataBook
or -1 if no row is selected.
ModelException
- if a exception occurs during synchronize.void setSelectedColumn(String pSelectedColumn) throws ModelException
IDataBook
.
pSelectedColumn
- the selected column in the IDataBook
.
ModelException
- if the column does not exist.
or if the IDataBook
isn't open or the master
IDataBook
has no selected row.String getSelectedColumn() throws ModelException
IDataBook
.
IDataBook
.
ModelException
- if a exception occurs during synchronize.void setDeleteCascade(boolean pDeleteCascade)
pDeleteCascade
- the value true means, delete the rows.boolean isDeleteCascade()
boolean isInsertAllowed() throws ModelException
ModelException
- if insert is not possible because row access failedboolean isInsertEnabled() throws ModelException
ModelException
- if insert is not possible because row access failedvoid setInsertEnabled(boolean pInsertEnabled)
pInsertEnabled
- true if insert is allowed on this IDataBook.boolean isUpdateAllowed() throws ModelException
ModelException
- if update is not possible because row access failedboolean isUpdateEnabled() throws ModelException
ModelException
- if update is not possible because row access failedvoid setUpdateEnabled(boolean pUpdateEnabled)
pUpdateEnabled
- true if update is enabled on this IDataBook.boolean isDeleteAllowed() throws ModelException
ModelException
- if delete is not possible because row access failedboolean isDeleteEnabled() throws ModelException
ModelException
- if delete is not possible because row access failedvoid setDeleteEnabled(boolean pDeleteEnabled)
pDeleteEnabled
- true if delete is enabled on this IDataBook.boolean isReadonly()
void setReadOnly(boolean pReadOnlyEnabled) throws ModelException
pReadOnlyEnabled
- true if this IDataBook is read only.
ModelException
- if the DataBook cannot be set read only.boolean isOpen()
IDataBook
is opened.
IDataBook
is opened.void open() throws ModelException
IDataBook
. AbstractStorage oriented implementations should open
the storage (DB, XML, File) and load the Meta data/defaulting
the RowDefinition
.
ModelException
- if the IDataBook
couldn't be opened, because of
empty storage unit name, empty IDataSource
,
missing RowDefinition or failed DataPage
creationvoid close()
IDataBook
. AbstractStorage oriented implementations should close
the storage (DB, XML, file).
int insert(boolean pBeforeRow) throws ModelException
IDataRow
. If bBeforeRow is true, it
will be inserted before the selected IDataRow
, otherwise after
that.
pBeforeRow
- specifies if the IDataRow
is inserted before or after the
selected IDataRow
IDataRow
is placed
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!)void update() throws ModelException
ModelException
- if problem with the locking in the storage happens.void delete() throws ModelException
DataRow
.
Events, if Detail DataBooks with rows exist:After the delete of the selected row is done, the IDataBookListener.AFTER_DELETING event is raised.
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.
ModelException
- if not all changes could be written to the storage
(maybe implicit save(), because of WritebackIsolationLevel)void notifyDetailChanged()
void saveSelectedRow() throws ModelException
IDataRow
.
ModelException
- if an ModelException
happens during store operation.void restoreSelectedRow() throws ModelException
IDataRow
, like the was before the changes.
ModelException
- if an ModelException
happens during undo the changes.void restoreAllRows() throws ModelException
IDataRow
's, like the was before the changes.
ModelException
- if an ModelException
happens during undo the changes.boolean isOutOfSync()
void reload() throws ModelException
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.
ModelException
- if an DataSourceException
happens during get the requested row.void reload(IDataBook.SelectionMode pSelectionMode) throws ModelException
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.
pSelectionMode
- the Selection mode to use
ModelException
- if an DataSourceException
happens during get the requested row.void setFilter(ICondition pFilter) throws ModelException
IDataBook
.ICondition
's.
It stores first all changes, and then sets the new filter.
pFilter
- the Filter
with all ICondition
's.
ModelException
- if the IDataBook
couldn't stored.ICondition
ICondition getFilter()
IDataBook
.
IDataBook
.void setSort(SortDefinition pSort) throws ModelException
IDataBook
.
pSort
- the sort order for this IDataBook
ModelException
- if the IDataBook
couldn't stored.SortDefinition
SortDefinition getSort()
IDataBook
.
IDataBook
.void addDetailDataBook(IDataBook pDataBook)
pDataBook
- the detail DataBook to usevoid removeDetailDataBook(IDataBook pDataBook)
pDataBook
- the detail IDataBook to useIDataBook[] getDetailDataBooks()
IDataBooks
to the master IDataBook
.
IDataBooks
to the master IDataBook
.void notifyMasterChanged()
DataBookHandler eventBeforeRowSelected()
DataBookHandler eventAfterRowSelected()
DataBookHandler eventBeforeInserting()
DataBookHandler eventAfterInserting()
DataBookHandler eventBeforeInserted()
DataBookHandler eventAfterInserted()
DataBookHandler eventBeforeUpdating()
DataBookHandler eventAfterUpdating()
DataBookHandler eventBeforeUpdated()
DataBookHandler eventAfterUpdated()
DataBookHandler eventBeforeDeleting()
DataBookHandler eventAfterDeleting()
DataBookHandler eventBeforeDeleted()
DataBookHandler eventAfterDeleted()
DataBookHandler eventBeforeRestore()
DataBookHandler eventAfterRestore()
DataBookHandler eventBeforeReload()
DataBookHandler eventAfterReload()
DataBookHandler eventBeforeColumnSelected()
DataBookHandler eventAfterColumnSelected()
void saveAllRows() throws ModelException
IDataRow
's to the IDataSource
.
ModelException
- if an ModelException
happens during store operation.void deleteAllDataRows() throws ModelException
DataRow
s.
ModelException
- if not all changes could be written to the storage
(maybe implicit save(), because of WritebackIsolationLevel)setSelectedRow(int)
,
delete()
void removeDataPage(IDataRow pMasterDataRow, TreePath pTreePath) throws ModelException
pMasterDataRow
- the MasterDataRow to use.pTreePath
- the TreePath to use.
ModelException
- if the remove of the DataPage didn't worked out.void saveDataPage() throws ModelException
ModelException
- if saveSelected() fails
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |