# HG changeset patch # User František Kučera # Date 1235853062 -3600 # Node ID 639991d0808a323c9252b09508033ff774e126ed # Parent 1612dbcec45111e4cab4b9cab192e5ac684a3249 Rozbalená knihovna verze 1.0 diff -r 1612dbcec451 -r 639991d0808a .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,2 @@ +java/cewolf-1.0/target/* +java/cewolf-1.0/lib/* diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/.classpath --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/.classpath Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/.project --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/.project Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,31 @@ + + cewolf + Cewolf is a tag library for JfreeChart. + JFreeChart is a class library, written in Java, for generating charts. + Utilising the Java2D APIs, it currently supports bar charts, pie charts, + line charts, XY-plots and time series plots. + + + + org.eclipse.jdt.core.javabuilder + + + + org.eclipse.wst.common.modulecore.ComponentStructuralBuilder + + + + org.eclipse.wst.validation.validationbuilder + + + + org.eclipse.wst.common.modulecore.ComponentStructuralBuilderDependencyResolver + + + + + org.eclipse.jdt.core.javanature + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + + \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/.wtpmodules --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/.wtpmodules Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/Build_Instructions.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/Build_Instructions.txt Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,7 @@ +Cewolf uses Apache Maven 2 as the build system as of version 0.12.0. Maven 2 can be downloaded from http://maven.apache.org. + +To build cewolf using M2 you must first load a couple of jars into your local repository. In the cewolf/repository folder, run "mvn install." This will load gnujaxp into your M2 local repository. This only needs to be done once. All the other dependant jars are automatically downloaded by M2 from ibiblio. + +To build cewolf, run "mvn install" from the cewolf folder. This will build the jar and javadocs place them in /target. + +To build the zip file deployed on sourceforge, run "mvn assembly:assembly" from the cewolf folder. The zip will be placed in /target. This jar will contain all the dependant jars and the source. \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/LICENSE.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/LICENSE.txt Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/RELEASE.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/RELEASE.txt Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,286 @@ +Release Notes for Version 1.0 +-------------------------------- +-Jpeg image support added. +-Added new tag parameters to img and legend: + -removeAfterRender will remove images from storage immediately. Defaults to False. NOTE: This + may cause problems if your users expect to copy or save the images from the browser as some + browsers will put the url in the paste buffer and attempt to reload when pasted somewhere such + as MS Word. + -forceSessionId will add jsessionid parameter to the image url. Defaults to True. This matches + existing functionality but now allows the option to disable this for certain use cases. +-Supports JFC 1.0.0 Final + JFC no longer supports the signals chart type. This has been commented out in cewolf for now + because there is talk on the forum that it may come back. +-At release time, site is not fully updated. This will come in the near future as I move the site fully to Maven2. + + +Release Notes for Version 0.12.0 +-------------------------------- +-Supports JFC 1.0.0-RC1 + +Release Notes for Version 0.11.0 Alpha +-------------------------------- +-Now supports JFC 1.0 Pre 2 +-Fixed bugs:1165987,1165979,1165967 +-There where significant changes to the JFC Api in this release. See www.jfree.org forums + for specific information. Chances are very good that your chart processors WILL BREAK because of these + changes. This is not because of Cewolf, but because the JFC APIs changed. + +Release Notes for Version 0.10.3 +-------------------------------- +-Added optional config parameter for FileStorage: "FileStorage.deleteOnExit" + to get the saved files deleted at normal shutdown. +-Improved overlaidchart can contain any number of sub-charts +-Added ChartImageRenderListener event callback interface can be implemented by ChartPostProcessor + to get called back after the image rendered. + Useful to acquire JFreeChart's ChartRenderingInfo object. +-Fixed [ 1158392 ] Configuration object causes NPE when servlet reloads +-Fixed chart-renderer factory problem; that if multiple charts of the same type appeared + on the same page they shared the same renderer, therefore if a post-processor customized + that renderer all charts were affected. +-Fixed that tooltips would not appear in firefox; when the jsp page in a subdir + need to use /etc/overlib.js style path in config for this. + +Release Notes for Version 0.10.2 +-------------------------------- +Fixed cewolf.jar in the wrong folder. +Fixed NPE in Renderer + +Release Notes for Version 0.10.1 +-------------------------------- +Fixed bar chart orientation and few other bugs. + +Release Notes for Version 0.10 +-------------------------------- +-bundled with JFreeChart 0.9.21 +-added option to allow use of JFreeChart link and tooltip generators + +Release Notes for Version 0.10a6 +-------------------------------- +-bundled with JFreeChart 0.9.18 +-new storage option that provides better support for long duration sessions. See bug 100248 for details. + +Realease Notes for Version 0.10a1 +-------------------------------- +- added support for meter, stacked area and bubble charts +- bundled with JFreeChart 0.9.11 + +Realease Notes for Version 0.9.5 +-------------------------------- +- fixed incompatibility to Servlet API 2.2 +- fixed pluginspace attribute in non SVG images + +Realease Notes for Version 0.9.4 +-------------------------------- +- fixed ConfigurationException when providing no param for CewolfServlet + +Realease Notes for Version 0.9.3 +-------------------------------- +- pluggable storage concept for chart images +- fixed large memory consumptions +- fixed another caching bug + +Realease Notes for Version 0.9.2 +-------------------------------- +- improved SVG support + +Realease Notes for Version 0.9.1 +-------------------------------- +- changed to to support JSP 1.1 +- changed to to support JSP 1.1 +- added var attribute to to expose URL as page attribute +- fixed wrong mimetype in testpage.jsp for SVG + +Realease Notes for Version 0.9 +-------------------------------- +- bundled with JFreeChart 0.9.8 +- added support for overlay charts (fist steps) +- added support for combined charts (fist steps) +- added usecache attribute to to disable data caching +- producer id is now passed to produceDataset() as parameter by default. See Javadoc of DatasetProducer +- image URLs are always encoded with session ID parameter even if cookies are enabled +- image URLs paramaters correctly escape ampersands +- semantic of renderer attribute of and changed (see taglib doc) +- logging is now handled by Apache's commons.logging +- API change to DatasetProducer to let the producer decide about + data caching +- added a configuration paramter overliburl to define the overlib.js destination relative to webapp URL +- removed expires attributes from taglibrary as they are not used anymore +- fixed configuration bugs +- fixed caching bugs by changing caching to be session based +- fixed memory leaks +- fixed synchronization issue when using more than one timeseries chart on a page +- fixed incompatibilities between tag attribute types and setter methods + +Realease Notes for Version 0.8.9 +-------------------------------- +- fixed the "null is not a valid chart id" bug +- fixed browser detection bug (729378) +- Socket write detection bug (729384,729501,730490) +- fixed synchronization issues +- removed console output(717861) + +Realease Notes for Version 0.8.8 +-------------------------------- +- fixed bug: missing closing bracket in tags + +Realease Notes for Version 0.8.7 +-------------------------------- +- bundled with JFreeCharts 0.9.4 + +Realease Notes for Version 0.8.6 +-------------------------------- +- fixed a bug which caused a ConfigurationException if the Cewolf servlet + was not loaded on startup + +Realease Notes for Version 0.8.5 +-------------------------------- +- fixed the server side image problem which occured on some machines + +Realease Notes for Version 0.8.4 +-------------------------------- +- now runs on resin-2.1.5 + +Realease Notes for Version 0.8.3 +-------------------------------- +- added some header information in HTTP header to improve performance +- added a debug paramter to servlet to turn on and of debugging + +Realease Notes for Version 0.8.2 +-------------------------------- +- useful image caching with cleanup mechanisms to avoid running out of memory +- bugfix in image key computing +- faster caching and key generation +- init parameters for cewolf servlet to manipulate caching (see example etc/web.xml) + +Realease Notes for Version 0.8.1 +-------------------------------- +- Removed dashes from tag names to make them work in a JSP 1.1 container + gradient-paint -> gradientpaint + texture-paint -> texturepaint + color-paint -> colorpaint +- Improved compatibility. Tested on + - Tomcat 3.3.1 + - Tomcat 4.0 + - Tomcat 4.1.10 + - JRun 4.0.SP1 beta +- some bug fixes in tag handlers + +Realease Notes for Version 0.8 +------------------------------ +- ChartPostProcessor process method signature now has a third parameter with the + current dataset of the rendered chart to enhance capabilities of processing +- tag does not render a image anymore. is only used to define + a chart instance initially inside a JSP. The rendering of the chart image is + performed by the tag which is passed the chart id as an attribute. +- image maps and tooltips implemented (tested on IE 5.5 and Mozilla 1.1) +- added tag which can be used as the src attribute of an HTML img tag +- obsolete tag has been removed all attributes can be set directly to + the tag now +- server side caching of images to gain performance blast when requesting the same + chart again +- many redesigns +- polished example webapp +- fixed a bug which prevented reloading of a page +- fixed a bug which let the tag produce same keys for different charts whan tags + are pooled + +Known issues: +- tooltips for pie3d charts are not positioned correctly + +Realease Notes for Version 0.7.1 +-------------------------------- +- fixed a typo in TLD (boder instead of border in two tags) +- removed "antialias" attribute in TLD for tag legend as it is not implemented + yet + +Realease Notes for Version 0.7 +------------------------------ +- unlimited customization of generated charts possible through additional + ChartPostprocessor objects. See documentation! +- changed signature of DatasetProducer. Params are now passed as Map instead + HashMap +- new tag to render the chart's legend separately +- added "legend" and "legendanchor" attribute to panel and chart tag to swith + on/off and manipulate legend display +- new tag allows the separate rendering of the chart's legend somewhere + in the JSP +- and tag now support all HTML 4.0 img tag attributes +- rendering servlet now renders an exception into the delivered image if one is + raised when trying to render the chart +- removed obsolete example page producerparams.jsp (view testpage.jsp instead) +- the example.war binary is now distributed separately +- example web.xml no has an url-mapping to work in more J2EE containers +- better usage of JSP callbacks by overriding the release() method in tags +- enhanced test page for JSP 1.1 and JSP 1.2 containers +- enhanced image loading performance +- redesigned, optimized and simplified some issues +- some javadocs + +Realease Notes for Version 0.6.2 +-------------------------------- +- fixed a bug in testpage.jsp and testpage-1.1.jsp which closed the panel tag twice + +Realease Notes for Version 0.6.1 +-------------------------------- +- fixed a bug in the tag library descriptor which defined the background + attribute of tag chart as a float + +Realease Notes for Version 0.6 +------------------------------ +- added tags , and + for background paints of chart panel +- some refactorings in tag lib implementation +- testpage enhanced + +Realease Notes for Version 0.5.1 +-------------------------------- +- fixed a bug which prevented the reuse of the chart tag instance + by the container + +Realease Notes for Version 0.5 +------------------------------ +- the data tag now embeds a producer tag, future releases will have other + possibilities to provide data (e.g. SQL) +- added support for Pie3DChart +- added tag to be embedded in tag +- embedded tag attributes override coressponing parent tags + attributes +- tag now extends tag +- changed value type of tag to java.io.Serilizable +- added antialias support +- added tag library documentation +- added some javadocs +- added some example JSPs + +Realease Notes for Version 0.4 +------------------------------ +- replaced TagExtraInfo with TagLibraryValidator +- moved .tld file to WEB-INF in sample WAR due to problems in some Tomcat + environments +- DatasetProducer now takes a HashMap containing additional parameters for + dataset production +- Added tutorial to docs +- some additional JavaDocs + +Realease Notes for Version 0.3 +------------------------------ +- included TagExtraInfo to check charttype at JSP compile time +- added documentation +- some redesigns + +Realease Notes for Version 0.2 +------------------------------ +- updated to JFreeChart 0.9.2 +- all 20 chart types from JFreeChart's ChartFactory are supported +- some redesigns +- some javadocs + + +Realease Notes for Version 0.1.1 +-------------------------------- +This is the first alpha-release of Cewolf. +It is useable already but there are not many possibilities to change the view of +the current charts. +The documentation is very less. +Not all types of charts are supported. \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/etc/cewolf-1.1.tld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/etc/cewolf-1.1.tld Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,1234 @@ + + + + +0.9.3 +1.2 +Cewolf Tag Library +http://cewolf.sourceforge.net/taglib/cewolf.tld +Cewolf Tag Library +This tag library is designed to describe charts of all kinds. + + plot + de.laures.cewolf.taglib.tags.PlotTag + JSP + + The plot tag is nested inside a complex chart to define a nested or layerd plot instance. + @required-child data + + + type + true + true + + The type of the plot. One of xyarea, xyline, xyshapesandlines , + scatter, xyverticalbar, step, candlestick, highlow, signal, + verticlebar, area, line, shapesandlines + + + + xaxislabel + false + true + + Title of the plot's x-axis. This attributes is + only used for horizontally combined charts. + + + + yaxislabel + false + true + + Title of the plot's y-axis. This attributes is + only used for vertically combined charts. + + + + + img + de.laures.cewolf.taglib.tags.ChartImgTag + JSP + + This tag is a specialized HTML img tag. It renders the chart + which has been specified by a <chart> tag in the same page. + @optional-child map + + + renderer + true + true + + Path to rendering servlet. Any path that starts with a '/' is assumed to refer to a resource relative to web application root. Otherwise, the path is assumed to refer to resource relative to the current page directory. + + + + chartid + true + true + + The id of the chart to render. + + + + width + true + true + + Width of the rendered chart image in pixel. + + + + height + true + true + + Height of the rendered chart image in pixel. + + + + mime + false + true + + The MIME type of the image. Currently image/png (default) and image/svg are supported. + @default image/png + + + + alt + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + timeout + false + true + + Sets the timeout value used in the LongTermSessionStorage obj. Value is in seconds. + + + + hspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + vspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + align + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + border + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ismap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + longdesc + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + usemap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + class + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + dir + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + lang + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ondbclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeydown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeypress + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeyup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousedown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousemove + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseout + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseover + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + style + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + htmltitle + false + true + + Corresponds to appropriate HMTL <img> title attribute. + + + + forceSessionId + false + true + + Add JSession id. + + + + removeAfterRender + false + true + + Remove image after rendering (defaults to false). + + + + + imgurl + de.laures.cewolf.taglib.tags.ChartImgURLTag + de.laures.cewolf.taglib.tags.ChartImgURLTagEI + + This tag can be used as the src attribute of a HTML img tag. E.g.: + <img src='<imgurl chartid="foobar" renderer="cewolf" width="100" height="100"/>'> + If the var attribute is used the URL is exposed as a page attribute of type String. + @extends img + + + var + false + true + + Name of the page scope attribute to hold the URL. If not specified the URL is printed to the page outstream. + + + + renderer + true + true + + Path to rendering servlet. Any path that starts with a '/' is assumed to refer to a resource relative to web application root. Otherwise, the path is assumed to refer to resource relative to the current page directory. + + + + chartid + true + true + + The id of the chart to render. + + + + width + true + true + + Width of the rendered chart image in pixel. + + + + height + true + true + + Height of the rendered chart image in pixel. + + + + mime + false + true + + The MIME type of the image. Currently image/png (default) and image/svg are supported. + @default image/png + + + + + chart + de.laures.cewolf.taglib.tags.SimpleChartTag + + Root tag of a chart description. + @root + @required-child data + @optional-child chartpostprocessor + + + id + true + true + + ID under which the chart description bean will be stored in the + page to be found by the img tag. Beware of using an + ID which is not yet used for other beans in the page to avoid + compile errors. + + + + type + true + true + + Type of the chart. One of area, areaxy, horizontalbar, horizontalbar3d, + line, pie, scatter, stackedarea, stackedhorizontalbar, stackedverticalbar, + stackedverticalbar3d, timeseries, verticalbar, verticalbar3d, xy, + candlestick, highlow, gantt, wind, signal, verticalxybar, pie3d, meter + + + + title + false + true + + Title of the chart which is displayed on the chart panel + above the plot pane. + + + + xaxislabel + false + true + + Title of the chart's x-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + yaxislabel + false + true + + Title of the chart's y-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + background + false + true + + Background image of the chart panel. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + backgroundimagealpha + false + true + java.lang.Float + + Chart's backgound alpha blending value as a float. Value ranges + from 0.0 to 1.0. + @default 0.0 + @overrides /chart[backgroundimagealpha] + + + + antialias + false + true + + Antialiased rendering of the chart. + @default true + @overrides /chart[backgroundimagealpha] + + + + showlegend + false + true + + Boolean value to switch on or off the legend display inside of this panel. + @default true + + + + legendanchor + false + true + + Sets the anchor of the legend inside of the panel. Possible values + are 'north', 'south', 'west', 'east'. + Ignored if showlegned is 'false'. + @default 'south' + + + + + overlaidchart + de.laures.cewolf.taglib.tags.OverlaidChartTag + + Root tag of a overlaid-chart description. + @root + @required-child data + @optional-child chartpostprocessor + + + id + true + true + + ID under which the chart description bean will be stored in the + page to be found by the img tag. Beware of using an + ID which is not yet used for other beans in the page to avoid + compile errors. + + + + type + true + true + + Type of the chart. In this version only overlaidxy is supported. + + + + title + false + true + + Title of the chart which is displayed on the chart panel + above the plot pane. + + + + xaxistype + true + true + + Type of the domain axis. Possible values: date, number + + + + xaxislabel + false + true + + Title of the chart's x-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + yaxistype + false + true + + Type of the range axis. Possible values: date, number + + + + yaxislabel + false + true + + Title of the chart's y-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + background + false + true + + Background image of the chart panel. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + backgroundimagealpha + false + true + java.lang.Float + + Chart's backgound alpha blending value as a float. Value ranges + from 0.0 to 1.0. + @default 0.0 + @overrides /chart[backgroundimagealpha] + + + + antialias + false + true + + Antialiased rendering of the chart. + @default true + @overrides /chart[backgroundimagealpha] + + + + showlegend + false + true + + Boolean value to switch on or off the legend display inside of this panel. + @default true + + + + legendanchor + false + true + + Sets the anchor of the legend inside of the panel. Possible values + are 'north', 'south', 'west', 'east'. + Ignored if showlegned is 'false'. + @default 'south' + + + + + combinedchart + de.laures.cewolf.taglib.tags.CombinedChartTag + + Root tag of a combined-chart description. + @root + @required-child plot + @optional-child chartpostprocessor + + + id + true + true + + ID under which the chart description bean will be stored in the + page to be found by the img tag. Beware of using an + ID which is not yet used for other beans in the page to avoid + compile errors. + + + + type + true + true + + Type of the chart. One of combinedxy + + + + layout + true + true + + Layout of the chart. Either vertical or horizontal + + + + title + false + true + + Title of the chart which is displayed on the chart panel + above the plot pane. + + + + xaxislabel + false + true + + Title of the chart's x-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + yaxislabel + false + true + + Title of the chart's y-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + background + false + true + + Background image of the chart panel. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + backgroundimagealpha + false + true + java.lang.Float + + Chart's backgound alpha blending value as a float. Value ranges + from 0.0 to 1.0. + @default 0.0 + @overrides /chart[backgroundimagealpha] + + + + antialias + false + true + + Antialiased rendering of the chart. + @default true + @overrides /chart[backgroundimagealpha] + + + + showlegend + false + true + + Boolean value to switch on or off the legend display inside of this panel. + @default true + + + + legendanchor + false + true + + Sets the anchor of the legend inside of the panel. Possible values + are 'north', 'south', 'west', 'east'. + Ignored if showlegned is 'false'. + @default 'south' + + + + + legend + de.laures.cewolf.taglib.tags.LegendTag + + This tag is used to render the legend of a chart in a separate image. + It assumes that somewhere else in the JSP a chart tag defines a chart + with the same ID as this legend tag. + + + renderer + true + true + + Path to rendering servlet relative to web apps root URL + (e.g. servlet/cewolf). + + + + id + true + true + + ID under which the chart description bean will be stored in the + session to be found by the rendering servlet. Beware of using an + ID which is not yet used for other beans in the session to avoid + overriding. + + + + timeout + false + true + + Sets the timeout value used in the LongTermSessionStorage obj. Value is in seconds. + + + + width + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + height + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + mime + false + true + + The MIME type of the image. Currently image/png (default) and image/svg are supported. + @default image/png + + + + alt + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + hspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + vspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + align + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + border + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ismap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + longdesc + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + usemap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + class + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + dir + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + lang + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ondbclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeydown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeypress + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeyup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousedown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousemove + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseout + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseover + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + style + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + htmltitle + false + true + + Corresponds to appropriate HMTL <img> title attribute. + + + + forceSessionId + false + true + + Add JSession id. + + + + removeAfterRender + false + true + + Remove image after rendering (defaults to false). + + + + + data + de.laures.cewolf.taglib.tags.DataTag + + A data tag provides all information needed to retrieve the data which are + needed by the chart. Current version only supports data provided by a + DatasetProducer. In future versions there will be tags to provide data + from a datasource (e.g. via SQL). + @optional-child producer + + + + producer + de.laures.cewolf.taglib.tags.ProducerTag + + A data tag provides all information needed to retrieve the data which are + needed by the chart. Current version only supports data provided by a + DatasetProducer. In future versions there will be tags to provide data + from a datasource (e.g. via SQL). + @optional-child param + + + id + true + true + + ID under which an object of type DatasetProducer can be found in + pageContext. This object is used to retrieve the dataset of the chart. + + + + usecache + false + true + + Determines if formally produced data should be reused if possible. + @default true + + + + + chartpostprocessor + de.laures.cewolf.taglib.tags.ChartPostProcessorTag + + A chart postprocessor tag references an object of type ChartProstProcessor + which must be defined in pageContext under the provided ID. This object + is called back after chart generation to post process the chart in any + manner. + @optional-child param + + + id + true + true + + ID under which an object of type ChartPostProcessor can be found in + pageContext. This object is used to postprocess the rendered chart. + + + + + param + de.laures.cewolf.taglib.tags.ParamTag + + Name/value-pair to paramterize a surrounding tag whose handler must + implement the Parameterized interface. + + + name + true + true + + Name of the param + + + + value + true + true + java.io.Serializable + + Value of the param. Must be serializable. + + + + + gradientpaint + de.laures.cewolf.taglib.tags.GradientTag + + The gradientpaint tag provides a way to fill a shape with a linear + color gradient pattern. If Point P1 with Color C1 and Point P2 with + Color C2 are specified in user space, the Color on the P1, P2 + connecting line is proportionally changed from C1 to C2. Any point + P not on the extended P1, P2 connecting line has the color of the + point P' that is the perpendicular projection of P on the extended P1, + P2 connecting line. Points on the extended line outside of the P1, + P2 segment can be colored in one of two ways. + <ul> + <li>If the gradient is cyclic then the points on the extended + P1, P2 connecting line cycle back and forth between the colors C1 + and C2. + <li>If the gradient is acyclic then points on the P1 side of + the segment have the constant Color C1 while points on the P2 side + have the constant Color C2. + The two colors are defined in a nested point tag of this tag. + @required-child point + + + cyclic + false + true + + Does the gradient cycle repeatedly between the two colors C1 and C2. + @default false + + + + + point + de.laures.cewolf.taglib.tags.PointTag + + Defines a point with x and y coordinates and a color. + @extends colorpaint + + + x + true + true + + The x coordinate of the point. + + + + y + true + true + + The y coordinate of the point. + + + + color + false + true + + @copy + + + + + colorpaint + de.laures.cewolf.taglib.tags.ColorTag + + Fills the area defined by the parent tag with a color. + + + color + true + true + + The color to be used to fill the parent tag's area. + The color definition is compatible with the + HTML one. E.g. black is '#000000' and red is '#FF0000'. However it + is possible to append two hex numbers for the alpha channel. Thus + '#FF000080' is red with alpha blending of 50%. + + + + + texturepaint + de.laures.cewolf.taglib.tags.TextureTag + + The texturepaint tag provides a way to fill the area of the parent tag + with a texture that is specified as an image. The texture is anchored to + the upper left corner of the parent tags area. + + + image + true + true + + Image fo the texture. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + width + true + true + + The width of the texture. + + + + height + true + true + + The height of the texture. + + + + + map + de.laures.cewolf.taglib.tags.ChartMapTag + + This tag defines an image and tooltip map for the parent img tag. + @parent img + + + linkgeneratorid + false + true + + The ID of the class which implements the appropriate de.laures.cewolf.LinkGenerator. + + + + tooltipgeneratorid + false + true + + The ID of the class which implements the appropriate com.jrefinery.chart.tooltips.ToolTipGenerator. + + + + useJFreeChartLinkGenerator + false + true + If the links provided by the JFreeChart renderer should be used. + + + useJFreeChartTooltipGenerator + false + true + If the tooltips provided by the JFreeChart renderer should be used. + + + + \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/etc/cewolf.tld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/etc/cewolf.tld Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,1234 @@ + + + + +0.9.3 +1.2 +Cewolf Tag Library +http://cewolf.sourceforge.net/taglib/cewolf.tld +Cewolf Tag Library +This tag library is designed to describe charts of all kinds. + + plot + de.laures.cewolf.taglib.tags.PlotTag + JSP + + The plot tag is nested inside a complex chart to define a nested or layerd plot instance. + @required-child data + + + type + true + true + + The type of the plot. One of xyarea, xyline, xyshapesandlines , + scatter, xyverticalbar, step, candlestick, highlow, signal, + verticlebar, area, line, shapesandlines + + + + xaxislabel + false + true + + Title of the plot's x-axis. This attributes is + only used for horizontally combined charts. + + + + yaxislabel + false + true + + Title of the plot's y-axis. This attributes is + only used for vertically combined charts. + + + + + img + de.laures.cewolf.taglib.tags.ChartImgTag + JSP + + This tag is a specialized HTML img tag. It renders the chart + which has been specified by a <chart> tag in the same page. + @optional-child map + + + renderer + true + true + + Path to rendering servlet. Any path that starts with a '/' is assumed to refer to a resource relative to web application root. Otherwise, the path is assumed to refer to resource relative to the current page directory. + + + + chartid + true + true + + The id of the chart to render. + + + + width + true + true + + Width of the rendered chart image in pixel. + + + + height + true + true + + Height of the rendered chart image in pixel. + + + + mime + false + true + + The MIME type of the image. Currently image/png (default) and image/svg are supported. + @default image/png + + + + alt + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + timeout + false + true + + Sets the timeout value used in the LongTermSessionStorage obj. Value is in seconds. + + + + hspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + vspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + align + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + border + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ismap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + longdesc + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + usemap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + class + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + dir + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + lang + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ondbclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeydown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeypress + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeyup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousedown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousemove + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseout + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseover + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + style + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + htmltitle + false + true + + Corresponds to appropriate HMTL <img> title attribute. + + + + forceSessionId + false + true + + Add JSession id. + + + + removeAfterRender + false + true + + Remove image after rendering (defaults to false). + + + + + imgurl + de.laures.cewolf.taglib.tags.ChartImgURLTag + de.laures.cewolf.taglib.tags.ChartImgURLTagEI + + This tag can be used as the src attribute of a HTML img tag. E.g.: + <img src='<imgurl chartid="foobar" renderer="cewolf" width="100" height="100"/>'> + If the var attribute is used the URL is exposed as a page attribute of type String. + @extends img + + + var + false + true + + Name of the page scope attribute to hold the URL. If not specified the URL is printed to the page outstream. + + + + renderer + true + true + + Path to rendering servlet. Any path that starts with a '/' is assumed to refer to a resource relative to web application root. Otherwise, the path is assumed to refer to resource relative to the current page directory. + + + + chartid + true + true + + The id of the chart to render. + + + + width + true + true + + Width of the rendered chart image in pixel. + + + + height + true + true + + Height of the rendered chart image in pixel. + + + + mime + false + true + + The MIME type of the image. Currently image/png (default) and image/svg are supported. + @default image/png + + + + + chart + de.laures.cewolf.taglib.tags.SimpleChartTag + + Root tag of a chart description. + @root + @required-child data + @optional-child chartpostprocessor + + + id + true + true + + ID under which the chart description bean will be stored in the + page to be found by the img tag. Beware of using an + ID which is not yet used for other beans in the page to avoid + compile errors. + + + + type + true + true + + Type of the chart. One of area, areaxy, horizontalbar, horizontalbar3d, + line, pie, scatter, stackedarea, stackedhorizontalbar, stackedverticalbar, + stackedverticalbar3d, timeseries, verticalbar, verticalbar3d, xy, + candlestick, highlow, gantt, wind, signal, verticalxybar, pie3d, meter + + + + title + false + true + + Title of the chart which is displayed on the chart panel + above the plot pane. + + + + xaxislabel + false + true + + Title of the chart's x-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + yaxislabel + false + true + + Title of the chart's y-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + background + false + true + + Background image of the chart panel. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + backgroundimagealpha + false + true + java.lang.Float + + Chart's backgound alpha blending value as a float. Value ranges + from 0.0 to 1.0. + @default 0.0 + @overrides /chart[backgroundimagealpha] + + + + antialias + false + true + + Antialiased rendering of the chart. + @default true + @overrides /chart[backgroundimagealpha] + + + + showlegend + false + true + + Boolean value to switch on or off the legend display inside of this panel. + @default true + + + + legendanchor + false + true + + Sets the anchor of the legend inside of the panel. Possible values + are 'north', 'south', 'west', 'east'. + Ignored if showlegned is 'false'. + @default 'south' + + + + + overlaidchart + de.laures.cewolf.taglib.tags.OverlaidChartTag + + Root tag of a overlaid-chart description. + @root + @required-child data + @optional-child chartpostprocessor + + + id + true + true + + ID under which the chart description bean will be stored in the + page to be found by the img tag. Beware of using an + ID which is not yet used for other beans in the page to avoid + compile errors. + + + + type + true + true + + Type of the chart. In this version only overlaidxy is supported. + + + + title + false + true + + Title of the chart which is displayed on the chart panel + above the plot pane. + + + + xaxistype + true + true + + Type of the domain axis. Possible values: date, number + + + + xaxislabel + false + true + + Title of the chart's x-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + yaxistype + false + true + + Type of the range axis. Possible values: date, number + + + + yaxislabel + false + true + + Title of the chart's y-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + background + false + true + + Background image of the chart panel. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + backgroundimagealpha + false + true + java.lang.Float + + Chart's backgound alpha blending value as a float. Value ranges + from 0.0 to 1.0. + @default 0.0 + @overrides /chart[backgroundimagealpha] + + + + antialias + false + true + + Antialiased rendering of the chart. + @default true + @overrides /chart[backgroundimagealpha] + + + + showlegend + false + true + + Boolean value to switch on or off the legend display inside of this panel. + @default true + + + + legendanchor + false + true + + Sets the anchor of the legend inside of the panel. Possible values + are 'north', 'south', 'west', 'east'. + Ignored if showlegned is 'false'. + @default 'south' + + + + + combinedchart + de.laures.cewolf.taglib.tags.CombinedChartTag + + Root tag of a combined-chart description. + @root + @required-child plot + @optional-child chartpostprocessor + + + id + true + true + + ID under which the chart description bean will be stored in the + page to be found by the img tag. Beware of using an + ID which is not yet used for other beans in the page to avoid + compile errors. + + + + type + true + true + + Type of the chart. One of combinedxy + + + + layout + true + true + + Layout of the chart. Either vertical or horizontal + + + + title + false + true + + Title of the chart which is displayed on the chart panel + above the plot pane. + + + + xaxislabel + false + true + + Title of the chart's x-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + yaxislabel + false + true + + Title of the chart's y-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + background + false + true + + Background image of the chart panel. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + backgroundimagealpha + false + true + java.lang.Float + + Chart's backgound alpha blending value as a float. Value ranges + from 0.0 to 1.0. + @default 0.0 + @overrides /chart[backgroundimagealpha] + + + + antialias + false + true + + Antialiased rendering of the chart. + @default true + @overrides /chart[backgroundimagealpha] + + + + showlegend + false + true + + Boolean value to switch on or off the legend display inside of this panel. + @default true + + + + legendanchor + false + true + + Sets the anchor of the legend inside of the panel. Possible values + are 'north', 'south', 'west', 'east'. + Ignored if showlegned is 'false'. + @default 'south' + + + + + legend + de.laures.cewolf.taglib.tags.LegendTag + + This tag is used to render the legend of a chart in a separate image. + It assumes that somewhere else in the JSP a chart tag defines a chart + with the same ID as this legend tag. + + + forceSessionId + false + true + + Add JSession id. + + + + removeAfterRender + false + true + + Remove image after rendering (defaults to false). + + + + renderer + true + true + + Path to rendering servlet relative to web apps root URL + (e.g. servlet/cewolf). + + + + id + true + true + + ID under which the chart description bean will be stored in the + session to be found by the rendering servlet. Beware of using an + ID which is not yet used for other beans in the session to avoid + overriding. + + + + timeout + false + true + + Sets the timeout value used in the LongTermSessionStorage obj. Value is in seconds. + + + + width + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + height + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + mime + false + true + + The MIME type of the image. Currently image/png (default) and image/svg are supported. + @default image/png + + + + alt + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + hspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + vspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + align + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + border + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ismap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + longdesc + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + usemap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + class + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + dir + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + lang + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ondbclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeydown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeypress + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeyup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousedown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousemove + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseout + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseover + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + style + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + htmltitle + false + true + + Corresponds to appropriate HMTL <img> title attribute. + + + + + data + de.laures.cewolf.taglib.tags.DataTag + + A data tag provides all information needed to retrieve the data which are + needed by the chart. Current version only supports data provided by a + DatasetProducer. In future versions there will be tags to provide data + from a datasource (e.g. via SQL). + @optional-child producer + + + + producer + de.laures.cewolf.taglib.tags.ProducerTag + + A data tag provides all information needed to retrieve the data which are + needed by the chart. Current version only supports data provided by a + DatasetProducer. In future versions there will be tags to provide data + from a datasource (e.g. via SQL). + @optional-child param + + + id + true + true + + ID under which an object of type DatasetProducer can be found in + pageContext. This object is used to retrieve the dataset of the chart. + + + + usecache + false + true + + Determines if formally produced data should be reused if possible. + @default true + + + + + chartpostprocessor + de.laures.cewolf.taglib.tags.ChartPostProcessorTag + + A chart postprocessor tag references an object of type ChartProstProcessor + which must be defined in pageContext under the provided ID. This object + is called back after chart generation to post process the chart in any + manner. + @optional-child param + + + id + true + true + + ID under which an object of type ChartPostProcessor can be found in + pageContext. This object is used to postprocess the rendered chart. + + + + + param + de.laures.cewolf.taglib.tags.ParamTag + + Name/value-pair to paramterize a surrounding tag whose handler must + implement the Parameterized interface. + + + name + true + true + + Name of the param + + + + value + true + true + java.io.Serializable + + Value of the param. Must be serializable. + + + + + gradientpaint + de.laures.cewolf.taglib.tags.GradientTag + + The gradientpaint tag provides a way to fill a shape with a linear + color gradient pattern. If Point P1 with Color C1 and Point P2 with + Color C2 are specified in user space, the Color on the P1, P2 + connecting line is proportionally changed from C1 to C2. Any point + P not on the extended P1, P2 connecting line has the color of the + point P' that is the perpendicular projection of P on the extended P1, + P2 connecting line. Points on the extended line outside of the P1, + P2 segment can be colored in one of two ways. + <ul> + <li>If the gradient is cyclic then the points on the extended + P1, P2 connecting line cycle back and forth between the colors C1 + and C2. + <li>If the gradient is acyclic then points on the P1 side of + the segment have the constant Color C1 while points on the P2 side + have the constant Color C2. + The two colors are defined in a nested point tag of this tag. + @required-child point + + + cyclic + false + true + + Does the gradient cycle repeatedly between the two colors C1 and C2. + @default false + + + + + point + de.laures.cewolf.taglib.tags.PointTag + + Defines a point with x and y coordinates and a color. + @extends colorpaint + + + x + true + true + + The x coordinate of the point. + + + + y + true + true + + The y coordinate of the point. + + + + color + false + true + + @copy + + + + + colorpaint + de.laures.cewolf.taglib.tags.ColorTag + + Fills the area defined by the parent tag with a color. + + + color + true + true + + The color to be used to fill the parent tag's area. + The color definition is compatible with the + HTML one. E.g. black is '#000000' and red is '#FF0000'. However it + is possible to append two hex numbers for the alpha channel. Thus + '#FF000080' is red with alpha blending of 50%. + + + + + texturepaint + de.laures.cewolf.taglib.tags.TextureTag + + The texturepaint tag provides a way to fill the area of the parent tag + with a texture that is specified as an image. The texture is anchored to + the upper left corner of the parent tags area. + + + image + true + true + + Image fo the texture. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + width + true + true + + The width of the texture. + + + + height + true + true + + The height of the texture. + + + + + map + de.laures.cewolf.taglib.tags.ChartMapTag + + This tag defines an image and tooltip map for the parent img tag. + @parent img + + + linkgeneratorid + false + true + + The ID of the class which implements the appropriate de.laures.cewolf.LinkGenerator. + + + + tooltipgeneratorid + false + true + + The ID of the class which implements the appropriate com.jrefinery.chart.tooltips.ToolTipGenerator. + + + + useJFreeChartLinkGenerator + false + true + If the links provided by the JFreeChart renderer should be used. + + + useJFreeChartTooltipGenerator + false + true + If the tooltips provided by the JFreeChart renderer should be used. + + + + \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/etc/overlib.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/etc/overlib.js Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,1222 @@ +//\////////////////////////////////////////////////////////////////////////////////// +//\ overLIB 3.50 -- This notice must remain untouched at all times. +//\ Copyright Erik Bosrup 1998-2001. All rights reserved. +//\ +//\ By Erik Bosrup (erik@bosrup.com). Last modified 2001-08-28. +//\ Portions by Dan Steinman (dansteinman.com). Additions by other people are +//\ listed on the overLIB homepage. +//\ +//\ Get the latest version at http://www.bosrup.com/web/overlib/ +//\ +//\ This script is published under an open source license. Please read the license +//\ agreement online at: http://www.bosrup.com/web/overlib/license.html +//\ If you have questions regarding the license please contact erik@bosrup.com. +//\ +//\ This script library was originally created for personal use. By request it has +//\ later been made public. This is free software. Do not sell this as your own +//\ work, or remove this copyright notice. For full details on copying or changing +//\ this script please read the license agreement at the link above. +//\ +//\ Please give credit on sites that use overLIB and submit changes of the script +//\ so other people can use them as well. This script is free to use, don't abuse. +//\////////////////////////////////////////////////////////////////////////////////// +//\mini + + +//////////////////////////////////////////////////////////////////////////////////// +// CONSTANTS +// Don't touch these. :) +//////////////////////////////////////////////////////////////////////////////////// +var INARRAY = 1; +var CAPARRAY = 2; +var STICKY = 3; +var BACKGROUND = 4; +var NOCLOSE = 5; +var CAPTION = 6; +var LEFT = 7; +var RIGHT = 8; +var CENTER = 9; +var OFFSETX = 10; +var OFFSETY = 11; +var FGCOLOR = 12; +var BGCOLOR = 13; +var TEXTCOLOR = 14; +var CAPCOLOR = 15; +var CLOSECOLOR = 16; +var WIDTH = 17; +var BORDER = 18; +var STATUS = 19; +var AUTOSTATUS = 20; +var AUTOSTATUSCAP = 21; +var HEIGHT = 22; +var CLOSETEXT = 23; +var SNAPX = 24; +var SNAPY = 25; +var FIXX = 26; +var FIXY = 27; +var FGBACKGROUND = 28; +var BGBACKGROUND = 29; +var PADX = 30; // PADX2 out +var PADY = 31; // PADY2 out +var FULLHTML = 34; +var ABOVE = 35; +var BELOW = 36; +var CAPICON = 37; +var TEXTFONT = 38; +var CAPTIONFONT = 39; +var CLOSEFONT = 40; +var TEXTSIZE = 41; +var CAPTIONSIZE = 42; +var CLOSESIZE = 43; +var FRAME = 44; +var TIMEOUT = 45; +var FUNCTION = 46; +var DELAY = 47; +var HAUTO = 48; +var VAUTO = 49; +var CLOSECLICK = 50; +var CSSOFF = 51; +var CSSSTYLE = 52; +var CSSCLASS = 53; +var FGCLASS = 54; +var BGCLASS = 55; +var TEXTFONTCLASS = 56; +var CAPTIONFONTCLASS = 57; +var CLOSEFONTCLASS = 58; +var PADUNIT = 59; +var HEIGHTUNIT = 60; +var WIDTHUNIT = 61; +var TEXTSIZEUNIT = 62; +var TEXTDECORATION = 63; +var TEXTSTYLE = 64; +var TEXTWEIGHT = 65; +var CAPTIONSIZEUNIT = 66; +var CAPTIONDECORATION = 67; +var CAPTIONSTYLE = 68; +var CAPTIONWEIGHT = 69; +var CLOSESIZEUNIT = 70; +var CLOSEDECORATION = 71; +var CLOSESTYLE = 72; +var CLOSEWEIGHT = 73; + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION +// You don't have to change anything here if you don't want to. All of this can be +// changed on your html page or through an overLIB call. +//////////////////////////////////////////////////////////////////////////////////// + +// Main background color (the large area) +// Usually a bright color (white, yellow etc) +if (typeof ol_fgcolor == 'undefined') { var ol_fgcolor = "#CCCCFF";} + +// Border color and color of caption +// Usually a dark color (black, brown etc) +if (typeof ol_bgcolor == 'undefined') { var ol_bgcolor = "#333399";} + +// Text color +// Usually a dark color +if (typeof ol_textcolor == 'undefined') { var ol_textcolor = "#000000";} + +// Color of the caption text +// Usually a bright color +if (typeof ol_capcolor == 'undefined') { var ol_capcolor = "#FFFFFF";} + +// Color of "Close" when using Sticky +// Usually a semi-bright color +if (typeof ol_closecolor == 'undefined') { var ol_closecolor = "#9999FF";} + +// Font face for the main text +if (typeof ol_textfont == 'undefined') { var ol_textfont = "Verdana,Arial,Helvetica";} + +// Font face for the caption +if (typeof ol_captionfont == 'undefined') { var ol_captionfont = "Verdana,Arial,Helvetica";} + +// Font face for the close text +if (typeof ol_closefont == 'undefined') { var ol_closefont = "Verdana,Arial,Helvetica";} + +// Font size for the main text +// When using CSS this will be very small. +if (typeof ol_textsize == 'undefined') { var ol_textsize = "1";} + +// Font size for the caption +// When using CSS this will be very small. +if (typeof ol_captionsize == 'undefined') { var ol_captionsize = "1";} + +// Font size for the close text +// When using CSS this will be very small. +if (typeof ol_closesize == 'undefined') { var ol_closesize = "1";} + +// Width of the popups in pixels +// 100-300 pixels is typical +if (typeof ol_width == 'undefined') { var ol_width = "200";} + +// How thick the ol_border should be in pixels +// 1-3 pixels is typical +if (typeof ol_border == 'undefined') { var ol_border = "1";} + +// How many pixels to the right/left of the cursor to show the popup +// Values between 3 and 12 are best +if (typeof ol_offsetx == 'undefined') { var ol_offsetx = 10;} + +// How many pixels to the below the cursor to show the popup +// Values between 3 and 12 are best +if (typeof ol_offsety == 'undefined') { var ol_offsety = 10;} + +// Default text for popups +// Should you forget to pass something to overLIB this will be displayed. +if (typeof ol_text == 'undefined') { var ol_text = "Default Text"; } + +// Default caption +// You should leave this blank or you will have problems making non caps popups. +if (typeof ol_cap == 'undefined') { var ol_cap = ""; } + +// Decides if sticky popups are default. +// 0 for non, 1 for stickies. +if (typeof ol_sticky == 'undefined') { var ol_sticky = 0; } + +// Default background image. Better left empty unless you always want one. +if (typeof ol_background == 'undefined') { var ol_background = ""; } + +// Text for the closing sticky popups. +// Normal is "Close". +if (typeof ol_close == 'undefined') { var ol_close = "Close"; } + +// Default vertical alignment for popups. +// It's best to leave RIGHT here. Other options are LEFT and CENTER. +if (typeof ol_hpos == 'undefined') { var ol_hpos = RIGHT; } + +// Default status bar text when a popup is invoked. +if (typeof ol_status == 'undefined') { var ol_status = ""; } + +// If the status bar automatically should load either text or caption. +// 0=nothing, 1=text, 2=caption +if (typeof ol_autostatus == 'undefined') { var ol_autostatus = 0; } + +// Default height for popup. Often best left alone. +if (typeof ol_height == 'undefined') { var ol_height = -1; } + +// Horizontal grid spacing that popups will snap to. +// 0 makes no grid, anything else will cause a snap to that grid spacing. +if (typeof ol_snapx == 'undefined') { var ol_snapx = 0; } + +// Vertical grid spacing that popups will snap to. +// 0 makes no grid, andthing else will cause a snap to that grid spacing. +if (typeof ol_snapy == 'undefined') { var ol_snapy = 0; } + +// Sets the popups horizontal position to a fixed column. +// Anything above -1 will cause fixed position. +if (typeof ol_fixx == 'undefined') { var ol_fixx = -1; } + +// Sets the popups vertical position to a fixed row. +// Anything above -1 will cause fixed position. +if (typeof ol_fixy == 'undefined') { var ol_fixy = -1; } + +// Background image for the popups inside. +if (typeof ol_fgbackground == 'undefined') { var ol_fgbackground = ""; } + +// Background image for the popups frame. +if (typeof ol_bgbackground == 'undefined') { var ol_bgbackground = ""; } + +// How much horizontal left padding text should get by default when BACKGROUND is used. +if (typeof ol_padxl == 'undefined') { var ol_padxl = 1; } + +// How much horizontal right padding text should get by default when BACKGROUND is used. +if (typeof ol_padxr == 'undefined') { var ol_padxr = 1; } + +// How much vertical top padding text should get by default when BACKGROUND is used. +if (typeof ol_padyt == 'undefined') { var ol_padyt = 1; } + +// How much vertical bottom padding text should get by default when BACKGROUND is used. +if (typeof ol_padyb == 'undefined') { var ol_padyb = 1; } + +// If the user by default must supply all html for complete popup control. +// Set to 1 to activate, 0 otherwise. +if (typeof ol_fullhtml == 'undefined') { var ol_fullhtml = 0; } + +// Default vertical position of the popup. Default should normally be BELOW. +// ABOVE only works when HEIGHT is defined. +if (typeof ol_vpos == 'undefined') { var ol_vpos = BELOW; } + +// Default height of popup to use when placing the popup above the cursor. +if (typeof ol_aboveheight == 'undefined') { var ol_aboveheight = 0; } + +// Default icon to place next to the popups caption. +if (typeof ol_caption == 'undefined') { var ol_capicon = ""; } + +// Default frame. We default to current frame if there is no frame defined. +if (typeof ol_frame == 'undefined') { var ol_frame = self; } + +// Default timeout. By default there is no timeout. +if (typeof ol_timeout == 'undefined') { var ol_timeout = 0; } + +// Default javascript funktion. By default there is none. +if (typeof ol_function == 'undefined') { var ol_function = Function(); } + +// Default timeout. By default there is no timeout. +if (typeof ol_delay == 'undefined') { var ol_delay = 0; } + +// If overLIB should decide the horizontal placement. +if (typeof ol_hauto == 'undefined') { var ol_hauto = 0; } + +// If overLIB should decide the vertical placement. +if (typeof ol_vauto == 'undefined') { var ol_vauto = 0; } + + + +// If the user has to click to close stickies. +if (typeof ol_closeclick == 'undefined') { var ol_closeclick = 0; } + +// This variable determines if you want to use CSS or inline definitions. +// CSSOFF=no CSS CSSSTYLE=use CSS inline styles CSSCLASS=use classes +if (typeof ol_css == 'undefined') { var ol_css = CSSOFF; } + +// Main background class (eqv of fgcolor) +// This is only used if CSS is set to use classes (ol_css = CSSCLASS) +if (typeof ol_fgclass == 'undefined') { var ol_fgclass = ""; } + +// Frame background class (eqv of bgcolor) +// This is only used if CSS is set to use classes (ol_css = CSSCLASS) +if (typeof ol_bgclass == 'undefined') { var ol_bgclass = ""; } + +// Main font class +// This is only used if CSS is set to use classes (ol_css = CSSCLASS) +if (typeof ol_textfontclass == 'undefined') { var ol_textfontclass = ""; } + +// Caption font class +// This is only used if CSS is set to use classes (ol_css = CSSCLASS) +if (typeof ol_captionfontclass == 'undefined') { var ol_captionfontclass = ""; } + +// Close font class +// This is only used if CSS is set to use classes (ol_css = CSSCLASS) +if (typeof ol_closefontclass == 'undefined') { var ol_closefontclass = ""; } + +// Unit to be used for the text padding above +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +// Options include "px", "%", "in", "cm" and more +if (typeof ol_padunit == 'undefined') { var ol_padunit = "px";} + +// Unit to be used for height of popup +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +// Options include "px", "%", "in", "cm" and more +if (typeof ol_heightunit == 'undefined') { var ol_heightunit = "px";} + +// Unit to be used for width of popup +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +// Options include "px", "%", "in", "cm" and more +if (typeof ol_widthunit == 'undefined') { var ol_widthunit = "px";} + +// Font size unit for the main text +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_textsizeunit == 'undefined') { var ol_textsizeunit = "px";} + +// Decoration of the main text ("none", "underline", "line-through" or "blink") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_textdecoration == 'undefined') { var ol_textdecoration = "none";} + +// Font style of the main text ("normal" or "italic") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_textstyle == 'undefined') { var ol_textstyle = "normal";} + +// Font weight of the main text ("normal", "bold", "bolder", "lighter", ect.) +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_textweight == 'undefined') { var ol_textweight = "normal";} + +// Font size unit for the caption +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_captionsizeunit == 'undefined') { var ol_captionsizeunit = "px";} + +// Decoration of the caption ("none", "underline", "line-through" or "blink") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_captiondecoration == 'undefined') { var ol_captiondecoration = "none";} + +// Font style of the caption ("normal" or "italic") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_captionstyle == 'undefined') { var ol_captionstyle = "normal";} + +// Font weight of the caption ("normal", "bold", "bolder", "lighter", ect.) +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_captionweight == 'undefined') { var ol_captionweight = "bold";} + +// Font size unit for the close text +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_closesizeunit == 'undefined') { var ol_closesizeunit = "px";} + +// Decoration of the close text ("none", "underline", "line-through" or "blink") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_closedecoration == 'undefined') { var ol_closedecoration = "none";} + +// Font style of the close text ("normal" or "italic") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_closestyle == 'undefined') { var ol_closestyle = "normal";} + +// Font weight of the close text ("normal", "bold", "bolder", "lighter", ect.) +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_closeweight == 'undefined') { var ol_closeweight = "normal";} + + + +//////////////////////////////////////////////////////////////////////////////////// +// ARRAY CONFIGURATION +// You don't have to change anything here if you don't want to. The following +// arrays can be filled with text and html if you don't wish to pass it from +// your html page. +//////////////////////////////////////////////////////////////////////////////////// + +// Array with texts. +if (typeof ol_texts == 'undefined') { var ol_texts = new Array("Text 0", "Text 1"); } + +// Array with captions. +if (typeof ol_caps == 'undefined') { var ol_caps = new Array("Caption 0", "Caption 1"); } + + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION +// Don't change anything below this line, all configuration is above. +//////////////////////////////////////////////////////////////////////////////////// + + + + + + + +//////////////////////////////////////////////////////////////////////////////////// +// INIT +//////////////////////////////////////////////////////////////////////////////////// + +// Runtime variables init. Used for runtime only, don't change, not for config! +var o3_text = ""; +var o3_cap = ""; +var o3_sticky = 0; +var o3_background = ""; +var o3_close = "Close"; +var o3_hpos = RIGHT; +var o3_offsetx = 2; +var o3_offsety = 2; +var o3_fgcolor = ""; +var o3_bgcolor = ""; +var o3_textcolor = ""; +var o3_capcolor = ""; +var o3_closecolor = ""; +var o3_width = 100; +var o3_border = 1; +var o3_status = ""; +var o3_autostatus = 0; +var o3_height = -1; +var o3_snapx = 0; +var o3_snapy = 0; +var o3_fixx = -1; +var o3_fixy = -1; +var o3_fgbackground = ""; +var o3_bgbackground = ""; +var o3_padxl = 0; +var o3_padxr = 0; +var o3_padyt = 0; +var o3_padyb = 0; +var o3_fullhtml = 0; +var o3_vpos = BELOW; +var o3_aboveheight = 0; +var o3_capicon = ""; +var o3_textfont = "Verdana,Arial,Helvetica"; +var o3_captionfont = "Verdana,Arial,Helvetica"; +var o3_closefont = "Verdana,Arial,Helvetica"; +var o3_textsize = "1"; +var o3_captionsize = "1"; +var o3_closesize = "1"; +var o3_frame = self; +var o3_timeout = 0; +var o3_timerid = 0; +var o3_allowmove = 0; +var o3_function = Function(); +var o3_delay = 0; +var o3_delayid = 0; +var o3_hauto = 0; +var o3_vauto = 0; +var o3_closeclick = 0; + +var o3_css = CSSOFF; +var o3_fgclass = ""; +var o3_bgclass = ""; +var o3_textfontclass = ""; +var o3_captionfontclass = ""; +var o3_closefontclass = ""; +var o3_padunit = "px"; +var o3_heightunit = "px"; +var o3_widthunit = "px"; +var o3_textsizeunit = "px"; +var o3_textdecoration = ""; +var o3_textstyle = ""; +var o3_textweight = ""; +var o3_captionsizeunit = "px"; +var o3_captiondecoration = ""; +var o3_captionstyle = ""; +var o3_captionweight = ""; +var o3_closesizeunit = "px"; +var o3_closedecoration = ""; +var o3_closestyle = ""; +var o3_closeweight = ""; + + + +// Display state variables +var o3_x = 0; +var o3_y = 0; +var o3_allow = 0; +var o3_showingsticky = 0; +var o3_removecounter = 0; + +// Our layer +var over = null; + + +// Decide browser version +var ns4 = (document.layers)? true:false; +var ns6 = (document.getElementById)? true:false; +var ie4 = (document.all)? true:false; +var ie5 = false; + +// Microsoft Stupidity Check(tm). +if (ie4) { + if ((navigator.userAgent.indexOf('MSIE 5') > 0) || (navigator.userAgent.indexOf('MSIE 6') > 0)) { + ie5 = true; + } + if (ns6) { + ns6 = false; + } +} + + +// Capture events, alt. diffuses the overlib function. +if ( (ns4) || (ie4) || (ns6)) { + document.onmousemove = mouseMove + if (ns4) document.captureEvents(Event.MOUSEMOVE) +} else { + overlib = no_overlib; + nd = no_overlib; + ver3fix = true; +} + + +// Fake function for 3.0 users. +function no_overlib() { + return ver3fix; +} + + + +//////////////////////////////////////////////////////////////////////////////////// +// PUBLIC FUNCTIONS +//////////////////////////////////////////////////////////////////////////////////// + + +// overlib(arg0, ..., argN) +// Loads parameters into global runtime variables. +function overlib() { + + // Load defaults to runtime. + o3_text = ol_text; + o3_cap = ol_cap; + o3_sticky = ol_sticky; + o3_background = ol_background; + o3_close = ol_close; + o3_hpos = ol_hpos; + o3_offsetx = ol_offsetx; + o3_offsety = ol_offsety; + o3_fgcolor = ol_fgcolor; + o3_bgcolor = ol_bgcolor; + o3_textcolor = ol_textcolor; + o3_capcolor = ol_capcolor; + o3_closecolor = ol_closecolor; + o3_width = ol_width; + o3_border = ol_border; + o3_status = ol_status; + o3_autostatus = ol_autostatus; + o3_height = ol_height; + o3_snapx = ol_snapx; + o3_snapy = ol_snapy; + o3_fixx = ol_fixx; + o3_fixy = ol_fixy; + o3_fgbackground = ol_fgbackground; + o3_bgbackground = ol_bgbackground; + o3_padxl = ol_padxl; + o3_padxr = ol_padxr; + o3_padyt = ol_padyt; + o3_padyb = ol_padyb; + o3_fullhtml = ol_fullhtml; + o3_vpos = ol_vpos; + o3_aboveheight = ol_aboveheight; + o3_capicon = ol_capicon; + o3_textfont = ol_textfont; + o3_captionfont = ol_captionfont; + o3_closefont = ol_closefont; + o3_textsize = ol_textsize; + o3_captionsize = ol_captionsize; + o3_closesize = ol_closesize; + o3_timeout = ol_timeout; + o3_function = ol_function; + o3_delay = ol_delay; + o3_hauto = ol_hauto; + o3_vauto = ol_vauto; + o3_closeclick = ol_closeclick; + + o3_css = ol_css; + o3_fgclass = ol_fgclass; + o3_bgclass = ol_bgclass; + o3_textfontclass = ol_textfontclass; + o3_captionfontclass = ol_captionfontclass; + o3_closefontclass = ol_closefontclass; + o3_padunit = ol_padunit; + o3_heightunit = ol_heightunit; + o3_widthunit = ol_widthunit; + o3_textsizeunit = ol_textsizeunit; + o3_textdecoration = ol_textdecoration; + o3_textstyle = ol_textstyle; + o3_textweight = ol_textweight; + o3_captionsizeunit = ol_captionsizeunit; + o3_captiondecoration = ol_captiondecoration; + o3_captionstyle = ol_captionstyle; + o3_captionweight = ol_captionweight; + o3_closesizeunit = ol_closesizeunit; + o3_closedecoration = ol_closedecoration; + o3_closestyle = ol_closestyle; + o3_closeweight = ol_closeweight; + + + // Special for frame support, over must be reset... + if ( (ns4) || (ie4) || (ns6) ) { + o3_frame = ol_frame; + if (ns4) over = o3_frame.document.overDiv + if (ie4) over = o3_frame.overDiv.style + if (ns6) over = o3_frame.document.getElementById("overDiv"); + } + + + // What the next argument is expected to be. + var parsemode = -1; + + var ar = arguments; + + for (i = 0; i < ar.length; i++) { + + if (parsemode < 0) { + // Arg is maintext, unless INARRAY + if (ar[i] == INARRAY) { + o3_text = ol_texts[ar[++i]]; + } else { + o3_text = ar[i]; + } + + parsemode = 0; + } else { + // Note: NS4 doesn't like switch cases with vars. + if (ar[i] == INARRAY) { o3_text = ol_texts[ar[++i]]; continue; } + if (ar[i] == CAPARRAY) { o3_cap = ol_caps[ar[++i]]; continue; } + if (ar[i] == STICKY) { o3_sticky = 1; continue; } + if (ar[i] == BACKGROUND) { o3_background = ar[++i]; continue; } + if (ar[i] == NOCLOSE) { o3_close = ""; continue; } + if (ar[i] == CAPTION) { o3_cap = ar[++i]; continue; } + if (ar[i] == CENTER || ar[i] == LEFT || ar[i] == RIGHT) { o3_hpos = ar[i]; continue; } + if (ar[i] == OFFSETX) { o3_offsetx = ar[++i]; continue; } + if (ar[i] == OFFSETY) { o3_offsety = ar[++i]; continue; } + if (ar[i] == FGCOLOR) { o3_fgcolor = ar[++i]; continue; } + if (ar[i] == BGCOLOR) { o3_bgcolor = ar[++i]; continue; } + if (ar[i] == TEXTCOLOR) { o3_textcolor = ar[++i]; continue; } + if (ar[i] == CAPCOLOR) { o3_capcolor = ar[++i]; continue; } + if (ar[i] == CLOSECOLOR) { o3_closecolor = ar[++i]; continue; } + if (ar[i] == WIDTH) { o3_width = ar[++i]; continue; } + if (ar[i] == BORDER) { o3_border = ar[++i]; continue; } + if (ar[i] == STATUS) { o3_status = ar[++i]; continue; } + if (ar[i] == AUTOSTATUS) { o3_autostatus = 1; continue; } + if (ar[i] == AUTOSTATUSCAP) { o3_autostatus = 2; continue; } + if (ar[i] == HEIGHT) { o3_height = ar[++i]; o3_aboveheight = ar[i]; continue; } // Same param again. + if (ar[i] == CLOSETEXT) { o3_close = ar[++i]; continue; } + if (ar[i] == SNAPX) { o3_snapx = ar[++i]; continue; } + if (ar[i] == SNAPY) { o3_snapy = ar[++i]; continue; } + if (ar[i] == FIXX) { o3_fixx = ar[++i]; continue; } + if (ar[i] == FIXY) { o3_fixy = ar[++i]; continue; } + if (ar[i] == FGBACKGROUND) { o3_fgbackground = ar[++i]; continue; } + if (ar[i] == BGBACKGROUND) { o3_bgbackground = ar[++i]; continue; } + if (ar[i] == PADX) { o3_padxl = ar[++i]; o3_padxr = ar[++i]; continue; } + if (ar[i] == PADY) { o3_padyt = ar[++i]; o3_padyb = ar[++i]; continue; } + if (ar[i] == FULLHTML) { o3_fullhtml = 1; continue; } + if (ar[i] == BELOW || ar[i] == ABOVE) { o3_vpos = ar[i]; continue; } + if (ar[i] == CAPICON) { o3_capicon = ar[++i]; continue; } + if (ar[i] == TEXTFONT) { o3_textfont = ar[++i]; continue; } + if (ar[i] == CAPTIONFONT) { o3_captionfont = ar[++i]; continue; } + if (ar[i] == CLOSEFONT) { o3_closefont = ar[++i]; continue; } + if (ar[i] == TEXTSIZE) { o3_textsize = ar[++i]; continue; } + if (ar[i] == CAPTIONSIZE) { o3_captionsize = ar[++i]; continue; } + if (ar[i] == CLOSESIZE) { o3_closesize = ar[++i]; continue; } + if (ar[i] == FRAME) { opt_FRAME(ar[++i]); continue; } + if (ar[i] == TIMEOUT) { o3_timeout = ar[++i]; continue; } + if (ar[i] == FUNCTION) { opt_FUNCTION(ar[++i]); continue; } + if (ar[i] == DELAY) { o3_delay = ar[++i]; continue; } + if (ar[i] == HAUTO) { o3_hauto = (o3_hauto == 0) ? 1 : 0; continue; } + if (ar[i] == VAUTO) { o3_vauto = (o3_vauto == 0) ? 1 : 0; continue; } + if (ar[i] == CLOSECLICK) { o3_closeclick = (o3_closeclick == 0) ? 1 : 0; continue; } + if (ar[i] == CSSOFF) { o3_css = ar[i]; continue; } + if (ar[i] == CSSSTYLE) { o3_css = ar[i]; continue; } + if (ar[i] == CSSCLASS) { o3_css = ar[i]; continue; } + if (ar[i] == FGCLASS) { o3_fgclass = ar[++i]; continue; } + if (ar[i] == BGCLASS) { o3_bgclass = ar[++i]; continue; } + if (ar[i] == TEXTFONTCLASS) { o3_textfontclass = ar[++i]; continue; } + if (ar[i] == CAPTIONFONTCLASS) { o3_captionfontclass = ar[++i]; continue; } + if (ar[i] == CLOSEFONTCLASS) { o3_closefontclass = ar[++i]; continue; } + if (ar[i] == PADUNIT) { o3_padunit = ar[++i]; continue; } + if (ar[i] == HEIGHTUNIT) { o3_heightunit = ar[++i]; continue; } + if (ar[i] == WIDTHUNIT) { o3_widthunit = ar[++i]; continue; } + if (ar[i] == TEXTSIZEUNIT) { o3_textsizeunit = ar[++i]; continue; } + if (ar[i] == TEXTDECORATION) { o3_textdecoration = ar[++i]; continue; } + if (ar[i] == TEXTSTYLE) { o3_textstyle = ar[++i]; continue; } + if (ar[i] == TEXTWEIGHT) { o3_textweight = ar[++i]; continue; } + if (ar[i] == CAPTIONSIZEUNIT) { o3_captionsizeunit = ar[++i]; continue; } + if (ar[i] == CAPTIONDECORATION) { o3_captiondecoration = ar[++i]; continue; } + if (ar[i] == CAPTIONSTYLE) { o3_captionstyle = ar[++i]; continue; } + if (ar[i] == CAPTIONWEIGHT) { o3_captionweight = ar[++i]; continue; } + if (ar[i] == CLOSESIZEUNIT) { o3_closesizeunit = ar[++i]; continue; } + if (ar[i] == CLOSEDECORATION) { o3_closedecoration = ar[++i]; continue; } + if (ar[i] == CLOSESTYLE) { o3_closestyle = ar[++i]; continue; } + if (ar[i] == CLOSEWEIGHT) { o3_closeweight = ar[++i]; continue; } + } + } + + if (o3_delay == 0) { + return overlib350(); + } else { + o3_delayid = setTimeout("overlib350()", o3_delay); + + if (o3_sticky) { + return false; + } else { + return true; + } + } +} + + + +// Clears popups if appropriate +function nd() { + if ( o3_removecounter >= 1 ) { o3_showingsticky = 0 }; + if ( (ns4) || (ie4) || (ns6) ) { + if ( o3_showingsticky == 0 ) { + o3_allowmove = 0; + if (over != null) hideObject(over); + } else { + o3_removecounter++; + } + } + + return true; +} + + + + + + + +//////////////////////////////////////////////////////////////////////////////////// +// OVERLIB 3.50 FUNCTION +//////////////////////////////////////////////////////////////////////////////////// + + +// This function decides what it is we want to display and how we want it done. +function overlib350() { + + // Make layer content + var layerhtml; + + if (o3_background != "" || o3_fullhtml) { + // Use background instead of box. + layerhtml = ol_content_background(o3_text, o3_background, o3_fullhtml); + } else { + // They want a popup box. + + // Prepare popup background + if (o3_fgbackground != "" && o3_css == CSSOFF) { + o3_fgbackground = "BACKGROUND=\""+o3_fgbackground+"\""; + } + if (o3_bgbackground != "" && o3_css == CSSOFF) { + o3_bgbackground = "BACKGROUND=\""+o3_bgbackground+"\""; + } + + // Prepare popup colors + if (o3_fgcolor != "" && o3_css == CSSOFF) { + o3_fgcolor = "BGCOLOR=\""+o3_fgcolor+"\""; + } + if (o3_bgcolor != "" && o3_css == CSSOFF) { + o3_bgcolor = "BGCOLOR=\""+o3_bgcolor+"\""; + } + + // Prepare popup height + if (o3_height > 0 && o3_css == CSSOFF) { + o3_height = "HEIGHT=" + o3_height; + } else { + o3_height = ""; + } + + // Decide which kinda box. + if (o3_cap == "") { + // Plain + layerhtml = ol_content_simple(o3_text); + } else { + // With caption + if (o3_sticky) { + // Show close text + layerhtml = ol_content_caption(o3_text, o3_cap, o3_close); + } else { + // No close text + layerhtml = ol_content_caption(o3_text, o3_cap, ""); + } + } + } + + // We want it to stick! + if (o3_sticky) { + o3_showingsticky = 1; + o3_removecounter = 0; + } + + // Write layer + layerWrite(layerhtml); + + // Prepare status bar + if (o3_autostatus > 0) { + o3_status = o3_text; + if (o3_autostatus > 1) { + o3_status = o3_cap; + } + } + + // When placing the layer the first time, even stickies may be moved. + o3_allowmove = 0; + + // Initiate a timer for timeout + if (o3_timeout > 0) { + if (o3_timerid > 0) clearTimeout(o3_timerid); + o3_timerid = setTimeout("cClick()", o3_timeout); + } + + // Show layer + disp(o3_status); + + // Stickies should stay where they are. + if (o3_sticky) { + o3_allowmove = 0; + return false; + } else { + return true; + } +} + + + +//////////////////////////////////////////////////////////////////////////////////// +// LAYER GENERATION FUNCTIONS +//////////////////////////////////////////////////////////////////////////////////// + +// Makes simple table without caption +function ol_content_simple(text) { + if (o3_css == CSSCLASS) txt = "
"+text+"
"; + if (o3_css == CSSSTYLE) txt = "
"+text+"
"; + if (o3_css == CSSOFF) txt = "
"+text+"
"; + + set_background(""); + return txt; +} + + + + +// Makes table with caption and optional close link +function ol_content_caption(text, title, close) { + closing = ""; + closeevent = "onMouseOver"; + + if (o3_closeclick == 1) closeevent = "onClick"; + if (o3_capicon != "") o3_capicon = " "; + + if (close != "") { + if (o3_css == CSSCLASS) closing = ""+close+""; + if (o3_css == CSSSTYLE) closing = ""+close+""; + if (o3_css == CSSOFF) closing = ""+close+""; + } + + if (o3_css == CSSCLASS) txt = "
"+closing+"
"+o3_capicon+title+"
"+text+"
"; + if (o3_css == CSSSTYLE) txt = "
"+closing+"
"+o3_capicon+title+"
"+text+"
"; + if (o3_css == CSSOFF) txt = "
"+closing+"
"+o3_capicon+title+"
"+text+"
"; + + set_background(""); + return txt; +} + +// Sets the background picture, padding and lots more. :) +function ol_content_background(text, picture, hasfullhtml) { + if (hasfullhtml) { + txt = text; + } else { + if (o3_css == CSSCLASS) txt = "
"+text+"
"; + if (o3_css == CSSSTYLE) txt = "
"+text+"
"; + if (o3_css == CSSOFF) txt = "
"+text+"
"; + } + set_background(picture); + return txt; +} + +// Loads a picture into the div. +function set_background(pic) { + if (pic == "") { + if (ie4) over.backgroundImage = "none"; + if (ns6) over.style.backgroundImage = "none"; + } else { + if (ns4) { + over.background.src = pic; + } else if (ie4) { + over.backgroundImage = "url("+pic+")"; + } else if (ns6) { + over.style.backgroundImage = "url("+pic+")"; + } + } +} + + + +//////////////////////////////////////////////////////////////////////////////////// +// HANDLING FUNCTIONS +//////////////////////////////////////////////////////////////////////////////////// + + +// Displays the popup +function disp(statustext) { + if ( (ns4) || (ie4) || (ns6) ) { + if (o3_allowmove == 0) { + placeLayer(); + showObject(over); + o3_allowmove = 1; + } + } + + if (statustext != "") { + self.status = statustext; + } +} + +// Decides where we want the popup. +function placeLayer() { + var placeX, placeY; + + // HORIZONTAL PLACEMENT + if (o3_fixx > -1) { + // Fixed position + placeX = o3_fixx; + } else { + winoffset = (ie4) ? o3_frame.document.body.scrollLeft : o3_frame.pageXOffset; + if (ie4) iwidth = o3_frame.document.body.clientWidth; + if (ns4) iwidth = o3_frame.innerWidth; // was screwed in mozilla, fixed now? + if (ns6) iwidth = o3_frame.outerWidth; + + // If HAUTO, decide what to use. + if (o3_hauto == 1) { + if ( (o3_x - winoffset) > ((eval(iwidth)) / 2)) { + o3_hpos = LEFT; + } else { + o3_hpos = RIGHT; + } + } + + // From mouse + if (o3_hpos == CENTER) { // Center + placeX = o3_x+o3_offsetx-(o3_width/2); + } + if (o3_hpos == RIGHT) { // Right + placeX = o3_x+o3_offsetx; + if ( (eval(placeX) + eval(o3_width)) > (winoffset + iwidth) ) { + placeX = iwidth + winoffset - o3_width; + if (placeX < 0) placeX = 0; + } + } + if (o3_hpos == LEFT) { // Left + placeX = o3_x-o3_offsetx-o3_width; + if (placeX < winoffset) placeX = winoffset; + } + + // Snapping! + if (o3_snapx > 1) { + var snapping = placeX % o3_snapx; + if (o3_hpos == LEFT) { + placeX = placeX - (o3_snapx + snapping); + } else { + // CENTER and RIGHT + placeX = placeX + (o3_snapx - snapping); + } + if (placeX < winoffset) placeX = winoffset; + } + } + + + + // VERTICAL PLACEMENT + if (o3_fixy > -1) { + // Fixed position + placeY = o3_fixy; + } else { + scrolloffset = (ie4) ? o3_frame.document.body.scrollTop : o3_frame.pageYOffset; + + // If VAUTO, decide what to use. + if (o3_vauto == 1) { + if (ie4) iheight = o3_frame.document.body.clientHeight; + if (ns4) iheight = o3_frame.innerHeight; + if (ns6) iheight = o3_frame.outerHeight; + + iheight = (eval(iheight)) / 2; + if ( (o3_y - scrolloffset) > iheight) { + o3_vpos = ABOVE; + } else { + o3_vpos = BELOW; + } + } + + + // From mouse + if (o3_vpos == ABOVE) { + if (o3_aboveheight == 0) { + var divref = (ie4) ? o3_frame.document.all['overDiv'] : over; + o3_aboveheight = (ns4) ? divref.clip.height : divref.offsetHeight; + } + + placeY = o3_y - (o3_aboveheight + o3_offsety); + if (placeY < scrolloffset) placeY = scrolloffset; + } else { + // BELOW + placeY = o3_y + o3_offsety; + } + + // Snapping! + if (o3_snapy > 1) { + var snapping = placeY % o3_snapy; + + if (o3_aboveheight > 0 && o3_vpos == ABOVE) { + placeY = placeY - (o3_snapy + snapping); + } else { + placeY = placeY + (o3_snapy - snapping); + } + + if (placeY < scrolloffset) placeY = scrolloffset; + } + } + + + // Actually move the object. + repositionTo(over, placeX, placeY); +} + + +// Moves the layer +function mouseMove(e) { + if ( (ns4) || (ns6) ) {o3_x=e.pageX; o3_y=e.pageY;} + if (ie4) {o3_x=event.x; o3_y=event.y;} + if (ie5) {o3_x=event.x+o3_frame.document.body.scrollLeft; o3_y=event.y+o3_frame.document.body.scrollTop;} + + if (o3_allowmove == 1) { + placeLayer(); + } +} + +// The Close onMouseOver function for stickies +function cClick() { + hideObject(over); + o3_showingsticky = 0; + + return false; +} + + +// Makes sure target frame has overLIB +function compatibleframe(frameid) { + if (ns4) { + if (typeof frameid.document.overDiv =='undefined') return false; + } else if (ie4) { + if (typeof frameid.document.all["overDiv"] =='undefined') return false; + } else if (ns6) { + if (frameid.document.getElementById('overDiv') == null) return false; + } + + return true; +} + + + +//////////////////////////////////////////////////////////////////////////////////// +// LAYER FUNCTIONS +//////////////////////////////////////////////////////////////////////////////////// + + +// Writes to a layer +function layerWrite(txt) { + txt += "\n"; + + if (ns4) { + var lyr = o3_frame.document.overDiv.document + + lyr.write(txt) + lyr.close() + } else if (ie4) { + o3_frame.document.all["overDiv"].innerHTML = txt + } else if (ns6) { + range = o3_frame.document.createRange(); + range.setStartBefore(over); + domfrag = range.createContextualFragment(txt); + while (over.hasChildNodes()) { + over.removeChild(over.lastChild); + } + over.appendChild(domfrag); + } +} + +// Make an object visible +function showObject(obj) { + if (ns4) obj.visibility = "show"; + else if (ie4) obj.visibility = "visible"; + else if (ns6) obj.style.visibility = "visible"; +} + +// Hides an object +function hideObject(obj) { + if (ns4) obj.visibility = "hide"; + else if (ie4) obj.visibility = "hidden"; + else if (ns6) obj.style.visibility = "hidden"; + + if (o3_timerid > 0) clearTimeout(o3_timerid); + if (o3_delayid > 0) clearTimeout(o3_delayid); + o3_timerid = 0; + o3_delayid = 0; + self.status = ""; +} + +// Move a layer +function repositionTo(obj,xL,yL) { + if ( (ns4) || (ie4) ) { + obj.left = xL; + obj.top = yL; + } else if (ns6) { + obj.style.left = xL + "px"; + obj.style.top = yL+ "px"; + } +} + + + + + +//////////////////////////////////////////////////////////////////////////////////// +// PARSER FUNCTIONS +//////////////////////////////////////////////////////////////////////////////////// + + +// Defines which frame we should point to. +function opt_FRAME(frm) { + o3_frame = compatibleframe(frm) ? frm : ol_frame; + + if ( (ns4) || (ie4 || (ns6)) ) { + if (ns4) over = o3_frame.document.overDiv; + if (ie4) over = o3_frame.overDiv.style; + if (ns6) over = o3_frame.document.getElementById("overDiv"); + } + + return 0; +} + +// Calls an external function +function opt_FUNCTION(callme) { + o3_text = callme() + return 0; +} + + + + +//end (For internal purposes.) +//////////////////////////////////////////////////////////////////////////////////// +// OVERLIB 2 COMPATABILITY FUNCTIONS +// If you aren't upgrading you can remove the below section. +//////////////////////////////////////////////////////////////////////////////////// + +// Converts old 0=left, 1=right and 2=center into constants. +function vpos_convert(d) { + if (d == 0) { + d = LEFT; + } else { + if (d == 1) { + d = RIGHT; + } else { + d = CENTER; + } + } + + return d; +} + +// Simple popup +function dts(d,text) { + o3_hpos = vpos_convert(d); + overlib(text, o3_hpos, CAPTION, ""); +} + +// Caption popup +function dtc(d,text, title) { + o3_hpos = vpos_convert(d); + overlib(text, CAPTION, title, o3_hpos); +} + +// Sticky +function stc(d,text, title) { + o3_hpos = vpos_convert(d); + overlib(text, CAPTION, title, o3_hpos, STICKY); +} + +// Simple popup right +function drs(text) { + dts(1,text); +} + +// Caption popup right +function drc(text, title) { + dtc(1,text,title); +} + +// Sticky caption right +function src(text,title) { + stc(1,text,title); +} + +// Simple popup left +function dls(text) { + dts(0,text); +} + +// Caption popup left +function dlc(text, title) { + dtc(0,text,title); +} + +// Sticky caption left +function slc(text,title) { + stc(0,text,title); +} + +// Simple popup center +function dcs(text) { + dts(2,text); +} + +// Caption popup center +function dcc(text, title) { + dtc(2,text,title); +} + +// Sticky caption center +function scc(text,title) { + stc(2,text,title); +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/pom.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/pom.xml Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,128 @@ + + 4.0.0 + cewolf + cewolf + jar + 1.0 + Cewolf + http://cewolf.sourceforge.net + + + + Cewolf is a tag library for JfreeChart. + JFreeChart is a class library, written in Java, for generating charts. + Utilising the Java2D APIs, it currently supports bar charts, pie charts, + line charts, XY-plots and time series plots. + + + + http://cvs.sourceforge.net/viewcvs.py/cewolf/ + + scm:cvs:pserver:anonymous@cvs.sourceforge.net:/cvsroot/cewolf/cewolf + + + + + + + maven-assembly-plugin + 2.0-beta-1 + + + src/main/assembly/assembly.xml + ${pom.artifactId}-${pom.version} + target + target/assembly/work + + + + + maven-javadoc-plugin + + + package + + javadoc + + + + + + + + + batik + batik-dom + 1.6 + compile + + + batik + batik-awt-util + 1.6 + compile + + + batik + batik-svggen + 1.6 + compile + + + batik + batik-xml + 1.6 + compile + + + batik + batik-util + 1.6 + compile + + + commons-logging + commons-logging + 1.0.4 + compile + + + log4j + log4j + 1.2.12 + compile + + + crimson + crimson + 1.1.3 + compile + + + + javax.servlet + servlet-api + 2.3 + provided + + + jfreechart + jfreechart + 1.0.0 + compile + + + jfree + jcommon + 1.0.0 + compile + + + gnujaxp + gnujaxp + 1.0.0 + compile + + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/repository/gnujaxp/gnujaxp.jar Binary file java/cewolf-1.0/repository/gnujaxp/gnujaxp.jar has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/repository/gnujaxp/pom.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/repository/gnujaxp/pom.xml Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,30 @@ + + 4.0.0 + + gnujaxp + gnujaxp + 1.0.0 + + + + maven-antrun-plugin + + + generate-sources + + + + + + + + run + + + + + + + \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/repository/pom.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/repository/pom.xml Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,11 @@ + + 4.0.0 + cewolf.repository + parent + 1.0 + pom + + gnujaxp + + \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/assembly/assembly.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/assembly/assembly.xml Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,45 @@ + + bin-src + + zip + + + + + RELEASE* + LICENSE* + NOTICE* + *.txt + pom.xml + .* + + + + target + /lib + + *.jar + + + + src + + + repository + + + target/javadoc + + + src/main/resources + /etc + + + + + /lib + false + compile + + + \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/CewolfException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/CewolfException.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,52 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf; + +/** + * Base class of all Cewolf related exceptions + * @author Guido Laures + */ +public class CewolfException extends Exception { + + /** Creates a new instance of CewolfException without detail message. */ + public CewolfException() { + } + + /** + * Constructs an instance of CewolfException with the specified detail message. + * @param msg the detail message. + */ + public CewolfException(String msg) { + super(msg); + } + + /** + * Constructs exception with causing exception + * @param msg message + * @param cause cause exception + */ + public CewolfException(String msg, Exception cause) { + super(msg, cause); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/CewolfRenderer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/CewolfRenderer.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,265 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.Writer; +import java.util.Enumeration; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import de.laures.cewolf.util.RenderingHelper; + +/** + * The rendering servlet of Cewolf. It is resposible for writing an entire chart + * img into the response stream of the client. Everything needed for this is + * prepared already by the ChartImgTag resp. LegendTag. The ID of a chart image + * is passed to this servlet as a request parameter. After that the image object + * is retrieved from the server side session based image cache. This servlet + * must be configured in web.xml of the web application in order to use Cewolf + * services. The servlet's URL relative to the web apps root is used as the + * renderer attribute of the ChartImgTag resp. LegendTag in the JSP page. + * + * @see de.laures.cewolf.taglib.tags.ChartImgTag + * @see de.laures.cewolf.taglib.tags.LegendTag + * @author Guido Laures + * @since 0.1 + */ +public class CewolfRenderer extends HttpServlet implements WebConstants +{ + + public static final String INIT_CONFIG = "CewolfRenderer_Init_Config"; + private static final String STATE = "state"; + private boolean debugged = false; + private int requestCount = 0; + private Byte lock = Byte.valueOf("0"); + private Configuration config = null; + + public void init( ServletConfig servletCfg ) throws ServletException + { + super.init(servletCfg); + + //Store init config params for processing by the Configuration + servletCfg.getServletContext().setAttribute(INIT_CONFIG, servletCfg); + config = Configuration.getInstance(servletCfg.getServletContext()); + + if (config != null) + this.debugged = config.isDebugged(); + else + this.debugged = false; + } + + /** + * Processes HTTP GET request. Renders the chart or the lengend + * into the client's response stream. + * + * @param request + * servlet request + * @param response + * servlet response + * @throws ServletException + * when the production of data could not be handled by the + * configured DatasetProcuder + */ + + public void printParameters(HttpServletRequest request) + { + Enumeration enumeration = request.getParameterNames(); + while (enumeration.hasMoreElements()) + { + String cur = (String)enumeration.nextElement(); + Object obj = request.getParameter(cur); + + log("Request Parameter -> " + cur + " Value -> " + obj.toString()); + } + } + + protected void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException + { + if ( debugged ) + { + logRequest(request); + } + addHeaders(response); + if ( request.getParameter(STATE) != null || !request.getParameterNames().hasMoreElements() ) + { + requestState(response); + return; + } + synchronized (lock) { + requestCount++; + } + + int width = 400; + int height = 400; + boolean removeAfterRendering = false; + if ( request.getParameter(REMOVE_AFTER_RENDERING) != null ) + { + removeAfterRendering = true; + } + if ( request.getParameter(WIDTH_PARAM) != null ) + { + width = Integer.parseInt(request.getParameter(WIDTH_PARAM)); + } + if ( request.getParameter(HEIGHT_PARAM) != null ) + { + height = Integer.parseInt(request.getParameter(HEIGHT_PARAM)); + } + + // determine the cache key + String imgKey = request.getParameter(IMG_PARAM); + if ( imgKey == null ) + { + logAndRenderException(new ServletException("no '" + IMG_PARAM + "' parameter provided for Cewolf servlet."), response, width, height); + return; + } + Storage storage = config.getStorage(); + ChartImage chartImage = storage.getChartImage(imgKey, request); + if ( chartImage == null ) + { + renderImageExpiry(response, width, height); + return; + } + // send the img + try + { + long start = System.currentTimeMillis(); + // response.setContentType(cid.getMimeType()); + final int size = chartImage.getSize(); + response.setContentType(chartImage.getMimeType()); + response.setContentLength(size); + response.setBufferSize(size); + response.setStatus(HttpServletResponse.SC_OK); + response.getOutputStream().write(chartImage.getBytes()); + long last = System.currentTimeMillis() - start; + if ( debugged ) + { + log("creation time for chart " + imgKey + ": " + last + "ms."); + } + } + catch (Throwable t) + { + logAndRenderException(t, response, width, height); + } + finally + { + if (removeAfterRendering) + { + try { + storage.removeChartImage(imgKey , request); + } catch (CewolfException e) { + log("Removal of image failed", e); + } + } + } + } + + /** + * Method addHeaders. + * + * @param response + */ + private void addHeaders( HttpServletResponse response ) + { + response.setDateHeader("Expires", System.currentTimeMillis()); + } + + /** + * Method requestState. + * + * @param request + * @param response + */ + private void requestState( HttpServletResponse response ) throws IOException + { + Writer writer = response.getWriter(); + writer.write(""); + /* + * StateDescriptor sd = (StateDescriptor) + * ChartImageCacheFactory.getChartImageBase( getServletContext()); + * writer.write(HTMLStateTable.getStateTable(sd)); + */ + writer.write("Cewolf servlet up and running.
"); + writer.write("Requests served so far: " + requestCount); + writer.write(""); + writer.close(); + } + + private void logAndRenderException( Throwable ex, HttpServletResponse response, int width, int height ) throws IOException + { + log(ex.getMessage(), ex); + response.setContentType("image/jpg"); + OutputStream out = response.getOutputStream(); + RenderingHelper.renderException(ex, width, height, out); + out.close(); + } + + /** + * Method renderImageExpiry. + * + * @param response + * @param width + * @param height + */ + private void renderImageExpiry( HttpServletResponse response, int width, int height ) throws IOException + { + response.setContentType("image/jpg"); + OutputStream out = response.getOutputStream(); + RenderingHelper.renderMessage("This chart has expired. Please reload.", width, height, out); + out.close(); + } + + private void logRequest( HttpServletRequest request ) throws IOException + { + log("Cewolf request:"); + log("Actual Request values:"); + printParameters(request); + Enumeration headerNames = request.getHeaderNames(); + while ( headerNames.hasMoreElements() ) + { + String name = (String) headerNames.nextElement(); + Enumeration values = request.getHeaders(name); + StringBuffer value = new StringBuffer(); + while ( values.hasMoreElements() ) + { + value.append((String) values.nextElement() + ","); + } + // cut last comma + if ( value.length() > 0 ) + value.setLength(value.length() - 1); + log(name + ": " + value); + } + // InputStream body = request.getInputStream(); + // byte[] bodyData = new byte[body.available()]; + // body.read(bodyData); + // body.close(); + // log(new String(bodyData)); + + } + +} \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/ChartHolder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/ChartHolder.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,56 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf; + +/** + * An object of this type represents a full descritption of a chart. + * Therefore it is able to produce the chart and dataset object + * resulting out of this definition. + * @author Guido Laures + */ +public interface ChartHolder { + + /** + * Returns a chart. The type of this object is dependant on the underlying + * chart implementation. As of this version of Cewolf it is of type + * org.jfree.chart.JFreeChart. + * @return the chart object for this definition + * @throws DatasetProduceException if there could be no data produced for + * the cahrt + * @throws ConfigurationException if there is something wrong in the + * Cewolf configuration + * @throws PostProcessingException if a post processor failed to + * process the chart + */ + public Object getChart() throws DatasetProduceException, PostProcessingException, ChartValidationException; + + /** + * Returns the dataset produced when using this definition.The type of this object is dependant on the underlying + * chart implementation. As of this version of Cewolf it is of type + * org.jfree.data.Dataset. + * @return Object the dataset for this definition + * @throws DatasetProduceException if the dataset could not be produced + */ + public Object getDataset() throws DatasetProduceException; + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/ChartImage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/ChartImage.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,81 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf; + +import java.io.IOException; +import java.util.Date; + + +/** + * A special ChartHolder which also holds the image presentation of the chart. + * @author Guido Laures + */ +public interface ChartImage { + + public static final int IMG_TYPE_CHART = 0; + public static final int IMG_TYPE_LEGEND = 1; + + /** + * Returns the width of the chart image in pixel. + * @return the width of the chart image in pixel + */ + public int getWidth(); + + /** + * Returns the height of the chart image in pixel. + * @return the height of the chart image in pixel + */ + public int getHeight(); + + /** + * Returns the type of the chart image. + * @return the type of the chart image + * @see #IMG_TYPE_CHART + * @see #IMG_TYPE_LEGEND + */ + public int getType(); + + /** + * Writes out a cached image to an outputstream. This method only marks the object + * as accessed and therfore frees it for cache cleanup. + * @param key the cache key + * @param out the stream to write to + * @throws IOException if an I/O error occured during write + */ + public byte[] getBytes() throws CewolfException; + + /** + * Returns the MIME type of this image. + * @return the MIME type of the image + */ + public String getMimeType(); + + /** + * Returns the size of the image in bytes. + * @return size of the image + * @throws CewolfException if the size could not be determined + */ + public int getSize() throws CewolfException; + + public Date getTimeoutTime(); +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/ChartPostProcessor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/ChartPostProcessor.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,50 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf; + +import java.util.Map; + +/** + * Postprocesses a generated chart instance. Objects of this class can be used to + * customize a generated and afterwards rendered chart instance additionally. + * To provide a postprocessor the <chartpostprocessor> tag is used. + * There can be an unlimited number of postprocessors registered. + * @see de.laures.cewolf.taglib.tags.ChartPostProcessorTag + * @author Guido Laures + */ +public interface ChartPostProcessor { + + /** + * Processes a generated chart. This method is called by the ChartProducer + * after a chart instance is generated and before it is rendered (if so). + * The ChartProducer is responsible for post processing a chart dependant + * on and only on the provided parameters. This means that the same parameters + * should result in the same post processings. + * @param chart the chart instnce. Concrete class depends on the rendering + * implementation. Currently a org.jfree.chart.JFreeChart is passed. + * @param params paramters passed to the postprocessor. These are defined in the JSP + * @see de.laures.cewolf.taglib.tags.ChartPostProcessorTag + */ + void processChart(Object chart, Map params); + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/ChartRenderingException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/ChartRenderingException.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,52 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf; + +/** + * Thrown by a renderer if a problem during the rendering process occured. + * @author Guido Laures + */ +public class ChartRenderingException extends CewolfException { + + /** Creates a new instance of ChartRenderingException without detail message. */ + public ChartRenderingException() { + } + + + /** + * Constructs an instance of ChartRenderingException with the specified detail message. + * @param msg the detail message. + */ + public ChartRenderingException(String msg) { + super(msg); + } + + /** + * Constructor with cause exception + * @param msg Message + * @param cause cause + */ + public ChartRenderingException(String msg, Exception cause) { + super(msg, cause); + } +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/ChartValidationException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/ChartValidationException.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,35 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf; + + +/** + * @author glaures + */ +public class ChartValidationException extends CewolfException { + + public ChartValidationException(String msg){ + super(msg); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/Configuration.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/Configuration.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,169 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf; + +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; + +/** + * This class represents the configuration of the Cewolf framework. + * It is designed as singleton and resists in application context. + * @author glaures + * @since 0.8 + */ +public class Configuration { + + public static final String KEY = Configuration.class.getName(); + private static final String DEFAULT_OVERLIB_URL = "overlib.js"; + private static final String DEFAULT_STORAGE = "de.laures.cewolf.storage.TransientSessionStorage"; + + private String overlibURL = DEFAULT_OVERLIB_URL; + private boolean debugged = false; + + private String storageClassName = DEFAULT_STORAGE; + private Storage storage = null; + private Map parameters = new HashMap(); + + /** package protected constructor triggered by servlet */ + protected Configuration(ServletContext ctx) { + ctx.log("configuring cewolf app.."); + ctx.setAttribute(KEY, this); + + //retrieve the init config params + ServletConfig config = (ServletConfig) ctx.getAttribute(CewolfRenderer.INIT_CONFIG); + if (config != null) + { + Enumeration initParams = config.getInitParameterNames(); + try { + while (initParams.hasMoreElements()) { + String param = (String) initParams.nextElement(); + String value = config.getInitParameter(param); + if ("debug".equalsIgnoreCase(param)) { + debugged = Boolean.valueOf(value).booleanValue(); + } else if ("overliburl".equalsIgnoreCase(param)) { + overlibURL = value; + } else if ("storage".equalsIgnoreCase(param)) { + storageClassName = value; + } else { + ctx.log(param + " parameter is ignored."); + } + parameters.put(param,value); + } + } catch (Throwable t) { + ctx.log("Error in Cewolf config.", t); + } + } + else { + ctx.log("Cewolf Misconfiguration. You should add a tag " + + "to your web.xml for the Cewolf rendering servlet.\n" + + "A default Configuration will be used if not."); + } + + try { + initStorage(ctx); + } catch (CewolfException ex) { + ctx.log("exception during storage init from class " + storageClassName); + ctx.log("using " + DEFAULT_STORAGE); + storageClassName = DEFAULT_STORAGE; + try { + initStorage(ctx); + } catch(CewolfException cwex){ + cwex.printStackTrace(); + throw new RuntimeException(storageClassName + ".init() threw exception."); + } + } + ctx.log("using storage class " + storageClassName); + ctx.log("using overlibURL " + overlibURL); + ctx.log("debugging is turned " + (debugged ? "on" : "off")); + ctx.log("...done."); + } + + private void initStorage(ServletContext ctx) throws CewolfException { + try { + storage = (Storage)Class.forName(storageClassName).newInstance(); + } catch(Exception ex){ + ex.printStackTrace(); + throw new CewolfException(ex.getMessage()); + } + storage.init(ctx); + } + + private Configuration() { + } + + /** + * Factory method. If no Configuration had been initialized before, a new + * one is created, stored in ctx and returned to the caller. + * @param ctx the servlet context from where to retrieve the Configuration + * object. + * @return the config object + */ + public static Configuration getInstance(ServletContext ctx) { + Configuration config = null; + config = (Configuration) ctx.getAttribute(KEY); + + if (config == null) + { + ctx.log("No Configuration for this context. Initializing."); + config = new Configuration(ctx); + ctx.setAttribute(KEY, config); + } + + return config; + } + + /** + * Checks if debugging is configured to be turned on. Configured by + * init param debug in web.xml. + * @return true if a debugging is on, else false + */ + public boolean isDebugged() { + return debugged; + } + + /** + * Returns the location of the overlib.js relative to webapp's root. + * Configured by init param overliburl in web.xml. Defaults to + * overlib.js + * @return String + */ + public String getOverlibURL() { + return overlibURL; + } + + public Storage getStorage() { + return storage; + } + + /** + * Get the initialization parameters from Cewolf servlet. + * @return The parameter map (String->String) values + */ + public Map getParameters() { + return parameters; + } +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/ConfigurationException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/ConfigurationException.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,44 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf; + +/** + * Thrown by an object which handles the production of a specific chart instance + * when detecting an incorrect or unconsistent configuration. + * @author Guido Laures + */ +public class ConfigurationException extends CewolfException { + + /** Creates a new instance of ConfigurationException without detail message. */ + public ConfigurationException() { + } + + + /** + * Constructs an instance of ConfigurationException with the specified detail message. + * @param msg the detail message. + */ + public ConfigurationException(String msg) { + super(msg); + } +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/DatasetProduceException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/DatasetProduceException.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,44 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf; + +/** + * Thrown by a DatasetProducer if it has problems in creating a correct dataset. + * @see DatasetProducer + * @author Guido Laures + */ +public class DatasetProduceException extends CewolfException { + + /** Creates a new instance of DatasetProduceException without detail message. */ + public DatasetProduceException() { + } + + + /** + * Constructs an instance of DatasetProduceException with the specified detail message. + * @param msg the detail message. + */ + public DatasetProduceException(String msg) { + super(msg); + } +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/DatasetProducer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/DatasetProducer.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,87 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf; + +import java.io.Serializable; +import java.util.Date; +import java.util.Map; + +/** + * Produces a {@link org.jfree.data.Dataset} which will be rendered + * as a chart afterwards. + * @see org.jfree.data.Dataset + * @author Guido Laures + * @since 0.1 + */ +public interface DatasetProducer extends Serializable { + + /** + * By default the the name of the JSP attribute + * holding the producer instance is passed to the + * produceDataset method as a prameter. + */ + public static final String PRODUCER_ATTRIBUTE_NAME = "de.laures.cewolf.DatasetProducer.id"; + + /** + * Produces a {@link org.jfree.data.Dataset} object. + * @param params additional params for the dataset production. All elements + * of this HashMap are of type java.io.Serializable. This is + * necessary to ensure the the serialization of the dataset producer into + * the http session. To provide a producer with additional production + * parameters the <param> tag is used (see tag library documentation). + * It is recommended to synchronize implementations of this method to avoid + * concurrency problems. + * @return an object of type org.jfree.data.Dataset. + * @throws DatasetProduceException if an error occured during production + * @since 0.2 + */ + Object produceDataset(Map params) throws DatasetProduceException; + + /** + * This method is called by the Cewolf framework to check if a formerly + * produced data can be reused. If the data which had already been used + * for chart rendering is still valid this method should return true. + * If possible the Cewolf framework will try to reuse the rendered chart + * image. If this is not possible because of some circumstances (e.g. the chart + * had been removed from the image cache) the produceDataset method is called afterwards. + * Therefore there is no guarantee that the dataset production is always + * avoided if this method returns true. + * @param params the production parameters of the already produced data + * @param since the point in time when the already produced data had been produced + * @return true if the data which had been produced with the + * passed in parameters has expired since its creation, false + * otherwise + * @since 0.9 + */ + boolean hasExpired(Map params, Date since); + + /** + * Tis method returns a unique ID for a DatasetProducer from this class. + * Producers with the same ID are supposed to produce the same data when + * called with the same paramters. + * @return the unique ID for instances of this poducer class + * @since 0.9 + */ + String getProducerId(); + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/PostProcessingException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/PostProcessingException.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,44 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf; + +/** + * Thrown by a DatasetProducer if it has problems in creating a correct dataset. + * @see DatasetProducer + * @author Guido Laures + */ +public class PostProcessingException extends CewolfException { + + /** Creates a new instance of DatasetProduceException without detail message. */ + public PostProcessingException() { + } + + + /** + * Constructs an instance of DatasetProduceException with the specified detail message. + * @param msg the detail message. + */ + public PostProcessingException(String msg) { + super(msg); + } +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/Storage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/Storage.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,87 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.servlet.jsp.PageContext; + +/** + * Pluggable storage. Implement this class to change the + * storage concept which Cewolf uses to store chart imanges and + * provide the implementation class name as init paramter storage + * for Cewolf servlet. + * @author glaures + */ +public interface Storage{ + + /** + * Stores a chart image. + * @param cid the image to be stored + * @param servletContext servletContext which might be needed + * @return String the storage id which is used to find the image in storage + */ + public String storeChartImage(ChartImage chartImage, PageContext pageContext) throws CewolfException; + + /** + * Retrieves a chart image. + * @param id the id of the image + * @param request the request + * @return ChartImage the stored image instance + */ + public ChartImage getChartImage(String id, HttpServletRequest request); + + /** + * Tests if a chart image is already available in thsi store.. + * @param chartImage the image to test + * @param pageContext the pageContext + * @return true if a stored instance of this image is availbale + */ + // public boolean contains(ChartImage chartImage, PageContext pageContext); + + /** + * Returns the key for this + * @param chartImage + * @return String + */ + // public String getKey(ChartImage chartImage); + + /** + * Method init. + * @param servletContext + * @throws CewolfException + */ + public void init(ServletContext servletContext) throws CewolfException; + + + /** + * Removes the image from the storage + * @param imgId Image id + * @param request Servlet request + * @return Image id + * @throws CewolfException + */ + public String removeChartImage(String imgId, HttpServletRequest request) + throws CewolfException; +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/WebConstants.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/WebConstants.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,79 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf; + +/** + * Contains some base constants to avoid explicit dependancy to concrete chart + * implementation's constant values. The constants of this class also serve as + * the base contract for data exchange between sub packages. + * @author Guido Laures + */ +public interface WebConstants { + + /** + * The key for the session ID. + */ + String SESSIONID_KEY = "jsessionid"; + + /** + * Escape of an Ampersand in HTML + */ + String AMPERSAND = "&"; + + /** + * The image parameter key. + */ + String IMG_PARAM = "img"; + + /** + * The key for the width of the image. + */ + String WIDTH_PARAM = "width"; + + /** + * The key for the height of the image. + */ + String HEIGHT_PARAM = "height"; + + /** + * Remove image from Storage after rendering + */ + String REMOVE_AFTER_RENDERING = "removeAfterRendering"; + + /** + * MIME name of a PNG image. + */ + String MIME_PNG = "image/png"; + + /** + * MIME name of a JPEG image. + */ + String MIME_JPEG = "image/jpeg"; + + + /** + * MIME name of a SVG image + */ + String MIME_SVG = "image/svg+xml"; + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/cpp/RotatedAxisLabels.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/cpp/RotatedAxisLabels.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,70 @@ +package de.laures.cewolf.cpp; + +import java.util.Map; + +import org.jfree.chart.JFreeChart; +import org.jfree.chart.axis.CategoryAxis; +import org.jfree.chart.axis.CategoryLabelPositions; +import org.jfree.chart.plot.CategoryPlot; +import org.jfree.data.category.CategoryDataset; + +import de.laures.cewolf.ChartPostProcessor; + +/** +* A cewolf post-processor for rotating and/or removing the labels on the X-Axis +* parameters: +* rotate_at: make the labels vertical +* skip_at: print only some of the labels (so they don't overlap) +* remove_at: don't print any labels +* +* Usage: +* +* +* +* +* +* +* +* @author Rich Unger +*/ + +public class RotatedAxisLabels implements ChartPostProcessor { + +public void processChart(Object chart, Map params) { + CategoryPlot plot = (CategoryPlot) ((JFreeChart) chart).getPlot(); + + CategoryAxis axis = plot.getDomainAxis(); + + Number rotateThreshold = (Number) params.get("rotate_at"); + Number skipThreshold = (Number) params.get("skip_at"); + Number removeThreshold = (Number) params.get("remove_at"); + + CategoryDataset dataset = plot.getDataset(); + int iCategoryCount = dataset.getRowCount(); + + if (rotateThreshold != null) + { + if (iCategoryCount >= rotateThreshold.intValue()) + { + axis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); + } + else + { + axis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD); + } + + } + + if (skipThreshold != null) + { + //this method does nothing in jfreechart .9.18 + //axis.setSkipCategoryLabelsToFit(iCategoryCount >= skipThreshold.intValue()); + } + + if (removeThreshold != null) + { + axis.setTickLabelsVisible(iCategoryCount < removeThreshold.intValue()); + } + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/cpp/package.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/cpp/package.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,10 @@ + + + + + + + +Unsupported third party ChartPostProcessor implmentations. + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/dp/DataSourceXYDatasetProducer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/dp/DataSourceXYDatasetProducer.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,54 @@ +package de.laures.cewolf.dp; + +import java.io.Serializable; +import java.util.Date; +import java.util.Map; + +import de.laures.cewolf.DatasetProduceException; +import de.laures.cewolf.DatasetProducer; + +/** + * @author glaures + * + * To change this generated comment edit the template variable "typecomment": + * Window>Preferences>Java>Templates. + * To enable and disable the creation of type comments go to + * Window>Preferences>Java>Code Generation. + */ +public class DataSourceXYDatasetProducer implements DatasetProducer, Serializable { + + public static final String PARAM_SERIES_LIST = "series"; + + /** + * @see de.laures.cewolf.DatasetProducer#produceDataset(Map) + */ + public Object produceDataset(Map params) throws DatasetProduceException { + /* + DataSourceXYSeries series = new DataSourceXYSeries("select * from xy;"); + XYSeriesCollection dataset = new XYSeriesCollection(); + try { + DataSource ds = getDataSource((String)params.get(PARAM_DATASOURCE)); + dataset.addSeries(series.produceXYSeries(ds)); + } catch (NamingException nEx) { + nEx.printStackTrace(); + throw new DatasetProduceException(nEx.getMessage()); + } + */ + return null; + } + + /** + * @see de.laures.cewolf.DatasetProducer#hasExpired(Map, Date) + */ + public boolean hasExpired(Map params, Date since) { + return true; + } + + /** + * @see de.laures.cewolf.DatasetProducer#getProducerId() + */ + public String getProducerId() { + return toString(); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/dp/DataSourceXYSeries.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/dp/DataSourceXYSeries.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,67 @@ +package de.laures.cewolf.dp; + +import java.io.Serializable; +import java.sql.Connection; +import java.sql.ResultSet; +import java.util.Map; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.sql.DataSource; + +import org.jfree.data.xy.XYSeries; + +import de.laures.cewolf.DatasetProduceException; + +/** + * @author glaures + * + * To change this generated comment edit the template variable "typecomment": + * Window>Preferences>Java>Templates. + * To enable and disable the creation of type comments go to + * Window>Preferences>Java>Code Generation. + */ +public class DataSourceXYSeries implements Serializable { + + private String dataSourceName; + private String query; + private String xCol = "x"; + private String yCol = "y"; + private String seriesName = "name"; + + /** + * Constructor for DataSourceXYSeries. + */ + public DataSourceXYSeries(String dataSourceName, String query) { + this.dataSourceName = dataSourceName; + this.query = query; + } + + protected DataSource getDataSource() throws NamingException { + Context initCtx = new InitialContext(); + Context envCtx = (Context) initCtx.lookup("java:comp/env"); + return (DataSource) envCtx.lookup(dataSourceName); + } + + /** + * @see de.laures.cewolf.DatasetProducer#produceDataset(Map) + */ + public XYSeries produceXYSeries() throws DatasetProduceException { + XYSeries series = new XYSeries(seriesName); + try { + DataSource ds = getDataSource(); + Connection con = ds.getConnection(); + ResultSet rs = con.createStatement().executeQuery(query); + int xColIndex = rs.findColumn(xCol); + int yColIndex = rs.findColumn(yCol); + while(rs.next()){ + series.add((Number)rs.getObject(xColIndex), (Number)rs.getObject(yColIndex)); + } + } catch (Exception namingEx) { + namingEx.printStackTrace(); + throw new DatasetProduceException(namingEx.getMessage()); + } + return series; + } +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/dp/MovingAverageDatasetProducer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/dp/MovingAverageDatasetProducer.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,60 @@ +package de.laures.cewolf.dp; + +import java.io.Serializable; +import java.util.Date; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jfree.data.general.Dataset; +import org.jfree.data.time.MovingAverage; +import org.jfree.data.xy.XYDataset; + +import de.laures.cewolf.DatasetProduceException; +import de.laures.cewolf.DatasetProducer; + +/** + * @author guido + * + * To change this generated comment edit the template variable "typecomment": + * Window>Preferences>Java>Templates. + * To enable and disable the creation of type comments go to + * Window>Preferences>Java>Code Generation. + */ +public class MovingAverageDatasetProducer implements DatasetProducer, Serializable { + + private static final Log log = LogFactory.getLog(MovingAverageDatasetProducer.class); + + /** + * @see de.laures.cewolf.DatasetProducer#produceDataset(Map) + */ + public Object produceDataset(Map params) throws DatasetProduceException { + log.debug(params); + DatasetProducer datasetProducer = (DatasetProducer)params.get("producer"); + log.debug(datasetProducer); + Dataset dataset = (Dataset)datasetProducer.produceDataset(params); + String suffix = (String)params.get("suffix"); + int period = ((Integer)params.get("period")).intValue(); + int skip = ((Integer)params.get("skip")).intValue(); + if(dataset instanceof XYDataset){ + return MovingAverage.createMovingAverage((XYDataset)dataset, suffix, period, skip); + } else { + throw new DatasetProduceException("moving average only supported for XYDatasets"); + } + } + + /** + * @see de.laures.cewolf.DatasetProducer#hasExpired(Map, Date) + */ + public boolean hasExpired(Map params, Date since) { + return true; + } + + /** + * @see de.laures.cewolf.DatasetProducer#getProducerId() + */ + public String getProducerId() { + return getClass().getName(); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/dp/package.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/dp/package.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,10 @@ + + + + + + + +Custom DatasetProducer. + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/event/ChartImageRenderListener.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/event/ChartImageRenderListener.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2005, Cambridge Technology Partners + * + * $Id: ChartImageRenderListener.java,v 1.1 2005/10/09 22:05:16 brianfox Exp $ + */ +package de.laures.cewolf.event; + +import de.laures.cewolf.util.RenderedImage; + +/** + * Event listener called back after the image is rendered. ChartPostProcessors + * may implement this interface to get notified when the image gets rendered. + * It is useful to retrieve the JFreeChart's ChartRenderingInfo object. + * + *
+ *	public void onImageRendered (RenderedImage renderedImage) {
+ * 		ChartRenderingInfo info = (ChartRenderingInfo) renderedImage.renderingInfo;
+ * 		...
+ *  }
+ * 
+ * + * @author zluspai + */ +public interface ChartImageRenderListener { + + /** + * Callback right after a new image gets rendered. + * + * @param renderedImage The fresh image just got rendered + */ + public void onImageRendered (RenderedImage renderedImage); + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/links/CategoryItemLinkGenerator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/links/CategoryItemLinkGenerator.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,43 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ +package de.laures.cewolf.links; + +/** + * A link generator for category items. This interface is used by the + * tag library to produce image maps. Implement this if the dataset that + * ths DatasetProducer produces is a CategoryDataset. + * @see org.jfree.data.CategoryDataset + * @author Guido Laures + * @since 0.8 + */ +public interface CategoryItemLinkGenerator extends LinkGenerator { + + /** + * Generates a link for a specific dataset/series/category triple. + * @param dataset the dataset + * @param series the series number + * @param category the category + * @see org.jfree.data.CategoryDataset + */ + String generateLink(Object dataset, int series, Object category); + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/links/LinkGenerator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/links/LinkGenerator.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,33 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.links; + +/** + * This is the base interface of all link generating components which can + * be used to produce image maps. + * @author Guido Laures + * @since 0.8 + */ +public interface LinkGenerator { + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/links/PieSectionLinkGenerator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/links/PieSectionLinkGenerator.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,41 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.links; + +/** + * A LinkGenerator for PieDatasets. + * @author Guido Laures + * @since 0.8 + */ +public interface PieSectionLinkGenerator extends LinkGenerator { + + /** + * Generate a link for a PieDataset and a category. + * @param dataset the dataset. This will normally be of a subtype of PieDataset. It is + * genralized to avoid dependencies to the concrete chart implementation + * @param category the category to produce a link for + * @return the URL of the link belonging to the category + */ + String generateLink(Object dataset, Object category); + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/links/XYItemLinkGenerator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/links/XYItemLinkGenerator.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,42 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.links; + +/** + * A LinkGenerator for XYDatasets. + * @author Guido Laures + * @since 0.8 + */ +public interface XYItemLinkGenerator extends LinkGenerator { + + /** + * Generate a link for a XYDataset, series and item. + * @param dataset the dataset. This will normally be of a subtype of XYDataset. It is + * genralized to avoid dependencies to the concrete chart implementation + * @param series the series to produce a link for + * @param item the item to produce the link for + * @return the URL of the link belonging to the series/item + */ + String generateLink(Object data, int series, int item); + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/package.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/package.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,10 @@ + + + + + + + +Servlet based framework to render charts into a client's response stream. + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/AbstractSessionStorage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/AbstractSessionStorage.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,130 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.storage; + +import java.io.Serializable; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.servlet.jsp.PageContext; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import de.laures.cewolf.CewolfException; +import de.laures.cewolf.ChartImage; +import de.laures.cewolf.Storage; +import de.laures.cewolf.taglib.util.KeyGenerator; + +/** + * @author glaures + */ +public abstract class AbstractSessionStorage implements Storage +{ + + private static final Log log = LogFactory.getLog(AbstractSessionStorage.class); + + /** + * @see de.laures.cewolf.Storage#storeChartImage(ChartImage, ServletContext) + */ + public String storeChartImage( ChartImage cid, PageContext pageContext ) throws CewolfException + { + if ( contains(cid, pageContext) ) + { + return getKey(cid); + } + log.debug("storing chart " + cid); + final HttpSession session = pageContext.getSession(); + //String key = getKey(cid); + return storeChartImage(cid, session); + } + + + /** + * @see de.laures.cewolf.Storage#getChartImage(String) + */ + public ChartImage getChartImage( String id, HttpServletRequest request ) + { + HttpSession session = request.getSession(); + return (ChartImage) session.getAttribute(id); + } + + public boolean contains( ChartImage cid, PageContext pageContext ) + { + return pageContext.getSession().getAttribute(getKey(cid)) != null; + } + + public final String getKey( ChartImage cid ) + { + return String.valueOf(KeyGenerator.generateKey((Serializable) cid)); + } + + protected String storeChartImage( ChartImage cid, HttpSession session ) throws CewolfException + { + final String sessionKey = getKey(cid); + synchronized (session) + { + session.setAttribute(sessionKey, getCacheObject(cid)); + } + return sessionKey; + } + + /** + */ + public String removeChartImage(String imgKey, HttpServletRequest request) + throws CewolfException { + final HttpSession session = request.getSession(); + if (session == null) + { + return imgKey; + } + return removeChartImage(imgKey, session); + } + + /** + * @param cid + * @param session + * @return + * @throws CewolfException + */ + protected String removeChartImage(String cid, HttpSession session) + throws CewolfException { + synchronized (session) { + session.removeAttribute(cid); + } + return cid; + } + + protected abstract Object getCacheObject( ChartImage cid ) throws CewolfException; + + /** + * @see de.laures.cewolf.Storage#init(ServletContext) + */ + public void init( ServletContext servletContext ) throws CewolfException + { + } + + + +} \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/ClusterableSessionStorage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/ClusterableSessionStorage.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,43 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.storage; + +import de.laures.cewolf.CewolfException; +import de.laures.cewolf.ChartImage; + +/** + * @author guido + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class ClusterableSessionStorage extends AbstractSessionStorage { + + /* (non-Javadoc) + * @see de.laures.cewolf.storage.AbstractSessionStorage#getCacheObject(de.laures.cewolf.ChartImage) + */ + protected Object getCacheObject(ChartImage cid) throws CewolfException { + return new SerializableChartImage(cid); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/FileStorage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/FileStorage.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,175 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.storage; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.jsp.PageContext; + +import de.laures.cewolf.CewolfException; +import de.laures.cewolf.ChartImage; +import de.laures.cewolf.Configuration; +import de.laures.cewolf.Storage; +import de.laures.cewolf.taglib.util.KeyGenerator; + +/** + * Storage for storing images as files in the web application directory as files _chart-XXXXX. + * Note that by default the files won't ever be removed. To remove saved images on VM exit set + * the FileStorage.deleteOnExit configuration parameter to "true". For example: + * + *
+ *		
+ *			storage
+ *			de.laures.cewolf.storage.FileStorage
+ *		
+ *		
+ *				FileStorage.deleteOnExit
+ *				true
+ *		 
+ *	
+ * + * @author guido + */ +public class FileStorage implements Storage { + + String basePath = null; + List stored = new ArrayList(); + private boolean deleteOnExit = false; + + /** + * @see de.laures.cewolf.Storage#storeChartImage(ChartImage, PageContext) + */ + public String storeChartImage(ChartImage cid, PageContext pageContext) { + if(contains(cid, pageContext)){ + return getKey(cid); + } + String id = getKey(cid); + ObjectOutputStream oos = null; + try { + String fileName = getFileName(id); + pageContext.getServletContext().log("Storing image to file " + fileName); + File f = new File(fileName); + if (deleteOnExit) { + f.deleteOnExit(); + } + oos = new ObjectOutputStream(new FileOutputStream(f)); + oos.writeObject(new SerializableChartImage(cid)); + oos.close(); + } catch(IOException ioex){ + ioex.printStackTrace(); + } catch(CewolfException cwex){ + cwex.printStackTrace(); + } finally { + if(oos != null){ + try { + oos.close(); + } catch(IOException ioex){ + ioex.printStackTrace(); + } + } + } + return id; + } + + /** + * @see de.laures.cewolf.Storage#getChartImage(String, HttpServletRequest) + */ + public ChartImage getChartImage(String id, HttpServletRequest request) { + ChartImage res = null; + ObjectInputStream ois = null; + try { + ois = new ObjectInputStream(new FileInputStream(getFileName(id))); + res = (ChartImage)ois.readObject(); + ois.close(); + } catch(Exception ex){ + ex.printStackTrace(); + } finally { + if(ois != null){ + try { + ois.close(); + } catch(IOException ioex){ + ioex.printStackTrace(); + } + } + } + return res; + } + + /** + * @see de.laures.cewolf.Storage#contains(ChartImage, PageContext) + */ + public boolean contains(ChartImage chartImage, PageContext pageContext) { + return new File(getFileName(chartImage)).exists(); + } + + /** + * @see de.laures.cewolf.Storage#getKey(ChartImage) + */ + public String getKey(ChartImage chartImage) { + return String.valueOf(KeyGenerator.generateKey((Serializable)chartImage)); + } + + /** + * @see de.laures.cewolf.Storage#init(ServletContext) + */ + public void init(ServletContext servletContext) throws CewolfException { + basePath = servletContext.getRealPath("/"); + Configuration config = Configuration.getInstance(servletContext); + deleteOnExit = "true".equalsIgnoreCase("" + config.getParameters().get("FileStorage.deleteOnExit")); + servletContext.log("FileStorage initialized, deleteOnExit=" + deleteOnExit); + } + + private String getFileName(ChartImage chartImage){ + return getFileName(getKey(chartImage)); + } + + private String getFileName(String id){ + return basePath + "_chart" + id; + } + + /** + * @see de.laures.cewolf.Storage#removeChartImage(java.lang.String, javax.servlet.jsp.PageContext) + */ + public String removeChartImage(String imgKey, HttpServletRequest pageContext) throws CewolfException { + File file = new File(getFileName(imgKey)); + if (file.exists()) + { + if (!file.delete()) + { + throw new CewolfException("Could not delete file " + file.getAbsolutePath()); + } + } + return imgKey; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/LongTermSessionStorage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/LongTermSessionStorage.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,122 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ +package de.laures.cewolf.storage; + +import java.io.Serializable; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.servlet.jsp.PageContext; + +import de.laures.cewolf.CewolfException; +import de.laures.cewolf.ChartImage; +import de.laures.cewolf.Storage; +import de.laures.cewolf.taglib.util.KeyGenerator; + +/** + * Storage stores images in session, but expires them after a certain time. + * This expiration time defaults to 300 seconds, and can be changed by adding + * the timeout="xxx" parameter to and tags. + * + * @author brianf + */ +public class LongTermSessionStorage implements Storage +{ + + public final String getKey( ChartImage cid ) + { + return String.valueOf(KeyGenerator.generateKey((Serializable) cid)); + } + + /* + * (non-Javadoc) + * + * @see de.laures.cewolf.Storage#storeChartImage(de.laures.cewolf.ChartImage, + * javax.servlet.jsp.PageContext) + */ + public String storeChartImage( ChartImage chartImage, PageContext pageContext ) throws CewolfException + { + HttpSession session = pageContext.getSession(); + SessionStorageGroup ssg = (SessionStorageGroup) session.getAttribute("CewolfCharts"); + if ( ssg == null ) + { + ssg = new SessionStorageGroup(); + session.setAttribute("CewolfCharts", ssg); + } + String cid = getKey(chartImage); + SessionStorageItem ssi = new SessionStorageItem(chartImage, cid, chartImage.getTimeoutTime()); + ssg.put(cid, ssi); + + return cid; + } + + /* + * (non-Javadoc) + * + * @see de.laures.cewolf.Storage#getChartImage(java.lang.String, + * javax.servlet.http.HttpServletRequest) + */ + public ChartImage getChartImage( String id, HttpServletRequest request ) + { + HttpSession session = request.getSession(); + ChartImage chart = null; + SessionStorageGroup ssg = (SessionStorageGroup) session.getAttribute("CewolfCharts"); + if ( ssg != null ) + { + SessionStorageItem ssi = (SessionStorageItem) ssg.get(id); + if ( ssi != null ) + { + chart = ssi.getChart(); + } + } + + return chart; + } + /* + * (non-Javadoc) + * + * @see de.laures.cewolf.Storage#init(javax.servlet.ServletContext) + */ + public void init( ServletContext servletContext ) throws CewolfException { + } + + /** + * @see de.laures.cewolf.Storage#removeChartImage(java.lang.String, javax.servlet.jsp.PageContext) + */ + public String removeChartImage(String cid, HttpServletRequest request) throws CewolfException { + HttpSession session = request.getSession(); + // No session exit + if (session == null) + { + return cid; + } + SessionStorageGroup ssg = (SessionStorageGroup) session.getAttribute("CewolfCharts"); + if ( ssg == null ) + { + // No group exit + return cid; + } + ssg.remove(cid); + return cid; + } +} \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/SerializableChartImage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/SerializableChartImage.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,102 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.storage; + +import java.io.Serializable; +import java.util.Date; + +import de.laures.cewolf.CewolfException; +import de.laures.cewolf.ChartImage; + +/** + * @author guido + * + */ +public class SerializableChartImage implements ChartImage, Serializable { + + private final int width; + private final int height; + private final int type; + private final Date timeoutTime; + private final String mimeType; + private final byte[] data; + + public SerializableChartImage(ChartImage img) throws CewolfException{ + this.width = img.getWidth(); + this.height = img.getHeight(); + this.type = img.getType(); + this.mimeType = img.getMimeType(); + this.data = img.getBytes(); + this.timeoutTime = img.getTimeoutTime(); + } + + /** + * @see de.laures.cewolf.ChartImage#getWidth() + */ + public int getWidth() { + return width; + } + + /** + * @see de.laures.cewolf.ChartImage#getHeight() + */ + public int getHeight() { + return height; + } + + /** + * @see de.laures.cewolf.ChartImage#getType() + */ + public int getType() { + return type; + } + + /** + * @see de.laures.cewolf.ChartImage#getBytes() + */ + public byte[] getBytes() throws CewolfException { + return data; + } + + /** + * @see de.laures.cewolf.ChartImage#getMimeType() + */ + public String getMimeType() { + return mimeType; + } + + /** + * @see de.laures.cewolf.ChartImage#getSize() + */ + public int getSize() throws CewolfException { + return data.length; + } + + /* (non-Javadoc) + * @see de.laures.cewolf.ChartImage#getTimeoutTime() + */ + public Date getTimeoutTime() { + return timeoutTime; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/SessionStorageGroup.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/SessionStorageGroup.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,175 @@ +/* + * Created on Aug 3, 2004 + * + * To change the template for this generated file go to + * Window - Preferences - Java - Code Generation - Code and Comments + */ +package de.laures.cewolf.storage; + +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +/** + * @author brianf + * + * To change the template for this generated type comment go to Window - + * Preferences - Java - Code Generation - Code and Comments + */ +public class SessionStorageGroup implements Runnable +{ + private Map map = new HashMap(); + Thread runner; + + private void start() + { + if ( runner == null || !runner.isAlive() ) + { + runner = new Thread(this); + runner.setDaemon(false); + runner.setName("SessionCleanup"); + runner.setPriority(Thread.MIN_PRIORITY); + runner.start(); + } + } + + public synchronized Object get( Object a ) + { + return map.get(a); + } + + public synchronized Object put( Object a, Object b ) + { + Object c = map.put(a, b); + start(); + return c; + } + + public synchronized Object remove( Object a ) + { + return map.remove(a); + } + /* + * (non-Javadoc) + * + * @see java.lang.Runnable#run() + */ + public void run() + { + while ( !map.isEmpty() ) + { + Date date = new Date(); + synchronized (this) + { + Collection keys = map.keySet(); + + Iterator iter = keys.iterator(); + + while ( iter.hasNext() ) + { + // System.out.println("Get Next"); + String cid = (String) iter.next(); + SessionStorageItem ssi = (SessionStorageItem) get(cid); + if ( ssi.isExpired(date) ) + { + // System.out.println("Removing " + ssi); + iter.remove(); + } + } + } + try + { + //System.gc(); + Thread.sleep(1000); + } + catch (InterruptedException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + // System.out.println("Exiting Thread"); + } + public static void main( String[] args ) + { + int start = 0; + while(true) + { + System.out.println("Adding Objects"); + testThread(start); + + try + { + Thread.sleep(10000); + } + catch (InterruptedException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + + public static void testThread(int start) + { + SessionStorageGroup ssg = new SessionStorageGroup(); + Calendar cal = new GregorianCalendar(); + cal.setTime(new Date()); + // some huge garbage string + + for (int i = start; i < start+10000; i++) + { + cal.add(Calendar.MILLISECOND, 1); + SessionStorageItem ssi = new SessionStorageItem(null, Integer.toString(i), cal.getTime()); + ssg.put(Integer.toString(i), ssi); + } + + + } + /** + * Test that memory is freed up when low on it... + */ + public static void testSoftreferenceMemoryFreeup() + { + Date neverexpire = new Date(10000, 1, 1); + SessionStorageGroup ssg = new SessionStorageGroup(); + + // some huge garbage string + StringBuffer longString = new StringBuffer(); + for (int i = 0; i < 10000; i++) + { + longString.append(Math.random()); + } + + int i = 0; + long minmem = Long.MAX_VALUE; + while ( true ) + { + // let's use the id string to waste memory + String key = Long.toString(System.currentTimeMillis()); + String id = key + longString; + SessionStorageItem ssi = new SessionStorageItem(null, id, neverexpire); + ssg.put(key, ssi); + + i++; + long freemem = Runtime.getRuntime().freeMemory(); + long usedmem = Runtime.getRuntime().totalMemory(); + long maxmem = Runtime.getRuntime().maxMemory(); + if ( freemem < minmem ) + { + minmem = freemem; + } + if ( i % 100 == 0 ) + { + System.out.println("#" + i + ", minimum memory:" + minmem + ", freemem:" + freemem + + ", usedmem:" + usedmem + ", maxmem:" + maxmem); + } + } + + } +} + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/SessionStorageItem.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/SessionStorageItem.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,94 @@ +/* + * Created on Aug 2, 2004 + * + * To change the template for this generated file go to + * Window - Preferences - Java - Code Generation - Code and Comments + */ +package de.laures.cewolf.storage; + +import java.util.Date; + +import de.laures.cewolf.ChartImage; + +/** + * @author brianf + * + * To change the template for this generated type comment go to Window - + * Preferences - Java - Code Generation - Code and Comments + */ +public class SessionStorageItem +{ + String cid = null; + ChartImage chart = null; + Date timeout = null; + + public SessionStorageItem( ChartImage theChart, String theCid, Date theTimeout ) + { + chart = theChart; + cid = theCid; + timeout = theTimeout; + } + + public String toString() + { + return ("SSI: id:"+cid+" expires:"+timeout); + } + public final boolean isExpired(Date currentTime) + { + return currentTime.after(timeout); + } + /** + * @return Returns the chart. + */ + public ChartImage getChart() + { + return chart; + } + /** + * @param chart + * The chart to set. + */ + public void setChart( ChartImage chart ) + { + this.chart = chart; + } + /** + * @return Returns the cid. + */ + public String getCid() + { + return cid; + } + /** + * @param cid + * The cid to set. + */ + public void setCid( String cid ) + { + this.cid = cid; + } + /** + * + */ + public SessionStorageItem() + { + super(); + // TODO Auto-generated constructor stub + } + + /** + * @return Returns the timeout. + */ + public Date getTimeout() + { + return timeout; + } + /** + * @param timeout + * The timeout to set. + */ + public void setTimeout( Date timeout ) + { + this.timeout = timeout; + } +} \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/TransientSessionStorage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/storage/TransientSessionStorage.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,42 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.storage; + +import de.laures.cewolf.CewolfException; +import de.laures.cewolf.ChartImage; + +/** + * This storage should be used in non-clustered environments + * without failover concept. Using this storage enables render-on-demand. + * @author glaures + */ +public class TransientSessionStorage extends AbstractSessionStorage { + + /* (non-Javadoc) + * @see de.laures.cewolf.storage.AbstractSessionStorage#getCacheObject(de.laures.cewolf.ChartImage) + */ + protected Object getCacheObject(ChartImage cid) throws CewolfException { + return cid; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/AbstractChartDefinition.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/AbstractChartDefinition.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,274 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib; + +import java.awt.Image; +import java.awt.Paint; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.title.LegendTitle; +import org.jfree.ui.RectangleEdge; + +import de.laures.cewolf.ChartHolder; +import de.laures.cewolf.ChartPostProcessor; +import de.laures.cewolf.ChartValidationException; +import de.laures.cewolf.DatasetProduceException; +import de.laures.cewolf.PostProcessingException; +import de.laures.cewolf.event.ChartImageRenderListener; +import de.laures.cewolf.util.ImageHelper; +import de.laures.cewolf.util.RenderedImage; + +/** + * Serializable implementaton of a ChartDefinition. + * @author glaures + * @see de.laures.cewolf.ChartHolder + */ +public abstract class AbstractChartDefinition implements ChartHolder, Serializable, TaglibConstants, ChartImageRenderListener { + + protected static Log log = LogFactory.getLog(AbstractChartDefinition.class); + + protected String title; + protected String xAxisLabel; + protected String yAxisLabel; + protected String type; + + private boolean antialias = true; + private String background; + private float backgroundImageAlpha = 1.0f; + private Paint paint; + + private int legendAnchor = ANCHOR_SOUTH; + private boolean showLegend = true; + + private transient List postProcessors = new ArrayList(); + private List postProcessorsParams = new ArrayList(); + + private transient JFreeChart chart; + + protected abstract JFreeChart produceChart() throws DatasetProduceException, ChartValidationException; + + + //gets first legend in the list + public LegendTitle getLegend() + { + //i need to find the legend now. + LegendTitle legend = null; + List subTitles = chart.getSubtitles(); + Iterator iter = subTitles.iterator(); + while (iter.hasNext()) + { + Object o = iter.next(); + if (o instanceof LegendTitle) + { + legend = (LegendTitle) o; + break; + } + } + return legend; + } + + //removes first legend in the list + public void removeLegend() + { + List subTitles = chart.getSubtitles(); + Iterator iter = subTitles.iterator(); + while (iter.hasNext()) + { + Object o = iter.next(); + if (o instanceof LegendTitle) + { + iter.remove(); + break; + } + } + } + + /** + * This method triggers the dataset and chart production. It is only + * from outside if there is no cached image available in the the + * image cache. + */ + public Object getChart() throws DatasetProduceException, ChartValidationException, PostProcessingException { + if (chart == null) { + chart = produceChart(); + chart.setAntiAlias(antialias); + if (background != null) { + Image image = ImageHelper.loadImage(background); + chart.setBackgroundImage(image); + chart.setBackgroundImageAlpha(backgroundImageAlpha); + } + if (paint != null) { + chart.setBackgroundPaint(paint); + } + if (showLegend) + { + + LegendTitle legend = this.getLegend(); + switch (legendAnchor) + { + case ANCHOR_NORTH : + legend.setPosition(RectangleEdge.TOP); + break; + case ANCHOR_WEST : + legend.setPosition(RectangleEdge.RIGHT); + break; + case ANCHOR_EAST : + legend.setPosition(RectangleEdge.LEFT); + break; + default : + legend.setPosition(RectangleEdge.BOTTOM); + } + } + else + { + this.removeLegend(); + } + // postProcessing + for (int i = 0; i < postProcessors.size(); i++) { + ChartPostProcessor pp = (ChartPostProcessor)postProcessors.get(i); + try { + pp.processChart(chart, (Map)postProcessorsParams.get(i)); + } catch (Throwable t) { + log.error(t); + throw new PostProcessingException(t.getClass().getName() + " raised by post processor '" + + pp + "'.\nPost processing of this post processor " + "has been ignored."); + } + } + } + return chart; + } + + /** + * Sets the antialias. + * @param antialias The antialias to set + */ + public void setAntialias(boolean antialias) { + this.antialias = antialias; + } + + /** + * Sets the background. + * @param background The background to set + */ + public void setBackground(String background) { + this.background = background; + } + + /** + * Sets the backgroundImageAlpha. + * @param backgroundImageAlpha The backgroundImageAlpha to set + */ + public void setBackgroundImageAlpha(float backgroundImageAlpha) { + this.backgroundImageAlpha = backgroundImageAlpha; + } + + /** + * Sets the legendAnchor. + * @param legendAnchor The legendAnchor to set + */ + public void setLegendAnchor(int legendAnchor) { + this.legendAnchor = legendAnchor; + } + + /** + * Sets the paint. + * @param paint The paint to set + */ + public void setPaint(Paint paint) { + this.paint = paint; + } + + /** + * Sets the showLegend. + * @param showLegend The showLegend to set + */ + public void setShowLegend(boolean showLegend) { + this.showLegend = showLegend; + } + + /** + * Sets the title. + * @param title The title to set + */ + public void setTitle(String title) { + this.title = title; + } + + /** + * Sets the type. + * @param type The type to set + */ + public void setType(String type) { + this.type = type; + } + + /** + * Sets the xAxisLabel. + * @param xAxisLabel The xAxisLabel to set + */ + public void setXAxisLabel(String xAxisLabel) { + this.xAxisLabel = xAxisLabel; + } + + /** + * Sets the yAxisLabel. + * @param yAxisLabel The yAxisLabel to set + */ + public void setYAxisLabel(String yAxisLabel) { + this.yAxisLabel = yAxisLabel; + } + + public void addPostProcessor(ChartPostProcessor pp) { + postProcessors.add(pp); + } + + public void addPostProcessorParams(Map params) { + postProcessorsParams.add(params); + } + + /** + * Callback right after a new image gets rendered. + * Implemented, so if postprocessors implement the ImageRenderListener interface + * then they will be called back also + * + * @param renderedImage The fresh image just got rendered + */ + public void onImageRendered (RenderedImage renderedImage) { + // if the postprocessor implements ImageRenderListener interface call it! + for (int i = 0; i < postProcessors.size(); i++) { + ChartPostProcessor pp = (ChartPostProcessor)postProcessors.get(i); + if (pp instanceof ChartImageRenderListener) { + ((ChartImageRenderListener) pp).onImageRendered(renderedImage); + } + } + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/AttributeValidationException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/AttributeValidationException.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,36 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib; + +import de.laures.cewolf.ChartValidationException; + +/** + * @author glaures + */ +public class AttributeValidationException extends ChartValidationException { + + public AttributeValidationException(String attribute, String val){ + super("value " + val + " is not valid for attribute " + attribute); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/AxisConstants.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/AxisConstants.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,39 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib; + +/** + * Constants for axis attributes. + * @author glaures + */ +public interface AxisConstants { + + int ORIENTATION_HORIZONTAL = 0; + int ORIENTATION_VERTICAL = 1; + + int AXIS_TYPE_DATE = 0; + int AXIS_TYPE_NUMBER = 1; + + int AXIS_TYPE_CATEGORY = 2;//added by lrh 2005-07-11 +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/AxisFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/AxisFactory.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,45 @@ +package de.laures.cewolf.taglib; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jfree.chart.axis.Axis; +import org.jfree.chart.axis.CategoryAxis; +import org.jfree.chart.axis.DateAxis; +import org.jfree.chart.axis.NumberAxis; +import org.jfree.chart.axis.ValueAxis; + +/** + * @author guido + * + * To change this generated comment edit the template variable "typecomment": + * Window>Preferences>Java>Templates. + * To enable and disable the creation of type comments go to + * Window>Preferences>Java>Code Generation. + */ +public class AxisFactory implements AxisConstants { + + protected Log log = LogFactory.getLog(AxisFactory.class.getName()); + + private static final AxisFactory instance = new AxisFactory(); + + protected AxisFactory(){ + } + + public static final AxisFactory getInstance(){ + return instance; + } + + public Axis createAxis(int orientation, int type, String label) { + switch (type) { + case AXIS_TYPE_DATE : + return new DateAxis(label); + case AXIS_TYPE_NUMBER : + return new NumberAxis(label); + case AXIS_TYPE_CATEGORY://added by lrh 2005-07-11 + return new CategoryAxis(label); + default: + throw new RuntimeException("unsupported axis type constant " + type); + } + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/AxisTypes.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/AxisTypes.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,51 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib; + +import java.util.Arrays; +import java.util.List; + +/** + * Contains the list of all possible axis type string values which can be used + * in the type attribute of a <plot> tag. + * @author Guido Laures + */ +public class AxisTypes { + + /** All type strings in an array */ + public static final String[] typeNames = { + "date", + "number", + "category", + }; + + /** + * The whole typeNames array inside of a list. + * @see #typeNames + */ + public static final List typeList = Arrays.asList(typeNames); + + private AxisTypes() { + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/CewolfChartFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/CewolfChartFactory.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,313 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.jfree.chart.ChartFactory; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.axis.CategoryAxis; +import org.jfree.chart.axis.DateAxis; +import org.jfree.chart.axis.NumberAxis; +import org.jfree.chart.axis.ValueAxis; +import org.jfree.chart.plot.CategoryPlot; +import org.jfree.chart.plot.CombinedDomainXYPlot; +import org.jfree.chart.plot.CombinedRangeXYPlot; +import org.jfree.chart.plot.MeterPlot; +import org.jfree.chart.plot.Plot; +import org.jfree.chart.plot.PlotOrientation; +import org.jfree.chart.plot.XYPlot; +import org.jfree.chart.renderer.category.CategoryItemRenderer; +import org.jfree.chart.renderer.xy.XYItemRenderer; +import org.jfree.data.category.CategoryDataset; +import org.jfree.data.category.IntervalCategoryDataset; +import org.jfree.data.general.Dataset; +import org.jfree.data.general.PieDataset; +import org.jfree.data.general.ValueDataset; +import org.jfree.data.xy.IntervalXYDataset; +import org.jfree.data.xy.OHLCDataset; +import org.jfree.data.xy.WindDataset; +import org.jfree.data.xy.XYDataset; +import org.jfree.data.xy.XYZDataset; + +import de.laures.cewolf.ChartValidationException; +import de.laures.cewolf.DatasetProduceException; + +/** + * Chart factory creates Jfreechart instances. To add a new factory use the + * + * CewolfChartFactory.registerFactory(new CewolfChartFactory() {...}); + * + * method. + * + * @author Guido Laures + */ +public abstract class CewolfChartFactory implements ChartConstants, AxisConstants, LayoutConstants { + + // chart type string + protected String chartType; + // map contains registered factories, (String) chartType->CewolfChartFactory mappings + private static Map factories = new HashMap(); + + /** Creates a new instance of ChartFactory */ + protected CewolfChartFactory(String chartType) { + this.chartType = chartType; + } + + /** + * Callback when the chart instance to be created. + * @param title The title of chart + * @param xAxisLabel label on x axis + * @param yAxisLabel label on y axis + * @param data The dataset to create chart for + * @return The newly created JFreeChart instance + * + * @throws IncompatibleDatasetException If the incoming data is not compatible with this factory + */ + public abstract JFreeChart getChartInstance(String title, String xAxisLabel, String yAxisLabel, Dataset data) throws IncompatibleDatasetException; + + //////////////// static part /////////////////////// + + /** + * Register a new chart factory instance. + * @param factory The factory to register + */ + public static void registerFactory(CewolfChartFactory factory) { + factories.put(factory.chartType, factory); + } + + private static final int getChartTypeConstant(String type) { + final int res = ChartTypes.typeList.indexOf(type.toLowerCase()); + if (res < 0) { + throw new RuntimeException("unsupported chart type " + type); + } + return res; + } + + private static final int getLayoutConstant(String layout) { + return LayoutTypes.typeList.indexOf(layout.toLowerCase()); + } + + static { + // histogram chart type + registerFactory(new CewolfChartFactory("histogram") { + public JFreeChart getChartInstance(String title, String xAxisLabel, String yAxisLabel, Dataset data) throws IncompatibleDatasetException { + check(data, IntervalXYDataset.class, this.chartType); + return ChartFactory.createHistogram(title, xAxisLabel, yAxisLabel, (IntervalXYDataset) data, PlotOrientation.VERTICAL, true, false, false); + } + }); + } + + public static JFreeChart getChartInstance(String chartType, String title, String xAxisLabel, String yAxisLabel, Dataset data) throws ChartValidationException { + // first check the dynamically registered chart types + CewolfChartFactory factory = (CewolfChartFactory) factories.get(chartType); + if (factory != null) { + // custom factory found, use it + return factory.getChartInstance(title, xAxisLabel, yAxisLabel, data); + } + + switch (getChartTypeConstant(chartType)) { + case XY : + check(data, XYDataset.class, chartType); + return ChartFactory.createXYLineChart(title, xAxisLabel, yAxisLabel, (XYDataset) data, PlotOrientation.VERTICAL, true, true, true); + case PIE : + check(data, PieDataset.class, chartType); + return ChartFactory.createPieChart(title, (PieDataset) data, true, true, true); + case AREA_XY : + check(data, XYDataset.class, chartType); + return ChartFactory.createXYAreaChart(title, xAxisLabel, yAxisLabel, (XYDataset) data, PlotOrientation.VERTICAL, true, false, false); + case SCATTER : + check(data, XYDataset.class, chartType); + return ChartFactory.createScatterPlot(title, xAxisLabel, yAxisLabel, (XYDataset) data, PlotOrientation.VERTICAL, true, false, false); + case AREA : + check(data, CategoryDataset.class, chartType); + return ChartFactory.createAreaChart(title, xAxisLabel, yAxisLabel, (CategoryDataset) data, PlotOrientation.VERTICAL, true, false, false); + case HORIZONTAL_BAR : + check(data, CategoryDataset.class, chartType); + return ChartFactory.createBarChart(title, xAxisLabel, yAxisLabel, (CategoryDataset) data, PlotOrientation.HORIZONTAL, true, false, false); + case HORIZONTAL_BAR_3D : + check(data, CategoryDataset.class, chartType); + return ChartFactory.createBarChart3D(title, xAxisLabel, yAxisLabel, (CategoryDataset) data, PlotOrientation.HORIZONTAL, true, false, false); + case LINE : + check(data, CategoryDataset.class, chartType); + return ChartFactory.createLineChart(title, xAxisLabel, yAxisLabel, (CategoryDataset) data, PlotOrientation.VERTICAL, true, false, false); + case STACKED_HORIZONTAL_BAR : + check(data, CategoryDataset.class, chartType); + return ChartFactory.createStackedBarChart(title, xAxisLabel, yAxisLabel, (CategoryDataset) data, PlotOrientation.HORIZONTAL, true, false, false); + case STACKED_VERTICAL_BAR : + check(data, CategoryDataset.class, chartType); + return ChartFactory.createStackedBarChart(title, xAxisLabel, yAxisLabel, (CategoryDataset) data, PlotOrientation.VERTICAL, true, false, false); + case STACKED_VERTICAL_BAR_3D : + check(data, CategoryDataset.class, chartType); + return ChartFactory.createStackedBarChart3D(title, xAxisLabel, yAxisLabel, (CategoryDataset) data, PlotOrientation.VERTICAL, true, false, false); + case VERTICAL_BAR : + check(data, CategoryDataset.class, chartType); + return ChartFactory.createBarChart(title, xAxisLabel, yAxisLabel, (CategoryDataset) data, PlotOrientation.VERTICAL, true, false, false); + case VERTICAL_BAR_3D : + check(data, CategoryDataset.class, chartType); + return ChartFactory.createBarChart3D(title, xAxisLabel, yAxisLabel, (CategoryDataset) data, PlotOrientation.VERTICAL, true, false, false); + case TIME_SERIES : + check(data, XYDataset.class, chartType); + return ChartFactory.createTimeSeriesChart(title, xAxisLabel, yAxisLabel, (XYDataset) data, true, false, false); + case CANDLE_STICK : + check(data, OHLCDataset.class, chartType); + return ChartFactory.createCandlestickChart(title, xAxisLabel, yAxisLabel, (OHLCDataset) data, true); + case HIGH_LOW : + check(data, OHLCDataset.class, chartType); + return ChartFactory.createHighLowChart(title, xAxisLabel, yAxisLabel, (OHLCDataset) data, true); + case GANTT : + check(data, IntervalCategoryDataset.class, chartType); + return ChartFactory.createGanttChart(title, xAxisLabel, yAxisLabel, (IntervalCategoryDataset) data, true, false, false); + case WIND : + check(data, WindDataset.class, chartType); + return ChartFactory.createWindPlot(title, xAxisLabel, yAxisLabel, (WindDataset) data, true, false, false); + //case SIGNAL : + // check(data, SignalsDataset.class, chartType); + // return ChartFactory.createSignalChart(title, xAxisLabel, yAxisLabel, (SignalsDataset) data, true); + case VERRTICAL_XY_BAR : + check(data, IntervalXYDataset.class, chartType); + return ChartFactory.createXYBarChart(title, xAxisLabel, true,yAxisLabel, (IntervalXYDataset) data, PlotOrientation.VERTICAL, true, false, false); + case PIE_3D : + check(data, PieDataset.class, chartType); + return ChartFactory.createPieChart3D(title, (PieDataset) data, true, false, false); + case METER : + check(data, ValueDataset.class, chartType); + MeterPlot plot = new MeterPlot((ValueDataset) data); + JFreeChart chart = new JFreeChart(title, plot); + return chart; + case STACKED_AREA : + check(data, CategoryDataset.class, chartType); + return ChartFactory.createStackedAreaChart(title, xAxisLabel, yAxisLabel, (CategoryDataset) data, PlotOrientation.VERTICAL, true, false, false); + case BUBBLE : + check(data, XYZDataset.class, chartType); + return ChartFactory.createBubbleChart(title, xAxisLabel, yAxisLabel, (XYZDataset) data, PlotOrientation.VERTICAL, true, false, false); + default : + throw new UnsupportedChartTypeException(chartType + " is not supported."); + } + } + + public static JFreeChart getOverlaidChartInstance(String chartType, String title, String xAxisLabel, String yAxisLabel, int xAxisType, int yAxisType, List plotDefinitions) + throws ChartValidationException, DatasetProduceException { + final int chartTypeConst = getChartTypeConstant(chartType); + final AxisFactory axisFactory = AxisFactory.getInstance(); + switch (chartTypeConst) { + case OVERLAY_XY : + ValueAxis domainAxis = (ValueAxis) axisFactory.createAxis(ORIENTATION_HORIZONTAL, xAxisType, xAxisLabel); + // get main plot + PlotDefinition mainPlotDef = (PlotDefinition) plotDefinitions.get(0); + check((Dataset) mainPlotDef.getDataset(), XYDataset.class, chartType); + XYPlot plot = (XYPlot) mainPlotDef.getPlot(chartTypeConst); + plot.setDomainAxis(domainAxis); + plot.setRangeAxis((ValueAxis) axisFactory.createAxis(ORIENTATION_VERTICAL, yAxisType, yAxisLabel)); + //plot.setRenderer(new StandardXYItemRenderer()); + // add second and later datasets to main plot + for (int plotidx = 1;plotidxtype
attribute of a <chart> tag. + * @author Guido Laures + */ +public class ChartTypes { + + /** All type strings in an array */ + public static final String[] typeNames = { + "area", + "areaxy", + "horizontalbar", + "horizontalbar3d", + "line", + "pie", + "scatter", + "stackedhorizontalbar", + "stackedverticalbar", + "stackedverticalbar3d", + "timeseries", + "verticalbar", + "verticalbar3d", + "xy", + "candlestick", + "highlow", + "gantt", + "wind", + "signal", + "verticalxybar", + "pie3d", + "overlaidxy", + "overlaidcategory", + "combinedxy", + "meter", + "stackedarea", + "bubble" + }; + + /** + * The whole typeNames array inside of a list. + * @see #typeNames + */ + public static final List typeList = Arrays.asList(typeNames); + + private ChartTypes() { + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/CombinedChartDefinition.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/CombinedChartDefinition.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,43 @@ +package de.laures.cewolf.taglib; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.jfree.chart.JFreeChart; +import org.jfree.chart.plot.DefaultDrawingSupplier; +import org.jfree.chart.plot.DrawingSupplier; + +import de.laures.cewolf.ChartValidationException; +import de.laures.cewolf.DatasetProduceException; + +/** + * Chart definition subclass to handle combined charts + * + * @author guido + * @author tbardzil + */ +public class CombinedChartDefinition extends AbstractChartDefinition implements Serializable { + private String layout; + + private List plotDefinitions = new ArrayList(); + private transient DrawingSupplier drawingSupplier = new DefaultDrawingSupplier(); + + public void setLayout(String layout) { + this.layout = layout; + } + + public Object getDataset() throws DatasetProduceException { + return ((PlotDefinition)plotDefinitions.get(0)).getDataset(); + } + + public void addPlot(PlotDefinition pd) { + pd.setDrawingSupplier(drawingSupplier); + plotDefinitions.add(pd); + } + + protected JFreeChart produceChart() throws DatasetProduceException, ChartValidationException { + return CewolfChartFactory.getCombinedChartInstance(type, title, xAxisLabel, yAxisLabel, plotDefinitions, layout); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/DataAware.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/DataAware.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,13 @@ +package de.laures.cewolf.taglib; + +import java.util.Map; + +import de.laures.cewolf.DatasetProducer; + +/** + * @author glaures + */ +public interface DataAware { + + public void setDataProductionConfig(DatasetProducer dsp, Map params, boolean useCache); +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/DataContainer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/DataContainer.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,96 @@ +/* + * Created on 13.04.2003 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package de.laures.cewolf.taglib; + +import java.io.Serializable; +import java.util.Date; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jfree.data.general.Dataset; + +import de.laures.cewolf.DatasetProduceException; +import de.laures.cewolf.DatasetProducer; +import de.laures.cewolf.taglib.util.DatasetProductionTimeStore; +import de.laures.cewolf.taglib.util.KeyGenerator; +import de.laures.cewolf.util.Assert; + +/** + * @author guido + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class DataContainer implements DataAware, Serializable { + + private static transient final Log log = LogFactory.getLog(ChartImageDefinition.class); + + private transient Dataset data; + private transient DatasetProducer producer; + + private Map datasetProductionParams; + private long datasetProduceTime; + private boolean useCache = true; + + public void setDataProductionConfig(DatasetProducer dsp, Map params, boolean useCache) { + log.debug("setDataProductionConfig"); + producer = dsp; + datasetProductionParams = params; + this.useCache = useCache; + checkDataProductionNeed(); + } + + public Object getDataset() throws DatasetProduceException { + Assert.check(producer != null, "you need to specifiy a producer for the data of the chart."); + log.debug("getting data.."); + if (data == null) { + log.debug("producing new dataset for " + producer.getProducerId()); + data = (Dataset) producer.produceDataset(datasetProductionParams); + DatasetProductionTimeStore dataCache = DatasetProductionTimeStore.getInstance(); + dataCache.addEntry(producer.getProducerId(), datasetProductionParams, new Date(datasetProduceTime)); + } + Assert.check(data != null, "your producer of type " + producer.getClass().getName() + " produced a null dataset."); + return data; + } + + /** + * This method checks if there has been a dataset production + * for the same DatasetProvider and parameters. If so the DatasetProducer + * is consulted to check the expiry of this data. + * If the data has expired the retrieval of a cached image of this + * ChartDefinition is avoided by setting the datasetProduceTime to the + * actual time. After this the hash code of this object can not be + * present in the image cache and so a new image with new data will + * be rendered. + * If the data did not expire the last dataset production time is stored + * as a memeber to reach the same hash code for this object as the one + * before if possible. + * This method is called during serialization to ensure the same serialized + * representation of this and a eventually formally stored object. + */ + private void checkDataProductionNeed() { + log.debug("checking data actuality..." + producer + ", " + datasetProductionParams); + final String prodId = producer.getProducerId(); + log.debug(prodId + ", " + KeyGenerator.generateKey((Serializable)datasetProductionParams)); + log.debug("useCache = " + useCache); + DatasetProductionTimeStore dataCache = DatasetProductionTimeStore.getInstance(); + if (useCache && dataCache.containsEntry(prodId, datasetProductionParams)) { + Date produceTime = dataCache.getProductionTime(prodId, datasetProductionParams); + log.debug("cached data available."); + // cached data available + if (!producer.hasExpired(datasetProductionParams, produceTime)) { + log.debug("cached data is still valid."); + this.datasetProduceTime = produceTime.getTime(); + return; + } + dataCache.removeEntry(prodId, datasetProductionParams); + } + datasetProduceTime = System.currentTimeMillis(); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/IncompatibleDatasetException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/IncompatibleDatasetException.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,43 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib; + +import de.laures.cewolf.ChartValidationException; + +/** + * This exception is thrown if a chart is created with an incompatible dataset. + * @author glaures + * @since 0.9 + */ +public class IncompatibleDatasetException extends ChartValidationException { + + + /** + * Constructor for IncompatibleDatasetException. + * @param msg the excpetion message + */ + public IncompatibleDatasetException(String msg) { + super(msg); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/LayoutConstants.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/LayoutConstants.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,38 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib; + +/** + * Contains some base constants to avoid explicit dependancy to concrete chart + * implementation's constant values. The constants of this class also serve as + * the base contract for data exchange between sub packages. + * + * @author Guido Laures + * @author Tim Bardzil + */ +public interface LayoutConstants { + + int DOMAIN = 0; + int RANGE = 1; + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/LayoutTypes.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/LayoutTypes.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,51 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib; + +import java.util.Arrays; +import java.util.List; + +/** + * Contains the list of all possible layout type string values which can be used + * in the layout attribute of a <combined-chart> tag. + * @author Guido Laures + * @author Tim Bardzil + */ +public class LayoutTypes { + + /** All layout strings in an array */ + public static final String[] typeNames = { + "vertical", + "horizontal", + }; + + /** + * The whole typeNames array inside of a list. + * @see #typeNames + */ + public static final List typeList = Arrays.asList(typeNames); + + private LayoutTypes() { + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/OverlaidChartDefinition.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/OverlaidChartDefinition.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,64 @@ +/* + * Created on 13.04.2003 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package de.laures.cewolf.taglib; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.jfree.chart.JFreeChart; +import org.jfree.chart.plot.DefaultDrawingSupplier; +import org.jfree.chart.plot.DrawingSupplier; + +import de.laures.cewolf.ChartValidationException; +import de.laures.cewolf.DatasetProduceException; + +/** + * @author guido + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class OverlaidChartDefinition extends AbstractChartDefinition implements Serializable { + + private int xAxisType = 0; + private int yAxisType = 0; + + private List plotDefinitions = new ArrayList(); + private transient DrawingSupplier drawingSupplier = new DefaultDrawingSupplier(); + + public Object getDataset() throws DatasetProduceException { + return ((PlotDefinition)plotDefinitions.get(0)).getDataset(); + } + + public void addPlot(PlotDefinition pd) { + pd.setDrawingSupplier(drawingSupplier); + plotDefinitions.add(pd); + } + + protected JFreeChart produceChart() throws DatasetProduceException, ChartValidationException { + log.debug("xAxisType = " + xAxisType); + return CewolfChartFactory.getOverlaidChartInstance(type, title, xAxisLabel, yAxisLabel, xAxisType, yAxisType, plotDefinitions); + } + + /** + * Sets the xAxisType. + * @param xAxisType The xAxisType to set + */ + public void setXAxisType(int xAxisType) { + this.xAxisType = xAxisType; + } + + /** + * Sets the yAxisType. + * @param yAxisType The yAxisType to set + */ + public void setYAxisType(int yAxisType) { + this.yAxisType = yAxisType; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/PlotConstants.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/PlotConstants.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,45 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures and contributers + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib; + +/** + * Contains some base constants to avoid explicit dependancy to concrete Plot + * implementation's constant values. The constants of this class also serve as + * the base contract for data exchange between sub packages. + * @author Chris McCann + */ +public interface PlotConstants { + int XY_AREA = 0; + int XY_LINE = 1; + int XY_SHAPES_AND_LINES = 2; + int SCATTER = 3; + int XY_VERTICAL_BAR = 4; + int STEP = 5; + int CANDLESTICK = 6; + int HIGH_LOW = 7; + int SIGNAL = 8; + int VERTICAL_BAR = 9; + int AREA = 10; + int LINE = 11; + int SHAPES_AND_LINES = 13; +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/PlotContainer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/PlotContainer.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,19 @@ +/* + * Created on 13.04.2003 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package de.laures.cewolf.taglib; + +/** + * @author guido + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public interface PlotContainer { + + public void addPlot(PlotDefinition pd); + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/PlotDefinition.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/PlotDefinition.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,196 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures and contributers + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ +package de.laures.cewolf.taglib; + +import java.io.Serializable; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jfree.chart.plot.CategoryPlot; +import org.jfree.chart.plot.DrawingSupplier; +import org.jfree.chart.plot.Plot; +import org.jfree.chart.plot.XYPlot; +import org.jfree.chart.renderer.AbstractRenderer; +import org.jfree.chart.renderer.category.CategoryItemRenderer; +import org.jfree.chart.renderer.xy.XYItemRenderer; +import org.jfree.data.category.CategoryDataset; +import org.jfree.data.general.Dataset; +import org.jfree.data.xy.IntervalXYDataset; +import org.jfree.data.xy.OHLCDataset; +import org.jfree.data.xy.XYDataset; + +import de.laures.cewolf.ChartValidationException; +import de.laures.cewolf.DatasetProduceException; +import de.laures.cewolf.DatasetProducer; + +/** + * (sub) Plot definition for combined/overlaid charts. + * + * @author Chris McCann + * @author Guido Laures + */ +public class PlotDefinition implements DataAware, Serializable, TaglibConstants, PlotConstants { + + private transient Log log = LogFactory.getLog(getClass()); + + private String type; + private String xAxisLabel; // [tb] + private String yAxisLabel; // [tb] + + private DataContainer dataAware = new DataContainer(); + private transient Plot plot; + private transient DrawingSupplier drawingSupplier = null; + + public Plot getPlot(int chartType) throws DatasetProduceException, ChartValidationException { + log.debug("Plot.getPlot: chartType: " + chartType); + if (plot == null) { + int rendererIndex = PlotTypes.getRendererIndex(type); + + Dataset data = (Dataset) getDataset(); + log.debug("Plot.getPlot: data name: " +data.getClass().getName()); + AbstractRenderer rend = PlotTypes.getRenderer(rendererIndex); + log.debug("Plot.getPlot: rendererIndex: " + rendererIndex); + if (chartType == ChartConstants.OVERLAY_XY || chartType == ChartConstants.COMBINED_XY) { + switch (rendererIndex) { + case XY_AREA : + case XY_LINE : + case XY_SHAPES_AND_LINES : + case SCATTER : + case STEP : + check(data, XYDataset.class, rendererIndex); + plot = new XYPlot((XYDataset) data, null, null, (XYItemRenderer) rend); + break; + case XY_VERTICAL_BAR : + check(data, IntervalXYDataset.class, rendererIndex); + plot = new XYPlot((IntervalXYDataset) data, null, null, (XYItemRenderer) rend); + break; + case CANDLESTICK : + case HIGH_LOW : + check(data, OHLCDataset.class, rendererIndex); + plot = new XYPlot((OHLCDataset) data, null, null, (XYItemRenderer) rend); + break; + //case SIGNAL : + // check(data, SignalsDataset.class, rendererIndex); + // plot = new XYPlot((SignalsDataset) data, null, null, (XYItemRenderer) rend); + default : + throw new AttributeValidationException(chartType + ".type", type); + } + } else if (chartType == ChartConstants.OVERLAY_CATEGORY) { + switch (rendererIndex) { + case AREA : + case VERTICAL_BAR : + case LINE : + case SHAPES_AND_LINES : + check(data, CategoryDataset.class, rendererIndex); + plot = + new CategoryPlot( + (CategoryDataset) data, + null, + null, + (CategoryItemRenderer) rend); + break; + default : + throw new AttributeValidationException(chartType + ".type", type); + } + } + } + plot.setDrawingSupplier(drawingSupplier); + return plot; + } + + public Object getDataset() throws DatasetProduceException { + return dataAware.getDataset(); + } + + /** + * Gets the y-axis label. [tb] + * + * @return the y-axis label. + */ + public String getXaxislabel() { + return xAxisLabel; + } + + /** + * Sets the x-axis label [tb] + * + * @return the x-axis label + */ + public String getYaxislabel() { + return yAxisLabel; + } + + /** + * Sets the x-axis label [tb] + * + * @param xAxisLabel New value of property xAxisLabel. + */ + public void setXaxislabel(String xAxisLabel) { + this.xAxisLabel = xAxisLabel; + } + + /** + * Sets the y-axis label [tb] + * + * @param yAxisLabel New value of property yAxisLabel. + */ + public void setYaxislabel(String yAxisLabel) { + this.yAxisLabel = yAxisLabel; + } + /** + * Sets the type. + * @param type The type to set + */ + public void setType(String type) { + this.type = type; + } + /** + * Gets the type. + * @return type of plot as a String + */ + public String getType() { + return this.type; + } + + public void check(Dataset data, Class clazz, int plotType) throws IncompatibleDatasetException { + if (!clazz.isInstance(data)) { + throw new IncompatibleDatasetException( + "Plots of type " + PlotTypes.typeNames[plotType] + " need a dataset of type " + clazz.getName()); + } + } + + public void setDataProductionConfig(DatasetProducer dsp, Map params, boolean useCache) { + log.debug("setDataProductionConfig(" + dsp + ", " + params); + dataAware.setDataProductionConfig(dsp, params, useCache); + } + + /** + * Sets the drawingSupplier. + * @param drawingSupplier The drawingSupplier to set + */ + public void setDrawingSupplier(DrawingSupplier drawingSupplier) { + this.drawingSupplier = drawingSupplier; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/PlotTypes.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/PlotTypes.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,116 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib; + +import java.util.Arrays; +import java.util.List; + +import org.jfree.chart.renderer.AbstractRenderer; +import org.jfree.chart.renderer.category.AreaRenderer; +import org.jfree.chart.renderer.category.BarRenderer; +import org.jfree.chart.renderer.category.LineAndShapeRenderer; +import org.jfree.chart.renderer.xy.CandlestickRenderer; +import org.jfree.chart.renderer.xy.HighLowRenderer; +import org.jfree.chart.renderer.xy.StandardXYItemRenderer; +import org.jfree.chart.renderer.xy.XYAreaRenderer; +import org.jfree.chart.renderer.xy.XYBarRenderer; +import org.jfree.chart.renderer.xy.XYStepRenderer; + +/** + * Contains the list of all possible plot type string values which can be used + * in the type attribute of a <chart> tag. + * + * It also contains all the renders that correspond with the plot types + * @author Chris McCann + */ +public class PlotTypes { + + /** All type strings in an array */ + public static final String[] typeNames = + { + "xyarea", + "xyline", + "xyshapesandlines", + "scatter", + "xyverticalbar", + "step", + "candlestick", + "highlow", + "signal", + "verticalbar", + "area", + "line", + "shapesandlines" }; + + /** + * The whole typeNames array inside of a list. + * @see #typeNames + */ + private static final List typeList = Arrays.asList(typeNames); + + /** + * Create a renderer for the given type index. + * We create a new renderer instance for each chart, because they may want to customize + * it in a post-processor. + * + * @param idx The index of the type + * @return A new renderer instance + */ + public static AbstractRenderer getRenderer(int idx) { + switch (idx) { + case 0: return new XYAreaRenderer(); + case 1: return new StandardXYItemRenderer(); + case 2: return new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES_AND_LINES); + case 3: return new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES); + case 4: return new XYBarRenderer(); + case 5: return new XYStepRenderer(); + case 6: return new CandlestickRenderer(); + case 7: return new HighLowRenderer(); + //case 8: return new SignalRenderer(); + case 9: return new BarRenderer(); + case 10: return new AreaRenderer(); + case 11: return new LineAndShapeRenderer(true,false); + case 12: return new LineAndShapeRenderer(true,true); + default: + throw new RuntimeException("Invalid renderer index:" + idx); + } + } + + private PlotTypes() { + } + + /** + * Get the renderer index for the given plot type. + * @param plotType The type string of the plot + * @return The index The index of renderer + * @throws AttributeValidationException if unknown type + */ + public static int getRendererIndex(String plotType) throws AttributeValidationException { + int rendererIndex = PlotTypes.typeList.indexOf(plotType.toLowerCase()); + if (rendererIndex < 0) { + throw new AttributeValidationException("plot.type", plotType); + } + return rendererIndex; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/SimpleChartDefinition.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/SimpleChartDefinition.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,43 @@ +/* + * Created on 13.04.2003 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package de.laures.cewolf.taglib; + +import java.io.Serializable; +import java.util.Map; + +import org.jfree.chart.JFreeChart; +import org.jfree.data.general.Dataset; + +import de.laures.cewolf.ChartValidationException; +import de.laures.cewolf.DatasetProduceException; +import de.laures.cewolf.DatasetProducer; + +/** + * @author guido + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class SimpleChartDefinition extends AbstractChartDefinition implements DataAware, Serializable { + + private DataContainer dataAware = new DataContainer(); + + protected JFreeChart produceChart() throws DatasetProduceException, ChartValidationException { + return CewolfChartFactory.getChartInstance(type, title, xAxisLabel, yAxisLabel, (Dataset)getDataset()); + } + + public Object getDataset() throws DatasetProduceException { + return dataAware.getDataset(); + } + + public void setDataProductionConfig(DatasetProducer dsp, Map params, boolean useCache) { + dataAware.setDataProductionConfig(dsp, params, useCache); + } + + + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/TagValidationException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/TagValidationException.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,45 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib; + +import org.xml.sax.SAXException; + +/** + * Thrown by some of the libraries validators. + * @author Guido Laures + */ +public class TagValidationException extends SAXException { + + private final String tag; + + /** Creates a new instance of TagValidationException */ + public TagValidationException(String tag, String msg) { + super(msg); + this.tag = tag; + } + + public String getTag() { + return tag; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/TaglibConstants.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/TaglibConstants.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,40 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib; + +/** + * Contains some base constants to avoid explicit dependancy to concrete chart + * implementation's constant values. The constants of this class also serve as + * the base contract for data exchange between sub packages. + * @author Guido Laures + */ +public interface TaglibConstants { + + int ANCHOR_NORTH = 100; + int ANCHOR_SOUTH = 101; + int ANCHOR_EAST = 102; + int ANCHOR_WEST = 103; + + String TOOLTIPS_ENABLED_KEY = "ttenabled"; + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/UnsupportedChartTypeException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/UnsupportedChartTypeException.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,37 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib; + +import de.laures.cewolf.ChartValidationException; +; + +/** + * @author glaures + */ +public class UnsupportedChartTypeException extends ChartValidationException { + + public UnsupportedChartTypeException(String type){ + super("chart type " + type + " is unsupported."); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/html/AbstractHTMLBaseTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/html/AbstractHTMLBaseTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,307 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.html; + +import java.io.IOException; +import java.io.Serializable; +import java.io.Writer; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspWriter; + +import de.laures.cewolf.taglib.tags.CewolfBodyTag; + +/** + * Abstract base class which holds attribbutes common for all HTML 4.0 tags. + * @author Guido Laures + */ +public abstract class AbstractHTMLBaseTag extends CewolfBodyTag implements Serializable{ + + protected static final int UNDEFINED_INT = -1; + protected static final float UNDEFINED_FLOAT = -1.0f; + protected static final String UNDEFINED_STR = null; + + /** Holds value of property ID. */ + protected String id = UNDEFINED_STR; + + /** Holds value of property clazz. */ + protected String clazz = UNDEFINED_STR; + + /** Holds value of property style. */ + protected String style = UNDEFINED_STR; + + /** Holds value of property title. */ + protected String title = UNDEFINED_STR; + + /** Holds value of property lang. */ + protected String lang = UNDEFINED_STR; + + /** Holds value of property dir. */ + protected String dir = UNDEFINED_STR; + + /** Holds value of property onclick. */ + protected String onclick = UNDEFINED_STR; + + /** Holds value of property ondbclick. */ + protected String ondbclick = UNDEFINED_STR; + + /** Holds value of property onmousedown. */ + protected String onmousedown = UNDEFINED_STR; + + /** Holds value of property onmouseup. */ + protected String onmouseup = UNDEFINED_STR; + + /** Holds value of property onmouseover. */ + protected String onmouseover = UNDEFINED_STR; + + /** Holds value of property onmousemove. */ + protected String onmousemove = UNDEFINED_STR; + + /** Holds value of property onmouseout. */ + protected String onmouseout = UNDEFINED_STR; + + /** Holds value of property onkeypress. */ + protected String onkeypress = UNDEFINED_STR; + + /** Holds value of property onkeydown. */ + protected String onkeydown = UNDEFINED_STR; + + /** Holds value of property onkeyup. */ + protected String onkeyup = UNDEFINED_STR; + + public AbstractHTMLBaseTag(){ + setId(UNDEFINED_STR); + } + + protected abstract String getTagName(); + + protected abstract boolean hasBody(); + + protected abstract boolean wellFormed(); + + protected void reset(){ + this.clazz = UNDEFINED_STR; + this.dir = UNDEFINED_STR; + this.id = UNDEFINED_STR; + this.lang = UNDEFINED_STR; + this.onclick = UNDEFINED_STR; + this.ondbclick = UNDEFINED_STR; + this.onkeydown = UNDEFINED_STR; + this.onkeypress = UNDEFINED_STR; + this.onkeyup = UNDEFINED_STR; + this.onmousedown = UNDEFINED_STR; + this.onmousemove = UNDEFINED_STR; + this.onmouseout = UNDEFINED_STR; + this.onmouseover = UNDEFINED_STR; + this.onmouseup = UNDEFINED_STR; + this.style = UNDEFINED_STR; + this.title = UNDEFINED_STR; + } + + public int doStartTag() throws JspException { + JspWriter writer = pageContext.getOut(); + try { + writer.write("<" + getTagName()); + writeAttributes(writer); + if(hasBody()){ + writer.write(">"); + return EVAL_PAGE; + } else { + return SKIP_BODY; + } + } catch(IOException ioe){ + super.pageContext.getServletContext().log("",ioe); + throw new JspException(ioe.getMessage()); + } + } + + public int doEndTag() throws JspException { + JspWriter writer = pageContext.getOut(); + try{ + if(hasBody()){ + writer.write(""); + } else { + if(wellFormed()){ + writer.write(" /"); + } + writer.write(">"); + } + return doAfterEndTag(EVAL_PAGE); + } catch(IOException ioe){ + super.pageContext.getServletContext().log("",ioe); + throw new JspException(ioe.getMessage()); + } + } + + public void writeAttributes(Writer wr){ + try { + appendAttributeDeclaration(wr, getId(), "ID"); + appendAttributeDeclaration(wr, this.clazz, "CLASS"); + appendAttributeDeclaration(wr, this.style, "STYLE"); + appendAttributeDeclaration(wr, this.onclick, "ONCLICK"); + appendAttributeDeclaration(wr, this.ondbclick, "ONDBCLICK"); + appendAttributeDeclaration(wr, this.onkeydown, "ONKEYDOWN"); + appendAttributeDeclaration(wr, this.onkeypress, "ONKEYPRESS"); + appendAttributeDeclaration(wr, this.onkeyup, "ONKEYUP"); + appendAttributeDeclaration(wr, this.onmousedown, "ONMOUSEDOWN"); + appendAttributeDeclaration(wr, this.onmousemove, "ONMOUSEMOVE"); + appendAttributeDeclaration(wr, this.onmouseout, "ONMOUSEOUT"); + appendAttributeDeclaration(wr, this.onmouseover, "ONMOUSEOVER"); + appendAttributeDeclaration(wr, this.onmouseup, "ONMOUSEUP"); + appendAttributeDeclaration(wr, this.title, "TITLE"); + appendAttributeDeclaration(wr, this.lang, "LANG"); + appendAttributeDeclaration(wr, this.dir, "DIR"); + } catch(IOException ioex){ + ioex.printStackTrace(); + } + } + + protected void appendAttributeDeclaration(Writer wr, String attr, String name) throws IOException { + if(attr != UNDEFINED_STR){ + wr.write(" " + name + "=\"" + attr + "\""); + } + } + + protected void appendAttributeDeclaration(Writer wr, int attr, String name) throws IOException { + // does not call the according method for Strings to avoid additional + // String instantiation + if(attr != UNDEFINED_INT){ + wr.write(" " + name + "=\"" + attr + "\""); + } + } + + protected void appendAttributeDeclaration(Writer wr, float attr, String name) throws IOException { + // does not call the according method for Strings to avoid additional + // String instantiation + if(attr != UNDEFINED_FLOAT){ + wr.write(" " + name + "=\"" + attr + "\""); + } + } + + /** Setter for property clazz. + * @param clazz New value of property clazz. + */ + public void setClass(String clazz) { + this.clazz = clazz; + } + + /** Setter for property style. + * @param style New value of property style. + */ + public void setStyle(String style) { + this.style = style; + } + + /** Setter for property title. + * @param title New value of property title. + */ + public void setHtmltitle(String title) { + this.title = title; + } + + /** Setter for property lang. + * @param lang New value of property lang. + */ + public void setLang(String lang) { + this.lang = lang; + } + + /** Setter for property dir. + * @param dir New value of property dir. + */ + public void setDir(String dir) { + this.dir = dir; + } + + /** Setter for property onclick. + * @param onclick New value of property onclick. + */ + public void setOnclick(String onclick) { + this.onclick = onclick; + } + + /** Setter for property ondbclick. + * @param ondbclick New value of property ondbclick. + */ + public void setOndbclick(String ondbclick) { + this.ondbclick = ondbclick; + } + + /** Setter for property onmousedown. + * @param onmousedown New value of property onmousedown. + */ + public void setOnmousedown(String onmousedown) { + this.onmousedown = onmousedown; + } + + /** Setter for property onmouseup. + * @param onmouseup New value of property onmouseup. + */ + public void setOnmouseup(String onmouseup) { + this.onmouseup = onmouseup; + } + + /** Setter for property onmouseover. + * @param onmouseover New value of property onmouseover. + */ + public void setOnmouseover(String onmouseover) { + this.onmouseover = onmouseover; + } + + /** Setter for property onmousemove. + * @param onmousemove New value of property onmousemove. + */ + public void setOnmousemove(String onmousemove) { + this.onmousemove = onmousemove; + } + + /** Setter for property onmouseout. + * @param onmouseout New value of property onmouseout. + */ + public void setOnmouseout(String onmouseout) { + this.onmouseout = onmouseout; + } + + /** Setter for property onkeypress. + * @param onkeypress New value of property onkeypress. + */ + public void setOnkeypress(String onkeypress) { + this.onkeypress = onkeypress; + } + + /** Setter for property onkeydown. + * @param onkeydown New value of property onkeydown. + */ + public void setOnkeydown(String onkeydown) { + this.onkeydown = onkeydown; + } + + /** Setter for property onkeyup. + * @param onkeyup New value of property onkeyup. + */ + public void setOnkeyup(String onkeyup) { + this.onkeyup = onkeyup; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/html/HTMLImgTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/html/HTMLImgTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,242 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.html; + +import java.io.IOException; +import java.io.Serializable; +import java.io.Writer; + +/** + * HTML img tag. + * @author Guido Laures + */ +public class HTMLImgTag extends AbstractHTMLBaseTag implements Serializable{ + + private final static String TAG_NAME = "IMG"; + + /** Holds value of property width. */ + protected int width = UNDEFINED_INT; + + /** Holds value of property height. */ + protected int height = UNDEFINED_INT; + + /** Holds value of property src. */ + protected String src = UNDEFINED_STR; + + /** Holds value of property alt. */ + protected String alt = ""; + + /** Holds value of property longDesc. */ + protected String longDesc = UNDEFINED_STR; + + /** Holds value of property useMap. */ + protected String useMap = UNDEFINED_STR; + + /** Holds value of property ismap. */ + protected String ismap = UNDEFINED_STR; + + /** Holds value of property align. */ + protected String align = UNDEFINED_STR; + + /** Holds value of property border. */ + protected int border = 0; + + /** Holds value of property hSpace. */ + protected int hSpace = UNDEFINED_INT; + + /** Holds value of property vSpace. */ + protected int vSpace = UNDEFINED_INT; + + /** + * Add or not JSESSIONID + */ + protected boolean forceSessionId = true; + + /** + * Remove image from Storage after rendering + */ + protected boolean removeAfterRender = false; + + /* + public void writeTag(Writer writer) throws IOException { + writer.write(""); + } + **/ + + public void writeAttributes(Writer wr){ + try { + super.writeAttributes(wr); + appendAttributeDeclaration(wr, this.border, "BORDER"); + appendAttributeDeclaration(wr, this.hSpace, "HSPACE"); + appendAttributeDeclaration(wr, this.height, "HEIGHT"); + appendAttributeDeclaration(wr, this.vSpace, "VSPACE"); + appendAttributeDeclaration(wr, this.width, "WIDTH"); + appendAttributeDeclaration(wr, this.align, "ALIGN"); + appendAttributeDeclaration(wr, this.alt, "ALT"); + appendAttributeDeclaration(wr, this.ismap, "ISMAP"); + appendAttributeDeclaration(wr, this.longDesc, "LONGDESC"); + appendAttributeDeclaration(wr, this.src, "SRC"); + appendAttributeDeclaration(wr, this.useMap, "USEMAP"); + } catch(IOException ioex){ + ioex.printStackTrace(); + } + } + + protected void reset(){ + // width = UNDEFINED_INT; + // height = UNDEFINED_INT; + src = UNDEFINED_STR; + alt = ""; + longDesc = UNDEFINED_STR; + useMap = UNDEFINED_STR; + ismap = UNDEFINED_STR; + align = UNDEFINED_STR; + border = 0; + hSpace = UNDEFINED_INT; + vSpace = UNDEFINED_INT; + forceSessionId = true; + removeAfterRender = false; + super.reset(); + } + + /** Setter for property width. + * @param width New value of property width. + */ + public void setWidth(int width) { + this.width = width; + } + + /** Setter for property height. + * @param height New value of property height. + */ + public void setHeight(int height) { + this.height = height; + } + + /** Setter for property src. + * @param src New value of property src. + */ + public void setSrc(String src) { + this.src = src; + } + + /** Setter for property alt. + * @param alt New value of property alt. + */ + public void setAlt(String alt) { + this.alt = alt; + } + + /** Setter for property longDesc. + * @param longDesc New value of property longDesc. + */ + public void setLongdesc(String longDesc) { + this.longDesc = longDesc; + } + + /** Setter for property useMap. + * @param useMap New value of property useMap. + */ + public void setUsemap(String useMap) { + this.useMap = useMap; + } + + /** Setter for property ismap. + * @param ismap New value of property ismap. + */ + public void setIsmap(String ismap) { + this.ismap = ismap; + } + + /** Setter for property align. + * @param align New value of property align. + */ + public void setAlign(String align) { + this.align = align; + } + + /** Setter for property border. + * @param border New value of property border. + */ + public void setBorder(int border) { + this.border = border; + } + + /** Setter for property hSpace. + * @param hSpace New value of property hSpace. + */ + public void setHspace(int hSpace) { + this.hSpace = hSpace; + } + + /** Setter for property vSpace. + * @param vSpace New value of property vSpace. + */ + public void setVspace(int vSpace) { + this.vSpace = vSpace; + } + + protected String getTagName() { + return TAG_NAME; + } + + protected boolean hasBody() { + return false; + } + + protected boolean wellFormed() { + return false; + } + + + /** + * @return Returns the forceSessionId. + */ + public boolean isForceSessionId() { + return forceSessionId; + } + + /** + * @param forceSessionId The forceSessionId to set. + */ + public void setForceSessionId(boolean forceSessionId) { + this.forceSessionId = forceSessionId; + } + + /** + * @return Returns the removeAfterRender. + */ + public boolean isRemoveAfterRender() { + return removeAfterRender; + } + + /** + * @param removeAfterRender The removeAfterRender to set. + */ + public void setRemoveAfterRender(boolean removeAfterRender) { + this.removeAfterRender = removeAfterRender; + } +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/html/package.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/html/package.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,10 @@ + + + + + + + +Value objects to hold HTML attributes. + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/package.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/package.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,10 @@ + + + + + + + +Framework classes for the tag library implementation. + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/AbstractChartTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/AbstractChartTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,144 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import java.awt.Paint; +import java.util.Map; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.PageContext; + +import de.laures.cewolf.ChartPostProcessor; +import de.laures.cewolf.taglib.AbstractChartDefinition; +import de.laures.cewolf.taglib.TaglibConstants; + +/** + * Root tag <chart> of a chart definition. Defines all values for the + * page scope variable of type ChartDefinition which is used by the img + * tag to render the appropriate chart. + * @author Guido Laures + */ +public abstract class AbstractChartTag extends CewolfTag implements CewolfRootTag, TaglibConstants, Painted { + + protected AbstractChartDefinition chartDefinition = createChartDefinition(); + + protected abstract AbstractChartDefinition createChartDefinition(); + + public int doStartTag(){ + return EVAL_BODY_INCLUDE; + } + + public int doEndTag() throws JspException { + pageContext.setAttribute(getId(), chartDefinition, PageContext.PAGE_SCOPE); + return doAfterEndTag(EVAL_PAGE); + } + + + public void reset() { + chartDefinition = createChartDefinition(); + } + + public String getChartId() { + return getId(); + } + + /** + * Setter for property title. + * @param title New value of property title. + */ + public void setTitle(String title) { + chartDefinition.setTitle(title); + } + + /** + * Setter for property xAxisLabel. + * @param xAxisLabel New value of property xAxisLabel. + */ + public void setXaxislabel(String xAxisLabel) { + chartDefinition.setXAxisLabel(xAxisLabel); + } + + /** + * Setter for property xAxisLabel. + * @param xAxisLabel New value of property xAxisLabel. + */ + public void setYaxislabel(String yAxisLabel) { + chartDefinition.setYAxisLabel(yAxisLabel); + } + + public void setBackground(String src) { + String srcFile = pageContext.getServletContext().getRealPath(src); + chartDefinition.setBackground(srcFile); + } + + public void setBackgroundimagealpha(Float alpha) { + chartDefinition.setBackgroundImageAlpha(alpha.floatValue()); + } + + public void setAntialias(boolean anti) { + chartDefinition.setAntialias(anti); + } + + /** + * Setter for property legend. + * @param legend New value of property legend. + */ + public void setShowlegend(boolean legend) { + chartDefinition.setShowLegend(legend); + } + + /** + * Setter for property legend. + * @param legend New value of property legend. + */ + public void setLegendanchor(String anchor) { + if ("north".equalsIgnoreCase(anchor)) { + chartDefinition.setLegendAnchor(ANCHOR_NORTH); + } else if ("south".equalsIgnoreCase(anchor)) { + chartDefinition.setLegendAnchor(ANCHOR_SOUTH); + } else if ("west".equalsIgnoreCase(anchor)) { + chartDefinition.setLegendAnchor(ANCHOR_WEST); + } else if ("east".equalsIgnoreCase(anchor)) { + chartDefinition.setLegendAnchor(ANCHOR_EAST); + } + } + + public void addChartPostProcessor(ChartPostProcessor pp, Map params) { + chartDefinition.addPostProcessor(pp); + chartDefinition.addPostProcessorParams(params); + } + + public void setPaint(Paint paint){ + chartDefinition.setPaint(paint); + } + + /** + * Setter for property type. + * @param type New value of property type. + */ + public void setType(String type) { + chartDefinition.setType(type); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/AbstractObjectTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/AbstractObjectTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,35 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +/** + * Abstract base class for all tags referencing a scripting variable by its ID. + * @author Guido Laures + */ +public abstract class AbstractObjectTag extends CewolfBodyTag { + + protected Object getObject() { + return pageContext.findAttribute(getId()); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/AbstractParameterizedObjectTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/AbstractParameterizedObjectTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,50 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import java.util.HashMap; +import java.util.Map; + +/** + * Abstract base class for all tags referencing a scripting variable by its ID + * which they want to parameterize further. + * @see Parameterized + * @author Guido Laures + */ +public abstract class AbstractParameterizedObjectTag extends AbstractObjectTag implements Parameterized { + + private Map params = new HashMap(); + + protected void reset(){ + params = new HashMap(); + } + + protected Map getParameters() { + return params; + } + + public void addParameter(String name, Object value) { + params.put(name, value); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/CewolfBodyTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/CewolfBodyTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,35 @@ +package de.laures.cewolf.taglib.tags; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.BodyTagSupport; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author glaures + * + * To change this generated comment edit the template variable "typecomment": + * Window>Preferences>Java>Templates. + * To enable and disable the creation of type comments go to + * Window>Preferences>Java>Code Generation. + */ +public abstract class CewolfBodyTag extends BodyTagSupport { + + protected Log log = LogFactory.getLog(getClass()); + + protected final int doAfterEndTag(int returnVal) { + reset(); + return returnVal; + } + + protected abstract void reset(); + + /** + * @see javax.servlet.jsp.tagext.Tag#doEndTag() + */ + public int doEndTag() throws JspException { + return doAfterEndTag(super.doEndTag()); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/CewolfRootTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/CewolfRootTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,37 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +/** + * A root tag always holds a chart ID as it always is assigne dto a chart. + * @author glaures + */ +public interface CewolfRootTag { + + /** + * Method getChartId. + * @return String + */ + String getChartId(); + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/CewolfTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/CewolfTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,35 @@ +package de.laures.cewolf.taglib.tags; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author glaures + * + * To change this generated comment edit the template variable "typecomment": + * Window>Preferences>Java>Templates. + * To enable and disable the creation of type comments go to + * Window>Preferences>Java>Code Generation. + */ +public abstract class CewolfTag extends TagSupport { + + protected Log log = LogFactory.getLog(this.getClass()); + + protected final int doAfterEndTag(int returnVal) { + reset(); + return returnVal; + } + + protected abstract void reset(); + + /** + * @see javax.servlet.jsp.tagext.Tag#doEndTag() + */ + public int doEndTag() throws JspException { + return doAfterEndTag(super.doEndTag()); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ChartImgTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ChartImgTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,325 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import java.io.IOException; +import java.io.Writer; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspWriter; +import javax.servlet.jsp.PageContext; +import javax.servlet.jsp.tagext.BodyContent; + +import de.laures.cewolf.CewolfException; +import de.laures.cewolf.ChartHolder; +import de.laures.cewolf.ChartImage; +import de.laures.cewolf.Configuration; +import de.laures.cewolf.Storage; +import de.laures.cewolf.WebConstants; +import de.laures.cewolf.taglib.ChartImageDefinition; +import de.laures.cewolf.taglib.TaglibConstants; +import de.laures.cewolf.taglib.html.HTMLImgTag; +import de.laures.cewolf.taglib.util.MIMEExtensionHelper; +import de.laures.cewolf.taglib.util.PageUtils; + +/** + * This is the tag implementation of the <img> tag. This tag inputs the + * proper <img> tag into the HTML page delivered to the client. It + * therefor determines the chart ID which will be used by the rendering servlet + * to retrieve the chart. + * + * @author glaures + * @see de.laures.cewolf.ChartImage + */ +public class ChartImgTag extends HTMLImgTag implements CewolfRootTag, Mapped, TaglibConstants, WebConstants +{ + + private static final String DEFAULT_MIME_TYPE = MIME_PNG; + private static final String TAG_NAME_SVG = "EMBED"; + private static final int DEFAULT_TIMEOUT = 300; + + private String chartId = null; + private String renderer; + private String mimeType = DEFAULT_MIME_TYPE; + private int timeout = DEFAULT_TIMEOUT; + protected String sessionKey = null; + + private ChartImageDefinition chartImageDefinition; + + public int doStartTag() throws JspException + { + final ChartHolder chartHolder = PageUtils.getChartHolder(chartId, pageContext); + this.chartImageDefinition = new ChartImageDefinition(chartHolder, width, height, ChartImage.IMG_TYPE_CHART, mimeType,timeout); + Storage storage = Configuration.getInstance(pageContext.getServletContext()).getStorage(); + try + { + this.sessionKey = storage.storeChartImage(chartImageDefinition, pageContext); + } + catch (CewolfException cwex) + { + throw new JspException(cwex.getMessage()); + } + return EVAL_PAGE; + } + + public int doAfterBody() throws JspException + { + try + { + // double checking for null as Resin had problems with that + final BodyContent body = getBodyContent(); + if ( body != null ) + { + final JspWriter writer = getPreviousOut(); + if ( writer != null ) + { + body.writeOut(writer); + } + } + + } + catch (IOException ioex) + { + log.error(ioex); + throw new JspException(ioex.getMessage()); + } + return SKIP_BODY; + } + + public int doEndTag() throws JspException + { + super.doStartTag(); + final StringBuffer buffer = new StringBuffer(" src=\""); + buffer.append(getImgURL()); + buffer.append("\""); + try + { + pageContext.getOut().write(buffer.toString()); + } + catch (IOException ioex) + { + reset(); + log.error(ioex); + throw new JspException(ioex.getMessage()); + } + return super.doEndTag(); + } + + /** + * Fix an absolute url given as attribute by adding the full application url path to it. + * It is considered absolute url (not relative) when it starts with "/" + * @param url The url to fix + * @param request The http request + * @return Fixed url contains the full path + */ + public static String fixAbsolutURL(String url, HttpServletRequest request) { + if ( url.startsWith("/") ) + { + //final HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); + final String context = request.getContextPath(); + url = context + url; + } + return url; + } + + /** + * Same as the other fixAbsolutURL, convinience only. + * @param url The url to fix + * @param pageContext The page context + * @return Fixed url contains the full path + */ + public static String fixAbsolutURL(String url, PageContext pageContext) { + return fixAbsolutURL(url, (HttpServletRequest) pageContext.getRequest()); + } + + /** + * Build the image url + * @param renderer the url of the renderer + * @param pageContext Page context + * @param sessionKey The session key for the image stored. + * @param width The width + * @param height The height + * @param mimeType the mime-type (for example png) of it + * @return The full url + */ + public static String buildImgURL( + String renderer, PageContext pageContext, String sessionKey, int width, int height, String mimeType, + boolean forceSessionId, boolean removeAfterRender) { + renderer = fixAbsolutURL(renderer, pageContext); + final HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); + StringBuffer url = new StringBuffer(response.encodeURL(renderer)); + if ( url.toString().indexOf(SESSIONID_KEY) == -1 ) + { + if (forceSessionId) + { + final String sessionId = pageContext.getSession().getId(); + url.append(";" + SESSIONID_KEY + "=" + sessionId); + } + } + url.append("?" + IMG_PARAM + "=" + sessionKey); + url.append(AMPERSAND + WIDTH_PARAM + "=" + width); + url.append(AMPERSAND + HEIGHT_PARAM + "=" + height); + if (removeAfterRender) + { + url.append(AMPERSAND + REMOVE_AFTER_RENDERING + "=true"); + } + url.append(AMPERSAND + "iehack=" + MIMEExtensionHelper.getExtensionForMimeType(mimeType)); + return url.toString(); + } + + /** + * To enable further server side scriptings on JSP output the session ID is + * always encoded into the image URL even if cookies are enabled on the client + * side. + */ + protected String getImgURL() + { + return buildImgURL(renderer, pageContext, sessionKey, width, height, mimeType, forceSessionId, removeAfterRender); + } + + public Object getRenderingInfo() throws CewolfException + { + return chartImageDefinition.getRenderingInfo(); + } + + protected String getMimeType() + { + return mimeType; + } + + protected void reset() + { + this.mimeType = DEFAULT_MIME_TYPE; + // as of a weird JSP compiler in resin + // a reused tag's attribute is only set if + // it changes. So width an height may not + // be unset to ensure correct values. + int lHeight = this.height; + int lWidth = this.width; + int lTimeout = this.timeout; + super.reset(); + this.height = lHeight; + this.width = lWidth; + this.timeout = lTimeout; + } + + public void enableMapping() + { + setUsemap("#" + chartId); + } + + public String getChartId() + { + return getChartid(); + } + + public void setChartid( String id ) + { + this.chartId = id; + } + + public String getChartid() + { + return chartId; + } + + public void setRenderer( String renderer ) + { + this.renderer = renderer; + } + + protected String getRenderer() + { + return this.renderer; + } + + public int getWidth() + { + return this.width; + } + + public int getHeight() + { + return height; + } + + /** + * Sets the mimeType. + * + * @param mimeType + * The mimeType to set + */ + public void setMime( String mimeType ) + { + this.mimeType = mimeType; + } + + /** + * @see de.laures.cewolf.taglib.html.AbstractHTMLBaseTag#getTagName() + */ + protected String getTagName() + { + if ( MIME_SVG.equals(mimeType) ) + { + return TAG_NAME_SVG; + } + return super.getTagName(); + } + + /** + * @see de.laures.cewolf.taglib.html.AbstractHTMLBaseTag#writeAttributes(Writer) + */ + public void writeAttributes( Writer wr ) + { + super.writeAttributes(wr); + if ( MIME_SVG.equals(mimeType) ) + { + try + { + appendAttributeDeclaration(wr, "http://www.adobe.com/svg/viewer/install/", "PLUGINSPAGE"); + } + catch (IOException ioex) + { + ioex.printStackTrace(); + } + } + } + + /** + * @return Returns the timeout. + */ + public int getTimeout() + { + return timeout; + } + /** + * @param timeout The timeout to set. + */ + public void setTimeout( int timeout ) + { + this.timeout = timeout; + } +} \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ChartImgURLTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ChartImgURLTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,79 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import java.io.IOException; + +import javax.servlet.jsp.JspException; + +/** + * This tag only renders the image URL instead of a full <img> tag. + * @author glaures + * @see de.laures.cewolf.taglib.tags.ChartImgTag + */ +public class ChartImgURLTag extends ChartImgTag { + + public static final String VAR_NAME = "var"; + + String var = null; + + public int doEndTag() throws JspException { + try { + if(var == null){ + pageContext.getOut().write(getImgURL()); + } else { + pageContext.setAttribute(var, getImgURL()); + } + } catch(IOException ioex){ + log.error(ioex); + throw new JspException(ioex.getMessage()); + } + return doAfterEndTag(EVAL_PAGE); + } + + /** + * @see de.laures.cewolf.taglib.tags.CewolfBodyTag#reset() + */ + protected void reset() { + super.reset(); + var = null; + } + + /** + * Returns the var. + * @return String + */ + public String getVar() { + return var; + } + + /** + * Sets the var. + * @param var The var to set + */ + public void setVar(String var) { + this.var = var; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ChartImgURLTagEI.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ChartImgURLTagEI.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,49 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +/** + * TagExxtraInfo for the ChartImgURLTag + * @see ChartImgURLTag + * @author glaures + */ +public class ChartImgURLTagEI extends TagExtraInfo { + + /** + * @see javax.servlet.jsp.tagext.TagExtraInfo#getVariableInfo(TagData) + */ + public VariableInfo[] getVariableInfo(TagData tagData) { + String varName = (String)(tagData.getAttribute(ChartImgURLTag.VAR_NAME)); + if(varName == null){ + return new VariableInfo[] {}; + } + VariableInfo info = new VariableInfo(varName, "java.lang.String", true, VariableInfo.AT_END); + return new VariableInfo[] {info}; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ChartMapTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ChartMapTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,272 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import java.io.IOException; +import java.io.Writer; +import java.util.Iterator; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.jsp.JspException; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jfree.chart.ChartRenderingInfo; +import org.jfree.chart.entity.CategoryItemEntity; +import org.jfree.chart.entity.ChartEntity; +import org.jfree.chart.entity.LegendItemEntity; +import org.jfree.chart.entity.PieSectionEntity; +import org.jfree.chart.entity.XYItemEntity; +import org.jfree.data.category.CategoryDataset; +import org.jfree.data.general.Dataset; +import org.jfree.data.general.PieDataset; +import org.jfree.data.xy.XYDataset; + +import de.laures.cewolf.CewolfException; +import de.laures.cewolf.Configuration; +import de.laures.cewolf.links.CategoryItemLinkGenerator; +import de.laures.cewolf.links.LinkGenerator; +import de.laures.cewolf.links.PieSectionLinkGenerator; +import de.laures.cewolf.links.XYItemLinkGenerator; +import de.laures.cewolf.taglib.util.BrowserDetection; +import de.laures.cewolf.taglib.util.PageUtils; +import de.laures.cewolf.tooltips.CategoryToolTipGenerator; +import de.laures.cewolf.tooltips.PieToolTipGenerator; +import de.laures.cewolf.tooltips.ToolTipGenerator; +import de.laures.cewolf.tooltips.XYToolTipGenerator; + +/** + * Tag <map> which defines the tooltip and link tags. + * @see DataTag + * @author Guido Laures + */ +public class ChartMapTag extends CewolfTag { + + private static final long serialVersionUID = -3742340487378471159L; + + private static final Log LOG = LogFactory.getLog(ChartMapTag.class); + + ToolTipGenerator toolTipGenerator = null; + LinkGenerator linkGenerator = null; + + // If the links provided by the JFreeChart renderer should be used. + boolean useJFreeChartLinkGenerator = false; + // If the tooltips provided by the JFreeChart renderer should be used. + boolean useJFreeChartTooltipGenerator = false; + + public int doStartTag() throws JspException { + // Object linkGenerator = getLinkGenerator(); + Mapped root = (Mapped) PageUtils.findRoot(this, pageContext); + root.enableMapping(); + String chartId = ((CewolfRootTag) root).getChartId(); + try { + Dataset dataset = PageUtils.getDataset(chartId, pageContext); + Writer out = pageContext.getOut(); + final boolean isIE = BrowserDetection.isIE((HttpServletRequest) pageContext.getRequest()); + if (hasToolTips()) { + enableToolTips(out, isIE); + } + out.write("\n"); + ChartRenderingInfo info = (ChartRenderingInfo) root.getRenderingInfo(); + Iterator entities = info.getEntityCollection().iterator(); + while (entities.hasNext()) { + ChartEntity ce = (ChartEntity) entities.next(); + out.write("\n"); + } + } catch (IOException ioex) { + log.error(ioex); + throw new JspException(ioex.getMessage()); + } catch (CewolfException cwex) { + log.error(cwex); + throw new JspException(cwex.getMessage()); + } + return EVAL_PAGE; + } + + public int doEndTag() throws JspException { + // print out image map end + Writer out = pageContext.getOut(); + try { + out.write(""); + } catch (IOException ioex) { + log.error(ioex); + throw new JspException(ioex.getMessage()); + } + return doAfterEndTag(EVAL_PAGE); + } + + public void reset() { + this.toolTipGenerator = null; + this.linkGenerator = null; + } + + public void writeOutLink(Object linkGen, Dataset dataset, Writer out, ChartEntity ce) throws IOException { + final String link = generateLink(dataset, ce); + + if (null != link) { + final String href = ((HttpServletResponse) pageContext.getResponse()).encodeURL(link); + out.write("HREF=\"" + href + "\""); + } + } + + private void writeOutToolTip(Dataset dataset, Writer out, final boolean isIE, ChartEntity ce) throws IOException, JspException { + String toolTip = generateToolTip(dataset, ce); + if (null != toolTip) { + if (!isIE) { + out.write("ONMOUSEOVER=\"return overlib('" + + toolTip + "', WIDTH, '20');\" ONMOUSEOUT=\"return nd();\" "); + } else { + out.write("ALT=\"" + toolTip + "\" "); + } + } + } + + public void enableToolTips(Writer out, final boolean isIE) throws IOException { + if (!PageUtils.isToolTipsEnabled(pageContext) && !isIE) { + Configuration config = Configuration.getInstance(pageContext.getServletContext()); + String overLibURL = ChartImgTag.fixAbsolutURL(config.getOverlibURL(), pageContext); + out.write("\n"); + out.write("
\n"); + PageUtils.setToolTipsEnabled(pageContext); + } + } + + private String generateLink(Dataset dataset, ChartEntity ce) { + String link = null; + if (useJFreeChartLinkGenerator) { + link = ce.getURLText(); + } else if (linkGenerator instanceof CategoryItemLinkGenerator || linkGenerator instanceof XYItemLinkGenerator || linkGenerator instanceof PieSectionLinkGenerator) { + if (linkGenerator instanceof CategoryItemLinkGenerator) { + if (ce instanceof CategoryItemEntity) { + CategoryItemEntity catEnt = (CategoryItemEntity) ce; + link = ((CategoryItemLinkGenerator) linkGenerator).generateLink(dataset, catEnt.getSeries(), catEnt.getCategory()); + } + } + if (linkGenerator instanceof XYItemLinkGenerator) { + if (ce instanceof XYItemEntity) { + XYItemEntity xyEnt = (XYItemEntity) ce; + link = ((XYItemLinkGenerator) linkGenerator).generateLink(dataset, xyEnt.getSeriesIndex(), xyEnt.getItem()); + } else { + // Note; there is a simple ChartEntity also passed since Jfreechart 1.0rc1, that is ignored + LOG.debug("Link entity skipped, not XYItemEntity.class:" + ce); + } + } + if (linkGenerator instanceof PieSectionLinkGenerator) { + if (ce instanceof PieSectionEntity) { + PieSectionEntity pieEnt = (PieSectionEntity) ce; + link = ((PieSectionLinkGenerator) linkGenerator).generateLink(dataset, pieEnt.getSectionKey()); + } + } + } + return link; + } + + private String generateToolTip(Dataset dataset, ChartEntity ce) throws JspException { + String tooltip = null; + if (useJFreeChartTooltipGenerator) { + tooltip = ce.getToolTipText(); + } else if (toolTipGenerator instanceof CategoryToolTipGenerator || toolTipGenerator instanceof XYToolTipGenerator || toolTipGenerator instanceof PieToolTipGenerator) { + if (toolTipGenerator instanceof CategoryToolTipGenerator) { + if (ce instanceof CategoryItemEntity) { + CategoryItemEntity catEnt = (CategoryItemEntity) ce; + tooltip = ((CategoryToolTipGenerator) toolTipGenerator).generateToolTip((CategoryDataset) dataset, catEnt.getSeries(), catEnt.getCategoryIndex()); + } + } + + if (toolTipGenerator instanceof XYToolTipGenerator) { + if (ce instanceof XYItemEntity) { + XYItemEntity xyEnt = (XYItemEntity) ce; + tooltip = ((XYToolTipGenerator) toolTipGenerator).generateToolTip((XYDataset) dataset, xyEnt.getSeriesIndex(), xyEnt.getItem()); + } + } + + if (toolTipGenerator instanceof PieToolTipGenerator) { + if (ce instanceof PieSectionEntity) { + PieSectionEntity pieEnt = (PieSectionEntity) ce; + PieDataset ds = (PieDataset) dataset; + final int index = pieEnt.getSectionIndex(); + tooltip = ((PieToolTipGenerator) toolTipGenerator).generateToolTip(ds, ds.getKey(index), index); + } + } + } else { + // throw because category is unknown + throw new JspException( + "TooltipgGenerator of class " + toolTipGenerator.getClass().getName() + " does not implement the appropriate TooltipGenerator interface for entity type " + ce.getClass().getName()); + } + return tooltip; + } + + private boolean hasToolTips() throws JspException { + if (toolTipGenerator!=null && useJFreeChartTooltipGenerator) { + throw new JspException("Can't have both tooltipGenerator and useJFreeChartTooltipGenerator parameters specified!"); + } + return toolTipGenerator != null || useJFreeChartTooltipGenerator; + } + + public void setTooltipgeneratorid(String id) { + this.toolTipGenerator = (ToolTipGenerator) pageContext.findAttribute(id); + } + + private boolean hasLinks() throws JspException { + if (linkGenerator!=null && useJFreeChartLinkGenerator) { + throw new JspException("Can't have both linkGenerator and useJFreeChartLinkGenerator parameters specified!"); + } + return linkGenerator != null || useJFreeChartLinkGenerator; + } + + public void setLinkgeneratorid(String id) { + this.linkGenerator = (LinkGenerator) pageContext.findAttribute(id); + } + + /** + * Setter of the useJFreeChartLinkGenerator field. + * @param useJFreeChartLinkGenerator the useJFreeChartLinkGenerator to set. + */ + public void setUseJFreeChartLinkGenerator(boolean useJFreeChartLinkGenerator) { + this.useJFreeChartLinkGenerator = useJFreeChartLinkGenerator; + } + /** + * Setter of the useJFreeChartTooltipGenerator field. + * @param useJFreeChartTooltipGenerator the useJFreeChartTooltipGenerator to set. + */ + public void setUseJFreeChartTooltipGenerator(boolean useJFreeChartTooltipGenerator) { + this.useJFreeChartTooltipGenerator = useJFreeChartTooltipGenerator; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ChartPostProcessorTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ChartPostProcessorTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,54 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import javax.servlet.jsp.JspException; + +import de.laures.cewolf.ChartPostProcessor; +import de.laures.cewolf.taglib.util.PageUtils; + +/** + * Tag to define a post processor. + * @see ChartPostProcessor + * @author Guido Laures + */ +public class ChartPostProcessorTag extends AbstractParameterizedObjectTag { + + public int doEndTag() throws JspException { + ChartPostProcessor pp = null; + try { + pp = (ChartPostProcessor)getObject(); + if (pp == null) { + throw new JspException("Could not find ChartEnhanncer under ID '" + getId() + "'"); + } + } catch (ClassCastException cce) { + throw new JspException("Bean under ID '" + getId() + "' is of type '" + + pp.getClass().getName() + + "'.\nType expected:" + ChartPostProcessor.class.getName()); + } + AbstractChartTag rt = (AbstractChartTag)PageUtils.findRoot(this, pageContext); + rt.addChartPostProcessor((ChartPostProcessor)getObject(), getParameters()); + return doAfterEndTag(EVAL_PAGE); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ColorTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ColorTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,63 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import java.awt.Color; +import java.util.Map; + +import de.laures.cewolf.ChartPostProcessor; +import de.laures.cewolf.taglib.util.ColorHelper; + + +/** + * Tag <color> which sets the color of its parent tag. + * This must implement the Colored interface + * @see Colored + * @author Guido Laures + */ +public class ColorTag extends CewolfBodyTag implements ChartPostProcessor { + + private Color color = Color.white; + + public int doEndTag() { + ((Painted)getParent()).setPaint(color); + return doAfterEndTag(EVAL_PAGE); + } + + protected void reset(){ + } + + public void setColor(String s) { + this.color = ColorHelper.getColor(s); + } + + protected Color getColor() { + return color; + } + + public void processChart(Object chart, Map args){ + ((org.jfree.chart.JFreeChart)chart).setBackgroundPaint(color); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/Colored.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/Colored.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,36 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import java.awt.Color; + +/** + * Tags implementing this interface can nest a <color> tag. + * @see ColorTag + * @author Guido Laures + */ +public interface Colored { + + void setColor(Color col); +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/CombinedChartTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/CombinedChartTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,33 @@ +package de.laures.cewolf.taglib.tags; + +import de.laures.cewolf.taglib.AbstractChartDefinition; +import de.laures.cewolf.taglib.CombinedChartDefinition; +import de.laures.cewolf.taglib.PlotContainer; +import de.laures.cewolf.taglib.PlotDefinition; + + +/** + * Chart tag subclass to handle combined charts + * + * @author guido + * @author tbardzil + * + */ +public class CombinedChartTag extends AbstractChartTag implements PlotContainer { + + protected AbstractChartDefinition createChartDefinition() { + return new CombinedChartDefinition(); + } + + public void addPlot(PlotDefinition pd){ + ((CombinedChartDefinition) chartDefinition).addPlot(pd); + } + + /** + * Setter for property layout [tb] + * @param layout + */ + public void setLayout(String layout) { + ((CombinedChartDefinition) chartDefinition).setLayout(layout); + } +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/DataTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/DataTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,41 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + +/** + * Tag <data> which nests the data definition of the chart. Currently only + * the <producer> tag is supported. Future versions will define further + * tags to provide data via SQL, CVS or XML directly in the JSP. + * @see ProducerTag + * @author Guido Laures + */ +public class DataTag extends TagSupport { + + public int doStartTag() throws JspException { + return EVAL_BODY_INCLUDE; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/GradientTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/GradientTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,71 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import java.awt.Color; + + +/** + * Tag <gradient-paint> which defines a paint of type gradient. + * @author Guido Laures + */ +public class GradientTag extends CewolfTag implements Pointed { + + private SerializableGradientPaint gPaint = new SerializableGradientPaint(); + private int pointCount = 0; + + public int doStartTag() { + return EVAL_PAGE; + } + + public int doEndTag() { + ((Painted)getParent()).setPaint(gPaint); + return doAfterEndTag(EVAL_PAGE); + } + + public void reset() { + gPaint = new SerializableGradientPaint(); + pointCount = 0; + } + + public void addPoint(int x, int y, Color c) { + switch (pointCount) { + case 0: + gPaint.setPoint1(x, y, c); + break; + default: + gPaint.setPoint2(x, y, c); + } + pointCount ++; + } + + /** + * Setter for property cyclic. + * @param cyclic New value of property cyclic. + */ + public void setCyclic(boolean cyclic) { + gPaint.setCyclic(cyclic); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/LegendTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/LegendTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,135 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import java.io.IOException; + +import javax.servlet.jsp.JspException; + +import de.laures.cewolf.CewolfException; +import de.laures.cewolf.ChartHolder; +import de.laures.cewolf.ChartImage; +import de.laures.cewolf.Configuration; +import de.laures.cewolf.Storage; +import de.laures.cewolf.WebConstants; +import de.laures.cewolf.taglib.ChartImageDefinition; +import de.laures.cewolf.taglib.TaglibConstants; +import de.laures.cewolf.taglib.html.HTMLImgTag; +import de.laures.cewolf.taglib.util.PageUtils; + +/** + * Tag <legend> which can be used to render a chart's legend + * separately somewhere in the page. + * @author Guido Laures + */ +public class LegendTag extends HTMLImgTag implements CewolfRootTag, TaglibConstants, WebConstants { + + private static final String DEFAULT_MIME_TYPE = MIME_PNG; + private static final int DEFAULT_TIMEOUT = 300; + private int timeout = DEFAULT_TIMEOUT; + private transient String sessionKey; + private transient String renderer; + private String mimeType = DEFAULT_MIME_TYPE; + + public int doStartTag() throws JspException { + ChartHolder cd = PageUtils.getChartHolder(getChartId(), pageContext); + ChartImage cid = new ChartImageDefinition(cd, width, height, ChartImage.IMG_TYPE_LEGEND, mimeType,timeout); + Storage storage = Configuration.getInstance(pageContext.getServletContext()).getStorage(); + try { + this.sessionKey = storage.storeChartImage(cid, pageContext); + } catch(CewolfException cwex){ + log.error(cwex); + throw new JspException(cwex.getMessage()); + } + return SKIP_BODY; + } + + public int doEndTag() throws JspException { + super.doStartTag(); + final StringBuffer buffer = new StringBuffer(" src=\""); + buffer.append(getImgURL()); + buffer.append("\""); + try { + pageContext.getOut().write(buffer.toString()); + } catch (IOException ioex) { + reset(); + log.error(ioex); + throw new JspException(ioex.getMessage()); + } + return super.doEndTag(); + } + + /** + * To enable further server side scriptings on JSP output the session ID is always + * encoded into the image URL even if cookies are enabled on the client side. + */ + protected String getImgURL() { + return ChartImgTag.buildImgURL(renderer, pageContext, sessionKey, width, height, mimeType, forceSessionId,removeAfterRender); + } + + protected void reset() { + // as of a weird JSP compiler in resin + // a reused tag's attribute is only set if + // it changes. So width an height may not + // be unset to ensure correct values. + int lHeight = this.height; + int lWidth = this.width; + int lTimeout = this.timeout; + super.reset(); + this.height = lHeight; + this.width = lWidth; + this.timeout = lTimeout; + } + + public String getChartId() { + return getId(); + } + + public void setRenderer(String rend) { + this.renderer = rend; + } + + /** + * Sets the mimeType. + * @param mimeType The mimeType to set + */ + public void setMime(String mimeType) { + this.mimeType = mimeType; + } + + /** + * @return Returns the timeout. + */ + public int getTimeout() + { + return timeout; + } + /** + * @param timeout The timeout to set. + */ + public void setTimeout( int timeout ) + { + this.timeout = timeout; + } +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/Mapped.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/Mapped.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,46 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import de.laures.cewolf.CewolfException; + +/** + * Image maps can be attacjed to objects + * implementing this interface. + * @author glaures + */ +public interface Mapped { + + /** + * Method getImageKey. + * @return int + */ + public Object getRenderingInfo() throws CewolfException; + + /** + * Method setUsemap. + * @param map + */ + public void enableMapping(); + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/OverlaidChartTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/OverlaidChartTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,50 @@ +/* + * Created on 13.04.2003 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package de.laures.cewolf.taglib.tags; + +import de.laures.cewolf.taglib.AbstractChartDefinition; +import de.laures.cewolf.taglib.AxisTypes; +import de.laures.cewolf.taglib.OverlaidChartDefinition; +import de.laures.cewolf.taglib.PlotContainer; +import de.laures.cewolf.taglib.PlotDefinition; + + +/** + * @author guido + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class OverlaidChartTag extends AbstractChartTag implements PlotContainer { + + protected AbstractChartDefinition createChartDefinition() { + return new OverlaidChartDefinition(); + } + + public void addPlot(PlotDefinition pd){ + ((OverlaidChartDefinition)chartDefinition).addPlot(pd); + } + + /** + * Sets the xAxisType. + * @param xAxisType The xAxisType to set + */ + public void setxaxistype(String xAxisType) { + final int xAxisTypeConst = AxisTypes.typeList.indexOf(xAxisType); + ((OverlaidChartDefinition)chartDefinition).setXAxisType(xAxisTypeConst); + } + + /** + * Sets the yAxisType. + * @param yAxisType The yAxisType to set + */ + public void setyaxistype(String yAxisType) { + final int yAxisTypeConst = AxisTypes.typeList.indexOf(yAxisType); + ((OverlaidChartDefinition)chartDefinition).setYAxisType(yAxisTypeConst); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/Painted.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/Painted.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,40 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import java.awt.Paint; + +/** + * Paint objects can be assigned to objects impmlementing this interface. + * @see java.awt.Paint + * @author glaures + */ +public interface Painted { + + /** + * Method setPaint. + * @param p + */ + public void setPaint(Paint p); + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ParamTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ParamTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,56 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import java.io.Serializable; + +/** + * Tag <param> which defines a key/value pair which is set in the parent + * tag. This must implement the Parameterized interface. + * @see Parameterized + * @author Guido Laures + */ +public class ParamTag extends CewolfBodyTag { + + private String name; + private Object value; + + public int doEndTag() { + Parameterized parent = (Parameterized)getParent(); + parent.addParameter(name, value); + return doAfterEndTag(EVAL_PAGE); + } + + protected void reset() { + } + + public void setName(String name) { + this.name = name; + } + + public void setValue(Serializable val) { + this.value = val; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/Parameterized.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/Parameterized.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,35 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +/** + * Tags implementing this interface can be paramterized by a nested <param> + * tag. + * @see ParamTag + * @author Guido Laures + */ +public interface Parameterized { + + void addParameter(String name, Object value); + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/PlotTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/PlotTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,90 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures, and contributers + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import java.util.Map; + +import javax.servlet.jsp.JspException; + +import de.laures.cewolf.DatasetProducer; +import de.laures.cewolf.taglib.DataAware; +import de.laures.cewolf.taglib.PlotContainer; +import de.laures.cewolf.taglib.PlotDefinition; +import de.laures.cewolf.taglib.TaglibConstants; + +/** + * Tag <sub-plot> which defines a plot to overlay + * @author Chris McCann + */ +public class PlotTag extends CewolfTag implements TaglibConstants, DataAware { + + private PlotDefinition plotDefinition = new PlotDefinition(); + + public int doStartTag() throws JspException { + return EVAL_BODY_INCLUDE; + } + + public int doEndTag() throws JspException { + PlotContainer pc = (PlotContainer)findAncestorWithClass(this, PlotContainer.class); + if (pc == null) { + throw new JspException("<plot> must be nested in a PlotContainer tag like <overlaid-chart>"); + } + pc.addPlot(plotDefinition); + return doAfterEndTag(EVAL_PAGE); + } + + public void reset() { + plotDefinition = new PlotDefinition(); + } + + /** + * Setter for property type. + * @param type New value of property type. + */ + public void setType(String type) { + plotDefinition.setType(type); + } + + public void setDataProductionConfig(DatasetProducer dsp, Map params, boolean useCache) { + plotDefinition.setDataProductionConfig(dsp, params, useCache); + } + + /** + * Setter for property xAxisLabel. [tb] + * @param xAxisLabel New value of property xAxisLabel. + */ + public void setXaxislabel(String xAxisLabel) { + plotDefinition.setXaxislabel(xAxisLabel); + } + + /** + * Setter for property yAxisLabel. [tb] + * @param yAxisLabel New value of property xAxisLabel. + */ + public void setYaxislabel(String yAxisLabel) { + plotDefinition.setYaxislabel(yAxisLabel); + } + + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/PointTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/PointTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,50 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +/** + * Tag <point> which adds a colored point with x and y coordinates to the + * parent tag. This must implement the Pointed interface. + * @see Pointed + * @author Guido Laures + */ +public class PointTag extends ColorTag { + + private int x; + private int y; + + public int doEndTag() { + ((Pointed)getParent()).addPoint(x, y, getColor()); + return doAfterEndTag(EVAL_PAGE); + } + + public void setX(int x) { + this.x = x; + } + + public void setY(int y) { + this.y = y; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/Pointed.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/Pointed.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,37 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import java.awt.Color; + +/** + * Tag implemeting this interface can add points by nesting the <point> + * tag. + * @see PointTag + * @author Guido Laures + */ +public interface Pointed { + + void addPoint(int x, int y, Color col); +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ProducerTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/ProducerTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,71 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import javax.servlet.jsp.JspException; + +import de.laures.cewolf.DatasetProducer; +import de.laures.cewolf.taglib.DataAware; + +/** + * Tag <producer> which defines a DatasetProducer. + * @see DataTag + * @author Guido Laures + */ +public class ProducerTag extends AbstractParameterizedObjectTag { + + private boolean useCache = true; + + public int doEndTag() throws JspException { + DatasetProducer dataProducer = null; + try { + dataProducer = (DatasetProducer) getObject(); + if (dataProducer == null) { + throw new JspException("Could not find datasetproducer under ID '" + getId() + "'"); + } + } catch (ClassCastException cce) { + throw new JspException( + "Bean under ID '" + + getId() + + "' is of type '" + + getObject().getClass().getName() + + "'.\nType expected:" + + DatasetProducer.class.getName()); + } + DataAware dw = (DataAware) findAncestorWithClass(this, DataAware.class); + log.debug("setting data config on " + dw); + log.debug("useCache = " + useCache); + addParameter(DatasetProducer.PRODUCER_ATTRIBUTE_NAME, getId()); + dw.setDataProductionConfig(dataProducer, getParameters(), useCache); + return doAfterEndTag(EVAL_BODY_INCLUDE); + } + + /** + * Sets the useCache. + * @param useCache The useCache to set + */ + public void setUsecache(boolean useCache) { + this.useCache = useCache; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/SerializableGradientPaint.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/SerializableGradientPaint.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,103 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import java.awt.Color; +import java.awt.GradientPaint; +import java.awt.Paint; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; +import java.awt.image.ColorModel; +import java.io.Serializable; + +/** + * Special gradient paint which can be serialized. + * @see GradientPaint + * @author Guido Laures + */ +public class SerializableGradientPaint implements Paint, Serializable { + + private int x1; + private int y1; + private Color c1 = Color.white; + private int x2; + private int y2; + private Color c2 = Color.white; + private boolean cyclic = false; + private transient Paint paint = null; + + public SerializableGradientPaint() { + } + + /** Creates a new instance of SerializableGradientPaint */ + public SerializableGradientPaint(int x1, int y1, Color c1, int x2, int y2, Color c2) { + this.x1 = x1; + this.y1 = y1; + this.c1 = c1; + this.x2 = x2; + this.y2 = y2; + this.c2 = c2; + } + + private Paint getPaint() { + if (paint == null) { + createPaint(); + } + return paint; + } + + private void createPaint() { + paint = new GradientPaint(x1, y1, c1, x2, y2, c2, cyclic); + } + + public void setPoint1(int x, int y, Color c) { + this.x1 = x; + this.y1 = y; + this.c1 = c; + } + + public void setPoint2(int x, int y, Color c) { + this.x2 = x; + this.y2 = y; + this.c2 = c; + } + + public java.awt.PaintContext createContext(ColorModel colorModel, Rectangle rectangle, Rectangle2D rectangle2D, + AffineTransform affineTransform, RenderingHints renderingHints) { + return getPaint().createContext(colorModel, rectangle, rectangle2D, affineTransform, renderingHints); + } + + public int getTransparency() { + return getPaint().getTransparency(); + } + + public void setCyclic(boolean b) { + this.cyclic = b; + } + + public String toString() { + return "" + x1 + "," + y1 + "," + c1 + "," + x2 + "," + y2 + "," + c2; + } +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/SerializableTexturePaint.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/SerializableTexturePaint.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,81 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import java.awt.Paint; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.TexturePaint; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.io.Serializable; + +import de.laures.cewolf.util.ImageHelper; + +/** + * Special texture paint which can be serialized. + * @see TexturePaint + * @author Guido Laures + */ +public class SerializableTexturePaint implements Paint, Serializable { + + private String image; + private int width; + private int height; + private transient Paint paint = null; + + public SerializableTexturePaint() { + } + + /** Creates a new instance of SerializableGradientPaint */ + public SerializableTexturePaint(String image, int width, int height) { + this.image = image; + this.width = width; + this.height = height; + } + + private Paint getPaint() { + if (paint == null) { + createPaint(); + } + return paint; + } + + private void createPaint() { + BufferedImage bim = ImageHelper.loadBufferedImage(image); + Rectangle rect = new Rectangle(width, height); + paint = new TexturePaint(bim, rect); + } + + public java.awt.PaintContext createContext(ColorModel colorModel, Rectangle rectangle, Rectangle2D rectangle2D, + AffineTransform affineTransform, RenderingHints renderingHints) { + return getPaint().createContext(colorModel, rectangle, rectangle2D, affineTransform, renderingHints); + } + + public int getTransparency() { + return getPaint().getTransparency(); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/SimpleChartTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/SimpleChartTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,32 @@ +/* + * Created on 13.04.2003 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package de.laures.cewolf.taglib.tags; + +import java.util.Map; + +import de.laures.cewolf.DatasetProducer; +import de.laures.cewolf.taglib.AbstractChartDefinition; +import de.laures.cewolf.taglib.DataAware; +import de.laures.cewolf.taglib.SimpleChartDefinition; + +/** + * @author guido + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class SimpleChartTag extends AbstractChartTag implements DataAware{ + + protected AbstractChartDefinition createChartDefinition() { + return new SimpleChartDefinition(); + } + + public void setDataProductionConfig(DatasetProducer dsp, Map params, boolean useCache) { + ((SimpleChartDefinition)chartDefinition).setDataProductionConfig(dsp, params, useCache); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/TextureTag.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/TextureTag.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,59 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.tags; + +import javax.servlet.jsp.JspException; + + +/** + * Tag <texture> which defines a texture paint. + * @author Guido Laures + */ +public class TextureTag extends CewolfBodyTag { + + private String image; + private int width; + private int height; + + public int doEndTag() throws JspException { + String realFileName = pageContext.getServletContext().getRealPath(image); + ((Painted)getParent()).setPaint(new SerializableTexturePaint(realFileName, width, height)); + return doAfterEndTag(EVAL_PAGE); + } + + protected void reset() { + } + + public void setImage(String s) { + this.image = s; + } + + public void setWidth(int width) { + this.width = width; + } + + public void setHeight(int height) { + this.height = height; + } +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/package.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/tags/package.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,10 @@ + + + + + + + +Implementation of the specific tags. + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/BrowserDetection.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/BrowserDetection.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,50 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.util; + +import javax.servlet.http.HttpServletRequest; +/** + * @author glaures + */ +public class BrowserDetection { + + private final static String USER_AGENT_KEY = "user-agent"; + private final static String MSIE = "msie"; + + private final static int IE = 0; + private final static int OTHER = 1; + + public static final int getBrowser(HttpServletRequest request){ + String agent = request.getHeader(USER_AGENT_KEY); + if(agent == null || agent.toLowerCase().indexOf(MSIE) < 0){ + return OTHER; + } else { + return IE; + } + } + + public static final boolean isIE(HttpServletRequest request){ + return getBrowser(request) == IE; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/ColorHelper.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/ColorHelper.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,56 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.util; + +import java.awt.Color; + + +/** @author Guido Laures */ +public class ColorHelper { + + private ColorHelper() { + } + + public static final Color getColor(String hexString) { + try { + if (hexString == null || hexString.length() < 7) { + return Color.black; + } + final int red = Integer.parseInt(hexString.substring(1, 3), 16); + final int green = Integer.parseInt(hexString.substring(3, 5), 16); + final int blue = Integer.parseInt(hexString.substring(5, 7), 16); + int alpha = 0; + if (hexString.length() > 8) { + alpha = Integer.parseInt(hexString.substring(7, 9), 16); + } + if (alpha > 0) { + return new Color(red, green, blue, alpha); + } else { + return new Color(red, green, blue); + } + } catch (NumberFormatException nfe) { + return Color.black; + } + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/DatasetProductionTimeStore.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/DatasetProductionTimeStore.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,77 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.util; + +import java.util.Date; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author glaures + */ +public class DatasetProductionTimeStore extends Hashtable { + + private static final DatasetProductionTimeStore instance = new DatasetProductionTimeStore(); + private static final Log log = LogFactory.getLog(DatasetProductionTimeStore.class); + public static final DatasetProductionTimeStore getInstance() { + return instance; + } + + private DatasetProductionTimeStore() { + } + + public boolean containsEntry(String producerId, Map params) { + return containsKey(new DatasetProductionTimesKey(producerId, params)); + } + + public void addEntry(String producerId, Map params, Date produceTime) { + log.debug("add entry: " + producerId); + put(new DatasetProductionTimesKey(producerId, params), produceTime); + } + + public void removeEntry(String producerId, Map params) { + log.debug("remove entry: " + producerId); + + remove(new DatasetProductionTimesKey(producerId, params)); + } + + public Date getProductionTime(String producerId, Map params) { + return (Date) get(new DatasetProductionTimesKey(producerId, params)); + } + + public String paramsToString(Map params){ + Iterator it = params.keySet().iterator(); + StringBuffer buf = new StringBuffer("["); + while(it.hasNext()){ + String key = (String)it.next(); + buf.append(key + ":" + params.get(key)); + } + buf.append("]"); + return buf.toString(); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/DatasetProductionTimesKey.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/DatasetProductionTimesKey.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,66 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.util; + +import java.io.Serializable; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author glaures + */ +class DatasetProductionTimesKey implements Serializable { + + private static final Log log = LogFactory.getLog(DatasetProductionTimesKey.class); + + private final transient int key; + + public DatasetProductionTimesKey(String producerId, Map params){ + key = KeyGenerator.generateKey((Serializable) params); + log.debug("data key is " + key + " producerId=" + producerId); + } + + public int getKey(){ + return key; + } + + public String toString() { + return String.valueOf(key); + } + + public int hashCode() { + return key; + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o instanceof DatasetProductionTimesKey) { + return key == ((DatasetProductionTimesKey) o).getKey(); + } + return false; + } +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/KeyGenerator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/KeyGenerator.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,58 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.util; + +import java.io.IOException; +import java.io.Serializable; +import java.rmi.MarshalledObject; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author Guido Laures + */ +public abstract class KeyGenerator { + + private static final Log log = LogFactory.getLog(KeyGenerator.class); + + private static class NoKeyException extends RuntimeException { + public NoKeyException(String msg){ + super(msg); + } + } + + public static int generateKey(Serializable obj) { + if (obj == null) { + NoKeyException ex = new NoKeyException("assertion failed: can not generate key for null,"); + throw ex; + } + try { + MarshalledObject mo = new MarshalledObject(obj); + return mo.hashCode(); + } catch (IOException ioex) { + log.error("IOException during key generation KeyGenerator.generateKey()", ioex); + throw new NoKeyException(obj + " is not serializable."); + } + } +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/MIMEExtensionHelper.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/MIMEExtensionHelper.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,45 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.util; + +import de.laures.cewolf.WebConstants; + +/** + * @author glaures + */ +public class MIMEExtensionHelper { + + public static String getExtensionForMimeType(String mimeType) { + if (WebConstants.MIME_SVG.equalsIgnoreCase(mimeType)) { + return ".svg"; + } else if (WebConstants.MIME_PNG.equalsIgnoreCase(mimeType)) { + return ".png"; + } + if (WebConstants.MIME_JPEG.equalsIgnoreCase(mimeType)) { + return ".jpg"; + } + return null; + } + + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/PageUtils.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/PageUtils.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,80 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.taglib.util; + +import javax.servlet.jsp.PageContext; +import javax.servlet.jsp.tagext.Tag; + +import org.jfree.data.general.Dataset; + +import de.laures.cewolf.ChartHolder; +import de.laures.cewolf.DatasetProduceException; +import de.laures.cewolf.taglib.tags.CewolfRootTag; + +/** + * Helper class to easily retrieve some objects of page context. + * @author glaures + */ +public class PageUtils { + + private final static String TOOLTIPS_ENABLED_ATTR = PageUtils.class.getName() + ".ttenabled"; + + /** Creates a new instance of ChartDefinitionFactory */ + private PageUtils() {} + + public static ChartHolder getChartHolder(String chartId, PageContext ctx){ + return (ChartHolder)ctx.getAttribute(chartId, PageContext.PAGE_SCOPE); + } + + public static final ChartHolder getChartHolder(Tag tag, PageContext ctx){ + CewolfRootTag root = findRoot(tag, ctx); + if(root instanceof ChartHolder){ + return (ChartHolder)root; + } else { + return getChartHolder(root.getChartId(), ctx); + } + } + + public static final Dataset getDataset(String chartId, PageContext ctx) throws DatasetProduceException { + return (Dataset) getChartHolder(chartId, ctx).getDataset(); + } + + public static final CewolfRootTag findRoot(Tag t, PageContext ctx){ + Tag res = t; + while(!(res instanceof CewolfRootTag)){ + res = res.getParent(); + } + return (CewolfRootTag)res; + } + + public static final void setToolTipsEnabled(PageContext ctx){ + if(!isToolTipsEnabled(ctx)){ + ctx.setAttribute(TOOLTIPS_ENABLED_ATTR, "true", PageContext.PAGE_SCOPE); + } + } + + public static final boolean isToolTipsEnabled(PageContext ctx){ + return ctx.getAttribute(TOOLTIPS_ENABLED_ATTR, PageContext.PAGE_SCOPE) != null; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/package.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/util/package.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,10 @@ + + + + + + + +Utility classes for the tag library. + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/tooltips/CategoryToolTipGenerator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/tooltips/CategoryToolTipGenerator.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,33 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.tooltips; + +import org.jfree.data.category.CategoryDataset; + +/** + * @author glaures + */ +public interface CategoryToolTipGenerator extends ToolTipGenerator { + + String generateToolTip(CategoryDataset data, int series, int item); +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/tooltips/PieToolTipGenerator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/tooltips/PieToolTipGenerator.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,42 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.tooltips; + +import org.jfree.data.general.PieDataset; + +/** + * @author glaures + */ +public interface PieToolTipGenerator extends ToolTipGenerator { + + /** + * Generates a tool tip text item for a particular category in the dataset. + * + * @param data the dataset. + * @param key the item key. + * @param pieIndex the pie index (differentiates between pies in a 'multi' pie chart). + * + * @return The tool tip text. + */ + String generateToolTip(PieDataset data, Comparable key, int pieIndex); +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/tooltips/ToolTipGenerator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/tooltips/ToolTipGenerator.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,32 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.tooltips; + + +/** + * Interface for all tooltip generators. + * @author glaures + */ +public interface ToolTipGenerator { + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/tooltips/XYToolTipGenerator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/tooltips/XYToolTipGenerator.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,41 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.tooltips; + +import org.jfree.data.xy.XYDataset; + +/** + * @author glaures + */ +public interface XYToolTipGenerator extends ToolTipGenerator { + + /** + * Generates a tool tip text item for a particular item within a series. + * @param data the dataset. + * @param series the series index (zero-based). + * @param item the item index (zero-based). + * @return the tooltip text. + */ + String generateToolTip(XYDataset data, int series, int item); + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/util/Assert.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/util/Assert.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,42 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.util; + +/** + * Simple assertion class. + * @author glaures + * @since 0.9 + */ +public class Assert { + + private static class AssertionException extends RuntimeException { + public AssertionException(String msg){ + super(msg); + } + } + + public static void check(boolean b, String msg){ + if(!b) throw new AssertionException(msg); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/util/HTMLStateTable.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/util/HTMLStateTable.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,50 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.util; + +import java.util.Iterator; +import java.util.List; + +/** + * Renders the state of a StateDescriptor as an HTML table. + * @since 0.9 + * @see de.laures.cewolf.util.StateDescriptor + * @author glaures + */ +public class HTMLStateTable { + + public static String getStateTable(StateDescriptor sd){ + StringBuffer res = new StringBuffer(""); + res.append(""); + List params = sd.getStateParameters(); + Iterator it = params.iterator(); + while(it.hasNext()){ + Object key = it.next(); + Object val = sd.getState(key); + res.append(""); + } + res.append("
" + sd.getID() + "
" + key + "" + val + "
"); + return res.toString(); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/util/ImageHelper.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/util/ImageHelper.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,106 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.util; + +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.MediaTracker; +import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.awt.image.PixelGrabber; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Some simple image rendering helper methods. + * @author Guido Laures + */ +public class ImageHelper { + + private static final Component comp = new Component() { }; + private static final MediaTracker tracker = new MediaTracker(comp); + private static final Log log = LogFactory.getLog(ImageHelper.class); + + /** Creates a new instance of ImageHelper */ + private ImageHelper() { + } + + public static final Image loadImage(String fileName) { + final Image image = java.awt.Toolkit.getDefaultToolkit().getImage(fileName); + synchronized(tracker) { + tracker.addImage(image, 0); + try { + tracker.waitForID(0, 0); + } catch (InterruptedException e) { + log.debug("INTERRUPTED while loading Image"); + } + tracker.removeImage(image, 0); + } + return image; + } + + public static BufferedImage loadBufferedImage(String fileName) { + Image image = loadImage(fileName); + if (image instanceof BufferedImage) { + return (BufferedImage)image; + } + /* final boolean hasAlpha = hasAlpha(image); + int transparency = Transparency.OPAQUE; + if (hasAlpha) { + transparency = Transparency.BITMASK; + }*/ + int width = (int)Math.max(1.0, image.getWidth(null)); + int height = (int)Math.max(1.0, image.getHeight(null)); + // BufferedImage bimage = GRAPHICS_CONV.createCompatibleImage(width, height, transparency); + BufferedImage bimage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + final Graphics g = bimage.createGraphics(); + g.drawImage(image, 0, 0, null); + g.dispose(); + return bimage; + } + + public static boolean hasAlpha(Image image) { + if (image instanceof BufferedImage) { + return ((BufferedImage)image).getColorModel().hasAlpha(); + } + PixelGrabber pg = new PixelGrabber(image, 0, 0, 1, 1, false); + try { + pg.grabPixels(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + ColorModel cm = pg.getColorModel(); + if(cm == null){ + return false; + } + return cm.hasAlpha(); + } + + public static BufferedImage createImage(int width, int height) { + // return GRAPHICS_CONV.createCompatibleImage(width, height); + return new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/util/RenderedImage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/util/RenderedImage.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,18 @@ +package de.laures.cewolf.util; + +/** + * @author glaures + */ +public class RenderedImage { + + public final byte[] data; + public final String mimeType; + public final transient Object renderingInfo; + + public RenderedImage(byte[] data, String mimeType, Object renderingInfo) { + this.data = data; + this.mimeType = mimeType; + this.renderingInfo = renderingInfo; + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/util/Renderer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/util/Renderer.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,278 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.util; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.util.Iterator; +import java.util.List; + +import org.apache.batik.dom.GenericDOMImplementation; +import org.apache.batik.svggen.SVGGeneratorContext; +import org.apache.batik.svggen.SVGGraphics2D; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jfree.chart.ChartRenderingInfo; +import org.jfree.chart.ChartUtilities; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.block.RectangleConstraint; +import org.jfree.chart.entity.StandardEntityCollection; +import org.jfree.chart.title.LegendTitle; +import org.jfree.ui.RectangleEdge; +import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Document; + +import com.sun.image.codec.jpeg.JPEGCodec; +import com.sun.image.codec.jpeg.JPEGEncodeParam; +import com.sun.image.codec.jpeg.JPEGImageEncoder; + +import de.laures.cewolf.CewolfException; +import de.laures.cewolf.ChartImage; +import de.laures.cewolf.ChartRenderingException; +import de.laures.cewolf.ConfigurationException; +import de.laures.cewolf.WebConstants; + +/** + * Renderer for ChartImageDefinitions. + * + * @author glaures + * @author tbardzil + * @see de.laures.cewolf.ChartImage + */ +public class Renderer implements WebConstants { + + private final static Log log = LogFactory.getLog(Renderer.class); + + /** Creates a new instance of Renderer */ + private Renderer() { + }; + + /** + * Renders a chart image + * + * @param cd the chart to render + * @return the rendered image + * @throws CewolfException + */ + public static RenderedImage render(ChartImage cd, Object chart) throws CewolfException { + log.debug("rendering " + cd); + switch (cd.getType()) { + case ChartImage.IMG_TYPE_CHART : + return renderChart(cd, chart); + case ChartImage.IMG_TYPE_LEGEND : + return renderLegend(cd, chart); + default : + throw new ConfigurationException(cd.getType() + " is not a supported image type"); + } + } + + /** + * Renders a chart + * @param cd the chart image to be rendered + * @return the rendered image + * @throws CewolfException + */ + private static RenderedImage renderChart(ChartImage cd, Object chart) throws CewolfException { + try { + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); + final String mimeType = cd.getMimeType(); + if (MIME_PNG.equals(mimeType)) { + handlePNG(baos, (JFreeChart)chart, cd.getWidth(), cd.getHeight(), info); + } else if (MIME_JPEG.equals(mimeType)) { + handleJPEG(baos, (JFreeChart)chart, cd.getWidth(), cd.getHeight(), info); + } else if (MIME_SVG.equals(mimeType)) { + handleSVG(baos, (JFreeChart)chart, cd.getWidth(), cd.getHeight()); + } else { + throw new RenderingException("Mime type " + mimeType + " is unsupported."); + } + baos.close(); + return new RenderedImage(baos.toByteArray(), mimeType, info); + } catch (IOException ioe) { + log.error(ioe); + throw new ChartRenderingException(ioe.getMessage(),ioe); + } + } + + /** + * Handles rendering a chart as a PNG. Currently this method is synchronized + * because of concurrency issues with JFreeChart. + * + * @param baos + * @param chart + * @param width + * @param height + * @param info + * @throws IOException + */ + private static synchronized void handlePNG( + ByteArrayOutputStream baos, + JFreeChart chart, + int width, + int height, + ChartRenderingInfo info) + throws IOException { + ChartUtilities.writeChartAsPNG(baos, chart, width, height, info); + } + + /** + * Handles rendering a chart as a JPEG. Currently this method is synchronized + * because of concurrency issues with JFreeChart. + * + * @param baos + * @param chart + * @param width + * @param height + * @param info + * @throws IOException + */ + private static synchronized void handleJPEG( + ByteArrayOutputStream baos, + JFreeChart chart, + int width, + int height, + ChartRenderingInfo info) + throws IOException { + ChartUtilities.writeChartAsJPEG(baos, chart, width, height, info); + } + + /** + * Handles rendering a chart as a SVG. Currently this method is synchronized + * because of concurrency issues with JFreeChart. + * + * @param baos + * @param chart + * @param width + * @param height + * @throws IOException + */ + private static synchronized void handleSVG(ByteArrayOutputStream baos, JFreeChart chart, int width, int height) + throws IOException { + OutputStreamWriter writer = new OutputStreamWriter(baos, "UTF-8"); + DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation(); + Document document = domImpl.createDocument("cewolf-svg", "svg", null); + SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(document); + ctx.setComment("Generated by Cewolf using JFreeChart and Apache Batik SVG Generator"); + SVGGraphics2D svgGenerator = new SVGGraphics2D(ctx, false); + svgGenerator.setSVGCanvasSize(new Dimension(width, height)); + chart.draw(svgGenerator, new Rectangle2D.Double(0, 0, width, height), null); + svgGenerator.stream(writer, false); + writer.close(); + } + + //gets first legend in the list + public static LegendTitle getLegend(JFreeChart chart) + { + //i need to find the legend now. + LegendTitle legend = null; + List subTitles = chart.getSubtitles(); + Iterator iter = subTitles.iterator(); + while (iter.hasNext()) + { + Object o = iter.next(); + if (o instanceof LegendTitle) + { + legend = (LegendTitle) o; + break; + } + } + return legend; + } + + //removes first legend in the list + public static void removeLegend(JFreeChart chart) + { + List subTitles = chart.getSubtitles(); + Iterator iter = subTitles.iterator(); + while (iter.hasNext()) + { + Object o = iter.next(); + if (o instanceof LegendTitle) + { + iter.remove(); + break; + } + } + } + + /** + * Renders a legend + * @param cd the chart iamge to be rendred + * @return the rendered image + * @throws CewolfException + */ + private static RenderedImage renderLegend(ChartImage cd, Object c) throws CewolfException { + try { + JFreeChart chart = (JFreeChart) c; + final int width = cd.getWidth(); + final int height = cd.getHeight(); + LegendTitle legend = getLegend(chart); + boolean haslegend = true; + + // with JFreeChart v0.9.20, the only way to get a valid legend, + // is either to retrieve it from the chart or to assign a new + // one to the chart. In the case where the chart has no legend, + // a new one must be assigned, but just for rendering. After, we + // have to reset the legend to null in the chart. + if (null == legend) { + haslegend = false; + legend = new LegendTitle(chart.getPlot()); + } + legend.setPosition(RectangleEdge.BOTTOM); + BufferedImage bimage = ImageHelper.createImage(width, height); + Graphics2D g = bimage.createGraphics(); + g.setColor(Color.white); + g.fillRect(0, 0, width, height); + legend.arrange(g,new RectangleConstraint(width,height)); + legend.draw(g, new Rectangle(width, height)); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); + JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bimage); + param.setQuality(1.0f, true); + encoder.encode(bimage, param); + out.close(); + + // if the chart had no legend, reset it to null in order to give back the + // chart in the state we received it. + if (!haslegend) { + removeLegend(chart); + } + + return new RenderedImage( + out.toByteArray(), + "image/jpeg", + new ChartRenderingInfo(new StandardEntityCollection())); + } catch (IOException ioex) { + log.error(ioex); + throw new ChartRenderingException(ioex.getMessage(), ioex); + } + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/util/RenderingException.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/util/RenderingException.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,63 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.util; + +import de.laures.cewolf.CewolfException; + +/** + * Thrown when an error during rendering occured. + * @author glaures + * + */ +public class RenderingException extends CewolfException { + + private Throwable wrapped; + + /** + * Constructor for RenderingException. + */ + public RenderingException() { + super(); + } + + /** + * Constructor for RenderingException. + * @param msg + */ + public RenderingException(String msg) { + super(msg); + } + + public RenderingException(Throwable ex){ + super(ex.getMessage()); + } + + public void printStackTrace(){ + if(wrapped != null){ + wrapped.printStackTrace(); + } else { + super.printStackTrace(); + } + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/util/RenderingHelper.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/util/RenderingHelper.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,100 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.util; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Enumeration; +import java.util.StringTokenizer; + +import com.sun.image.codec.jpeg.JPEGCodec; +import com.sun.image.codec.jpeg.JPEGEncodeParam; +import com.sun.image.codec.jpeg.JPEGImageEncoder; + +/** + * Some methods to render messages or exceptions into an image. + * @author glaures + */ +public class RenderingHelper { + + private final static int PADDING_X = 5; + + public static String renderMessage(String msg, int width, int height, OutputStream out) throws IOException { + BufferedImage image = ImageHelper.createImage(width, height); + Graphics gr = image.getGraphics(); + gr.setColor(Color.white); + gr.fillRect(0, 0, width, height); + gr.setColor(Color.black); + gr.drawString(msg, PADDING_X, height/2 - 7); + JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); + JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(image); + param.setQuality(1.0f, true); + encoder.encode(image, param); + return "image/jpeg"; + } + + public static String renderException(Throwable ex, int width, int height, OutputStream out) throws IOException { + BufferedImage image = ImageHelper.createImage(width, height); + Graphics gr = image.getGraphics(); + gr.setColor(Color.white); + gr.fillRect(0, 0, width, height); + gr.setColor(Color.red); + gr.drawString(ex.getClass().getName() + " raised:", PADDING_X, 15); + gr.drawString(String.valueOf(ex.getMessage()), PADDING_X, 30); + gr.setColor(Color.black); + Font stFont = gr.getFont().deriveFont(9f); + gr.setFont(stFont); + drawStackTrace(gr, PADDING_X, 50, ex); + JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); + JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(image); + param.setQuality(1.0f, true); + encoder.encode(image, param); + return "image/jpeg"; + } + + private static void drawStackTrace(Graphics gr, int x, int y, Throwable ex) { + final int linePadding = 4; + int lineHeight = gr.getFont().getSize() + linePadding; + int currY = y; + Enumeration lines = new StringTokenizer(getStackTrace(ex), "\n", false); + while (lines.hasMoreElements()) { + gr.drawString(((String)lines.nextElement()).trim(), x, currY); + currY += lineHeight; + } + } + + private static String getStackTrace(Throwable t) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + t.printStackTrace(pw); + pw.close(); + return sw.getBuffer().toString(); + } + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/util/StateDescriptor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/util/StateDescriptor.java Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,38 @@ +/* ================================================================ + * Cewolf : Chart enabling Web Objects Framework + * ================================================================ + * + * Project Info: http://cewolf.sourceforge.net + * Project Lead: Guido Laures (guido@laures.de); + * + * (C) Copyright 2002, by Guido Laures + * + * This library is free software; you can redistribute it and/or modify it under the terms + * of the GNU Lesser General Public License as published by the Free Software Foundation; + * either version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with this + * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +package de.laures.cewolf.util; + +import java.util.List; + +/** + * States of objects implementing this interface can be monitored in some way. + * @todo change this into an aspect or use MBeans for this + * @author glaures + */ +public interface StateDescriptor { + + public String getID(); + public List getStateParameters(); + public Object getState(Object stateParam); + +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/java/de/laures/cewolf/util/package.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/util/package.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,10 @@ + + + + + + + +Utility classes used by Cewolf. + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/resources/cewolf-1.1.tld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/resources/cewolf-1.1.tld Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,1234 @@ + + + + +0.9.3 +1.2 +Cewolf Tag Library +http://cewolf.sourceforge.net/taglib/cewolf.tld +Cewolf Tag Library +This tag library is designed to describe charts of all kinds. + + plot + de.laures.cewolf.taglib.tags.PlotTag + JSP + + The plot tag is nested inside a complex chart to define a nested or layerd plot instance. + @required-child data + + + type + true + true + + The type of the plot. One of xyarea, xyline, xyshapesandlines , + scatter, xyverticalbar, step, candlestick, highlow, signal, + verticlebar, area, line, shapesandlines + + + + xaxislabel + false + true + + Title of the plot's x-axis. This attributes is + only used for horizontally combined charts. + + + + yaxislabel + false + true + + Title of the plot's y-axis. This attributes is + only used for vertically combined charts. + + + + + img + de.laures.cewolf.taglib.tags.ChartImgTag + JSP + + This tag is a specialized HTML img tag. It renders the chart + which has been specified by a <chart> tag in the same page. + @optional-child map + + + renderer + true + true + + Path to rendering servlet. Any path that starts with a '/' is assumed to refer to a resource relative to web application root. Otherwise, the path is assumed to refer to resource relative to the current page directory. + + + + chartid + true + true + + The id of the chart to render. + + + + width + true + true + + Width of the rendered chart image in pixel. + + + + height + true + true + + Height of the rendered chart image in pixel. + + + + mime + false + true + + The MIME type of the image. Currently image/png (default) and image/svg are supported. + @default image/png + + + + alt + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + timeout + false + true + + Sets the timeout value used in the LongTermSessionStorage obj. Value is in seconds. + + + + hspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + vspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + align + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + border + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ismap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + longdesc + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + usemap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + class + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + dir + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + lang + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ondbclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeydown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeypress + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeyup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousedown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousemove + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseout + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseover + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + style + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + htmltitle + false + true + + Corresponds to appropriate HMTL <img> title attribute. + + + + forceSessionId + false + true + + Add JSession id. + + + + removeAfterRender + false + true + + Remove image after rendering (defaults to false). + + + + + imgurl + de.laures.cewolf.taglib.tags.ChartImgURLTag + de.laures.cewolf.taglib.tags.ChartImgURLTagEI + + This tag can be used as the src attribute of a HTML img tag. E.g.: + <img src='<imgurl chartid="foobar" renderer="cewolf" width="100" height="100"/>'> + If the var attribute is used the URL is exposed as a page attribute of type String. + @extends img + + + var + false + true + + Name of the page scope attribute to hold the URL. If not specified the URL is printed to the page outstream. + + + + renderer + true + true + + Path to rendering servlet. Any path that starts with a '/' is assumed to refer to a resource relative to web application root. Otherwise, the path is assumed to refer to resource relative to the current page directory. + + + + chartid + true + true + + The id of the chart to render. + + + + width + true + true + + Width of the rendered chart image in pixel. + + + + height + true + true + + Height of the rendered chart image in pixel. + + + + mime + false + true + + The MIME type of the image. Currently image/png (default) and image/svg are supported. + @default image/png + + + + + chart + de.laures.cewolf.taglib.tags.SimpleChartTag + + Root tag of a chart description. + @root + @required-child data + @optional-child chartpostprocessor + + + id + true + true + + ID under which the chart description bean will be stored in the + page to be found by the img tag. Beware of using an + ID which is not yet used for other beans in the page to avoid + compile errors. + + + + type + true + true + + Type of the chart. One of area, areaxy, horizontalbar, horizontalbar3d, + line, pie, scatter, stackedarea, stackedhorizontalbar, stackedverticalbar, + stackedverticalbar3d, timeseries, verticalbar, verticalbar3d, xy, + candlestick, highlow, gantt, wind, signal, verticalxybar, pie3d, meter + + + + title + false + true + + Title of the chart which is displayed on the chart panel + above the plot pane. + + + + xaxislabel + false + true + + Title of the chart's x-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + yaxislabel + false + true + + Title of the chart's y-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + background + false + true + + Background image of the chart panel. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + backgroundimagealpha + false + true + java.lang.Float + + Chart's backgound alpha blending value as a float. Value ranges + from 0.0 to 1.0. + @default 0.0 + @overrides /chart[backgroundimagealpha] + + + + antialias + false + true + + Antialiased rendering of the chart. + @default true + @overrides /chart[backgroundimagealpha] + + + + showlegend + false + true + + Boolean value to switch on or off the legend display inside of this panel. + @default true + + + + legendanchor + false + true + + Sets the anchor of the legend inside of the panel. Possible values + are 'north', 'south', 'west', 'east'. + Ignored if showlegned is 'false'. + @default 'south' + + + + + overlaidchart + de.laures.cewolf.taglib.tags.OverlaidChartTag + + Root tag of a overlaid-chart description. + @root + @required-child data + @optional-child chartpostprocessor + + + id + true + true + + ID under which the chart description bean will be stored in the + page to be found by the img tag. Beware of using an + ID which is not yet used for other beans in the page to avoid + compile errors. + + + + type + true + true + + Type of the chart. In this version only overlaidxy is supported. + + + + title + false + true + + Title of the chart which is displayed on the chart panel + above the plot pane. + + + + xaxistype + true + true + + Type of the domain axis. Possible values: date, number + + + + xaxislabel + false + true + + Title of the chart's x-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + yaxistype + false + true + + Type of the range axis. Possible values: date, number + + + + yaxislabel + false + true + + Title of the chart's y-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + background + false + true + + Background image of the chart panel. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + backgroundimagealpha + false + true + java.lang.Float + + Chart's backgound alpha blending value as a float. Value ranges + from 0.0 to 1.0. + @default 0.0 + @overrides /chart[backgroundimagealpha] + + + + antialias + false + true + + Antialiased rendering of the chart. + @default true + @overrides /chart[backgroundimagealpha] + + + + showlegend + false + true + + Boolean value to switch on or off the legend display inside of this panel. + @default true + + + + legendanchor + false + true + + Sets the anchor of the legend inside of the panel. Possible values + are 'north', 'south', 'west', 'east'. + Ignored if showlegned is 'false'. + @default 'south' + + + + + combinedchart + de.laures.cewolf.taglib.tags.CombinedChartTag + + Root tag of a combined-chart description. + @root + @required-child plot + @optional-child chartpostprocessor + + + id + true + true + + ID under which the chart description bean will be stored in the + page to be found by the img tag. Beware of using an + ID which is not yet used for other beans in the page to avoid + compile errors. + + + + type + true + true + + Type of the chart. One of combinedxy + + + + layout + true + true + + Layout of the chart. Either vertical or horizontal + + + + title + false + true + + Title of the chart which is displayed on the chart panel + above the plot pane. + + + + xaxislabel + false + true + + Title of the chart's x-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + yaxislabel + false + true + + Title of the chart's y-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + background + false + true + + Background image of the chart panel. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + backgroundimagealpha + false + true + java.lang.Float + + Chart's backgound alpha blending value as a float. Value ranges + from 0.0 to 1.0. + @default 0.0 + @overrides /chart[backgroundimagealpha] + + + + antialias + false + true + + Antialiased rendering of the chart. + @default true + @overrides /chart[backgroundimagealpha] + + + + showlegend + false + true + + Boolean value to switch on or off the legend display inside of this panel. + @default true + + + + legendanchor + false + true + + Sets the anchor of the legend inside of the panel. Possible values + are 'north', 'south', 'west', 'east'. + Ignored if showlegned is 'false'. + @default 'south' + + + + + legend + de.laures.cewolf.taglib.tags.LegendTag + + This tag is used to render the legend of a chart in a separate image. + It assumes that somewhere else in the JSP a chart tag defines a chart + with the same ID as this legend tag. + + + renderer + true + true + + Path to rendering servlet relative to web apps root URL + (e.g. servlet/cewolf). + + + + id + true + true + + ID under which the chart description bean will be stored in the + session to be found by the rendering servlet. Beware of using an + ID which is not yet used for other beans in the session to avoid + overriding. + + + + timeout + false + true + + Sets the timeout value used in the LongTermSessionStorage obj. Value is in seconds. + + + + width + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + height + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + mime + false + true + + The MIME type of the image. Currently image/png (default) and image/svg are supported. + @default image/png + + + + alt + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + hspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + vspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + align + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + border + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ismap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + longdesc + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + usemap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + class + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + dir + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + lang + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ondbclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeydown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeypress + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeyup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousedown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousemove + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseout + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseover + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + style + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + htmltitle + false + true + + Corresponds to appropriate HMTL <img> title attribute. + + + + forceSessionId + false + true + + Add JSession id. + + + + removeAfterRender + false + true + + Remove image after rendering (defaults to false). + + + + + data + de.laures.cewolf.taglib.tags.DataTag + + A data tag provides all information needed to retrieve the data which are + needed by the chart. Current version only supports data provided by a + DatasetProducer. In future versions there will be tags to provide data + from a datasource (e.g. via SQL). + @optional-child producer + + + + producer + de.laures.cewolf.taglib.tags.ProducerTag + + A data tag provides all information needed to retrieve the data which are + needed by the chart. Current version only supports data provided by a + DatasetProducer. In future versions there will be tags to provide data + from a datasource (e.g. via SQL). + @optional-child param + + + id + true + true + + ID under which an object of type DatasetProducer can be found in + pageContext. This object is used to retrieve the dataset of the chart. + + + + usecache + false + true + + Determines if formally produced data should be reused if possible. + @default true + + + + + chartpostprocessor + de.laures.cewolf.taglib.tags.ChartPostProcessorTag + + A chart postprocessor tag references an object of type ChartProstProcessor + which must be defined in pageContext under the provided ID. This object + is called back after chart generation to post process the chart in any + manner. + @optional-child param + + + id + true + true + + ID under which an object of type ChartPostProcessor can be found in + pageContext. This object is used to postprocess the rendered chart. + + + + + param + de.laures.cewolf.taglib.tags.ParamTag + + Name/value-pair to paramterize a surrounding tag whose handler must + implement the Parameterized interface. + + + name + true + true + + Name of the param + + + + value + true + true + java.io.Serializable + + Value of the param. Must be serializable. + + + + + gradientpaint + de.laures.cewolf.taglib.tags.GradientTag + + The gradientpaint tag provides a way to fill a shape with a linear + color gradient pattern. If Point P1 with Color C1 and Point P2 with + Color C2 are specified in user space, the Color on the P1, P2 + connecting line is proportionally changed from C1 to C2. Any point + P not on the extended P1, P2 connecting line has the color of the + point P' that is the perpendicular projection of P on the extended P1, + P2 connecting line. Points on the extended line outside of the P1, + P2 segment can be colored in one of two ways. + <ul> + <li>If the gradient is cyclic then the points on the extended + P1, P2 connecting line cycle back and forth between the colors C1 + and C2. + <li>If the gradient is acyclic then points on the P1 side of + the segment have the constant Color C1 while points on the P2 side + have the constant Color C2. + The two colors are defined in a nested point tag of this tag. + @required-child point + + + cyclic + false + true + + Does the gradient cycle repeatedly between the two colors C1 and C2. + @default false + + + + + point + de.laures.cewolf.taglib.tags.PointTag + + Defines a point with x and y coordinates and a color. + @extends colorpaint + + + x + true + true + + The x coordinate of the point. + + + + y + true + true + + The y coordinate of the point. + + + + color + false + true + + @copy + + + + + colorpaint + de.laures.cewolf.taglib.tags.ColorTag + + Fills the area defined by the parent tag with a color. + + + color + true + true + + The color to be used to fill the parent tag's area. + The color definition is compatible with the + HTML one. E.g. black is '#000000' and red is '#FF0000'. However it + is possible to append two hex numbers for the alpha channel. Thus + '#FF000080' is red with alpha blending of 50%. + + + + + texturepaint + de.laures.cewolf.taglib.tags.TextureTag + + The texturepaint tag provides a way to fill the area of the parent tag + with a texture that is specified as an image. The texture is anchored to + the upper left corner of the parent tags area. + + + image + true + true + + Image fo the texture. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + width + true + true + + The width of the texture. + + + + height + true + true + + The height of the texture. + + + + + map + de.laures.cewolf.taglib.tags.ChartMapTag + + This tag defines an image and tooltip map for the parent img tag. + @parent img + + + linkgeneratorid + false + true + + The ID of the class which implements the appropriate de.laures.cewolf.LinkGenerator. + + + + tooltipgeneratorid + false + true + + The ID of the class which implements the appropriate com.jrefinery.chart.tooltips.ToolTipGenerator. + + + + useJFreeChartLinkGenerator + false + true + If the links provided by the JFreeChart renderer should be used. + + + useJFreeChartTooltipGenerator + false + true + If the tooltips provided by the JFreeChart renderer should be used. + + + + \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/resources/cewolf.tld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/resources/cewolf.tld Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,1234 @@ + + + + +0.9.3 +1.2 +Cewolf Tag Library +http://cewolf.sourceforge.net/taglib/cewolf.tld +Cewolf Tag Library +This tag library is designed to describe charts of all kinds. + + plot + de.laures.cewolf.taglib.tags.PlotTag + JSP + + The plot tag is nested inside a complex chart to define a nested or layerd plot instance. + @required-child data + + + type + true + true + + The type of the plot. One of xyarea, xyline, xyshapesandlines , + scatter, xyverticalbar, step, candlestick, highlow, signal, + verticlebar, area, line, shapesandlines + + + + xaxislabel + false + true + + Title of the plot's x-axis. This attributes is + only used for horizontally combined charts. + + + + yaxislabel + false + true + + Title of the plot's y-axis. This attributes is + only used for vertically combined charts. + + + + + img + de.laures.cewolf.taglib.tags.ChartImgTag + JSP + + This tag is a specialized HTML img tag. It renders the chart + which has been specified by a <chart> tag in the same page. + @optional-child map + + + renderer + true + true + + Path to rendering servlet. Any path that starts with a '/' is assumed to refer to a resource relative to web application root. Otherwise, the path is assumed to refer to resource relative to the current page directory. + + + + chartid + true + true + + The id of the chart to render. + + + + width + true + true + + Width of the rendered chart image in pixel. + + + + height + true + true + + Height of the rendered chart image in pixel. + + + + mime + false + true + + The MIME type of the image. Currently image/png (default) and image/svg are supported. + @default image/png + + + + alt + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + timeout + false + true + + Sets the timeout value used in the LongTermSessionStorage obj. Value is in seconds. + + + + hspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + vspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + align + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + border + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ismap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + longdesc + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + usemap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + class + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + dir + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + lang + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ondbclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeydown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeypress + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeyup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousedown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousemove + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseout + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseover + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + style + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + htmltitle + false + true + + Corresponds to appropriate HMTL <img> title attribute. + + + + forceSessionId + false + true + + Add JSession id. + + + + removeAfterRender + false + true + + Remove image after rendering (defaults to false). + + + + + imgurl + de.laures.cewolf.taglib.tags.ChartImgURLTag + de.laures.cewolf.taglib.tags.ChartImgURLTagEI + + This tag can be used as the src attribute of a HTML img tag. E.g.: + <img src='<imgurl chartid="foobar" renderer="cewolf" width="100" height="100"/>'> + If the var attribute is used the URL is exposed as a page attribute of type String. + @extends img + + + var + false + true + + Name of the page scope attribute to hold the URL. If not specified the URL is printed to the page outstream. + + + + renderer + true + true + + Path to rendering servlet. Any path that starts with a '/' is assumed to refer to a resource relative to web application root. Otherwise, the path is assumed to refer to resource relative to the current page directory. + + + + chartid + true + true + + The id of the chart to render. + + + + width + true + true + + Width of the rendered chart image in pixel. + + + + height + true + true + + Height of the rendered chart image in pixel. + + + + mime + false + true + + The MIME type of the image. Currently image/png (default) and image/svg are supported. + @default image/png + + + + + chart + de.laures.cewolf.taglib.tags.SimpleChartTag + + Root tag of a chart description. + @root + @required-child data + @optional-child chartpostprocessor + + + id + true + true + + ID under which the chart description bean will be stored in the + page to be found by the img tag. Beware of using an + ID which is not yet used for other beans in the page to avoid + compile errors. + + + + type + true + true + + Type of the chart. One of area, areaxy, horizontalbar, horizontalbar3d, + line, pie, scatter, stackedarea, stackedhorizontalbar, stackedverticalbar, + stackedverticalbar3d, timeseries, verticalbar, verticalbar3d, xy, + candlestick, highlow, gantt, wind, signal, verticalxybar, pie3d, meter + + + + title + false + true + + Title of the chart which is displayed on the chart panel + above the plot pane. + + + + xaxislabel + false + true + + Title of the chart's x-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + yaxislabel + false + true + + Title of the chart's y-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + background + false + true + + Background image of the chart panel. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + backgroundimagealpha + false + true + java.lang.Float + + Chart's backgound alpha blending value as a float. Value ranges + from 0.0 to 1.0. + @default 0.0 + @overrides /chart[backgroundimagealpha] + + + + antialias + false + true + + Antialiased rendering of the chart. + @default true + @overrides /chart[backgroundimagealpha] + + + + showlegend + false + true + + Boolean value to switch on or off the legend display inside of this panel. + @default true + + + + legendanchor + false + true + + Sets the anchor of the legend inside of the panel. Possible values + are 'north', 'south', 'west', 'east'. + Ignored if showlegned is 'false'. + @default 'south' + + + + + overlaidchart + de.laures.cewolf.taglib.tags.OverlaidChartTag + + Root tag of a overlaid-chart description. + @root + @required-child data + @optional-child chartpostprocessor + + + id + true + true + + ID under which the chart description bean will be stored in the + page to be found by the img tag. Beware of using an + ID which is not yet used for other beans in the page to avoid + compile errors. + + + + type + true + true + + Type of the chart. In this version only overlaidxy is supported. + + + + title + false + true + + Title of the chart which is displayed on the chart panel + above the plot pane. + + + + xaxistype + true + true + + Type of the domain axis. Possible values: date, number + + + + xaxislabel + false + true + + Title of the chart's x-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + yaxistype + false + true + + Type of the range axis. Possible values: date, number + + + + yaxislabel + false + true + + Title of the chart's y-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + background + false + true + + Background image of the chart panel. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + backgroundimagealpha + false + true + java.lang.Float + + Chart's backgound alpha blending value as a float. Value ranges + from 0.0 to 1.0. + @default 0.0 + @overrides /chart[backgroundimagealpha] + + + + antialias + false + true + + Antialiased rendering of the chart. + @default true + @overrides /chart[backgroundimagealpha] + + + + showlegend + false + true + + Boolean value to switch on or off the legend display inside of this panel. + @default true + + + + legendanchor + false + true + + Sets the anchor of the legend inside of the panel. Possible values + are 'north', 'south', 'west', 'east'. + Ignored if showlegned is 'false'. + @default 'south' + + + + + combinedchart + de.laures.cewolf.taglib.tags.CombinedChartTag + + Root tag of a combined-chart description. + @root + @required-child plot + @optional-child chartpostprocessor + + + id + true + true + + ID under which the chart description bean will be stored in the + page to be found by the img tag. Beware of using an + ID which is not yet used for other beans in the page to avoid + compile errors. + + + + type + true + true + + Type of the chart. One of combinedxy + + + + layout + true + true + + Layout of the chart. Either vertical or horizontal + + + + title + false + true + + Title of the chart which is displayed on the chart panel + above the plot pane. + + + + xaxislabel + false + true + + Title of the chart's x-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + yaxislabel + false + true + + Title of the chart's y-axis. This attributes is + ignored if the type attribute of the parent chart tag is one + of pie3d or pie. + + + + background + false + true + + Background image of the chart panel. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + backgroundimagealpha + false + true + java.lang.Float + + Chart's backgound alpha blending value as a float. Value ranges + from 0.0 to 1.0. + @default 0.0 + @overrides /chart[backgroundimagealpha] + + + + antialias + false + true + + Antialiased rendering of the chart. + @default true + @overrides /chart[backgroundimagealpha] + + + + showlegend + false + true + + Boolean value to switch on or off the legend display inside of this panel. + @default true + + + + legendanchor + false + true + + Sets the anchor of the legend inside of the panel. Possible values + are 'north', 'south', 'west', 'east'. + Ignored if showlegned is 'false'. + @default 'south' + + + + + legend + de.laures.cewolf.taglib.tags.LegendTag + + This tag is used to render the legend of a chart in a separate image. + It assumes that somewhere else in the JSP a chart tag defines a chart + with the same ID as this legend tag. + + + forceSessionId + false + true + + Add JSession id. + + + + removeAfterRender + false + true + + Remove image after rendering (defaults to false). + + + + renderer + true + true + + Path to rendering servlet relative to web apps root URL + (e.g. servlet/cewolf). + + + + id + true + true + + ID under which the chart description bean will be stored in the + session to be found by the rendering servlet. Beware of using an + ID which is not yet used for other beans in the session to avoid + overriding. + + + + timeout + false + true + + Sets the timeout value used in the LongTermSessionStorage obj. Value is in seconds. + + + + width + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + height + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + mime + false + true + + The MIME type of the image. Currently image/png (default) and image/svg are supported. + @default image/png + + + + alt + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + hspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + vspace + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + align + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + border + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ismap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + longdesc + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + usemap + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + class + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + dir + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + lang + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + ondbclick + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeydown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeypress + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onkeyup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousedown + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmousemove + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseout + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseover + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + onmouseup + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + style + false + true + + Corresponds to appropriate HMTL <img> attribute. + + + + htmltitle + false + true + + Corresponds to appropriate HMTL <img> title attribute. + + + + + data + de.laures.cewolf.taglib.tags.DataTag + + A data tag provides all information needed to retrieve the data which are + needed by the chart. Current version only supports data provided by a + DatasetProducer. In future versions there will be tags to provide data + from a datasource (e.g. via SQL). + @optional-child producer + + + + producer + de.laures.cewolf.taglib.tags.ProducerTag + + A data tag provides all information needed to retrieve the data which are + needed by the chart. Current version only supports data provided by a + DatasetProducer. In future versions there will be tags to provide data + from a datasource (e.g. via SQL). + @optional-child param + + + id + true + true + + ID under which an object of type DatasetProducer can be found in + pageContext. This object is used to retrieve the dataset of the chart. + + + + usecache + false + true + + Determines if formally produced data should be reused if possible. + @default true + + + + + chartpostprocessor + de.laures.cewolf.taglib.tags.ChartPostProcessorTag + + A chart postprocessor tag references an object of type ChartProstProcessor + which must be defined in pageContext under the provided ID. This object + is called back after chart generation to post process the chart in any + manner. + @optional-child param + + + id + true + true + + ID under which an object of type ChartPostProcessor can be found in + pageContext. This object is used to postprocess the rendered chart. + + + + + param + de.laures.cewolf.taglib.tags.ParamTag + + Name/value-pair to paramterize a surrounding tag whose handler must + implement the Parameterized interface. + + + name + true + true + + Name of the param + + + + value + true + true + java.io.Serializable + + Value of the param. Must be serializable. + + + + + gradientpaint + de.laures.cewolf.taglib.tags.GradientTag + + The gradientpaint tag provides a way to fill a shape with a linear + color gradient pattern. If Point P1 with Color C1 and Point P2 with + Color C2 are specified in user space, the Color on the P1, P2 + connecting line is proportionally changed from C1 to C2. Any point + P not on the extended P1, P2 connecting line has the color of the + point P' that is the perpendicular projection of P on the extended P1, + P2 connecting line. Points on the extended line outside of the P1, + P2 segment can be colored in one of two ways. + <ul> + <li>If the gradient is cyclic then the points on the extended + P1, P2 connecting line cycle back and forth between the colors C1 + and C2. + <li>If the gradient is acyclic then points on the P1 side of + the segment have the constant Color C1 while points on the P2 side + have the constant Color C2. + The two colors are defined in a nested point tag of this tag. + @required-child point + + + cyclic + false + true + + Does the gradient cycle repeatedly between the two colors C1 and C2. + @default false + + + + + point + de.laures.cewolf.taglib.tags.PointTag + + Defines a point with x and y coordinates and a color. + @extends colorpaint + + + x + true + true + + The x coordinate of the point. + + + + y + true + true + + The y coordinate of the point. + + + + color + false + true + + @copy + + + + + colorpaint + de.laures.cewolf.taglib.tags.ColorTag + + Fills the area defined by the parent tag with a color. + + + color + true + true + + The color to be used to fill the parent tag's area. + The color definition is compatible with the + HTML one. E.g. black is '#000000' and red is '#FF0000'. However it + is possible to append two hex numbers for the alpha channel. Thus + '#FF000080' is red with alpha blending of 50%. + + + + + texturepaint + de.laures.cewolf.taglib.tags.TextureTag + + The texturepaint tag provides a way to fill the area of the parent tag + with a texture that is specified as an image. The texture is anchored to + the upper left corner of the parent tags area. + + + image + true + true + + Image fo the texture. The value of this + attribute is the filename of a graphics file relative to the web + application's root directory (e.g. /WEB-INF/img/bg.jpg). + The image must be loadable by the default java.awt.Toolkit of the + servlet container's JVM. + + + + width + true + true + + The width of the texture. + + + + height + true + true + + The height of the texture. + + + + + map + de.laures.cewolf.taglib.tags.ChartMapTag + + This tag defines an image and tooltip map for the parent img tag. + @parent img + + + linkgeneratorid + false + true + + The ID of the class which implements the appropriate de.laures.cewolf.LinkGenerator. + + + + tooltipgeneratorid + false + true + + The ID of the class which implements the appropriate com.jrefinery.chart.tooltips.ToolTipGenerator. + + + + useJFreeChartLinkGenerator + false + true + If the links provided by the JFreeChart renderer should be used. + + + useJFreeChartTooltipGenerator + false + true + If the tooltips provided by the JFreeChart renderer should be used. + + + + \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/main/resources/overlib.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/main/resources/overlib.js Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,1222 @@ +//\////////////////////////////////////////////////////////////////////////////////// +//\ overLIB 3.50 -- This notice must remain untouched at all times. +//\ Copyright Erik Bosrup 1998-2001. All rights reserved. +//\ +//\ By Erik Bosrup (erik@bosrup.com). Last modified 2001-08-28. +//\ Portions by Dan Steinman (dansteinman.com). Additions by other people are +//\ listed on the overLIB homepage. +//\ +//\ Get the latest version at http://www.bosrup.com/web/overlib/ +//\ +//\ This script is published under an open source license. Please read the license +//\ agreement online at: http://www.bosrup.com/web/overlib/license.html +//\ If you have questions regarding the license please contact erik@bosrup.com. +//\ +//\ This script library was originally created for personal use. By request it has +//\ later been made public. This is free software. Do not sell this as your own +//\ work, or remove this copyright notice. For full details on copying or changing +//\ this script please read the license agreement at the link above. +//\ +//\ Please give credit on sites that use overLIB and submit changes of the script +//\ so other people can use them as well. This script is free to use, don't abuse. +//\////////////////////////////////////////////////////////////////////////////////// +//\mini + + +//////////////////////////////////////////////////////////////////////////////////// +// CONSTANTS +// Don't touch these. :) +//////////////////////////////////////////////////////////////////////////////////// +var INARRAY = 1; +var CAPARRAY = 2; +var STICKY = 3; +var BACKGROUND = 4; +var NOCLOSE = 5; +var CAPTION = 6; +var LEFT = 7; +var RIGHT = 8; +var CENTER = 9; +var OFFSETX = 10; +var OFFSETY = 11; +var FGCOLOR = 12; +var BGCOLOR = 13; +var TEXTCOLOR = 14; +var CAPCOLOR = 15; +var CLOSECOLOR = 16; +var WIDTH = 17; +var BORDER = 18; +var STATUS = 19; +var AUTOSTATUS = 20; +var AUTOSTATUSCAP = 21; +var HEIGHT = 22; +var CLOSETEXT = 23; +var SNAPX = 24; +var SNAPY = 25; +var FIXX = 26; +var FIXY = 27; +var FGBACKGROUND = 28; +var BGBACKGROUND = 29; +var PADX = 30; // PADX2 out +var PADY = 31; // PADY2 out +var FULLHTML = 34; +var ABOVE = 35; +var BELOW = 36; +var CAPICON = 37; +var TEXTFONT = 38; +var CAPTIONFONT = 39; +var CLOSEFONT = 40; +var TEXTSIZE = 41; +var CAPTIONSIZE = 42; +var CLOSESIZE = 43; +var FRAME = 44; +var TIMEOUT = 45; +var FUNCTION = 46; +var DELAY = 47; +var HAUTO = 48; +var VAUTO = 49; +var CLOSECLICK = 50; +var CSSOFF = 51; +var CSSSTYLE = 52; +var CSSCLASS = 53; +var FGCLASS = 54; +var BGCLASS = 55; +var TEXTFONTCLASS = 56; +var CAPTIONFONTCLASS = 57; +var CLOSEFONTCLASS = 58; +var PADUNIT = 59; +var HEIGHTUNIT = 60; +var WIDTHUNIT = 61; +var TEXTSIZEUNIT = 62; +var TEXTDECORATION = 63; +var TEXTSTYLE = 64; +var TEXTWEIGHT = 65; +var CAPTIONSIZEUNIT = 66; +var CAPTIONDECORATION = 67; +var CAPTIONSTYLE = 68; +var CAPTIONWEIGHT = 69; +var CLOSESIZEUNIT = 70; +var CLOSEDECORATION = 71; +var CLOSESTYLE = 72; +var CLOSEWEIGHT = 73; + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION +// You don't have to change anything here if you don't want to. All of this can be +// changed on your html page or through an overLIB call. +//////////////////////////////////////////////////////////////////////////////////// + +// Main background color (the large area) +// Usually a bright color (white, yellow etc) +if (typeof ol_fgcolor == 'undefined') { var ol_fgcolor = "#CCCCFF";} + +// Border color and color of caption +// Usually a dark color (black, brown etc) +if (typeof ol_bgcolor == 'undefined') { var ol_bgcolor = "#333399";} + +// Text color +// Usually a dark color +if (typeof ol_textcolor == 'undefined') { var ol_textcolor = "#000000";} + +// Color of the caption text +// Usually a bright color +if (typeof ol_capcolor == 'undefined') { var ol_capcolor = "#FFFFFF";} + +// Color of "Close" when using Sticky +// Usually a semi-bright color +if (typeof ol_closecolor == 'undefined') { var ol_closecolor = "#9999FF";} + +// Font face for the main text +if (typeof ol_textfont == 'undefined') { var ol_textfont = "Verdana,Arial,Helvetica";} + +// Font face for the caption +if (typeof ol_captionfont == 'undefined') { var ol_captionfont = "Verdana,Arial,Helvetica";} + +// Font face for the close text +if (typeof ol_closefont == 'undefined') { var ol_closefont = "Verdana,Arial,Helvetica";} + +// Font size for the main text +// When using CSS this will be very small. +if (typeof ol_textsize == 'undefined') { var ol_textsize = "1";} + +// Font size for the caption +// When using CSS this will be very small. +if (typeof ol_captionsize == 'undefined') { var ol_captionsize = "1";} + +// Font size for the close text +// When using CSS this will be very small. +if (typeof ol_closesize == 'undefined') { var ol_closesize = "1";} + +// Width of the popups in pixels +// 100-300 pixels is typical +if (typeof ol_width == 'undefined') { var ol_width = "200";} + +// How thick the ol_border should be in pixels +// 1-3 pixels is typical +if (typeof ol_border == 'undefined') { var ol_border = "1";} + +// How many pixels to the right/left of the cursor to show the popup +// Values between 3 and 12 are best +if (typeof ol_offsetx == 'undefined') { var ol_offsetx = 10;} + +// How many pixels to the below the cursor to show the popup +// Values between 3 and 12 are best +if (typeof ol_offsety == 'undefined') { var ol_offsety = 10;} + +// Default text for popups +// Should you forget to pass something to overLIB this will be displayed. +if (typeof ol_text == 'undefined') { var ol_text = "Default Text"; } + +// Default caption +// You should leave this blank or you will have problems making non caps popups. +if (typeof ol_cap == 'undefined') { var ol_cap = ""; } + +// Decides if sticky popups are default. +// 0 for non, 1 for stickies. +if (typeof ol_sticky == 'undefined') { var ol_sticky = 0; } + +// Default background image. Better left empty unless you always want one. +if (typeof ol_background == 'undefined') { var ol_background = ""; } + +// Text for the closing sticky popups. +// Normal is "Close". +if (typeof ol_close == 'undefined') { var ol_close = "Close"; } + +// Default vertical alignment for popups. +// It's best to leave RIGHT here. Other options are LEFT and CENTER. +if (typeof ol_hpos == 'undefined') { var ol_hpos = RIGHT; } + +// Default status bar text when a popup is invoked. +if (typeof ol_status == 'undefined') { var ol_status = ""; } + +// If the status bar automatically should load either text or caption. +// 0=nothing, 1=text, 2=caption +if (typeof ol_autostatus == 'undefined') { var ol_autostatus = 0; } + +// Default height for popup. Often best left alone. +if (typeof ol_height == 'undefined') { var ol_height = -1; } + +// Horizontal grid spacing that popups will snap to. +// 0 makes no grid, anything else will cause a snap to that grid spacing. +if (typeof ol_snapx == 'undefined') { var ol_snapx = 0; } + +// Vertical grid spacing that popups will snap to. +// 0 makes no grid, andthing else will cause a snap to that grid spacing. +if (typeof ol_snapy == 'undefined') { var ol_snapy = 0; } + +// Sets the popups horizontal position to a fixed column. +// Anything above -1 will cause fixed position. +if (typeof ol_fixx == 'undefined') { var ol_fixx = -1; } + +// Sets the popups vertical position to a fixed row. +// Anything above -1 will cause fixed position. +if (typeof ol_fixy == 'undefined') { var ol_fixy = -1; } + +// Background image for the popups inside. +if (typeof ol_fgbackground == 'undefined') { var ol_fgbackground = ""; } + +// Background image for the popups frame. +if (typeof ol_bgbackground == 'undefined') { var ol_bgbackground = ""; } + +// How much horizontal left padding text should get by default when BACKGROUND is used. +if (typeof ol_padxl == 'undefined') { var ol_padxl = 1; } + +// How much horizontal right padding text should get by default when BACKGROUND is used. +if (typeof ol_padxr == 'undefined') { var ol_padxr = 1; } + +// How much vertical top padding text should get by default when BACKGROUND is used. +if (typeof ol_padyt == 'undefined') { var ol_padyt = 1; } + +// How much vertical bottom padding text should get by default when BACKGROUND is used. +if (typeof ol_padyb == 'undefined') { var ol_padyb = 1; } + +// If the user by default must supply all html for complete popup control. +// Set to 1 to activate, 0 otherwise. +if (typeof ol_fullhtml == 'undefined') { var ol_fullhtml = 0; } + +// Default vertical position of the popup. Default should normally be BELOW. +// ABOVE only works when HEIGHT is defined. +if (typeof ol_vpos == 'undefined') { var ol_vpos = BELOW; } + +// Default height of popup to use when placing the popup above the cursor. +if (typeof ol_aboveheight == 'undefined') { var ol_aboveheight = 0; } + +// Default icon to place next to the popups caption. +if (typeof ol_caption == 'undefined') { var ol_capicon = ""; } + +// Default frame. We default to current frame if there is no frame defined. +if (typeof ol_frame == 'undefined') { var ol_frame = self; } + +// Default timeout. By default there is no timeout. +if (typeof ol_timeout == 'undefined') { var ol_timeout = 0; } + +// Default javascript funktion. By default there is none. +if (typeof ol_function == 'undefined') { var ol_function = Function(); } + +// Default timeout. By default there is no timeout. +if (typeof ol_delay == 'undefined') { var ol_delay = 0; } + +// If overLIB should decide the horizontal placement. +if (typeof ol_hauto == 'undefined') { var ol_hauto = 0; } + +// If overLIB should decide the vertical placement. +if (typeof ol_vauto == 'undefined') { var ol_vauto = 0; } + + + +// If the user has to click to close stickies. +if (typeof ol_closeclick == 'undefined') { var ol_closeclick = 0; } + +// This variable determines if you want to use CSS or inline definitions. +// CSSOFF=no CSS CSSSTYLE=use CSS inline styles CSSCLASS=use classes +if (typeof ol_css == 'undefined') { var ol_css = CSSOFF; } + +// Main background class (eqv of fgcolor) +// This is only used if CSS is set to use classes (ol_css = CSSCLASS) +if (typeof ol_fgclass == 'undefined') { var ol_fgclass = ""; } + +// Frame background class (eqv of bgcolor) +// This is only used if CSS is set to use classes (ol_css = CSSCLASS) +if (typeof ol_bgclass == 'undefined') { var ol_bgclass = ""; } + +// Main font class +// This is only used if CSS is set to use classes (ol_css = CSSCLASS) +if (typeof ol_textfontclass == 'undefined') { var ol_textfontclass = ""; } + +// Caption font class +// This is only used if CSS is set to use classes (ol_css = CSSCLASS) +if (typeof ol_captionfontclass == 'undefined') { var ol_captionfontclass = ""; } + +// Close font class +// This is only used if CSS is set to use classes (ol_css = CSSCLASS) +if (typeof ol_closefontclass == 'undefined') { var ol_closefontclass = ""; } + +// Unit to be used for the text padding above +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +// Options include "px", "%", "in", "cm" and more +if (typeof ol_padunit == 'undefined') { var ol_padunit = "px";} + +// Unit to be used for height of popup +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +// Options include "px", "%", "in", "cm" and more +if (typeof ol_heightunit == 'undefined') { var ol_heightunit = "px";} + +// Unit to be used for width of popup +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +// Options include "px", "%", "in", "cm" and more +if (typeof ol_widthunit == 'undefined') { var ol_widthunit = "px";} + +// Font size unit for the main text +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_textsizeunit == 'undefined') { var ol_textsizeunit = "px";} + +// Decoration of the main text ("none", "underline", "line-through" or "blink") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_textdecoration == 'undefined') { var ol_textdecoration = "none";} + +// Font style of the main text ("normal" or "italic") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_textstyle == 'undefined') { var ol_textstyle = "normal";} + +// Font weight of the main text ("normal", "bold", "bolder", "lighter", ect.) +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_textweight == 'undefined') { var ol_textweight = "normal";} + +// Font size unit for the caption +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_captionsizeunit == 'undefined') { var ol_captionsizeunit = "px";} + +// Decoration of the caption ("none", "underline", "line-through" or "blink") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_captiondecoration == 'undefined') { var ol_captiondecoration = "none";} + +// Font style of the caption ("normal" or "italic") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_captionstyle == 'undefined') { var ol_captionstyle = "normal";} + +// Font weight of the caption ("normal", "bold", "bolder", "lighter", ect.) +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_captionweight == 'undefined') { var ol_captionweight = "bold";} + +// Font size unit for the close text +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_closesizeunit == 'undefined') { var ol_closesizeunit = "px";} + +// Decoration of the close text ("none", "underline", "line-through" or "blink") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_closedecoration == 'undefined') { var ol_closedecoration = "none";} + +// Font style of the close text ("normal" or "italic") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_closestyle == 'undefined') { var ol_closestyle = "normal";} + +// Font weight of the close text ("normal", "bold", "bolder", "lighter", ect.) +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_closeweight == 'undefined') { var ol_closeweight = "normal";} + + + +//////////////////////////////////////////////////////////////////////////////////// +// ARRAY CONFIGURATION +// You don't have to change anything here if you don't want to. The following +// arrays can be filled with text and html if you don't wish to pass it from +// your html page. +//////////////////////////////////////////////////////////////////////////////////// + +// Array with texts. +if (typeof ol_texts == 'undefined') { var ol_texts = new Array("Text 0", "Text 1"); } + +// Array with captions. +if (typeof ol_caps == 'undefined') { var ol_caps = new Array("Caption 0", "Caption 1"); } + + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION +// Don't change anything below this line, all configuration is above. +//////////////////////////////////////////////////////////////////////////////////// + + + + + + + +//////////////////////////////////////////////////////////////////////////////////// +// INIT +//////////////////////////////////////////////////////////////////////////////////// + +// Runtime variables init. Used for runtime only, don't change, not for config! +var o3_text = ""; +var o3_cap = ""; +var o3_sticky = 0; +var o3_background = ""; +var o3_close = "Close"; +var o3_hpos = RIGHT; +var o3_offsetx = 2; +var o3_offsety = 2; +var o3_fgcolor = ""; +var o3_bgcolor = ""; +var o3_textcolor = ""; +var o3_capcolor = ""; +var o3_closecolor = ""; +var o3_width = 100; +var o3_border = 1; +var o3_status = ""; +var o3_autostatus = 0; +var o3_height = -1; +var o3_snapx = 0; +var o3_snapy = 0; +var o3_fixx = -1; +var o3_fixy = -1; +var o3_fgbackground = ""; +var o3_bgbackground = ""; +var o3_padxl = 0; +var o3_padxr = 0; +var o3_padyt = 0; +var o3_padyb = 0; +var o3_fullhtml = 0; +var o3_vpos = BELOW; +var o3_aboveheight = 0; +var o3_capicon = ""; +var o3_textfont = "Verdana,Arial,Helvetica"; +var o3_captionfont = "Verdana,Arial,Helvetica"; +var o3_closefont = "Verdana,Arial,Helvetica"; +var o3_textsize = "1"; +var o3_captionsize = "1"; +var o3_closesize = "1"; +var o3_frame = self; +var o3_timeout = 0; +var o3_timerid = 0; +var o3_allowmove = 0; +var o3_function = Function(); +var o3_delay = 0; +var o3_delayid = 0; +var o3_hauto = 0; +var o3_vauto = 0; +var o3_closeclick = 0; + +var o3_css = CSSOFF; +var o3_fgclass = ""; +var o3_bgclass = ""; +var o3_textfontclass = ""; +var o3_captionfontclass = ""; +var o3_closefontclass = ""; +var o3_padunit = "px"; +var o3_heightunit = "px"; +var o3_widthunit = "px"; +var o3_textsizeunit = "px"; +var o3_textdecoration = ""; +var o3_textstyle = ""; +var o3_textweight = ""; +var o3_captionsizeunit = "px"; +var o3_captiondecoration = ""; +var o3_captionstyle = ""; +var o3_captionweight = ""; +var o3_closesizeunit = "px"; +var o3_closedecoration = ""; +var o3_closestyle = ""; +var o3_closeweight = ""; + + + +// Display state variables +var o3_x = 0; +var o3_y = 0; +var o3_allow = 0; +var o3_showingsticky = 0; +var o3_removecounter = 0; + +// Our layer +var over = null; + + +// Decide browser version +var ns4 = (document.layers)? true:false; +var ns6 = (document.getElementById)? true:false; +var ie4 = (document.all)? true:false; +var ie5 = false; + +// Microsoft Stupidity Check(tm). +if (ie4) { + if ((navigator.userAgent.indexOf('MSIE 5') > 0) || (navigator.userAgent.indexOf('MSIE 6') > 0)) { + ie5 = true; + } + if (ns6) { + ns6 = false; + } +} + + +// Capture events, alt. diffuses the overlib function. +if ( (ns4) || (ie4) || (ns6)) { + document.onmousemove = mouseMove + if (ns4) document.captureEvents(Event.MOUSEMOVE) +} else { + overlib = no_overlib; + nd = no_overlib; + ver3fix = true; +} + + +// Fake function for 3.0 users. +function no_overlib() { + return ver3fix; +} + + + +//////////////////////////////////////////////////////////////////////////////////// +// PUBLIC FUNCTIONS +//////////////////////////////////////////////////////////////////////////////////// + + +// overlib(arg0, ..., argN) +// Loads parameters into global runtime variables. +function overlib() { + + // Load defaults to runtime. + o3_text = ol_text; + o3_cap = ol_cap; + o3_sticky = ol_sticky; + o3_background = ol_background; + o3_close = ol_close; + o3_hpos = ol_hpos; + o3_offsetx = ol_offsetx; + o3_offsety = ol_offsety; + o3_fgcolor = ol_fgcolor; + o3_bgcolor = ol_bgcolor; + o3_textcolor = ol_textcolor; + o3_capcolor = ol_capcolor; + o3_closecolor = ol_closecolor; + o3_width = ol_width; + o3_border = ol_border; + o3_status = ol_status; + o3_autostatus = ol_autostatus; + o3_height = ol_height; + o3_snapx = ol_snapx; + o3_snapy = ol_snapy; + o3_fixx = ol_fixx; + o3_fixy = ol_fixy; + o3_fgbackground = ol_fgbackground; + o3_bgbackground = ol_bgbackground; + o3_padxl = ol_padxl; + o3_padxr = ol_padxr; + o3_padyt = ol_padyt; + o3_padyb = ol_padyb; + o3_fullhtml = ol_fullhtml; + o3_vpos = ol_vpos; + o3_aboveheight = ol_aboveheight; + o3_capicon = ol_capicon; + o3_textfont = ol_textfont; + o3_captionfont = ol_captionfont; + o3_closefont = ol_closefont; + o3_textsize = ol_textsize; + o3_captionsize = ol_captionsize; + o3_closesize = ol_closesize; + o3_timeout = ol_timeout; + o3_function = ol_function; + o3_delay = ol_delay; + o3_hauto = ol_hauto; + o3_vauto = ol_vauto; + o3_closeclick = ol_closeclick; + + o3_css = ol_css; + o3_fgclass = ol_fgclass; + o3_bgclass = ol_bgclass; + o3_textfontclass = ol_textfontclass; + o3_captionfontclass = ol_captionfontclass; + o3_closefontclass = ol_closefontclass; + o3_padunit = ol_padunit; + o3_heightunit = ol_heightunit; + o3_widthunit = ol_widthunit; + o3_textsizeunit = ol_textsizeunit; + o3_textdecoration = ol_textdecoration; + o3_textstyle = ol_textstyle; + o3_textweight = ol_textweight; + o3_captionsizeunit = ol_captionsizeunit; + o3_captiondecoration = ol_captiondecoration; + o3_captionstyle = ol_captionstyle; + o3_captionweight = ol_captionweight; + o3_closesizeunit = ol_closesizeunit; + o3_closedecoration = ol_closedecoration; + o3_closestyle = ol_closestyle; + o3_closeweight = ol_closeweight; + + + // Special for frame support, over must be reset... + if ( (ns4) || (ie4) || (ns6) ) { + o3_frame = ol_frame; + if (ns4) over = o3_frame.document.overDiv + if (ie4) over = o3_frame.overDiv.style + if (ns6) over = o3_frame.document.getElementById("overDiv"); + } + + + // What the next argument is expected to be. + var parsemode = -1; + + var ar = arguments; + + for (i = 0; i < ar.length; i++) { + + if (parsemode < 0) { + // Arg is maintext, unless INARRAY + if (ar[i] == INARRAY) { + o3_text = ol_texts[ar[++i]]; + } else { + o3_text = ar[i]; + } + + parsemode = 0; + } else { + // Note: NS4 doesn't like switch cases with vars. + if (ar[i] == INARRAY) { o3_text = ol_texts[ar[++i]]; continue; } + if (ar[i] == CAPARRAY) { o3_cap = ol_caps[ar[++i]]; continue; } + if (ar[i] == STICKY) { o3_sticky = 1; continue; } + if (ar[i] == BACKGROUND) { o3_background = ar[++i]; continue; } + if (ar[i] == NOCLOSE) { o3_close = ""; continue; } + if (ar[i] == CAPTION) { o3_cap = ar[++i]; continue; } + if (ar[i] == CENTER || ar[i] == LEFT || ar[i] == RIGHT) { o3_hpos = ar[i]; continue; } + if (ar[i] == OFFSETX) { o3_offsetx = ar[++i]; continue; } + if (ar[i] == OFFSETY) { o3_offsety = ar[++i]; continue; } + if (ar[i] == FGCOLOR) { o3_fgcolor = ar[++i]; continue; } + if (ar[i] == BGCOLOR) { o3_bgcolor = ar[++i]; continue; } + if (ar[i] == TEXTCOLOR) { o3_textcolor = ar[++i]; continue; } + if (ar[i] == CAPCOLOR) { o3_capcolor = ar[++i]; continue; } + if (ar[i] == CLOSECOLOR) { o3_closecolor = ar[++i]; continue; } + if (ar[i] == WIDTH) { o3_width = ar[++i]; continue; } + if (ar[i] == BORDER) { o3_border = ar[++i]; continue; } + if (ar[i] == STATUS) { o3_status = ar[++i]; continue; } + if (ar[i] == AUTOSTATUS) { o3_autostatus = 1; continue; } + if (ar[i] == AUTOSTATUSCAP) { o3_autostatus = 2; continue; } + if (ar[i] == HEIGHT) { o3_height = ar[++i]; o3_aboveheight = ar[i]; continue; } // Same param again. + if (ar[i] == CLOSETEXT) { o3_close = ar[++i]; continue; } + if (ar[i] == SNAPX) { o3_snapx = ar[++i]; continue; } + if (ar[i] == SNAPY) { o3_snapy = ar[++i]; continue; } + if (ar[i] == FIXX) { o3_fixx = ar[++i]; continue; } + if (ar[i] == FIXY) { o3_fixy = ar[++i]; continue; } + if (ar[i] == FGBACKGROUND) { o3_fgbackground = ar[++i]; continue; } + if (ar[i] == BGBACKGROUND) { o3_bgbackground = ar[++i]; continue; } + if (ar[i] == PADX) { o3_padxl = ar[++i]; o3_padxr = ar[++i]; continue; } + if (ar[i] == PADY) { o3_padyt = ar[++i]; o3_padyb = ar[++i]; continue; } + if (ar[i] == FULLHTML) { o3_fullhtml = 1; continue; } + if (ar[i] == BELOW || ar[i] == ABOVE) { o3_vpos = ar[i]; continue; } + if (ar[i] == CAPICON) { o3_capicon = ar[++i]; continue; } + if (ar[i] == TEXTFONT) { o3_textfont = ar[++i]; continue; } + if (ar[i] == CAPTIONFONT) { o3_captionfont = ar[++i]; continue; } + if (ar[i] == CLOSEFONT) { o3_closefont = ar[++i]; continue; } + if (ar[i] == TEXTSIZE) { o3_textsize = ar[++i]; continue; } + if (ar[i] == CAPTIONSIZE) { o3_captionsize = ar[++i]; continue; } + if (ar[i] == CLOSESIZE) { o3_closesize = ar[++i]; continue; } + if (ar[i] == FRAME) { opt_FRAME(ar[++i]); continue; } + if (ar[i] == TIMEOUT) { o3_timeout = ar[++i]; continue; } + if (ar[i] == FUNCTION) { opt_FUNCTION(ar[++i]); continue; } + if (ar[i] == DELAY) { o3_delay = ar[++i]; continue; } + if (ar[i] == HAUTO) { o3_hauto = (o3_hauto == 0) ? 1 : 0; continue; } + if (ar[i] == VAUTO) { o3_vauto = (o3_vauto == 0) ? 1 : 0; continue; } + if (ar[i] == CLOSECLICK) { o3_closeclick = (o3_closeclick == 0) ? 1 : 0; continue; } + if (ar[i] == CSSOFF) { o3_css = ar[i]; continue; } + if (ar[i] == CSSSTYLE) { o3_css = ar[i]; continue; } + if (ar[i] == CSSCLASS) { o3_css = ar[i]; continue; } + if (ar[i] == FGCLASS) { o3_fgclass = ar[++i]; continue; } + if (ar[i] == BGCLASS) { o3_bgclass = ar[++i]; continue; } + if (ar[i] == TEXTFONTCLASS) { o3_textfontclass = ar[++i]; continue; } + if (ar[i] == CAPTIONFONTCLASS) { o3_captionfontclass = ar[++i]; continue; } + if (ar[i] == CLOSEFONTCLASS) { o3_closefontclass = ar[++i]; continue; } + if (ar[i] == PADUNIT) { o3_padunit = ar[++i]; continue; } + if (ar[i] == HEIGHTUNIT) { o3_heightunit = ar[++i]; continue; } + if (ar[i] == WIDTHUNIT) { o3_widthunit = ar[++i]; continue; } + if (ar[i] == TEXTSIZEUNIT) { o3_textsizeunit = ar[++i]; continue; } + if (ar[i] == TEXTDECORATION) { o3_textdecoration = ar[++i]; continue; } + if (ar[i] == TEXTSTYLE) { o3_textstyle = ar[++i]; continue; } + if (ar[i] == TEXTWEIGHT) { o3_textweight = ar[++i]; continue; } + if (ar[i] == CAPTIONSIZEUNIT) { o3_captionsizeunit = ar[++i]; continue; } + if (ar[i] == CAPTIONDECORATION) { o3_captiondecoration = ar[++i]; continue; } + if (ar[i] == CAPTIONSTYLE) { o3_captionstyle = ar[++i]; continue; } + if (ar[i] == CAPTIONWEIGHT) { o3_captionweight = ar[++i]; continue; } + if (ar[i] == CLOSESIZEUNIT) { o3_closesizeunit = ar[++i]; continue; } + if (ar[i] == CLOSEDECORATION) { o3_closedecoration = ar[++i]; continue; } + if (ar[i] == CLOSESTYLE) { o3_closestyle = ar[++i]; continue; } + if (ar[i] == CLOSEWEIGHT) { o3_closeweight = ar[++i]; continue; } + } + } + + if (o3_delay == 0) { + return overlib350(); + } else { + o3_delayid = setTimeout("overlib350()", o3_delay); + + if (o3_sticky) { + return false; + } else { + return true; + } + } +} + + + +// Clears popups if appropriate +function nd() { + if ( o3_removecounter >= 1 ) { o3_showingsticky = 0 }; + if ( (ns4) || (ie4) || (ns6) ) { + if ( o3_showingsticky == 0 ) { + o3_allowmove = 0; + if (over != null) hideObject(over); + } else { + o3_removecounter++; + } + } + + return true; +} + + + + + + + +//////////////////////////////////////////////////////////////////////////////////// +// OVERLIB 3.50 FUNCTION +//////////////////////////////////////////////////////////////////////////////////// + + +// This function decides what it is we want to display and how we want it done. +function overlib350() { + + // Make layer content + var layerhtml; + + if (o3_background != "" || o3_fullhtml) { + // Use background instead of box. + layerhtml = ol_content_background(o3_text, o3_background, o3_fullhtml); + } else { + // They want a popup box. + + // Prepare popup background + if (o3_fgbackground != "" && o3_css == CSSOFF) { + o3_fgbackground = "BACKGROUND=\""+o3_fgbackground+"\""; + } + if (o3_bgbackground != "" && o3_css == CSSOFF) { + o3_bgbackground = "BACKGROUND=\""+o3_bgbackground+"\""; + } + + // Prepare popup colors + if (o3_fgcolor != "" && o3_css == CSSOFF) { + o3_fgcolor = "BGCOLOR=\""+o3_fgcolor+"\""; + } + if (o3_bgcolor != "" && o3_css == CSSOFF) { + o3_bgcolor = "BGCOLOR=\""+o3_bgcolor+"\""; + } + + // Prepare popup height + if (o3_height > 0 && o3_css == CSSOFF) { + o3_height = "HEIGHT=" + o3_height; + } else { + o3_height = ""; + } + + // Decide which kinda box. + if (o3_cap == "") { + // Plain + layerhtml = ol_content_simple(o3_text); + } else { + // With caption + if (o3_sticky) { + // Show close text + layerhtml = ol_content_caption(o3_text, o3_cap, o3_close); + } else { + // No close text + layerhtml = ol_content_caption(o3_text, o3_cap, ""); + } + } + } + + // We want it to stick! + if (o3_sticky) { + o3_showingsticky = 1; + o3_removecounter = 0; + } + + // Write layer + layerWrite(layerhtml); + + // Prepare status bar + if (o3_autostatus > 0) { + o3_status = o3_text; + if (o3_autostatus > 1) { + o3_status = o3_cap; + } + } + + // When placing the layer the first time, even stickies may be moved. + o3_allowmove = 0; + + // Initiate a timer for timeout + if (o3_timeout > 0) { + if (o3_timerid > 0) clearTimeout(o3_timerid); + o3_timerid = setTimeout("cClick()", o3_timeout); + } + + // Show layer + disp(o3_status); + + // Stickies should stay where they are. + if (o3_sticky) { + o3_allowmove = 0; + return false; + } else { + return true; + } +} + + + +//////////////////////////////////////////////////////////////////////////////////// +// LAYER GENERATION FUNCTIONS +//////////////////////////////////////////////////////////////////////////////////// + +// Makes simple table without caption +function ol_content_simple(text) { + if (o3_css == CSSCLASS) txt = "
"+text+"
"; + if (o3_css == CSSSTYLE) txt = "
"+text+"
"; + if (o3_css == CSSOFF) txt = "
"+text+"
"; + + set_background(""); + return txt; +} + + + + +// Makes table with caption and optional close link +function ol_content_caption(text, title, close) { + closing = ""; + closeevent = "onMouseOver"; + + if (o3_closeclick == 1) closeevent = "onClick"; + if (o3_capicon != "") o3_capicon = " "; + + if (close != "") { + if (o3_css == CSSCLASS) closing = ""+close+""; + if (o3_css == CSSSTYLE) closing = ""+close+""; + if (o3_css == CSSOFF) closing = ""+close+""; + } + + if (o3_css == CSSCLASS) txt = "
"+closing+"
"+o3_capicon+title+"
"+text+"
"; + if (o3_css == CSSSTYLE) txt = "
"+closing+"
"+o3_capicon+title+"
"+text+"
"; + if (o3_css == CSSOFF) txt = "
"+closing+"
"+o3_capicon+title+"
"+text+"
"; + + set_background(""); + return txt; +} + +// Sets the background picture, padding and lots more. :) +function ol_content_background(text, picture, hasfullhtml) { + if (hasfullhtml) { + txt = text; + } else { + if (o3_css == CSSCLASS) txt = "
"+text+"
"; + if (o3_css == CSSSTYLE) txt = "
"+text+"
"; + if (o3_css == CSSOFF) txt = "
"+text+"
"; + } + set_background(picture); + return txt; +} + +// Loads a picture into the div. +function set_background(pic) { + if (pic == "") { + if (ie4) over.backgroundImage = "none"; + if (ns6) over.style.backgroundImage = "none"; + } else { + if (ns4) { + over.background.src = pic; + } else if (ie4) { + over.backgroundImage = "url("+pic+")"; + } else if (ns6) { + over.style.backgroundImage = "url("+pic+")"; + } + } +} + + + +//////////////////////////////////////////////////////////////////////////////////// +// HANDLING FUNCTIONS +//////////////////////////////////////////////////////////////////////////////////// + + +// Displays the popup +function disp(statustext) { + if ( (ns4) || (ie4) || (ns6) ) { + if (o3_allowmove == 0) { + placeLayer(); + showObject(over); + o3_allowmove = 1; + } + } + + if (statustext != "") { + self.status = statustext; + } +} + +// Decides where we want the popup. +function placeLayer() { + var placeX, placeY; + + // HORIZONTAL PLACEMENT + if (o3_fixx > -1) { + // Fixed position + placeX = o3_fixx; + } else { + winoffset = (ie4) ? o3_frame.document.body.scrollLeft : o3_frame.pageXOffset; + if (ie4) iwidth = o3_frame.document.body.clientWidth; + if (ns4) iwidth = o3_frame.innerWidth; // was screwed in mozilla, fixed now? + if (ns6) iwidth = o3_frame.outerWidth; + + // If HAUTO, decide what to use. + if (o3_hauto == 1) { + if ( (o3_x - winoffset) > ((eval(iwidth)) / 2)) { + o3_hpos = LEFT; + } else { + o3_hpos = RIGHT; + } + } + + // From mouse + if (o3_hpos == CENTER) { // Center + placeX = o3_x+o3_offsetx-(o3_width/2); + } + if (o3_hpos == RIGHT) { // Right + placeX = o3_x+o3_offsetx; + if ( (eval(placeX) + eval(o3_width)) > (winoffset + iwidth) ) { + placeX = iwidth + winoffset - o3_width; + if (placeX < 0) placeX = 0; + } + } + if (o3_hpos == LEFT) { // Left + placeX = o3_x-o3_offsetx-o3_width; + if (placeX < winoffset) placeX = winoffset; + } + + // Snapping! + if (o3_snapx > 1) { + var snapping = placeX % o3_snapx; + if (o3_hpos == LEFT) { + placeX = placeX - (o3_snapx + snapping); + } else { + // CENTER and RIGHT + placeX = placeX + (o3_snapx - snapping); + } + if (placeX < winoffset) placeX = winoffset; + } + } + + + + // VERTICAL PLACEMENT + if (o3_fixy > -1) { + // Fixed position + placeY = o3_fixy; + } else { + scrolloffset = (ie4) ? o3_frame.document.body.scrollTop : o3_frame.pageYOffset; + + // If VAUTO, decide what to use. + if (o3_vauto == 1) { + if (ie4) iheight = o3_frame.document.body.clientHeight; + if (ns4) iheight = o3_frame.innerHeight; + if (ns6) iheight = o3_frame.outerHeight; + + iheight = (eval(iheight)) / 2; + if ( (o3_y - scrolloffset) > iheight) { + o3_vpos = ABOVE; + } else { + o3_vpos = BELOW; + } + } + + + // From mouse + if (o3_vpos == ABOVE) { + if (o3_aboveheight == 0) { + var divref = (ie4) ? o3_frame.document.all['overDiv'] : over; + o3_aboveheight = (ns4) ? divref.clip.height : divref.offsetHeight; + } + + placeY = o3_y - (o3_aboveheight + o3_offsety); + if (placeY < scrolloffset) placeY = scrolloffset; + } else { + // BELOW + placeY = o3_y + o3_offsety; + } + + // Snapping! + if (o3_snapy > 1) { + var snapping = placeY % o3_snapy; + + if (o3_aboveheight > 0 && o3_vpos == ABOVE) { + placeY = placeY - (o3_snapy + snapping); + } else { + placeY = placeY + (o3_snapy - snapping); + } + + if (placeY < scrolloffset) placeY = scrolloffset; + } + } + + + // Actually move the object. + repositionTo(over, placeX, placeY); +} + + +// Moves the layer +function mouseMove(e) { + if ( (ns4) || (ns6) ) {o3_x=e.pageX; o3_y=e.pageY;} + if (ie4) {o3_x=event.x; o3_y=event.y;} + if (ie5) {o3_x=event.x+o3_frame.document.body.scrollLeft; o3_y=event.y+o3_frame.document.body.scrollTop;} + + if (o3_allowmove == 1) { + placeLayer(); + } +} + +// The Close onMouseOver function for stickies +function cClick() { + hideObject(over); + o3_showingsticky = 0; + + return false; +} + + +// Makes sure target frame has overLIB +function compatibleframe(frameid) { + if (ns4) { + if (typeof frameid.document.overDiv =='undefined') return false; + } else if (ie4) { + if (typeof frameid.document.all["overDiv"] =='undefined') return false; + } else if (ns6) { + if (frameid.document.getElementById('overDiv') == null) return false; + } + + return true; +} + + + +//////////////////////////////////////////////////////////////////////////////////// +// LAYER FUNCTIONS +//////////////////////////////////////////////////////////////////////////////////// + + +// Writes to a layer +function layerWrite(txt) { + txt += "\n"; + + if (ns4) { + var lyr = o3_frame.document.overDiv.document + + lyr.write(txt) + lyr.close() + } else if (ie4) { + o3_frame.document.all["overDiv"].innerHTML = txt + } else if (ns6) { + range = o3_frame.document.createRange(); + range.setStartBefore(over); + domfrag = range.createContextualFragment(txt); + while (over.hasChildNodes()) { + over.removeChild(over.lastChild); + } + over.appendChild(domfrag); + } +} + +// Make an object visible +function showObject(obj) { + if (ns4) obj.visibility = "show"; + else if (ie4) obj.visibility = "visible"; + else if (ns6) obj.style.visibility = "visible"; +} + +// Hides an object +function hideObject(obj) { + if (ns4) obj.visibility = "hide"; + else if (ie4) obj.visibility = "hidden"; + else if (ns6) obj.style.visibility = "hidden"; + + if (o3_timerid > 0) clearTimeout(o3_timerid); + if (o3_delayid > 0) clearTimeout(o3_delayid); + o3_timerid = 0; + o3_delayid = 0; + self.status = ""; +} + +// Move a layer +function repositionTo(obj,xL,yL) { + if ( (ns4) || (ie4) ) { + obj.left = xL; + obj.top = yL; + } else if (ns6) { + obj.style.left = xL + "px"; + obj.style.top = yL+ "px"; + } +} + + + + + +//////////////////////////////////////////////////////////////////////////////////// +// PARSER FUNCTIONS +//////////////////////////////////////////////////////////////////////////////////// + + +// Defines which frame we should point to. +function opt_FRAME(frm) { + o3_frame = compatibleframe(frm) ? frm : ol_frame; + + if ( (ns4) || (ie4 || (ns6)) ) { + if (ns4) over = o3_frame.document.overDiv; + if (ie4) over = o3_frame.overDiv.style; + if (ns6) over = o3_frame.document.getElementById("overDiv"); + } + + return 0; +} + +// Calls an external function +function opt_FUNCTION(callme) { + o3_text = callme() + return 0; +} + + + + +//end (For internal purposes.) +//////////////////////////////////////////////////////////////////////////////////// +// OVERLIB 2 COMPATABILITY FUNCTIONS +// If you aren't upgrading you can remove the below section. +//////////////////////////////////////////////////////////////////////////////////// + +// Converts old 0=left, 1=right and 2=center into constants. +function vpos_convert(d) { + if (d == 0) { + d = LEFT; + } else { + if (d == 1) { + d = RIGHT; + } else { + d = CENTER; + } + } + + return d; +} + +// Simple popup +function dts(d,text) { + o3_hpos = vpos_convert(d); + overlib(text, o3_hpos, CAPTION, ""); +} + +// Caption popup +function dtc(d,text, title) { + o3_hpos = vpos_convert(d); + overlib(text, CAPTION, title, o3_hpos); +} + +// Sticky +function stc(d,text, title) { + o3_hpos = vpos_convert(d); + overlib(text, CAPTION, title, o3_hpos, STICKY); +} + +// Simple popup right +function drs(text) { + dts(1,text); +} + +// Caption popup right +function drc(text, title) { + dtc(1,text,title); +} + +// Sticky caption right +function src(text,title) { + stc(1,text,title); +} + +// Simple popup left +function dls(text) { + dts(0,text); +} + +// Caption popup left +function dlc(text, title) { + dtc(0,text,title); +} + +// Sticky caption left +function slc(text,title) { + stc(0,text,title); +} + +// Simple popup center +function dcs(text) { + dts(2,text); +} + +// Caption popup center +function dcc(text, title) { + dtc(2,text,title); +} + +// Sticky caption center +function scc(text,title) { + stc(2,text,title); +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/brief.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/brief.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,104 @@ + + + + + + + + +

Introduction

+

Cewolf can be used inside a Servlet/JSP based web +application to embed complex graphical charts of all kinds (e.g. line, +pie, bar chart, plots, etc.) into a web page. Therefore it provides a +full featured tag library to define all properties of the chart (colors, +strokes, legend, etc.). Thus the JSP which embedds the chart is not +polluted with any java code. Everything is described with XML conform +tags.

+

Cewolf is based on JFreeChart and +uses it's rendering engine to render the final chart image into the +clients response stream. No files are created on server side. Everything +is based on lightweight session objects and dynamic data analysis. +Cewolf consists of one servlet which handles the chart rendering and a +taglibrary which translates the chart definition included in the JSP +into an HTML img tag which consults the rendering servlet for retrieval +of the appropriate chart.

+

Simce the project has been funded in the middle of 2002 there have +been more then 150.000 page views and 16.000 downloads +(Sourceforge activity max: >99,7%).

+

+ + + + + + + + + + + + + + + + + + + +
Fully free and open100% Java compliant
+
    +
  • LGPL license
  • +
  • no charges
  • +
  • no restrictions
  • +
  • Support on SourceForge Forums
  • +
  • short development and upgrade circles
  • +
+
+
    +
  • no usage of native libraries
  • +
  • should run in every J2EE compliant server or servlet +container
  • +
  • extensive usage of available open source projects
  • +
+
Full featured Chart Tag LibraryHuge number of different Charts
+
    +
  • no java coding inside the JSP needed
  • +
  • XML description of a chart
  • +
  • design time validation of chart tags
  • +
  • extensive tag documentation
  • +
+
+
    +
  • Line [XY]
  • +
  • [3D] Pie
  • +
  • [3D] Horizonal Bar
  • +
  • [3D] Vertical [XY] Bar
  • +
  • [3D] Stacked Vertical Bar
  • +
  • Area [XY]
  • +
  • Scatter Plot
  • +
  • Candlestick
  • +
  • High Low
  • +
  • Gantt
  • +
  • Meter
  • +
  • Overlaid
  • +
  • Combined
  • +
+
+

+

+

Example

+

You can simply define a chart by including a chart tag into your JSP +like this:

+
<cewolf:chart 
id="XYChart"
type="xy"
title="XYChart"
<cewolf:gradient>
<cewolf:point x="0" y="0" color="#FFFFFF"/>
<cewolf:point x="0" y="300" color="#C8C8C8"/>
</cewolf:gradient>
<cewolf:data>
<cewolf:producer id="xyData"/>
</cewolf:data>
</cewolf:chart>
<cewolf:img chartid="XYChart" renderer="cewolf" width="400" height="300"/>
+

This results in a rendered chart like this:

+examplechart +

As you can see only the view is defined in the JSP page. The model +is produced by a so called DataProducer which must be available in the +pageContext of the JSP.

+SourceForge Logo + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/cewolf.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/cewolf.css Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,105 @@ +BODY { + FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; + FONT-SIZE: 11px; + LINE-HEIGHT: 16px; + background: #DDE8F2; + color:#333333; + padding: 30px 180px 0px 35px; +} + +TD { + FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; + FONT-SIZE: 11px; + LINE-HEIGHT: 16px; + background: #DDE8F2; + color:#BE4602; +} + +TH { + FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; + FONT-SIZE: 11px; + LINE-HEIGHT: 16px; + color:#BE4602; + FONT-weight: bold; +} + +a:link { + text-decoration:none; + font-weight:bold; + color:#BE4602; +} + +a:visited { + text-decoration:none; + font-weight:bold; + color:#BE4602; +} + +a:hover { + text-decoration:none; + font-weight:bold; + background-color:#FFFFFF; +} + +a:active { + text-decoration:none; + font-weight:bold; + background-color:#FFFFFF; +} + +a.body:link { + text-decoration:none; + font-weight:bold; + color:#BE4602; +} + +a.body:visited { + text-decoration:none; + font-weight:bold; + color:#BE4602; +} + +a.body:hover { + text-decoration:none; + font-weight:bold; + color:#BE4602; +} + +H1 { + FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; + FONT-SIZE: 15px; + FONT-WEIGHT: bold; + margin-bottom : 3px; + color:#BE4602; +} + +H2 { + FONT-FAMILY: Verdana, Arial, Verdana, Helvetica, sans-serif; + FONT-SIZE: 13px; + FONT-WEIGHT: bold; + margin-bottom : 0px; + margin-top : 6px; + color:#BE4602; +} + +H3 { + FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; + FONT-SIZE: 11px; + FONT-WEIGHT: bold; + margin-bottom : 0px; + margin-top : 6px; + color:#BE4602; +} + +IMG { + border: 0px; +} + +.featureGroup { + FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; + FONT-weight: bold; + FONT-SIZE: 12px; + color:#BE4602; + background: #FEFED2; +} + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/chartdatasetcombinations.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/chartdatasetcombinations.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ChartDatasetPlotRenderer
areaCategoryDatasetVerticalCategoryPlotAreaRenderer
areaxyXYDatasetXYPlot
horizontalbarCategoryDataset

horizontalbar3dCategoryDatasetHorizontalCategoryPlotHorizontalBarRenderer3D
lineCategoryDatasetVerticalCategoryPlotLineAndShapeRenderer
piePieDatasetPiePlot
scatterXYDatasetXYPlotAreaRenderer
stackedhorizontalbarCategoryDatasetHorizontalCategoryPlotStackedHorizontalBarRenderer
stackedverticalbarCategoryDatasetVerticalCategoryPlotStackedVerticalBarRenderer
stackedverticalbar3dCategoryDatasetVerticalCategoryPlotStackedVerticalBarRenderer3D
timeseriesXYDataset

verticalbarCategoryDataset

verticalbar3dCategoryDataset

xyXYDatasetXYPlotStandardXYItemRenderer
candlestickHighLowDataset

highlowHighLowDataset

ganttIntervalCategoryDatasetHorizontalCategoryPlotHorizontalIntervalBarRenderer
windWindDataset

signalSignalsDataset

verticalxybarIntervalXYDataset

pie3dPieDataset

overlaidxy


overlaidcategory


combinedxy


meterMeterDatasetMeterPlot
stackedareaCategoryDatasetVerticalCategoryPlotStackedAreaRenderer
bubbleXYZDataset

+ + + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/chartdatasetcombinations.sxc Binary file java/cewolf-1.0/src/site/chartdatasetcombinations.sxc has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/demo.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/demo.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,22 @@ + + + + + + + + +

Screens

+

These are some demo shots of charts generated by Cewolf/JFreeChart. +In sum Cewolf supports 20 types of charts.

+Horizontal3DChart  Overlaid  PieChart  ScatterPlot  ScatterPlot  Vertical3DChart  +

SourceForge Logo

+ + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/developerguide.sxw Binary file java/cewolf-1.0/src/site/developerguide.sxw has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/devguide.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/devguide.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,47 @@ + + + + + + + + +

Developer Guide

+

Let us assume the following (standard) scenario in which Cewolf +might be a solution.
+You have a running web application and you want to know which pages are +most visited by your users. You want to have a vertical bar chart which +looks like the one below

+

verticalbar

+

+

1. Prepare Your Application

+

If you have not yet downloaded the Cewolf distribution, this is the +point when you should do it (look at Download). Put the cewolf.jar file into your +web application's /WEB-INF/lib directory.
+That should be all you have to do to prepare your application for +Cewolf usage. If you encounter any problems in using the Cewolf tags +(e.g. "No Tags" is displayed in your containers console) you can +additionally put the cewolf.tld file from the distribution's etc +directory into a directory of your choice under your web application's +root and reference this file as the cewolf tag library from your JSPs.

+

2. Provide a DatasetProducer

+

As Cewolf uses a MVC (Model-View-Control) approach the data which +are shown in your chart are separated from the view defined in the JSP +page. So you can change them separately. To provide the chart with the +correct data you must provide an object which implements the interfacede.laures.cewolf.DatasetProducer. +This object is asked to produce data every time a chart is rendered. +Below you see an implementation of a DatasetProducer which could be used +to provide data needed for our example scenario.

+

+to be continued ... +

3. Install the Cewolf Servlet in your Web App

+tbd. +

4. Define the chart in your JSP

+
<%@page contentType="text/html"%>
<%@taglib uri='/WEB-INF/cewolf.tld' prefix='cewolf' %>
<jsp:useBean id="pageViews" class="de.laures.cewolf.example.PageViewCountData"/>
<cewolf:chart
id="horizontalBarChart"
title="HorizontalBarChart"
renderer="servlet/chart"
width="300" height="300"
type="horizontalBar"
xAxisLabel="Page"
yAxisLabel="Views">
<cewolf:data producer="pageViews" />
</cewolf:chart>
+

SourceForge Logo

+ + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/faq/faq.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/faq/faq.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,97 @@ + + + +Cewolf FAQ + + + + +

Cewolf FAQ

+ + + + +

FAQ Revised: Monday 09 June 2003 23:18:38

+

Table of Contents

+
+
1. General
+
+
2. Troubleshooting
+
+
+

1. General

+
+
1.1. What is the purpose of Cewolf?
+
Cewolf enables web applications running in a servlet container to easily include chart images.

+
1.2. Who wrote it?
+
Guido Laures wrote the initial program and released it.

+
1.3. Why has Cewolf been developped?
+
While developing a web application which needed to provide some chart images Guido +found out that there is no open source library which provides the ability to define chart images +as JSP tags. So he started to write a simple tag library based on the famous JFreeChart library +for standalone chart images.
+In June 2002 Guido decided to donate his library to the public and named it Cewolf.

+
+

2. Troubleshooting

+
+
2.1. I'm using Cewolf under Unix/Linux. When trying to access a chart I get a NoClassDefFoundError. What am I doing wrong?
+
Essentially, this is a variation of the headless Linux server problem. + If there are any Linux wizards out there (I use SuSE 7.1) to point out better solutions, I'd be happy to hear them.
+ +I was not quite convinced it would be the same problem many other people had, since I _have_ an X server running. However, it is sitting there, idling away with KDM (the KDE Display Manager), and I could not find a way to make that display available to java. I tried to connect to it, tried to set xhost +, but no avail. In the end, I used (as root) +startx -- :2 +to start another X server on display :2 (localhost is implied). Unfortunately, startx will start KDE, so the libraries are loaded into memory, but that is a minor annoyance. There might be a possibility of starting just the X server or a minor window manager (twm for example), but I tried with env WANTEDWM=twm startx -- :2 &, but KDE got loaded anyway. In essence, the Xvfb solution might just be the thing I use next time. +
+Then, all you have to do is tell Tomcat to use display 2 for painting: +env DISPLAY=:2 bin/startup.sh +(being in /opt/tomcat4). +
+Other posts I found helpful were: +http://www.object-refinery.com/phorum-3.3.2a/read.php?f=2&i=2987&t=2987 +http://forum.java.sun.com/thread.jsp?forum=4&thread=201773 +http://forum.java.sun.com/thread.jsp?forum=20&thread=132877 +
+Generally, try to look for 'headless' on java.sun.com (be sure to include the forums!). +
+Why didn't I use the headless option of JDK1.4? +Of course I tried, but the Cewolf classes include a call to de.laures.cewolf.util.ImageHelper, which in its static initializer will throw a headless exception. I verified this under NT and Linux. :( +
+One good method to troubleshoot is to call the servlet directly: in IE, right-click on the image (presumably missing, otherwise you wouldn't be here...), choose Properties, select the whole path and copy the path into the address line. Call this, and you will get a stack trace detailing the problem. However, it might be necessary to reload the application in between - somehow, only the stack trace of the first call is useful, the next calls to the same servlet will result in a much more generic (bland) error message. +
+With the method above I was able to use the Cewolf.war files from versions 0.7, 0.8 and 0.8.1. However, only the testpage worked satisfyingly in all cases. The Cewolf set in some circumstances created a
+
+java.lang.ClassCastException: sun.awt.image.DataBufferNative
+at sun.awt.image.codec.JPEGImangeEncoderImpl.encode(lines 405, called from 228 and 235)
+at de.laures.cewolf.taglib.Renderer.renderLegend(Renderer.java:97)
+at de.laures.cewolf.taglib.LegendTag.doStartTag(LegendTag.java:56)
+at org.apache.jsp.cewolfset_jsp. and so on........
+
+This is in 0.8.1. In the cewolfset of 0.7, most charts render fine, except for the last two, where it says 'Separate legend befor chart rendering' [sic] and 'Pie Chart with separate legend after chart rendering'. Both charts render fine, but the legends don't. Using above mentioned technique to render the servlet alone (the path is localhost:8080/Cewolf-0.7/cewolf?id=pie&action=renderlegend), the known ClassCastException appears again. +
+The one thing I still don't get is why my own application does not work on Linux, even though I use the exact same war file on NT without problems. I just get the empty windows, no stack traces in any logs, and calling the servlets alone gets the ClassCastException again, even though I don't think I do anything differently than in the testpage code. +I just tried to do it under JDK1.4.1_01, but no change (except that the ClassCastException doesn't mention sun.awt.image.DataBufferNative anymore). JDK1.3 might work (I get to see the complete Cewolfset, including the legends), only that I get another error in my DataProvider in a call to Calendar.setTimeInMillis (was protected in 1.3 and is public in 1.4). This error message was what prompted me to switch over to 1.4 in the first place... But I can fix that. Or wait until the casting problem is solved.

+
2.2. Why does the same chart display again and again even though the data changes?
+
A DatasetProducer is supposed to generate the same data when passed in the same paramters. So Cewolf returns a cached instance of a chart if there +is no change in parameters. If your DatasetProducer produces different data even when parameters do not change you can add a +fake parameter (e.g. time) to avoid caching.
+Since version 0.9 this issue has been fixed with the new methods in the DatasetProducer interface.

+
+ + + + + +
+

Copyright (c) 2003 Guido Laures
+This list of questions and answers was generated by makefaq.

+ + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/faq/faqfooter.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/faq/faqfooter.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,15 @@ + + + + + +
+

Copyright (c) 2003 Guido Laures
+This list of questions and answers was generated by makefaq.

+SourceForge Logo + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/faq/faqheader.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/faq/faqheader.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,13 @@ + + + +Cewolf FAQ + + + + +

Cewolf FAQ

+ + + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/header.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/header.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,38 @@ + + + + header + + + + + + + + + + + +
logo   + + + + + + + + +
Jspin.com Jspin.com SourceForge Logo
+
+ + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/Thumbs.db Binary file java/cewolf-1.0/src/site/img/Thumbs.db has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/api_button_off.png Binary file java/cewolf-1.0/src/site/img/api_button_off.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/api_button_on.png Binary file java/cewolf-1.0/src/site/img/api_button_on.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/architecture.png Binary file java/cewolf-1.0/src/site/img/architecture.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/cewolf_logo.gif Binary file java/cewolf-1.0/src/site/img/cewolf_logo.gif has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/downloads_button_off.png Binary file java/cewolf-1.0/src/site/img/downloads_button_off.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/downloads_button_on.png Binary file java/cewolf-1.0/src/site/img/downloads_button_on.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/examplehoriz3d.png Binary file java/cewolf-1.0/src/site/img/examplehoriz3d.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/exampleline.png Binary file java/cewolf-1.0/src/site/img/exampleline.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/exampleoverlaid.png Binary file java/cewolf-1.0/src/site/img/exampleoverlaid.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/examplepie.png Binary file java/cewolf-1.0/src/site/img/examplepie.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/examplescatter.png Binary file java/cewolf-1.0/src/site/img/examplescatter.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/examplevert3d.png Binary file java/cewolf-1.0/src/site/img/examplevert3d.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/examplexy.png Binary file java/cewolf-1.0/src/site/img/examplexy.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/faq_button_off.png Binary file java/cewolf-1.0/src/site/img/faq_button_off.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/faq_button_on.png Binary file java/cewolf-1.0/src/site/img/faq_button_on.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/header_bg.png Binary file java/cewolf-1.0/src/site/img/header_bg.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/intro_button_off.png Binary file java/cewolf-1.0/src/site/img/intro_button_off.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/intro_button_on.png Binary file java/cewolf-1.0/src/site/img/intro_button_on.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/jspin100.gif Binary file java/cewolf-1.0/src/site/img/jspin100.gif has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/logo.gif Binary file java/cewolf-1.0/src/site/img/logo.gif has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/menu_bg.png Binary file java/cewolf-1.0/src/site/img/menu_bg.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/menu_corner.png Binary file java/cewolf-1.0/src/site/img/menu_corner.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/project_button_off.png Binary file java/cewolf-1.0/src/site/img/project_button_off.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/project_button_on.png Binary file java/cewolf-1.0/src/site/img/project_button_on.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/screens_button_off.png Binary file java/cewolf-1.0/src/site/img/screens_button_off.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/screens_button_on.png Binary file java/cewolf-1.0/src/site/img/screens_button_on.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/sfstats.gif Binary file java/cewolf-1.0/src/site/img/sfstats.gif has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/taglib_button_off.png Binary file java/cewolf-1.0/src/site/img/taglib_button_off.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/taglib_button_on.png Binary file java/cewolf-1.0/src/site/img/taglib_button_on.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/tutorial.png Binary file java/cewolf-1.0/src/site/img/tutorial.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/tutorial_button_off.png Binary file java/cewolf-1.0/src/site/img/tutorial_button_off.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/tutorial_button_on.png Binary file java/cewolf-1.0/src/site/img/tutorial_button_on.png has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/img/web design.psd Binary file java/cewolf-1.0/src/site/img/web design.psd has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/index.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,31 @@ + + + + +Cewolf - Chart Enabling Web Object Framework + + + + + + + + + + + + + + + + + + <body> +Cewolf can be used inside a Servlet/JSP based web application to embed complex graphical charts of all kinds (e.g. line, pie, bar chart, plots, etc.) into a web page. Therefore it provides a full featured tag library to define all properties of the chart (colors, strokes, legend, etc.). Thus the JSP which embedds the chart is not polluted with any java code. Everything is described with XML conform tags. +<p>Cewolf is based on <a href="http://www.object-refinery.com/jfreechart/">JFreeChart</a> and uses it's rendering engine to render the final chart image into the clients response stream. No files are created on server side. Everything is based on lightweight session objects and dynamic data analysis. Cewolf consists of one servlet which handles the chart rendering and a taglibrary which translates the chart definition included in the JSP into an HTML img tag which consults the rendering servlet for retrieval of the appropriate chart. +<p>You need a frame enabled browser to view this page. + </body> + + + \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/menu.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/menu.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,159 @@ + + + + Menu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
menu cornder
intro
 
tutorial
+
 
taglib
+
 
screens
+
 
api
+
 
project
+
 
downloads
+
 
FAQ
+
 
SourceForge Logo
+
+
+
+ + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/overlib.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/overlib.js Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,1222 @@ +//\////////////////////////////////////////////////////////////////////////////////// +//\ overLIB 3.50 -- This notice must remain untouched at all times. +//\ Copyright Erik Bosrup 1998-2001. All rights reserved. +//\ +//\ By Erik Bosrup (erik@bosrup.com). Last modified 2001-08-28. +//\ Portions by Dan Steinman (dansteinman.com). Additions by other people are +//\ listed on the overLIB homepage. +//\ +//\ Get the latest version at http://www.bosrup.com/web/overlib/ +//\ +//\ This script is published under an open source license. Please read the license +//\ agreement online at: http://www.bosrup.com/web/overlib/license.html +//\ If you have questions regarding the license please contact erik@bosrup.com. +//\ +//\ This script library was originally created for personal use. By request it has +//\ later been made public. This is free software. Do not sell this as your own +//\ work, or remove this copyright notice. For full details on copying or changing +//\ this script please read the license agreement at the link above. +//\ +//\ Please give credit on sites that use overLIB and submit changes of the script +//\ so other people can use them as well. This script is free to use, don't abuse. +//\////////////////////////////////////////////////////////////////////////////////// +//\mini + + +//////////////////////////////////////////////////////////////////////////////////// +// CONSTANTS +// Don't touch these. :) +//////////////////////////////////////////////////////////////////////////////////// +var INARRAY = 1; +var CAPARRAY = 2; +var STICKY = 3; +var BACKGROUND = 4; +var NOCLOSE = 5; +var CAPTION = 6; +var LEFT = 7; +var RIGHT = 8; +var CENTER = 9; +var OFFSETX = 10; +var OFFSETY = 11; +var FGCOLOR = 12; +var BGCOLOR = 13; +var TEXTCOLOR = 14; +var CAPCOLOR = 15; +var CLOSECOLOR = 16; +var WIDTH = 17; +var BORDER = 18; +var STATUS = 19; +var AUTOSTATUS = 20; +var AUTOSTATUSCAP = 21; +var HEIGHT = 22; +var CLOSETEXT = 23; +var SNAPX = 24; +var SNAPY = 25; +var FIXX = 26; +var FIXY = 27; +var FGBACKGROUND = 28; +var BGBACKGROUND = 29; +var PADX = 30; // PADX2 out +var PADY = 31; // PADY2 out +var FULLHTML = 34; +var ABOVE = 35; +var BELOW = 36; +var CAPICON = 37; +var TEXTFONT = 38; +var CAPTIONFONT = 39; +var CLOSEFONT = 40; +var TEXTSIZE = 41; +var CAPTIONSIZE = 42; +var CLOSESIZE = 43; +var FRAME = 44; +var TIMEOUT = 45; +var FUNCTION = 46; +var DELAY = 47; +var HAUTO = 48; +var VAUTO = 49; +var CLOSECLICK = 50; +var CSSOFF = 51; +var CSSSTYLE = 52; +var CSSCLASS = 53; +var FGCLASS = 54; +var BGCLASS = 55; +var TEXTFONTCLASS = 56; +var CAPTIONFONTCLASS = 57; +var CLOSEFONTCLASS = 58; +var PADUNIT = 59; +var HEIGHTUNIT = 60; +var WIDTHUNIT = 61; +var TEXTSIZEUNIT = 62; +var TEXTDECORATION = 63; +var TEXTSTYLE = 64; +var TEXTWEIGHT = 65; +var CAPTIONSIZEUNIT = 66; +var CAPTIONDECORATION = 67; +var CAPTIONSTYLE = 68; +var CAPTIONWEIGHT = 69; +var CLOSESIZEUNIT = 70; +var CLOSEDECORATION = 71; +var CLOSESTYLE = 72; +var CLOSEWEIGHT = 73; + + +//////////////////////////////////////////////////////////////////////////////////// +// DEFAULT CONFIGURATION +// You don't have to change anything here if you don't want to. All of this can be +// changed on your html page or through an overLIB call. +//////////////////////////////////////////////////////////////////////////////////// + +// Main background color (the large area) +// Usually a bright color (white, yellow etc) +if (typeof ol_fgcolor == 'undefined') { var ol_fgcolor = "#CCCCFF";} + +// Border color and color of caption +// Usually a dark color (black, brown etc) +if (typeof ol_bgcolor == 'undefined') { var ol_bgcolor = "#333399";} + +// Text color +// Usually a dark color +if (typeof ol_textcolor == 'undefined') { var ol_textcolor = "#000000";} + +// Color of the caption text +// Usually a bright color +if (typeof ol_capcolor == 'undefined') { var ol_capcolor = "#FFFFFF";} + +// Color of "Close" when using Sticky +// Usually a semi-bright color +if (typeof ol_closecolor == 'undefined') { var ol_closecolor = "#9999FF";} + +// Font face for the main text +if (typeof ol_textfont == 'undefined') { var ol_textfont = "Verdana,Arial,Helvetica";} + +// Font face for the caption +if (typeof ol_captionfont == 'undefined') { var ol_captionfont = "Verdana,Arial,Helvetica";} + +// Font face for the close text +if (typeof ol_closefont == 'undefined') { var ol_closefont = "Verdana,Arial,Helvetica";} + +// Font size for the main text +// When using CSS this will be very small. +if (typeof ol_textsize == 'undefined') { var ol_textsize = "1";} + +// Font size for the caption +// When using CSS this will be very small. +if (typeof ol_captionsize == 'undefined') { var ol_captionsize = "1";} + +// Font size for the close text +// When using CSS this will be very small. +if (typeof ol_closesize == 'undefined') { var ol_closesize = "1";} + +// Width of the popups in pixels +// 100-300 pixels is typical +if (typeof ol_width == 'undefined') { var ol_width = "200";} + +// How thick the ol_border should be in pixels +// 1-3 pixels is typical +if (typeof ol_border == 'undefined') { var ol_border = "1";} + +// How many pixels to the right/left of the cursor to show the popup +// Values between 3 and 12 are best +if (typeof ol_offsetx == 'undefined') { var ol_offsetx = 10;} + +// How many pixels to the below the cursor to show the popup +// Values between 3 and 12 are best +if (typeof ol_offsety == 'undefined') { var ol_offsety = 10;} + +// Default text for popups +// Should you forget to pass something to overLIB this will be displayed. +if (typeof ol_text == 'undefined') { var ol_text = "Default Text"; } + +// Default caption +// You should leave this blank or you will have problems making non caps popups. +if (typeof ol_cap == 'undefined') { var ol_cap = ""; } + +// Decides if sticky popups are default. +// 0 for non, 1 for stickies. +if (typeof ol_sticky == 'undefined') { var ol_sticky = 0; } + +// Default background image. Better left empty unless you always want one. +if (typeof ol_background == 'undefined') { var ol_background = ""; } + +// Text for the closing sticky popups. +// Normal is "Close". +if (typeof ol_close == 'undefined') { var ol_close = "Close"; } + +// Default vertical alignment for popups. +// It's best to leave RIGHT here. Other options are LEFT and CENTER. +if (typeof ol_hpos == 'undefined') { var ol_hpos = RIGHT; } + +// Default status bar text when a popup is invoked. +if (typeof ol_status == 'undefined') { var ol_status = ""; } + +// If the status bar automatically should load either text or caption. +// 0=nothing, 1=text, 2=caption +if (typeof ol_autostatus == 'undefined') { var ol_autostatus = 0; } + +// Default height for popup. Often best left alone. +if (typeof ol_height == 'undefined') { var ol_height = -1; } + +// Horizontal grid spacing that popups will snap to. +// 0 makes no grid, anything else will cause a snap to that grid spacing. +if (typeof ol_snapx == 'undefined') { var ol_snapx = 0; } + +// Vertical grid spacing that popups will snap to. +// 0 makes no grid, andthing else will cause a snap to that grid spacing. +if (typeof ol_snapy == 'undefined') { var ol_snapy = 0; } + +// Sets the popups horizontal position to a fixed column. +// Anything above -1 will cause fixed position. +if (typeof ol_fixx == 'undefined') { var ol_fixx = -1; } + +// Sets the popups vertical position to a fixed row. +// Anything above -1 will cause fixed position. +if (typeof ol_fixy == 'undefined') { var ol_fixy = -1; } + +// Background image for the popups inside. +if (typeof ol_fgbackground == 'undefined') { var ol_fgbackground = ""; } + +// Background image for the popups frame. +if (typeof ol_bgbackground == 'undefined') { var ol_bgbackground = ""; } + +// How much horizontal left padding text should get by default when BACKGROUND is used. +if (typeof ol_padxl == 'undefined') { var ol_padxl = 1; } + +// How much horizontal right padding text should get by default when BACKGROUND is used. +if (typeof ol_padxr == 'undefined') { var ol_padxr = 1; } + +// How much vertical top padding text should get by default when BACKGROUND is used. +if (typeof ol_padyt == 'undefined') { var ol_padyt = 1; } + +// How much vertical bottom padding text should get by default when BACKGROUND is used. +if (typeof ol_padyb == 'undefined') { var ol_padyb = 1; } + +// If the user by default must supply all html for complete popup control. +// Set to 1 to activate, 0 otherwise. +if (typeof ol_fullhtml == 'undefined') { var ol_fullhtml = 0; } + +// Default vertical position of the popup. Default should normally be BELOW. +// ABOVE only works when HEIGHT is defined. +if (typeof ol_vpos == 'undefined') { var ol_vpos = BELOW; } + +// Default height of popup to use when placing the popup above the cursor. +if (typeof ol_aboveheight == 'undefined') { var ol_aboveheight = 0; } + +// Default icon to place next to the popups caption. +if (typeof ol_caption == 'undefined') { var ol_capicon = ""; } + +// Default frame. We default to current frame if there is no frame defined. +if (typeof ol_frame == 'undefined') { var ol_frame = self; } + +// Default timeout. By default there is no timeout. +if (typeof ol_timeout == 'undefined') { var ol_timeout = 0; } + +// Default javascript funktion. By default there is none. +if (typeof ol_function == 'undefined') { var ol_function = Function(); } + +// Default timeout. By default there is no timeout. +if (typeof ol_delay == 'undefined') { var ol_delay = 0; } + +// If overLIB should decide the horizontal placement. +if (typeof ol_hauto == 'undefined') { var ol_hauto = 0; } + +// If overLIB should decide the vertical placement. +if (typeof ol_vauto == 'undefined') { var ol_vauto = 0; } + + + +// If the user has to click to close stickies. +if (typeof ol_closeclick == 'undefined') { var ol_closeclick = 0; } + +// This variable determines if you want to use CSS or inline definitions. +// CSSOFF=no CSS CSSSTYLE=use CSS inline styles CSSCLASS=use classes +if (typeof ol_css == 'undefined') { var ol_css = CSSOFF; } + +// Main background class (eqv of fgcolor) +// This is only used if CSS is set to use classes (ol_css = CSSCLASS) +if (typeof ol_fgclass == 'undefined') { var ol_fgclass = ""; } + +// Frame background class (eqv of bgcolor) +// This is only used if CSS is set to use classes (ol_css = CSSCLASS) +if (typeof ol_bgclass == 'undefined') { var ol_bgclass = ""; } + +// Main font class +// This is only used if CSS is set to use classes (ol_css = CSSCLASS) +if (typeof ol_textfontclass == 'undefined') { var ol_textfontclass = ""; } + +// Caption font class +// This is only used if CSS is set to use classes (ol_css = CSSCLASS) +if (typeof ol_captionfontclass == 'undefined') { var ol_captionfontclass = ""; } + +// Close font class +// This is only used if CSS is set to use classes (ol_css = CSSCLASS) +if (typeof ol_closefontclass == 'undefined') { var ol_closefontclass = ""; } + +// Unit to be used for the text padding above +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +// Options include "px", "%", "in", "cm" and more +if (typeof ol_padunit == 'undefined') { var ol_padunit = "px";} + +// Unit to be used for height of popup +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +// Options include "px", "%", "in", "cm" and more +if (typeof ol_heightunit == 'undefined') { var ol_heightunit = "px";} + +// Unit to be used for width of popup +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +// Options include "px", "%", "in", "cm" and more +if (typeof ol_widthunit == 'undefined') { var ol_widthunit = "px";} + +// Font size unit for the main text +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_textsizeunit == 'undefined') { var ol_textsizeunit = "px";} + +// Decoration of the main text ("none", "underline", "line-through" or "blink") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_textdecoration == 'undefined') { var ol_textdecoration = "none";} + +// Font style of the main text ("normal" or "italic") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_textstyle == 'undefined') { var ol_textstyle = "normal";} + +// Font weight of the main text ("normal", "bold", "bolder", "lighter", ect.) +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_textweight == 'undefined') { var ol_textweight = "normal";} + +// Font size unit for the caption +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_captionsizeunit == 'undefined') { var ol_captionsizeunit = "px";} + +// Decoration of the caption ("none", "underline", "line-through" or "blink") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_captiondecoration == 'undefined') { var ol_captiondecoration = "none";} + +// Font style of the caption ("normal" or "italic") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_captionstyle == 'undefined') { var ol_captionstyle = "normal";} + +// Font weight of the caption ("normal", "bold", "bolder", "lighter", ect.) +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_captionweight == 'undefined') { var ol_captionweight = "bold";} + +// Font size unit for the close text +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_closesizeunit == 'undefined') { var ol_closesizeunit = "px";} + +// Decoration of the close text ("none", "underline", "line-through" or "blink") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_closedecoration == 'undefined') { var ol_closedecoration = "none";} + +// Font style of the close text ("normal" or "italic") +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_closestyle == 'undefined') { var ol_closestyle = "normal";} + +// Font weight of the close text ("normal", "bold", "bolder", "lighter", ect.) +// Only used if CSS inline styles are being used (ol_css = CSSSTYLE) +if (typeof ol_closeweight == 'undefined') { var ol_closeweight = "normal";} + + + +//////////////////////////////////////////////////////////////////////////////////// +// ARRAY CONFIGURATION +// You don't have to change anything here if you don't want to. The following +// arrays can be filled with text and html if you don't wish to pass it from +// your html page. +//////////////////////////////////////////////////////////////////////////////////// + +// Array with texts. +if (typeof ol_texts == 'undefined') { var ol_texts = new Array("Text 0", "Text 1"); } + +// Array with captions. +if (typeof ol_caps == 'undefined') { var ol_caps = new Array("Caption 0", "Caption 1"); } + + +//////////////////////////////////////////////////////////////////////////////////// +// END CONFIGURATION +// Don't change anything below this line, all configuration is above. +//////////////////////////////////////////////////////////////////////////////////// + + + + + + + +//////////////////////////////////////////////////////////////////////////////////// +// INIT +//////////////////////////////////////////////////////////////////////////////////// + +// Runtime variables init. Used for runtime only, don't change, not for config! +var o3_text = ""; +var o3_cap = ""; +var o3_sticky = 0; +var o3_background = ""; +var o3_close = "Close"; +var o3_hpos = RIGHT; +var o3_offsetx = 2; +var o3_offsety = 2; +var o3_fgcolor = ""; +var o3_bgcolor = ""; +var o3_textcolor = ""; +var o3_capcolor = ""; +var o3_closecolor = ""; +var o3_width = 100; +var o3_border = 1; +var o3_status = ""; +var o3_autostatus = 0; +var o3_height = -1; +var o3_snapx = 0; +var o3_snapy = 0; +var o3_fixx = -1; +var o3_fixy = -1; +var o3_fgbackground = ""; +var o3_bgbackground = ""; +var o3_padxl = 0; +var o3_padxr = 0; +var o3_padyt = 0; +var o3_padyb = 0; +var o3_fullhtml = 0; +var o3_vpos = BELOW; +var o3_aboveheight = 0; +var o3_capicon = ""; +var o3_textfont = "Verdana,Arial,Helvetica"; +var o3_captionfont = "Verdana,Arial,Helvetica"; +var o3_closefont = "Verdana,Arial,Helvetica"; +var o3_textsize = "1"; +var o3_captionsize = "1"; +var o3_closesize = "1"; +var o3_frame = self; +var o3_timeout = 0; +var o3_timerid = 0; +var o3_allowmove = 0; +var o3_function = Function(); +var o3_delay = 0; +var o3_delayid = 0; +var o3_hauto = 0; +var o3_vauto = 0; +var o3_closeclick = 0; + +var o3_css = CSSOFF; +var o3_fgclass = ""; +var o3_bgclass = ""; +var o3_textfontclass = ""; +var o3_captionfontclass = ""; +var o3_closefontclass = ""; +var o3_padunit = "px"; +var o3_heightunit = "px"; +var o3_widthunit = "px"; +var o3_textsizeunit = "px"; +var o3_textdecoration = ""; +var o3_textstyle = ""; +var o3_textweight = ""; +var o3_captionsizeunit = "px"; +var o3_captiondecoration = ""; +var o3_captionstyle = ""; +var o3_captionweight = ""; +var o3_closesizeunit = "px"; +var o3_closedecoration = ""; +var o3_closestyle = ""; +var o3_closeweight = ""; + + + +// Display state variables +var o3_x = 0; +var o3_y = 0; +var o3_allow = 0; +var o3_showingsticky = 0; +var o3_removecounter = 0; + +// Our layer +var over = null; + + +// Decide browser version +var ns4 = (document.layers)? true:false; +var ns6 = (document.getElementById)? true:false; +var ie4 = (document.all)? true:false; +var ie5 = false; + +// Microsoft Stupidity Check(tm). +if (ie4) { + if ((navigator.userAgent.indexOf('MSIE 5') > 0) || (navigator.userAgent.indexOf('MSIE 6') > 0)) { + ie5 = true; + } + if (ns6) { + ns6 = false; + } +} + + +// Capture events, alt. diffuses the overlib function. +if ( (ns4) || (ie4) || (ns6)) { + document.onmousemove = mouseMove + if (ns4) document.captureEvents(Event.MOUSEMOVE) +} else { + overlib = no_overlib; + nd = no_overlib; + ver3fix = true; +} + + +// Fake function for 3.0 users. +function no_overlib() { + return ver3fix; +} + + + +//////////////////////////////////////////////////////////////////////////////////// +// PUBLIC FUNCTIONS +//////////////////////////////////////////////////////////////////////////////////// + + +// overlib(arg0, ..., argN) +// Loads parameters into global runtime variables. +function overlib() { + + // Load defaults to runtime. + o3_text = ol_text; + o3_cap = ol_cap; + o3_sticky = ol_sticky; + o3_background = ol_background; + o3_close = ol_close; + o3_hpos = ol_hpos; + o3_offsetx = ol_offsetx; + o3_offsety = ol_offsety; + o3_fgcolor = ol_fgcolor; + o3_bgcolor = ol_bgcolor; + o3_textcolor = ol_textcolor; + o3_capcolor = ol_capcolor; + o3_closecolor = ol_closecolor; + o3_width = ol_width; + o3_border = ol_border; + o3_status = ol_status; + o3_autostatus = ol_autostatus; + o3_height = ol_height; + o3_snapx = ol_snapx; + o3_snapy = ol_snapy; + o3_fixx = ol_fixx; + o3_fixy = ol_fixy; + o3_fgbackground = ol_fgbackground; + o3_bgbackground = ol_bgbackground; + o3_padxl = ol_padxl; + o3_padxr = ol_padxr; + o3_padyt = ol_padyt; + o3_padyb = ol_padyb; + o3_fullhtml = ol_fullhtml; + o3_vpos = ol_vpos; + o3_aboveheight = ol_aboveheight; + o3_capicon = ol_capicon; + o3_textfont = ol_textfont; + o3_captionfont = ol_captionfont; + o3_closefont = ol_closefont; + o3_textsize = ol_textsize; + o3_captionsize = ol_captionsize; + o3_closesize = ol_closesize; + o3_timeout = ol_timeout; + o3_function = ol_function; + o3_delay = ol_delay; + o3_hauto = ol_hauto; + o3_vauto = ol_vauto; + o3_closeclick = ol_closeclick; + + o3_css = ol_css; + o3_fgclass = ol_fgclass; + o3_bgclass = ol_bgclass; + o3_textfontclass = ol_textfontclass; + o3_captionfontclass = ol_captionfontclass; + o3_closefontclass = ol_closefontclass; + o3_padunit = ol_padunit; + o3_heightunit = ol_heightunit; + o3_widthunit = ol_widthunit; + o3_textsizeunit = ol_textsizeunit; + o3_textdecoration = ol_textdecoration; + o3_textstyle = ol_textstyle; + o3_textweight = ol_textweight; + o3_captionsizeunit = ol_captionsizeunit; + o3_captiondecoration = ol_captiondecoration; + o3_captionstyle = ol_captionstyle; + o3_captionweight = ol_captionweight; + o3_closesizeunit = ol_closesizeunit; + o3_closedecoration = ol_closedecoration; + o3_closestyle = ol_closestyle; + o3_closeweight = ol_closeweight; + + + // Special for frame support, over must be reset... + if ( (ns4) || (ie4) || (ns6) ) { + o3_frame = ol_frame; + if (ns4) over = o3_frame.document.overDiv + if (ie4) over = o3_frame.overDiv.style + if (ns6) over = o3_frame.document.getElementById("overDiv"); + } + + + // What the next argument is expected to be. + var parsemode = -1; + + var ar = arguments; + + for (i = 0; i < ar.length; i++) { + + if (parsemode < 0) { + // Arg is maintext, unless INARRAY + if (ar[i] == INARRAY) { + o3_text = ol_texts[ar[++i]]; + } else { + o3_text = ar[i]; + } + + parsemode = 0; + } else { + // Note: NS4 doesn't like switch cases with vars. + if (ar[i] == INARRAY) { o3_text = ol_texts[ar[++i]]; continue; } + if (ar[i] == CAPARRAY) { o3_cap = ol_caps[ar[++i]]; continue; } + if (ar[i] == STICKY) { o3_sticky = 1; continue; } + if (ar[i] == BACKGROUND) { o3_background = ar[++i]; continue; } + if (ar[i] == NOCLOSE) { o3_close = ""; continue; } + if (ar[i] == CAPTION) { o3_cap = ar[++i]; continue; } + if (ar[i] == CENTER || ar[i] == LEFT || ar[i] == RIGHT) { o3_hpos = ar[i]; continue; } + if (ar[i] == OFFSETX) { o3_offsetx = ar[++i]; continue; } + if (ar[i] == OFFSETY) { o3_offsety = ar[++i]; continue; } + if (ar[i] == FGCOLOR) { o3_fgcolor = ar[++i]; continue; } + if (ar[i] == BGCOLOR) { o3_bgcolor = ar[++i]; continue; } + if (ar[i] == TEXTCOLOR) { o3_textcolor = ar[++i]; continue; } + if (ar[i] == CAPCOLOR) { o3_capcolor = ar[++i]; continue; } + if (ar[i] == CLOSECOLOR) { o3_closecolor = ar[++i]; continue; } + if (ar[i] == WIDTH) { o3_width = ar[++i]; continue; } + if (ar[i] == BORDER) { o3_border = ar[++i]; continue; } + if (ar[i] == STATUS) { o3_status = ar[++i]; continue; } + if (ar[i] == AUTOSTATUS) { o3_autostatus = 1; continue; } + if (ar[i] == AUTOSTATUSCAP) { o3_autostatus = 2; continue; } + if (ar[i] == HEIGHT) { o3_height = ar[++i]; o3_aboveheight = ar[i]; continue; } // Same param again. + if (ar[i] == CLOSETEXT) { o3_close = ar[++i]; continue; } + if (ar[i] == SNAPX) { o3_snapx = ar[++i]; continue; } + if (ar[i] == SNAPY) { o3_snapy = ar[++i]; continue; } + if (ar[i] == FIXX) { o3_fixx = ar[++i]; continue; } + if (ar[i] == FIXY) { o3_fixy = ar[++i]; continue; } + if (ar[i] == FGBACKGROUND) { o3_fgbackground = ar[++i]; continue; } + if (ar[i] == BGBACKGROUND) { o3_bgbackground = ar[++i]; continue; } + if (ar[i] == PADX) { o3_padxl = ar[++i]; o3_padxr = ar[++i]; continue; } + if (ar[i] == PADY) { o3_padyt = ar[++i]; o3_padyb = ar[++i]; continue; } + if (ar[i] == FULLHTML) { o3_fullhtml = 1; continue; } + if (ar[i] == BELOW || ar[i] == ABOVE) { o3_vpos = ar[i]; continue; } + if (ar[i] == CAPICON) { o3_capicon = ar[++i]; continue; } + if (ar[i] == TEXTFONT) { o3_textfont = ar[++i]; continue; } + if (ar[i] == CAPTIONFONT) { o3_captionfont = ar[++i]; continue; } + if (ar[i] == CLOSEFONT) { o3_closefont = ar[++i]; continue; } + if (ar[i] == TEXTSIZE) { o3_textsize = ar[++i]; continue; } + if (ar[i] == CAPTIONSIZE) { o3_captionsize = ar[++i]; continue; } + if (ar[i] == CLOSESIZE) { o3_closesize = ar[++i]; continue; } + if (ar[i] == FRAME) { opt_FRAME(ar[++i]); continue; } + if (ar[i] == TIMEOUT) { o3_timeout = ar[++i]; continue; } + if (ar[i] == FUNCTION) { opt_FUNCTION(ar[++i]); continue; } + if (ar[i] == DELAY) { o3_delay = ar[++i]; continue; } + if (ar[i] == HAUTO) { o3_hauto = (o3_hauto == 0) ? 1 : 0; continue; } + if (ar[i] == VAUTO) { o3_vauto = (o3_vauto == 0) ? 1 : 0; continue; } + if (ar[i] == CLOSECLICK) { o3_closeclick = (o3_closeclick == 0) ? 1 : 0; continue; } + if (ar[i] == CSSOFF) { o3_css = ar[i]; continue; } + if (ar[i] == CSSSTYLE) { o3_css = ar[i]; continue; } + if (ar[i] == CSSCLASS) { o3_css = ar[i]; continue; } + if (ar[i] == FGCLASS) { o3_fgclass = ar[++i]; continue; } + if (ar[i] == BGCLASS) { o3_bgclass = ar[++i]; continue; } + if (ar[i] == TEXTFONTCLASS) { o3_textfontclass = ar[++i]; continue; } + if (ar[i] == CAPTIONFONTCLASS) { o3_captionfontclass = ar[++i]; continue; } + if (ar[i] == CLOSEFONTCLASS) { o3_closefontclass = ar[++i]; continue; } + if (ar[i] == PADUNIT) { o3_padunit = ar[++i]; continue; } + if (ar[i] == HEIGHTUNIT) { o3_heightunit = ar[++i]; continue; } + if (ar[i] == WIDTHUNIT) { o3_widthunit = ar[++i]; continue; } + if (ar[i] == TEXTSIZEUNIT) { o3_textsizeunit = ar[++i]; continue; } + if (ar[i] == TEXTDECORATION) { o3_textdecoration = ar[++i]; continue; } + if (ar[i] == TEXTSTYLE) { o3_textstyle = ar[++i]; continue; } + if (ar[i] == TEXTWEIGHT) { o3_textweight = ar[++i]; continue; } + if (ar[i] == CAPTIONSIZEUNIT) { o3_captionsizeunit = ar[++i]; continue; } + if (ar[i] == CAPTIONDECORATION) { o3_captiondecoration = ar[++i]; continue; } + if (ar[i] == CAPTIONSTYLE) { o3_captionstyle = ar[++i]; continue; } + if (ar[i] == CAPTIONWEIGHT) { o3_captionweight = ar[++i]; continue; } + if (ar[i] == CLOSESIZEUNIT) { o3_closesizeunit = ar[++i]; continue; } + if (ar[i] == CLOSEDECORATION) { o3_closedecoration = ar[++i]; continue; } + if (ar[i] == CLOSESTYLE) { o3_closestyle = ar[++i]; continue; } + if (ar[i] == CLOSEWEIGHT) { o3_closeweight = ar[++i]; continue; } + } + } + + if (o3_delay == 0) { + return overlib350(); + } else { + o3_delayid = setTimeout("overlib350()", o3_delay); + + if (o3_sticky) { + return false; + } else { + return true; + } + } +} + + + +// Clears popups if appropriate +function nd() { + if ( o3_removecounter >= 1 ) { o3_showingsticky = 0 }; + if ( (ns4) || (ie4) || (ns6) ) { + if ( o3_showingsticky == 0 ) { + o3_allowmove = 0; + if (over != null) hideObject(over); + } else { + o3_removecounter++; + } + } + + return true; +} + + + + + + + +//////////////////////////////////////////////////////////////////////////////////// +// OVERLIB 3.50 FUNCTION +//////////////////////////////////////////////////////////////////////////////////// + + +// This function decides what it is we want to display and how we want it done. +function overlib350() { + + // Make layer content + var layerhtml; + + if (o3_background != "" || o3_fullhtml) { + // Use background instead of box. + layerhtml = ol_content_background(o3_text, o3_background, o3_fullhtml); + } else { + // They want a popup box. + + // Prepare popup background + if (o3_fgbackground != "" && o3_css == CSSOFF) { + o3_fgbackground = "BACKGROUND=\""+o3_fgbackground+"\""; + } + if (o3_bgbackground != "" && o3_css == CSSOFF) { + o3_bgbackground = "BACKGROUND=\""+o3_bgbackground+"\""; + } + + // Prepare popup colors + if (o3_fgcolor != "" && o3_css == CSSOFF) { + o3_fgcolor = "BGCOLOR=\""+o3_fgcolor+"\""; + } + if (o3_bgcolor != "" && o3_css == CSSOFF) { + o3_bgcolor = "BGCOLOR=\""+o3_bgcolor+"\""; + } + + // Prepare popup height + if (o3_height > 0 && o3_css == CSSOFF) { + o3_height = "HEIGHT=" + o3_height; + } else { + o3_height = ""; + } + + // Decide which kinda box. + if (o3_cap == "") { + // Plain + layerhtml = ol_content_simple(o3_text); + } else { + // With caption + if (o3_sticky) { + // Show close text + layerhtml = ol_content_caption(o3_text, o3_cap, o3_close); + } else { + // No close text + layerhtml = ol_content_caption(o3_text, o3_cap, ""); + } + } + } + + // We want it to stick! + if (o3_sticky) { + o3_showingsticky = 1; + o3_removecounter = 0; + } + + // Write layer + layerWrite(layerhtml); + + // Prepare status bar + if (o3_autostatus > 0) { + o3_status = o3_text; + if (o3_autostatus > 1) { + o3_status = o3_cap; + } + } + + // When placing the layer the first time, even stickies may be moved. + o3_allowmove = 0; + + // Initiate a timer for timeout + if (o3_timeout > 0) { + if (o3_timerid > 0) clearTimeout(o3_timerid); + o3_timerid = setTimeout("cClick()", o3_timeout); + } + + // Show layer + disp(o3_status); + + // Stickies should stay where they are. + if (o3_sticky) { + o3_allowmove = 0; + return false; + } else { + return true; + } +} + + + +//////////////////////////////////////////////////////////////////////////////////// +// LAYER GENERATION FUNCTIONS +//////////////////////////////////////////////////////////////////////////////////// + +// Makes simple table without caption +function ol_content_simple(text) { + if (o3_css == CSSCLASS) txt = "
"+text+"
"; + if (o3_css == CSSSTYLE) txt = "
"+text+"
"; + if (o3_css == CSSOFF) txt = "
"+text+"
"; + + set_background(""); + return txt; +} + + + + +// Makes table with caption and optional close link +function ol_content_caption(text, title, close) { + closing = ""; + closeevent = "onMouseOver"; + + if (o3_closeclick == 1) closeevent = "onClick"; + if (o3_capicon != "") o3_capicon = " "; + + if (close != "") { + if (o3_css == CSSCLASS) closing = ""+close+""; + if (o3_css == CSSSTYLE) closing = ""+close+""; + if (o3_css == CSSOFF) closing = ""+close+""; + } + + if (o3_css == CSSCLASS) txt = "
"+closing+"
"+o3_capicon+title+"
"+text+"
"; + if (o3_css == CSSSTYLE) txt = "
"+closing+"
"+o3_capicon+title+"
"+text+"
"; + if (o3_css == CSSOFF) txt = "
"+closing+"
"+o3_capicon+title+"
"+text+"
"; + + set_background(""); + return txt; +} + +// Sets the background picture, padding and lots more. :) +function ol_content_background(text, picture, hasfullhtml) { + if (hasfullhtml) { + txt = text; + } else { + if (o3_css == CSSCLASS) txt = "
"+text+"
"; + if (o3_css == CSSSTYLE) txt = "
"+text+"
"; + if (o3_css == CSSOFF) txt = "
"+text+"
"; + } + set_background(picture); + return txt; +} + +// Loads a picture into the div. +function set_background(pic) { + if (pic == "") { + if (ie4) over.backgroundImage = "none"; + if (ns6) over.style.backgroundImage = "none"; + } else { + if (ns4) { + over.background.src = pic; + } else if (ie4) { + over.backgroundImage = "url("+pic+")"; + } else if (ns6) { + over.style.backgroundImage = "url("+pic+")"; + } + } +} + + + +//////////////////////////////////////////////////////////////////////////////////// +// HANDLING FUNCTIONS +//////////////////////////////////////////////////////////////////////////////////// + + +// Displays the popup +function disp(statustext) { + if ( (ns4) || (ie4) || (ns6) ) { + if (o3_allowmove == 0) { + placeLayer(); + showObject(over); + o3_allowmove = 1; + } + } + + if (statustext != "") { + self.status = statustext; + } +} + +// Decides where we want the popup. +function placeLayer() { + var placeX, placeY; + + // HORIZONTAL PLACEMENT + if (o3_fixx > -1) { + // Fixed position + placeX = o3_fixx; + } else { + winoffset = (ie4) ? o3_frame.document.body.scrollLeft : o3_frame.pageXOffset; + if (ie4) iwidth = o3_frame.document.body.clientWidth; + if (ns4) iwidth = o3_frame.innerWidth; // was screwed in mozilla, fixed now? + if (ns6) iwidth = o3_frame.outerWidth; + + // If HAUTO, decide what to use. + if (o3_hauto == 1) { + if ( (o3_x - winoffset) > ((eval(iwidth)) / 2)) { + o3_hpos = LEFT; + } else { + o3_hpos = RIGHT; + } + } + + // From mouse + if (o3_hpos == CENTER) { // Center + placeX = o3_x+o3_offsetx-(o3_width/2); + } + if (o3_hpos == RIGHT) { // Right + placeX = o3_x+o3_offsetx; + if ( (eval(placeX) + eval(o3_width)) > (winoffset + iwidth) ) { + placeX = iwidth + winoffset - o3_width; + if (placeX < 0) placeX = 0; + } + } + if (o3_hpos == LEFT) { // Left + placeX = o3_x-o3_offsetx-o3_width; + if (placeX < winoffset) placeX = winoffset; + } + + // Snapping! + if (o3_snapx > 1) { + var snapping = placeX % o3_snapx; + if (o3_hpos == LEFT) { + placeX = placeX - (o3_snapx + snapping); + } else { + // CENTER and RIGHT + placeX = placeX + (o3_snapx - snapping); + } + if (placeX < winoffset) placeX = winoffset; + } + } + + + + // VERTICAL PLACEMENT + if (o3_fixy > -1) { + // Fixed position + placeY = o3_fixy; + } else { + scrolloffset = (ie4) ? o3_frame.document.body.scrollTop : o3_frame.pageYOffset; + + // If VAUTO, decide what to use. + if (o3_vauto == 1) { + if (ie4) iheight = o3_frame.document.body.clientHeight; + if (ns4) iheight = o3_frame.innerHeight; + if (ns6) iheight = o3_frame.outerHeight; + + iheight = (eval(iheight)) / 2; + if ( (o3_y - scrolloffset) > iheight) { + o3_vpos = ABOVE; + } else { + o3_vpos = BELOW; + } + } + + + // From mouse + if (o3_vpos == ABOVE) { + if (o3_aboveheight == 0) { + var divref = (ie4) ? o3_frame.document.all['overDiv'] : over; + o3_aboveheight = (ns4) ? divref.clip.height : divref.offsetHeight; + } + + placeY = o3_y - (o3_aboveheight + o3_offsety); + if (placeY < scrolloffset) placeY = scrolloffset; + } else { + // BELOW + placeY = o3_y + o3_offsety; + } + + // Snapping! + if (o3_snapy > 1) { + var snapping = placeY % o3_snapy; + + if (o3_aboveheight > 0 && o3_vpos == ABOVE) { + placeY = placeY - (o3_snapy + snapping); + } else { + placeY = placeY + (o3_snapy - snapping); + } + + if (placeY < scrolloffset) placeY = scrolloffset; + } + } + + + // Actually move the object. + repositionTo(over, placeX, placeY); +} + + +// Moves the layer +function mouseMove(e) { + if ( (ns4) || (ns6) ) {o3_x=e.pageX; o3_y=e.pageY;} + if (ie4) {o3_x=event.x; o3_y=event.y;} + if (ie5) {o3_x=event.x+o3_frame.document.body.scrollLeft; o3_y=event.y+o3_frame.document.body.scrollTop;} + + if (o3_allowmove == 1) { + placeLayer(); + } +} + +// The Close onMouseOver function for stickies +function cClick() { + hideObject(over); + o3_showingsticky = 0; + + return false; +} + + +// Makes sure target frame has overLIB +function compatibleframe(frameid) { + if (ns4) { + if (typeof frameid.document.overDiv =='undefined') return false; + } else if (ie4) { + if (typeof frameid.document.all["overDiv"] =='undefined') return false; + } else if (ns6) { + if (frameid.document.getElementById('overDiv') == null) return false; + } + + return true; +} + + + +//////////////////////////////////////////////////////////////////////////////////// +// LAYER FUNCTIONS +//////////////////////////////////////////////////////////////////////////////////// + + +// Writes to a layer +function layerWrite(txt) { + txt += "\n"; + + if (ns4) { + var lyr = o3_frame.document.overDiv.document + + lyr.write(txt) + lyr.close() + } else if (ie4) { + o3_frame.document.all["overDiv"].innerHTML = txt + } else if (ns6) { + range = o3_frame.document.createRange(); + range.setStartBefore(over); + domfrag = range.createContextualFragment(txt); + while (over.hasChildNodes()) { + over.removeChild(over.lastChild); + } + over.appendChild(domfrag); + } +} + +// Make an object visible +function showObject(obj) { + if (ns4) obj.visibility = "show"; + else if (ie4) obj.visibility = "visible"; + else if (ns6) obj.style.visibility = "visible"; +} + +// Hides an object +function hideObject(obj) { + if (ns4) obj.visibility = "hide"; + else if (ie4) obj.visibility = "hidden"; + else if (ns6) obj.style.visibility = "hidden"; + + if (o3_timerid > 0) clearTimeout(o3_timerid); + if (o3_delayid > 0) clearTimeout(o3_delayid); + o3_timerid = 0; + o3_delayid = 0; + self.status = ""; +} + +// Move a layer +function repositionTo(obj,xL,yL) { + if ( (ns4) || (ie4) ) { + obj.left = xL; + obj.top = yL; + } else if (ns6) { + obj.style.left = xL + "px"; + obj.style.top = yL+ "px"; + } +} + + + + + +//////////////////////////////////////////////////////////////////////////////////// +// PARSER FUNCTIONS +//////////////////////////////////////////////////////////////////////////////////// + + +// Defines which frame we should point to. +function opt_FRAME(frm) { + o3_frame = compatibleframe(frm) ? frm : ol_frame; + + if ( (ns4) || (ie4 || (ns6)) ) { + if (ns4) over = o3_frame.document.overDiv; + if (ie4) over = o3_frame.overDiv.style; + if (ns6) over = o3_frame.document.getElementById("overDiv"); + } + + return 0; +} + +// Calls an external function +function opt_FUNCTION(callme) { + o3_text = callme() + return 0; +} + + + + +//end (For internal purposes.) +//////////////////////////////////////////////////////////////////////////////////// +// OVERLIB 2 COMPATABILITY FUNCTIONS +// If you aren't upgrading you can remove the below section. +//////////////////////////////////////////////////////////////////////////////////// + +// Converts old 0=left, 1=right and 2=center into constants. +function vpos_convert(d) { + if (d == 0) { + d = LEFT; + } else { + if (d == 1) { + d = RIGHT; + } else { + d = CENTER; + } + } + + return d; +} + +// Simple popup +function dts(d,text) { + o3_hpos = vpos_convert(d); + overlib(text, o3_hpos, CAPTION, ""); +} + +// Caption popup +function dtc(d,text, title) { + o3_hpos = vpos_convert(d); + overlib(text, CAPTION, title, o3_hpos); +} + +// Sticky +function stc(d,text, title) { + o3_hpos = vpos_convert(d); + overlib(text, CAPTION, title, o3_hpos, STICKY); +} + +// Simple popup right +function drs(text) { + dts(1,text); +} + +// Caption popup right +function drc(text, title) { + dtc(1,text,title); +} + +// Sticky caption right +function src(text,title) { + stc(1,text,title); +} + +// Simple popup left +function dls(text) { + dts(0,text); +} + +// Caption popup left +function dlc(text, title) { + dtc(0,text,title); +} + +// Sticky caption left +function slc(text,title) { + stc(0,text,title); +} + +// Simple popup center +function dcs(text) { + dts(2,text); +} + +// Caption popup center +function dcc(text, title) { + dtc(2,text,title); +} + +// Sticky caption center +function scc(text,title) { + stc(2,text,title); +} diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/plotdatasetcombinations.sxc Binary file java/cewolf-1.0/src/site/plotdatasetcombinations.sxc has changed diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/site.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/site.xml Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,32 @@ + + + + + Mojo + http://mojo.codehaus.org/images/mojo_logo.png + http://mojo.codehaus.org + + + Codehaus + http://mojo.codehaus.org/images/codehaus-small.png + http://www.codehaus.org + + + + + + + + + + + + + + + + + + ${reports} + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/taglib.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/taglib.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,461 @@ +Cewolf Tag Library

Cewolf Tag Library (0.13.0)

This tag library is designed to describe charts of all kinds.

+ <plot> +

+The plot tag is nested inside a complex chart to define a nested or layerd plot instance. +data +

Attributes
type
+The type of the plot. One of xyarea, xyline, xyshapesandlines , +scatter, xyverticalbar, step, candlestick, highlow, signal, +verticlebar, area, line, shapesandlines +
required=true
rtexprvalue=true
xaxislabel
+Title of the plot's x-axis. This attributes is +only used for horizontally combined charts. +
required=false
rtexprvalue=true
yaxislabel
+Title of the plot's y-axis. This attributes is +only used for vertically combined charts. +
required=false
rtexprvalue=true

+ <img> +

+ optional childs: + + <map>
+This tag is a specialized HTML img tag. It renders the chart +which has been specified by a <chart> tag in the same page. +map +

Attributes
renderer
+Path to rendering servlet. Any path that starts with a '/' is assumed to refer to a resource relative to web application root. Otherwise, the path is assumed to refer to resource relative to the current page directory. +
required=true
rtexprvalue=true
chartid
+The id of the chart to render. +
required=true
rtexprvalue=true
width
+Width of the rendered chart image in pixel. +
required=true
rtexprvalue=true
height
+Height of the rendered chart image in pixel. +
required=true
rtexprvalue=true
mime
+The MIME type of the image. Currently image/png (default),image/svg and image/jpeg are supported. +
default=image/png
required=false
rtexprvalue=true
alt
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
hspace
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
vspace
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
align
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
border
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
ismap
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
longdesc
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
usemap
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
class
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
dir
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
lang
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onclick
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
ondbclick
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onkeydown
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onkeypress
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onkeyup
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onmousedown
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onmousemove
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onmouseout
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onmouseover
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onmouseup
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
style
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
htmltitle
+Corresponds to appropriate HMTL <img> title attribute. +
required=false
rtexprvalue=true
removeAfterRender
+Remove image after rendering (defaults to false). WARNING. This may cause problems if your users expect to save the images or paste them into other applications such as WORD. +
required=false
rtexprvalue=true
forceSessionId
+Forces jsessionid to be added to image url. (Defaults to True) +
required=false
rtexprvalue=true
timeout
+Sets the timeout value used in the LongTermSessionStorage obj. Value is in seconds. Default is 5 Minutes. +
required=false
rtexprvalue=true

+ <imgurl> +

+This tag can be used as the src attribute of a HTML img tag. E.g.: +<img src='<imgurl chartid="foobar" renderer="cewolf" width="100" height="100"/>'> +If the var attribute is used the URL is exposed as a page attribute of type String. +img +

Attributes
var
+Name of the page scope attribute to hold the URL. If not specified the URL is printed to the page outstream. +
required=false
rtexprvalue=true
renderer
+Path to rendering servlet. Any path that starts with a '/' is assumed to refer to a resource relative to web application root. Otherwise, the path is assumed to refer to resource relative to the current page directory. +
required=true
rtexprvalue=true
chartid
+The id of the chart to render. +
required=true
rtexprvalue=true
width
+Width of the rendered chart image in pixel. +
required=true
rtexprvalue=true
height
+Height of the rendered chart image in pixel. +
required=true
rtexprvalue=true
mime
+The MIME type of the image. Currently image/png (default),image/svg and image/jpeg are supported. +
default=image/png
required=false
rtexprvalue=true

+ <chart> +

+ optional childs: + + <chartpostprocessor>
+Root tag of a chart description. + +data +chartpostprocessor +

Attributes
id
+ID under which the chart description bean will be stored in the +page to be found by the img tag. Beware of using an +ID which is not yet used for other beans in the page to avoid +compile errors. +
required=true
rtexprvalue=true
type
+Type of the chart. One of area, areaxy, horizontalbar, horizontalbar3d, +line, pie, scatter, stackedhorizontalbar, stackedverticalbar, +stackedverticalbar3d, timeseries, verticalbar, verticalbar3d, xy, +candlestick, highlow, gantt, wind, signal, verticalxybar, pie3d +
required=true
rtexprvalue=true
title
+Title of the chart which is displayed on the chart panel +above the plot pane. +
required=false
rtexprvalue=true
xaxislabel
+Title of the chart's x-axis. This attributes is +ignored if the type attribute of the parent chart tag is one +of pie3d or pie. +
required=false
rtexprvalue=true
yaxislabel
+Title of the chart's y-axis. This attributes is +ignored if the type attribute of the parent chart tag is one +of pie3d or pie. +
required=false
rtexprvalue=true
background
+Background image of the chart panel. The value of this +attribute is the filename of a graphics file relative to the web +application's root directory (e.g. /WEB-INF/img/bg.jpg). +The image must be loadable by the default java.awt.Toolkit of the +servlet container's JVM. +
required=false
rtexprvalue=true
backgroundimagealpha
+Chart's backgound alpha blending value as a float. Value ranges +from 0.0 to 1.0. +0.0 +/chart[backgroundimagealpha] +
type=java.lang.Float
default=0.0
required=false
rtexprvalue=true
antialias
+Antialiased rendering of the chart. +true +/chart[backgroundimagealpha] +
default=true
required=false
rtexprvalue=true
showlegend
+Boolean value to switch on or off the legend display inside of this panel. +true +
default=true
required=false
rtexprvalue=true
legendanchor
+Sets the anchor of the legend inside of the panel. Possible values +are 'north', 'south', 'west', 'east'. +Ignored if showlegned is 'false'. +'south' +
default='south'
required=false
rtexprvalue=true

+ <overlaidchart> +

+ optional childs: + + <chartpostprocessor>
+Root tag of a overlaid-chart description. + +data +chartpostprocessor +

Attributes
id
+ID under which the chart description bean will be stored in the +page to be found by the img tag. Beware of using an +ID which is not yet used for other beans in the page to avoid +compile errors. +
required=true
rtexprvalue=true
type
+Type of the chart. In this version only overlaidxy is supported. +
required=true
rtexprvalue=true
title
+Title of the chart which is displayed on the chart panel +above the plot pane. +
required=false
rtexprvalue=true
xaxistype
+Type of the domain axis. Possible values: date, number +
required=true
rtexprvalue=true
xaxislabel
+Title of the chart's x-axis. This attributes is +ignored if the type attribute of the parent chart tag is one +of pie3d or pie. +
required=false
rtexprvalue=true
yaxistype
+Type of the range axis. Possible values: date, number +
required=false
rtexprvalue=true
yaxislabel
+Title of the chart's y-axis. This attributes is +ignored if the type attribute of the parent chart tag is one +of pie3d or pie. +
required=false
rtexprvalue=true
background
+Background image of the chart panel. The value of this +attribute is the filename of a graphics file relative to the web +application's root directory (e.g. /WEB-INF/img/bg.jpg). +The image must be loadable by the default java.awt.Toolkit of the +servlet container's JVM. +
required=false
rtexprvalue=true
backgroundimagealpha
+Chart's backgound alpha blending value as a float. Value ranges +from 0.0 to 1.0. +0.0 +/chart[backgroundimagealpha] +
type=java.lang.Float
default=0.0
required=false
rtexprvalue=true
antialias
+Antialiased rendering of the chart. +true +/chart[backgroundimagealpha] +
default=true
required=false
rtexprvalue=true
showlegend
+Boolean value to switch on or off the legend display inside of this panel. +true +
default=true
required=false
rtexprvalue=true
legendanchor
+Sets the anchor of the legend inside of the panel. Possible values +are 'north', 'south', 'west', 'east'. +Ignored if showlegned is 'false'. +'south' +
default='south'
required=false
rtexprvalue=true

+ <combinedchart> +

+ optional childs: + + <chartpostprocessor>
+Root tag of a combined-chart description. + +plot +chartpostprocessor +

Attributes
id
+ID under which the chart description bean will be stored in the +page to be found by the img tag. Beware of using an +ID which is not yet used for other beans in the page to avoid +compile errors. +
required=true
rtexprvalue=true
type
+Type of the chart. One of combinedxy +
required=true
rtexprvalue=true
layout
+Layout of the chart. Either vertical or horizontal +
required=true
rtexprvalue=true
title
+Title of the chart which is displayed on the chart panel +above the plot pane. +
required=false
rtexprvalue=true
xaxislabel
+Title of the chart's x-axis. This attributes is +ignored if the type attribute of the parent chart tag is one +of pie3d or pie. +
required=false
rtexprvalue=true
yaxislabel
+Title of the chart's y-axis. This attributes is +ignored if the type attribute of the parent chart tag is one +of pie3d or pie. +
required=false
rtexprvalue=true
background
+Background image of the chart panel. The value of this +attribute is the filename of a graphics file relative to the web +application's root directory (e.g. /WEB-INF/img/bg.jpg). +The image must be loadable by the default java.awt.Toolkit of the +servlet container's JVM. +
required=false
rtexprvalue=true
backgroundimagealpha
+Chart's backgound alpha blending value as a float. Value ranges +from 0.0 to 1.0. +0.0 +/chart[backgroundimagealpha] +
type=java.lang.Float
default=0.0
required=false
rtexprvalue=true
antialias
+Antialiased rendering of the chart. +true +/chart[backgroundimagealpha] +
default=true
required=false
rtexprvalue=true
showlegend
+Boolean value to switch on or off the legend display inside of this panel. +true +
default=true
required=false
rtexprvalue=true
legendanchor
+Sets the anchor of the legend inside of the panel. Possible values +are 'north', 'south', 'west', 'east'. +Ignored if showlegned is 'false'. +'south' +
default='south'
required=false
rtexprvalue=true

+ <legend> +

+This tag is used to render the legend of a chart in a separate image. +It assumes that somewhere else in the JSP a chart tag defines a chart +with the same ID as this legend tag. +

Attributes
renderer
+Path to rendering servlet relative to web apps root URL +(e.g. servlet/cewolf). +
required=true
rtexprvalue=true
id
+ID under which the chart description bean will be stored in the +session to be found by the rendering servlet. Beware of using an +ID which is not yet used for other beans in the session to avoid +overriding. +
required=true
rtexprvalue=true
width
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
height
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
mime
+The MIME type of the image. Currently image/png (default) and image/svg are supported. +image/png +
default=image/png
required=false
rtexprvalue=true
alt
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
hspace
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
vspace
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
align
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
border
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
ismap
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
longdesc
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
usemap
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
class
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
dir
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
lang
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onclick
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
ondbclick
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onkeydown
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onkeypress
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onkeyup
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onmousedown
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onmousemove
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onmouseout
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onmouseover
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
onmouseup
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
style
+Corresponds to appropriate HMTL <img> attribute. +
required=false
rtexprvalue=true
htmltitle
+Corresponds to appropriate HMTL <img> title attribute. +
required=false
rtexprvalue=true
removeAfterRender
+Remove image after rendering (defaults to false). WARNING. This may cause problems if your users expect to save the images or paste them into other applications such as WORD. +
required=false
rtexprvalue=true
forceSessionId
+Forces jsessionid to be added to image url. (Defaults to True) +
required=false
rtexprvalue=true
timeout
+Sets the timeout value used in the LongTermSessionStorage obj. Value is in seconds. Default is 5 Minutes. +
required=false
rtexprvalue=true

+ <data> +

+ optional childs: + + <producer>
+A data tag provides all information needed to retrieve the data which are +needed by the chart. Current version only supports data provided by a +DatasetProducer. In future versions there will be tags to provide data +from a datasource (e.g. via SQL). +producer +

Attributes

+ <producer> +

+ optional childs: + + <param>
+A data tag provides all information needed to retrieve the data which are +needed by the chart. Current version only supports data provided by a +DatasetProducer. In future versions there will be tags to provide data +from a datasource (e.g. via SQL). +param +

Attributes
id
+ID under which an object of type DatasetProducer can be found in +pageContext. This object is used to retrieve the dataset of the chart. +
required=true
rtexprvalue=true
usecache
+Determines if formally produced data should be reused if possible. +true +
default=true
required=false
rtexprvalue=true

+ <chartpostprocessor> +

+ optional childs: + + <param>
+A chart postprocessor tag references an object of type ChartProstProcessor +which must be defined in pageContext under the provided ID. This object +is called back after chart generation to post process the chart in any +manner. +param +

Attributes
id
+ID under which an object of type ChartPostProcessor can be found in +pageContext. This object is used to postprocess the rendered chart. +
required=true
rtexprvalue=true

+ <param> +

+Name/value-pair to paramterize a surrounding tag whose handler must +implement the Parameterized interface. +

Attributes
name
+Name of the param +
required=true
rtexprvalue=true
value
+Value of the param. Must be serializable. +
type=java.io.Serializable
required=true
rtexprvalue=true

+ <gradientpaint> +

+The gradientpaint tag provides a way to fill a shape with a linear +color gradient pattern. If Point P1 with Color C1 and Point P2 with +Color C2 are specified in user space, the Color on the P1, P2 +connecting line is proportionally changed from C1 to C2. Any point +P not on the extended P1, P2 connecting line has the color of the +point P' that is the perpendicular projection of P on the extended P1, +P2 connecting line. Points on the extended line outside of the P1, +P2 segment can be colored in one of two ways. +<ul> +<li>If the gradient is cyclic then the points on the extended +P1, P2 connecting line cycle back and forth between the colors C1 +and C2. +<li>If the gradient is acyclic then points on the P1 side of +the segment have the constant Color C1 while points on the P2 side +have the constant Color C2. +The two colors are defined in a nested point tag of this tag. +point +

Attributes
cyclic
+Does the gradient cycle repeatedly between the two colors C1 and C2. +false +
default=false
required=false
rtexprvalue=true

+ <point> +

+Defines a point with x and y coordinates and a color. +colorpaint +

Attributes
x
+The x coordinate of the point. +
required=true
rtexprvalue=true
y
+The y coordinate of the point. +
required=true
rtexprvalue=true
color
+ +
required=false
rtexprvalue=true

+ <colorpaint> +

+Fills the area defined by the parent tag with a color. +

Attributes
color
+The color to be used to fill the parent tag's area. +The color definition is compatible with the +HTML one. E.g. black is '#000000' and red is '#FF0000'. However it +is possible to append two hex numbers for the alpha channel. Thus +'#FF000080' is red with alpha blending of 50%. +
required=true
rtexprvalue=true

+ <texturepaint> +

+The texturepaint tag provides a way to fill the area of the parent tag +with a texture that is specified as an image. The texture is anchored to +the upper left corner of the parent tags area. +

Attributes
image
+Image fo the texture. The value of this +attribute is the filename of a graphics file relative to the web +application's root directory (e.g. /WEB-INF/img/bg.jpg). +The image must be loadable by the default java.awt.Toolkit of the +servlet container's JVM. +
required=true
rtexprvalue=true
width
+The width of the texture. +
required=true
rtexprvalue=true
height
+The height of the texture. +
required=true
rtexprvalue=true

+ <map> +

+This tag defines an image and tooltip map for the parent img tag. +img +

Attributes
linkgeneratorid
+The ID of the class which implements the appropriate de.laures.cewolf.LinkGenerator. +
required=false
rtexprvalue=true
tooltipgeneratorid
+The ID of the class which implements the appropriate com.jrefinery.chart.tooltips.ToolTipGenerator. +
required=false
rtexprvalue=true

SourceForge Logo \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/tutorial.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/tutorial.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,54 @@ + + + + + + + + +

Tutorial

+

+Let us assume the following scenario in which Cewolf might be a solution.
+You have a running web application and you want a web page which shows statistics +about your page visits. You want to have a line chart which looks like the +one below (drag mouse to see image maps and tooltips). +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Step 1: Prepare your application >> + + \ No newline at end of file diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/tutorial/step1.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/tutorial/step1.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,44 @@ + + + + Cewolf Tutorial(1): Prepare Your Application + + + + +

+

Tutorial: Step 1

+

Prepare Your Application

+

If you have not downloaded the Cewolf distribution yet, this is the +point to do it (look at Download). Put the following JAR files of the /lib +directory into your web application's /WEB-INF/lib directory:

+
    +
  • jfreechart-*-demo.jar
  • +
  • jfreechart-*.jar
  • +
  • jcommon-*.jar
  • +
  • commons-logging.jar
  • +
  • cewolf.jar
  • +
  • batik-xml.jar
  • +
  • batik-util.jar
  • +
  • batik-svggen.jar
  • +
  • batik-dom.jar
  • +
  • batik-awt-util.jar
  • +
+

Put the file overlib.js from the /example directory into +your webapps root directory. This file is needed to provide tooltips for +image maps for Mozilla based browsers.

+

That should be all you have to do to prepare your application for +Cewolf usage. If you encounter any problems in using the Cewolf tags +(e.g. "No Tags" is displayed in your containers console) you can +additionally put the cewolf.tld (or cewolf-1.1.tld for +JSP 1.1 containers) file from the distribution's etc directory +into a directory of your choice under your web application's root and +reference this file as the cewolf tag library from your JSPs.

+

Step 2: Provide a DatasetProducer>>

+SourceForge Logo + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/tutorial/step2.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/tutorial/step2.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,138 @@ + + + + Cewolf Tutorial(2): Provide a DatasetProducer + + + + +

Tutorial: Step 2

+

Provide a DatasetProducer

+

As Cewolf uses a MVC (Model-View-Control) approach the data which +are shown in your chart are separated from the view defined in the JSP +page. So you can change them separately. To provide the chart with the +correct data you must provide an object which implements the interfacede.laures.cewolf.DatasetProducer. +This object is asked to produce data every time a new chart must be +rendered. Below you can see an example implementation of a +DatasetProducer which could be used to provide data needed for our +example scenario.

+

+
package de.laures.cewolf.example;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jfree.data.category.CategoryDataset;
+import org.jfree.data.category.DefaultCategoryDataset;
+
+import de.laures.cewolf.DatasetProduceException;
+import de.laures.cewolf.DatasetProducer;
+import de.laures.cewolf.links.CategoryItemLinkGenerator;
+import de.laures.cewolf.tooltips.CategoryToolTipGenerator;
+
+/** 
+ * An example data producer.
+ * @author  Guido Laures 
+ */
+public class PageViewCountData implements DatasetProducer, CategoryToolTipGenerator, CategoryItemLinkGenerator, Serializable {
+
+    private static final Log log = LogFactory.getLog(PageViewCountData.class);
+
+    // These values would normally not be hard coded but produced by
+    // some kind of data source like a database or a file
+    private final String[] categories =    {"mon", "tue", "wen", "thu", "fri", "sat", "sun"};
+    private final String[] seriesNames =    {"cewolfset.jsp", "tutorial.jsp", "testpage.jsp", "performancetest.jsp"};
+
+	/**
+	 *  Produces some random data.
+	 */
+    public Object produceDataset(Map params) throws DatasetProduceException {
+    	log.debug("producing data.");
+        DefaultCategoryDataset dataset = new DefaultCategoryDataset(){
+			/**
+			 * @see java.lang.Object#finalize()
+			 */
+			protected void finalize() throws Throwable {
+				super.finalize();
+				log.debug(this +" finalized.");
+			}
+        };
+        for (int series = 0; series < seriesNames.length; series ++) {
+            int lastY = (int)(Math.random() * 1000 + 1000);
+            for (int i = 0; i < categories.length; i++) {
+                final int y = lastY + (int)(Math.random() * 200 - 100);
+                lastY = y;
+                dataset.addValue(y, seriesNames[series], categories[i]);
+            }
+        }
+        return dataset;
+    }
+
+    /**
+     * This producer's data is invalidated after 5 seconds. By this method the
+     * producer can influence Cewolf's caching behaviour the way it wants to.
+     */
+	public boolean hasExpired(Map params, Date since) {		
+        log.debug(getClass().getName() + "hasExpired()");
+		return (System.currentTimeMillis() - since.getTime())  > 5000;
+	}
+
+	/**
+	 * Returns a unique ID for this DatasetProducer
+	 */
+	public String getProducerId() {
+		return "PageViewCountData DatasetProducer";
+	}
+
+    /**
+     * Returns a link target for a special data item.
+     */
+    public String generateLink(Object data, int series, Object category) {
+        return seriesNames[series];
+    }
+    
+	/**
+	 * @see java.lang.Object#finalize()
+	 */
+	protected void finalize() throws Throwable {
+		super.finalize();
+		log.debug(this + " finalized.");
+	}
+
+	/**
+	 * @see org.jfree.chart.tooltips.CategoryToolTipGenerator#generateToolTip(CategoryDataset, int, int)
+	 */
+	public String generateToolTip(CategoryDataset arg0, int series, int arg2) {
+		return seriesNames[series];
+	}
+
+}
+
+

As you can see this datasetproducer is not very useful. Normally +this class would try to access a datasource (e.g. a database) to access +the needed information. But to serve as an example it should do.

+

A DatasetProducer needs to implement three methods. The most +important one is the produceDataset() method which actually +produces the data which should be used to render a chart. This method +takes a parameter map which is filled by some special tags of the JSP +which will be explained later on.

+

The hasExpired() method is called by the Cewolf framework +if there already exits a data object produced by this producer in +Cewolf's data cache. When returning true the producer +signalizes that the data formerly used has expired.

+

By providing an unique ID via the getProducerId() method +the Cewolf framework identifies a producer type. Two producer instances +with the same ID are supposed to produce the same data.

+

Compile the class and put it in the correct folder structure under +your web application's /WEB-INF/classes directory to make it +available for your application.

+

Step 3: Install the Cewolf Servlet in your Web +Application>>

+SourceForge Logo + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/tutorial/step3.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/tutorial/step3.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,103 @@ + + + + Cewolf Tutorial(3): Install the Cewolf Servlet in your Web +Application + + + + +

Tutorial: Step 3

+

Install the Cewolf Servlet in your Web App

+

The rendering of the entire chart is finally provided via a servlet. +This has to be installed in your web application. Cewolf provides a +servlet class de.laures.cewolf.CewolfRenderer which does the +job.
+To configure your web application you have to edit the /WEB-INF/web.xml +file. Add the following lines to it:
+

+
<servlet>
<servlet-name>CewolfServlet</servlet-name>
<servlet-class>de.laures.cewolf.CewolfRenderer</servlet-class>
</servlet>
+Additionally you should provide a servlet-mapping to tell the container +which URL maps to your Cewolf rendering servlet.
+
<servlet-mapping>
<servlet-name>CewolfServlet</servlet-name>
+ <url-pattern>/cewolf/*</url-pattern>
</servlet-mapping>
+ + You also need to tell CeWolf to load on startup: +
 <load-on-startup>1</load-on-startup>
+To test the correct installation you should start your web app and try +to call the rendering servlet with a browser (e.g. +http://localhost:8080/myapp/cewolf?state). Cewolf should answer: "Cewolf +servlet up and running." + +Here is a copy of the example web.xml: +
<web-app>
+  <servlet>
+    <servlet-name>CewolfServlet</servlet-name>
+    <servlet-class>de.laures.cewolf.CewolfRenderer</servlet-class>
+	<!-- sets storage implementation -->
+    <init-param>
+        <param-name>storage</param-name>
+        <param-value>de.laures.cewolf.storage.TransientSessionStorage</param-value>
+    </init-param>
+	<!-- sets overlib.js location relative to webapp -->
+    <init-param>
+        <param-name>overliburl</param-name>
+        <param-value>etc/overlib.js</param-value>
+    </init-param>
+	<!-- turn on or off debugging logging -->
+    <init-param>
+        <param-name>debug</param-name>
+        <param-value>true</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>CewolfServlet</servlet-name>
+    <url-pattern>/cewolf/*</url-pattern>
+  </servlet-mapping>
+
+  <session-config>
+    <session-timeout>1</session-timeout>
+  </session-config>
+
+  <mime-mapping>
+      <extension>css</extension>
+      <mime-type>text/css</mime-type>
+  </mime-mapping>
+
+  <welcome-file-list>
+  	<welcome-file>
+      index.html
+    </welcome-file>
+  	<welcome-file>
+      index.htm
+    </welcome-file>
+  </welcome-file-list>
+  
+	<!-- resource-ref>
+	  <description>
+	    Resource reference to a factory for java.sql.Connection
+	    instances that may be used for talking to a particular
+	    database that is configured in the server.xml file.
+	  </description>
+	  <resource-ref-name>
+	    jdbc/testdb
+	  </resource-ref-name>
+	  <res-type>
+	    javax.sql.DataSource
+	  </res-type>
+	  <res-auth>
+	    Container
+	  </res-auth>
+	</resource-ref -->
+
+</web-app>
+
+ +

Step 4: Define the Chart in your JSP>>

+SourceForge Logo + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/tutorial/step4.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/tutorial/step4.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,27 @@ + + + + Cewolf Tutorial(4): Define the chart in your JSP + + + + +

Tutorial: Step 4

+

Define the chart in your JSP

+
<%@page contentType="text/html"%>
<%@taglib uri='/WEB-INF/cewolf.tld' prefix='cewolf' %>
<HTML>
<BODY>
<H1>Page View Statistics</H1>
<HR>
<jsp:useBean id="pageViews" class="de.laures.cewolf.example.PageViewCountData"/>
<cewolf:chart
id="line"
title="Page View Statistics"
type="line"
xaxislabel="Page"
yaxislabel="Views">
<cewolf:data>
<cewolf:producer id="pageViews"/>
</cewolf:data>
</cewolf:chart>
<p>
<cewolf:img chartid="line" renderer="cewolf" width="400" height="300"/>
<P>
</BODY>
</HTML>
+

As you can see there are different tags of the cewolf taglib +involved. The first <cewolf:chart> tag defines a chart with all +its parameters. The concrete rendering is handled by the +<cewolf:img> tag which adds the correct <img> tag in the +rendered HTML page. The connection between both cewolf tags inside the +JSP is specified by using the same id attributes.

+

When calling this JSP from a client browser you should see the page +view statistic chart. If you got a broken image have a look at your +container's log files.

+

Step 5: Create ImageMap and Tooltip +Information>>

+SourceForge Logo + + diff -r 1612dbcec451 -r 639991d0808a java/cewolf-1.0/src/site/tutorial/step5.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/cewolf-1.0/src/site/tutorial/step5.html Sat Feb 28 21:31:02 2009 +0100 @@ -0,0 +1,44 @@ + + + + Cewolf Tutorial(5): Create ImageMap and Tooltip Information + + + + +

Tutorial: Step 5

+

Create ImageMap and Tooltip Information

+

To provide your chart with additionnal tooltips and image map +information you have to provide an additional Java class or enhance an +existing one like the one below. In this tutorial we will add some +methods to the datasetproducer class which had been introduced at the +beginning of this tutorial.

+

+
...
public String generateLink(Object data, int series, Object category) {
return seriesNames[series];
}

public String generateToolTip(CategoryDataset arg0, int series, int arg2) {
return seriesNames[series];
}
...
+

As you can see it is very easy to implement a class that produces +image map and tooltips information. First of all it has to implement the +interfaces CategoryItemLinkGenerator and CategoryToolTipGenerator +(as it produces a CategoryDataset). For other data types refer to the cewolf java api.

+

To let your class produce links and tooltips for the chart image you +have to change the <cewolf:img> tag as follows:

+

+
<cewolf:img chartid="line" renderer="cewolf" width="400" height="300">
<cewolf:map id="pageViews"/>
</cewolf:img>
+

Reload your page and you will see tooltips and links on data points. +Internet Explorer browsers are handled slightly different as others as +they are able to render a tooltip based on the alt attribute +inside an image map. All other browser need the overlib.js for this. +Cewolf tries to determine the used browser and renders a correct page +transparently.

+

For further information on using Cewolf refer to the Tag Library Reference and the Cewolf JavaDoc.

+

If you want to see more examples of how to implement catchy charts +in your webapp, you should deploy the example webapp (downloadable from +the Cewolf home +page and have a look at its sourcecode.

+SourceForge Logo + +