spark-1.2-src/000700 000765 000024 00000000000 11474330132 013541 5ustar00larrystaff000000 000000 spark-1.2-src/build.properties000644 000765 000024 00000000000 10454015201 016750 0ustar00larrystaff000000 000000 spark-1.2-src/build.xml000644 000765 000024 00000006350 10456770132 015407 0ustar00larrystaff000000 000000 spark-1.2-src/docs/000755 000765 000024 00000000000 10572117021 014501 5ustar00larrystaff000000 000000 spark-1.2-src/lib/000755 000765 000024 00000000000 10575064435 014334 5ustar00larrystaff000000 000000 spark-1.2-src/LICENSE.txt000644 000765 000024 00000026136 10572077137 015421 0ustar00larrystaff000000 000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. spark-1.2-src/src/000755 000765 000024 00000000000 11474330050 014341 5ustar00larrystaff000000 000000 spark-1.2-src/test/000755 000765 000024 00000000000 11474330050 014531 5ustar00larrystaff000000 000000 spark-1.2-src/test/com/000755 000765 000024 00000000000 11474330050 015307 5ustar00larrystaff000000 000000 spark-1.2-src/test/com/representqueens/000755 000765 000024 00000000000 11474330050 020537 5ustar00larrystaff000000 000000 spark-1.2-src/test/com/representqueens/spark/000755 000765 000024 00000000000 11474330050 021657 5ustar00larrystaff000000 000000 spark-1.2-src/test/com/representqueens/util/000755 000765 000024 00000000000 11474330050 021514 5ustar00larrystaff000000 000000 spark-1.2-src/test/com/representqueens/util/StringUtilsTest.java000644 000765 000024 00000002665 10572077361 025532 0ustar00larrystaff000000 000000 /* * $Id: StringUtilsTest.java,v 1.1 2007-03-02 19:45:53 larry Exp $ */ package com.representqueens.util; /* * * Copyright 2007 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.util.ArrayList; import java.util.List; import junit.framework.TestCase; /** * @author Larry Ogrodnek * @version $Revision: 1.1 $ $Date: 2007-03-02 19:45:53 $ */ public class StringUtilsTest extends TestCase { /** * Test method for {@link com.representqueens.util.StringUtils#toString(java.util.List)}. */ public void testToStringListOfInteger() { final List data = new ArrayList(); assertEquals("", StringUtils.toString(data)); data.add(5); assertEquals("5", StringUtils.toString(data)); data.add(6); assertEquals("5,6", StringUtils.toString(data)); data.add(7); assertEquals("5,6,7", StringUtils.toString(data)); } } spark-1.2-src/test/com/representqueens/spark/TestColor.java000644 000765 000024 00000003154 10575064532 024455 0ustar00larrystaff000000 000000 /* * $Id: TestColor.java,v 1.7 2007-03-11 20:40:58 larry Exp $ */ package com.representqueens.spark; /* * * Copyright 2006 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import com.representqueens.util.ColorUtils; /** * @author Larry Ogrodnek * @version $Revision: 1.7 $ $Date: 2007-03-11 20:40:58 $ */ public class TestColor { public static void main(final String[] args) throws IOException { final Number[] data = {5, 23, 11, 25, -19, 4, 2, 3, -13, 2, 3, 4, 5}; final Color color = ColorUtils.parseColor("black"); final Color back = ColorUtils.parseColor("red"); System.out.println("Found color: " + color); final BufferedImage i = LineGraph.createGraph(data, LineGraph.DEFAULT_SIZE, color, back); //final BufferedImage i = BarGraph.createGraph(data, BarGraph.DEFAULT_SIZE, color, null, null); final File file = new File(args[0]); ImageIO.write(i, "png", file); } } spark-1.2-src/test/com/representqueens/spark/TestEncoder.java000644 000765 000024 00000002420 10456770620 024751 0ustar00larrystaff000000 000000 /* * $Id: TestEncoder.java,v 1.3 2006/07/17 20:22:40 larry Exp $ */ package com.representqueens.spark; /* * * Copyright 2006 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.awt.image.BufferedImage; import java.io.IOException; /** * @author Larry Ogrodnek * @version $Revision: 1.3 $ $Date: 2006/07/17 20:22:40 $ */ public class TestEncoder { /** * @param args */ public static void main(final String[] args) throws IOException { final Number[] data = {3, 5, 3, 7, 20, 17, 12, 4, 13, 11, 7, 20, 17, 7, 9, 8, 10, 12}; final BufferedImage i = BarGraph.createGraph(data); //final BufferedImage i = LineGraph.createGraph(data); System.out.println(Encoder.encode(i, Encoder.Format.DATA)); } } spark-1.2-src/test/com/representqueens/spark/TestGraph.java000644 000765 000024 00000002474 10456770620 024444 0ustar00larrystaff000000 000000 /* * $Id: TestGraph.java,v 1.5 2006/07/17 20:22:40 larry Exp $ */ package com.representqueens.spark; /* * * Copyright 2006 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; /** * @author Larry Ogrodnek * @version $Revision: 1.5 $ $Date: 2006/07/17 20:22:40 $ */ public class TestGraph { public static void main(final String[] args) throws IOException { final Number[] data = {3, 5, 3, 7, 20, 17, 12, 4, 13, 11, 7, 20, 17, 7, 9, 8, 10, 12}; final BufferedImage i = BarGraph.createGraph(data); //final BufferedImage i = LineGraph.createGraph(data); final File file = new File(args[0]); ImageIO.write(i, "png", file); } } spark-1.2-src/test/com/representqueens/spark/VisitorGraph.java000644 000765 000024 00000003346 10456770620 025163 0ustar00larrystaff000000 000000 /* * $Id: VisitorGraph.java,v 1.2 2006/07/17 20:22:40 larry Exp $ */ package com.representqueens.spark; /* * * Copyright 2006 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import javax.imageio.ImageIO; import com.representqueens.util.StringUtils; /** * @author Larry Ogrodnek * @version $Revision: 1.2 $ $Date: 2006/07/17 20:22:40 $ */ public final class VisitorGraph { /** * @param args */ public static void main(final String[] args) throws IOException { final BufferedReader br = new BufferedReader(new FileReader(args[0])); final Number[] data = StringUtils.toIntList(br.readLine(), "\\s+").toArray(new Number[0]); final BufferedImage i = BarGraph.createGraph(data, BarGraph.DEFAULT_SIZE, BarGraph.DEFAULT_COLOR, BarGraph.DEFAULT_HIGH_COLOR, BarGraph.DEFAULT_LAST_COLOR); final File out = new File(args[2]); if (out.exists()) { out.delete(); } ImageIO.write(i, "png", out); } } spark-1.2-src/src/com/000755 000765 000024 00000000000 11474330050 015117 5ustar00larrystaff000000 000000 spark-1.2-src/src/manifest.mf000644 000765 000024 00000000300 10454016663 016474 0ustar00larrystaff000000 000000 Manifest-Version: 1.0 Name: com/representqueens/web/tags/spark Sealed: true Implementation-Title: "Sparkline Tag Library" Implementation-Version: "1.1" Implementation-Vendor: "Larry Ogrodnek" spark-1.2-src/src/META-INF/000755 000765 000024 00000000000 11474330050 015501 5ustar00larrystaff000000 000000 spark-1.2-src/src/META-INF/spark.tld000644 000765 000024 00000006746 10575064736 017363 0ustar00larrystaff000000 000000 Sparkline generation 1.1 1.2 spark http://www.representqueens.com/taglibs/spark bar com.representqueens.web.tags.spark.BarGraph empty name true false width false true height false true spacing false true color false true highColor false true lastColor false true background false true path false true output false true line com.representqueens.web.tags.spark.LineGraph empty name true false width false true height false true spacing false true color false true background false true path false true output false true spark-1.2-src/src/META-INF/spark_em.tld000644 000765 000024 00000005614 10572064350 020022 0ustar00larrystaff000000 000000 Sparkline generation 1.1 1.2 spark http://www.representqueens.com/taglibs/spark_em bar com.representqueens.web.tags.spark.embedded.BarGraph empty name true false width false true height false true spacing false true color false true highColor false true lastColor false true output false true line com.representqueens.web.tags.spark.embedded.LineGraph empty name true false width false true height false true spacing false true color false true output false true spark-1.2-src/src/com/representqueens/000755 000765 000024 00000000000 11474330050 020347 5ustar00larrystaff000000 000000 spark-1.2-src/src/com/representqueens/spark/000755 000765 000024 00000000000 11474330050 021467 5ustar00larrystaff000000 000000 spark-1.2-src/src/com/representqueens/util/000755 000765 000024 00000000000 11474330050 021324 5ustar00larrystaff000000 000000 spark-1.2-src/src/com/representqueens/web/000755 000765 000024 00000000000 11474330050 021124 5ustar00larrystaff000000 000000 spark-1.2-src/src/com/representqueens/web/tags/000755 000765 000024 00000000000 11474330050 022062 5ustar00larrystaff000000 000000 spark-1.2-src/src/com/representqueens/web/tags/spark/000755 000765 000024 00000000000 11474330050 023202 5ustar00larrystaff000000 000000 spark-1.2-src/src/com/representqueens/web/tags/spark/AbstractGraph.java000644 000765 000024 00000011565 10575064532 026614 0ustar00larrystaff000000 000000 /* * $Id: AbstractGraph.java,v 1.3 2007-03-11 20:40:58 larry Exp $ */ package com.representqueens.web.tags.spark; /* * * Copyright 2006 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.awt.image.BufferedImage; import java.io.IOException; import java.util.List; import javax.servlet.jsp.tagext.TagSupport; import com.representqueens.spark.BarGraph; import com.representqueens.spark.Encoder; import com.representqueens.spark.LineGraph; import com.representqueens.spark.SizeParams; import com.representqueens.spark.Encoder.Format; import com.representqueens.spark.util.StringConversion; import com.representqueens.util.StringUtils; /** * @author Larry Ogrodnek * @version $Revision: 1.3 $ $Date: 2007-03-11 20:40:58 $ */ public abstract class AbstractGraph extends TagSupport { private String name; private String width; private String height; private String spacing; private String color; private String highColor; private String lastColor; private String background; private String output; public String getColor() { return this.color; } public void setColor(final String color) { this.color = color; } public String getHeight() { return this.height; } public void setHeight(final String height) { this.height = height; } public String getName() { return this.name; } public void setName(final String name) { this.name = name; } public String getOutput() { return this.output; } public void setOutput(final String output) { this.output = output; } public String getSpacing() { return this.spacing; } public void setSpacing(final String spacing) { this.spacing = spacing; } public String getWidth() { return this.width; } public void setWidth(final String width) { this.width = width; } public String getHighColor() { return this.highColor; } public void setHighColor(final String highColor) { this.highColor = highColor; } public String getLastColor() { return this.lastColor; } public void setLastColor(final String lastColor) { this.lastColor = lastColor; } public String getBackground() { return this.background; } public void setBackground(final String background) { this.background = background; } protected String getBarGraphData() throws IOException { final BufferedImage image = BarGraph.createGraph(getData(), getSizeParams(BarGraph.DEFAULT_SIZE), StringConversion.convertColor(this.color, BarGraph.DEFAULT_COLOR), StringConversion.convertColor(this.highColor, null), StringConversion.convertColor(this.lastColor, null)); return Encoder.encode(image, getOutputFormat()); } protected String getLineGraphData() throws IOException { final BufferedImage image = LineGraph.createGraph(getData(), getSizeParams(LineGraph.DEFAULT_SIZE), StringConversion.convertColor(this.color, LineGraph.DEFAULT_COLOR)); return Encoder.encode(image, getOutputFormat()); } protected SizeParams getSizeParams(final SizeParams defaults) { return new SizeParams(StringConversion.convertInt(this.width, defaults.getWidth()), StringConversion.convertInt(this.height, defaults.getHeight()), StringConversion.convertInt(this.spacing, defaults.getSpacing())); } protected Number[] getData() { final Object o = this.pageContext.findAttribute(this.name); if (o instanceof List) { final List l = (List) o; return (Number[]) l.toArray(new Number[l.size()]); } if (o instanceof Number[]) { return (Number[]) o; } if (o instanceof String) { try { final List l = StringUtils.toIntList((String) o); return l.toArray(new Number[l.size()]); } catch (final NumberFormatException nfe) { // fall through... } } return new Number[0]; } protected Format getOutputFormat() { if (! StringUtils.isEmpty(this.output)) { if ("data".equalsIgnoreCase(this.output)) { return Format.DATA; } } return Format.JAVASCRIPT; } } spark-1.2-src/src/com/representqueens/web/tags/spark/AbstractServerGraph.java000644 000765 000024 00000005143 10575064532 027776 0ustar00larrystaff000000 000000 /* * $Id: AbstractServerGraph.java,v 1.3 2007-03-11 20:40:58 larry Exp $ */ package com.representqueens.web.tags.spark; /* * * Copyright 2007 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import javax.servlet.http.HttpServletRequest; import com.representqueens.util.StringUtils; /** * @author Larry Ogrodnek * @version $Revision: 1.3 $ $Date: 2007-03-11 20:40:58 $ */ public abstract class AbstractServerGraph extends AbstractGraph { private static final String DEFAULT_PATH = "/spark"; private String path; public String getPath() { return this.path; } public void setPath(final String path) { this.path = path; } public String getRealPath() { final Object o = this.pageContext.findAttribute("sparkPath"); if (o instanceof String) { return convertPath(o.toString()); } return convertPath((this.path == null ? DEFAULT_PATH : this.path)); } private String convertPath(final String s) { final String c = ((HttpServletRequest) this.pageContext.getRequest()).getContextPath(); return String.format("%s%s", c, s); } protected String getQueryParams() { final StringBuilder sb = new StringBuilder(); final String[] n = new String[] { "color", "highcolor", "lastcolor", "background", "width", "height", "spacing", "output" }; final String[] p = new String[] { getColor(), getHighColor(), getLastColor(), getBackground(), getWidth(), getHeight(), getSpacing(), getOutput() }; try { for (int i = 0; i < n.length; i++) { if (!StringUtils.isEmpty(p[i])) { sb.append("&").append(n[i]).append("=").append(URLEncoder.encode(p[i], "UTF-8")); } } } catch (final UnsupportedEncodingException uee) { // won't happen... } final Number[] data = getData(); if (data != null && data.length > 0) { sb.append("&data="); sb.append(StringUtils.toString(data)); } return sb.toString(); } } spark-1.2-src/src/com/representqueens/web/tags/spark/BarGraph.java000644 000765 000024 00000002522 10575064532 025546 0ustar00larrystaff000000 000000 /* * $Id: BarGraph.java,v 1.3 2007-03-11 20:40:58 larry Exp $ */ package com.representqueens.web.tags.spark; /* * * Copyright 2007 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.io.IOException; /** * @author Larry Ogrodnek * @version $Revision: 1.3 $ $Date: 2007-03-11 20:40:58 $ */ public final class BarGraph extends AbstractServerGraph { @Override public int doEndTag() { try { this.pageContext.getOut().write(constructImagePath()); } catch (final IOException ioe) { // nothing to do... } return EVAL_PAGE; } public String constructImagePath() { final StringBuilder sb = new StringBuilder(); sb.append(String.format("%s?type=bar%s", getRealPath(), getQueryParams())); return sb.toString(); } } spark-1.2-src/src/com/representqueens/web/tags/spark/embedded/000755 000765 000024 00000000000 11474330050 024733 5ustar00larrystaff000000 000000 spark-1.2-src/src/com/representqueens/web/tags/spark/LineGraph.java000644 000765 000024 00000002525 10575064532 025734 0ustar00larrystaff000000 000000 /* * $Id: LineGraph.java,v 1.3 2007-03-11 20:40:58 larry Exp $ */ package com.representqueens.web.tags.spark; /* * * Copyright 2007 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.io.IOException; /** * @author Larry Ogrodnek * @version $Revision: 1.3 $ $Date: 2007-03-11 20:40:58 $ */ public final class LineGraph extends AbstractServerGraph { @Override public int doEndTag() { try { this.pageContext.getOut().write(constructImagePath()); } catch (final IOException ioe) { // nothing to do... } return EVAL_PAGE; } public String constructImagePath() { final StringBuilder sb = new StringBuilder(); sb.append(String.format("%s?type=line%s", getRealPath(), getQueryParams())); return sb.toString(); } } spark-1.2-src/src/com/representqueens/web/tags/spark/embedded/BarGraph.java000644 000765 000024 00000002256 10572077361 027304 0ustar00larrystaff000000 000000 /* * $Id: BarGraph.java,v 1.1 2007-03-02 19:45:53 larry Exp $ */ package com.representqueens.web.tags.spark.embedded; /* * * Copyright 2006 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.io.IOException; import com.representqueens.web.tags.spark.AbstractGraph; /** * @author Larry Ogrodnek * @version $Revision: 1.1 $ $Date: 2007-03-02 19:45:53 $ */ public class BarGraph extends AbstractGraph { @Override public int doEndTag() { try { this.pageContext.getOut().write(getBarGraphData()); } catch (final IOException ioe) { // what can we do? } return EVAL_PAGE; } } spark-1.2-src/src/com/representqueens/web/tags/spark/embedded/LineGraph.java000644 000765 000024 00000002261 10572077361 027463 0ustar00larrystaff000000 000000 /* * $Id: LineGraph.java,v 1.1 2007-03-02 19:45:53 larry Exp $ */ package com.representqueens.web.tags.spark.embedded; /* * * Copyright 2006 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.io.IOException; import com.representqueens.web.tags.spark.AbstractGraph; /** * @author Larry Ogrodnek * @version $Revision: 1.1 $ $Date: 2007-03-02 19:45:53 $ */ public class LineGraph extends AbstractGraph { @Override public int doEndTag() { try { this.pageContext.getOut().write(getLineGraphData()); } catch (final IOException ioe) { // what can we do? } return EVAL_PAGE; } } spark-1.2-src/src/com/representqueens/util/ColorUtils.java000644 000765 000024 00000004335 10456770620 024305 0ustar00larrystaff000000 000000 /* * $Id: ColorUtils.java,v 1.2 2006/07/17 20:22:40 larry Exp $ */ package com.representqueens.util; /* * * Copyright 2006 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.awt.Color; import java.lang.reflect.Field; import java.lang.reflect.Modifier; /** * Utility methods for parsing Strings into Color Objects. * * @author Larry Ogrodnek * @version $Revision: 1.2 $ $Date: 2006/07/17 20:22:40 $ */ public final class ColorUtils { private ColorUtils() { } /** * Parse a String into a Color. * * This method will accept either a color name (a field name from {@link Color}, * case insensitive e.g. "red"), or a HTML hex color string (e.g. "#ff0000" * for Color.RED). * * @param s String to parse for color name or color number. * @return Color for s. */ public static Color parseColor(final String s) { Color color = null; if (! StringUtils.isEmpty(s)) { try { color = Color.decode(s); } catch (final NumberFormatException nfe) { color = colorByField(s); } } return color; } private static Color colorByField(final String _s) { final Field[] fields = Color.class.getFields(); final String s = _s.toLowerCase(); try { for (final Field f : fields) { if (f.getName().toLowerCase().equals(s)) { final int mod = f.getModifiers(); if (Modifier.isStatic(mod) && Modifier.isPublic(mod) && Color.class.equals(f.getType())) { return (Color) f.get(null); } } } } catch (final IllegalAccessException iae) { // ? } return null; } } spark-1.2-src/src/com/representqueens/util/StringUtils.java000644 000765 000024 00000004166 10572077361 024500 0ustar00larrystaff000000 000000 /* * $Id: StringUtils.java,v 1.5 2007-03-02 19:45:53 larry Exp $ */ package com.representqueens.util; /* * * Copyright 2006 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; /** * Some simple String utilities. * * @author Larry Ogrodnek * @version $Revision: 1.5 $ $Date: 2007-03-02 19:45:53 $ */ public final class StringUtils { private StringUtils() { } public static boolean isEmpty(final String s) { return (s == null || "".equals(s)); } public static List toIntList(final String s) { return toIntList(s, "\\s*,\\s*"); } public static List toIntList(final String s, final String sep) { if (isEmpty(s)) { return Collections.emptyList(); } final String[] n = s.split(sep); final List ret = new ArrayList(n.length); for (int i=0; i< n.length; i++) { ret.add(Integer.parseInt(n[i])); } return ret; } public static String toString(final Number[] data) { return toString(Arrays.asList(data)); } public static String toString(final List data) { if (data.size() == 0) { return ""; } if (data.size() == 1) { return data.get(0).toString(); } final StringBuilder sb = new StringBuilder(); for (int i=0; i< data.size() - 1; i++) { sb.append(data.get(i)).append(","); } sb.append(data.get(data.size() - 1)); return sb.toString(); } } spark-1.2-src/src/com/representqueens/spark/BarGraph.java000644 000765 000024 00000010670 10575064532 024036 0ustar00larrystaff000000 000000 /* * $Id: BarGraph.java,v 1.6 2007-03-11 20:40:58 larry Exp $ */ package com.representqueens.spark; /* * * Copyright 2006 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.awt.Color; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; /** * Bargraph generation. * * @author Larry Ogrodnek * @version $Revision: 1.6 $ $Date: 2007-03-11 20:40:58 $ */ public class BarGraph { public static final int DEFAULT_WIDTH = 100; public static final int DEFAULT_HEIGHT = 25; public static final int DEFAULT_SPACING = 2; public static final SizeParams DEFAULT_SIZE = new SizeParams(DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_SPACING); public static final Color DEFAULT_COLOR = Color.GRAY; public static final Color DEFAULT_HIGH_COLOR = Color.BLACK; public static final Color DEFAULT_LAST_COLOR = Color.RED; /** * Create a Bargraph from an array of numbers, using default colors and sizes. * * @param data Array of Number Objects. * * @return BufferedImage containing a Bargraph of data. */ public static BufferedImage createGraph(final Number[] data) { return createGraph(data, DEFAULT_SIZE, DEFAULT_COLOR, DEFAULT_HIGH_COLOR, DEFAULT_LAST_COLOR); } /** * Create a Bargraph. * * @param data Array of Number Objects to graph. * @param size SizeParams specifying graph size attributes. * @param color main graph color * @param highColor color for above average data points (or null). * @param lastColor color for last data point (or null). * * @return BufferedImage containing a Bargraph of data. */ public static BufferedImage createGraph(final Number[] data, final SizeParams size, final Color color, final Color highColor, final Color lastColor) { return createGraph(data, size, color, highColor, lastColor, null); } /** * Create a Bargraph. * * @param data Array of Number Objects to graph. * @param size SizeParams specifying graph size attributes. * @param color main graph color * @param highColor color for above average data points (or null). * @param lastColor color for last data point (or null). * @param background background color, or null for transparency. * * @return BufferedImage containing a Bargraph of data. */ public static BufferedImage createGraph(final Number[] data, final SizeParams size, final Color color, final Color highColor, final Color lastColor, final Color background) { final BufferedImage bi = new BufferedImage(size.getWidth(), size.getHeight(), BufferedImage.TYPE_INT_ARGB); if (data == null || data.length < 1) { return bi; } final Graphics2D g = bi.createGraphics(); //g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if (background != null) { g.setBackground(background); g.clearRect(0, 0, size.getWidth(), size.getHeight()); } final float d = GraphUtils.getDivisor(data, size.getHeight()); final int a = getAvg(data); final int w = (size.getWidth() - (size.getSpacing() * data.length))/ data.length; int x = 0; final int y = 0; int c = 0; for (final Number i : data) { final int h = (int) (i.floatValue() / d); if (c == (data.length - 1) && lastColor != null) { g.setPaint(lastColor); } else if (i.intValue() < a || (highColor == null)) { g.setPaint(color); } else { g.setPaint(highColor); } g.fill(new Rectangle2D.Double(x, y + (size.getHeight() - h), w, i.intValue() / d)); x+=(w + size.getSpacing()); c++; } return bi; } private static final int getAvg(final Number[] data) { int total = 0; for (final Number i : data) { total += i.intValue(); } return (total / data.length); } } spark-1.2-src/src/com/representqueens/spark/Encoder.java000644 000765 000024 00000003735 10456770620 023733 0ustar00larrystaff000000 000000 /* * $Id: Encoder.java,v 1.2 2006/07/17 20:22:40 larry Exp $ */ package com.representqueens.spark; /* * * Copyright 2006 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import javax.imageio.ImageIO; /** * Encodes Image data as Strings, using code from David Flanagan's * website (http://www.davidflanagan.com/). * * @author David Flanagan * @author Larry Ogrodnek * @version $Revision: 1.2 $ $Date: 2006/07/17 20:22:40 $ */ public class Encoder { public enum Format { DATA, JAVASCRIPT }; public static String encode(final BufferedImage bi, final Format format) throws IOException { try { final ByteArrayOutputStream os = new ByteArrayOutputStream(); ImageIO.write(bi, "png", os); final byte[] data = os.toByteArray(); final String rawString = new String(data, "iso8859-1"); String encoded = URLEncoder.encode(rawString, "iso8859-1"); encoded = encoded.replaceAll("\\+", "%20"); if (Format.JAVASCRIPT.equals(format)) { return "javascript:'" + encoded.replaceAll("%", "\\\\x") + "'"; } return "data:image/png," + encoded; } catch (final UnsupportedEncodingException uee) { throw new RuntimeException(uee); } } } spark-1.2-src/src/com/representqueens/spark/GraphUtils.java000644 000765 000024 00000002346 10552603721 024425 0ustar00larrystaff000000 000000 /* * $Id: GraphUtils.java,v 1.3 2007-01-15 04:49:21 larry Exp $ */ package com.representqueens.spark; /* * * Copyright 2006 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @author Larry Ogrodnek * @version $Revision: 1.3 $ $Date: 2007-01-15 04:49:21 $ */ final class GraphUtils { private GraphUtils() { } static final float getDivisor(final Number[] data, final int height) { float max = Float.MIN_VALUE; float min = Float.MAX_VALUE; for (final Number i : data) { min = Math.min(min,i.floatValue()); max = Math.max(max,i.floatValue()); } if (max <= min) { return 1.0f; } return (max-min)/(height-1); } } spark-1.2-src/src/com/representqueens/spark/LineGraph.java000644 000765 000024 00000007324 10575064532 024223 0ustar00larrystaff000000 000000 /* * $Id: LineGraph.java,v 1.7 2007-03-11 20:40:58 larry Exp $ */ package com.representqueens.spark; /* * * Copyright 2006 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.awt.Color; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.geom.Line2D; import java.awt.image.BufferedImage; /** * Linegraph generation. * * @author Larry Ogrodnek * @version $Revision: 1.7 $ $Date: 2007-03-11 20:40:58 $ */ public class LineGraph { private static final int WIDTH = 100; private static final int HEIGHT = 25; private static final int SPACING = 2; public static final SizeParams DEFAULT_SIZE = new SizeParams(WIDTH, HEIGHT, SPACING); public static final Color DEFAULT_COLOR = Color.GRAY; /** * Create a Linegraph using defaults. * * @param data Array of Number Objects to graph. * * @return BufferedImage containing a Linegraph of data. */ public static BufferedImage createGraph(final Number[] data) { return createGraph(data, DEFAULT_SIZE, DEFAULT_COLOR); } /** * Create a Linegraph. * * @param data Array of Number Objects to graph. * @param size SizeParams specifying graph size attributes. * @param color graph Color. * * @return BufferedImage containing a Linegraph of data. */ public static BufferedImage createGraph(final Number[] data, final SizeParams size, final Color color) { return createGraph(data, size, color, null); } /** * Create a Linegraph. * * @param data Array of Number Objects to graph. * @param size SizeParams specifying graph size attributes. * @param color graph Color. * @param background background color, or null for transparent. * * @return BufferedImage containing a Linegraph of data. */ public static BufferedImage createGraph(final Number[] data, final SizeParams size, final Color color, final Color background) { final BufferedImage bi = new BufferedImage(size.getWidth(), size.getHeight(), BufferedImage.TYPE_INT_ARGB); if (data == null || data.length < 2) { return bi; } final Graphics2D g = bi.createGraphics(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if (background != null) { g.setBackground(background); g.clearRect(0, 0, size.getWidth(), size.getHeight()); } float d = GraphUtils.getDivisor(data, size.getHeight()); final int w = (size.getWidth() - (size.getSpacing() * (data.length -1)))/ (data.length - 1); float min = Float.MAX_VALUE; for (final Number i : data) { min = Math.min(min,i.floatValue()); } int x = 0; int y = -1; if (d == 0.0) { //special case -- a horizontal straight line d = 1.0f; y = - size.getHeight()/2; } for (int i=0; i< data.length - 1; i++) { final int px1 = x; x+= (w + size.getSpacing()); final int px2 = x; g.setPaint(color); g.draw(new Line2D.Double(px1, y + (size.getHeight() - ((data[i].floatValue()-min) / d)), px2, y + (size.getHeight() - ((data[i+1].floatValue()-min) / d)))); } return bi; } } spark-1.2-src/src/com/representqueens/spark/service/000755 000765 000024 00000000000 11474330050 023127 5ustar00larrystaff000000 000000 spark-1.2-src/src/com/representqueens/spark/SizeParams.java000644 000765 000024 00000003332 10456770620 024423 0ustar00larrystaff000000 000000 /* * $Id: SizeParams.java,v 1.2 2006/07/17 20:22:40 larry Exp $ */ package com.representqueens.spark; /* * * Copyright 2006 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Graph size attributes. * * @author Larry Ogrodnek * @version $Revision: 1.2 $ $Date: 2006/07/17 20:22:40 $ */ public final class SizeParams { private final int width; private final int height; private final int spacing; /** * Constructor. * * @param width graph width (in pixels). * @param height graph height (in pixels). * @param spacing spacing between data points (in pixels). */ public SizeParams(final int width, final int height, final int spacing) { this.width = width; this.height = height; this.spacing = spacing; } /** * Get the graph height. * @return graph height (in pixels). */ public int getHeight() { return this.height; } /** * Get the spacing between data points. * @return spacing between data points (in pixels). */ public int getSpacing() { return this.spacing; } /** * Get the graph width. * @return graph width (in pixels). */ public int getWidth() { return this.width; } } spark-1.2-src/src/com/representqueens/spark/util/000755 000765 000024 00000000000 11474330050 022444 5ustar00larrystaff000000 000000 spark-1.2-src/src/com/representqueens/spark/util/StringConversion.java000644 000765 000024 00000003635 11474327771 026652 0ustar00larrystaff000000 000000 package com.representqueens.spark.util; /* * * Copyright 2006 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.awt.Color; import java.util.ArrayList; import java.util.List; import com.representqueens.util.ColorUtils; import com.representqueens.util.StringUtils; /** * * @author Larry Ogrodnek * @version $Revision: 1.1 $ $Date: 2006-11-20 02:58:38 $ */ public final class StringConversion { private StringConversion() { } public static final Number[] getData(final String s) { final String[] data = s.split(","); final List out = new ArrayList(data.length); for (final String d : data) { out.add(Float.parseFloat(d)); } return out.toArray(new Number[out.size()]); } public static final Color convertColor(final String s, final Color defValue) { Color color = null; if (!StringUtils.isEmpty(s)) { color = ColorUtils.parseColor(s); } return (color == null ? defValue : color); } public static final int convertInt(final String s, final int defValue) { if (! StringUtils.isEmpty(s)) { try { return Integer.parseInt(s); } catch (final NumberFormatException nfe) { // fall through, return default } } return defValue; } } spark-1.2-src/src/com/representqueens/spark/service/SparkController.java000644 000765 000024 00000007076 10575064532 027142 0ustar00larrystaff000000 000000 /* * $Id: SparkController.java,v 1.3 2007-03-11 20:40:58 larry Exp $ */ package com.representqueens.spark.service; /* * * Copyright 2007 Larry Ogrodnek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.representqueens.spark.BarGraph; import com.representqueens.spark.LineGraph; import com.representqueens.spark.SizeParams; import com.representqueens.spark.util.StringConversion; import com.representqueens.util.StringUtils; /** * @author Larry Ogrodnek * @version $Revision: 1.3 $ $Date: 2007-03-11 20:40:58 $ */ public final class SparkController extends HttpServlet { @Override public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws IOException { final Number[] data = StringConversion.getData(request.getParameter("data")); final String type = request.getParameter("type"); final BufferedImage image; if (type != null && type.equals("line")) { image = LineGraph.createGraph(data, getSizeParams(request, LineGraph.DEFAULT_SIZE), StringConversion.convertColor(request.getParameter("color"), LineGraph.DEFAULT_COLOR), StringConversion.convertColor(request.getParameter("background"), null)); } else { image = BarGraph.createGraph(data, getSizeParams(request, BarGraph.DEFAULT_SIZE), StringConversion.convertColor(request.getParameter("color"), BarGraph.DEFAULT_COLOR), StringConversion.convertColor(request.getParameter("highcolor"), null), StringConversion.convertColor(request.getParameter("lastcolor"), null), StringConversion.convertColor(request.getParameter("background"), null)); } final String _output = request.getParameter("output"); final String output = StringUtils.isEmpty(_output) ? "png" : _output; response.setContentType("image/" + output); ImageIO.write(image, output, response.getOutputStream()); response.getOutputStream().close(); } @Override public void doPut(final HttpServletRequest request, final HttpServletResponse response) throws IOException { doGet(request, response); } private static SizeParams getSizeParams(final HttpServletRequest request, final SizeParams defaults) { return new SizeParams(StringConversion.convertInt(request.getParameter("width"), defaults.getWidth()), StringConversion.convertInt(request.getParameter("height"), defaults.getHeight()), StringConversion.convertInt(request.getParameter("spacing"), defaults.getSpacing())); } } spark-1.2-src/docs/allclasses-frame.html000644 000765 000024 00000005335 10572117021 020613 0ustar00larrystaff000000 000000 All Classes All Classes
AbstractGraph
AbstractServerGraph
BarGraph
BarGraph
BarGraph
ColorUtils
Encoder
Encoder.Format
LineGraph
LineGraph
LineGraph
SizeParams
SparkController
StringConversion
StringUtils
spark-1.2-src/docs/allclasses-noframe.html000644 000765 000024 00000004661 10572117021 021151 0ustar00larrystaff000000 000000 All Classes All Classes
AbstractGraph
AbstractServerGraph
BarGraph
BarGraph
BarGraph
ColorUtils
Encoder
Encoder.Format
LineGraph
LineGraph
LineGraph
SizeParams
SparkController
StringConversion
StringUtils
spark-1.2-src/docs/com/000755 000765 000024 00000000000 10572117017 015264 5ustar00larrystaff000000 000000 spark-1.2-src/docs/constant-values.html000644 000765 000024 00000014717 10572117020 020526 0ustar00larrystaff000000 000000 Constant Field Values

Constant Field Values


Contents
com.representqueens.*

com.representqueens.spark.BarGraph
public static final int DEFAULT_HEIGHT 25
public static final int DEFAULT_SPACING 2
public static final int DEFAULT_WIDTH 100



spark-1.2-src/docs/deprecated-list.html000644 000765 000024 00000011240 10572117021 020436 0ustar00larrystaff000000 000000 Deprecated List

Deprecated API


Contents


spark-1.2-src/docs/help-doc.html000644 000765 000024 00000021243 10572117021 017064 0ustar00larrystaff000000 000000 API Help

How This API Document Is Organized

This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.

Overview

The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

Package

Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:

  • Interfaces (italic)
  • Classes
  • Enums
  • Exceptions
  • Errors
  • Annotation Types

Class/Interface

Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

  • Class inheritance diagram
  • Direct Subclasses
  • All Known Subinterfaces
  • All Known Implementing Classes
  • Class/interface declaration
  • Class/interface description

  • Nested Class Summary
  • Field Summary
  • Constructor Summary
  • Method Summary

  • Field Detail
  • Constructor Detail
  • Method Detail
Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

Annotation Type

Each annotation type has its own separate page with the following sections:

  • Annotation Type declaration
  • Annotation Type description
  • Required Element Summary
  • Optional Element Summary
  • Element Detail

Enum

Each enum has its own separate page with the following sections:

  • Enum declaration
  • Enum description
  • Enum Constant Summary
  • Enum Constant Detail

Tree (Class Hierarchy)

There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
  • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
  • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.

Deprecated API

The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

Index

The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

Prev/Next

These links take you to the next or previous class, interface, package, or related page.

Frames/No Frames

These links show and hide the HTML frames. All pages are available with or without frames.

Serialized Form

Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

Constant Field Values

The Constant Field Values page lists the static final fields and their values.

This help file applies to API documentation generated using the standard doclet.



spark-1.2-src/docs/index-all.html000644 000765 000024 00000101435 10572117021 017250 0ustar00larrystaff000000 000000 Index
A B C D E G I L P S T V

A

AbstractGraph - Class in com.representqueens.web.tags.spark
 
AbstractGraph() - Constructor for class com.representqueens.web.tags.spark.AbstractGraph
 
AbstractServerGraph - Class in com.representqueens.web.tags.spark
 
AbstractServerGraph() - Constructor for class com.representqueens.web.tags.spark.AbstractServerGraph
 

B

BarGraph - Class in com.representqueens.spark
Bargraph generation.
BarGraph() - Constructor for class com.representqueens.spark.BarGraph
 
BarGraph - Class in com.representqueens.web.tags.spark
 
BarGraph() - Constructor for class com.representqueens.web.tags.spark.BarGraph
 
BarGraph - Class in com.representqueens.web.tags.spark.embedded
 
BarGraph() - Constructor for class com.representqueens.web.tags.spark.embedded.BarGraph
 

C

ColorUtils - Class in com.representqueens.util
Utility methods for parsing Strings into Color Objects.
com.representqueens.spark - package com.representqueens.spark
 
com.representqueens.spark.service - package com.representqueens.spark.service
 
com.representqueens.spark.util - package com.representqueens.spark.util
 
com.representqueens.util - package com.representqueens.util
 
com.representqueens.web.tags.spark - package com.representqueens.web.tags.spark
 
com.representqueens.web.tags.spark.embedded - package com.representqueens.web.tags.spark.embedded
 
constructImagePath() - Method in class com.representqueens.web.tags.spark.BarGraph
 
constructImagePath() - Method in class com.representqueens.web.tags.spark.LineGraph
 
convertColor(String, Color) - Static method in class com.representqueens.spark.util.StringConversion
 
convertInt(String, int) - Static method in class com.representqueens.spark.util.StringConversion
 
createGraph(Number[]) - Static method in class com.representqueens.spark.BarGraph
Create a Bargraph from an array of numbers, using default colors and sizes.
createGraph(Number[], SizeParams, Color, Color, Color) - Static method in class com.representqueens.spark.BarGraph
Create a Bargraph.
createGraph(Number[]) - Static method in class com.representqueens.spark.LineGraph
Create a Linegraph using defaults.
createGraph(Number[], SizeParams, Color) - Static method in class com.representqueens.spark.LineGraph
Create a Linegraph.

D

DEFAULT_COLOR - Static variable in class com.representqueens.spark.BarGraph
 
DEFAULT_COLOR - Static variable in class com.representqueens.spark.LineGraph
 
DEFAULT_HEIGHT - Static variable in class com.representqueens.spark.BarGraph
 
DEFAULT_HIGH_COLOR - Static variable in class com.representqueens.spark.BarGraph
 
DEFAULT_LAST_COLOR - Static variable in class com.representqueens.spark.BarGraph
 
DEFAULT_SIZE - Static variable in class com.representqueens.spark.BarGraph
 
DEFAULT_SIZE - Static variable in class com.representqueens.spark.LineGraph
 
DEFAULT_SPACING - Static variable in class com.representqueens.spark.BarGraph
 
DEFAULT_WIDTH - Static variable in class com.representqueens.spark.BarGraph
 
doEndTag() - Method in class com.representqueens.web.tags.spark.BarGraph
 
doEndTag() - Method in class com.representqueens.web.tags.spark.embedded.BarGraph
 
doEndTag() - Method in class com.representqueens.web.tags.spark.embedded.LineGraph
 
doEndTag() - Method in class com.representqueens.web.tags.spark.LineGraph
 
doGet(HttpServletRequest, HttpServletResponse) - Method in class com.representqueens.spark.service.SparkController
 
doPut(HttpServletRequest, HttpServletResponse) - Method in class com.representqueens.spark.service.SparkController
 

E

encode(BufferedImage, Encoder.Format) - Static method in class com.representqueens.spark.Encoder
 
Encoder - Class in com.representqueens.spark
Encodes Image data as Strings, using code from David Flanagan's website (http://www.davidflanagan.com/).
Encoder() - Constructor for class com.representqueens.spark.Encoder
 
Encoder.Format - Enum in com.representqueens.spark
 

G

getBarGraphData() - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
getColor() - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
getData(String) - Static method in class com.representqueens.spark.util.StringConversion
 
getData() - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
getHeight() - Method in class com.representqueens.spark.SizeParams
Get the graph height.
getHeight() - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
getHighColor() - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
getLastColor() - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
getLineGraphData() - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
getName() - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
getOutput() - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
getOutputFormat() - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
getPath() - Method in class com.representqueens.web.tags.spark.AbstractServerGraph
 
getQueryParams() - Method in class com.representqueens.web.tags.spark.AbstractServerGraph
 
getRealPath() - Method in class com.representqueens.web.tags.spark.AbstractServerGraph
 
getSizeParams(SizeParams) - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
getSpacing() - Method in class com.representqueens.spark.SizeParams
Get the spacing between data points.
getSpacing() - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
getWidth() - Method in class com.representqueens.spark.SizeParams
Get the graph width.
getWidth() - Method in class com.representqueens.web.tags.spark.AbstractGraph
 

I

isEmpty(String) - Static method in class com.representqueens.util.StringUtils
 

L

LineGraph - Class in com.representqueens.spark
Linegraph generation.
LineGraph() - Constructor for class com.representqueens.spark.LineGraph
 
LineGraph - Class in com.representqueens.web.tags.spark.embedded
 
LineGraph() - Constructor for class com.representqueens.web.tags.spark.embedded.LineGraph
 
LineGraph - Class in com.representqueens.web.tags.spark
 
LineGraph() - Constructor for class com.representqueens.web.tags.spark.LineGraph
 

P

parseColor(String) - Static method in class com.representqueens.util.ColorUtils
Parse a String into a Color.

S

setColor(String) - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
setHeight(String) - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
setHighColor(String) - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
setLastColor(String) - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
setName(String) - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
setOutput(String) - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
setPath(String) - Method in class com.representqueens.web.tags.spark.AbstractServerGraph
 
setSpacing(String) - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
setWidth(String) - Method in class com.representqueens.web.tags.spark.AbstractGraph
 
SizeParams - Class in com.representqueens.spark
Graph size attributes.
SizeParams(int, int, int) - Constructor for class com.representqueens.spark.SizeParams
Constructor.
SparkController - Class in com.representqueens.spark.service
 
SparkController() - Constructor for class com.representqueens.spark.service.SparkController
 
StringConversion - Class in com.representqueens.spark.util
 
StringUtils - Class in com.representqueens.util
Some simple String utilities.

T

toIntList(String) - Static method in class com.representqueens.util.StringUtils
 
toIntList(String, String) - Static method in class com.representqueens.util.StringUtils
 
toString(Number[]) - Static method in class com.representqueens.util.StringUtils
 
toString(List<? extends Number>) - Static method in class com.representqueens.util.StringUtils
 

V

valueOf(String) - Static method in enum com.representqueens.spark.Encoder.Format
Returns the enum constant of this type with the specified name.
values() - Static method in enum com.representqueens.spark.Encoder.Format
Returns an array containing the constants of this enum type, in the order they're declared.

A B C D E G I L P S T V

spark-1.2-src/docs/index.html000644 000765 000024 00000002475 10572117021 016506 0ustar00larrystaff000000 000000 Generated Documentation (Untitled) <H2> Frame Alert</H2> <P> This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. <BR> Link to<A HREF="overview-summary.html">Non-frame version.</A> spark-1.2-src/docs/overview-frame.html000644 000765 000024 00000003365 10572117020 020333 0ustar00larrystaff000000 000000 Overview
All Classes

Packages
com.representqueens.spark
com.representqueens.spark.service
com.representqueens.spark.util
com.representqueens.util
com.representqueens.web.tags.spark
com.representqueens.web.tags.spark.embedded

  spark-1.2-src/docs/overview-summary.html000644 000765 000024 00000013701 10572117021 020732 0ustar00larrystaff000000 000000 Overview


Packages
com.representqueens.spark  
com.representqueens.spark.service  
com.representqueens.spark.util  
com.representqueens.util  
com.representqueens.web.tags.spark  
com.representqueens.web.tags.spark.embedded  

 



spark-1.2-src/docs/overview-tree.html000644 000765 000024 00000020345 10572117020 020175 0ustar00larrystaff000000 000000 Class Hierarchy

Hierarchy For All Packages

Package Hierarchies:
com.representqueens.spark, com.representqueens.spark.service, com.representqueens.spark.util, com.representqueens.util, com.representqueens.web.tags.spark, com.representqueens.web.tags.spark.embedded

Class Hierarchy

Enum Hierarchy

  • java.lang.Object
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable)


spark-1.2-src/docs/package-list000644 000765 000024 00000000303 10572117020 016763 0ustar00larrystaff000000 000000 com.representqueens.spark com.representqueens.spark.service com.representqueens.spark.util com.representqueens.util com.representqueens.web.tags.spark com.representqueens.web.tags.spark.embedded spark-1.2-src/docs/resources/000755 000765 000024 00000000000 10572117020 016512 5ustar00larrystaff000000 000000 spark-1.2-src/docs/stylesheet.css000644 000765 000024 00000002262 10572117021 017406 0ustar00larrystaff000000 000000 /* Javadoc style sheet */ /* Define colors, fonts and other style attributes here to override the defaults */ /* Page background color */ body { background-color: #FFFFFF } /* Headings */ h1 { font-size: 145% } /* Table colors */ .TableHeadingColor { background: #CCCCFF } /* Dark mauve */ .TableSubHeadingColor { background: #EEEEFF } /* Light mauve */ .TableRowColor { background: #FFFFFF } /* White */ /* Font used in left-hand frame lists */ .FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif } .FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif } .FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif } /* Navigation bar fonts and colors */ .NavBarCell1 { background-color:#EEEEFF;} /* Light mauve */ .NavBarCell1Rev { background-color:#00008B;} /* Dark Blue */ .NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;} .NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;} .NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} .NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} spark-1.2-src/docs/resources/inherit.gif000644 000765 000024 00000000071 10572117020 020641 0ustar00larrystaff000000 000000 GIF89a€ÿÿÿ,„ ¡½®DršjñÔ;߀Q@–¦…N;spark-1.2-src/docs/com/representqueens/000755 000765 000024 00000000000 10572117020 020506 5ustar00larrystaff000000 000000 spark-1.2-src/docs/com/representqueens/spark/000755 000765 000024 00000000000 10572117020 021626 5ustar00larrystaff000000 000000 spark-1.2-src/docs/com/representqueens/util/000755 000765 000024 00000000000 10572117020 021463 5ustar00larrystaff000000 000000 spark-1.2-src/docs/com/representqueens/web/000755 000765 000024 00000000000 10572117017 021271 5ustar00larrystaff000000 000000 spark-1.2-src/docs/com/representqueens/web/tags/000755 000765 000024 00000000000 10572117017 022227 5ustar00larrystaff000000 000000 spark-1.2-src/docs/com/representqueens/web/tags/spark/000755 000765 000024 00000000000 10572117020 023341 5ustar00larrystaff000000 000000 spark-1.2-src/docs/com/representqueens/web/tags/spark/AbstractGraph.html000644 000765 000024 00000052767 10572117017 027003 0ustar00larrystaff000000 000000 AbstractGraph

com.representqueens.web.tags.spark
Class AbstractGraph

java.lang.Object
  extended by TagSupport
      extended by com.representqueens.web.tags.spark.AbstractGraph
Direct Known Subclasses:
AbstractServerGraph, BarGraph, LineGraph

public abstract class AbstractGraph
extends TagSupport


Constructor Summary
AbstractGraph()
           
 
Method Summary
protected  java.lang.String getBarGraphData()
           
 java.lang.String getColor()
           
protected  java.lang.Number[] getData()
           
 java.lang.String getHeight()
           
 java.lang.String getHighColor()
           
 java.lang.String getLastColor()
           
protected  java.lang.String getLineGraphData()
           
 java.lang.String getName()
           
 java.lang.String getOutput()
           
protected  Encoder.Format getOutputFormat()
           
protected  SizeParams getSizeParams(SizeParams defaults)
           
 java.lang.String getSpacing()
           
 java.lang.String getWidth()
           
 void setColor(java.lang.String color)
           
 void setHeight(java.lang.String height)
           
 void setHighColor(java.lang.String highColor)
           
 void setLastColor(java.lang.String lastColor)
           
 void setName(java.lang.String name)
           
 void setOutput(java.lang.String output)
           
 void setSpacing(java.lang.String spacing)
           
 void setWidth(java.lang.String width)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGraph

public AbstractGraph()
Method Detail

getColor

public java.lang.String getColor()

setColor

public void setColor(java.lang.String color)

getHeight

public java.lang.String getHeight()

setHeight

public void setHeight(java.lang.String height)

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getOutput

public java.lang.String getOutput()

setOutput

public void setOutput(java.lang.String output)

getSpacing

public java.lang.String getSpacing()

setSpacing

public void setSpacing(java.lang.String spacing)

getWidth

public java.lang.String getWidth()

setWidth

public void setWidth(java.lang.String width)

getHighColor

public java.lang.String getHighColor()

setHighColor

public void setHighColor(java.lang.String highColor)

getLastColor

public java.lang.String getLastColor()

setLastColor

public void setLastColor(java.lang.String lastColor)

getBarGraphData

protected java.lang.String getBarGraphData()
                                    throws java.io.IOException
Throws:
java.io.IOException

getLineGraphData

protected java.lang.String getLineGraphData()
                                     throws java.io.IOException
Throws:
java.io.IOException

getSizeParams

protected SizeParams getSizeParams(SizeParams defaults)

getData

protected java.lang.Number[] getData()

getOutputFormat

protected Encoder.Format getOutputFormat()


spark-1.2-src/docs/com/representqueens/web/tags/spark/AbstractServerGraph.html000644 000765 000024 00000035570 10572117017 030163 0ustar00larrystaff000000 000000 AbstractServerGraph

com.representqueens.web.tags.spark
Class AbstractServerGraph

java.lang.Object
  extended by TagSupport
      extended by com.representqueens.web.tags.spark.AbstractGraph
          extended by com.representqueens.web.tags.spark.AbstractServerGraph
Direct Known Subclasses:
BarGraph, LineGraph

public abstract class AbstractServerGraph
extends AbstractGraph


Constructor Summary
AbstractServerGraph()
           
 
Method Summary
 java.lang.String getPath()
           
protected  java.lang.String getQueryParams()
           
 java.lang.String getRealPath()
           
 void setPath(java.lang.String path)
           
 
Methods inherited from class com.representqueens.web.tags.spark.AbstractGraph
getBarGraphData, getColor, getData, getHeight, getHighColor, getLastColor, getLineGraphData, getName, getOutput, getOutputFormat, getSizeParams, getSpacing, getWidth, setColor, setHeight, setHighColor, setLastColor, setName, setOutput, setSpacing, setWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractServerGraph

public AbstractServerGraph()
Method Detail

getPath

public java.lang.String getPath()

setPath

public void setPath(java.lang.String path)

getRealPath

public java.lang.String getRealPath()

getQueryParams

protected java.lang.String getQueryParams()


spark-1.2-src/docs/com/representqueens/web/tags/spark/BarGraph.html000644 000765 000024 00000035120 10572117017 025724 0ustar00larrystaff000000 000000 BarGraph

com.representqueens.web.tags.spark
Class BarGraph

java.lang.Object
  extended by TagSupport
      extended by com.representqueens.web.tags.spark.AbstractGraph
          extended by com.representqueens.web.tags.spark.AbstractServerGraph
              extended by com.representqueens.web.tags.spark.BarGraph

public final class BarGraph
extends AbstractServerGraph


Constructor Summary
BarGraph()
           
 
Method Summary
 java.lang.String constructImagePath()
           
 int doEndTag()
           
 
Methods inherited from class com.representqueens.web.tags.spark.AbstractServerGraph
getPath, getQueryParams, getRealPath, setPath
 
Methods inherited from class com.representqueens.web.tags.spark.AbstractGraph
getBarGraphData, getColor, getData, getHeight, getHighColor, getLastColor, getLineGraphData, getName, getOutput, getOutputFormat, getSizeParams, getSpacing, getWidth, setColor, setHeight, setHighColor, setLastColor, setName, setOutput, setSpacing, setWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BarGraph

public BarGraph()
Method Detail

doEndTag

public int doEndTag()

constructImagePath

public java.lang.String constructImagePath()


spark-1.2-src/docs/com/representqueens/web/tags/spark/embedded/000755 000765 000024 00000000000 10572117020 025072 5ustar00larrystaff000000 000000 spark-1.2-src/docs/com/representqueens/web/tags/spark/LineGraph.html000644 000765 000024 00000034470 10572117017 026116 0ustar00larrystaff000000 000000 LineGraph

com.representqueens.web.tags.spark
Class LineGraph

java.lang.Object
  extended by TagSupport
      extended by com.representqueens.web.tags.spark.AbstractGraph
          extended by com.representqueens.web.tags.spark.AbstractServerGraph
              extended by com.representqueens.web.tags.spark.LineGraph

public final class LineGraph
extends AbstractServerGraph


Constructor Summary
LineGraph()
           
 
Method Summary
 java.lang.String constructImagePath()
           
 int doEndTag()
           
 
Methods inherited from class com.representqueens.web.tags.spark.AbstractServerGraph
getPath, getQueryParams, getRealPath, setPath
 
Methods inherited from class com.representqueens.web.tags.spark.AbstractGraph
getBarGraphData, getColor, getData, getHeight, getHighColor, getLastColor, getLineGraphData, getName, getOutput, getOutputFormat, getSizeParams, getSpacing, getWidth, setColor, setHeight, setHighColor, setLastColor, setName, setOutput, setSpacing, setWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineGraph

public LineGraph()
Method Detail

doEndTag

public int doEndTag()

constructImagePath

public java.lang.String constructImagePath()


spark-1.2-src/docs/com/representqueens/web/tags/spark/package-frame.html000644 000765 000024 00000002474 10572117020 026721 0ustar00larrystaff000000 000000 com.representqueens.web.tags.spark com.representqueens.web.tags.spark
Classes 
AbstractGraph
AbstractServerGraph
BarGraph
LineGraph
spark-1.2-src/docs/com/representqueens/web/tags/spark/package-summary.html000644 000765 000024 00000015237 10572117020 027325 0ustar00larrystaff000000 000000 com.representqueens.web.tags.spark

Package com.representqueens.web.tags.spark

Class Summary
AbstractGraph  
AbstractServerGraph  
BarGraph  
LineGraph  
 



spark-1.2-src/docs/com/representqueens/web/tags/spark/package-tree.html000644 000765 000024 00000014747 10572117020 026574 0ustar00larrystaff000000 000000 com.representqueens.web.tags.spark Class Hierarchy

Hierarchy For Package com.representqueens.web.tags.spark

Package Hierarchies:
All Packages

Class Hierarchy



spark-1.2-src/docs/com/representqueens/web/tags/spark/embedded/BarGraph.html000644 000765 000024 00000031255 10572117020 027454 0ustar00larrystaff000000 000000 BarGraph

com.representqueens.web.tags.spark.embedded
Class BarGraph

java.lang.Object
  extended by TagSupport
      extended by com.representqueens.web.tags.spark.AbstractGraph
          extended by com.representqueens.web.tags.spark.embedded.BarGraph

public class BarGraph
extends AbstractGraph


Constructor Summary
BarGraph()
           
 
Method Summary
 int doEndTag()
           
 
Methods inherited from class com.representqueens.web.tags.spark.AbstractGraph
getBarGraphData, getColor, getData, getHeight, getHighColor, getLastColor, getLineGraphData, getName, getOutput, getOutputFormat, getSizeParams, getSpacing, getWidth, setColor, setHeight, setHighColor, setLastColor, setName, setOutput, setSpacing, setWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BarGraph

public BarGraph()
Method Detail

doEndTag

public int doEndTag()


spark-1.2-src/docs/com/representqueens/web/tags/spark/embedded/LineGraph.html000644 000765 000024 00000031274 10572117020 027640 0ustar00larrystaff000000 000000 LineGraph

com.representqueens.web.tags.spark.embedded
Class LineGraph

java.lang.Object
  extended by TagSupport
      extended by com.representqueens.web.tags.spark.AbstractGraph
          extended by com.representqueens.web.tags.spark.embedded.LineGraph

public class LineGraph
extends AbstractGraph


Constructor Summary
LineGraph()
           
 
Method Summary
 int doEndTag()
           
 
Methods inherited from class com.representqueens.web.tags.spark.AbstractGraph
getBarGraphData, getColor, getData, getHeight, getHighColor, getLastColor, getLineGraphData, getName, getOutput, getOutputFormat, getSizeParams, getSpacing, getWidth, setColor, setHeight, setHighColor, setLastColor, setName, setOutput, setSpacing, setWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineGraph

public LineGraph()
Method Detail

doEndTag

public int doEndTag()


spark-1.2-src/docs/com/representqueens/web/tags/spark/embedded/package-frame.html000644 000765 000024 00000002164 10572117020 030446 0ustar00larrystaff000000 000000 com.representqueens.web.tags.spark.embedded com.representqueens.web.tags.spark.embedded
Classes 
BarGraph
LineGraph
spark-1.2-src/docs/com/representqueens/web/tags/spark/embedded/package-summary.html000644 000765 000024 00000014214 10572117020 031050 0ustar00larrystaff000000 000000 com.representqueens.web.tags.spark.embedded

Package com.representqueens.web.tags.spark.embedded

Class Summary
BarGraph  
LineGraph  
 



spark-1.2-src/docs/com/representqueens/web/tags/spark/embedded/package-tree.html000644 000765 000024 00000014362 10572117020 030316 0ustar00larrystaff000000 000000 com.representqueens.web.tags.spark.embedded Class Hierarchy

Hierarchy For Package com.representqueens.web.tags.spark.embedded

Package Hierarchies:
All Packages

Class Hierarchy

  • java.lang.Object
    • TagSupport
      • com.representqueens.web.tags.spark.AbstractGraph
        • com.representqueens.web.tags.spark.embedded.BarGraph
        • com.representqueens.web.tags.spark.embedded.LineGraph


spark-1.2-src/docs/com/representqueens/util/ColorUtils.html000644 000765 000024 00000020460 10572117017 024460 0ustar00larrystaff000000 000000 ColorUtils

com.representqueens.util
Class ColorUtils

java.lang.Object
  extended by com.representqueens.util.ColorUtils

public final class ColorUtils
extends java.lang.Object

Utility methods for parsing Strings into Color Objects.


Method Summary
static java.awt.Color parseColor(java.lang.String s)
          Parse a String into a Color.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parseColor

public static java.awt.Color parseColor(java.lang.String s)
Parse a String into a Color. This method will accept either a color name (a field name from Color, case insensitive e.g. "red"), or a HTML hex color string (e.g. "#ff0000" for Color.RED).

Parameters:
s - String to parse for color name or color number.
Returns:
Color for s.


spark-1.2-src/docs/com/representqueens/util/package-frame.html000644 000765 000024 00000001770 10572117020 025041 0ustar00larrystaff000000 000000 com.representqueens.util com.representqueens.util
Classes 
ColorUtils
StringUtils
spark-1.2-src/docs/com/representqueens/util/package-summary.html000644 000765 000024 00000014027 10572117020 025443 0ustar00larrystaff000000 000000 com.representqueens.util

Package com.representqueens.util

Class Summary
ColorUtils Utility methods for parsing Strings into Color Objects.
StringUtils Some simple String utilities.
 



spark-1.2-src/docs/com/representqueens/util/package-tree.html000644 000765 000024 00000013416 10572117020 024706 0ustar00larrystaff000000 000000 com.representqueens.util Class Hierarchy

Hierarchy For Package com.representqueens.util

Package Hierarchies:
All Packages

Class Hierarchy



spark-1.2-src/docs/com/representqueens/util/StringUtils.html000644 000765 000024 00000024774 10572117020 024656 0ustar00larrystaff000000 000000 StringUtils

com.representqueens.util
Class StringUtils

java.lang.Object
  extended by com.representqueens.util.StringUtils

public final class StringUtils
extends java.lang.Object

Some simple String utilities.


Method Summary
static boolean isEmpty(java.lang.String s)
           
static java.util.List<java.lang.Integer> toIntList(java.lang.String s)
           
static java.util.List<java.lang.Integer> toIntList(java.lang.String s, java.lang.String sep)
           
static java.lang.String toString(java.util.List<? extends java.lang.Number> data)
           
static java.lang.String toString(java.lang.Number[] data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isEmpty

public static boolean isEmpty(java.lang.String s)

toIntList

public static java.util.List<java.lang.Integer> toIntList(java.lang.String s)

toIntList

public static java.util.List<java.lang.Integer> toIntList(java.lang.String s,
                                                          java.lang.String sep)

toString

public static java.lang.String toString(java.lang.Number[] data)

toString

public static java.lang.String toString(java.util.List<? extends java.lang.Number> data)


spark-1.2-src/docs/com/representqueens/spark/BarGraph.html000644 000765 000024 00000037760 10572117020 024217 0ustar00larrystaff000000 000000 BarGraph

com.representqueens.spark
Class BarGraph

java.lang.Object
  extended by com.representqueens.spark.BarGraph

public class BarGraph
extends java.lang.Object

Bargraph generation.


Field Summary
static java.awt.Color DEFAULT_COLOR
           
static int DEFAULT_HEIGHT
           
static java.awt.Color DEFAULT_HIGH_COLOR
           
static java.awt.Color DEFAULT_LAST_COLOR
           
static SizeParams DEFAULT_SIZE
           
static int DEFAULT_SPACING
           
static int DEFAULT_WIDTH
           
 
Constructor Summary
BarGraph()
           
 
Method Summary
static java.awt.image.BufferedImage createGraph(java.lang.Number[] data)
          Create a Bargraph from an array of numbers, using default colors and sizes.
static java.awt.image.BufferedImage createGraph(java.lang.Number[] data, SizeParams size, java.awt.Color color, java.awt.Color highColor, java.awt.Color lastColor)
          Create a Bargraph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
See Also:
Constant Field Values

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
See Also:
Constant Field Values

DEFAULT_SPACING

public static final int DEFAULT_SPACING
See Also:
Constant Field Values

DEFAULT_SIZE

public static final SizeParams DEFAULT_SIZE

DEFAULT_COLOR

public static final java.awt.Color DEFAULT_COLOR

DEFAULT_HIGH_COLOR

public static final java.awt.Color DEFAULT_HIGH_COLOR

DEFAULT_LAST_COLOR

public static final java.awt.Color DEFAULT_LAST_COLOR
Constructor Detail

BarGraph

public BarGraph()
Method Detail

createGraph

public static java.awt.image.BufferedImage createGraph(java.lang.Number[] data)
Create a Bargraph from an array of numbers, using default colors and sizes.

Parameters:
data - Array of Number Objects.
Returns:
BufferedImage containing a Bargraph of data.

createGraph

public static java.awt.image.BufferedImage createGraph(java.lang.Number[] data,
                                                       SizeParams size,
                                                       java.awt.Color color,
                                                       java.awt.Color highColor,
                                                       java.awt.Color lastColor)
Create a Bargraph.

Parameters:
data - Array of Number Objects to graph.
size - SizeParams specifying graph size attributes.
color - main graph color
highColor - color for above average data points (or null).
lastColor - color for last data point (or null).
Returns:
BufferedImage containing a Bargraph of data.


spark-1.2-src/docs/com/representqueens/spark/Encoder.Format.html000644 000765 000024 00000031706 10572117020 025331 0ustar00larrystaff000000 000000 Encoder.Format

com.representqueens.spark
Enum Encoder.Format

java.lang.Object
  extended by java.lang.Enum<Encoder.Format>
      extended by com.representqueens.spark.Encoder.Format
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Encoder.Format>
Enclosing class:
Encoder

public static enum Encoder.Format
extends java.lang.Enum<Encoder.Format>


Enum Constant Summary
DATA
           
JAVASCRIPT
           
 
Method Summary
static Encoder.Format valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Encoder.Format[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

DATA

public static final Encoder.Format DATA

JAVASCRIPT

public static final Encoder.Format JAVASCRIPT
Method Detail

values

public static final Encoder.Format[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(Encoder.Format c : Encoder.Format.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static Encoder.Format valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name


spark-1.2-src/docs/com/representqueens/spark/Encoder.html000644 000765 000024 00000025104 10572117020 024075 0ustar00larrystaff000000 000000 Encoder

com.representqueens.spark
Class Encoder

java.lang.Object
  extended by com.representqueens.spark.Encoder

public class Encoder
extends java.lang.Object

Encodes Image data as Strings, using code from David Flanagan's website (http://www.davidflanagan.com/).


Nested Class Summary
static class Encoder.Format
           
 
Constructor Summary
Encoder()
           
 
Method Summary
static java.lang.String encode(java.awt.image.BufferedImage bi, Encoder.Format format)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Encoder

public Encoder()
Method Detail

encode

public static java.lang.String encode(java.awt.image.BufferedImage bi,
                                      Encoder.Format format)
                               throws java.io.IOException
Throws:
java.io.IOException


spark-1.2-src/docs/com/representqueens/spark/LineGraph.html000644 000765 000024 00000031517 10572117020 024374 0ustar00larrystaff000000 000000 LineGraph

com.representqueens.spark
Class LineGraph

java.lang.Object
  extended by com.representqueens.spark.LineGraph

public class LineGraph
extends java.lang.Object

Linegraph generation.


Field Summary
static java.awt.Color DEFAULT_COLOR
           
static SizeParams DEFAULT_SIZE
           
 
Constructor Summary
LineGraph()
           
 
Method Summary
static java.awt.image.BufferedImage createGraph(java.lang.Number[] data)
          Create a Linegraph using defaults.
static java.awt.image.BufferedImage createGraph(java.lang.Number[] data, SizeParams size, java.awt.Color color)
          Create a Linegraph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SIZE

public static final SizeParams DEFAULT_SIZE

DEFAULT_COLOR

public static final java.awt.Color DEFAULT_COLOR
Constructor Detail

LineGraph

public LineGraph()
Method Detail

createGraph

public static java.awt.image.BufferedImage createGraph(java.lang.Number[] data)
Create a Linegraph using defaults.

Parameters:
data - Array of Number Objects to graph.
Returns:
BufferedImage containing a Linegraph of data.

createGraph

public static java.awt.image.BufferedImage createGraph(java.lang.Number[] data,
                                                       SizeParams size,
                                                       java.awt.Color color)
Create a Linegraph.

Parameters:
data - Array of Number Objects to graph.
size - SizeParams specifying graph size attributes.
color - graph Color.
Returns:
BufferedImage containing a Linegraph of data.


spark-1.2-src/docs/com/representqueens/spark/package-frame.html000644 000765 000024 00000002760 10572117020 025204 0ustar00larrystaff000000 000000 com.representqueens.spark com.representqueens.spark
Classes 
BarGraph
Encoder
LineGraph
SizeParams
Enums 
Encoder.Format
spark-1.2-src/docs/com/representqueens/spark/package-summary.html000644 000765 000024 00000015436 10572117020 025613 0ustar00larrystaff000000 000000 com.representqueens.spark

Package com.representqueens.spark

Class Summary
BarGraph Bargraph generation.
Encoder Encodes Image data as Strings, using code from David Flanagan's website (http://www.davidflanagan.com/).
LineGraph Linegraph generation.
SizeParams Graph size attributes.
 

Enum Summary
Encoder.Format  
 



spark-1.2-src/docs/com/representqueens/spark/package-tree.html000644 000765 000024 00000014465 10572117020 025056 0ustar00larrystaff000000 000000 com.representqueens.spark Class Hierarchy

Hierarchy For Package com.representqueens.spark

Package Hierarchies:
All Packages

Class Hierarchy

Enum Hierarchy

  • java.lang.Object
    • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable)


spark-1.2-src/docs/com/representqueens/spark/service/000755 000765 000024 00000000000 10572117020 023266 5ustar00larrystaff000000 000000 spark-1.2-src/docs/com/representqueens/spark/SizeParams.html000644 000765 000024 00000025035 10572117020 024577 0ustar00larrystaff000000 000000 SizeParams

com.representqueens.spark
Class SizeParams

java.lang.Object
  extended by com.representqueens.spark.SizeParams

public final class SizeParams
extends java.lang.Object

Graph size attributes.


Constructor Summary
SizeParams(int width, int height, int spacing)
          Constructor.
 
Method Summary
 int getHeight()
          Get the graph height.
 int getSpacing()
          Get the spacing between data points.
 int getWidth()
          Get the graph width.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeParams

public SizeParams(int width,
                  int height,
                  int spacing)
Constructor.

Parameters:
width - graph width (in pixels).
height - graph height (in pixels).
spacing - spacing between data points (in pixels).
Method Detail

getHeight

public int getHeight()
Get the graph height.

Returns:
graph height (in pixels).

getSpacing

public int getSpacing()
Get the spacing between data points.

Returns:
spacing between data points (in pixels).

getWidth

public int getWidth()
Get the graph width.

Returns:
graph width (in pixels).


spark-1.2-src/docs/com/representqueens/spark/util/000755 000765 000024 00000000000 10572117020 022603 5ustar00larrystaff000000 000000 spark-1.2-src/docs/com/representqueens/spark/util/package-frame.html000644 000765 000024 00000001672 10572117020 026162 0ustar00larrystaff000000 000000 com.representqueens.spark.util com.representqueens.spark.util
Classes 
StringConversion
spark-1.2-src/docs/com/representqueens/spark/util/package-summary.html000644 000765 000024 00000013545 10572117020 026567 0ustar00larrystaff000000 000000 com.representqueens.spark.util

Package com.representqueens.spark.util

Class Summary
StringConversion  
 



spark-1.2-src/docs/com/representqueens/spark/util/package-tree.html000644 000765 000024 00000013323 10572117020 026023 0ustar00larrystaff000000 000000 com.representqueens.spark.util Class Hierarchy

Hierarchy For Package com.representqueens.spark.util

Package Hierarchies:
All Packages

Class Hierarchy



spark-1.2-src/docs/com/representqueens/spark/util/StringConversion.html000644 000765 000024 00000022340 10572117020 027006 0ustar00larrystaff000000 000000 StringConversion

com.representqueens.spark.util
Class StringConversion

java.lang.Object
  extended by com.representqueens.spark.util.StringConversion

public final class StringConversion
extends java.lang.Object


Method Summary
static java.awt.Color convertColor(java.lang.String s, java.awt.Color defValue)
           
static int convertInt(java.lang.String s, int defValue)
           
static java.lang.Number[] getData(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getData

public static final java.lang.Number[] getData(java.lang.String s)

convertColor

public static final java.awt.Color convertColor(java.lang.String s,
                                                java.awt.Color defValue)

convertInt

public static final int convertInt(java.lang.String s,
                                   int defValue)


spark-1.2-src/docs/com/representqueens/spark/service/package-frame.html000644 000765 000024 00000001707 10572117020 026644 0ustar00larrystaff000000 000000 com.representqueens.spark.service com.representqueens.spark.service
Classes 
SparkController
spark-1.2-src/docs/com/representqueens/spark/service/package-summary.html000644 000765 000024 00000013567 10572117020 027256 0ustar00larrystaff000000 000000 com.representqueens.spark.service

Package com.representqueens.spark.service

Class Summary
SparkController  
 



spark-1.2-src/docs/com/representqueens/spark/service/package-tree.html000644 000765 000024 00000013415 10572117020 026510 0ustar00larrystaff000000 000000 com.representqueens.spark.service Class Hierarchy

Hierarchy For Package com.representqueens.spark.service

Package Hierarchies:
All Packages

Class Hierarchy

  • java.lang.Object


spark-1.2-src/docs/com/representqueens/spark/service/SparkController.html000644 000765 000024 00000023764 10572117020 027314 0ustar00larrystaff000000 000000 SparkController

com.representqueens.spark.service
Class SparkController

java.lang.Object
  extended by HttpServlet
      extended by com.representqueens.spark.service.SparkController

public final class SparkController
extends HttpServlet


Constructor Summary
SparkController()
           
 
Method Summary
 void doGet(HttpServletRequest request, HttpServletResponse response)
           
 void doPut(HttpServletRequest request, HttpServletResponse response)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SparkController

public SparkController()
Method Detail

doGet

public void doGet(HttpServletRequest request,
                  HttpServletResponse response)
           throws java.io.IOException
Throws:
java.io.IOException

doPut

public void doPut(HttpServletRequest request,
                  HttpServletResponse response)
           throws java.io.IOException
Throws:
java.io.IOException