Hi.
It's probably useless (?) patch, but I've decided to post it anyway :)
It does not modify, extend or improve any functionality, but simply
cleans things out - by replacing those ugly hard-coded string literals
with private static constants. Feel free to ingnore it, whoever is
responsible for commiting stuff like this :):)
Bye.
Scooter
---- !!!!!!!!!! Cut here !!!!!!!!!!!
diff -u -r1.1.1.1 TemplateInfo.java
--- TemplateInfo.java 2000/07/19 02:57:04 1.1.1.1
+++ TemplateInfo.java 2000/07/20 15:00:24
@@ -61,17 +61,22 @@
// Turbine classes
import org.apache.turbine.util.*;
-
+
/**
* This is a wrapper for Template specific information.
* It's part of the RunData object and can extract the information
- * it needs to do the job directly from the data.getParameters().
+ * it needs to do the job directly from the data.getParameters().
*
* @author Dave Bryson<a
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
* @version $Revision: 1.1.1.1 $
*/
public class TemplateInfo
{
+ /* tempStorage hashtable constants */
+ private static final String NAVIGATION_TEMPLATE = "00navigation_template00";
+ private static final String LAYOUT_TEMPLATE = "00layout_template00";
+ private static final String DEFAULT_TEMPLATE = "00default_template00";
+ private static final String SERVICE_NAME = "template_service";
/* Handle to the RunData object */
private RunData data = null;
/* Place to store information about templates */
@@ -86,30 +91,30 @@
this.data=data;
tempStorage = new Hashtable();
}
-
+
/**
* Get the value of navigationTemplate.
* @return Value of navigationTemplate.
*/
public String getNavigationTemplate()
{
- String temp = getString("00navigation_template00");
+ String temp = getString(TemplateInfo.NAVIGATION_TEMPLATE);
if ( temp != null )
{
temp = temp.replace(',', '/');
}
return temp;
}
-
+
/**
* Set the value of navigationTemplate.
* @param v Value to assign to navigationTemplate.
*/
public void setNavigationTemplate(String v)
{
- setTemp("00navigation_template00",v);
+ setTemp(TemplateInfo.NAVIGATION_TEMPLATE,v);
}
-
+
/**
* Get the value of screen for the RunData parameters.<br>
* This information comes from PathInfo or a QueryString.
@@ -126,15 +131,15 @@
}
return temp;
}
-
+
/**
* Set the value of screen. This is really just a method to hide using
- * the RunData Parameter.
+ * the RunData Parameter.
* @param v Value to assign to screen.
*/
public void setScreenTemplate(String v)
{
- data.getParameters().add("template",v);
+ data.getParameters().add("template",v);
}
/**
@@ -143,21 +148,21 @@
*/
public String getLayoutTemplate()
{
- String value = getString("00layout_template00");
+ String value = getString(TemplateInfo.LAYOUT_TEMPLATE);
if ( value == null )
value = getDefaultTemplate();
return value;
}
-
+
/**
* Set the value of layout.
* @param v Value to assign to layout.
*/
public void setLayoutTemplate(String v)
{
- setTemp("00layout_template00",v);
+ setTemp(TemplateInfo.LAYOUT_TEMPLATE,v);
}
-
+
/**
* Get the value of Template context. This will be cast
* to the proper Context by it's Service.
@@ -167,7 +172,7 @@
{
return getTemp(name);
}
-
+
/**
* Set the value of context.
* @param v Value to assign to context.
@@ -176,23 +181,23 @@
{
setTemp(name,v);
}
-
+
/**
* Get the value of service.
* @return Value of service.
*/
public String getService()
{
- return getString("template_service");
+ return getString(TemplateInfo.SERVICE_NAME);
}
-
+
/**
* Set the value of service.
* @param v Value to assign to service.
*/
public void setService(String v)
{
- setTemp("template_service",v);
+ setTemp(TemplateInfo.SERVICE_NAME,v);
}
/**
@@ -201,18 +206,18 @@
*/
public String getDefaultTemplate()
{
- return getString("00default_template00");
+ return getString(TemplateInfo.DEFAULT_TEMPLATE);
}
-
+
/**
* Set the value of defaultTemplate.
* @param v Value to assign to defaultTemplate.
*/
public void setDefaultTemplate(String v)
{
- setTemp("00default_template00",v);
+ setTemp(TemplateInfo.DEFAULT_TEMPLATE,v);
}
-
+
/**
* Get an object from temporary storage.
*/
@@ -220,7 +225,7 @@
{
return tempStorage.get (name);
}
-
+
/**
* Get an object from temporary storage
* @return default if value is null.
@@ -275,11 +280,3 @@
return value;
}
}
-
-
-
-
-
-
-
-
----!!!!!!!!!!! Cut here !!!!!!!!!!
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]