|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectto.etc.domui.component.tbl.TableModelBase<T>
to.etc.domui.component.tbl.SimpleCollectionModel<T>
T
-
@Deprecated public class SimpleCollectionModel<T>
DEPRECATED Use SimpleListModel instead. The SimpleCollectionModel is a very basic model that directly represents a collection.
20091206 jal This model is deprecated because TableModel's REQUIRE the use of indexed addressing, and this addressing needs to remain stable while using this. This implementation uses Collection and re-creates a list for every time we need indexed addressing. This is VERY expensive, but also unstable when items are added: when they are added to a HashSet for instance the entire internal order can change (after a rehash) causing all items in the table to shift position. Although this model does fire modelChanged so at least the presentation remains correct, this is unacceptable behaviour. The implementation depends on the unshelve command, during unshelving all listeners are notified that the model changed, so changes in the collection this model represents constructor will be reflected in the component that is bound to the model. This means that changes made to the collection itself will be reflected only if that changed are made in a different page then where the component this model is tied to is located. For reflecting changes in the same page the add and remove methods should be called on the model itself, not on the collection it represents.
Field Summary |
---|
Fields inherited from interface to.etc.domui.component.tbl.ITableModel |
---|
DEFAULT_MAX_SIZE |
Constructor Summary | |
---|---|
SimpleCollectionModel(java.util.Collection<T> collection)
Deprecated. |
Method Summary | |
---|---|
boolean |
add(T item)
Deprecated. Tries to add an item to the model's collection. |
T |
getItem(int index)
Deprecated. |
java.util.List<T> |
getItems(int start,
int end)
Deprecated. |
protected java.util.List<T> |
getList()
Deprecated. |
int |
getRows()
Deprecated. This must return the total #of rows in this table. |
void |
onShelve()
Deprecated. |
void |
onUnshelve()
Deprecated. |
boolean |
remove(T item)
Deprecated. Tries to remove an item from the model's collection. |
Methods inherited from class to.etc.domui.component.tbl.TableModelBase |
---|
addChangeListener, fireAdded, fireDeleted, fireModelChanged, fireModified, getListeners, refresh, removeChangeListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleCollectionModel(java.util.Collection<T> collection)
Method Detail |
---|
protected java.util.List<T> getList() throws java.lang.Exception
java.lang.Exception
public void onShelve() throws java.lang.Exception
onShelve
in interface IShelvedListener
java.lang.Exception
public void onUnshelve() throws java.lang.Exception
onUnshelve
in interface IShelvedListener
java.lang.Exception
public java.util.List<T> getItems(int start, int end) throws java.lang.Exception
getItems
in interface ITableModel<T>
java.lang.Exception
public T getItem(int index) throws java.lang.Exception
getItem
in class TableModelBase<T>
java.lang.Exception
public int getRows() throws java.lang.Exception
ITableModel
getRows
in interface ITableModel<T>
java.lang.Exception
public boolean add(T item) throws java.lang.Exception
item,
- the item to be added.
java.lang.Exception
public boolean remove(T item) throws java.lang.Exception
item,
- the item to be removed.
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |