nicolaken 02/05/16 10:04:03 Modified: src/scratchpad/src/org/apache/cocoon/transformation/constrained AbstractConstrainedTransformer.java ElementEventAdapter.java XmlTreeConstraint.java src/scratchpad/src/org/apache/cocoon/transformation Chart2SvgTransformer.java src/scratchpad/webapp/mount/charts sitemap.xmap Added: src/scratchpad/webapp/mount/charts/content/static/bar bar1.xml bar10.xml bar11.xml bar12.xml bar2.xml bar3.xml bar4.xml bar5.xml bar6.xml bar7.xml bar8.xml bar9.xml src/scratchpad/src/org/apache/cocoon/transformation WingsTransformer.java src/scratchpad/lib krysalis-wings-0.2.0-dev.jar src/scratchpad/webapp/mount/charts/content/static/line line1.xml line2.xml line3.xml line4.xml line5.xml line6.xml src/scratchpad/webapp/mount/charts/content/static/multi multi1.xml src/scratchpad/webapp/mount/charts/content/static/pie pie1.xml pie2.xml pie3.xml pie4.xml pie5.xml pie6.xml pie7.xml Log: Added wings 0.2 lib based on new codebase and added working examples for it. This is an innitial commit of the new system; the new Wings Transformer was made by Tom Klaasen <[EMAIL PROTECTED]>, Revision Changes Path 1.3 +55 -7 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/constrained/AbstractConstrainedTransformer.java Index: AbstractConstrainedTransformer.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/constrained/AbstractConstrainedTransformer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- AbstractConstrainedTransformer.java 14 May 2002 20:34:22 -0000 1.2 +++ AbstractConstrainedTransformer.java 16 May 2002 17:04:02 -0000 1.3 @@ -44,6 +44,7 @@ import java.util.Map; import java.util.Properties; import java.util.ArrayList; +import java.util.List; import java.util.HashMap; import java.util.ListIterator; import java.util.TooManyListenersException; @@ -70,32 +71,79 @@ * code is from the SQLTransformer of Donald Ball. * *@author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> + *@author <a href="mailto:[EMAIL PROTECTED]">Tom Klaasen</a> *@created 14 mei 2002 */ public abstract class AbstractConstrainedTransformer extends AbstractTransformer { + /** The URI of the namespace this class processes */ private String my_uri; + /** The prefix that is used in the XML document to indicate the namespace */ private String my_prefix = "unknown"; + /** + * The 'name' of the namespace this class processes. FIXME: Seems to be the + * last path element of the URI -- is that correct? + */ private String my_name; - private ArrayList myUriOpenElements = new ArrayList(); - private ArrayList globalOpenElements = new ArrayList(); - private ArrayList globalOpenElementsAttributes = new ArrayList(); + /** A List of open elements in the namespace of this class. */ + private List myUriOpenElements = new ArrayList(); + /** A List of all open elements in the XML file that is processed. */ + private List globalOpenElements = new ArrayList(); + /** + * A List of the attributes of the open elements in the XML file that is + * processed. + */ + private List globalOpenElementsAttributes = new ArrayList(); + /** The raw representation of the element that was last opened in the XML file. */ private String lastOpenElementRaw = ""; - private ArrayList registeredListeners = new ArrayList(); - private ArrayList registeredListenerConstraints = new ArrayList(); - private StringBuffer current_value = - new StringBuffer(); + /** The List with the listeners that are interested in the events of this class. */ + private List registeredListeners = new ArrayList(); + /** + * The constraints of the registered listeners. FIXME: Find out how the + * relation with the previous List is maintained. + */ + private List registeredListenerConstraints = new ArrayList(); + /** FIXME: What's this? */ + private StringBuffer current_value = new StringBuffer(); + /** + * The consumer of the SAX events generated by this + * AbstractConstrainedTransformer. + */ public XMLConsumer xml_consumer; + /** + * The lexical handler of the SAX events generated by this + * AbstractConstrainedTransformer. FIXME: Isn't this always the same as the + * xml_consumer?? + */ public LexicalHandler lexical_handler; + /** + * Initialize: set up the listeners etc. + * + *@param parameters The parameters that can be used by this method. + */ public abstract void init(Parameters parameters); + + /** + * Retrieve the URI of the namespace this AbstractConstrainedTransformer has + * to process. + * + *@return The URI of the namespace this AbstractConstrainedTransformer has + * to process. + */ public abstract String getUri(); + /** + * Retrieve the 'name' of the namespace this class processes. FIXME: Seems to + * be the last path element of the URI -- is that correct? + * + *@return The 'name' of the namespace this class processes. + */ public abstract String getName(); 1.2 +44 -54 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/constrained/ElementEventAdapter.java Index: ElementEventAdapter.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/constrained/ElementEventAdapter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ElementEventAdapter.java 8 Apr 2002 08:09:16 -0000 1.1 +++ ElementEventAdapter.java 16 May 2002 17:04:02 -0000 1.2 @@ -1,67 +1,57 @@ /* - - ============================================================================ - The Apache Software License, Version 1.1 - ============================================================================ - - Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. - - Redistribution and use in source and binary forms, with or without modifica- - tion, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. The end-user documentation included with the redistribution, if any, must - include the following acknowledgment: "This product includes software - developed by the Apache Software Foundation (http://www.apache.org/)." - Alternately, this acknowledgment may appear in the software itself, if - and wherever such third-party acknowledgments normally appear. - - 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be - used to endorse or promote products derived from this software without - prior written permission. For written permission, please contact - [EMAIL PROTECTED] - - 5. Products derived from this software may not be called "Apache", nor may - "Apache" appear in their name, without prior written permission of the - Apache Software Foundation. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - This software consists of voluntary contributions made by many individuals - on behalf of the Apache Software Foundation and was originally created by - Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache - Software Foundation, please see <http://www.apache.org/>. - -*/ - + * ============================================================================ + * The Apache Software License, Version 1.1 + * ============================================================================ + * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. + * Redistribution and use in source and binary forms, with or without modifica- + * tion, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The end-user documentation included with the redistribution, if any, must + * include the following acknowledgment: "This product includes software + * developed by the Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, if + * and wherever such third-party acknowledgments normally appear. + * 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be + * used to endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * [EMAIL PROTECTED] + * 5. Products derived from this software may not be called "Apache", nor may + * "Apache" appear in their name, without prior written permission of the + * Apache Software Foundation. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This software consists of voluntary contributions made by many individuals + * on behalf of the Apache Software Foundation and was originally created by + * Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache + * Software Foundation, please see <http://www.apache.org/>. + */ package org.apache.cocoon.transformation.constrained; import java.util.EventListener; import org.xml.sax.SAXException; /** - * - * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> + *@author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> + *@created 15 mei 2002 */ public abstract class ElementEventAdapter implements ElementEventListener { - public void containerElementEnded(ContainerElementEndEvent e) throws Exception{} + public void containerElementEnded(ContainerElementEndEvent e) throws Exception { } + - public void elementValueRecieved(ElementValueEvent e) throws Exception{} + public void elementValueRecieved(ElementValueEvent e) throws Exception { } } + 1.2 +189 -171 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/constrained/XmlTreeConstraint.java Index: XmlTreeConstraint.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/constrained/XmlTreeConstraint.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- XmlTreeConstraint.java 8 Apr 2002 08:09:16 -0000 1.1 +++ XmlTreeConstraint.java 16 May 2002 17:04:02 -0000 1.2 @@ -1,184 +1,202 @@ /* - - ============================================================================ - The Apache Software License, Version 1.1 - ============================================================================ - - Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. - - Redistribution and use in source and binary forms, with or without modifica- - tion, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. The end-user documentation included with the redistribution, if any, must - include the following acknowledgment: "This product includes software - developed by the Apache Software Foundation (http://www.apache.org/)." - Alternately, this acknowledgment may appear in the software itself, if - and wherever such third-party acknowledgments normally appear. - - 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be - used to endorse or promote products derived from this software without - prior written permission. For written permission, please contact - [EMAIL PROTECTED] - - 5. Products derived from this software may not be called "Apache", nor may - "Apache" appear in their name, without prior written permission of the - Apache Software Foundation. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - This software consists of voluntary contributions made by many individuals - on behalf of the Apache Software Foundation and was originally created by - Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache - Software Foundation, please see <http://www.apache.org/>. - -*/ - + * ============================================================================ + * The Apache Software License, Version 1.1 + * ============================================================================ + * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. + * Redistribution and use in source and binary forms, with or without modifica- + * tion, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The end-user documentation included with the redistribution, if any, must + * include the following acknowledgment: "This product includes software + * developed by the Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, if + * and wherever such third-party acknowledgments normally appear. + * 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be + * used to endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * [EMAIL PROTECTED] + * 5. Products derived from this software may not be called "Apache", nor may + * "Apache" appear in their name, without prior written permission of the + * Apache Software Foundation. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This software consists of voluntary contributions made by many individuals + * on behalf of the Apache Software Foundation and was originally created by + * Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache + * Software Foundation, please see <http://www.apache.org/>. + */ package org.apache.cocoon.transformation.constrained; - - import java.util.ArrayList; +import java.util.List; import java.util.Arrays; import java.util.ListIterator; - /** - * - * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> + *@author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> + *@created 15 mei 2002 */ public class XmlTreeConstraint { - private boolean debug=true; + private boolean debug = true; - private Boolean isMyUriRequired; - private ArrayList allowedMyUriStackEnd = null; - private ArrayList allowedGlobalStackEnd = null; - - public XmlTreeConstraint(ArrayList allowedMyUriStackEnd, - ArrayList allowedGlobalStackEnd, - Boolean isMyUriRequired) { - - this.allowedMyUriStackEnd = allowedMyUriStackEnd; - this.allowedGlobalStackEnd = allowedGlobalStackEnd; - this.isMyUriRequired = isMyUriRequired; - } - - public XmlTreeConstraint(ArrayList allowedMyUriStackEnd, - Boolean isMyUriRequired) { - this.allowedMyUriStackEnd = allowedMyUriStackEnd; - this.isMyUriRequired = isMyUriRequired; - } - - public XmlTreeConstraint(ArrayList allowedMyUriStackEnd) { - this.allowedMyUriStackEnd = allowedMyUriStackEnd; - } - - public XmlTreeConstraint(String[] allowedMyUriStackEnd, - String[] allowedGlobalStackEnd, - boolean isMyUriRequired) { - - this.allowedMyUriStackEnd = new ArrayList(Arrays.asList(allowedMyUriStackEnd)); - this.allowedGlobalStackEnd = new ArrayList(Arrays.asList(allowedGlobalStackEnd)); - this.isMyUriRequired = new Boolean(isMyUriRequired); - } - - public XmlTreeConstraint(String[] allowedMyUriStackEnd, - boolean isMyUriRequired) { - this.allowedMyUriStackEnd = new ArrayList(Arrays.asList(allowedMyUriStackEnd)); - this.isMyUriRequired = new Boolean(isMyUriRequired); - } - - public XmlTreeConstraint(String[] allowedMyUriStackEnd) { - this.allowedMyUriStackEnd = new ArrayList(Arrays.asList(allowedMyUriStackEnd)); - } - - - public boolean isAllowed(Boolean isMyUri, ArrayList myUriStack, - ArrayList globalStack) { - if(debug){ - System.out.println("isMyUri :"+isMyUri+"\nrequired uri "+isMyUriRequired); - System.out.println("myUristack: \n"+myUriStack); - System.out.println("allowedMyUriStackEnd: \n"+allowedMyUriStackEnd); - System.out.println("globalstack: \n"+globalStack); - System.out.println("allowedGlobalStackEnd: \n"+allowedGlobalStackEnd); - } - if (isMyUriRequired != null) { - if (isMyUri == null) { - return false; - } - - if (!isMyUriRequired.equals(isMyUri)) { - return false; - } - } - - if (allowedMyUriStackEnd != null) { - if (myUriStack == null) { - return false; - } - - if (!areEndsEqual(allowedMyUriStackEnd, myUriStack)) { - return false; - } - } - - if (allowedGlobalStackEnd != null) { - if (globalStack == null) { - return false; - } - - if (!areEndsEqual(allowedGlobalStackEnd, globalStack)) { - return false; - } - } - - return true; - } - - private boolean areEndsEqual(ArrayList l1, ArrayList l2) { - - if (l1.size() > l2.size()) { - if ((!(l1.size() == l2.size())) - && ((l1.size() < 1) || (l2.size() < 1))) { - return false; - } - - //make l1 smaller - ArrayList l3 = l1; - - l1 = l2; - l2 = l3; - } - - ListIterator iter1 = l1.listIterator(l1.size()); - ListIterator iter2 = l2.listIterator(l2.size()); - - while (iter1.hasPrevious()) { - if (!(((String) iter1.previous().toString()) - .equals(iter2.previous().toString()))) { - - //System.out.println("ends are NOT equal."); - return false; - } - } - - //System.out.println("ends are equal."); - return true; - } + private Boolean isMyUriRequired; + private List allowedMyUriStackEnd = null; + private List allowedGlobalStackEnd = null; + + + public XmlTreeConstraint(List allowedMyUriStackEnd, + List allowedGlobalStackEnd, + Boolean isMyUriRequired) { + + this.allowedMyUriStackEnd = allowedMyUriStackEnd; + this.allowedGlobalStackEnd = allowedGlobalStackEnd; + this.isMyUriRequired = isMyUriRequired; + } + + + public XmlTreeConstraint(List allowedMyUriStackEnd, + Boolean isMyUriRequired) { + this.allowedMyUriStackEnd = allowedMyUriStackEnd; + this.isMyUriRequired = isMyUriRequired; + } + + + public XmlTreeConstraint(List allowedMyUriStackEnd) { + this.allowedMyUriStackEnd = allowedMyUriStackEnd; + } + + + public XmlTreeConstraint(String[] allowedMyUriStackEnd, + String[] allowedGlobalStackEnd, + boolean isMyUriRequired) { + + this.allowedMyUriStackEnd = Arrays.asList(allowedMyUriStackEnd); + this.allowedGlobalStackEnd = Arrays.asList(allowedGlobalStackEnd); + this.isMyUriRequired = new Boolean(isMyUriRequired); + } + + + public XmlTreeConstraint(String[] allowedMyUriStackEnd, + boolean isMyUriRequired) { + this.allowedMyUriStackEnd = Arrays.asList(allowedMyUriStackEnd); + this.isMyUriRequired = new Boolean(isMyUriRequired); + } + + + public XmlTreeConstraint(String[] allowedMyUriStackEnd) { + this.allowedMyUriStackEnd = Arrays.asList(allowedMyUriStackEnd); + } + + + /** + * Check whether the current element is allowed on this position in the XML + * tree / SAX stream. + * + *@param isMyUri Is the URI of the element the same as the URI of the + * calling object? <code>true</code> if it is, else <code>false</code> + *@param myUriStack The List with elements in the namespace of the calling + * object. + *@param globalStack The List with all elements (thus far) of the XML file + * being processed. + *@return <code>true</code> if the element is allowed on this + * position, <code>false</code> otherwise. + */ + public boolean isAllowed(Boolean isMyUri, List myUriStack, + List globalStack) { + if (debug) { + System.out.println("isMyUri :" + isMyUri + "\nrequired uri " + isMyUriRequired); + System.out.println("myUristack: \n" + myUriStack); + System.out.println("allowedMyUriStackEnd: \n" + allowedMyUriStackEnd); + System.out.println("globalstack: \n" + globalStack); + System.out.println("allowedGlobalStackEnd: \n" + allowedGlobalStackEnd); + } + if (isMyUriRequired != null) { + if (isMyUri == null) { + return false; + } + + /* + * new code + */ + if (isMyUriRequired.booleanValue()) { + if (!isMyUri.booleanValue()) { + return false; + } + } + /* + * old code -- seems wrong to me (tomK) + * if (!isMyUriRequired.equals(isMyUri)) { + * return false; + * } + */ + } + + if (allowedMyUriStackEnd != null) { + if (myUriStack == null) { + return false; + } + + if (!areEndsEqual(allowedMyUriStackEnd, myUriStack)) { + return false; + } + } + + if (allowedGlobalStackEnd != null) { + if (globalStack == null) { + return false; + } + + if (!areEndsEqual(allowedGlobalStackEnd, globalStack)) { + return false; + } + } + + return true; + } + + + private boolean areEndsEqual(List l1, List l2) { + + if (l1.size() > l2.size()) { + if ((!(l1.size() == l2.size())) + && ((l1.size() < 1) || (l2.size() < 1))) { + return false; + } + + //make l1 the smaller one + List l3 = l1; + + l1 = l2; + l2 = l3; + } + + ListIterator iter1 = l1.listIterator(l1.size()); + ListIterator iter2 = l2.listIterator(l2.size()); + + while (iter1.hasPrevious()) { + if (!(((String) iter1.previous().toString()) + .equals(iter2.previous().toString()))) { + + //System.out.println("ends are NOT equal."); + return false; + } + } + + //System.out.println("ends are equal."); + return true; + } } + 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/bar/bar1.xml Index: bar1.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>1990</n><a>80</a></v> <v><n></n><a>77.6</a></v> <v><n></n><a>75.7</a></v> <v><n></n><a>76.6</a></v> <v><n></n><a>76.6</a></v> <v><n>1991</n><a>75.6</a></v> <v><n></n><a>75.6</a></v> <v><n></n><a>75.6</a></v> <v><n></n><a>74.6</a></v> <v><n></n><a>74.6</a></v> <v><n></n><a>74.6</a></v> <v><n>1992</n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>72.6</a></v> <v><n>1993</n><a>72.6</a></v> </set> <set id="2" name="South"> <v><a>87</a></v> <v><a>88.6</a></v> <v><a>89.7</a></v> <v><a>90.6</a></v> <v><a>92.6</a></v> <v><a>92.6</a></v> <v><a>94.6</a></v> <v><a>96.6</a></v> <v><a>98.6</a></v> <v><a>98.6</a></v> <v><a>99.6</a></v> <v><a>99.6</a></v> <v><a>101</a></v> <v><a>103</a></v> <v><a>106</a></v> <v><a>106</a></v> <v><a>109</a></v> </set> <set id="3" name="West"> <v><a>90</a></v> <v><a>89.6</a></v> <v><a>90.7</a></v> <v><a>91.6</a></v> <v><a>93.6</a></v> <v><a>94.6</a></v> <v><a>95.6</a></v> <v><a>97.6</a></v> <v><a>108.6</a></v> <v><a>108.6</a></v> <v><a>109.6</a></v> <v><a>109.6</a></v> <v><a>111</a></v> <v><a>113</a></v> <v><a>116</a></v> <v><a>116</a></v> <v><a>119</a></v> </set> </data> <ggroup> <gset width="350" height="200" effect="3D"> <graph type="barChart" combine="difference" style="border:false;config:/default/barChart.xml"> <dataset ref-id="1"/> <dataset ref-id="2"/> <dataset ref-id="3"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/bar/bar10.xml Index: bar10.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="Sets"> <v><n>Set A</n><a>2000</a></v> <v><n>Set B</n><a>1000</a></v> <v><n>Set C</n><a>3000</a></v> <v><n>Set D</n><a>-500</a></v> <v><n>Set E</n><a>8000</a></v> <v><n>Set F</n><a>5000</a></v> <v><n>Set G</n><a>10000</a></v> </set> </data> <ggroup> <gset width="750" height="400" effect="3D"> <graph type="barChart" style="border:false;config:/default/barChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/bar/bar11.xml Index: bar11.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="Sets"> <v><n>Set A</n><a>2000</a></v> <v><n>Set B</n><a>1000</a></v> <v><n>Set C</n><a>3000</a></v> <v><n>Set D</n><a>-500</a></v> <v><n>Set E</n><a>8000</a></v> <v><n>Set F</n><a>5000</a></v> <v><n>Set G</n><a>10000</a></v> </set> <set id="2" name="Others"> <v><n>Set A</n><a>-2000</a></v> <v><n>Set B</n><a>-1000</a></v> <v><n>Set C</n><a>-3000</a></v> <v><n>Set D</n><a>500</a></v> <v><n>Set E</n><a>-8000</a></v> <v><n>Set F</n><a>-5000</a></v> <v><n>Set G</n><a>-15000</a></v> </set> </data> <ggroup> <gset width="750" height="400" effect="3D"> <graph type="barChart" style="border:false;config:/default/barChart.xml"> <dataset ref-id="1"/> <dataset ref-id="2"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/bar/bar12.xml Index: bar12.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="Sets"> <v><n>Set A</n><a>2</a></v> <v><n>Set B</n><a>1</a></v> <v><n>Set C</n><a>3</a></v> <v><n>Set D</n><a>-5</a></v> <v><n>Set E</n><a>8</a></v> <v><n>Set F</n><a>5</a></v> <v><n>Set G</n><a>10</a></v> </set> <set id="2" name="Others"> <v><n>Set A</n><a>-2</a></v> <v><n>Set B</n><a>-10</a></v> <v><n>Set C</n><a>-3</a></v> <v><n>Set D</n><a>5</a></v> <v><n>Set E</n><a>-8</a></v> <v><n>Set F</n><a>-5</a></v> <v><n>Set G</n><a>-15</a></v> </set> <set id="3" name="More"> <v><n>Set A</n><a>12</a></v> <v><n>Set B</n><a>-10</a></v> <v><n>Set C</n><a>3</a></v> <v><n>Set D</n><a>1</a></v> <v><n>Set E</n><a>13</a></v> <v><n>Set F</n><a>9</a></v> <v><n>Set G</n><a>5</a></v> </set> </data> <ggroup> <gset width="750" height="400" effect="3D"> <graph type="barChart" style="border:false;config:/default/barChart.xml"> <dataset ref-id="1"/> <dataset ref-id="2"/> <dataset ref-id="3"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/bar/bar2.xml Index: bar2.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>1990</n><a>80</a></v> <v><n></n><a>77.6</a></v> <v><n></n><a>75.7</a></v> <v><n></n><a>76.6</a></v> <v><n></n><a>76.6</a></v> <v><n>1991</n><a>75.6</a></v> <v><n></n><a>75.6</a></v> <v><n></n><a>75.6</a></v> <v><n></n><a>74.6</a></v> <v><n></n><a>74.6</a></v> <v><n></n><a>74.6</a></v> <v><n>1992</n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>72.6</a></v> <v><n>1993</n><a>72.6</a></v> </set> <set id="2" name="South"> <v><a>87</a></v> <v><a>88.6</a></v> <v><a>89.7</a></v> <v><a>90.6</a></v> <v><a>92.6</a></v> <v><a>92.6</a></v> <v><a>94.6</a></v> <v><a>96.6</a></v> <v><a>98.6</a></v> <v><a>98.6</a></v> <v><a>99.6</a></v> <v><a>99.6</a></v> <v><a>101</a></v> <v><a>103</a></v> <v><a>106</a></v> <v><a>106</a></v> <v><a>109</a></v> </set> <set id="3" name="East"> <v><a>90</a></v> <v><a>94.6</a></v> <v><a>95.7</a></v> <v><a>96.6</a></v> <v><a>97.6</a></v> <v><a>99.6</a></v> <v><a>100.6</a></v> <v><a>102.6</a></v> <v><a>113.6</a></v> <v><a>113.6</a></v> <v><a>113.6</a></v> <v><a>114.6</a></v> <v><a>116</a></v> <v><a>117</a></v> <v><a>121</a></v> <v><a>121</a></v> <v><a>127</a></v> </set> <set id="4" name="West"> <v><a>95</a></v> <v><a>99.6</a></v> <v><a>110.7</a></v> <v><a>111.6</a></v> <v><a>113.6</a></v> <v><a>114.6</a></v> <v><a>115.6</a></v> <v><a>117.6</a></v> <v><a>128.6</a></v> <v><a>128.6</a></v> <v><a>129.6</a></v> <v><a>129.6</a></v> <v><a>131</a></v> <v><a>133</a></v> <v><a>136</a></v> <v><a>146</a></v> <v><a>159</a></v> </set> </data> <ggroup> <gset width="350" height="200" effect="3D"> <graph type="barChart" combine="difference" style="border:false;config:/default/barChart.xml"> <dataset ref-id="1"/> <dataset ref-id="2"/> <dataset ref-id="3"/> <dataset ref-id="4"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/bar/bar3.xml Index: bar3.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>1990</n><a>80</a></v> <v><n></n><a>77.6</a></v> <v><n></n><a>75.7</a></v> <v><n></n><a>76.6</a></v> <v><n></n><a>76.6</a></v> <v><n>1991</n><a>75.6</a></v> <v><n></n><a>75.6</a></v> <v><n></n><a>75.6</a></v> <v><n></n><a>74.6</a></v> <v><n></n><a>74.6</a></v> <v><n></n><a>74.6</a></v> <v><n>1992</n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>72.6</a></v> <v><n>1993</n><a>72.6</a></v> </set> <set id="2" name="South"> <v><a>87</a></v> <v><a>88.6</a></v> <v><a>89.7</a></v> <v><a>90.6</a></v> <v><a>92.6</a></v> <v><a>92.6</a></v> <v><a>94.6</a></v> <v><a>96.6</a></v> <v><a>98.6</a></v> <v><a>98.6</a></v> <v><a>99.6</a></v> <v><a>99.6</a></v> <v><a>101</a></v> <v><a>103</a></v> <v><a>106</a></v> <v><a>106</a></v> <v><a>109</a></v> </set> <set id="3" name="East"> <v><a>90</a></v> <v><a>94.6</a></v> <v><a>95.7</a></v> <v><a>96.6</a></v> <v><a>97.6</a></v> <v><a>99.6</a></v> <v><a>100.6</a></v> <v><a>102.6</a></v> <v><a>113.6</a></v> <v><a>113.6</a></v> <v><a>113.6</a></v> <v><a>114.6</a></v> <v><a>116</a></v> <v><a>117</a></v> <v><a>121</a></v> <v><a>121</a></v> <v><a>127</a></v> </set> <set id="4" name="West"> <v><a>95</a></v> <v><a>99.6</a></v> <v><a>110.7</a></v> <v><a>111.6</a></v> <v><a>113.6</a></v> <v><a>114.6</a></v> <v><a>115.6</a></v> <v><a>117.6</a></v> <v><a>128.6</a></v> <v><a>128.6</a></v> <v><a>129.6</a></v> <v><a>129.6</a></v> <v><a>131</a></v> <v><a>133</a></v> <v><a>136</a></v> <v><a>146</a></v> <v><a>159</a></v> </set> </data> <ggroup> <gset width="350" height="200" effect="3D"> <graph type="barChart" combine="merge" style="border:false;config:/default/barChart.xml"> <dataset ref-id="1"/> <dataset ref-id="2"/> <dataset ref-id="3"/> <dataset ref-id="4"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/bar/bar4.xml Index: bar4.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>Set A</n><a>80</a></v> <v><n>Set B</n><a>77.6</a></v> <v><n>Set C</n><a>75.7</a></v> <v><n>Set D</n><a>76.6</a></v> </set> </data> <ggroup> <gset width="550" height="300" effect="3D"> <graph type="barChart" style="border:false;config:/default/barChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/bar/bar5.xml Index: bar5.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set type="percent" id="1" name="North"> <v><n>Set A</n><a>80%</a></v> <v><n>Set B</n><a>77.6%</a></v> <v><n>Set C</n><a>%</a></v> <v><n>Set D</n><a>7%</a></v> </set> </data> <ggroup> <gset width="550" height="300" effect="3D"> <graph type="barChart" style="border:false;config:/default/barChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/bar/bar6.xml Index: bar6.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>Set A</n><a>80</a></v> <v><n>Set B</n><a></a></v> <v><n>Set C</n><a>150</a></v> <v><n>Set D</n><a>207</a></v> </set> </data> <ggroup> <gset width="550" height="300" effect="3D"> <graph type="barChart" style="border:false;config:/default/barChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/bar/bar7.xml Index: bar7.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="Sets"> <v><n>Set A</n><a>0.02</a></v> <v><n>Set B</n><a>0.01</a></v> <v><n>Set C</n><a>0.6</a></v> <v><n>Set D</n><a>0.43</a></v> <v><n>Set E</n><a>0.95</a></v> <v><n>Set F</n><a>0.32</a></v> <v><n>Set G</n><a>0.45</a></v> </set> </data> <ggroup> <gset width="750" height="400" effect="3D"> <graph type="barChart" style="border:false;config:/default/barChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/bar/bar8.xml Index: bar8.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="Sets"> <v><n>Set A</n><a>20</a></v> <v><n>Set B</n><a>-10</a></v> <v><n>Set C</n><a>30</a></v> <v><n>Set D</n><a>-5</a></v> <v><n>Set E</n><a>80</a></v> <v><n>Set F</n><a>50</a></v> <v><n>Set G</n><a>-10</a></v> </set> </data> <ggroup> <gset width="750" height="400" effect="3D"> <graph type="barChart" style="border:false;config:/default/barChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/bar/bar9.xml Index: bar9.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="Sets"> <v><n>Set A</n><a>0.00120</a></v> <v><n>Set B</n><a>0.003</a></v> <v><n>Set C</n><a>0.002</a></v> <v><n>Set D</n><a>0.0005</a></v> <v><n>Set E</n><a>0.007</a></v> <v><n>Set F</n><a>0.002</a></v> <v><n>Set G</n><a>0.006</a></v> </set> </data> <ggroup> <gset width="750" height="400" effect="3D"> <graph type="barChart" style="border:false;config:/default/barChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.3 +49 -38 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/Chart2SvgTransformer.java Index: Chart2SvgTransformer.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/Chart2SvgTransformer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Chart2SvgTransformer.java 14 May 2002 20:34:22 -0000 1.2 +++ Chart2SvgTransformer.java 16 May 2002 17:04:02 -0000 1.3 @@ -1,42 +1,53 @@ /* - * ============================================================================ - * The Apache Software License, Version 1.1 - * ============================================================================ - * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The end-user documentation included with the redistribution, if any, must - * include the following acknowledgment: "This product includes software - * developed by the Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, if - * and wherever such third-party acknowledgments normally appear. - * 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be - * used to endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * [EMAIL PROTECTED] - * 5. Products derived from this software may not be called "Apache", nor may - * "Apache" appear in their name, without prior written permission of the - * Apache Software Foundation. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * This software consists of voluntary contributions made by many individuals - * on behalf of the Apache Software Foundation and was originally created by - * Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache - * Software Foundation, please see <http://www.apache.org/>. - */ + + ============================================================================ + The Apache Software License, Version 1.1 + ============================================================================ + + Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without modifica- + tion, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The end-user documentation included with the redistribution, if any, must + include the following acknowledgment: "This product includes software + developed by the Apache Software Foundation (http://www.apache.org/)." + Alternately, this acknowledgment may appear in the software itself, if + and wherever such third-party acknowledgments normally appear. + + 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be + used to endorse or promote products derived from this software without + prior written permission. For written permission, please contact + [EMAIL PROTECTED] + + 5. Products derived from this software may not be called "Apache", nor may + "Apache" appear in their name, without prior written permission of the + Apache Software Foundation. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + This software consists of voluntary contributions made by many individuals + on behalf of the Apache Software Foundation and was originally created by + Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache + Software Foundation, please see <http://www.apache.org/>. + +*/ package org.apache.cocoon.transformation; import java.io.IOException; 1.1 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/transformation/WingsTransformer.java Index: WingsTransformer.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [EMAIL PROTECTED] 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache Software Foundation, please see <http://www.apache.org/>. */ package org.apache.cocoon.transformation; import org.w3c.dom.*; import org.krysalis.wings.*; /** * A transformer to render charts. Uses the Krysalis Wings XCML charting engine.<p> * * The component in the pipeline before this one, has to generate SAX-events * that comply the Krysalis Wings XCML charting format. Output is a stream of SVG SAX events. * *@author <a href="mailto:[EMAIL PROTECTED]">Tom Klaasen</a> *@created 16 mei 2002 */ public class WingsTransformer extends AbstractDOMTransformer { protected Document transform(Document doc) { WingsRenderer gr = new WingsRenderer(); gr.setLogger(new org.apache.avalon.framework.logger.LogKitLogger(getLogger())); gr.setFontInfo("sansserif", 12); Document svgdoc = gr.renderToSVG(doc); return svgdoc; } } 1.1 xml-cocoon2/src/scratchpad/lib/krysalis-wings-0.2.0-dev.jar <<Binary file>> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/line/line1.xml Index: line1.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>1990</n><a>80</a></v> <v><n></n><a>77.6</a></v> <v><n></n><a>75.7</a></v> <v><n></n><a>76.6</a></v> <v><n></n><a>76.6</a></v> <v><n>1991</n><a>75.6</a></v> <v><n></n><a>75.6</a></v> <v><n></n><a>75.6</a></v> <v><n></n><a>74.6</a></v> <v><n></n><a>74.6</a></v> <v><n></n><a>74.6</a></v> <v><n>1992</n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>72.6</a></v> <v><n>1993</n><a>72.6</a></v> </set> <set id="2" name="South"> <v><a>87</a></v> <v><a>88.6</a></v> <v><a>89.7</a></v> <v><a>90.6</a></v> <v><a>92.6</a></v> <v><a>92.6</a></v> <v><a>94.6</a></v> <v><a>96.6</a></v> <v><a>98.6</a></v> <v><a>98.6</a></v> <v><a>99.6</a></v> <v><a>99.6</a></v> <v><a>101</a></v> <v><a>103</a></v> <v><a>106</a></v> <v><a>106</a></v> <v><a>109</a></v> </set> <set id="3" name="West"> <v><a>90</a></v> <v><a>89.6</a></v> <v><a>90.7</a></v> <v><a>91.6</a></v> <v><a>93.6</a></v> <v><a>94.6</a></v> <v><a>95.6</a></v> <v><a>97.6</a></v> <v><a>108.6</a></v> <v><a>108.6</a></v> <v><a>109.6</a></v> <v><a>109.6</a></v> <v><a>111</a></v> <v><a>113</a></v> <v><a>116</a></v> <v><a>116</a></v> <v><a>119</a></v> </set> </data> <ggroup> <gset width="350" height="200" effect="3D"> <graph type="lineChart" combine="compare" style="border:false;config:/default/lineChart.xml"> <dataset ref-id="1"/> <dataset ref-id="2"/> <dataset ref-id="3"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/line/line2.xml Index: line2.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>1990</n><a>8</a></v> <v><n></n><a>10</a></v> <v><n></n><a>12</a></v> <v><n></n><a>13</a></v> <v><n></n><a>15</a></v> <v><n>1991</n><a>20</a></v> <v><n></n><a>21</a></v> <v><n></n><a>23</a></v> <v><n></n><a>25</a></v> <v><n></n><a>40</a></v> <v><n></n><a>45</a></v> <v><n>1992</n><a>30</a></v> <v><n></n><a>35</a></v> <v><n></n><a>41</a></v> <v><n></n><a>42</a></v> <v><n></n><a>47</a></v> <v><n>1993</n><a>55</a></v> </set> </data> <ggroup> <gset width="350" height="200" effect="3D"> <graph type="lineChart" combine="compare" style="border:false;config:/default/greenLineChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/line/line3.xml Index: line3.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>1990</n><a>80</a></v> <v><n></n><a>130</a></v> <v><n></n><a>150</a></v> <v><n></n><a>180</a></v> <v><n></n><a>190</a></v> <v><n>1991</n><a>160</a></v> <v><n></n><a>150</a></v> <v><n></n><a>145</a></v> <v><n></n><a>140</a></v> <v><n></n><a>146</a></v> <v><n></n><a>150</a></v> <v><n>1992</n><a>170</a></v> <v><n></n><a>210</a></v> <v><n></n><a>220</a></v> <v><n></n><a>250</a></v> <v><n></n><a>300</a></v> <v><n>1993</n><a>350</a></v> </set> </data> <ggroup> <gset width="350" height="200" effect="3D"> <graph type="lineChart" combine="compare" style="border:false;config:/default/lineChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/line/line4.xml Index: line4.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>1990</n><a>80</a></v> <v><n>1991</n><a>70</a></v> <v><n>1992</n><a>170</a></v> <v><n>1993</n><a>80</a></v> <v><n>1993</n><a>95</a></v> </set> </data> <ggroup> <gset width="350" height="200" effect="3D"> <graph type="lineChart" combine="compare" style="border:false;config:/default/blueLineChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/line/line5.xml Index: line5.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>1990</n><a>80</a></v> <v><n></n><a>30</a></v> <v><n></n><a>10</a></v> <v><n>1991</n><a>-20</a></v> <v><n></n><a>-60</a></v> <v><n></n><a>-80</a></v> <v><n>1992</n><a>-50</a></v> <v><n></n><a>-40</a></v> <v><n></n><a>-10</a></v> <v><n>1993</n><a>20</a></v> </set> </data> <ggroup> <gset width="350" height="200" effect="3D"> <graph type="lineChart" style="border:false;config:/default/lineChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/line/line6.xml Index: line6.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>1990</n><a>-80</a></v> <v><n></n><a>-30</a></v> <v><n></n><a>-10</a></v> <v><n>1991</n><a>-20</a></v> <v><n></n><a>-60</a></v> <v><n></n><a>-80</a></v> <v><n>1992</n><a>-50</a></v> <v><n></n><a>-40</a></v> <v><n></n><a>-10</a></v> <v><n>1993</n><a>-20</a></v> </set> </data> <ggroup> <gset width="350" height="200" effect="3D"> <graph type="lineChart" style="border:false;config:/default/lineChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/multi/multi1.xml Index: multi1.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>1990</n><a>80</a></v> <v><n></n><a>77.6</a></v> <v><n></n><a>75.7</a></v> <v><n></n><a>76.6</a></v> <v><n></n><a>76.6</a></v> <v><n>1991</n><a>75.6</a></v> <v><n></n><a>75.6</a></v> <v><n></n><a>75.6</a></v> <v><n></n><a>74.6</a></v> <v><n></n><a>74.6</a></v> <v><n></n><a>74.6</a></v> <v><n>1992</n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>72.6</a></v> <v><n>1993</n><a>72.6</a></v> </set> <set id="2" name="South"> <v><a>87</a></v> <v><a>88.6</a></v> <v><a>89.7</a></v> <v><a>90.6</a></v> <v><a>92.6</a></v> <v><a>92.6</a></v> <v><a>94.6</a></v> <v><a>96.6</a></v> <v><a>98.6</a></v> <v><a>98.6</a></v> <v><a>99.6</a></v> <v><a>99.6</a></v> <v><a>101</a></v> <v><a>103</a></v> <v><a>106</a></v> <v><a>106</a></v> <v><a>109</a></v> </set> <set id="3" name="West"> <v><a>90</a></v> <v><a>89.6</a></v> <v><a>90.7</a></v> <v><a>91.6</a></v> <v><a>93.6</a></v> <v><a>94.6</a></v> <v><a>95.6</a></v> <v><a>97.6</a></v> <v><a>108.6</a></v> <v><a>108.6</a></v> <v><a>109.6</a></v> <v><a>109.6</a></v> <v><a>111</a></v> <v><a>113</a></v> <v><a>116</a></v> <v><a>116</a></v> <v><a>119</a></v> </set> </data> <ggroup> <gset width="350" height="200" effect="3D"> <graph type="barChart" combine="difference" style="border:false;config:/default/barChart.xml"> <dataset ref-id="1"/> <dataset ref-id="2"/> <dataset ref-id="3"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/pie/pie1.xml Index: pie1.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>1990</n><a>80</a></v> <v><n></n><a>77.6</a></v> <v><n></n><a>75.7</a></v> <v><n></n><a>76.6</a></v> <v><n></n><a>76.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>73.6</a></v> <v><n></n><a>72.6</a></v> <v><n>1993</n><a>72.6</a></v> </set> </data> <ggroup> <gset width="350" height="200" effect="3D"> <graph type="pieChart" style="legendSpace:2;border:false;config:/default/pieChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/pie/pie2.xml Index: pie2.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" style="config:/default/pieChart.xml" lang="de"> <title>embeddedPieChart</title> <data> <set type="percent" id="1"> <v> <a>100,0%</a> </v> <v> <a>0,0%</a> </v> </set> </data> <ggroup> <gset height="150" width="350"> <graph style="legendSpace:4.3" effect="3D" type="embeddedPieChart"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/pie/pie3.xml Index: pie3.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>AAAAAAA</n><a>3</a></v> <v><n>BBBBBBB</n><a>47.6</a></v> <v><n>CCCC</n><a>55.7</a></v> <v><n>DDDDD</n><a>26.6</a></v> <v><n>EEEEE</n><a>70</a></v> <v><n>FFFF</n><a>3</a></v> <v><n>G</n><a>6</a></v> <v><n>HHHHHHH</n><a>7.6</a></v> <v><n>IIIII</n><a>2.6</a></v> </set> </data> <ggroup> <gset width="350" height="200" effect="3D"> <graph type="pieChart" style="legendSpace:2;border:false;config:/default/pieChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/pie/pie4.xml Index: pie4.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>1990</n><a>10</a></v> <v><n></n><a>7.6</a></v> <v><n></n><a>5</a></v> <v><n></n><a>6</a></v> <v><n></n><a>26</a></v> <v><n></n><a>73</a></v> <v><n></n><a>73</a></v> <v><n></n><a>72</a></v> <v><n>1993</n><a>72</a></v> </set> </data> <ggroup> <gset width="350" height="200" effect="3D"> <graph type="pieChart" style="legendSpace:2;border:false;config:/default/pieChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/pie/pie5.xml Index: pie5.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>1990</n><a>8</a></v> <v><n>1991</n><a>77.6</a></v> <v><n>1992</n><a>5.7</a></v> <v><n>1993</n><a>6.6</a></v> <v><n>1994</n><a>76.6</a></v> <v><n>1995</n><a>3.6</a></v> <v><n>1996</n><a>3.6</a></v> <v><n>1997</n><a>72.6</a></v> <v><n>1998</n><a>2.6</a></v> </set> </data> <ggroup> <gset width="350pt" height="200pt" effect="3D"> <graph type="pieChart" style="legendSpace:0.15in;border:false;config:/default/pieChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/pie/pie6.xml Index: pie6.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>1</n><a>80</a></v> <v><n>2</n><a>77.6</a></v> <v><n>3</n><a>5.072</a></v> <v><n>4</n><a>6.564</a></v> <v><n>5</n><a>3.324</a></v> <v><n>6</n><a>2.275</a></v> <v><n>7</n><a>3.6</a></v> <v><n>8</n><a>72.6</a></v> <v><n>9</n><a>72.6</a></v> </set> </data> <ggroup> <gset width="350" height="200" effect="3D"> <graph type="pieChart" style="legendSpace:2;border:false;config:/default/pieChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.1 xml-cocoon2/src/scratchpad/webapp/mount/charts/content/static/pie/pie7.xml Index: pie7.xml =================================================================== <xcml xmlns="http://xml.apache.org/2001/xcml" country="EN" lang="en" style="border:false;"> <title>test</title> <data> <set id="1" name="North"> <v><n>1</n><a>4.01</a></v> <v><n>2</n><a>6.04</a></v> <v><n>3</n><a>5.16</a></v> <v><n>4</n><a>76.6</a></v> <v><n>5</n><a>76.6</a></v> <v><n>6</n><a>73.6</a></v> <v><n>7</n><a>73.6</a></v> <v><n>8</n><a>2.55</a></v> </set> </data> <ggroup> <gset width="350" height="200" effect="3D"> <graph type="pieChart" style="legendSpace:2;border:false;config:/default/pieChart.xml"> <dataset ref-id="1"/> </graph> </gset> </ggroup> </xcml> 1.3 +20 -0 xml-cocoon2/src/scratchpad/webapp/mount/charts/sitemap.xmap Index: sitemap.xmap =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/charts/sitemap.xmap,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- sitemap.xmap 14 May 2002 20:34:23 -0000 1.2 +++ sitemap.xmap 16 May 2002 17:04:03 -0000 1.3 @@ -7,6 +7,7 @@ <map:transformers default="xslt"> <map:transformer label="transformed" name="chart2svg" src="org.apache.cocoon.transformation.Chart2SvgTransformer"/> + <map:transformer name="wings" src="org.apache.cocoon.transformation.WingsTransformer" /> </map:transformers> <map:readers default="resource"/> @@ -44,6 +45,25 @@ <map:transform src="stylesheets/simple-samples2html.xsl"/> <map:serialize/> </map:match> + + <map:match pattern="*/*.xml"> + <map:generate src="content/static/{1}/{2}.xml" /> + <map:transform type="wings" /> + <map:serialize type="xml" /> + </map:match> + + <map:match pattern="*/*.svg"> + <map:generate src="content/static/{1}/{2}.xml" /> + <map:transform type="wings" /> + <map:serialize type="svgxml" /> + </map:match> + + <map:match pattern="*/*.jpg"> + <map:generate src="content/static/{1}/{2}.xml" /> + <map:transform type="wings" /> + <map:serialize type="svg2jpeg" /> + </map:match> + <map:match pattern="*chart.xml"> <map:generate src="content/static/{1}chart.xml"/>
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]