|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectat.spardat.xma.mdl.WModel
at.spardat.xma.mdl.table.TableBaseWM
at.spardat.xma.mdl.table.TableWM
A table widget model where the programmer is in full control on what rows the table has. Rows may be added, replaced or removed. Every row may have an additional image displayed with the row. Rows are stored in an ordered collection and may be accessed either by a unique String key or by a zero based row index.
Besides managing the rows, a single or multiple selection state is controlled (interface ISelectable). The selected rows are identified by their String keys.
| Field Summary | |
protected int |
updateCount_
A counter which is incremented after every update. |
| Fields inherited from class at.spardat.xma.mdl.table.TableBaseWM |
columnCount_, isAtServer_ |
| Fields inherited from class at.spardat.xma.mdl.WModel |
S_NULL |
| Fields inherited from interface at.spardat.xma.mdl.table.ITableWM |
S_LAST, S_MULTI_SELECT, S_ONE_WAY |
| Constructor Summary | |
TableWM(short id,
Page pm,
int numColumns,
int style)
Constructor |
|
| Method Summary | |
protected boolean |
add(int rowIndex,
java.lang.String key,
Atom[] atoms)
Adds a row to the table at a provided zero based row index. |
boolean |
changed()
Yields true if this WidgetModel has changed since the last server side event (or creation). |
void |
cleanUpAfterServerEvent()
If this table is one-way, we remove all rows after a server event finished. |
void |
clear()
Removes all rows from the table and deselects all rows. |
void |
commit()
This method clears the change history. |
boolean |
containsKey(java.lang.String key)
Returns true if this table contains a row with the provided key. |
void |
describe(DNode n)
describe puts all relevant information about this into the provided node. |
void |
deselect(java.lang.String key)
Deselects a particular entry. |
void |
deselectAll()
All selected entries get deselected. |
void |
equalsCS(WModel mServer,
int syncPoint)
Compares this widget model (which must be a client side one) with the server buddy mServer and returns true if they are correct with respect to syncPoint. |
int |
estimateMemory()
Estimates the number of bytes this object consumes in memory. |
void |
externalize(XmaOutput xo,
boolean forceFull)
Externalizing either saves the actual state or deltas (changes) in a provided XMAObjectOutput. |
TableRow |
getRow(int rowIndex)
Returns the table row at a provided zero based row index. |
TableRow |
getRow(java.lang.String key)
Returns the table row for a provided key. |
java.lang.String |
getSelected()
Returns the id of the selected element. |
java.lang.String[] |
getSelection()
Returns a newly created array containing the ids of the selected entries or an empty array, if nothing is selected. |
int |
getSelectionCount()
Returns the number of selected elements. |
boolean |
handle(ModelChangeEvent event)
All events that might change a WidgetModel are executed via this method. |
int |
indexOf(java.lang.String key)
Returns the index at which the row with the provided key is located or -1 if no row with key is here. |
void |
internalize(XmaInput in)
Updates the state of this with information of the given XMAObjectInput. |
void |
internalRemoveRows()
Removes only the rows but leave selection unchanged. |
boolean |
isMultiSelect()
Returns true if more than one entry may be selected. |
boolean |
isOneWay()
Returns if this table is one way. |
boolean |
isSelected(java.lang.String key)
Returns true if the entry with the provided key is selected, false otherwise. |
boolean |
isStrict()
Returns if this Selectable has strict behaviour, that is, the selected keys must always be in the underlying domain of this. |
void |
randomlyChange()
Make random changes to this |
void |
removeRow(int rowIndex)
Removes a row from this table at a provided index. |
boolean |
removeRow(java.lang.String key)
Removes a row with a particular key. |
void |
rollback()
This method restores this Widget Model to its state immediately after the last server side event (or creation). |
void |
select(java.lang.String key)
Sets the entry with a provided key as selected. |
void |
selectByModelIndex(int index)
Selects the row at the provided zero-based index. |
int |
size()
Returns the number of rows in this table. |
| Methods inherited from class at.spardat.xma.mdl.table.TableBaseWM |
getColumnCount, getPage |
| Methods inherited from class at.spardat.xma.mdl.WModel |
getId, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface at.spardat.xma.mdl.table.ITableWM |
getColumnCount |
| Field Detail |
protected int updateCount_
| Constructor Detail |
public TableWM(short id,
Page pm,
int numColumns,
int style)
id - uniquely identifies the model within its pagepm - the enclosing page model this widget model belongs to.numColumns - number of columns this table hasstyle - bit or combination of the style constants S_*.| Method Detail |
public boolean changed()
WModel
changed in interface Transactionalchanged in class WModelTransactional.changed()public void rollback()
WModel
rollback in interface Transactionalrollback in class WModelTransactional.rollback()public void commit()
WModel
commit in interface Transactionalcommit in class WModelTransactional.commit()public boolean handle(ModelChangeEvent event)
WModel
handle in class WModelevent - the event carrying the information of a change.
WModel.handle(at.spardat.xma.mdl.ModelChangeEvent)public void select(java.lang.String key)
ISelectableIf isStrict() and the provided key is not contained in the underlying domain, this method does nothing.
select in interface ISelectablekey - the entry to selectISelectable.select(java.lang.String)public void deselect(java.lang.String key)
ISelectable
deselect in interface ISelectablekey - identifies the entry to deselect. If the entry with the provided key is not
selected, this method does nothing.ISelectable.deselect(java.lang.String)public void deselectAll()
ISelectable
deselectAll in interface ISelectableISelectable.deselectAll()public boolean isMultiSelect()
ISelectable
isMultiSelect in interface ISelectableISelectable.isMultiSelect()public java.lang.String getSelected()
ISelectableUsually, this method is the preferred way of querying the selection state if !isMultiSelect().
getSelected in interface ISelectableISelectable.getSelected()public java.lang.String[] getSelection()
ISelectable
getSelection in interface ISelectableISelectable.getSelection()public int getSelectionCount()
ISelectable
getSelectionCount in interface ISelectableISelectable.getSelectionCount()public boolean isSelected(java.lang.String key)
ISelectable
isSelected in interface ISelectableISelectable.isSelected(java.lang.String)public boolean isStrict()
ISelectableStrict behaviour is only supported if !isMultiSelect(). That means, isMultiSelect() always implies isStrict().
isStrict in interface ISelectableISelectable.isStrict()public void selectByModelIndex(int index)
ITableWMNote that this method selects using an index of the table-model. At the XMA client, if the table has been sorted, this need not necessarely correspond to be the index you see in the SWT-table.
selectByModelIndex in interface ITableWMindex - zero based index of the row to select.ITableWM.selectByModelIndex(int)
public void externalize(XmaOutput xo,
boolean forceFull)
throws java.io.IOException
SynchronizationIf forceFull is false, the object implementing this interface must also implement Transactional. If the object implementing this is able to track changes, these are the changes since the last syncpoint.
externalize in interface Synchronizationxo - the serialization destinationforceFull - if true, the complete state is written
and deltas are ignored.
java.io.IOException - on serialization errorsSynchronization.externalize(at.spardat.xma.serializer.XmaOutput, boolean)
public void internalize(XmaInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
SynchronizationThis method is not allowed to throw Exceptions because that would leave models in an inconsistent state. Thrown exceptions are considered to be programming errors. Internalize must not throw technical exceptions which indicate system or ressource failures. That implies that the person implementing internalize is not allowed to access ressources outside the JVM, either directly or via calls to other methods. Examples of ressource access which must not be triggered are calls to communication of file system services.
internalize in interface Synchronizationin - the XMAObjectInput. If a XMAObjectInputChangeListener is
set in the object in, it will be notified after applying
changes read from in.
java.lang.ClassNotFoundException - on serialization errors
java.io.IOException - on serialization errorsSynchronization.internalize(at.spardat.xma.serializer.XmaInput)public boolean isOneWay()
isOneWay in interface ITableWMITableWM.S_ONE_WAYpublic int size()
size in interface ITableWM
protected boolean add(int rowIndex,
java.lang.String key,
Atom[] atoms)
If the row is not added at the end of the table, runtime order is O(n) since an array is internally used to store the table.
rowIndex - the zero based index of the new row. Must be greater or equal
to zero and not greater than size().key - the key of the new rowatoms - Atom array
java.lang.IllegalArgumentException - if rowIndex is invalid.public boolean containsKey(java.lang.String key)
containsKey in interface ITableWMpublic int indexOf(java.lang.String key)
indexOf in interface ITableWMkey - the key of the row that is looked up.
public TableRow getRow(java.lang.String key)
The returned TableRow may be used to query and modify the row. It must not be cached outside for later reuse because the returned row becomes invalid if the table is modified in other ways.
getRow in interface ITableWMkey - the key whose row is wanted
public TableRow getRow(int rowIndex)
The returned TableRow may be used to query and modify the row. It must not be cached outside for later reuse because the returned row becomes invalid if the table is modified in other ways.
getRow in interface ITableWMrowIndex - the index of the row
java.lang.ArrayIndexOutOfBoundsException - if rowIndex invalidpublic void removeRow(int rowIndex)
removeRow in interface ITableWMrowIndex - the zero based row index.
java.lang.IndexOutOfBoundsException - if rowIndex invalid.public boolean removeRow(java.lang.String key)
Note that this method is of runtime order O(n). If performance matters, please use removeRow(int) instead.
removeRow in interface ITableWMkey - the key whose row is to be removed.
public void clear()
clear in interface ITableWMclear in class WModelpublic void internalRemoveRows()
public void describe(DNode n)
Descriptive
describe in interface Descriptivedescribe in class WModelDescriptive.describe(at.spardat.xma.mdl.util.DNode)public void randomlyChange()
randomlyChange in class WModel
public void equalsCS(WModel mServer,
int syncPoint)
WModelThis method is for debugging purpose and assumes that client and server models are running within the same VM. It tests if the models the programmer views after a synchronization operation are consistent.
This method requires that this is a client side model.
This method does not throw an exception if models are the same in terms of their contained model data. If it is allowed that models differ (for example some one way tables), this method must take this fact into account. If the models differ, this indicates a programming error and a RuntimeException is thrown.
equalsCS in class WModelmServer - the server side model partner for this.syncPoint - 0 if the point in time is after a client to server
sychnronization, 1 if the point is after a server to
client synchronization.WModel.equalsCS(at.spardat.xma.mdl.WModel, int)public int estimateMemory()
estimateMemory in class WModelpublic void cleanUpAfterServerEvent()
cleanUpAfterServerEvent in class WModelWModel.cleanUpAfterServerEvent()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||