java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/PlotTag.java
changeset 1 639991d0808a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/PlotTag.java	Sat Feb 28 21:31:02 2009 +0100
     1.3 @@ -0,0 +1,90 @@
     1.4 +/* ================================================================
     1.5 + * Cewolf : Chart enabling Web Objects Framework
     1.6 + * ================================================================
     1.7 + *
     1.8 + * Project Info:  http://cewolf.sourceforge.net
     1.9 + * Project Lead:  Guido Laures (guido@laures.de);
    1.10 + *
    1.11 + * (C) Copyright 2002, by Guido Laures, and contributers
    1.12 + *
    1.13 + * This library is free software; you can redistribute it and/or modify it under the terms
    1.14 + * of the GNU Lesser General Public License as published by the Free Software Foundation;
    1.15 + * either version 2.1 of
    1.16 + * the License, or (at your option) any later version.
    1.17 + *
    1.18 + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
    1.19 + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    1.20 + * See the GNU Lesser General Public License for more details.
    1.21 + *
    1.22 + * You should have received a copy of the GNU Lesser General Public License along with this
    1.23 + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
    1.24 + * Boston, MA 02111-1307, USA.
    1.25 + */
    1.26 +
    1.27 +package de.laures.cewolf.taglib.tags;
    1.28 +
    1.29 +import java.util.Map;
    1.30 +
    1.31 +import javax.servlet.jsp.JspException;
    1.32 +
    1.33 +import de.laures.cewolf.DatasetProducer;
    1.34 +import de.laures.cewolf.taglib.DataAware;
    1.35 +import de.laures.cewolf.taglib.PlotContainer;
    1.36 +import de.laures.cewolf.taglib.PlotDefinition;
    1.37 +import de.laures.cewolf.taglib.TaglibConstants;
    1.38 +
    1.39 +/** 
    1.40 + * Tag <sub-plot> which defines a plot to overlay 
    1.41 + * @author Chris McCann
    1.42 + */
    1.43 +public class PlotTag extends CewolfTag implements TaglibConstants, DataAware {
    1.44 +
    1.45 +    private PlotDefinition plotDefinition = new PlotDefinition();
    1.46 +
    1.47 +    public int doStartTag() throws JspException {
    1.48 +        return EVAL_BODY_INCLUDE;
    1.49 +    }
    1.50 +    
    1.51 +    public int doEndTag() throws JspException {
    1.52 +        PlotContainer pc = (PlotContainer)findAncestorWithClass(this, PlotContainer.class);
    1.53 +        if (pc == null) {
    1.54 +            throw new JspException("<plot> must be nested in a PlotContainer tag like <overlaid-chart>");
    1.55 +        }
    1.56 +        pc.addPlot(plotDefinition);
    1.57 +        return doAfterEndTag(EVAL_PAGE);
    1.58 +    }
    1.59 +
    1.60 +    public void reset() {
    1.61 +        plotDefinition = new PlotDefinition();
    1.62 +    }
    1.63 +
    1.64 +    /**
    1.65 +     * Setter for property type.
    1.66 +     * @param type New value of property type.
    1.67 +     */
    1.68 +    public void setType(String type) {
    1.69 +        plotDefinition.setType(type);
    1.70 +    }
    1.71 +
    1.72 +    public void setDataProductionConfig(DatasetProducer dsp, Map params, boolean useCache) {
    1.73 +        plotDefinition.setDataProductionConfig(dsp, params, useCache);
    1.74 +    }
    1.75 +    
    1.76 +    /**
    1.77 +     * Setter for property xAxisLabel. [tb]
    1.78 +     * @param xAxisLabel New value of property xAxisLabel.
    1.79 +     */
    1.80 +    public void setXaxislabel(String xAxisLabel) {
    1.81 +        plotDefinition.setXaxislabel(xAxisLabel);
    1.82 +    }
    1.83 +
    1.84 +    /**
    1.85 +     * Setter for property yAxisLabel. [tb]
    1.86 +     * @param yAxisLabel New value of property xAxisLabel.
    1.87 +     */
    1.88 +    public void setYaxislabel(String yAxisLabel) {
    1.89 +        plotDefinition.setYaxislabel(yAxisLabel);
    1.90 +    }
    1.91 +
    1.92 +
    1.93 +}