You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jv...@apache.org on 2001/03/29 00:18:02 UTC

cvs commit: jakarta-turbine/src/java/org/apache/turbine/util/template TemplateInfo.java

jvanzyl     01/03/28 14:18:02

  Modified:    src/java/org/apache/turbine/util/template TemplateInfo.java
  Log:
  - added functionity to setScreenTemplate() that updates the layout
    template as well so that the client programmer doesn't have to
    perform this task manually.
  
    so, for example, when you perform the following:
  
    data.setScreenTemplate("Login.vm")
  
    Inside the TemplateInfo class we now try to find the accompanying
    layout template. This came about because the LoginUser action
    changes the template presented to the user depending on whether
    they are currently logged in or not. the layout used pre-login
    is probably always going to be different then for post-login.
    Anyway the LoginUser class changes the screen template so
    i just wanted to layout template to be changed automatically
    to make things easier.
  
  Revision  Changes    Path
  1.5       +21 -2     jakarta-turbine/src/java/org/apache/turbine/util/template/TemplateInfo.java
  
  Index: TemplateInfo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/util/template/TemplateInfo.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TemplateInfo.java	2001/03/06 06:14:45	1.4
  +++ TemplateInfo.java	2001/03/28 22:18:02	1.5
  @@ -58,7 +58,8 @@
   import java.util.Hashtable;
   
   // Turbine classes
  -import org.apache.turbine.util.*;
  +import org.apache.turbine.util.RunData;
  +import org.apache.turbine.services.template.TurbineTemplate;
   
   /**
    * This is a wrapper for Template specific information.  It's part of
  @@ -66,7 +67,8 @@
    * the job directly from the data.getParameters().
    *
    * @author <a href="mailto:mbryson@mindspring.com">Dave Bryson</a>
  - * @version $Id: TemplateInfo.java,v 1.4 2001/03/06 06:14:45 chrise Exp $
  + * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
  + * @version $Id: TemplateInfo.java,v 1.5 2001/03/28 22:18:02 jvanzyl Exp $
    */
   public class TemplateInfo
   {
  @@ -144,6 +146,23 @@
       public void setScreenTemplate(String v)
       {
          data.getParameters().setString("template",v);
  +       
  +       /*
  +        * We have changed the screen template so
  +        * we should now update the layout template
  +        * as well. We will use the template service
  +        * to help us out.
  +        */
  +        try
  +        {
  +            setLayoutTemplate(TurbineTemplate.getLayoutTemplateName(v));
  +        }                    
  +        catch (Exception e)
  +        {
  +            /*
  +             * do nothing.
  +             */
  +        }
       }
   
       /**
  
  
  

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