You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by he...@apache.org on 2003/02/28 15:19:54 UTC
cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts VelocityECSLayout.java VelocityOnlyLayout.java
henning 2003/02/28 06:19:54
Modified: src/java/org/apache/turbine/modules/layouts
VelocityECSLayout.java VelocityOnlyLayout.java
Log:
Cleaned up the return logic of the Layout execution.
Revision Changes Path
1.6 +24 -17 jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts/VelocityECSLayout.java
Index: VelocityECSLayout.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts/VelocityECSLayout.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- VelocityECSLayout.java 12 Feb 2003 17:52:17 -0000 1.5
+++ VelocityECSLayout.java 28 Feb 2003 14:19:54 -0000 1.6
@@ -54,16 +54,20 @@
* <http://www.apache.org/>.
*/
-// ECS Classes
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.apache.ecs.ConcreteElement;
+
import org.apache.turbine.modules.Layout;
import org.apache.turbine.modules.ScreenLoader;
+
import org.apache.turbine.services.velocity.TurbineVelocity;
+
import org.apache.turbine.util.RunData;
+
import org.apache.turbine.util.template.TemplateNavigation;
+
import org.apache.velocity.context.Context;
/**
@@ -74,12 +78,14 @@
*
* @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
* @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
+ * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
* @version $Id$
* @deprecated you should use velocity
*/
-public class VelocityECSLayout extends Layout
+public class VelocityECSLayout
+ extends Layout
{
- /** the log */
+ /** Logging */
private static Log log = LogFactory.getLog(VelocityECSLayout.class);
/**
@@ -98,23 +104,24 @@
* @param data Turbine information.
* @exception Exception a generic exception.
*/
- public void doBuild(RunData data) throws Exception
+ public void doBuild(RunData data)
+ throws Exception
{
// Get the context needed by Velocity.
Context context = TurbineVelocity.getContext(data);
- // Screen results.
- String returnValue = "";
+ String screenName = data.getScreen();
+
+ log.debug("Loading Screen " + screenName);
+
+ /*
+ * First, generate the screen and put it in the context so we
+ * can grab it the layout template.
+ */
+ ConcreteElement results =
+ ScreenLoader.getInstance().eval(data, screenName);
- // First, generate the screen and put it in the context so we
- // can grab it the layout template.
- ConcreteElement results = ScreenLoader.getInstance()
- .eval(data, data.getScreen());
-
- if (results != null)
- {
- returnValue = results.toString();
- }
+ String returnValue = (results == null) ? "" : results.toString();
// Variable for the screen in the layout template.
context.put("screen_placeholder", returnValue);
1.5 +14 -11 jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java
Index: VelocityOnlyLayout.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- VelocityOnlyLayout.java 12 Feb 2003 17:52:17 -0000 1.4
+++ VelocityOnlyLayout.java 28 Feb 2003 14:19:54 -0000 1.5
@@ -54,14 +54,17 @@
* <http://www.apache.org/>.
*/
-// ECS Classes
-
import org.apache.ecs.ConcreteElement;
+
import org.apache.turbine.modules.Layout;
import org.apache.turbine.modules.ScreenLoader;
+
import org.apache.turbine.services.velocity.TurbineVelocity;
+
import org.apache.turbine.util.RunData;
+
import org.apache.turbine.util.template.TemplateNavigation;
+
import org.apache.velocity.context.Context;
/**
@@ -72,8 +75,11 @@
*
* @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
* @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
+ * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
+ * @version $Id$
*/
-public class VelocityOnlyLayout extends Layout
+public class VelocityOnlyLayout
+ extends Layout
{
/**
* Method called by LayoutLoader.
@@ -81,21 +87,18 @@
* @param data RunData
* @throws Exception generic exception
*/
- public void doBuild(RunData data) throws Exception
+ public void doBuild(RunData data)
+ throws Exception
{
// Get the context needed by Velocity
Context context = TurbineVelocity.getContext(data);
- // Screen results
- String returnValue = "";
// First, generate the screen and put it in the context so
// we can grab it the layout template.
ConcreteElement results = ScreenLoader.getInstance()
- .eval(data, data.getScreen());
- if (results != null)
- {
- returnValue = results.toString();
- }
+ .eval(data, data.getScreen());
+
+ String returnValue = (results == null) ? "" : results.toString();
// variable for the screen in the layout template
context.put("screen_placeholder", returnValue);
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org