|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sibvisions.rad.model.mem.DataRow
com.sibvisions.rad.model.mem.ChangeableDataRow
com.sibvisions.rad.model.mem.MemDataBook
public class MemDataBook
The MemDataBook
is a storage independent table, and handles all operations
to load, save and manipulate table oriented data.
An MemDataBook
has at least one MemDataPage
to store all
DataRow
's of this MemDataBook
. If an MemDataBook
has detail IDataBook
's, it handles for each detail IDataBook
the IDataPage
's. Thats necessary because every change of the selected
IDataRow
needs to initiate the change of the corresponding details.
So the IDataBook
adds the appropriate IDataPage
's into the
detail IDataBook
's.
The MemDataBook
is also a IChangeableDataRow
, the selected row
of the MemDataBook
.
MemDataPage
,
IDataPage
,
IDataBook
,
IRowDefinition
,
IChangeableDataRow
,
IDataSource
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from interface javax.rad.model.IDataBook |
---|
IDataBook.SelectionMode, IDataBook.WriteBackIsolationLevel |
Field Summary | |
---|---|
protected boolean |
bMemFilter
Determines if the filter should be made in memory. |
protected boolean |
bMemSort
Determines if the sort should be made in memory. |
protected IDataBook |
rootDataBook
The root data book. |
protected DataRow |
rowInstance1
Optimization for fast row access with singleton instance of data row for search, filter, sort. |
protected DataRow |
rowInstance2
Optimization for fast row access with singleton instance of data row for search, filter, sort. |
Fields inherited from class com.sibvisions.rad.model.mem.ChangeableDataRow |
---|
DELETING, DETAILS_CHANGED, dpDataPage, INSERTING, INTERNAL_OFFSET, iRowIndex, UPDATING, WRITABLE_COLUMN_CHANGED |
Fields inherited from class com.sibvisions.rad.model.mem.DataRow |
---|
oaStorage, rdRowDefinition |
Constructor Summary | |
---|---|
MemDataBook()
Contructs a new MemDataBook with an empty RowDefinition . |
|
MemDataBook(RowDefinition pRowDefinition)
Constructs a new MemDataBook with the given RowDefinition . |
Method Summary | |
---|---|
void |
addControl(IControl pControl)
Adds the given IControl to this IDataRow as control. |
void |
addDetailDataBook(IDataBook pDetailDataBook)
Registers the given IDataBook as a detail IDataBook . |
protected void |
calculateRow()
Calculates the given row. |
void |
cancelEditingControls()
Informs all registered controls that they should
cancel any pending editing operation and revert to the values in this
IDataRow . |
protected void |
clear()
It clears the AbstractStorage of the MemDataBook. |
protected void |
clearCurrentDataPage()
It clears the AbstractStorage of the MemDataBook. |
protected void |
clearFilterSortInCurrentMemDataPage()
It clears all mem filter sorts in the MemDataPages. |
protected void |
clearFilterSortInMemDataPages()
It clears all mem filter sorts in the MemDataPages. |
void |
close()
Closes this IDataBook . |
protected MemDataPage |
createAndCacheDataPage(IDataRow pMasterDataRow)
It constructs a new MemDataPage and puts it in the datapage cache. |
protected MemDataPage |
createDataPage(IDataRow pMasterDataRow)
It constructs a new MemDataPage. |
IDataRow |
createDataRow(java.lang.String[] pColumnNames)
Creates and returns a new IDataRow which only contains the
specified columns and their values. |
static IReadOnlyChecker |
createReadOnlyChecker(java.lang.Object pReadOnlyCheckerObject,
java.lang.String pMethodName)
Creates a read only checkerr instance with the given object and method name. |
static IRowCalculator |
createRowCalculator(java.lang.Object pRowCalculatorObject,
java.lang.String pMethodName)
Creates a row calculator instance with the given object and method name. |
void |
delete()
Deletes the currently selected row. |
void |
deleteAllDataRows()
Deprecated. |
void |
deleteAllRows()
Deletes all IDataRow s which are currently available, it is the
same as IDataBook.delete() except that it is a mass operation on all rows. |
DataBookHandler |
eventAfterColumnSelected()
Gets the DataBookHandler for after column selected event. |
DataBookHandler |
eventAfterDeleted()
Gets the DataBookHandler for after deleted event. |
DataBookHandler |
eventAfterDeleting()
Gets the DataBookHandler for after deleting event. |
DataBookHandler |
eventAfterFilterChanged()
Gets the DataBookHandler for after filter changed event. |
DataBookHandler |
eventAfterInserted()
Gets the DataBookHandler for after inserted event. |
DataBookHandler |
eventAfterInserting()
Gets the DataBookHandler for after inserting event. |
DataBookHandler |
eventAfterReload()
Gets the DataBookHandler for after reload event. |
DataBookHandler |
eventAfterRestore()
Gets the DataBookHandler for after restore event. |
DataBookHandler |
eventAfterRowSelected()
Gets the DataBookHandler for after row selected event. |
DataBookHandler |
eventAfterSortChanged()
Gets the DataBookHandler for after sort changed event. |
DataBookHandler |
eventAfterUpdated()
Gets the DataBookHandler for after updated event. |
DataBookHandler |
eventAfterUpdating()
Gets the DataBookHandler for after updating event. |
DataBookHandler |
eventBeforeColumnSelected()
Gets the DataBookHandler for before column selected event. |
DataBookHandler |
eventBeforeDeleted()
Gets the DataBookHandler for before deleted event. |
DataBookHandler |
eventBeforeDeleting()
Gets the DataBookHandler for before deleting event. |
DataBookHandler |
eventBeforeFilterChanged()
Gets the DataBookHandler for before filter changed event. |
DataBookHandler |
eventBeforeInserted()
Gets the DataBookHandler for before inserted event. |
DataBookHandler |
eventBeforeInserting()
Gets the DataBookHandler for before inserting event. |
DataBookHandler |
eventBeforeReload()
Gets the DataBookHandler for before reload event. |
DataBookHandler |
eventBeforeRestore()
Gets the DataBookHandler for before restore event. |
DataBookHandler |
eventBeforeRowSelected()
Gets the DataBookHandler for before row selected event. |
DataBookHandler |
eventBeforeSortChanged()
Gets the DataBookHandler for before sort changed event. |
DataBookHandler |
eventBeforeUpdated()
Gets the DataBookHandler for before updated event. |
DataBookHandler |
eventBeforeUpdating()
Gets the DataBookHandler for before updating event. |
protected void |
executeDelete(IChangeableDataRow pDataRow)
Its called when the deleting DataRow (delete row) should be deleted. |
protected IDataRow |
executeInsert(IChangeableDataRow pDataRow)
Its called when the inserting DataRow (new row) should be inserted. |
protected IDataRow |
executeLockAndRefetch(IChangeableDataRow pDataRow)
Its called before the DataRow (existing row) will be changed. |
protected void |
executeRefresh()
It will be called, when the MemDataBook will be completely refreshed. |
protected void |
executeRefreshDataPage()
It will be called, when the MemDataBook will be completely refreshed. |
protected IDataRow |
executeUpdate(IChangeableDataRow pDataRow)
Its called when the updating DataRow (changed row) should be updated Derived classed should override this to implemented the needed functionality. |
void |
fetchAll()
Fetches all IDataRow s from the storage. |
protected void |
finalize()
|
ChangeableDataRow |
getAdditionalDataRow()
Returns the additional data row. |
int[] |
getChangedDataRows()
Deprecated. |
int[] |
getChangedRows()
Gets an int array containing the indexes of all changed IDataRow
s. |
IDataBook |
getDataBook()
Gets the parent IDataBook . |
IDataPage |
getDataPage()
Gets the parent IDataPage . |
IDataPage |
getDataPage(IDataRow pMasterDataRow)
Returns the corresponding IDataPage to specified master row
from the master DataBook . |
IDataPage |
getDataPage(IDataRow pRootRow,
TreePath pTreePath)
Gets the IDataPage for the given TreePath and the given
root row . |
IDataPage |
getDataPage(TreePath pTreePath)
Gets the IDataPage for the given TreePath . |
IDataPage |
getDataPageWithRootRow(IDataRow pRootDataRow)
Returns the corresponding IDataPage to specified root row
from the root DataBook . |
IChangeableDataRow |
getDataRow(int pDataRowIndex)
Gets a copy of the IChangeableDataRow at the specified index. |
IDataSource |
getDataSource()
Gets the IDataSource that is used. |
IDataBook[] |
getDetailDataBooks()
Gets all detail IDataBook s as array. |
int |
getEstimatedRowCount()
Returns the row count in IDBAccess for this RemoteDataBook. |
ICondition |
getFilter()
Gets the used filter . |
IDataRow |
getMasterDataRow()
Gets the corresponding master row . |
ReferenceDefinition |
getMasterReference()
Gets the master reference that is used. |
java.lang.String |
getName()
Gets the name that is used. |
IDataRow |
getOriginalDataRow()
Gets the original IDataRow , before any changes were performed. |
int |
getReadAhead()
Returns the count of rows which are read ahead from the IDBAccess. |
IReadOnlyChecker |
getReadOnlyChecker()
Gets the IReadOnlyChecker . |
IDataBook |
getRootDataBook()
Gets the root data book. |
protected IDataBook |
getRootDataBookIntern()
Evaluates the current root data book. |
ReferenceDefinition |
getRootReference()
Gets the tree root reference. |
IRowCalculator |
getRowCalculator()
Gets the IRowCalculator . |
int |
getRowCount()
Gets the number of rows which are currently held. |
IRowDefinition |
getRowDefinition()
Gets the IRowDefinition that is used. |
int |
getRowIndex()
Gets the row index within the parent IDataPage . |
java.lang.String |
getSelectedColumn()
Gets the name of the selected column. |
int |
getSelectedDataPageRow()
Returns the selected row index relatively to the current IDataPage . |
int |
getSelectedRow()
Gets the index of the selected row. |
IDataBook.SelectionMode |
getSelectionMode()
Gets the IDataBook.SelectionMode that is used. |
SortDefinition |
getSort()
Gets the used SortDefinition . |
TreePath |
getTreePath()
Gets the tree current tree path. |
java.lang.Object |
getUID()
Gets the internal unique identifier for this IDataRow . |
java.lang.Object |
getValue(int pColumnIndex)
Returns the value of the column by index. |
java.lang.Object |
getValue(java.lang.String pColumnName)
Returns the value of the named column. |
java.lang.Object[] |
getValues(java.lang.String[] pColumnNames)
Gets the values from all specified columns as an Object array. |
IDataBook.WriteBackIsolationLevel |
getWritebackIsolationLevel()
Gets the IDataBook.WriteBackIsolationLevel that is used. |
boolean |
hasChanges()
Checks if the databook has changes. |
boolean |
hasDataPage(IDataRow pMasterDataRow)
Returns true if an IDataPage to specified master row from
the master DataBook exists. |
boolean |
hasDataPage(IDataRow pRootDataRow,
TreePath pTreePath)
Returns true if an IDataPage to specified root row and TreePath
from the master DataBook exists. |
int |
insert(boolean pBeforeRow)
Inserts a new IDataRow at the current position. |
protected void |
invokeTreeCancelEditingControls()
Its invokes for each IComponent the cancelEditing() method. |
protected void |
invokeTreeSaveEditingControls()
It invokes for each IComponent the saveEditing() method. |
boolean |
isAdditionalDataRowVisible()
True, if the additional data row is visible. |
boolean |
isAllFetched()
Gets if all IDataRow s have been fetched from the storage, and
there is nothing more to fetch. |
protected boolean |
isDataPageRefetchPossible()
This function is used for rehashing data pages after insert of the master row. |
boolean |
isDeleteAllowed()
Gets if it is possible to delete an already existing
row. |
boolean |
isDeleteCascade()
Gets if a delete on a master IDataBook should also delete all
rows associated with the master row in this IDataBook . |
boolean |
isDeleteEnabled()
Gets if deleting a row is enabled. |
boolean |
isDeleting()
Gets if this row is currently being deleted, which means that it has been removed/deleted but this action has not yet been finalized. |
boolean |
isDetailChanged()
Gets if any associated detail rows have been modified. |
boolean |
isInsertAllowed()
Gets if it is possible to IDataBook.insert(boolean) a new row. |
boolean |
isInsertEnabled()
Gets if inserting is enabled. |
boolean |
isInserting()
Gets if this row is currently being inserted, which means that it has been created but has not yet been saved/finalized. |
boolean |
isLockAndRefetchEnabled()
Returns true if lock and refetch is enabled. |
protected boolean |
isMemFilter()
Returns true if the filter is handled in memory. |
protected boolean |
isMemSort()
Returns true if the sort is handled in memory. |
boolean |
isOpen()
Gets if this IDataBook is open. |
boolean |
isOutOfSync()
Gets if this IDataBook is out of sync with its master. |
boolean |
isReadOnly()
Gets if this IDataBook is read only. |
boolean |
isSelfJoined()
Gets if this IDataBook has been joined with itself. |
boolean |
isSortDataRowOnSave()
Is true, if the current saved row should be moved to the correct possition according to the set SortDefinition. |
boolean |
isUpdateAllowed()
Gets if it is possible to update an
already existing row. |
boolean |
isUpdateEnabled()
Gets if IDataRow.setValue(String, Object) updating a row is enabled. |
boolean |
isUpdating()
Gets if this row is currently being updated, which means that its values are changed but these changes have not yet been saved/finalized. |
boolean |
isWritableColumnChanged()
Gets if there was a writeable column changed. |
protected boolean |
isWritebackEnabled()
Returns true if this data book should write its changes to the storage. |
protected SortDefinition |
keepSortableColumns(SortDefinition pSortDefinition)
Returns a new SortDefinition with only the ColumnDefinition.isSortable() columns
from the given SortDefinition . |
void |
notifyDetailChanged()
Notifies the master IDataBook that one or more detail rows have
changed. |
void |
notifyMasterChanged()
Notifies this IDataBook that its master IDataBook has
changed. |
void |
notifyRepaintControls()
Informs all registered controls that there are new
values and that they must redraw themselves. |
void |
open()
Opens this IDataBook . |
void |
reload()
Reloads all rows from the storage, any changes are discarded. |
void |
reload(IDataBook.SelectionMode pSelectionMode)
Reloads all rows from the storage (any changes are discarded) and applies the given IDataBook.SelectionMode to this reload operation. |
void |
reloadDataPage(IDataBook.SelectionMode pSelectionMode)
Reload the current DataPage with the pSelectionMode. |
protected void |
reloadIntern()
Reloads without sending before reload event. |
void |
removeDataPage(IDataRow pMasterDataRow,
TreePath pTreePath)
Removes the DataPage to the specified master DataRow or TreePath. e.g. |
void |
removeDetailDataBook(IDataBook pDetailDataBook)
Unregisters the given IDataBook as a detail IDataBook . |
void |
restoreAllRows()
Restores all rows to a state without changes. |
void |
restoreDataPage()
Restores all rows in the current DataPage. |
void |
restoreSelectedRow()
Restores the currently selected row to a state without changes. |
void |
saveAllRows()
Saves all IDataRow s which have been changed, it is the same as
IDataBook.saveSelectedRow() except that it is a mass operation on all
rows. |
void |
saveDataPage()
Saves all rows in the current DataPage. |
void |
saveEditingControls()
Informs all registered controls that they should
save their values. |
void |
saveSelectedRow()
Saves the currently selected row. |
int |
searchNext(ICondition pCondition)
Searches for the first occurrence of an IDataRow which matches
the given ICondition and returns its index. |
int |
searchNext(ICondition pCondition,
int pRowNum)
Searches for the next occurrence of an IDataRow which matches the
given ICondition and returns its index. |
int |
searchPrevious(ICondition pCondition)
Searches for the last occurrence of an IDataRow which matches the
given ICondition and returns its index. |
int |
searchPrevious(ICondition pCondition,
int pRowNum)
Searches for the previous occurrence of an IDataRow which matches
the given ICondition and returns its index. |
void |
setAdditionalDataRowVisible(boolean pVisible)
Set true, if the additional data row is visible. |
void |
setDataSource(IDataSource pDataSource)
Sets the IDataSource to use, which allows the IDataBook
to retrieve and set data. |
void |
setDeleteCascade(boolean pDeleteCascade)
Sets if a delete on a master IDataBook should also delete all
rows associated with the master row in this IDataBook . |
void |
setDeleteEnabled(boolean pDeleteEnabled)
Sets if deleting a row is enabled. |
void |
setFilter(ICondition pFilter)
Sets the filter that is used. |
void |
setInsertEnabled(boolean pInsertEnabled)
Sets if inserting is enabled. |
void |
setLockAndRefetchEnabled(boolean pLockAndRefetchEnabled)
Sets whether if lock and refetch is enabled. |
void |
setMasterReference(ReferenceDefinition pMasterReference)
Sets the master reference that is going to be
used. |
protected void |
setMemFilter(boolean pMemFilter)
Sets if the sort is handled in memory. |
protected void |
setMemSort(boolean pMemSort)
Sets if the sort is handled in memory. |
void |
setName(java.lang.String pName)
Sets the name to use. |
void |
setReadAhead(int pReadAheadRowCount)
Sets the count of rows which are read ahead from the IDBAccess. |
void |
setReadOnly(boolean pReadOnly)
Sets if this IDataBook is read only. |
void |
setReadOnlyChecker(IReadOnlyChecker pReadOnlyChecker)
Sets the IReadOnlyChecker . |
void |
setReadOnlyChecker(java.lang.Object pReadOnlyCheckerObject,
java.lang.String pMethodName)
Sets the read only checker. |
void |
setReadOnlyWithoutSave(boolean pReadOnly)
Sets the databook readonly but does not automatically save. |
void |
setRootReference(ReferenceDefinition pTreeRootReference)
Sets the tree root reference. |
void |
setRowCalculator(IRowCalculator pRowCalculator)
Sets the IRowCalculator . |
void |
setRowCalculator(java.lang.Object pRowCalculatorObject,
java.lang.String pMethodName)
Sets the row calculator. |
void |
setRowDefinition(IRowDefinition pRowDefinition)
Sets the RowDefinition to use. |
void |
setSelectedColumn(java.lang.String pColumnName)
Sets the selected column based on the given name. |
void |
setSelectedDataPageRow(int pDataRowIndex)
Sets the selected row index relatively to the current IDataPage . |
void |
setSelectedRow(int pDataRowIndex)
Sets the selected IDataRow to the given index. |
protected void |
setSelectedRowInternal(int pDataRowIndex)
Sets the selected row with throwing any changed events. |
void |
setSelectionMode(IDataBook.SelectionMode pSelectionMode)
Sets the IDataBook.SelectionMode that should be used. |
void |
setSort(SortDefinition pSort)
Sets the SortDefinition that is used. |
void |
setSortDataRowOnSave(boolean pSortDataRowOnSave)
Is true, if the current saved row should be moved to the correct possition according to the set SortDefinition. |
void |
setTreePath(TreePath pTreePath)
Sets the tree current tree path. |
void |
setUpdateEnabled(boolean pUpdateEnabled)
Sets if IDataRow.setValue(String, Object) updating a row is enabled. |
void |
setValue(java.lang.String pColumnName,
java.lang.Object pValue)
Sets the value of the named column. |
void |
setValues(java.lang.String[] pColumnNames,
java.lang.Object[] pValues)
Sets all columns of the given names to the given values. |
protected void |
setWritebackEnabled(boolean pWritebackEnabled)
Sets if this data book should write back its changes to the storage. |
void |
setWritebackIsolationLevel(IDataBook.WriteBackIsolationLevel pIsolationLevel)
Sets the IDataBook.WriteBackIsolationLevel to use. |
protected void |
store()
It stores the changes in memory as stored. |
java.lang.String |
toString()
|
void |
update()
Sets the currently selected row as "updating". |
Methods inherited from class com.sibvisions.rad.model.mem.ChangeableDataRow |
---|
getOriginalRow, restore, setDeleting, setDetailChanged, setInserting, setUID, setUpdating, setValueIntern |
Methods inherited from class com.sibvisions.rad.model.mem.DataRow |
---|
compareTo, compareTo, createEmptyDataRow, createEmptyRow, equals, equals, eventValuesChanged, eventValuesChanged, getControls, getValueAsString, getValuesAsString, hasControls, hashCode, invokeCancelEditingControls, invokeRepaintListeners, invokeSaveEditingControls, removeControl, setDefaultValues, setValuesIntern |
Methods inherited from class java.lang.Object |
---|
clone, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.rad.model.IChangeableDataRow |
---|
getOriginalRow |
Methods inherited from interface javax.rad.model.IDataRow |
---|
compareTo, createEmptyDataRow, createEmptyRow, equals, eventValuesChanged, eventValuesChanged, getControls, getValueAsString, getValuesAsString, removeControl |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Field Detail |
---|
protected boolean bMemSort
protected boolean bMemFilter
protected DataRow rowInstance1
protected DataRow rowInstance2
protected IDataBook rootDataBook
Constructor Detail |
---|
public MemDataBook()
MemDataBook
with an empty RowDefinition
.
public MemDataBook(RowDefinition pRowDefinition)
MemDataBook
with the given RowDefinition
.
pRowDefinition
- the row definition for the data bookMethod Detail |
---|
public IDataBook getDataBook()
IDataBook
.
getDataBook
in interface IDataPage
IDataBook
.public java.lang.String getName()
getName
in interface IDataBook
getName
in interface INamedObject
IDataBook.setName(String)
public void setName(java.lang.String pName) throws ModelException
The name can only be set if the IDataBook
is not already
open
.
setName
in interface IDataBook
setName
in interface INamedObject
pName
- the name to use.
ModelException
- if the IDataBook
is already
open
.IDataBook.getName()
public void setWritebackIsolationLevel(IDataBook.WriteBackIsolationLevel pIsolationLevel) throws ModelException
IDataBook.WriteBackIsolationLevel
to use.
The default value should be IDataBook.WriteBackIsolationLevel.DATA_ROW
.
setWritebackIsolationLevel
in interface IDataBook
pIsolationLevel
- the IDataBook.WriteBackIsolationLevel
to use.
ModelException
- if setting DATAROW level fails, because saveAllRows fails.IDataBook.getWritebackIsolationLevel()
,
IDataBook.WriteBackIsolationLevel
public IDataBook.WriteBackIsolationLevel getWritebackIsolationLevel()
IDataBook.WriteBackIsolationLevel
that is used.
The default value should be IDataBook.WriteBackIsolationLevel.DATA_ROW
.
getWritebackIsolationLevel
in interface IDataBook
IDataBook.WriteBackIsolationLevel
that is used.IDataBook.setWritebackIsolationLevel(WriteBackIsolationLevel)
,
IDataBook.WriteBackIsolationLevel
public void setRowDefinition(IRowDefinition pRowDefinition) throws ModelException
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
.
setRowDefinition
in interface IDataBook
pRowDefinition
- the RowDefinition
to use.
ModelException
- if the IDataBook
is already
open
.IDataRow.getRowDefinition()
,
IRowDefinition
public IDataSource getDataSource()
IDataSource
that is used.
getDataSource
in interface IDataBook
IDataSource
that is used.IDataBook.setDataSource(IDataSource)
,
IDataSource
public void setDataSource(IDataSource pDataSource) throws ModelException
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
.
setDataSource
in interface IDataBook
pDataSource
- the IDataSource
to use.
ModelException
- if the IDataBook
is already
open
.IDataBook.getDataSource()
,
IDataSource
public ReferenceDefinition getMasterReference()
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.
getMasterReference
in interface IDataBook
master reference
that is used.public void setMasterReference(ReferenceDefinition pMasterReference) throws ModelException
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
.
setMasterReference
in interface IDataBook
pMasterReference
- the master reference
that is going to be used.
ModelException
- if the IDataBook
is already
open
.IDataBook.getMasterReference()
,
ReferenceDefinition
public boolean isSelfJoined()
IDataBook
has been joined with itself.
isSelfJoined
in interface IDataBook
true
if this IDataBook
has been joined with
itself.public IDataPage getDataPage(TreePath pTreePath) throws ModelException
IDataPage
for the given TreePath
.
getDataPage
in interface IDataBook
pTreePath
- the TreePath
.
IDataPage
for the given TreePath
.
ModelException
- if the pRootRow or pTreePath don't contains the
master columns from the master
ReferenceDefinition
public IDataPage getDataPage(IDataRow pRootRow, TreePath pTreePath) throws ModelException
IDataPage
for the given TreePath
and the given
root row
.
getDataPage
in interface IDataBook
pRootRow
- the root row
.pTreePath
- the TreePath
.
IDataPage
for the given TreePath
and
root row
.
ModelException
- if the pRootRow or pTreePath don't contains the
master columns from the master
ReferenceDefinition
public IDataPage getDataPageWithRootRow(IDataRow pRootDataRow) throws ModelException
IDataPage
to specified root row
from the root DataBook
. If it doesn't exists, it will be
created and returned.
getDataPageWithRootRow
in interface IDataBook
pRootDataRow
- 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
public ReferenceDefinition getRootReference()
getRootReference
in interface IDataBook
public void setRootReference(ReferenceDefinition pTreeRootReference) throws ModelException
setRootReference
in interface IDataBook
pTreeRootReference
- the tree root reference.
ModelException
- if the IDataBook
is openpublic TreePath getTreePath()
getTreePath
in interface IDataBook
public void setTreePath(TreePath pTreePath) throws ModelException
setTreePath
in interface IDataBook
pTreePath
- the tree root reference.
ModelException
- if the IDataBook
is openpublic void notifyMasterChanged()
IDataBook
that its master IDataBook
has
changed.
notifyMasterChanged
in interface IDataBook
public void removeDataPage(IDataRow pMasterDataRow, TreePath pTreePath) throws ModelException
removeDataPage
in interface IDataBook
pMasterDataRow
- the MasterDataRow to use.pTreePath
- the TreePath to use.
ModelException
- if the remove of the DataPage didn't worked out.public IDataBook.SelectionMode getSelectionMode()
IDataBook.SelectionMode
that is used.
getSelectionMode
in interface IDataBook
IDataBook.SelectionMode
that is used.IDataBook.setSelectionMode(SelectionMode)
public void setSelectionMode(IDataBook.SelectionMode pSelectionMode)
IDataBook.SelectionMode
that should be used.
setSelectionMode
in interface IDataBook
pSelectionMode
- the IDataBook.SelectionMode
that should be used.IDataBook.getSelectionMode()
public boolean isInsertAllowed()
IDataBook.insert(boolean)
a new row.
An insert might not be possible if it is either disabled
or if the storage does not allow an insert.
isInsertAllowed
in interface IDataBook
true
if it is possible to IDataBook.insert(boolean)
a row.IDataBook.isInsertEnabled()
,
IDataBook.setInsertEnabled(boolean)
public boolean isInsertEnabled()
inserting
is enabled.
isInsertEnabled
in interface IDataBook
true
if inserting
is enabled.IDataBook.isInsertAllowed()
,
IDataBook.setInsertEnabled(boolean)
public void setInsertEnabled(boolean pInsertEnabled)
inserting
is enabled.
setInsertEnabled
in interface IDataBook
pInsertEnabled
- true
if inserting
is enabled.IDataBook.isInsertAllowed()
,
IDataBook.isInsertEnabled()
public boolean isUpdateAllowed() throws ModelException
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.
isUpdateAllowed
in interface IDataBook
true
if it is possible to
update
a row.
ModelException
- if the state could not be determined.IDataBook.isUpdateEnabled()
,
IDataBook.setUpdateEnabled(boolean)
public boolean isUpdateEnabled() throws ModelException
IDataRow.setValue(String, Object)
updating a row is enabled.
isUpdateEnabled
in interface IDataBook
true
if IDataRow.setValue(String, Object)
updating a row
is enabled.
ModelException
- if the state could not be determined.IDataBook.isUpdateAllowed()
,
IDataBook.setUpdateEnabled(boolean)
public void setUpdateEnabled(boolean pUpdateEnabled)
IDataRow.setValue(String, Object)
updating a row is enabled.
setUpdateEnabled
in interface IDataBook
pUpdateEnabled
- true
if IDataRow.setValue(String, Object)
updating a row is enabled.IDataBook.isUpdateAllowed()
,
IDataBook.isUpdateEnabled()
public boolean isDeleteAllowed() throws ModelException
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.
isDeleteAllowed
in interface IDataBook
true
if it is possible to delete
a row.
ModelException
- if the state could not be determined.IDataBook.isDeleteEnabled()
,
IDataBook.setDeleteEnabled(boolean)
public boolean isDeleteEnabled() throws ModelException
deleting
a row is enabled.
isDeleteEnabled
in interface IDataBook
true
if deleting
a row is enabled.
ModelException
- if the state could not be determined.IDataBook.isDeleteAllowed()
,
IDataBook.setDeleteCascade(boolean)
public void setDeleteEnabled(boolean pDeleteEnabled)
deleting
a row is enabled.
setDeleteEnabled
in interface IDataBook
pDeleteEnabled
- true
if deleting
a row is
enabled.IDataBook.isDeleteAllowed()
,
IDataBook.isDeleteEnabled()
public boolean isReadOnly()
IDataBook
is read only.
isReadOnly
in interface IDataBook
true
this IDataBook
is read only.IDataBook.setReadOnly(boolean)
public void setReadOnly(boolean pReadOnly) throws ModelException
IDataBook
is read only.
If there are changes and the IDataBook
is set to read only, the
changed data is saved.
setReadOnly
in interface IDataBook
pReadOnly
- true
if this IDataBook
is read
only.
ModelException
- if saving any changes failed.IDataBook.isReadOnly()
public boolean isOpen()
IDataBook
is open.
isOpen
in interface IDataBook
true
if this IDataBook
is open.IDataBook.open()
public void open() throws ModelException
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).
open
in interface IDataBook
ModelException
- if there is no name
set, or if
there is no column in the row
definition
, or if there is no IDataBook.getDataSource()
set.public void close()
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.
close
in interface IDataBook
public int getRowCount() throws ModelException
getRowCount
in interface IDataPage
ModelException
- if the number of rows could not be determined.public int getSelectedRow() throws ModelException
The index might -1
if there is no row selected or if this
IDataBook
is not IDataBook.isOpen()
.
getSelectedRow
in interface IDataBook
-1
if there is none
selected or the IDataBook
is not open
.
ModelException
- if the synchronization with the master failed.IDataBook.setSelectedRow(int)
public void setSelectedRow(int pDataRowIndex) throws ModelException
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 IControl
s is invoked. Afterwards
the IDataBook.eventBeforeRowSelected()
and
IDataBook.eventAfterRowSelected()
events are fired in this order. The last
action is that the IControl.notifyRepaint()
method of all registered IControl
s is invoked.
setSelectedRow
in interface IDataBook
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.
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.IDataBook.getSelectedRow()
public java.lang.String getSelectedColumn() throws ModelException
The returned name might be null
if there is no column selected.
getSelectedColumn
in interface IDataBook
null
if there is none
selected.
ModelException
- if the synchronization with the master failed.IDataBook.setSelectedColumn(String)
public void setSelectedColumn(java.lang.String pColumnName) throws ModelException
If the given column name is null
no column is selected (if there
is already a row selected, it will be unselected).
Before the selection changes the IDataBook.eventBeforeColumnSelected()
is
fired and afterwards the IDataBook.eventAfterColumnSelected()
is fired.
setSelectedColumn
in interface IDataBook
pColumnName
- the name of the column to select, can be
null
to remove the selection (if any).
ModelException
- if the IDataBook
is not open
or if there is no column with the given name or if
synchronization with the master failed.IDataBook.getSelectedColumn()
public boolean isDeleteCascade()
IDataBook
should also delete all
rows associated with the master row in this IDataBook
.
isDeleteCascade
in interface IDataBook
true
if the rows in this IDataBook
should be
deleted if the master row is deleted.IDataBook.setDeleteCascade(boolean)
public void setDeleteCascade(boolean pDeleteCascade)
IDataBook
should also delete all
rows associated with the master row in this IDataBook
.
setDeleteCascade
in interface IDataBook
pDeleteCascade
- true
if the rows in this IDataBook
should be deleted if the master row is deleted.IDataBook.isDeleteCascade()
public int insert(boolean pBeforeRow) throws ModelException
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:
IControl.saveEditing()
is invoked on all
registered IControl
s.IDataBook.eventBeforeInserting()
IDataBook.eventAfterInserting()
IDataBook.eventAfterRowSelected()
IControl.notifyRepaint()
is invoked on all
registered IControl
s.
insert
in interface IDataBook
pBeforeRow
- if the new row should be inserted before the current
selection.
ModelException
- if the IDataBook
is not open
, or if saving of already existing changes failed, or if
IDataBook.isInsertAllowed()
is disabled, or if saving the row
to the storage failed.public void update() throws ModelException
value is set
. If there
is no row selected a ModelException
is thrown.
The storage might want to reload and eventually lock the row that is being updated.
Before the update is executed the IDataBook.eventBeforeUpdating()
is fired
and afterwards the IDataBook.eventAfterUpdating()
is fired.
update
in interface IDataBook
ModelException
- if the IDataBook
is not open
, or if IDataBook.isUpdateAllowed()
is disabled (for
example no row is selected), or if there was an error when
setting the state.public void delete() throws ModelException
ModelException
is thrown. It deletes the selected.
Before the delete is executed the IDataBook.eventBeforeDeleting()
is fired
and afterwards the IDataBook.eventAfterDeleting()
is fired. As the row has
been deleted at that point, the selected row
is changed to the next row.
delete
in interface IDataBook
ModelException
- if the IDataBook
is not open
, or if IDataBook.isDeleteAllowed()
is disabled (for
example no row is selected), or if there was an error when
setting the state.@Deprecated public void deleteAllDataRows() throws ModelException
IDataRow
s which are currently available, it is the
same as IDataBook.delete()
except that it is a mass operation on all rows.
Deleting all rows does only delete the currently available rows, rows
which do not match the currently applied filter
will
not be deleted.
First the row is selected
and afterwards
deleted
.
These events are fired for all rows.
deleteAllDataRows
in interface IDataBook
ModelException
- if the IDataBook
is not open
or if the changes (because of the selection change)
could not be saved.IDataBook.delete()
public void deleteAllRows() throws ModelException
IDataRow
s which are currently available, it is the
same as IDataBook.delete()
except that it is a mass operation on all rows.
Deleting all rows does only delete the currently available rows, rows
which do not match the currently applied filter
will
not be deleted.
First the row is selected
and afterwards
deleted
.
These events are fired for all rows.
deleteAllRows
in interface IDataBook
ModelException
- if the IDataBook
is not open
or if the changes (because of the selection change)
could not be saved.IDataBook.delete()
public void notifyDetailChanged()
IDataBook
that one or more detail rows have
changed.
notifyDetailChanged
in interface IDataBook
public IChangeableDataRow getDataRow(int pDataRowIndex) throws ModelException
IChangeableDataRow
at the specified index.
Returns null
if there is no row at the specified index.
If the row is currently not in memory, it will be fetched from the underlying storage.
getDataRow
in interface IDataPage
pDataRowIndex
- the index of the IChangeableDataRow
to get.
IChangeableDataRow
at the specified index,
null
if there is no row at the specified index.
ModelException
- if the IChangeableDataRow
at the specified
index can no be got.public ChangeableDataRow getAdditionalDataRow() throws ModelException
getAdditionalDataRow
in interface IDataBook
ModelException
- if the data book is not open.public boolean isAdditionalDataRowVisible()
isAdditionalDataRowVisible
in interface IDataBook
public void setAdditionalDataRowVisible(boolean pVisible)
setAdditionalDataRowVisible
in interface IDataBook
pVisible
- true, if the additional data row is visible.public int getSelectedDataPageRow() throws ModelException
IDataPage
.
getSelectedDataPageRow
in interface IDataBook
IDataPage
.
ModelException
- if a exception occurs during synchronize.public void setSelectedDataPageRow(int pDataRowIndex) throws ModelException
IDataPage
.
setSelectedDataPageRow
in interface IDataBook
pDataRowIndex
- the selected row index relatively to the current
IDataPage
.
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.public IDataRow getOriginalDataRow() throws ModelException
IDataRow
, before any changes were performed.
getOriginalDataRow
in interface IChangeableDataRow
getOriginalDataRow
in class ChangeableDataRow
IDataRow
, before any changes were performed.
ModelException
- if the original IDataRow
could not be got.public boolean isWritableColumnChanged() throws ModelException
isWritableColumnChanged
in interface IChangeableDataRow
isWritableColumnChanged
in class ChangeableDataRow
true
if there was a writeable column changed.
ModelException
- if the state could not be determined.public boolean isDeleting() throws ModelException
isDeleting
in interface IChangeableDataRow
isDeleting
in class ChangeableDataRow
ModelException
- if the state could not be determined.public boolean isUpdating() throws ModelException
isUpdating
in interface IChangeableDataRow
isUpdating
in class ChangeableDataRow
true
if this row is currently being changed.
ModelException
- if the state could not be determined.public boolean isInserting() throws ModelException
isInserting
in interface IChangeableDataRow
isInserting
in class ChangeableDataRow
true
if this row is currently being inserted.
ModelException
- if the state could not be determined.public boolean isDetailChanged() throws ModelException
isDetailChanged
in interface IChangeableDataRow
isDetailChanged
in class ChangeableDataRow
true
if any associated detail rows have been modified.
ModelException
- if the state of the detail rows could not be
determined.public java.lang.Object getUID() throws ModelException
IDataRow
.
getUID
in interface IChangeableDataRow
getUID
in class ChangeableDataRow
IDataRow
.
ModelException
- if the unique identifier could not be determined.public ICondition getFilter()
filter
. Can be null
if none is
used or set.
getFilter
in interface IDataBook
filter
, null
if none used or
set.IDataBook.setFilter(ICondition)
,
ICondition
public void setFilter(ICondition pFilter) throws ModelException
filter
that is used. If the given
filter
is null
no filter will be applied to
the data.
This call is schematically equal to IDataBook.reload()
with the exception
that changes are saved before the filter
is applied.
setFilter
in interface IDataBook
pFilter
- the filter
to apply.
ModelException
- if the IDataBook
is not open
or the data could not be reloaded.IDataBook.getFilter()
,
ICondition
public SortDefinition getSort()
SortDefinition
. Can be null
if there is
none set or used.
getSort
in interface IDataBook
SortDefinition
, null
if there is none
set or used.IDataBook.setSort(SortDefinition)
,
SortDefinition
public void setSort(SortDefinition pSort) throws ModelException
SortDefinition
that is used. The given
SortDefinition
can be null
for no sorting.
This is schematically equal top IDataBook.setFilter(ICondition)
.
setSort
in interface IDataBook
pSort
- the SortDefinition
to use. Can be null
for
no sorting.
ModelException
- if the changes could not be stored.IDataBook.getSort()
,
SortDefinition
public void reload() throws ModelException
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 IControl
s is invoked. After
that the IDataBook.eventBeforeReload()
is fired and afterwards the
IDataBook.eventAfterReload()
. Afterwards the
IControl.notifyRepaint()
method of all
registered IControl
s is invoked.
reload
in interface IDataBook
ModelException
- if the IDataBook
is not open
or if the reload failed.IDataBook.reload(SelectionMode)
public void reload(IDataBook.SelectionMode pSelectionMode) throws ModelException
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 IControl
s is invoked. After
that the IDataBook.eventBeforeReload()
is fired and afterwards the
IDataBook.eventAfterReload()
. Afterwards the
IControl.notifyRepaint()
method of all
registered IControl
s is invoked.
reload
in interface IDataBook
pSelectionMode
- the Selection mode to use
ModelException
- if the IDataBook
is not open
or if the reload failed.IDataBook.reload()
public void restoreSelectedRow() throws ModelException
"Restoring" means that all changes made by the user are reverted, if this
IDataBook
is backed by a database it would mean to refetch the
row.
Before the restore the IDataBook.eventBeforeRestore()
is fired and
afterwards the IDataBook.eventAfterRestore()
is fired. Afterwards the
IControl.notifyRepaint()
method of all
registered IControl
s is invoked.
restoreSelectedRow
in interface IDataBook
ModelException
- if the IDataBook
is not open
or if the row could not be restored.IDataBook.restoreAllRows()
public void restoreAllRows() throws ModelException
"Restoring" means that all changes made by the user are reverted, if this
IDataBook
is backed by a database it would mean to refetch the
row.
Restoring all rows does restore all rows, including those which do not
match the currently set filter
.
Before the restore of each row the IDataBook.eventBeforeRestore()
is fired
and afterwards the IDataBook.eventAfterRestore()
is fired. Afterwards the
IControl.notifyRepaint()
method of all
registered IControl
s is invoked.
restoreAllRows
in interface IDataBook
ModelException
- if the IDataBook
is not open
or if the row could not be restored.IDataBook.restoreSelectedRow()
public void saveSelectedRow() throws ModelException
Depending on the state of the row, either IDataBook.eventBeforeInserted()
/
IDataBook.eventAfterInserted()
, IDataBook.eventBeforeUpdated()
/
IDataBook.eventAfterUpdated()
or IDataBook.eventBeforeDeleted()
/
IDataBook.eventAfterDeleted()
are fired. Afterwards the
IControl.notifyRepaint()
method of all
registered IControl
s is invoked.
saveSelectedRow
in interface IDataBook
ModelException
- if the IDataBook
is not open
or if the changes could not be saved.IDataBook.saveAllRows()
public void saveDataPage() throws ModelException
saveDataPage
in interface IDataBook
ModelException
- if saveSelected() failspublic void saveAllRows() throws ModelException
IDataRow
s which have been changed, it is the same as
IDataBook.saveSelectedRow()
except that it is a mass operation on all
rows.
Saving all rows does save all rows, including those which do not match
the currently set filter
.
Depending on the state of the rows, either IDataBook.eventBeforeInserted()
/ IDataBook.eventAfterInserted()
, IDataBook.eventBeforeUpdated()
/
IDataBook.eventAfterUpdated()
or IDataBook.eventBeforeDeleted()
/
IDataBook.eventAfterDeleted()
are fired. Afterwards the
IControl.notifyRepaint()
method of all
registered IControl
s is invoked.
These events are fired for all changed rows.
saveAllRows
in interface IDataBook
ModelException
- if the IDataBook
is not open
or if the changes could not be saved.IDataBook.saveSelectedRow()
public boolean isOutOfSync()
IDataBook
is out of sync with its master.
isOutOfSync
in interface IDataBook
true
if this IDataBook
is out of sync with its
master.public boolean isAllFetched() throws ModelException
IDataRow
s have been fetched from the storage, and
there is nothing more to fetch.
isAllFetched
in interface IDataPage
true
if all IDataRow
s have been fetched.
ModelException
- if determining if all IDataRow
s have been
fetched failed.public void fetchAll() throws ModelException
IDataRow
s from the storage.
fetchAll
in interface IDataPage
ModelException
- if there is a problem while fetching the rows.public IDataRow getMasterDataRow() throws ModelException
master row
.
getMasterDataRow
in interface IDataPage
master row
.
ModelException
- if the master row
could not be
fetched for some reason.public void addDetailDataBook(IDataBook pDetailDataBook)
IDataBook
as a detail IDataBook
.
addDetailDataBook
in interface IDataBook
pDetailDataBook
- the IDataBook
to register as a detail
IDataBook
.IDataBook.removeDetailDataBook(IDataBook)
,
IDataBook.getDetailDataBooks()
public void removeDetailDataBook(IDataBook pDetailDataBook)
IDataBook
as a detail IDataBook
.
removeDetailDataBook
in interface IDataBook
pDetailDataBook
- the IDataBook
to unregister as a detail
IDataBook
.IDataBook.addDetailDataBook(IDataBook)
,
IDataBook.getDetailDataBooks()
public IDataBook[] getDetailDataBooks()
IDataBook
s as array. The returned array might be
empty if there are no detail IDataBook
s.
getDetailDataBooks
in interface IDataBook
IDataBook
s as array, the array might be empty
if there are none.IDataBook.addDetailDataBook(IDataBook)
,
IDataBook.removeDetailDataBook(IDataBook)
@Deprecated public int[] getChangedDataRows() throws ModelException
IDataRow
s. Returns an empty array if there are no changed IDataRow
s.
getChangedDataRows
in interface IDataPage
IDataRow
s. An empty array if there are no changes.
ModelException
- if a exception occurs during synchronize.public int[] getChangedRows() throws ModelException
IDataRow
s. Returns an empty array if there are no changed IDataRow
s.
getChangedRows
in interface IDataPage
IDataRow
s. An empty array if there are no changes.
ModelException
- if a exception occurs during synchronize.public IDataPage getDataPage(IDataRow pMasterDataRow) throws ModelException
IDataPage
to specified master row
from the master DataBook
. If it doesn't exists, it will be
created and returned.
getDataPage
in interface IDataBook
pMasterDataRow
- 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
public boolean hasDataPage(IDataRow pMasterDataRow) throws ModelException
IDataPage
to specified master row from
the master DataBook
exists.
hasDataPage
in interface IDataBook
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
public int searchNext(ICondition pCondition) throws ModelException
IDataRow
which matches
the given ICondition
and returns its index. -1
is
returned if there is no IDataRow
that matches.
This method might fetch more rows from the storage as needed.
searchNext
in interface IDataPage
pCondition
- the ICondition
.
IDataRow
, -1
if
there is none.
ModelException
- if searching through and/or fetching the
IDataRow
s failed.public int searchNext(ICondition pCondition, int pRowNum) throws ModelException
IDataRow
which matches the
given ICondition
and returns its index. The search is started at
the given index. -1
is returned if there is no IDataRow
that matches.
This method might fetch more rows from the storage as needed.
searchNext
in interface IDataPage
pCondition
- the ICondition
.pRowNum
- the index at which to start, inclusive.
IDataRow
, -1
if
there is none.
ModelException
- if searching through and/or fetching the
IDataRow
s failed.public int searchPrevious(ICondition pCondition) throws ModelException
IDataRow
which matches the
given ICondition
and returns its index. -1
is returned if
there is no IDataRow
that matches.
This method might fetch more rows from the storage as needed.
searchPrevious
in interface IDataPage
pCondition
- the ICondition
.
IDataRow
, -1
if
there is none.
ModelException
- if searching through and/or fetching the
IDataRow
s failed.public int searchPrevious(ICondition pCondition, int pRowNum) throws ModelException
IDataRow
which matches
the given ICondition
and returns its index. The search is started
at the given index. -1
is returned if there is no
IDataRow
that matches.
This method might fetch more rows from the storage as needed.
searchPrevious
in interface IDataPage
pCondition
- the ICondition
.pRowNum
- the index at which to start, exclusive.
IDataRow
, -1
if there is none.
ModelException
- if searching through and/or fetching the
IDataRow
s failed.public IRowCalculator getRowCalculator()
IRowCalculator
.
getRowCalculator
in interface IDataBook
IRowCalculator
.public void setRowCalculator(IRowCalculator pRowCalculator)
IRowCalculator
.
setRowCalculator
in interface IDataBook
pRowCalculator
- the IRowCalculator
.public void setRowCalculator(java.lang.Object pRowCalculatorObject, java.lang.String pMethodName)
pRowCalculatorObject
- the object.pMethodName
- the method name.public static IRowCalculator createRowCalculator(java.lang.Object pRowCalculatorObject, java.lang.String pMethodName)
pRowCalculatorObject
- the object.pMethodName
- the method name.
protected void calculateRow()
public IReadOnlyChecker getReadOnlyChecker()
IReadOnlyChecker
.
getReadOnlyChecker
in interface IDataBook
IReadOnlyChecker
.public void setReadOnlyChecker(IReadOnlyChecker pReadOnlyChecker)
IReadOnlyChecker
.
setReadOnlyChecker
in interface IDataBook
pReadOnlyChecker
- the IReadOnlyChecker
..public void setReadOnlyChecker(java.lang.Object pReadOnlyCheckerObject, java.lang.String pMethodName)
pReadOnlyCheckerObject
- the object.pMethodName
- the method name.public static IReadOnlyChecker createReadOnlyChecker(java.lang.Object pReadOnlyCheckerObject, java.lang.String pMethodName)
pReadOnlyCheckerObject
- the object.pMethodName
- the method name.
public DataBookHandler eventBeforeRowSelected()
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.
eventBeforeRowSelected
in interface IDataBook
DataBookHandler
for before row selected event.public DataBookHandler eventAfterRowSelected()
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.
eventAfterRowSelected
in interface IDataBook
DataBookHandler
for after row selected event.public DataBookHandler eventBeforeInserting()
DataBookHandler
for before inserting event.
This event is fired before a new row is inserted
.
eventBeforeInserting
in interface IDataBook
DataBookHandler
for before inserting event.public DataBookHandler eventAfterInserting()
DataBookHandler
for after inserting event.
This event is fired after a new row is inserted
.
eventAfterInserting
in interface IDataBook
DataBookHandler
for after inserting event.public DataBookHandler eventBeforeInserted()
DataBookHandler
for before inserted event.
This event is fired before an inserted row
is
saved
.
eventBeforeInserted
in interface IDataBook
DataBookHandler
for before inserted event.public DataBookHandler eventAfterInserted()
DataBookHandler
for after inserted event.
This event is fired after an inserted row
is
saved
.
eventAfterInserted
in interface IDataBook
DataBookHandler
for after inserted event.public DataBookHandler eventBeforeUpdating()
DataBookHandler
for before updating event.
This event is fired before a row is updated
.
eventBeforeUpdating
in interface IDataBook
DataBookHandler
for before updating event.public DataBookHandler eventAfterUpdating()
DataBookHandler
for after updating event.
This event is fired after a row is updated
.
eventAfterUpdating
in interface IDataBook
DataBookHandler
for after updating event.public DataBookHandler eventBeforeUpdated()
DataBookHandler
for before updated event.
This event is fired before an updated row
is
saved
.
eventBeforeUpdated
in interface IDataBook
DataBookHandler
for before updated event.public DataBookHandler eventAfterUpdated()
DataBookHandler
for after updated event.
This event is fired after an updated row
is
saved
.
eventAfterUpdated
in interface IDataBook
DataBookHandler
for after updated event.public DataBookHandler eventBeforeDeleting()
DataBookHandler
for before deleting event.
This event is fired before a row is deleted
.
eventBeforeDeleting
in interface IDataBook
DataBookHandler
for before deleting event.public DataBookHandler eventAfterDeleting()
DataBookHandler
for after deleting event.
This event is fired after a row is deleted
.
eventAfterDeleting
in interface IDataBook
DataBookHandler
for after deleting event.public DataBookHandler eventBeforeDeleted()
DataBookHandler
for before deleted event.
This event is fired before a deleted row
is
saved
.
eventBeforeDeleted
in interface IDataBook
DataBookHandler
for before deleted event.public DataBookHandler eventAfterDeleted()
DataBookHandler
for after deleted event.
This event is fired after a deleted row
is
saved
.
eventAfterDeleted
in interface IDataBook
DataBookHandler
for after deleted event.public DataBookHandler eventBeforeRestore()
DataBookHandler
for before restore event.
This event is fired before a row is
restored
.
eventBeforeRestore
in interface IDataBook
DataBookHandler
for before restore event.public DataBookHandler eventAfterRestore()
DataBookHandler
for after restore event.
This event is fired after a row is restored
.
eventAfterRestore
in interface IDataBook
DataBookHandler
for after restore event.public DataBookHandler eventBeforeReload()
DataBookHandler
for before reload event.
This event is fired before the IDataBook
is reloaded
.
eventBeforeReload
in interface IDataBook
DataBookHandler
for before reload event.public DataBookHandler eventAfterReload()
DataBookHandler
for after reload event.
This event is fired after the IDataBook
is reloaded
.
eventAfterReload
in interface IDataBook
DataBookHandler
for after reload event.public DataBookHandler eventBeforeFilterChanged()
DataBookHandler
for before filter changed event.
This event is fired before the filter
changes
.
eventBeforeFilterChanged
in interface IDataBook
DataBookHandler
for before filter changed event.public DataBookHandler eventAfterFilterChanged()
DataBookHandler
for after filter changed event.
This event is fired after the filter
changes
.
eventAfterFilterChanged
in interface IDataBook
DataBookHandler
for after filter changed event.public DataBookHandler eventBeforeSortChanged()
DataBookHandler
for before sort changed event.
This event is fired before the sort
changes
.
eventBeforeSortChanged
in interface IDataBook
DataBookHandler
for before sort changed event.public DataBookHandler eventAfterSortChanged()
DataBookHandler
for after sort changed event.
This event is fired afterthe sort
changes
.
eventAfterSortChanged
in interface IDataBook
DataBookHandler
for after sort changed event.public DataBookHandler eventBeforeColumnSelected()
DataBookHandler
for before column selected event.
This event is fired before the selected
column
changes.
eventBeforeColumnSelected
in interface IDataBook
DataBookHandler
for before column selected event.public DataBookHandler eventAfterColumnSelected()
DataBookHandler
for after column selected event.
This event is fired after the selected
column
changes.
eventAfterColumnSelected
in interface IDataBook
DataBookHandler
for after column selected event.public void addControl(IControl pControl)
IControl
to this IDataRow
as control.
The registered IControl
will be notified of changes in this
IDataRow
.
addControl
in interface IDataRow
addControl
in class DataRow
pControl
- the IControl
to add.IDataRow.removeControl(IControl)
,
IDataRow.getControls()
public int getRowIndex()
IDataPage
.
getRowIndex
in interface IChangeableDataRow
getRowIndex
in class ChangeableDataRow
IDataPage
, can be
-1
if there is no parent IDataPage
.public IDataPage getDataPage()
IDataPage
.
getDataPage
in interface IChangeableDataRow
getDataPage
in class ChangeableDataRow
IDataPage
, can null
if there is no
parent IDataPage
.protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public java.lang.Object getValue(int pColumnIndex) throws ModelException
getValue
in interface IDataRow
getValue
in class DataRow
pColumnIndex
- the column index.
ModelException
- if the column index is out of bounds.IDataRow.getValue(String)
public java.lang.Object getValue(java.lang.String pColumnName) throws ModelException
getValue
in interface IDataRow
getValue
in class DataRow
pColumnName
- the name of the column.
ModelException
- if there is no column with the given name.IDataRow.getValue(int)
public void setValue(java.lang.String pColumnName, java.lang.Object pValue) throws ModelException
After the value has changed the value
changed event
and value changed (by
name) event
are invoked and fired. Afterwards all registered
IControl
s are notified of the change by invoking
IControl.notifyRepaint()
.
setValue
in interface IDataRow
setValue
in class DataRow
pColumnName
- the column name.pValue
- the new value for the named column.
ModelException
- if there is no column with the given name or the
given value can not be converted to the IDataType
of
the column.IDataRow.eventValuesChanged()
,
IDataRow.eventValuesChanged(String)
,
IDataType.convertToTypeClass(Object)
public java.lang.Object[] getValues(java.lang.String[] pColumnNames) throws ModelException
Object
array.
Note that the returned Object
array does not represent an
internal state of the IDataRow
. Modifying the array does not
change the IDataRow
.
getValues
in interface IDataRow
getValues
in class DataRow
pColumnNames
- the names of the columns from which to get the
values. Can be null
for all columns (which is equal to
IRowDefinition.getColumnNames()
.
Object
array.
ModelException
- if there is no column with one of the specified
names.IDataRow.getValue(int)
,
IDataRow.getValue(String)
public IDataRow createDataRow(java.lang.String[] pColumnNames) throws ModelException
IDataRow
which only contains the
specified columns and their values.
createDataRow
in interface IDataRow
createDataRow
in class DataRow
pColumnNames
- a String
array of column names. Can be
null
for all columns (which is equal to
IRowDefinition.getColumnNames()
.
IDataRow
which only contains the specified columns
and their values.
ModelException
- if new IDataRow
could not be constructed.public void setValues(java.lang.String[] pColumnNames, java.lang.Object[] pValues) throws ModelException
The String
array which represents the column names is directly
mapped to the Object
array which holds the values. So they must
be equal in length.
After the value has changed the value
changed event
and value changed (by
name) event
are invoked and fired. Afterwards all registered
IControl
s are notified of the change by invoking
IControl.notifyRepaint()
.
setValues
in interface IDataRow
setValues
in class DataRow
pColumnNames
- a String
array of the column names. Can be
null
for all columns (which is equal to
IRowDefinition.getColumnNames()
.pValues
- a Object
array of values to set in the
corresponding columns.
ModelException
- if there is no column with one of the specified
names or if any of the values could not be converted to the
IDataType
of the column.IDataRow.eventValuesChanged()
,
IDataRow.eventValuesChanged(String)
,
IDataRow.setValue(String, Object)
,
IDataType.convertToTypeClass(Object)
public java.lang.String toString()
toString
in class ChangeableDataRow
public void notifyRepaintControls()
registered controls
that there are new
values and that they must redraw themselves. For this purpose the
IControl.notifyRepaint()
method is invoked on all registered
IControl
s.
notifyRepaintControls
in interface IDataRow
notifyRepaintControls
in class DataRow
IControl.notifyRepaint()
public void saveEditingControls() throws ModelException
registered controls
that they should
save their values. For this purpose the IControl.saveEditing()
method is invoked on all registered IControl
s.
saveEditingControls
in interface IDataRow
saveEditingControls
in class DataRow
ModelException
- if saving of any of the registered
IControl
s fails.IControl.notifyRepaint()
public void cancelEditingControls()
registered controls
that they should
cancel any pending editing operation and revert to the values in this
IDataRow
. For this purpose the IControl.cancelEditing()
method is invoked on all registered IControl
s.
cancelEditingControls
in interface IDataRow
cancelEditingControls
in class DataRow
public IRowDefinition getRowDefinition()
IRowDefinition
that is used.
The IRowDefinition
contains all the information about the
columns.
getRowDefinition
in interface IDataRow
getRowDefinition
in class DataRow
IRowDefinition
that is used.public void restoreDataPage() throws ModelException
ModelException
- - if an ModelException happens during undo the changes.restoreAllRows()
protected void reloadIntern() throws ModelException
ModelException
- if reloading failedpublic void reloadDataPage(IDataBook.SelectionMode pSelectionMode) throws ModelException
pSelectionMode
- pSelectionMode the Selection mode to use
ModelException
- if an DataSourceException happens during get the requested row.reload(javax.rad.model.IDataBook.SelectionMode)
public boolean hasChanges()
true
if there are changespublic boolean hasDataPage(IDataRow pRootDataRow, TreePath pTreePath) throws ModelException
IDataPage
to specified root row and TreePath
from the master DataBook
exists.
pRootDataRow
- the root IDataRow
of the DataBook
to check.pTreePath
- the TreePath
to use.
IDataPage
to specified root row and TreePath
from the master DataBook
exists.
ModelException
- if the pRootDataRow don't contains the root columns from the DataBook.protected MemDataPage createAndCacheDataPage(IDataRow pMasterDataRow) throws ModelException
pMasterDataRow
- the master IDataRow for this IDataPage.
ModelException
- if getting the UID of the datarow failed.createDataPage(IDataRow)
protected MemDataPage createDataPage(IDataRow pMasterDataRow)
pMasterDataRow
- the master IDataRow for this IDataPage.
protected boolean isMemSort()
protected void setMemSort(boolean pMemSort)
pMemSort
- true if the sort is handled in memory.protected boolean isMemFilter()
protected void setMemFilter(boolean pMemFilter)
pMemFilter
- true if the filter is handled in memory.protected boolean isWritebackEnabled()
protected void setWritebackEnabled(boolean pWritebackEnabled)
pWritebackEnabled
- determines if changes should be written to the store.public boolean isLockAndRefetchEnabled()
public void setLockAndRefetchEnabled(boolean pLockAndRefetchEnabled)
pLockAndRefetchEnabled
- true if lock and refetch is enabled.public int getReadAhead()
public void setReadAhead(int pReadAheadRowCount)
pReadAheadRowCount
- the row count to read ahead from the IDBAccesspublic int getEstimatedRowCount() throws ModelException
IDBAccess
for this RemoteDataBook.
ModelException
- the the detail DataBook couldn't synchronized with the master DataBookpublic boolean isSortDataRowOnSave()
public void setSortDataRowOnSave(boolean pSortDataRowOnSave)
pSortDataRowOnSave
- true, if the current saved row should be moved to the correct possition according to the set SortDefinition.protected IDataRow executeInsert(IChangeableDataRow pDataRow) throws ModelException
pDataRow
- the data row to insert
ModelException
- if an ModelException occur during insert.protected IDataRow executeUpdate(IChangeableDataRow pDataRow) throws ModelException
pDataRow
- the data row to update
ModelException
- if an ModelException occur during update.protected void executeDelete(IChangeableDataRow pDataRow) throws ModelException
pDataRow
- the data row to delete
ModelException
- if an ModelException occur during delete.protected IDataRow executeLockAndRefetch(IChangeableDataRow pDataRow) throws ModelException
pDataRow
- the data row to lock
ModelException
- if an ModelException occur during insert.public IDataBook getRootDataBook()
getRootDataBook
in interface IDataBook
protected IDataBook getRootDataBookIntern()
protected void invokeTreeSaveEditingControls() throws ModelException
IComponent
the saveEditing()
method.
ModelException
- if saving the editors fails.protected void invokeTreeCancelEditingControls()
IComponent
the cancelEditing()
method.
protected void executeRefresh() throws ModelException
ModelException
- if an ModelExcpetion happen during refreshprotected void executeRefreshDataPage() throws ModelException
ModelException
- if an ModelExcpetion happen during refreshprotected void clear() throws ModelException
ModelException
- if an ModelExcpetion happen during refreshprotected void clearCurrentDataPage() throws ModelException
ModelException
- if an ModelExcpetion happen during refreshprotected void setSelectedRowInternal(int pDataRowIndex) throws ModelException
pDataRowIndex
- the new row index to use.
ModelException
- if new row couldn't determined or selected.protected SortDefinition keepSortableColumns(SortDefinition pSortDefinition) throws ModelException
SortDefinition
with only the ColumnDefinition.isSortable()
columns
from the given SortDefinition
.
pSortDefinition
- the SortDefinition
to process.
SortDefinition
with only ColumnDefinition.isSortable()
columns.
null
if no columns remained or if the given SortDefinition
was null
or if the this databook is currently not open.
ModelException
- if accessing the column information failed.protected void store() throws ModelException
store
in class ChangeableDataRow
ModelException
- if a ModelException occurs.protected void clearFilterSortInMemDataPages() throws ModelException
ModelException
- if a ModelException occurs.protected void clearFilterSortInCurrentMemDataPage() throws ModelException
ModelException
- if a ModelException occurs.public void setReadOnlyWithoutSave(boolean pReadOnly)
pReadOnly
- true
to set the databook readonly, false
otherwiseprotected boolean isDataPageRefetchPossible()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |