to.etc.domui.component.tbl
Class TableListModelBase<T>

java.lang.Object
  extended by to.etc.domui.component.tbl.TableModelBase<T>
      extended by to.etc.domui.component.tbl.TableListModelBase<T>
All Implemented Interfaces:
IModifyableTableModel<T>, ITableModel<T>
Direct Known Subclasses:
DefaultTableModel, SimpleListModel, SimpleSearchModel

public abstract class TableListModelBase<T>
extends TableModelBase<T>
implements IModifyableTableModel<T>


Field Summary
 
Fields inherited from interface to.etc.domui.component.tbl.ITableModel
DEFAULT_MAX_SIZE
 
Constructor Summary
TableListModelBase()
           
 
Method Summary
 void add(int index, T row)
          Add the item at the specified index.
 void add(T row)
          Add the item at the end (or the appropriate location wrt the sort order) of the list.
 T delete(int index)
          Delete the object at the specified index.
 boolean delete(T val)
           
 java.util.Comparator<T> getComparator()
          When set the list will be kept ordered.
 T getItem(int index)
           
 java.util.List<T> getItems(int start, int end)
           
protected abstract  java.util.List<T> getList()
           
 int getRows()
          This must return the total #of rows in this table.
 void modified(int index)
           
 void modified(T val)
           
 void move(int to, int from)
          Convenience method to move an item from index from to index to.
 void setComparator(java.util.Comparator<T> comparator)
          Sets a new comparator to use.
 
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

TableListModelBase

public TableListModelBase()
Method Detail

getList

protected abstract java.util.List<T> getList()
                                      throws java.lang.Exception
Throws:
java.lang.Exception

getItems

public java.util.List<T> getItems(int start,
                                  int end)
                           throws java.lang.Exception
Specified by:
getItems in interface ITableModel<T>
Throws:
java.lang.Exception

getItem

public T getItem(int index)
          throws java.lang.Exception
Specified by:
getItem in class TableModelBase<T>
Throws:
java.lang.Exception

getRows

public int getRows()
            throws java.lang.Exception
Description copied from interface: ITableModel
This must return the total #of rows in this table.

Specified by:
getRows in interface ITableModel<T>
Returns:
Throws:
java.lang.Exception

getComparator

public java.util.Comparator<T> getComparator()
When set the list will be kept ordered.

Returns:

setComparator

public void setComparator(java.util.Comparator<T> comparator)
                   throws java.lang.Exception
Sets a new comparator to use. This resorts the model, if needed, causing a full model update.

Parameters:
comparator -
Throws:
java.lang.Exception

add

public void add(int index,
                T row)
         throws java.lang.Exception
Add the item at the specified index. The item currently at that position and all items above it move up a notch.

Specified by:
add in interface IModifyableTableModel<T>
Throws:
java.lang.Exception

add

public void add(T row)
         throws java.lang.Exception
Add the item at the end (or the appropriate location wrt the sort order) of the list.

Specified by:
add in interface IModifyableTableModel<T>
Throws:
java.lang.Exception

delete

public T delete(int index)
         throws java.lang.Exception
Delete the object at the specified index.

Specified by:
delete in interface IModifyableTableModel<T>
Parameters:
index -
Throws:
java.lang.Exception

delete

public boolean delete(T val)
               throws java.lang.Exception
Specified by:
delete in interface IModifyableTableModel<T>
Throws:
java.lang.Exception

modified

public void modified(int index)
              throws java.lang.Exception
Throws:
java.lang.Exception

modified

public void modified(T val)
              throws java.lang.Exception
Throws:
java.lang.Exception

move

public void move(int to,
                 int from)
          throws java.lang.Exception
Convenience method to move an item from index from to index to.

Parameters:
to -
from -
Throws:
java.lang.Exception