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

java.lang.Object
  extended by to.etc.domui.component.tbl.TableModelBase<T>
      extended by to.etc.domui.component.tbl.TableListModelBase<T>
          extended by to.etc.domui.component.tbl.SimpleSearchModel<T>
All Implemented Interfaces:
IKeyedTableModel<T>, IModifyableTableModel<T>, IProgrammableSortableModel, ISortableTableModel, ITableModel<T>, ITruncateableDataModel, IShelvedListener

public class SimpleSearchModel<T>
extends TableListModelBase<T>
implements IKeyedTableModel<T>, ITruncateableDataModel, IProgrammableSortableModel, IShelvedListener

Author:
Frits Jalvingh Created on Jun 16, 2008

Nested Class Summary
static interface SimpleSearchModel.IQuery<T>
          Functor interface to create some abstract query result.
 
Field Summary
 
Fields inherited from interface to.etc.domui.component.tbl.ITableModel
DEFAULT_MAX_SIZE
 
Constructor Summary
SimpleSearchModel(IQueryHandler<T> ss, QCriteria<T> qc)
           
SimpleSearchModel(NodeBase contextSourceNode, QCriteria<T> qc)
          EXPERIMENTAL INTERFACE
SimpleSearchModel(NodeBase contextSource, SimpleSearchModel.IQuery<T> q)
           
SimpleSearchModel(QDataContextFactory ss, QCriteria<T> qc)
          Use {@link SimpleSearchModel#SimpleSearchModel(IQueryHandler, QCriteria) instead!
SimpleSearchModel(QDataContextFactory f, SimpleSearchModel.IQuery<T> q)
           
 
Method Summary
 void clear()
           
 T findRowObject(java.lang.String key)
           
 java.util.List<T> getItems(int start, int end)
           
protected  java.util.List<T> getList()
           
 int getMaxRowCount()
          Return the current result row limit.
 QCriteria<T> getQuery()
           
 java.lang.String getRowKey(int row)
           
 QCriteria<?> getSortCriteria()
           
 java.lang.String getSortKey()
          If this model is currently sorted, this returns an identifier (usually a property reference) indicating on which column the thingy is sorted.
 int getTruncatedCount()
           
protected  void handleQuerySorting(QCriteria<T> qc)
           
protected  void initResult()
           
 boolean isRefreshAfterShelve()
           
 boolean isSortDescending()
          If the set is a sorted set, this returns TRUE if the sort order is descending.
 boolean isTruncated()
           
 void onShelve()
          When the component is shelved we discard all results.
 void onUnshelve()
           
 void refresh()
           
 void setMaxRowCount(int maxRowCount)
          Set the current result row limit.
 void setRefreshAfterShelve(boolean refreshAfterShelve)
           
 void sortOn(ISortHelper helper, boolean descending)
          Set a sorter to sort the result.
 void sortOn(java.lang.String key, boolean descending)
          When called this does a re-query using the specified sort property.
 
Methods inherited from class to.etc.domui.component.tbl.TableListModelBase
add, add, delete, delete, getComparator, getItem, getRows, modified, modified, move, setComparator
 
Methods inherited from class to.etc.domui.component.tbl.TableModelBase
addChangeListener, fireAdded, fireDeleted, fireModelChanged, fireModified, getListeners, 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, getRows, removeChangeListener
 

Constructor Detail

SimpleSearchModel

public SimpleSearchModel(@Nonnull
                         NodeBase contextSourceNode,
                         @Nonnull
                         QCriteria<T> qc)
EXPERIMENTAL INTERFACE

Parameters:
contextSourceNode -
qc -

SimpleSearchModel

public SimpleSearchModel(@Nonnull
                         QDataContextFactory ss,
                         @Nonnull
                         QCriteria<T> qc)
Use {@link SimpleSearchModel#SimpleSearchModel(IQueryHandler, QCriteria) instead!

Parameters:
ss -
qc -

SimpleSearchModel

public SimpleSearchModel(@Nonnull
                         IQueryHandler<T> ss,
                         @Nonnull
                         QCriteria<T> qc)

SimpleSearchModel

public SimpleSearchModel(@Nonnull
                         QDataContextFactory f,
                         @Nonnull
                         SimpleSearchModel.IQuery<T> q)

SimpleSearchModel

public SimpleSearchModel(@Nonnull
                         NodeBase contextSource,
                         @Nonnull
                         SimpleSearchModel.IQuery<T> q)
Method Detail

getQuery

public QCriteria<T> getQuery()

setRefreshAfterShelve

public void setRefreshAfterShelve(boolean refreshAfterShelve)
Parameters:
refreshAfterShelve -

isRefreshAfterShelve

public boolean isRefreshAfterShelve()

getMaxRowCount

public int getMaxRowCount()
Return the current result row limit. When <= 0 the result will have a default limit.

Returns:

setMaxRowCount

public void setMaxRowCount(int maxRowCount)
Set the current result row limit. When <= 0 the result will have a default limit.


handleQuerySorting

protected void handleQuerySorting(QCriteria<T> qc)

getSortCriteria

@Nonnull
public QCriteria<?> getSortCriteria()

isTruncated

public boolean isTruncated()

getTruncatedCount

public int getTruncatedCount()
Specified by:
getTruncatedCount in interface ITruncateableDataModel

initResult

protected void initResult()
                   throws java.lang.Exception
Throws:
java.lang.Exception

getList

@Nonnull
protected java.util.List<T> getList()
                             throws java.lang.Exception
Specified by:
getList in class TableListModelBase<T>
Throws:
java.lang.Exception

getItems

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

findRowObject

public T findRowObject(java.lang.String key)
                throws java.lang.Exception
Specified by:
findRowObject in interface IKeyedTableModel<T>
Throws:
java.lang.Exception

getRowKey

public java.lang.String getRowKey(int row)
                           throws java.lang.Exception
Specified by:
getRowKey in interface IKeyedTableModel<T>
Throws:
java.lang.Exception
See Also:
to.etc.domui.component.tbl.ITableModel#getRowKey(int)

clear

public void clear()

sortOn

public void sortOn(java.lang.String key,
                   boolean descending)
            throws java.lang.Exception
When called this does a re-query using the specified sort property.

Specified by:
sortOn in interface ISortableTableModel
Throws:
java.lang.Exception

getSortKey

@Nullable
public java.lang.String getSortKey()
Description copied from interface: ISortableTableModel
If this model is currently sorted, this returns an identifier (usually a property reference) indicating on which column the thingy is sorted. If the model is unsorted this returns null.

Specified by:
getSortKey in interface ISortableTableModel
Returns:

isSortDescending

public boolean isSortDescending()
Description copied from interface: ISortableTableModel
If the set is a sorted set, this returns TRUE if the sort order is descending. The return value is undefined for an unsorted model.

Specified by:
isSortDescending in interface ISortableTableModel
Returns:

sortOn

public void sortOn(ISortHelper helper,
                   boolean descending)
            throws java.lang.Exception
Set a sorter to sort the result.

Specified by:
sortOn in interface IProgrammableSortableModel
Throws:
java.lang.Exception
See Also:
IProgrammableSortableModel.sortOn(to.etc.domui.component.tbl.ISortHelper, boolean)

onShelve

public void onShelve()
              throws java.lang.Exception
When the component is shelved we discard all results. This causes a requery when unshelved (when accessed).

Specified by:
onShelve in interface IShelvedListener
Throws:
java.lang.Exception
See Also:
IShelvedListener.onShelve()

onUnshelve

public void onUnshelve()
                throws java.lang.Exception
Specified by:
onUnshelve in interface IShelvedListener
Throws:
java.lang.Exception

refresh

public void refresh()
Specified by:
refresh in interface ITableModel<T>
Overrides:
refresh in class TableModelBase<T>