/*
 * Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 */
package com.arsdigita.bebop;

import com.arsdigita.xml.Element;


/**
 * A solid, horizontal line.
 *
 * @author Michael Pih 
 * @version $Revision: #8 $ $Date: 2004/08/16 $
 */
// FIXME: Could this be done solely in XSL ? Or do some of these attributes
// come from the DB/user preferences ? It would be cleaner if we could move
// this completely to XSL.
public class HorizontalLine extends SimpleComponent {

    public static final String versionId = "$Id: HorizontalLine.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";

    private String m_width;
    private String m_height;
    private String m_bgcolor;



    public HorizontalLine() {
        super();
    }

    public String getWidth() {
        return m_width;
    }

    // TODO: should be renamed to setHeight() to make the correspondance
    // with XML more obvious
    public String getThickness() {
        return m_height;
    }

    public String getColor() {
        return m_bgcolor;
    }

    public void setWidth(String w) {
        m_width = w;
    }

    public void setThickness(String t) {
        m_height = t;
    }

    public void setColor(String c) {
        m_bgcolor = c;
    }

    // TODO: document the XML generated by this component
    public void generateXML(PageState state, Element parent) {
        if ( !isVisible(state) ) {
            return;
        }

        Element line = parent.newChildElement("bebop:solidLine", BEBOP_XML_NS);
        line.addAttribute("width", m_width);
        line.addAttribute("height", m_height);
        line.addAttribute("bgcolor", m_bgcolor);
        exportAttributes(line);
    }


}
