org.mmbase.bridge.jsp.taglib
Class AbstractNodeListTag

org.mmbase.bridge.jsp.taglib.AbstractNodeListTag
All Implemented Interfaces:
ListProvider, TagIdentifier
Direct Known Subclasses:
ListNodesTag, ListRelationsTag, ListTag, RelatedNodesTag, TreeTag, WhoTag

public abstract class AbstractNodeListTag
implements ListProvider

AbstractNodeListTag, provides basic functionality for listing objects stored in MMBase

Author:
Kees Jongenburger, Michiel Meeuwissen, Pierre van Rooden

Field Summary
protected  boolean changed
          Determines whether a field in orderby changed during iteration.
protected  java.lang.String constraints
          Holds the clause used to filter the list.
protected  int currentItemIndex
          The current item
protected  java.lang.String directions
          Holds the direction to sort the list on (per field in orderby).
protected  int max
          The maximum number of elements in a list.
protected static int NOT_HANDLED
           
protected  int offset
          The offset of the elements that are returned in a list.
protected  java.lang.String orderby
          Holds the list of fields to sort the list on.
protected  NodeList returnList
           
protected  NodeIterator returnValues
          Data member to hold an iteration of the values to return.
protected  int timerHandle
          A handle necessary when using the Time Tag;
 
Constructor Summary
AbstractNodeListTag()
           
 
Method Summary
 int doAfterBody()
           
 int doEndTag()
           
 void doInitBody()
           
protected  int doStartTagHelper()
           
 java.lang.Object getCurrent()
           
 int getIndex()
           
 boolean isChanged()
          If you order a list, then the 'changed' property will be true if the field on which you order changed value.
 void setConstraints(java.lang.String where)
          Sets the selection query
 void setDirections(java.lang.String directions)
          Sets the direction to sort on
 void setMax(java.lang.String m)
          Set the list maximum
 void setOffset(java.lang.String o)
          Set the list offset
 void setOrderby(java.lang.String orderby)
          Sets the fields to sort on.
protected  int setReturnValues(NodeList nodes)
          Creates the node iterator and sets appropriate variables (i.e.
protected  int setReturnValues(NodeList nodes, boolean trim)
          Creates the node iterator and sets appropriate variables (i.e.
 int size()
           
 
Methods inherited from interface org.mmbase.bridge.jsp.taglib.TagIdentifier
getId
 

Field Detail

orderby

protected java.lang.String orderby
Holds the list of fields to sort the list on. The sort itself is implementation specific.

directions

protected java.lang.String directions
Holds the direction to sort the list on (per field in orderby). The sort itself is implementation specific.

constraints

protected java.lang.String constraints
Holds the clause used to filter the list. This is either a SQL-clause, with MMBase fields in brackets, a altavista-like search, preceded with the keyword ALTA, or a MMBase database node search, preceded with the keyord MMNODE. The filter itself is implementation specific (not all lists may implement this!).

max

protected int max
The maximum number of elements in a list. Setting the list size to conform to this maximum is implementation specific.

offset

protected int offset
The offset of the elements that are returned in a list. Setting the list to conform to this ofsset is implementation specific.

changed

protected boolean changed
Determines whether a field in orderby changed during iteration.

returnValues

protected NodeIterator returnValues
Data member to hold an iteration of the values to return. This variable is set in setReturnValues(NodeList), which should be called from #doStartTag, and will be used to fill the return variables for every iteration.

returnList

protected NodeList returnList

currentItemIndex

protected int currentItemIndex
The current item

timerHandle

protected int timerHandle
A handle necessary when using the Time Tag;

NOT_HANDLED

protected static int NOT_HANDLED
Constructor Detail

AbstractNodeListTag

public AbstractNodeListTag()
Method Detail

getIndex

public int getIndex()
Specified by:
getIndex in interface ListProvider
Following copied from interface: org.mmbase.bridge.jsp.taglib.ListProvider
Returns:
the index of the current item in a list

getCurrent

public java.lang.Object getCurrent()
Specified by:
getCurrent in interface ListProvider
Following copied from interface: org.mmbase.bridge.jsp.taglib.ListProvider
Returns:
the current item in a list

setOrderby

public void setOrderby(java.lang.String orderby)
                throws javax.servlet.jsp.JspTagException
Sets the fields to sort on.
Parameters:
sorted - A comma separated list of fields on witch the returned nodes should be sorted

setDirections

public void setDirections(java.lang.String directions)
                   throws javax.servlet.jsp.JspTagException
Sets the direction to sort on
Parameters:
direction - the selection query for the object we are looking for direction

setMax

public void setMax(java.lang.String m)
            throws javax.servlet.jsp.JspTagException
Set the list maximum
Parameters:
max - the max number of values returned

setOffset

public void setOffset(java.lang.String o)
               throws javax.servlet.jsp.JspTagException
Set the list offset
Parameters:
max - the max number of values returned

setConstraints

public void setConstraints(java.lang.String where)
                    throws javax.servlet.jsp.JspTagException
Sets the selection query
Parameters:
where - the selection query

doStartTagHelper

protected int doStartTagHelper()
                        throws javax.servlet.jsp.JspTagException

setReturnValues

protected int setReturnValues(NodeList nodes)
                       throws javax.servlet.jsp.JspTagException
Creates the node iterator and sets appropriate variables (i.e. listsize) froma passed node list. The list is assumed to be already sorted and trimmed.
Parameters:
nodes - the nodelist to create the iterator from
Returns:
EVAL_BODY_TAG if the resulting list is not empty, SKIP_BODY if the list is empty. THis value should be passed as the result of {

setReturnValues

protected int setReturnValues(NodeList nodes,
                              boolean trim)
                       throws javax.servlet.jsp.JspTagException
Creates the node iterator and sets appropriate variables (i.e. listsize). Takes a node list, and trims it using the offset and max attributes if so indicated. The list is assumed to be already sorted.
Parameters:
nodes - the nodelist to create the iterator from
trim - if true, trim the list using offset and max (if false, it is assumed the calling routine already did so)
Returns:
EVAL_BODY_TAG if the resulting list is not empty, SKIP_BODY if the list is empty. THis value should be passed as the result of {

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspTagException

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspTagException

doInitBody

public void doInitBody()
                throws javax.servlet.jsp.JspTagException

isChanged

public boolean isChanged()
If you order a list, then the 'changed' property will be true if the field on which you order changed value.
Specified by:
isChanged in interface ListProvider
Following copied from interface: org.mmbase.bridge.jsp.taglib.ListProvider
Returns:
a boolean indicating wether the field on which was sorted is changed.

size

public int size()
Specified by:
size in interface ListProvider
Following copied from interface: org.mmbase.bridge.jsp.taglib.ListProvider
Returns:
the size of the list


MMBase 2002