You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by mp...@apache.org on 2003/02/11 22:10:45 UTC

cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts DefaultLayout.java JspLayout.java VelocityDirectLayout.java VelocityECSLayout.java VelocityOnlyLayout.java VelocityXslLayout.java

mpoeschl    2003/02/11 13:10:45

  Modified:    src/java/org/apache/turbine/modules/layouts
                        DefaultLayout.java JspLayout.java
                        VelocityDirectLayout.java VelocityECSLayout.java
                        VelocityOnlyLayout.java VelocityXslLayout.java
  Log:
  o javadocs
  o remove unused private members
  o checkstyle fixes
  
  Revision  Changes    Path
  1.2       +14 -14    jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts/DefaultLayout.java
  
  Index: DefaultLayout.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts/DefaultLayout.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultLayout.java	16 Aug 2001 05:08:33 -0000	1.1
  +++ DefaultLayout.java	11 Feb 2003 21:10:44 -0000	1.2
  @@ -72,7 +72,8 @@
    *
    * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
    * @version $Id$
  - * @deprecated The use of ECS for the view is deprecated. Use a templating solution.
  + * @deprecated The use of ECS for the view is deprecated.
  + *             Use a templating solution.
    */
   public class DefaultLayout extends Layout
   {
  @@ -83,22 +84,21 @@
        * defaults to 'white'</em></p>
        *
        * @param data Turbine information.
  -     * @exception Exception, a generic exception.
  +     * @exception Exception a generic exception.
        */
  -    public void doBuild( RunData data ) throws Exception
  +    public void doBuild(RunData data) throws Exception
       {
           // Execute the Top Navigation portion for this Layout.
           ConcreteElement topNav =
               NavigationLoader.getInstance().eval(data, "DefaultTopNavigation");
   
  -        if ( topNav != null)
  +        if (topNav != null)
           {
  -            data.getPage().getBody().addElement( topNav );
  +            data.getPage().getBody().addElement(topNav);
           }
   
  -        // If an Action has defined a message, attempt to display it
  -        // here.
  -        if ( data.getMessage() != null )
  +        // If an Action has defined a message, attempt to display it here.
  +        if (data.getMessage() != null)
           {
               data.getPage().getBody().addElement(new P())
                   .addElement(new Font().setColor(HtmlColor.red)
  @@ -111,7 +111,7 @@
   
           if (screen != null)
           {
  -            data.getPage().getBody().addElement( screen );
  +            data.getPage().getBody().addElement(screen);
           }
   
           // The screen should have attempted to set a Title for itself,
  @@ -123,12 +123,12 @@
           data.getPage().getBody().setBgColor(HtmlColor.white);
   
           // Execute the Bottom Navigation portion for this Layout.
  -        ConcreteElement bottomNav =
  -        NavigationLoader.getInstance().eval ( data, "DefaultBottomNavigation" );
  +        ConcreteElement bottomNav = NavigationLoader.getInstance().eval(data,
  +            "DefaultBottomNavigation");
   
  -        if ( bottomNav != null)
  +        if (bottomNav != null)
           {
  -            data.getPage().getBody().addElement( bottomNav );
  +            data.getPage().getBody().addElement(bottomNav);
           }
       }
   }
  
  
  
  1.2       +5 -7      jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts/JspLayout.java
  
  Index: JspLayout.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts/JspLayout.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JspLayout.java	16 Aug 2001 05:08:34 -0000	1.1
  +++ JspLayout.java	11 Feb 2003 21:10:44 -0000	1.2
  @@ -74,25 +74,23 @@
       /**
        * Method called by LayoutLoader.
        *
  -     * @param RunData
  -     * @return processed template in a String
  +     * @param data RunData
  +     * @throws Exception generic exception
        */
       public void doBuild(RunData data) throws Exception
       {
           data.getResponse().setContentType("text/html");
           data.declareDirectResponse();
           // variable to reference the screen in the layout template
  -        data.getRequest()
  -            .setAttribute("screen_placeholder",
  +        data.getRequest().setAttribute("screen_placeholder",
                   new JspScreenPlaceholder(data));
           // variable to reference the navigations in the layout template
  -        data.getRequest()
  -            .setAttribute("navigation", new JspNavigation(data));
  +        data.getRequest().setAttribute("navigation", new JspNavigation(data));
   
           // Grab the layout template set in the TemplatePage.
           String templateName = data.getTemplateInfo().getLayoutTemplate();
           // Finally, generate the layout template and output to the response
  -        JspService jsp = (JspService)TurbineServices.getInstance()
  +        JspService jsp = (JspService) TurbineServices.getInstance()
               .getService(JspService.SERVICE_NAME);
           jsp.handleRequest(data, "/layouts" + templateName, true);
       }
  
  
  
  1.2       +18 -20    jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java
  
  Index: VelocityDirectLayout.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- VelocityDirectLayout.java	19 Aug 2001 17:59:18 -0000	1.1
  +++ VelocityDirectLayout.java	11 Feb 2003 21:10:44 -0000	1.2
  @@ -66,45 +66,43 @@
   
   /**
    * This Layout module allows Velocity templates
  - * to be used as layouts. It will stream directly the output of 
  + * to be used as layouts. It will stream directly the output of
    * the layout, naviagtions and templates to the output writer.
    *
    * @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
    * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
  - * @author Dave Bryson<a href="mailto:mbryson@mont.mindspring.com">mbryson@mont.mindspring.com</a>
  + * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
    */
   public class VelocityDirectLayout extends Layout
   {
       /**
        * Method called by LayoutLoader.
        *
  -     * @param RunData
  -     * @return processed template in a String
  +     * @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 WebMacro */
  -        Context context = TurbineVelocity.getContext( data );
  +        // Get the context needed by Velocity
  +        Context context = TurbineVelocity.getContext(data);
   
  -        /* variable for the screen in the layout template */
  -        context.put("screen_placeholder", new TemplateScreen( data ));
  +        // variable for the screen in the layout template
  +        context.put("screen_placeholder", new TemplateScreen(data));
   
  -        /* variable to reference the navigation screen in the layout template */
  -        context.put("navigation", new TemplateNavigation( data ));
  +        // variable to reference the navigation screen in the layout template
  +        context.put("navigation", new TemplateNavigation(data));
   
  -        /* Grab the layout template set in the WebMacroSitePage.  
  -         * If null, then use the default layout template 
  -         * (done by the TemplateInfo object )
  -         */
  +        // Grab the layout template set in the VelocityPage.
  +        // If null, then use the default layout template
  +        // (done by the TemplateInfo object )
           String templateName = data.getTemplateInfo().getLayoutTemplate();
   
  -        /* Set the locale and content type */
  +        // Set the locale and content type
           data.getResponse().setLocale(data.getLocale());
           data.getResponse().setContentType(data.getContentType());
   
  -        /* Finally, generate the layout template and send it to the browser */
  -        TurbineVelocity
  -            .handleRequest(context, "layouts" + templateName, data.getOut());
  +        // Finally, generate the layout template and send it to the browser
  +        TurbineVelocity.handleRequest(context,
  +            "layouts" + templateName, data.getOut());
       }
  -    
   }
  
  
  
  1.4       +21 -27    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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- VelocityECSLayout.java	14 Jan 2003 00:04:08 -0000	1.3
  +++ VelocityECSLayout.java	11 Feb 2003 21:10:44 -0000	1.4
  @@ -66,7 +66,6 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  -
   // Velocity Stuff
   import org.apache.velocity.context.Context;
   
  @@ -83,11 +82,16 @@
    */
   public class VelocityECSLayout extends Layout
   {
  +    /** the log */
       private static Log log = LogFactory.getLog(VelocityECSLayout.class);
   
  +    /**
  +     * default constructor
  +     */
       public VelocityECSLayout()
       {
  -        log.warn("The VelocityECSLayout is deprecated.  Please switch to VelocityOnlyLayout.");
  +        log.warn("The VelocityECSLayout is deprecated. "
  +           + "Please switch to VelocityOnlyLayout.");
       }
   
       /**
  @@ -97,18 +101,16 @@
        * @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 );
  +        // Get the context needed by Velocity.
  +        Context context = TurbineVelocity.getContext(data);
   
  -        /* Screen results. */
  +        // Screen results.
           String returnValue = "";
   
  -        /*
  -         * First, generate the screen and put it in the context so we
  -         * can grab it the layout template.
  -         */
  +        // 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());
   
  @@ -117,26 +119,18 @@
               returnValue = results.toString();
           }
   
  -        /* Variable for the screen in the layout template. */
  +        // Variable for the screen in the layout template.
           context.put("screen_placeholder", returnValue);
   
  -        /*
  -         * Variable to reference the navigation screen in the layout
  -         * template.
  -         */
  -        context.put("navigation", new TemplateNavigation( data ));
  -
  -        /*
  -         * Grab the layout template set in the TemplatePage.
  -         */
  +        // Variable to reference the navigation screen in the layout template.
  +        context.put("navigation", new TemplateNavigation(data));
  +
  +        // Grab the layout template set in the TemplatePage.
           String templateName = data.getTemplateInfo().getLayoutTemplate();
   
  -        /*
  -         * Finally, generate the layout template and add it to the
  -         * body of the Document in the RunData.
  -         */
  -        data.getPage().getBody().addElement(
  -            TurbineVelocity.handleRequest(
  +        // Finally, generate the layout template and add it to the body of the
  +        // Document in the RunData.
  +        data.getPage().getBody().addElement(TurbineVelocity.handleRequest(
                   context, "layouts" + templateName));
       }
   }
  
  
  
  1.3       +19 -19    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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- VelocityOnlyLayout.java	13 Jan 2003 23:58:34 -0000	1.2
  +++ VelocityOnlyLayout.java	11 Feb 2003 21:10:44 -0000	1.3
  @@ -74,48 +74,48 @@
    * to subclass this Layout.
    *
    * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
  - * @author Dave Bryson<a href="mailto:mbryson@mont.mindspring.com">mbryson@mont.mindspring.com</a>
  + * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
    */
   public class VelocityOnlyLayout extends Layout
   {
       /**
        * Method called by LayoutLoader.
        *
  -     * @param data
  +     * @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 WebMacro */
  -        Context context = TurbineVelocity.getContext( data );
  -        /* Screen results */
  +        // 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.
  -         */
  +        // 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();
  +        }
   
  -        /* variable for the screen in the layout template */
  +        // variable for the screen in the layout template
           context.put("screen_placeholder", returnValue);
   
  -        /* variable to reference the navigation screen in the layout template */
  -        context.put("navigation", new TemplateNavigation( data ));
  +        // variable to reference the navigation screen in the layout template
  +        context.put("navigation", new TemplateNavigation(data));
   
  -        /* Grab the layout template set in the WebMacroSitePage.
  -         * If null, then use the default layout template
  -         * (done by the TemplateInfo object )
  -         */
  +        // Grab the layout template set in the VelocityPage.
  +        // If null, then use the default layout template
  +        // (done by the TemplateInfo object)
           String templateName = data.getTemplateInfo().getLayoutTemplate();
   
  -        /* Set the locale and content type */
  +        // Set the locale and content type
           data.getResponse().setLocale(data.getLocale());
           data.getResponse().setContentType(data.getContentType());
   
  -        /* Finally, generate the layout template and send it to the browser */
  +        // Finally, generate the layout template and send it to the browser
           data.getOut().print(TurbineVelocity
               .handleRequest(context, "layouts" + templateName));
       }
  
  
  
  1.2       +59 -81    jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java
  
  Index: VelocityXslLayout.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- VelocityXslLayout.java	16 Aug 2001 05:08:34 -0000	1.1
  +++ VelocityXslLayout.java	11 Feb 2003 21:10:44 -0000	1.2
  @@ -1,7 +1,10 @@
   package org.apache.turbine.modules.layouts;
   
  -/*
  - * Copyright (c) 1997-1999 The Java Apache Project.  All rights reserved.
  +/* ====================================================================
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
  @@ -15,63 +18,53 @@
    *    the documentation and/or other materials provided with the
    *    distribution.
    *
  - * 3. All advertising materials mentioning features or use of this
  - *    software must display the following acknowledgment:
  - *    "This product includes software developed by the Java Apache
  - *    Project for use in the Apache JServ servlet engine project
  - *    <http://java.apache.org/>."
  - *
  - * 4. The names "Apache JServ", "Apache JServ Servlet Engine", "Turbine",
  - *    "Apache Turbine", "Turbine Project", "Apache Turbine Project" and
  - *    "Java Apache Project" must not be used to endorse or promote products
  - *    derived from this software without prior written permission.
  - *
  - * 5. Products derived from this software may not be called "Apache JServ"
  - *    nor may "Apache" nor "Apache JServ" appear in their names without
  - *    prior written permission of the Java Apache Project.
  - *
  - * 6. Redistributions of any form whatsoever must retain the following
  - *    acknowledgment:
  - *    "This product includes software developed by the Java Apache
  - *    Project for use in the Apache JServ servlet engine project
  - *    <http://java.apache.org/>."
  - *
  - * THIS SOFTWARE IS PROVIDED BY THE JAVA APACHE PROJECT "AS IS" AND ANY
  - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  - * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE JAVA APACHE PROJECT OR
  + * 3. The end-user documentation included with the redistribution,
  + *    if any, must include the following acknowledgment:
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself,
  + *    if and wherever such third-party acknowledgments normally appear.
  + *
  + * 4. The names "Apache" and "Apache Software Foundation" and
  + *    "Apache Turbine" must not be used to endorse or promote products
  + *    derived from this software without prior written permission. For
  + *    written permission, please contact apache@apache.org.
  + *
  + * 5. Products derived from this software may not be called "Apache",
  + *    "Apache Turbine", nor may "Apache" appear in their name, without
  + *    prior written permission of the Apache Software Foundation.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  - * OF THE POSSIBILITY OF SUCH DAMAGE.
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
    *
    * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Java Apache Group. For more information
  - * on the Java Apache Project and the Apache JServ Servlet Engine project,
  - * please see <http://java.apache.org/>.
  - *
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
    */
   
  -// JDK Imports
   import java.io.StringReader;
  -
  -// Turbine/Village/ECS Imports
   import org.apache.ecs.ConcreteElement;
   import org.apache.turbine.modules.Layout;
   import org.apache.turbine.modules.ScreenLoader;
  -import org.apache.turbine.util.RunData;
  -import org.apache.turbine.util.template.TemplateNavigation;
   import org.apache.turbine.services.velocity.TurbineVelocity;
   import org.apache.turbine.services.xslt.TurbineXSLT;
  -
  -// Velocity Stuff
  +import org.apache.turbine.util.RunData;
  +import org.apache.turbine.util.template.TemplateNavigation;
   import org.apache.velocity.context.Context;
   
  -/*
  +/**
    * This Layout module allows Velocity XML templates to be used as layouts.
    * <br><br>
    * Once the (XML) screen and navigation templates have been inserted into
  @@ -87,64 +80,49 @@
    * to subclass this Layout.
    *
    * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
  + * @version $Id$
    */
   public class VelocityXslLayout extends Layout
   {
       /**
        * Method called by LayoutLoader.
        *
  -     * @param RunData
  -     * @return processed template in a String
  +     * @param data RunData
  +     * @throws Exception generic exception
        */
  -    public void doBuild( RunData data ) throws Exception
  +    public void doBuild(RunData data) throws Exception
       {
  -        long start = System.currentTimeMillis();
  -
  -        data.getResponse().setContentType ("text/html");
  -        Context context = TurbineVelocity.getContext( data );
  +        data.getResponse().setContentType("text/html");
  +        Context context = TurbineVelocity.getContext(data);
           String returnValue = "";
   
  -        /*
  -         * First, generate the screen and put it in the context so
  -         * we can grab it the layout template.
  -         */
  -
  +        // 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();
  -        }            
  +        }
   
  -        /* 
  -         * variable for the screen in the layout template 
  -         */
  +        // variable for the screen in the layout template
           context.put("screen_placeholder", returnValue);
   
  -        /* 
  -         * variable to reference the navigation screen in 
  -         * the layout template 
  -         */
  -        context.put("navigation", new TemplateNavigation( data ));
  -
  -        /* 
  -         * Grab the layout template set in the WebMacroSitePage.  
  -         * If null, then use the default layout template 
  -         * (done by the TemplateInfo object)  
  -         */
  +        // variable to reference the navigation screen in the layout template
  +        context.put("navigation", new TemplateNavigation(data));
  +
  +        // Grab the layout template set in the WebMacroSitePage.
  +        // If null, then use the default layout template
  +        // (done by the TemplateInfo object)
           String templateName = data.getTemplateInfo().getLayoutTemplate();
   
  -        /* 
  -         * Now, generate the layout template. 
  -         */
  +        // Now, generate the layout template.
           String temp = TurbineVelocity.handleRequest(context,
               "layouts" + templateName);
   
  -        /* 
  -         * Finally we do a transformation and send the result
  -         * back to the browser 
  -         */
  +        // Finally we do a transformation and send the result
  +        // back to the browser
           TurbineXSLT.transform (data.getTemplateInfo().getScreenTemplate(),
               new StringReader(temp), data.getOut());
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org