geirm 00/12/04 21:09:14
Modified: src/java/org/apache/velocity Context.java
Log:
Added member String and accessors to carry template name down through tree. Context
acts as a visitor to all the nodes that count, so why not...
Revision Changes Path
1.8 +28 -1 jakarta-velocity/src/java/org/apache/velocity/Context.java
Index: Context.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/Context.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Context.java 2000/11/27 22:44:15 1.7
+++ Context.java 2000/12/05 05:09:13 1.8
@@ -67,7 +67,8 @@
* an valid object derived from Object. These objects
* are stored in a Hashtable.
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: Context.java,v 1.7 2000/11/27 22:44:15 jon Exp $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
+ * @version $Id: Context.java,v 1.8 2000/12/05 05:09:13 geirm Exp $
*/
public class Context implements Cloneable, Serializable
{
@@ -77,6 +78,11 @@
protected Hashtable context;
/**
+ * Current template name.
+ */
+ private String strCurrentTemplate = "<undef>";
+
+ /**
* Constructs the context under which to execute the templating engine.
*/
public Context()
@@ -152,4 +158,25 @@
return clone;
}
+
+ /**
+ * set/get the value of the current template during a render
+ * Since the Context is effectively a visitor as it is sent
+ * to all nodes during render(), lets take advantage of this.
+ */
+ public void setCurrentTemplateName( String s )
+ {
+ strCurrentTemplate = s;
+ return;
+ }
+
+ public String getCurrentTemplateName()
+ {
+ return strCurrentTemplate;
+ }
}
+
+
+
+
+