View Javadoc

    1   // ========================================================================
    2   // $Id: StyleLink.java,v 1.3 2004/05/09 20:31:28 gregwilkins Exp $
    3   // Copyright 1999-2004 Mort Bay Consulting Pty. Ltd.
    4   // ------------------------------------------------------------------------
    5   // Licensed under the Apache License, Version 2.0 (the "License");
    6   // you may not use this file except in compliance with the License.
    7   // You may obtain a copy of the License at
    8   // http://www.apache.org/licenses/LICENSE-2.0
    9   // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  // ========================================================================
    15
    16  package org.mortbay.html;
    17
    18
    19  /* ------------------------------------------------------------ */
    20  /** CSS Style LINK.
    21   *
    22   * @version $Id: StyleLink.java,v 1.3 2004/05/09 20:31:28 gregwilkins Exp $
    23   * @author Greg Wilkins (gregw)
    24   */
    25  public class StyleLink extends Tag
    26  {
    27      public final static String
    28          REL="rel",
    29          HREF="href",
    30          TYPE=Style.TYPE,
    31          MEDIA=Style.MEDIA;
    32
    33      /* ------------------------------------------------------------ */
    34      /** Constructor.
    35       * @param href The URL of the style sheet
    36       */
    37      public StyleLink(String href)
    38      {
    39          super("link");
    40          attribute(REL,Style.StyleSheet);
    41          attribute(HREF,href);
    42          attribute(TYPE,Style.text_css);
    43      }
    44
    45      /* ------------------------------------------------------------ */
    46      /** Full Constructor.
    47       * @param rel Style Relationship, default StyleSheet if null.
    48       * @param href The URL of the style sheet
    49       * @param type The type, default text/css if null
    50       * @param media The media, not specified if null
    51       */
    52      public StyleLink(String rel, String href, String type, String media)
    53      {
    54          super("link");
    55          attribute(REL,rel==null?Style.StyleSheet:rel);
    56          attribute(HREF,href);
    57          attribute(TYPE,type==null?Style.text_css:type);
    58          if (media!=null)
    59              attribute(MEDIA,media);
    60      }
    61
    62  };
    63
    64
    65
    66
    67
    68
    69
    70