org.mmbase.bridge.jsp.taglib
Class AbstractNodeListTag
java.lang.Object
|
+--javax.servlet.jsp.tagext.TagSupport
|
+--javax.servlet.jsp.tagext.BodyTagSupport
|
+--org.mmbase.bridge.jsp.taglib.ContextReferrerTag
|
+--org.mmbase.bridge.jsp.taglib.CloudReferrerTag
|
+--org.mmbase.bridge.jsp.taglib.NodeReferrerTag
|
+--org.mmbase.bridge.jsp.taglib.AbstractNodeProviderTag
|
+--org.mmbase.bridge.jsp.taglib.AbstractNodeListTag
- All Implemented Interfaces:
- javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, ListProvider, NodeProvider, java.io.Serializable, javax.servlet.jsp.tagext.Tag, TagIdentifier
- Direct Known Subclasses:
- ListNodesTag, ListRelationsTag, ListTag, RelatedNodesTag, TreeTag, WhoTag
- public abstract class AbstractNodeListTag
- extends AbstractNodeProviderTag
- implements javax.servlet.jsp.tagext.BodyTag, ListProvider
AbstractNodeListTag, provides basic functionality for listing objects
stored in MMBase
- Author:
- Kees Jongenburger, Michiel Meeuwissen, Pierre van Rooden
- See Also:
- Serialized Form
|
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; |
| Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
bodyContent |
| Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
id, pageContext |
| Fields inherited from interface javax.servlet.jsp.tagext.BodyTag |
EVAL_BODY_BUFFERED, EVAL_BODY_TAG |
| Fields inherited from interface javax.servlet.jsp.tagext.IterationTag |
EVAL_BODY_AGAIN |
| Fields inherited from interface javax.servlet.jsp.tagext.Tag |
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
|
Method Summary |
int |
doAfterBody()
Does everything needed on the afterbody tag of every
NodeProvider. |
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 class org.mmbase.bridge.jsp.taglib.ContextReferrerTag |
findParentTag, findParentTag, findWriter, findWriter, getAttributeBoolean, getAttributeInteger, getAttributeInteger, getAttributeValue, getContextTag, getObject, getReferid, getString, release, setContext, setPageContext, setReferid, setWriter |
| Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport |
doStartTag, getBodyContent, getPreviousOut, setBodyContent |
| Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.servlet.jsp.tagext.BodyTag |
setBodyContent |
| Methods inherited from interface javax.servlet.jsp.tagext.Tag |
doStartTag, getParent, release, setPageContext, setParent |
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 BodyTagSupport.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
AbstractNodeListTag
public AbstractNodeListTag()
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_BUFFERED 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 fromtrim - if true, trim the list using offset and max
(if false, it is assumed the calling routine already did so)- Returns:
- EVAL_BODY_BUFFERED 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
- Description copied from class:
AbstractNodeProviderTag
- Does everything needed on the afterbody tag of every
NodeProvider. Normally this function would be overrided with
one that has to call super.doAfterBody(). But not all servlet
engines to call this function if there is no body. So, in that
case it should be called from doEndTag, if the tag can do
something without a body.
- Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag- Overrides:
doAfterBody in class AbstractNodeProviderTag
doEndTag
public int doEndTag()
throws javax.servlet.jsp.JspTagException
- Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag- Overrides:
doEndTag in class AbstractNodeProviderTag
doInitBody
public void doInitBody()
throws javax.servlet.jsp.JspTagException
- Specified by:
doInitBody in interface javax.servlet.jsp.tagext.BodyTag- Overrides:
doInitBody in class AbstractNodeProviderTag
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 build 1.6.5.20030923