1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/web.flyingsaucer/build.xml Wed Jan 05 16:59:54 2011 +0100
1.3 @@ -0,0 +1,48 @@
1.4 +<?xml version="1.0" encoding="UTF-8"?>
1.5 +<!--
1.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
1.7 +
1.8 +Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
1.9 +
1.10 +Oracle and Java are registered trademarks of Oracle and/or its affiliates.
1.11 +Other names may be trademarks of their respective owners.
1.12 +
1.13 +
1.14 +The contents of this file are subject to the terms of either the GNU
1.15 +General Public License Version 2 only ("GPL") or the Common
1.16 +Development and Distribution License("CDDL") (collectively, the
1.17 +"License"). You may not use this file except in compliance with the
1.18 +License. You can obtain a copy of the License at
1.19 +http://www.netbeans.org/cddl-gplv2.html
1.20 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
1.21 +specific language governing permissions and limitations under the
1.22 +License. When distributing the software, include this License Header
1.23 +Notice in each file and include the License file at
1.24 +nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
1.25 +particular file as subject to the "Classpath" exception as provided
1.26 +by Oracle in the GPL Version 2 section of the License file that
1.27 +accompanied this code. If applicable, add the following below the
1.28 +License Header, with the fields enclosed by brackets [] replaced by
1.29 +your own identifying information:
1.30 +"Portions Copyrighted [year] [name of copyright owner]"
1.31 +
1.32 +Contributor(s):
1.33 +
1.34 +The Original Software is NetBeans. The Initial Developer of the Original
1.35 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
1.36 +Microsystems, Inc. All Rights Reserved.
1.37 +
1.38 +If you wish your version of this file to be governed by only the CDDL
1.39 +or only the GPL Version 2, indicate your decision by adding
1.40 +"[Contributor] elects to include this software in this distribution
1.41 +under the [CDDL or GPL Version 2] license." If you do not indicate a
1.42 +single choice of license, a recipient has the option to distribute
1.43 +your version of this file under either the CDDL, the GPL Version 2 or
1.44 +to extend the choice of license to its licensees as provided above.
1.45 +However, if you add GPL Version 2 code and therefore, elected the GPL
1.46 +Version 2 license, then the option applies only if the new code is
1.47 +made subject to such option by the copyright holder.
1.48 +-->
1.49 +<project name="contrib/web.flyingsaucer" default="netbeans" basedir=".">
1.50 + <import file="../../nbbuild/templates/projectized.xml"/>
1.51 +</project>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/web.flyingsaucer/external/binaries-list Wed Jan 05 16:59:54 2011 +0100
2.3 @@ -0,0 +1,1 @@
2.4 +088E6306A7C88E3C3082AE548999025CB14002F1 core-rendererR8final.jar
2.5 \ No newline at end of file
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/web.flyingsaucer/external/flying-saucer-R8final-license.txt Wed Jan 05 16:59:54 2011 +0100
3.3 @@ -0,0 +1,513 @@
3.4 +Name: Flying Saucer XHTML Renderer
3.5 +Version: R8final
3.6 +License: LGPL-2.1
3.7 +OSR: 7225
3.8 +Files: core-rendererR8final.jar
3.9 +Description: Java XHTML+CSS renderer
3.10 +Origin: https://xhtmlrenderer.dev.java.net/
3.11 +Source: https://xhtmlrenderer.dev.java.net/
3.12 +
3.13 + GNU LESSER GENERAL PUBLIC LICENSE
3.14 + Version 2.1, February 1999
3.15 +
3.16 + Copyright (C) 1991, 1999 Free Software Foundation, Inc.
3.17 + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
3.18 + Everyone is permitted to copy and distribute verbatim copies
3.19 + of this license document, but changing it is not allowed.
3.20 +
3.21 +[This is the first released version of the Lesser GPL. It also counts
3.22 + as the successor of the GNU Library Public License, version 2, hence
3.23 + the version number 2.1.]
3.24 +
3.25 + Preamble
3.26 +
3.27 + The licenses for most software are designed to take away your
3.28 +freedom to share and change it. By contrast, the GNU General Public
3.29 +Licenses are intended to guarantee your freedom to share and change
3.30 +free software--to make sure the software is free for all its users.
3.31 +
3.32 + This license, the Lesser General Public License, applies to some
3.33 +specially designated software packages--typically libraries--of the
3.34 +Free Software Foundation and other authors who decide to use it. You
3.35 +can use it too, but we suggest you first think carefully about whether
3.36 +this license or the ordinary General Public License is the better
3.37 +strategy to use in any particular case, based on the explanations below.
3.38 +
3.39 + When we speak of free software, we are referring to freedom of use,
3.40 +not price. Our General Public Licenses are designed to make sure that
3.41 +you have the freedom to distribute copies of free software (and charge
3.42 +for this service if you wish); that you receive source code or can get
3.43 +it if you want it; that you can change the software and use pieces of
3.44 +it in new free programs; and that you are informed that you can do
3.45 +these things.
3.46 +
3.47 + To protect your rights, we need to make restrictions that forbid
3.48 +distributors to deny you these rights or to ask you to surrender these
3.49 +rights. These restrictions translate to certain responsibilities for
3.50 +you if you distribute copies of the library or if you modify it.
3.51 +
3.52 + For example, if you distribute copies of the library, whether gratis
3.53 +or for a fee, you must give the recipients all the rights that we gave
3.54 +you. You must make sure that they, too, receive or can get the source
3.55 +code. If you link other code with the library, you must provide
3.56 +complete object files to the recipients, so that they can relink them
3.57 +with the library after making changes to the library and recompiling
3.58 +it. And you must show them these terms so they know their rights.
3.59 +
3.60 + We protect your rights with a two-step method: (1) we copyright the
3.61 +library, and (2) we offer you this license, which gives you legal
3.62 +permission to copy, distribute and/or modify the library.
3.63 +
3.64 + To protect each distributor, we want to make it very clear that
3.65 +there is no warranty for the free library. Also, if the library is
3.66 +modified by someone else and passed on, the recipients should know
3.67 +that what they have is not the original version, so that the original
3.68 +author's reputation will not be affected by problems that might be
3.69 +introduced by others.
3.70 +
3.71 + Finally, software patents pose a constant threat to the existence of
3.72 +any free program. We wish to make sure that a company cannot
3.73 +effectively restrict the users of a free program by obtaining a
3.74 +restrictive license from a patent holder. Therefore, we insist that
3.75 +any patent license obtained for a version of the library must be
3.76 +consistent with the full freedom of use specified in this license.
3.77 +
3.78 + Most GNU software, including some libraries, is covered by the
3.79 +ordinary GNU General Public License. This license, the GNU Lesser
3.80 +General Public License, applies to certain designated libraries, and
3.81 +is quite different from the ordinary General Public License. We use
3.82 +this license for certain libraries in order to permit linking those
3.83 +libraries into non-free programs.
3.84 +
3.85 + When a program is linked with a library, whether statically or using
3.86 +a shared library, the combination of the two is legally speaking a
3.87 +combined work, a derivative of the original library. The ordinary
3.88 +General Public License therefore permits such linking only if the
3.89 +entire combination fits its criteria of freedom. The Lesser General
3.90 +Public License permits more lax criteria for linking other code with
3.91 +the library.
3.92 +
3.93 + We call this license the "Lesser" General Public License because it
3.94 +does Less to protect the user's freedom than the ordinary General
3.95 +Public License. It also provides other free software developers Less
3.96 +of an advantage over competing non-free programs. These disadvantages
3.97 +are the reason we use the ordinary General Public License for many
3.98 +libraries. However, the Lesser license provides advantages in certain
3.99 +special circumstances.
3.100 +
3.101 + For example, on rare occasions, there may be a special need to
3.102 +encourage the widest possible use of a certain library, so that it becomes
3.103 +a de-facto standard. To achieve this, non-free programs must be
3.104 +allowed to use the library. A more frequent case is that a free
3.105 +library does the same job as widely used non-free libraries. In this
3.106 +case, there is little to gain by limiting the free library to free
3.107 +software only, so we use the Lesser General Public License.
3.108 +
3.109 + In other cases, permission to use a particular library in non-free
3.110 +programs enables a greater number of people to use a large body of
3.111 +free software. For example, permission to use the GNU C Library in
3.112 +non-free programs enables many more people to use the whole GNU
3.113 +operating system, as well as its variant, the GNU/Linux operating
3.114 +system.
3.115 +
3.116 + Although the Lesser General Public License is Less protective of the
3.117 +users' freedom, it does ensure that the user of a program that is
3.118 +linked with the Library has the freedom and the wherewithal to run
3.119 +that program using a modified version of the Library.
3.120 +
3.121 + The precise terms and conditions for copying, distribution and
3.122 +modification follow. Pay close attention to the difference between a
3.123 +"work based on the library" and a "work that uses the library". The
3.124 +former contains code derived from the library, whereas the latter must
3.125 +be combined with the library in order to run.
3.126 +
3.127 + GNU LESSER GENERAL PUBLIC LICENSE
3.128 + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
3.129 +
3.130 + 0. This License Agreement applies to any software library or other
3.131 +program which contains a notice placed by the copyright holder or
3.132 +other authorized party saying it may be distributed under the terms of
3.133 +this Lesser General Public License (also called "this License").
3.134 +Each licensee is addressed as "you".
3.135 +
3.136 + A "library" means a collection of software functions and/or data
3.137 +prepared so as to be conveniently linked with application programs
3.138 +(which use some of those functions and data) to form executables.
3.139 +
3.140 + The "Library", below, refers to any such software library or work
3.141 +which has been distributed under these terms. A "work based on the
3.142 +Library" means either the Library or any derivative work under
3.143 +copyright law: that is to say, a work containing the Library or a
3.144 +portion of it, either verbatim or with modifications and/or translated
3.145 +straightforwardly into another language. (Hereinafter, translation is
3.146 +included without limitation in the term "modification".)
3.147 +
3.148 + "Source code" for a work means the preferred form of the work for
3.149 +making modifications to it. For a library, complete source code means
3.150 +all the source code for all modules it contains, plus any associated
3.151 +interface definition files, plus the scripts used to control compilation
3.152 +and installation of the library.
3.153 +
3.154 + Activities other than copying, distribution and modification are not
3.155 +covered by this License; they are outside its scope. The act of
3.156 +running a program using the Library is not restricted, and output from
3.157 +such a program is covered only if its contents constitute a work based
3.158 +on the Library (independent of the use of the Library in a tool for
3.159 +writing it). Whether that is true depends on what the Library does
3.160 +and what the program that uses the Library does.
3.161 +
3.162 + 1. You may copy and distribute verbatim copies of the Library's
3.163 +complete source code as you receive it, in any medium, provided that
3.164 +you conspicuously and appropriately publish on each copy an
3.165 +appropriate copyright notice and disclaimer of warranty; keep intact
3.166 +all the notices that refer to this License and to the absence of any
3.167 +warranty; and distribute a copy of this License along with the
3.168 +Library.
3.169 +
3.170 + You may charge a fee for the physical act of transferring a copy,
3.171 +and you may at your option offer warranty protection in exchange for a
3.172 +fee.
3.173 +
3.174 + 2. You may modify your copy or copies of the Library or any portion
3.175 +of it, thus forming a work based on the Library, and copy and
3.176 +distribute such modifications or work under the terms of Section 1
3.177 +above, provided that you also meet all of these conditions:
3.178 +
3.179 + a) The modified work must itself be a software library.
3.180 +
3.181 + b) You must cause the files modified to carry prominent notices
3.182 + stating that you changed the files and the date of any change.
3.183 +
3.184 + c) You must cause the whole of the work to be licensed at no
3.185 + charge to all third parties under the terms of this License.
3.186 +
3.187 + d) If a facility in the modified Library refers to a function or a
3.188 + table of data to be supplied by an application program that uses
3.189 + the facility, other than as an argument passed when the facility
3.190 + is invoked, then you must make a good faith effort to ensure that,
3.191 + in the event an application does not supply such function or
3.192 + table, the facility still operates, and performs whatever part of
3.193 + its purpose remains meaningful.
3.194 +
3.195 + (For example, a function in a library to compute square roots has
3.196 + a purpose that is entirely well-defined independent of the
3.197 + application. Therefore, Subsection 2d requires that any
3.198 + application-supplied function or table used by this function must
3.199 + be optional: if the application does not supply it, the square
3.200 + root function must still compute square roots.)
3.201 +
3.202 +These requirements apply to the modified work as a whole. If
3.203 +identifiable sections of that work are not derived from the Library,
3.204 +and can be reasonably considered independent and separate works in
3.205 +themselves, then this License, and its terms, do not apply to those
3.206 +sections when you distribute them as separate works. But when you
3.207 +distribute the same sections as part of a whole which is a work based
3.208 +on the Library, the distribution of the whole must be on the terms of
3.209 +this License, whose permissions for other licensees extend to the
3.210 +entire whole, and thus to each and every part regardless of who wrote
3.211 +it.
3.212 +
3.213 +Thus, it is not the intent of this section to claim rights or contest
3.214 +your rights to work written entirely by you; rather, the intent is to
3.215 +exercise the right to control the distribution of derivative or
3.216 +collective works based on the Library.
3.217 +
3.218 +In addition, mere aggregation of another work not based on the Library
3.219 +with the Library (or with a work based on the Library) on a volume of
3.220 +a storage or distribution medium does not bring the other work under
3.221 +the scope of this License.
3.222 +
3.223 + 3. You may opt to apply the terms of the ordinary GNU General Public
3.224 +License instead of this License to a given copy of the Library. To do
3.225 +this, you must alter all the notices that refer to this License, so
3.226 +that they refer to the ordinary GNU General Public License, version 2,
3.227 +instead of to this License. (If a newer version than version 2 of the
3.228 +ordinary GNU General Public License has appeared, then you can specify
3.229 +that version instead if you wish.) Do not make any other change in
3.230 +these notices.
3.231 +
3.232 + Once this change is made in a given copy, it is irreversible for
3.233 +that copy, so the ordinary GNU General Public License applies to all
3.234 +subsequent copies and derivative works made from that copy.
3.235 +
3.236 + This option is useful when you wish to copy part of the code of
3.237 +the Library into a program that is not a library.
3.238 +
3.239 + 4. You may copy and distribute the Library (or a portion or
3.240 +derivative of it, under Section 2) in object code or executable form
3.241 +under the terms of Sections 1 and 2 above provided that you accompany
3.242 +it with the complete corresponding machine-readable source code, which
3.243 +must be distributed under the terms of Sections 1 and 2 above on a
3.244 +medium customarily used for software interchange.
3.245 +
3.246 + If distribution of object code is made by offering access to copy
3.247 +from a designated place, then offering equivalent access to copy the
3.248 +source code from the same place satisfies the requirement to
3.249 +distribute the source code, even though third parties are not
3.250 +compelled to copy the source along with the object code.
3.251 +
3.252 + 5. A program that contains no derivative of any portion of the
3.253 +Library, but is designed to work with the Library by being compiled or
3.254 +linked with it, is called a "work that uses the Library". Such a
3.255 +work, in isolation, is not a derivative work of the Library, and
3.256 +therefore falls outside the scope of this License.
3.257 +
3.258 + However, linking a "work that uses the Library" with the Library
3.259 +creates an executable that is a derivative of the Library (because it
3.260 +contains portions of the Library), rather than a "work that uses the
3.261 +library". The executable is therefore covered by this License.
3.262 +Section 6 states terms for distribution of such executables.
3.263 +
3.264 + When a "work that uses the Library" uses material from a header file
3.265 +that is part of the Library, the object code for the work may be a
3.266 +derivative work of the Library even though the source code is not.
3.267 +Whether this is true is especially significant if the work can be
3.268 +linked without the Library, or if the work is itself a library. The
3.269 +threshold for this to be true is not precisely defined by law.
3.270 +
3.271 + If such an object file uses only numerical parameters, data
3.272 +structure layouts and accessors, and small macros and small inline
3.273 +functions (ten lines or less in length), then the use of the object
3.274 +file is unrestricted, regardless of whether it is legally a derivative
3.275 +work. (Executables containing this object code plus portions of the
3.276 +Library will still fall under Section 6.)
3.277 +
3.278 + Otherwise, if the work is a derivative of the Library, you may
3.279 +distribute the object code for the work under the terms of Section 6.
3.280 +Any executables containing that work also fall under Section 6,
3.281 +whether or not they are linked directly with the Library itself.
3.282 +
3.283 + 6. As an exception to the Sections above, you may also combine or
3.284 +link a "work that uses the Library" with the Library to produce a
3.285 +work containing portions of the Library, and distribute that work
3.286 +under terms of your choice, provided that the terms permit
3.287 +modification of the work for the customer's own use and reverse
3.288 +engineering for debugging such modifications.
3.289 +
3.290 + You must give prominent notice with each copy of the work that the
3.291 +Library is used in it and that the Library and its use are covered by
3.292 +this License. You must supply a copy of this License. If the work
3.293 +during execution displays copyright notices, you must include the
3.294 +copyright notice for the Library among them, as well as a reference
3.295 +directing the user to the copy of this License. Also, you must do one
3.296 +of these things:
3.297 +
3.298 + a) Accompany the work with the complete corresponding
3.299 + machine-readable source code for the Library including whatever
3.300 + changes were used in the work (which must be distributed under
3.301 + Sections 1 and 2 above); and, if the work is an executable linked
3.302 + with the Library, with the complete machine-readable "work that
3.303 + uses the Library", as object code and/or source code, so that the
3.304 + user can modify the Library and then relink to produce a modified
3.305 + executable containing the modified Library. (It is understood
3.306 + that the user who changes the contents of definitions files in the
3.307 + Library will not necessarily be able to recompile the application
3.308 + to use the modified definitions.)
3.309 +
3.310 + b) Use a suitable shared library mechanism for linking with the
3.311 + Library. A suitable mechanism is one that (1) uses at run time a
3.312 + copy of the library already present on the user's computer system,
3.313 + rather than copying library functions into the executable, and (2)
3.314 + will operate properly with a modified version of the library, if
3.315 + the user installs one, as long as the modified version is
3.316 + interface-compatible with the version that the work was made with.
3.317 +
3.318 + c) Accompany the work with a written offer, valid for at
3.319 + least three years, to give the same user the materials
3.320 + specified in Subsection 6a, above, for a charge no more
3.321 + than the cost of performing this distribution.
3.322 +
3.323 + d) If distribution of the work is made by offering access to copy
3.324 + from a designated place, offer equivalent access to copy the above
3.325 + specified materials from the same place.
3.326 +
3.327 + e) Verify that the user has already received a copy of these
3.328 + materials or that you have already sent this user a copy.
3.329 +
3.330 + For an executable, the required form of the "work that uses the
3.331 +Library" must include any data and utility programs needed for
3.332 +reproducing the executable from it. However, as a special exception,
3.333 +the materials to be distributed need not include anything that is
3.334 +normally distributed (in either source or binary form) with the major
3.335 +components (compiler, kernel, and so on) of the operating system on
3.336 +which the executable runs, unless that component itself accompanies
3.337 +the executable.
3.338 +
3.339 + It may happen that this requirement contradicts the license
3.340 +restrictions of other proprietary libraries that do not normally
3.341 +accompany the operating system. Such a contradiction means you cannot
3.342 +use both them and the Library together in an executable that you
3.343 +distribute.
3.344 +
3.345 + 7. You may place library facilities that are a work based on the
3.346 +Library side-by-side in a single library together with other library
3.347 +facilities not covered by this License, and distribute such a combined
3.348 +library, provided that the separate distribution of the work based on
3.349 +the Library and of the other library facilities is otherwise
3.350 +permitted, and provided that you do these two things:
3.351 +
3.352 + a) Accompany the combined library with a copy of the same work
3.353 + based on the Library, uncombined with any other library
3.354 + facilities. This must be distributed under the terms of the
3.355 + Sections above.
3.356 +
3.357 + b) Give prominent notice with the combined library of the fact
3.358 + that part of it is a work based on the Library, and explaining
3.359 + where to find the accompanying uncombined form of the same work.
3.360 +
3.361 + 8. You may not copy, modify, sublicense, link with, or distribute
3.362 +the Library except as expressly provided under this License. Any
3.363 +attempt otherwise to copy, modify, sublicense, link with, or
3.364 +distribute the Library is void, and will automatically terminate your
3.365 +rights under this License. However, parties who have received copies,
3.366 +or rights, from you under this License will not have their licenses
3.367 +terminated so long as such parties remain in full compliance.
3.368 +
3.369 + 9. You are not required to accept this License, since you have not
3.370 +signed it. However, nothing else grants you permission to modify or
3.371 +distribute the Library or its derivative works. These actions are
3.372 +prohibited by law if you do not accept this License. Therefore, by
3.373 +modifying or distributing the Library (or any work based on the
3.374 +Library), you indicate your acceptance of this License to do so, and
3.375 +all its terms and conditions for copying, distributing or modifying
3.376 +the Library or works based on it.
3.377 +
3.378 + 10. Each time you redistribute the Library (or any work based on the
3.379 +Library), the recipient automatically receives a license from the
3.380 +original licensor to copy, distribute, link with or modify the Library
3.381 +subject to these terms and conditions. You may not impose any further
3.382 +restrictions on the recipients' exercise of the rights granted herein.
3.383 +You are not responsible for enforcing compliance by third parties with
3.384 +this License.
3.385 +
3.386 + 11. If, as a consequence of a court judgment or allegation of patent
3.387 +infringement or for any other reason (not limited to patent issues),
3.388 +conditions are imposed on you (whether by court order, agreement or
3.389 +otherwise) that contradict the conditions of this License, they do not
3.390 +excuse you from the conditions of this License. If you cannot
3.391 +distribute so as to satisfy simultaneously your obligations under this
3.392 +License and any other pertinent obligations, then as a consequence you
3.393 +may not distribute the Library at all. For example, if a patent
3.394 +license would not permit royalty-free redistribution of the Library by
3.395 +all those who receive copies directly or indirectly through you, then
3.396 +the only way you could satisfy both it and this License would be to
3.397 +refrain entirely from distribution of the Library.
3.398 +
3.399 +If any portion of this section is held invalid or unenforceable under any
3.400 +particular circumstance, the balance of the section is intended to apply,
3.401 +and the section as a whole is intended to apply in other circumstances.
3.402 +
3.403 +It is not the purpose of this section to induce you to infringe any
3.404 +patents or other property right claims or to contest validity of any
3.405 +such claims; this section has the sole purpose of protecting the
3.406 +integrity of the free software distribution system which is
3.407 +implemented by public license practices. Many people have made
3.408 +generous contributions to the wide range of software distributed
3.409 +through that system in reliance on consistent application of that
3.410 +system; it is up to the author/donor to decide if he or she is willing
3.411 +to distribute software through any other system and a licensee cannot
3.412 +impose that choice.
3.413 +
3.414 +This section is intended to make thoroughly clear what is believed to
3.415 +be a consequence of the rest of this License.
3.416 +
3.417 + 12. If the distribution and/or use of the Library is restricted in
3.418 +certain countries either by patents or by copyrighted interfaces, the
3.419 +original copyright holder who places the Library under this License may add
3.420 +an explicit geographical distribution limitation excluding those countries,
3.421 +so that distribution is permitted only in or among countries not thus
3.422 +excluded. In such case, this License incorporates the limitation as if
3.423 +written in the body of this License.
3.424 +
3.425 + 13. The Free Software Foundation may publish revised and/or new
3.426 +versions of the Lesser General Public License from time to time.
3.427 +Such new versions will be similar in spirit to the present version,
3.428 +but may differ in detail to address new problems or concerns.
3.429 +
3.430 +Each version is given a distinguishing version number. If the Library
3.431 +specifies a version number of this License which applies to it and
3.432 +"any later version", you have the option of following the terms and
3.433 +conditions either of that version or of any later version published by
3.434 +the Free Software Foundation. If the Library does not specify a
3.435 +license version number, you may choose any version ever published by
3.436 +the Free Software Foundation.
3.437 +
3.438 + 14. If you wish to incorporate parts of the Library into other free
3.439 +programs whose distribution conditions are incompatible with these,
3.440 +write to the author to ask for permission. For software which is
3.441 +copyrighted by the Free Software Foundation, write to the Free
3.442 +Software Foundation; we sometimes make exceptions for this. Our
3.443 +decision will be guided by the two goals of preserving the free status
3.444 +of all derivatives of our free software and of promoting the sharing
3.445 +and reuse of software generally.
3.446 +
3.447 + NO WARRANTY
3.448 +
3.449 + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
3.450 +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
3.451 +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
3.452 +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
3.453 +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
3.454 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
3.455 +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
3.456 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
3.457 +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
3.458 +
3.459 + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
3.460 +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
3.461 +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
3.462 +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
3.463 +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
3.464 +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
3.465 +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
3.466 +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
3.467 +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
3.468 +DAMAGES.
3.469 +
3.470 + END OF TERMS AND CONDITIONS
3.471 +
3.472 + How to Apply These Terms to Your New Libraries
3.473 +
3.474 + If you develop a new library, and you want it to be of the greatest
3.475 +possible use to the public, we recommend making it free software that
3.476 +everyone can redistribute and change. You can do so by permitting
3.477 +redistribution under these terms (or, alternatively, under the terms of the
3.478 +ordinary General Public License).
3.479 +
3.480 + To apply these terms, attach the following notices to the library. It is
3.481 +safest to attach them to the start of each source file to most effectively
3.482 +convey the exclusion of warranty; and each file should have at least the
3.483 +"copyright" line and a pointer to where the full notice is found.
3.484 +
3.485 + <one line to give the library's name and a brief idea of what it does.>
3.486 + Copyright (C) <year> <name of author>
3.487 +
3.488 + This library is free software; you can redistribute it and/or
3.489 + modify it under the terms of the GNU Lesser General Public
3.490 + License as published by the Free Software Foundation; either
3.491 + version 2.1 of the License, or (at your option) any later version.
3.492 +
3.493 + This library is distributed in the hope that it will be useful,
3.494 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3.495 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3.496 + Lesser General Public License for more details.
3.497 +
3.498 + You should have received a copy of the GNU Lesser General Public
3.499 + License along with this library; if not, write to the Free Software
3.500 + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
3.501 +
3.502 +Also add information on how to contact you by electronic and paper mail.
3.503 +
3.504 +You should also get your employer (if you work as a programmer) or your
3.505 +school, if any, to sign a "copyright disclaimer" for the library, if
3.506 +necessary. Here is a sample; alter the names:
3.507 +
3.508 + Yoyodyne, Inc., hereby disclaims all copyright interest in the
3.509 + library `Frob' (a library for tweaking knobs) written by James Random Hacker.
3.510 +
3.511 + <signature of Ty Coon>, 1 April 1990
3.512 + Ty Coon, President of Vice
3.513 +
3.514 +That's all there is to it!
3.515 +
3.516 +
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/web.flyingsaucer/manifest.mf Wed Jan 05 16:59:54 2011 +0100
4.3 @@ -0,0 +1,6 @@
4.4 +Manifest-Version: 1.0
4.5 +OpenIDE-Module: org.netbeans.modules.web.flyingsaucer/1
4.6 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/web/flyingsaucer/Bundle.properties
4.7 +OpenIDE-Module-Implementation-Version: 1
4.8 +AutoUpdate-Show-In-Client: true
4.9 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/web.flyingsaucer/nbproject/project.properties Wed Jan 05 16:59:54 2011 +0100
5.3 @@ -0,0 +1,52 @@
5.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5.5 +#
5.6 +# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5.7 +#
5.8 +# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
5.9 +# Other names may be trademarks of their respective owners.
5.10 +#
5.11 +# The contents of this file are subject to the terms of either the GNU
5.12 +# General Public License Version 2 only ("GPL") or the Common
5.13 +# Development and Distribution License("CDDL") (collectively, the
5.14 +# "License"). You may not use this file except in compliance with the
5.15 +# License. You can obtain a copy of the License at
5.16 +# http://www.netbeans.org/cddl-gplv2.html
5.17 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
5.18 +# specific language governing permissions and limitations under the
5.19 +# License. When distributing the software, include this License Header
5.20 +# Notice in each file and include the License file at
5.21 +# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
5.22 +# particular file as subject to the "Classpath" exception as provided
5.23 +# by Oracle in the GPL Version 2 section of the License file that
5.24 +# accompanied this code. If applicable, add the following below the
5.25 +# License Header, with the fields enclosed by brackets [] replaced by
5.26 +# your own identifying information:
5.27 +# "Portions Copyrighted [year] [name of copyright owner]"
5.28 +#
5.29 +# Contributor(s):
5.30 +#
5.31 +# The Original Software is NetBeans. The Initial Developer of the Original
5.32 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
5.33 +# Microsystems, Inc. All Rights Reserved.
5.34 +#
5.35 +# If you wish your version of this file to be governed by only the CDDL
5.36 +# or only the GPL Version 2, indicate your decision by adding
5.37 +# "[Contributor] elects to include this software in this distribution
5.38 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
5.39 +# single choice of license, a recipient has the option to distribute
5.40 +# your version of this file under either the CDDL, the GPL Version 2 or
5.41 +# to extend the choice of license to its licensees as provided above.
5.42 +# However, if you add GPL Version 2 code and therefore, elected the GPL
5.43 +# Version 2 license, then the option applies only if the new code is
5.44 +# made subject to such option by the copyright holder.
5.45 +
5.46 +is.autoload=true
5.47 +javac.compilerargs=-Xlint -Xlint:-serial
5.48 +javac.source=1.5
5.49 +nbm.needs.restart=true
5.50 +release.external/core-rendererR8final.jar=modules/ext/core-renderer.jar
5.51 +
5.52 +# Fatal error: class com.lowagie.text.DocumentException not found
5.53 +# Warning: class com.lowagie.text.DocumentException not found. Please, add required jar or directory to the classpath.
5.54 +sigtest.gen.fail.on.error=false
5.55 +spec.version.base=1.12.0
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/web.flyingsaucer/nbproject/project.xml Wed Jan 05 16:59:54 2011 +0100
6.3 @@ -0,0 +1,101 @@
6.4 +<?xml version="1.0" encoding="UTF-8"?>
6.5 +<!--
6.6 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
6.7 +
6.8 +Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
6.9 +
6.10 +Oracle and Java are registered trademarks of Oracle and/or its affiliates.
6.11 +Other names may be trademarks of their respective owners.
6.12 +
6.13 +
6.14 +The contents of this file are subject to the terms of either the GNU
6.15 +General Public License Version 2 only ("GPL") or the Common
6.16 +Development and Distribution License("CDDL") (collectively, the
6.17 +"License"). You may not use this file except in compliance with the
6.18 +License. You can obtain a copy of the License at
6.19 +http://www.netbeans.org/cddl-gplv2.html
6.20 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
6.21 +specific language governing permissions and limitations under the
6.22 +License. When distributing the software, include this License Header
6.23 +Notice in each file and include the License file at
6.24 +nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
6.25 +particular file as subject to the "Classpath" exception as provided
6.26 +by Oracle in the GPL Version 2 section of the License file that
6.27 +accompanied this code. If applicable, add the following below the
6.28 +License Header, with the fields enclosed by brackets [] replaced by
6.29 +your own identifying information:
6.30 +"Portions Copyrighted [year] [name of copyright owner]"
6.31 +
6.32 +Contributor(s):
6.33 +
6.34 +The Original Software is NetBeans. The Initial Developer of the Original
6.35 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
6.36 +Microsystems, Inc. All Rights Reserved.
6.37 +
6.38 +If you wish your version of this file to be governed by only the CDDL
6.39 +or only the GPL Version 2, indicate your decision by adding
6.40 +"[Contributor] elects to include this software in this distribution
6.41 +under the [CDDL or GPL Version 2] license." If you do not indicate a
6.42 +single choice of license, a recipient has the option to distribute
6.43 +your version of this file under either the CDDL, the GPL Version 2 or
6.44 +to extend the choice of license to its licensees as provided above.
6.45 +However, if you add GPL Version 2 code and therefore, elected the GPL
6.46 +Version 2 license, then the option applies only if the new code is
6.47 +made subject to such option by the copyright holder.
6.48 +-->
6.49 +<project xmlns="http://www.netbeans.org/ns/project/1">
6.50 + <type>org.netbeans.modules.apisupport.project</type>
6.51 + <configuration>
6.52 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/2">
6.53 + <code-name-base>org.netbeans.modules.web.flyingsaucer</code-name-base>
6.54 + <module-dependencies>
6.55 + <dependency>
6.56 + <code-name-base>org.netbeans.modules.css.visual</code-name-base>
6.57 + <build-prerequisite/>
6.58 + <compile-dependency/>
6.59 + <run-dependency>
6.60 + <release-version>1</release-version>
6.61 + <specification-version>2.14</specification-version>
6.62 + </run-dependency>
6.63 + </dependency>
6.64 + <dependency>
6.65 + <code-name-base>org.netbeans.modules.web.common</code-name-base>
6.66 + <build-prerequisite/>
6.67 + <compile-dependency/>
6.68 + <run-dependency>
6.69 + <specification-version>1.8</specification-version>
6.70 + </run-dependency>
6.71 + </dependency>
6.72 + <dependency>
6.73 + <code-name-base>org.openide.filesystems</code-name-base>
6.74 + <build-prerequisite/>
6.75 + <compile-dependency/>
6.76 + <run-dependency>
6.77 + <specification-version>7.44</specification-version>
6.78 + </run-dependency>
6.79 + </dependency>
6.80 + <dependency>
6.81 + <code-name-base>org.openide.util</code-name-base>
6.82 + <build-prerequisite/>
6.83 + <compile-dependency/>
6.84 + <run-dependency>
6.85 + <specification-version>8.11</specification-version>
6.86 + </run-dependency>
6.87 + </dependency>
6.88 + <dependency>
6.89 + <code-name-base>org.openide.util.lookup</code-name-base>
6.90 + <build-prerequisite/>
6.91 + <compile-dependency/>
6.92 + <run-dependency>
6.93 + <specification-version>8.5</specification-version>
6.94 + </run-dependency>
6.95 + </dependency>
6.96 + </module-dependencies>
6.97 + <public-packages/>
6.98 + <class-path-extension>
6.99 + <runtime-relative-path>ext/core-renderer.jar</runtime-relative-path>
6.100 + <binary-origin>external/core-rendererR8final.jar</binary-origin>
6.101 + </class-path-extension>
6.102 + </data>
6.103 + </configuration>
6.104 +</project>
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/web.flyingsaucer/src/org/netbeans/modules/web/flyingsaucer/Bundle.properties Wed Jan 05 16:59:54 2011 +0100
7.3 @@ -0,0 +1,51 @@
7.4 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
7.5 +#
7.6 +# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
7.7 +#
7.8 +# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7.9 +# Other names may be trademarks of their respective owners.
7.10 +#
7.11 +# The contents of this file are subject to the terms of either the GNU
7.12 +# General Public License Version 2 only ("GPL") or the Common
7.13 +# Development and Distribution License("CDDL") (collectively, the
7.14 +# "License"). You may not use this file except in compliance with the
7.15 +# License. You can obtain a copy of the License at
7.16 +# http://www.netbeans.org/cddl-gplv2.html
7.17 +# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
7.18 +# specific language governing permissions and limitations under the
7.19 +# License. When distributing the software, include this License Header
7.20 +# Notice in each file and include the License file at
7.21 +# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
7.22 +# particular file as subject to the "Classpath" exception as provided
7.23 +# by Oracle in the GPL Version 2 section of the License file that
7.24 +# accompanied this code. If applicable, add the following below the
7.25 +# License Header, with the fields enclosed by brackets [] replaced by
7.26 +# your own identifying information:
7.27 +# "Portions Copyrighted [year] [name of copyright owner]"
7.28 +#
7.29 +# Contributor(s):
7.30 +#
7.31 +# The Original Software is NetBeans. The Initial Developer of the Original
7.32 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
7.33 +# Microsystems, Inc. All Rights Reserved.
7.34 +#
7.35 +# If you wish your version of this file to be governed by only the CDDL
7.36 +# or only the GPL Version 2, indicate your decision by adding
7.37 +# "[Contributor] elects to include this software in this distribution
7.38 +# under the [CDDL or GPL Version 2] license." If you do not indicate a
7.39 +# single choice of license, a recipient has the option to distribute
7.40 +# your version of this file under either the CDDL, the GPL Version 2 or
7.41 +# to extend the choice of license to its licensees as provided above.
7.42 +# However, if you add GPL Version 2 code and therefore, elected the GPL
7.43 +# Version 2 license, then the option applies only if the new code is
7.44 +# made subject to such option by the copyright holder.
7.45 +
7.46 +# module descritpion
7.47 +OpenIDE-Module-Name=CSS Preview by Flying Saucer Renderer
7.48 +OpenIDE-Module-Display-Category=Web
7.49 +OpenIDE-Module-Short-Description=Previews CSS documents using the Flying Saucer XHTML rendered
7.50 +OpenIDE-Module-Long-Description=\
7.51 + Previews CSS documents using the Flying Saucer XHTML rendered
7.52 +
7.53 +# library display name
7.54 +flyingsaucer=Flying Saucer
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/web.flyingsaucer/src/org/netbeans/modules/web/flyingsaucer/CssPreviewPanel.form Wed Jan 05 16:59:54 2011 +0100
8.3 @@ -0,0 +1,29 @@
8.4 +<?xml version="1.1" encoding="UTF-8" ?>
8.5 +
8.6 +<Form version="1.4" maxVersion="1.4" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
8.7 + <AuxValues>
8.8 + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
8.9 + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
8.10 + <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
8.11 + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
8.12 + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
8.13 + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
8.14 + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
8.15 + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
8.16 + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
8.17 + <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,16,0,0,1,-112"/>
8.18 + </AuxValues>
8.19 +
8.20 + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
8.21 + <SubComponents>
8.22 + <Container class="javax.swing.JScrollPane" name="jScrollPane1">
8.23 + <Constraints>
8.24 + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
8.25 + <BorderConstraints direction="Center"/>
8.26 + </Constraint>
8.27 + </Constraints>
8.28 +
8.29 + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
8.30 + </Container>
8.31 + </SubComponents>
8.32 +</Form>
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/web.flyingsaucer/src/org/netbeans/modules/web/flyingsaucer/CssPreviewPanel.java Wed Jan 05 16:59:54 2011 +0100
9.3 @@ -0,0 +1,393 @@
9.4 +/*
9.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
9.6 + *
9.7 + * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
9.8 + *
9.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
9.10 + * Other names may be trademarks of their respective owners.
9.11 + *
9.12 + * The contents of this file are subject to the terms of either the GNU
9.13 + * General Public License Version 2 only ("GPL") or the Common
9.14 + * Development and Distribution License("CDDL") (collectively, the
9.15 + * "License"). You may not use this file except in compliance with the
9.16 + * License. You can obtain a copy of the License at
9.17 + * http://www.netbeans.org/cddl-gplv2.html
9.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
9.19 + * specific language governing permissions and limitations under the
9.20 + * License. When distributing the software, include this License Header
9.21 + * Notice in each file and include the License file at
9.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
9.23 + * particular file as subject to the "Classpath" exception as provided
9.24 + * by Oracle in the GPL Version 2 section of the License file that
9.25 + * accompanied this code. If applicable, add the following below the
9.26 + * License Header, with the fields enclosed by brackets [] replaced by
9.27 + * your own identifying information:
9.28 + * "Portions Copyrighted [year] [name of copyright owner]"
9.29 + *
9.30 + * Contributor(s):
9.31 + *
9.32 + * The Original Software is NetBeans. The Initial Developer of the Original
9.33 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
9.34 + * Microsystems, Inc. All Rights Reserved.
9.35 + *
9.36 + * If you wish your version of this file to be governed by only the CDDL
9.37 + * or only the GPL Version 2, indicate your decision by adding
9.38 + * "[Contributor] elects to include this software in this distribution
9.39 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
9.40 + * single choice of license, a recipient has the option to distribute
9.41 + * your version of this file under either the CDDL, the GPL Version 2 or
9.42 + * to extend the choice of license to its licensees as provided above.
9.43 + * However, if you add GPL Version 2 code and therefore, elected the GPL
9.44 + * Version 2 license, then the option applies only if the new code is
9.45 + * made subject to such option by the copyright holder.
9.46 + */
9.47 +package org.netbeans.modules.web.flyingsaucer;
9.48 +
9.49 +import java.beans.PropertyChangeListener;
9.50 +import java.util.Collection;
9.51 +import java.util.LinkedList;
9.52 +import org.netbeans.modules.css.visual.api.CssPreviewComponent;
9.53 +import java.awt.Graphics;
9.54 +import java.io.StringReader;
9.55 +import java.net.MalformedURLException;
9.56 +import java.net.URISyntaxException;
9.57 +import java.net.URL;
9.58 +import java.util.concurrent.FutureTask;
9.59 +import java.util.logging.Level;
9.60 +import java.util.logging.Logger;
9.61 +import javax.swing.JComponent;
9.62 +import javax.swing.SwingUtilities;
9.63 +import org.netbeans.modules.css.visual.api.CssPreviewComponentFactory;
9.64 +import org.netbeans.modules.css.visual.api.CssPreviewComponentListener;
9.65 +import org.netbeans.modules.web.common.api.WebUtils;
9.66 +import org.openide.filesystems.FileObject;
9.67 +import org.openide.filesystems.URLMapper;
9.68 +import org.openide.util.RequestProcessor;
9.69 +import org.openide.util.lookup.ServiceProvider;
9.70 +import org.w3c.dom.Document;
9.71 +import org.xhtmlrenderer.extend.FSImage;
9.72 +import org.xhtmlrenderer.extend.UserAgentCallback;
9.73 +import org.xhtmlrenderer.resource.ImageResource;
9.74 +import org.xhtmlrenderer.resource.XMLResource;
9.75 +import org.xhtmlrenderer.simple.XHTMLPanel;
9.76 +import org.xhtmlrenderer.simple.extend.XhtmlNamespaceHandler;
9.77 +import org.xhtmlrenderer.swing.NaiveUserAgent;
9.78 +import org.xhtmlrenderer.util.XRLog;
9.79 +import org.xhtmlrenderer.util.XRLogger;
9.80 +import org.xml.sax.InputSource;
9.81 +
9.82 +/**
9.83 + * JPanel wrapping XHTMLPanel, the Flying Saucer's rendering area.
9.84 + * The class also suppresses exceptions falling from the renderer
9.85 + * so they are just logged, not displayed to user as exceptions.
9.86 + *
9.87 + * @author Marek Fukala
9.88 + */
9.89 +public class CssPreviewPanel extends javax.swing.JPanel implements CssPreviewComponent {
9.90 +
9.91 + private static final String EMPTY_DOCUMENT_CONTENT = "<html><head><title>empty document</title></head><body></body></html>"; //NOI18N
9.92 + private static final Logger LOGGER = Logger.getLogger(CssPreviewPanel.class.getName());
9.93 + private static final boolean LOG_FINE = LOGGER.isLoggable(Level.FINE);
9.94 + private XRLogger FS_HANDLER = new FlyingSaucerLoggersHandler();
9.95 + private PatchedXHTMLPanel xhtmlPanel;
9.96 + private Runnable panelCreatedTask;
9.97 + private final Collection<CssPreviewComponentListener> listeners = new LinkedList<CssPreviewComponentListener>();
9.98 +
9.99 + /** Creates new form CssPreviewPanel2 */
9.100 + public CssPreviewPanel() {
9.101 + initComponents();
9.102 + //run the xhtml panel creation in a non-AWT thread
9.103 + RequestProcessor.getDefault().execute(new FutureTask<XHTMLPanel>(new Runnable() {
9.104 +
9.105 + @Override
9.106 + public void run() {
9.107 + //create outside of AWT
9.108 + final PatchedXHTMLPanel panel = new PatchedXHTMLPanel(new PreviewUserAgent());
9.109 + //set own XRLogger, all FS logged events will go to our impl.
9.110 + XRLog.setLoggerImpl(FS_HANDLER);
9.111 + try {
9.112 + //call the setDocument(...) on the freshly created panel so all the resources
9.113 + //loading is done now and not later in EDT
9.114 + InputSource inputSource = new InputSource(new StringReader(EMPTY_DOCUMENT_CONTENT));
9.115 + panel.setDocument(inputSource, null);
9.116 + } catch (Exception ex) {
9.117 + //no-op
9.118 + }
9.119 + //and set the panel to this component in AWT
9.120 + SwingUtilities.invokeLater(new Runnable() {
9.121 +
9.122 + @Override
9.123 + public void run() {
9.124 + setXhtmlPanel(panel);
9.125 + }
9.126 + });
9.127 + }
9.128 + }, null));
9.129 +
9.130 + }
9.131 +
9.132 + private synchronized void setXhtmlPanel(PatchedXHTMLPanel panel) {
9.133 + assert SwingUtilities.isEventDispatchThread();
9.134 + this.xhtmlPanel = panel;
9.135 + jScrollPane1.setViewportView(panel);
9.136 + //set the content if some was already requested
9.137 + if (panelCreatedTask != null) {
9.138 + panelCreatedTask.run();
9.139 + //release the only once used runnable
9.140 + panelCreatedTask = null;
9.141 + }
9.142 + }
9.143 +
9.144 + @Override
9.145 + public synchronized void setDocument(final InputSource is, final String url) throws Exception {
9.146 + if (xhtmlPanel == null) {
9.147 + //early attempt to set a document content, the xhtml panel initialization
9.148 + //is still running
9.149 + panelCreatedTask = new Runnable() {
9.150 +
9.151 + @Override
9.152 + public void run() {
9.153 + //call it in non-AWT thread, it may take some time
9.154 + RequestProcessor.getDefault().post(new Runnable() {
9.155 +
9.156 + @Override
9.157 + public void run() {
9.158 + try {
9.159 + doSetDocument(is, url);
9.160 + //repaing the panel in AWT then
9.161 + SwingUtilities.invokeLater(new Runnable() {
9.162 +
9.163 + @Override
9.164 + public void run() {
9.165 + xhtmlPanel.revalidate();
9.166 + xhtmlPanel.repaint();
9.167 + }
9.168 +
9.169 + });
9.170 + } catch (Exception ex) {
9.171 + LOGGER.log(Level.INFO, "Error setting the document to be previewed!", ex); //NOI18N
9.172 + }
9.173 + }
9.174 + });
9.175 + }
9.176 +
9.177 + };
9.178 + } else {
9.179 + //and set the document to he renderer
9.180 + doSetDocument(is, url);
9.181 + }
9.182 + }
9.183 +
9.184 + private void doSetDocument(InputSource inputSource, String url) throws Exception {
9.185 + xhtmlPanel.setDocument(inputSource, url);
9.186 + }
9.187 +
9.188 + @Override
9.189 + public JComponent getComponent() {
9.190 + return this;
9.191 + }
9.192 +
9.193 + @Override
9.194 + public void dispose() {
9.195 + // nothing to dispose here
9.196 + }
9.197 +
9.198 + /** This method is called from within the constructor to
9.199 + * initialize the form.
9.200 + * WARNING: Do NOT modify this code. The content of this method is
9.201 + * always regenerated by the Form Editor.
9.202 + */
9.203 + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
9.204 + private void initComponents() {
9.205 +
9.206 + jScrollPane1 = new javax.swing.JScrollPane();
9.207 +
9.208 + setLayout(new java.awt.BorderLayout());
9.209 + add(jScrollPane1, java.awt.BorderLayout.CENTER);
9.210 + }// </editor-fold>//GEN-END:initComponents
9.211 + // Variables declaration - do not modify//GEN-BEGIN:variables
9.212 + private javax.swing.JScrollPane jScrollPane1;
9.213 + // End of variables declaration//GEN-END:variables
9.214 +
9.215 + @Override
9.216 + public void addListener(CssPreviewComponentListener listener) {
9.217 + synchronized (listeners) {
9.218 + listeners.add(listener);
9.219 + }
9.220 + }
9.221 +
9.222 + @Override
9.223 + public void removeListener(CssPreviewComponentListener listener) {
9.224 + synchronized (listeners) {
9.225 + listeners.remove(listener);
9.226 + }
9.227 + }
9.228 +
9.229 + private void fireErrorEvent(String msg) {
9.230 + synchronized (listeners) {
9.231 + for(CssPreviewComponentListener l : listeners) {
9.232 + l.error(msg);
9.233 + }
9.234 + }
9.235 + }
9.236 +
9.237 + // End of variables declaration
9.238 +
9.239 + @ServiceProvider(service=CssPreviewComponentFactory.class, position=100)
9.240 + public static class Factory implements CssPreviewComponentFactory {
9.241 +
9.242 + @Override
9.243 + public CssPreviewComponent createCssPreviewComponent() {
9.244 + return new CssPreviewPanel();
9.245 + }
9.246 +
9.247 + @Override
9.248 + public void addPropertyChangeListener(PropertyChangeListener l) {
9.249 + //no-op
9.250 + }
9.251 +
9.252 + @Override
9.253 + public void removePropertyChangeListener(PropertyChangeListener l) {
9.254 + //no-op
9.255 + }
9.256 +
9.257 + }
9.258 +
9.259 + //delegating flying saucer handler
9.260 + //modifies the log record priorities!
9.261 + private class FlyingSaucerLoggersHandler implements XRLogger {
9.262 +
9.263 + private void publish(Level level, String msg, Throwable exc) {
9.264 + //log the important messages with INFO level and show them in the status bar
9.265 + if(level.intValue() >= Level.WARNING.intValue()) {
9.266 + //log the exception message to output
9.267 + LOGGER.log(Level.INFO, msg, exc);
9.268 + //...and to the status bar
9.269 + fireErrorEvent(msg);
9.270 + } else {
9.271 + //lower priority
9.272 + if(LOG_FINE) {
9.273 + LOGGER.log(Level.FINE, msg, exc);
9.274 + }
9.275 + }
9.276 + }
9.277 +
9.278 + @Override
9.279 + public void log(String logger, Level level, String msg) {
9.280 + log(logger, level, msg, null);
9.281 + }
9.282 +
9.283 + @Override
9.284 + public void log(String logger, Level level, String msg, Throwable thrwbl) {
9.285 + publish(level, logger+msg, thrwbl);
9.286 + }
9.287 +
9.288 + @Override
9.289 + public void setLevel(String string, Level level) {
9.290 + //no-op
9.291 + }
9.292 +
9.293 + }
9.294 +
9.295 + //workaround for FlyingSaucer bug (reported as netbeans issue #117499 (NullPointerException for unreachable url))
9.296 + private class PatchedXHTMLPanel extends XHTMLPanel {
9.297 +
9.298 + /**
9.299 + * Instantiates a panel with a custom {@link org.xhtmlrenderer.extend.UserAgentCallback}
9.300 + * implementation.
9.301 + *
9.302 + * @param uac The custom UserAgentCallback implementation.
9.303 + */
9.304 + public PatchedXHTMLPanel(UserAgentCallback uac) {
9.305 + super(uac);
9.306 + }
9.307 +
9.308 + public void setDocument(InputSource inputSource, String url) {
9.309 + Document dom = XMLResource.load(inputSource).getDocument();
9.310 + setDocument(dom, url, new XhtmlNamespaceHandler());
9.311 + }
9.312 +
9.313 + @Override
9.314 + public void paintComponent(Graphics g) {
9.315 + try {
9.316 + super.paintComponent(g);
9.317 + } catch (Throwable e) {
9.318 + if (LOG_FINE) {
9.319 + LOGGER.log(Level.FINE, "It seems there is a bug in FlyinSaucer XHTML renderer.", e); //NOI18N
9.320 + }
9.321 + fireErrorEvent(e.getLocalizedMessage());
9.322 + }
9.323 + }
9.324 + }
9.325 +
9.326 + //workaround for specifying Base URL
9.327 + private static class PreviewUserAgent extends NaiveUserAgent {
9.328 +
9.329 + //issue #191644 - 'endless image drawing' workround
9.330 + @Override
9.331 + public ImageResource getImageResource(String uri) {
9.332 + ImageResource is = super.getImageResource(uri);
9.333 + if(is != null) {
9.334 + //if the image to be returned by the ImageResource has width or height == 0
9.335 + //we cannot pass it to the AbstractOutputDevice since it would cause the
9.336 + //AbstractOutputDevice.paintTiles(...) to run endlessly
9.337 + FSImage fsimg = is.getImage();
9.338 + if(fsimg.getHeight() == 0 || fsimg.getWidth() == 0) {
9.339 + return new ImageResource(null);
9.340 + }
9.341 + }
9.342 +
9.343 + return is;
9.344 + }
9.345 +
9.346 + @Override
9.347 + public String resolveURI(String uri) {
9.348 + if (uri == null) {
9.349 + return null;
9.350 + }
9.351 +
9.352 + try {
9.353 + //the FS tries to resolve the absolute link by simply adding it to the
9.354 + //current relative base so the uri given here looks like:
9.355 + //
9.356 + //file:/Users/marekfukala/NetBeansProjects/CssTesting/web/resources//duke2.png
9.357 + //
9.358 + //We can try to identify the doubleslash here and resolve the rest of the URI
9.359 + //by relativizing it to the web root (base of the absolute links).
9.360 + //This solution however seems to be little hacky to me and can stop
9.361 + //working if FS changes the (undefined) semantic.
9.362 + int doubleSlashIndex = uri.lastIndexOf("//"); //NOI18N
9.363 + if(doubleSlashIndex != -1) {
9.364 + //get the link path w/o the base, KEEP one slash as the link prefix
9.365 + //so we can simply use WebUtils.resolve()
9.366 + String absoluteLink = uri.substring(doubleSlashIndex + 1); //+1 => just one slash goes away
9.367 + // Absolute path now we will look to the webRoot of the project
9.368 + URL url = new URL(getBaseURL());
9.369 +
9.370 + //fix for Bug 188259 - java.net.URISyntaxException: Illegal character in path at index 20: file:/C:/Users/Bryan Field/Projects/SurfNSecure.com-Applied-Thermal-DocumentNotes/web/,.css (edit)
9.371 + //the FileBasedURLMapper.getFileObjects() logs URISyntaxException instead of passing it out,
9.372 + //if happens during its call to url.getURI();
9.373 + url.toURI(); //lets catch the exception here
9.374 +
9.375 + FileObject edited = URLMapper.findFileObject(url);
9.376 + if (edited != null) {
9.377 + FileObject target = WebUtils.resolve(edited, absoluteLink);
9.378 + if (target != null) {
9.379 + URL targetURL = URLMapper.findURL(target, URLMapper.INTERNAL);
9.380 + if (targetURL != null) {
9.381 + return targetURL.toExternalForm();
9.382 + }
9.383 + }
9.384 + }
9.385 + }
9.386 +
9.387 + } catch (URISyntaxException ex) {
9.388 + LOGGER.log(Level.INFO, null, ex); //NOI18N
9.389 + } catch (MalformedURLException ex) {
9.390 + LOGGER.log(Level.INFO, null, ex); //NOI18N
9.391 + }
9.392 + // falling back to FlyingSaucer implementation
9.393 + return super.resolveURI(uri);
9.394 + }
9.395 + }
9.396 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/web.flyingsaucer/src/org/netbeans/modules/web/flyingsaucer/flyingsaucers.xml Wed Jan 05 16:59:54 2011 +0100
10.3 @@ -0,0 +1,56 @@
10.4 +<?xml version="1.0" encoding="UTF-8"?>
10.5 +
10.6 +<!--
10.7 +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
10.8 +
10.9 +Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
10.10 +
10.11 +Oracle and Java are registered trademarks of Oracle and/or its affiliates.
10.12 +Other names may be trademarks of their respective owners.
10.13 +
10.14 +
10.15 +The contents of this file are subject to the terms of either the GNU
10.16 +General Public License Version 2 only ("GPL") or the Common
10.17 +Development and Distribution License("CDDL") (collectively, the
10.18 +"License"). You may not use this file except in compliance with the
10.19 +License. You can obtain a copy of the License at
10.20 +http://www.netbeans.org/cddl-gplv2.html
10.21 +or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
10.22 +specific language governing permissions and limitations under the
10.23 +License. When distributing the software, include this License Header
10.24 +Notice in each file and include the License file at
10.25 +nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
10.26 +particular file as subject to the "Classpath" exception as provided
10.27 +by Oracle in the GPL Version 2 section of the License file that
10.28 +accompanied this code. If applicable, add the following below the
10.29 +License Header, with the fields enclosed by brackets [] replaced by
10.30 +your own identifying information:
10.31 +"Portions Copyrighted [year] [name of copyright owner]"
10.32 +
10.33 +Contributor(s):
10.34 +
10.35 +The Original Software is NetBeans. The Initial Developer of the Original
10.36 +Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
10.37 +Microsystems, Inc. All Rights Reserved.
10.38 +
10.39 +If you wish your version of this file to be governed by only the CDDL
10.40 +or only the GPL Version 2, indicate your decision by adding
10.41 +"[Contributor] elects to include this software in this distribution
10.42 +under the [CDDL or GPL Version 2] license." If you do not indicate a
10.43 +single choice of license, a recipient has the option to distribute
10.44 +your version of this file under either the CDDL, the GPL Version 2 or
10.45 +to extend the choice of license to its licensees as provided above.
10.46 +However, if you add GPL Version 2 code and therefore, elected the GPL
10.47 +Version 2 license, then the option applies only if the new code is
10.48 +made subject to such option by the copyright holder.
10.49 +-->
10.50 +<!DOCTYPE library PUBLIC "-//NetBeans//DTD Library Declaration 1.0//EN" "http://www.netbeans.org/dtds/library-declaration-1_0.dtd">
10.51 +<library version="1.0">
10.52 + <name>flyingsaucer</name>
10.53 + <type>j2se</type>
10.54 + <localizing-bundle>org/netbeans/modules/web/flyingsaucer/Bundle</localizing-bundle>
10.55 + <volume>
10.56 + <type>classpath</type>
10.57 + <resource>jar:nbinst://org.netbeans.modules.web.flyingsaucer/modules/ext/core-renderer.jar!/</resource>
10.58 + </volume>
10.59 +</library>