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 2002/11/20 19:43:23 UTC

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

mpoeschl    2002/11/20 10:43:23

  Modified:    src/java/org/apache/turbine/util/template
                        TemplatePageAttributes.java
  Log:
  oops: missed this one to fix TTWS1
  
  Revision  Changes    Path
  1.4       +43 -1     jakarta-turbine-2/src/java/org/apache/turbine/util/template/TemplatePageAttributes.java
  
  Index: TemplatePageAttributes.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/util/template/TemplatePageAttributes.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TemplatePageAttributes.java	11 Jul 2002 16:53:19 -0000	1.3
  +++ TemplatePageAttributes.java	20 Nov 2002 18:43:23 -0000	1.4
  @@ -58,6 +58,8 @@
   import org.apache.ecs.html.Link;
   import org.apache.ecs.html.Meta;
   import org.apache.ecs.html.Title;
  +import org.apache.ecs.html.Style;
  +import org.apache.ecs.html.Script;
   import org.apache.turbine.services.pull.ApplicationTool;
   import org.apache.turbine.util.RunData;
   
  @@ -176,6 +178,46 @@
       {
           data.getPage().getHead().addElement(new Link()
                   .setRel("stylesheet").setType("text/css").setHref(url));
  +        return this;
  +    }
  +
  +    /**
  +     * Adds a LINK to a CSS stylesheet to the HEAD of the page, allowing the
  +     * media type to be specified.
  +     *
  +     * @param url The value for the <code>href</code> attribute.
  +     * @param media The value for the <code>media</code> attribute.
  +     * @return a <code>TemplatePageAttributes</code> (self).
  +     */
  +    public TemplatePageAttributes setStyleSheet(String url, String media)
  +    {
  +        data.getPage().getHead().addElement(new Link().setRel("stylesheet")
  +                .setType("text/css").setMedia(media).setHref(url));
  +        return this;
  +    }
  +
  +    /**
  +     * Adds a STYLE element to the HEAD of the page with the provided content.
  +     *
  +     * @param styleText The contents of the <code>style</code> tag.
  +     * @return a <code>TemplatePageAttributes</code> (self).
  +     */
  +    public TemplatePageAttributes setStyle(String styleText)
  +    {
  +        data.getPage().getHead().addElement(new Style("text/css", styleText));
  +        return this;
  +    }
  +
  +    /**
  +     * Adds a LINK to a javascript file to the HEAD of the page.
  +     *
  +     * @param url A String.
  +     * @return A TemplatePageAttributesEx (self).
  +     */
  +    public TemplatePageAttributes setScript(String url)
  +    {
  +        data.getPage().getHead().addElement(new Script().setSrc(url)
  +                .setType("text/javascript").setLanguage("JavaScript"));
           return this;
       }
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>