/*
 * Scone - The Web Enhancement Framework
 * Copyright (C) 2009 Harald Weinreich, Volkert Buchmann, Frank Wollenweber, Torsten Haß
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 package scone.util.tokenstream;


import adc.parser.HtmlTag;


/**
 * an HTML style element.
 *
 * @author Harald Weinreich
 * @author Volkert Buchmann 
 */

public class HtmlStyleToken extends HtmlTagToken {
    public static final String COPYRIGHT = "(C) Harald Weinreich & Volkert Buchmann";
   	
    /**
     * the style definitions
     */
    protected String style;
	
    /**
     * creates a <code>HtmlStyleToken</code>
     *
     * @param tag the tag
     * @param style the style definitions
     * @param whiteSpaces preceding whitespaces
     */
    public HtmlStyleToken(HtmlTag tag, String style, StringBuffer whiteSpaces) {
        this.tag = tag;
        this.style = style;
        this.whiteSpaces = new String(whiteSpaces);
    }

    /**
     * returns a clone of this Token
     * @return the clone
     */
    public Token getClone() {
        try {
            HtmlTag nTag = new HtmlTag(tag);

            return new HtmlStyleToken(nTag, style, new StringBuffer(whiteSpaces));		
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println(tag.toString());
            System.out.println(tag.getTagString());
        }
        return null;   	
    }
	
    /**
     * returns the style definitions
     * @return the style definitions
     */
    public String getStyle() {
        return style;
    }

    /**
     * returns a string representation of the style element, preceded by the whitespaces
     * @return the style element as a String
     */
    public String toString() {
        return super.toString() + style + "</style>";
    }
	
}
