KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > bridge > jsp > taglib > macro > RelatedTag


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.bridge.jsp.taglib.macro;
11
12 import javax.servlet.jsp.JspTagException JavaDoc;
13
14 import org.mmbase.bridge.*;
15
16 import org.mmbase.bridge.jsp.taglib.ListTag;
17 import org.mmbase.bridge.jsp.taglib.util.Attribute;
18 import org.mmbase.bridge.jsp.taglib.containers.*;
19
20 //import org.mmbase.util.logging.*;
21

22
23 /**
24  * Shortcut for List where the start node is the parent node.
25  *
26  * @author Michiel Meeuwissen
27  * @author Jacco de Groot
28  * @author Pierre van Rooden
29  * @version $Id: RelatedTag.java,v 1.31 2006/07/21 09:24:37 michiel Exp $
30  */

31 public class RelatedTag extends ListTag {
32     // private static final Logger log = Logging.getLoggerInstance(RelatedTag.class);
33

34     protected Node getBaseNode() throws JspTagException JavaDoc {
35         if (nodes != Attribute.NULL && ! nodes.getString(this).equals("")) {
36             // return getCloudVar().getNode((String)StringSplitter.split(nodes.getString(this), ",").get(0));
37
String JavaDoc[] ns = nodes.getString(this).trim().split("\\s*,\\s*");
38             return super.getCloudVar().getNode(ns[0]);
39         } else {
40             return getNode();
41         }
42     }
43
44
45     // overridden since 1.8.2
46
public Cloud getCloudVar() throws JspTagException JavaDoc {
47         return getBaseNode().getCloud();
48
49     }
50
51     protected String JavaDoc getSearchNodes() throws JspTagException JavaDoc {
52         return (nodes == Attribute.NULL || nodes.getString(this).equals("")) ? "" + getNode().getNumber() : nodes.getString(this);
53     }
54
55     /**
56      * Obtain the list path. Adds the related basenode's type (extended with a '0' postfix to distinguis it from
57      * other types in the path) to the front of the path.
58      */

59     protected String JavaDoc getPath() throws JspTagException JavaDoc {
60         return getBaseNode().getNodeManager().getName() + "0," + path.getString(this);
61     }
62
63     protected QueryContainer getListContainer() throws JspTagException JavaDoc {
64         return (QueryContainer) findParentTag(RelatedContainerTag.class, (String JavaDoc) container.getValue(this), false);
65     }
66
67 }
68
Popular Tags