1 10 package org.mmbase.bridge.jsp.taglib.functions; 11 12 import java.util.Collection ; 13 14 import javax.servlet.jsp.*; 15 16 import org.mmbase.bridge.*; 17 import org.mmbase.bridge.jsp.taglib.*; 18 import org.mmbase.bridge.jsp.taglib.containers.FunctionContainerReferrer; 19 import org.mmbase.bridge.jsp.taglib.util.ContextContainer; 20 import org.mmbase.util.logging.*; 21 22 31 public class NodeListFunctionTag extends AbstractFunctionTag implements ListProvider, FunctionContainerReferrer, NodeProvider { 32 33 private static final Logger log = Logging.getLoggerInstance(NodeListFunctionTag.class); 34 35 private NodeProviderHelper nodeHelper = new NodeProviderHelper(this); 39 private NodeListHelper listHelper = new NodeListHelper(this, nodeHelper); 40 41 42 public Node getNodeVar() throws JspTagException { 44 return nodeHelper.getNodeVar(); 45 } 46 47 public Query getGeneratingQuery() throws JspTagException { 48 return nodeHelper.getGeneratingQuery(); 49 } 50 53 public void setCommitonclose(String c) throws JspTagException { 54 nodeHelper.setCommitonclose(c); 55 } 56 57 public void setJspvar(String jv) { 58 nodeHelper.setJspvar(jv); 59 } 60 61 public int size() { 63 return listHelper.size(); 64 } 65 66 public int getIndex() { 67 return listHelper.getIndex(); 68 } 69 70 public int getIndexOffset() { 71 return listHelper.getIndexOffset(); 72 } 73 74 public boolean isChanged() { 75 return listHelper.isChanged(); 76 } 77 78 public Object getCurrent() { 79 return listHelper.getCurrent(); 80 } 81 82 public void remove() { 83 listHelper.remove(); 84 } 85 86 public void setMax(String m) throws JspTagException { 88 listHelper.setMax(m); 89 } 90 91 public void setOffset(String o) throws JspTagException { 92 listHelper.setOffset(o); 93 } 94 95 public void setComparator(String c) throws JspTagException { 96 listHelper.setComparator(c); 97 } 98 99 public ContextContainer getContextContainer() throws JspTagException { 100 return listHelper.getContextContainer(); 101 } 102 103 public int doStartTag() throws JspTagException { 104 NodeList list; 105 Object value = getFunctionValue(false); 106 107 112 if (value instanceof NodeList) { 113 list = (NodeList) value; 114 } else { 115 list = getCloudVar().createNodeList(); 116 if (value != null) { 117 list.addAll((Collection ) value); 118 } 119 } 120 listHelper.doStartTagHelper(); 121 return listHelper.setReturnValues(list, true); 122 } 123 124 public int doAfterBody() throws JspException { 125 log.debug("doafterbody"); 126 nodeHelper.doAfterBody(); 127 return listHelper.doAfterBody(); 128 } 129 130 public int doEndTag() throws JspTagException { 131 super.doEndTag(); 132 listHelper.doEndTag(); 133 return nodeHelper.doEndTag(); 134 } 135 136 public void doFinally() { 137 listHelper.doFinally(); 138 nodeHelper.doFinally(); 139 } 140 141 public javax.servlet.jsp.jstl.core.LoopTagStatus getLoopStatus() { 142 return new ListProviderLoopTagStatus(this); 143 } 144 } 145 146 | Popular Tags |