|
||||||||||
| 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.list.ListWM
Widged model to represent a list of choises. It can be used with
the SWT-widgets Combo and List. The entries of the list have to be provided by the
programmer. All entries must by Atoms of the same type.
The supported types are T_STRING, T_BCD, T_DATE and T_TIMESTAMP.
There are convinience methods to use Java Strings directly.
These Strings are converted to Atoms of type T_STRING internally.
For domain values please use ListDomWM.
| Field Summary |
| Fields inherited from class at.spardat.xma.mdl.WModel |
S_NULL |
| Fields inherited from interface at.spardat.xma.mdl.list.IListWM |
S_MULTI_SELECT, S_NOT_STRICT |
| Constructor Summary | |
ListWM(short id,
Page pm,
int style)
Constructs a ListWM. |
|
| Method Summary | |
void |
add(Atom entry)
Adds an entry to the list. |
void |
add(Atom[] entries)
Adds the entries to the list. |
void |
add(java.util.Collection entries)
Adds the entries to the list. |
void |
add(int index,
Atom entry)
Inserts an entry into the list at the specified position. |
void |
add(int index,
java.lang.String entry)
Inserts an entry into the list at the specified position. |
void |
add(java.lang.String entry)
Adds an entry to the list. |
void |
add(java.lang.String[] entries)
Adds the entries to the list. |
boolean |
changed()
Yields true if this WidgetModel has changed since the last server side event (or creation). |
void |
clear()
Removes all entries from the list and deselects all selected entries. |
void |
commit()
This method clears the change history. |
boolean |
contains(Atom entry)
Returns true if the list contains the given entry. |
boolean |
contains(java.lang.String entry)
Returns true if the list contains the given entry. |
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()
Provides the estimated number of bytes this widget model consumes in memory, asuming that it is in a committed state, i.e, there are no pending changes. |
void |
externalize(XmaOutput xo,
boolean forceFull)
Externalizing either saves the actual state or deltas (changes) in a provided XMAObjectOutput. |
Atom |
getEntry(int index)
Get the entry at the specified position. |
Atom |
getEntry(java.lang.String key)
Get the entry for the given 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. |
java.lang.String |
getStringEntry(int index)
Get the entry at the specified position. |
boolean |
handle(ModelChangeEvent event)
All events that might change a WidgetModel are executed via this method. |
int |
indexOf(Atom entry)
Get the index of the given entry. |
int |
indexOf(java.lang.String entry)
Get the index of the given entry. |
void |
internalize(XmaInput in)
Updates the state of this with information of the given XMAObjectInput. |
boolean |
isMultiSelect()
Returns true if more than one entry may be selected. |
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. |
boolean |
isUserStrict()
Returns if the user is allowed to enter values not in the list of choices. |
void |
randomlyChange()
A implementing subclass must make a random change to its widget model. |
void |
remove(Atom entry)
Removes an entry from the list. |
void |
remove(int index)
Removes the entry at the given position from the list. |
void |
remove(java.lang.String entry)
Removes an entry from the list. |
void |
replace(int index,
Atom newEntry)
Replaces an entry in the list. |
void |
replace(int index,
java.lang.String newEntry)
Replaces an entry in the list. |
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. |
int |
size()
Gets the size of the list. |
| Methods inherited from class at.spardat.xma.mdl.WModel |
cleanUpAfterServerEvent, getId, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ListWM(short id,
Page pm,
int style)
IListWM.S_MULTI_SELECT
IListWM.S_NOT_STRICT
id - a numeric id which identifies the WidgetModel within its Page.pm - reference to the enclosing Pagestyle - one of the style-constants listed above or S_NULL.| Method Detail |
public boolean changed()
WModel
changed in interface Transactionalchanged in class WModelpublic void rollback()
WModel
rollback in interface Transactionalrollback in class WModelpublic void commit()
WModel
commit in interface Transactionalcommit in class WModelpublic boolean handle(ModelChangeEvent event)
WModel
handle in class WModelevent - the event carrying the information of a change.
public void clear()
IListWM
clear in interface IListWMclear in class WModelpublic void describe(DNode n)
Descriptive
describe in interface Descriptivedescribe in class WModelDescriptive.describe(at.spardat.xma.mdl.util.DNode)public void randomlyChange()
WModel
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.public int estimateMemory()
WModel
estimateMemory in class WModelpublic void add(Atom entry)
IListWM
add in interface IListWMentry - to addpublic void add(java.lang.String entry)
IListWM
add in interface IListWMentry - to add
public void add(int index,
Atom entry)
IListWM
add in interface IListWMindex - the desired zero base index of the new entryentry - to add
public void add(int index,
java.lang.String entry)
IListWM
add in interface IListWMindex - the desired zero base index of the new entryentry - to addpublic void add(Atom[] entries)
IListWM
add in interface IListWMentries - to addpublic void add(java.lang.String[] entries)
IListWM
add in interface IListWMentries - to addpublic void add(java.util.Collection entries)
IListWM
add in interface IListWMentries - to addpublic Atom getEntry(int index)
IListWM
getEntry in interface IListWMindex - the index of the desired entry.
public java.lang.String getStringEntry(int index)
IListWM
getStringEntry in interface IListWMindex - the index of the desired entry.
public Atom getEntry(java.lang.String key)
IListWM
getEntry in interface IListWMkey - string representation of the desired entry.
public int indexOf(Atom entry)
IListWM
indexOf in interface IListWMentry - the entry of which the index is desired.
public int indexOf(java.lang.String entry)
IListWM
indexOf in interface IListWMentry - the entry of which the index is desired.
public void remove(Atom entry)
IListWM
remove in interface IListWMentry - to removepublic void remove(java.lang.String entry)
IListWM
remove in interface IListWMentry - to removepublic void remove(int index)
IListWM
remove in interface IListWMindex -
public void replace(int index,
Atom newEntry)
IListWM
replace in interface IListWMindex - the index of the entry to replace.newEntry - the new entry to insert.
public void replace(int index,
java.lang.String newEntry)
IListWM
replace in interface IListWMindex - the index of the entry to replace.newEntry - the new entry to insert.public boolean contains(Atom entry)
IListWM
contains in interface IListWMentry -
public boolean contains(java.lang.String entry)
IListWM
contains in interface IListWMentry -
public int size()
IListWM
size in interface IListWMpublic 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 selectpublic 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.public void deselectAll()
ISelectable
deselectAll in interface ISelectablepublic boolean isMultiSelect()
ISelectable
isMultiSelect in interface ISelectablepublic java.lang.String getSelected()
ISelectableUsually, this method is the preferred way of querying the selection state if !isMultiSelect().
getSelected in interface ISelectablepublic java.lang.String[] getSelection()
ISelectable
getSelection in interface ISelectablepublic int getSelectionCount()
ISelectable
getSelectionCount in interface ISelectablepublic boolean isSelected(java.lang.String key)
ISelectable
isSelected in interface ISelectablepublic boolean isStrict()
ISelectableStrict behaviour is only supported if !isMultiSelect(). That means, isMultiSelect() always implies isStrict().
isStrict in interface ISelectablepublic boolean isUserStrict()
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 errors
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 errors
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||