info.magnolia.cms.gui.controlx.list
Class AbstractListModel

java.lang.Object
  extended by info.magnolia.cms.gui.controlx.list.AbstractListModel
All Implemented Interfaces:
ListModel
Direct Known Subclasses:
AbstractSearchableListModel, InboxListModel, VersionListModel

public abstract class AbstractListModel
extends Object
implements ListModel

Author:
Sameer Charles $Id: AbstractListModel.java 41137 2011-01-06 18:19:25Z gjoseph $

Nested Class Summary
protected  class AbstractListModel.ListComparator
          Does simple or sub ordering
 
Field Summary
static String ASCENDING
          sort or group by order
static String DESCENDING
          sort or group by order
protected  String groupBy
          group by field name
protected  String groupByOrder
          group by order
protected  String sortBy
          sort by field name
protected  String sortByOrder
          sort by order
 
Constructor Summary
AbstractListModel()
           
 
Method Summary
protected  ListModelIterator createIterator(Collection items)
          Create the iterator
protected  Collection doSort(Collection collection)
          sort
 String getGroupBy()
          get group on field name
 String getGroupByOrder()
          get group by ordering
 ListModelIterator getListModelIterator()
          this must be implemented by implementing classes
protected abstract  Collection getResult()
           
 String getSortBy()
          get sort on field name
 String getSortByOrder()
          get sort by ordering
 ValueProvider getValueProvider()
           
 Iterator iterator()
          implement Iterable
protected  AbstractListModel.ListComparator newComparator()
           
protected  String resolveId(int index, Object value)
          Use by the list iterator to resolve the id
 void setGroupBy(String name)
          set group by field
 void setGroupBy(String name, String order)
          set group by field and order ('ASCENDING' | 'DESCENDING')
 void setSortBy(String name)
          set sort by field
 void setSortBy(String name, String order)
          set sort by field and order ('ASCENDING' | 'DESCENDING')
 void setValueProvider(ValueProvider valueProvider)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESCENDING

public static final String DESCENDING
sort or group by order

See Also:
Constant Field Values

ASCENDING

public static final String ASCENDING
sort or group by order

See Also:
Constant Field Values

sortBy

protected String sortBy
sort by field name


sortByOrder

protected String sortByOrder
sort by order


groupBy

protected String groupBy
group by field name


groupByOrder

protected String groupByOrder
group by order

Constructor Detail

AbstractListModel

public AbstractListModel()
Method Detail

getListModelIterator

public ListModelIterator getListModelIterator()
this must be implemented by implementing classes

Specified by:
getListModelIterator in interface ListModel
Returns:
Iterator over found records
See Also:
ListModelIterator

iterator

public Iterator iterator()
Description copied from interface: ListModel
implement Iterable

Specified by:
iterator in interface ListModel
Returns:
iterator

getResult

protected abstract Collection getResult()
                                 throws Exception
Returns:
the collection of the items passed to the iterator
Throws:
Exception

createIterator

protected ListModelIterator createIterator(Collection items)
Create the iterator

Parameters:
items -
Returns:

setSortBy

public void setSortBy(String name)
set sort by field

Specified by:
setSortBy in interface ListModel
Parameters:
name -

setSortBy

public void setSortBy(String name,
                      String order)
set sort by field and order ('ASCENDING' | 'DESCENDING')

Specified by:
setSortBy in interface ListModel
Parameters:
name -
order -

setGroupBy

public void setGroupBy(String name)
set group by field

Specified by:
setGroupBy in interface ListModel
Parameters:
name -

setGroupBy

public void setGroupBy(String name,
                       String order)
set group by field and order ('ASCENDING' | 'DESCENDING')

Specified by:
setGroupBy in interface ListModel
Parameters:
name -
order -

getSortBy

public String getSortBy()
get sort on field name

Specified by:
getSortBy in interface ListModel
Returns:
String field name

getSortByOrder

public String getSortByOrder()
get sort by ordering

Specified by:
getSortByOrder in interface ListModel
Returns:
order ('ASCENDING' | 'DESCENDING')

getGroupBy

public String getGroupBy()
get group on field name

Specified by:
getGroupBy in interface ListModel
Returns:
String field name

getGroupByOrder

public String getGroupByOrder()
get group by ordering

Specified by:
getGroupByOrder in interface ListModel
Returns:
order ('ASCENDING' | 'DESCENDING')

doSort

protected Collection doSort(Collection collection)
sort

Parameters:
collection -
Returns:
sorted collection

newComparator

protected AbstractListModel.ListComparator newComparator()

setValueProvider

public void setValueProvider(ValueProvider valueProvider)
Parameters:
valueProvider - the valueProvider to set

getValueProvider

public ValueProvider getValueProvider()
Returns:
the valueProvider

resolveId

protected String resolveId(int index,
                           Object value)
Use by the list iterator to resolve the id



Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.