java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/PlotTag.java
author František Kučera <franta-hg@frantovo.cz>
Sat, 28 Feb 2009 21:31:02 +0100
changeset 1 639991d0808a
permissions -rw-r--r--
Rozbalená knihovna verze 1.0
     1 /* ================================================================
     2  * Cewolf : Chart enabling Web Objects Framework
     3  * ================================================================
     4  *
     5  * Project Info:  http://cewolf.sourceforge.net
     6  * Project Lead:  Guido Laures (guido@laures.de);
     7  *
     8  * (C) Copyright 2002, by Guido Laures, and contributers
     9  *
    10  * This library is free software; you can redistribute it and/or modify it under the terms
    11  * of the GNU Lesser General Public License as published by the Free Software Foundation;
    12  * either version 2.1 of
    13  * the License, or (at your option) any later version.
    14  *
    15  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
    16  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    17  * See the GNU Lesser General Public License for more details.
    18  *
    19  * You should have received a copy of the GNU Lesser General Public License along with this
    20  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
    21  * Boston, MA 02111-1307, USA.
    22  */
    23 
    24 package de.laures.cewolf.taglib.tags;
    25 
    26 import java.util.Map;
    27 
    28 import javax.servlet.jsp.JspException;
    29 
    30 import de.laures.cewolf.DatasetProducer;
    31 import de.laures.cewolf.taglib.DataAware;
    32 import de.laures.cewolf.taglib.PlotContainer;
    33 import de.laures.cewolf.taglib.PlotDefinition;
    34 import de.laures.cewolf.taglib.TaglibConstants;
    35 
    36 /** 
    37  * Tag &lt;sub-plot&gt; which defines a plot to overlay 
    38  * @author Chris McCann
    39  */
    40 public class PlotTag extends CewolfTag implements TaglibConstants, DataAware {
    41 
    42     private PlotDefinition plotDefinition = new PlotDefinition();
    43 
    44     public int doStartTag() throws JspException {
    45         return EVAL_BODY_INCLUDE;
    46     }
    47     
    48     public int doEndTag() throws JspException {
    49         PlotContainer pc = (PlotContainer)findAncestorWithClass(this, PlotContainer.class);
    50         if (pc == null) {
    51             throw new JspException("&lt;plot&gt; must be nested in a PlotContainer tag like &lt;overlaid-chart&gt;");
    52         }
    53         pc.addPlot(plotDefinition);
    54         return doAfterEndTag(EVAL_PAGE);
    55     }
    56 
    57     public void reset() {
    58         plotDefinition = new PlotDefinition();
    59     }
    60 
    61     /**
    62      * Setter for property type.
    63      * @param type New value of property type.
    64      */
    65     public void setType(String type) {
    66         plotDefinition.setType(type);
    67     }
    68 
    69     public void setDataProductionConfig(DatasetProducer dsp, Map params, boolean useCache) {
    70         plotDefinition.setDataProductionConfig(dsp, params, useCache);
    71     }
    72     
    73     /**
    74      * Setter for property xAxisLabel. [tb]
    75      * @param xAxisLabel New value of property xAxisLabel.
    76      */
    77     public void setXaxislabel(String xAxisLabel) {
    78         plotDefinition.setXaxislabel(xAxisLabel);
    79     }
    80 
    81     /**
    82      * Setter for property yAxisLabel. [tb]
    83      * @param yAxisLabel New value of property xAxisLabel.
    84      */
    85     public void setYaxislabel(String yAxisLabel) {
    86         plotDefinition.setYaxislabel(yAxisLabel);
    87     }
    88 
    89 
    90 }