|
||||||||||
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.TableKeyModelBase<K,T>
public abstract class TableKeyModelBase<K,T>
This model maintains a set of Keys K, and translates those keys to Model items T where needed. This
model should be used when maintaining a full set of T instances is too expensive. This model only
instantiates those T instances that are needed to display on a table's page. This is done by
loading all T's for a set of K's passed to getItems(List)
.
Field Summary |
---|
Fields inherited from interface to.etc.domui.component.tbl.ITableModel |
---|
DEFAULT_MAX_SIZE |
Constructor Summary | |
---|---|
TableKeyModelBase(java.util.Collection<K> keycoll)
Create an unsortable model using the specified collection as source. |
|
TableKeyModelBase(java.util.Collection<K> keycoll,
java.util.Comparator<K> comp)
Create a model where the keys are sorted using the specified comparator. |
Method Summary | |
---|---|
void |
add(int index,
K key)
Add a new key to show @ the specified location in the list(!). |
void |
add(K row)
Add a new key to the model. |
K |
delete(int index)
Delete the specified index from the backing list. |
boolean |
delete(K val)
Delete the specified key from the list and the backing set. |
protected T |
getItem(int index)
Internal: get a T for the specified index, to properly send events. |
java.util.List<T> |
getItems(int start,
int end)
|
protected abstract java.util.List<T> |
getItems(java.util.List<K> keys)
This method must return, for every K in the keys parameter, the proper T that belongs to that K, in the same order as the K's specified. |
int |
getRows()
This must return the total #of rows in this table. |
void |
modified(int index)
Send a "modified" message for the specified index. |
void |
modified(K key)
Send a modified event for the specified key, if found. |
void |
move(int to,
int from)
Convenience method to move a key from index from to index to. |
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 |
Methods inherited from interface to.etc.domui.component.tbl.ITableModel |
---|
addChangeListener, refresh, removeChangeListener |
Constructor Detail |
---|
public TableKeyModelBase(@Nonnull java.util.Collection<K> keycoll)
IModifyableTableModel
methods is called.
keycoll
- public TableKeyModelBase(@Nonnull java.util.Collection<K> keycoll, @Nonnull java.util.Comparator<K> comp)
keycoll
- comp
- Method Detail |
---|
@Nonnull protected abstract java.util.List<T> getItems(java.util.List<K> keys) throws java.lang.Exception
keys
-
java.lang.Exception
@Nonnull public java.util.List<T> getItems(int start, int end) throws java.lang.Exception
getItems
in interface ITableModel<T>
java.lang.Exception
@Nullable protected final T getItem(int index) throws java.lang.Exception
getItem
in class TableModelBase<T>
java.lang.Exception
TableModelBase.getItem(int)
public int getRows() throws java.lang.Exception
ITableModel
getRows
in interface ITableModel<T>
java.lang.Exception
ITableModel.getRows()
public void add(int index, @Nonnull K key) throws java.lang.Exception
add
in interface IModifyableTableModel<K>
java.lang.IllegalStateException
- when the model is sortable.
java.lang.Exception
IModifyableTableModel.add(int, java.lang.Object)
public void add(@Nonnull K row) throws java.lang.Exception
Collection.add(Object)
.
add
in interface IModifyableTableModel<K>
java.lang.Exception
IModifyableTableModel.add(java.lang.Object)
@Nullable public K delete(int index) throws java.lang.Exception
Collection.remove(Object)
.
delete
in interface IModifyableTableModel<K>
java.lang.Exception
IModifyableTableModel.delete(int)
public boolean delete(@Nonnull K val) throws java.lang.Exception
delete
in interface IModifyableTableModel<K>
java.lang.Exception
IModifyableTableModel.delete(java.lang.Object)
public void modified(int index) throws java.lang.Exception
index
-
java.lang.Exception
public void modified(K key) throws java.lang.Exception
key
-
java.lang.Exception
public void move(int to, int from) throws java.lang.Exception
to
- from
-
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |