--- rhino-1.7R2.orig/debian/rhino-doc.doc-base +++ rhino-1.7R2/debian/rhino-doc.doc-base @@ -0,0 +1,10 @@ +Document: rhino-doc1 +Title: API JavaDoc for Rhino +Author: The Mozilla Rhino Developers +Abstract: This is the API JavaDoc of Rhino, a JavaScript + engine written in Java. +Section: Programming + +Format: HTML +Index: /usr/share/doc/rhino/api/index.html +Files: /usr/share/doc/rhino/api/*.html --- rhino-1.7R2.orig/debian/rhino.install +++ rhino-1.7R2/debian/rhino.install @@ -0,0 +1 @@ +debian/bin/* usr/bin --- rhino-1.7R2.orig/debian/changelog +++ rhino-1.7R2/debian/changelog @@ -0,0 +1,245 @@ +rhino (1.7R2-4ubuntu1) maverick; urgency=low + + * To fix FTBFS, temporarily disabled E4X support as it requires + libxmlbeans-java which is in universe (LP: #638724) + - Removed Build-Depends on libxmlbeans-java + - Added no-e4x flag to ant.properties file + + -- James Page Tue, 14 Sep 2010 15:41:37 +0100 + +rhino (1.7R2-4) unstable; urgency=low + + * Enable E4X support: + - Build-Depends on libxmlbeans-java + - Set JAR location in debian/ant.properties + - Should fix (Closes: #567847) and (LP: #304702) + * Bump Standards-Version to 3.8.4 (no changes needed) + * Fix small typo in rhino-jsc manpage + * Fix debian/copyright: don't use symlink to license + + -- Damien Raude-Morvan Sat, 06 Feb 2010 21:19:47 +0100 + +rhino (1.7R2-3) unstable; urgency=low + + * Maven POMs: + - debian/control: add a Build-Depends on maven-repo-helper + - debian/rules: use mh_installpoms and mh_installjar + to install the POM and the jar to the Maven repository + - debian/pom.xml: Debian pom.xml file as upstream doesn't provide one + - debian/rules: new get-orig-pom to update debian/pom.xml at new upstream + release. + * Bump debhelper version to >= 7 + * debian/rhino.1: Describe more precisly optimization levels and add missing + level '-1'. Thanks to Marcus Better for notifying (Closes: #558086) + * Remove Arnaud Vandyck from Uploaders + * Add description to debian/patches/*.diff + + -- Damien Raude-Morvan Sat, 12 Dec 2009 15:18:24 +0100 + +rhino (1.7R2-2) unstable; urgency=low + + * Switch to Quilt patch system: + - Refresh all patches + - Add B-D on quilt + - Include patchsys-quilt.mk in debian/rules + * Bump Standards-Version to 3.8.3: + - Add a README.source to describe patch system + * Add a manpage for rhino-debugger script + * Build-Depends on default-jdk instead of default-jdk-builddep + because we don't build a native GCJ package + * Move api documentation to /usr/share/doc/rhino/api/ + * debian/control: Improve rhino-doc package long description + * debian/copyright: Add missing BSD licence (3 clauses) for files under + toolsrc/org/mozilla/javascript/tools/debugger/treetable + * Update my email address + + -- Damien Raude-Morvan Fri, 02 Oct 2009 22:23:46 +0200 + +rhino (1.7R2-1) unstable; urgency=low + + [ Marcus Better ] + * Updated package descriptions. + + [ Matthias Klose ] + * (Build-)depend on default-jre-headless/-jdk. + * Drop alternate dependencies on java2-runtime-headless and + java2-runtime-headless. The binary package is currently built to + require a java5 runtime. + + [ Damien Raude-Morvan ] + * New upstream release. + - new 02_exclude-jdk15 patch to exclude already compiled classes + for jdk15 rebuild: gcj doesn't handle compiling classes already + on its classpath + - new "rhino-debugger" launcher for Rhino Debugger Swing UI + - update "rhino" launcher to exclude OpenJDK bundled rhino (Closes: #512498) + * debian/{postinst,prerm }: scripts should take care of errors, + add set -e before any instruction + * debian/rules: add new get-orig-source target using uscan + * debian/control: + - Build-Depends on specialized default-jdk-builddep instead of + default-jdk + - Bump Standards-Version to 3.8.1: Wrap Uploaders field + - add Depends on ${misc:Depends} + + -- Damien Raude-Morvan Mon, 13 Apr 2009 02:40:15 +0200 + +rhino (1.7R2~pre-2) experimental; urgency=low + + * Really include the debugger. Closes: #474046. + + -- Michael Koch Sat, 05 Apr 2008 15:03:43 +0200 + +rhino (1.7R2~pre-1) experimental; urgency=low + + * New upstream release. + * Upload to experimental. + * Enable build of debugger. Closes: #474046. + + -- Michael Koch Fri, 04 Apr 2008 10:32:47 +0200 + +rhino (1.7R1-1) unstable; urgency=low + + * New upstream release. + + -- Michael Koch Sat, 22 Mar 2008 13:49:49 +0100 + +rhino (1.7R1~RC3-1) experimental; urgency=low + + * New upstream version. + * Fixed hyphen in rhino-jsc manpage. + * Updated watch file to handle upstream RC versions. + * Updated Standards-Version to 3.7.3. + + -- Michael Koch Tue, 19 Feb 2008 11:17:45 +0100 + +rhino (1.6.R7-2) unstable; urgency=low + + * Fixed bashism in debian/rules. Closes: #453766. + * Fixed names of Homepage, Vcs-Svn and Vcs-Browser fields. + * Added myself to Uploaders. + + -- Michael Koch Sat, 01 Dec 2007 11:56:31 +0100 + +rhino (1.6.R7-1) unstable; urgency=low + + * New upstream version. + + -- Marcus Better Thu, 11 Oct 2007 15:50:42 +0200 + +rhino (1.6.R5-3) unstable; urgency=low + + * Removed Wolfgang Baer from Uploaders and added myself. + * Fixed FTBFS: java.net.ConnectException: Connection refused. + Was trying to download xmlbeans Jar, which is not allowed. As + this Jar is not (yet) in Debian, rhino has been built with XML + implementation disabled. + A bug in 1.6.R5-2 meant that it was still trying to download the + "treetable" source. This has been fixed in debian/rules by copying the + sample source code into the "downloaded" directory (the sample source code + had to be modified). + (Closes: #424466) + * Moved "-doc" package to doc section. + + -- Paul Cager Sun, 15 Jul 2007 00:32:12 +0100 + +rhino (1.6.R5-2) unstable; urgency=low + + * added java classes from a tutorial from Sun (BSD license as mentionned + in #409629), thanks to Roktas, Filipe Lautert and Bruno Harbulot for + filing bug, giving infos and proposed a patch (even if it's not + used). I've just removed the 02-dont_build-toolsrc.patch. I added the + classes examples if needed but it seems not to be the case (closes: + #409629). + + -- Arnaud Vandyck Fri, 11 May 2007 14:07:21 +0200 + +rhino (1.6.R5-1) unstable; urgency=low + + * New upstream maintenance release. + + -- Matthias Klose Sat, 3 Feb 2007 16:46:28 +0100 + +rhino (1.6R2-3) unstable; urgency=low + + * debian/patches/02-dont_build-toolsrc.patch: added. Don't build toolsrc + and xmlimplsrc because they use Sun classes to build. If you want to + build them, just remove the file (closes: #395525). + + -- Arnaud Vandyck Mon, 6 Nov 2006 12:54:28 +0100 + +rhino (1.6R2-2) unstable; urgency=low + + * Changed the dependency from kaffe to java-gcj-compat. + + -- Arnaud Vandyck Sun, 5 Nov 2006 17:45:52 +0100 + +rhino (1.6R2-1) unstable; urgency=low + + * New upstream (closes: #350971). + * Removed Takashi Okamoto from uploaders (closes: + #352992) + * Updated Standards-Version to 3.7.2: moved debhelper and cdbs to + Build-Depends. + * Build with java-gcj-compat. + * debian/copyright: updated the download url. + * debian/watch: new file. + + -- Arnaud Vandyck Mon, 17 Jul 2006 14:50:36 +0200 + +rhino (1.5.R5-5) unstable; urgency=low + + * Removed explicit usage of jikes build compiler property + for kaffe jikes -> ecj transition + + -- Wolfgang Baer Fri, 6 Jan 2006 18:54:28 +0100 + +rhino (1.5.R5-4) unstable; urgency=low + + * libant1.6-java to ant transition + * Removed dependency on java-common + * Added suggests to rhino-doc and other way round + * Registered documentation with doc-base + * Fixed lintian warning in postinst and added override + for false positive lintian warning + * Standards-Version 3.6.2 (no changes) + + -- Wolfgang Baer Sat, 24 Sep 2005 23:31:36 +0200 + +rhino (1.5.R5-3) unstable; urgency=low + + * Added java2-runtime to runtime choices + * Removed build.xml workaround patch which is no longer + needed with the current kaffe in sarge/unstable + + -- Wolfgang Baer Wed, 13 Apr 2005 19:30:40 +0200 + +rhino (1.5.R5-2) unstable; urgency=low + + * Closes: #283651: alternative without a manpage + * upload to main: uses kaffe,jikes to build + * provide JavaScript compiler as rhino-jsc with manpage + * Arnaud Vandyck did sponsor this package. As a + member of pkg-java Alioth's project, I added Wolfgang as uploaders + + -- Wolfgang Baer Sat, 12 Feb 2005 11:56:06 +0000 + +rhino (1.5.R5-1) unstable; urgency=low + + * New upstream release + * changed the build system to cdbs + + -- Arnaud Vandyck Sun, 21 Nov 2004 14:29:34 +0100 + +rhino (1.5.R2-2) unstable; urgency=low + + * Add alternative for /usr/bin/js. The patch is provided by Brian + Bassett. (Closes:#122669) + + -- Takashi Okamoto Sat, 8 Dec 2001 10:45:06 +0900 + +rhino (1.5.R2-1) unstable; urgency=low + + * Initial Release. + + -- Takashi Okamoto Fri, 16 Nov 2001 23:51:38 +0900 --- rhino-1.7R2.orig/debian/rhino.1 +++ rhino-1.7R2/debian/rhino.1 @@ -0,0 +1,93 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH RHINO 1 "February 12, 2005" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +rhino \- invokes the JavaScript shell for running scripts in batch mode or interactive + +.SH SYNOPSIS +.B rhino +.I [options] +.I script_filename_or_url +.I [script_arguments] + +.SH DESCRIPTION +This manual page documents briefly the +.B rhino +command. +This manual page was written for the Debian distribution because the original +program does not have a manual page. It is written according to the html documentation. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBrhino\fP is a start script for the rhino JavaScript shell which provides a simple way +to run scripts in batch mode or an interactive environment for exploratory programming. + +.SH OPTIONS + +.IP -e\ \fIscript_source\fP +Executes script_source as a JavaScript script. +.IP -f\ \fIscript_filename_or_url\fP +Reads script_filename_or_url content and execute it as a JavaScript script. +.IP -opt,\ -O\ \fIoptLevel\fP +Optimizes at level optLevel, which must be an integer between -1 and 9. -1 means Interpretive mode is always used. 0 means no optimizations whereas 9 means all optimizations are performed. +.IP -version\ \fIversionNumber\fP +Specifies the language version to compile with. The string versionNumber must be one of 100, 110, 120, 130, or 140. See JavaScript Language Versions for more information on language versions. +.IP -strict +Enable strict mode. + +.SH PREDEFINED PROPERTIES + +Scripts executing in the shell have access to some additional properties of the top-level object. + +.IP arguments +The arguments object is an array containing the strings of all the arguments given at the command line when the shell was invoked. +.IP help() +Executing the help function will print usage and help messages. +.IP defineClass(\fIclassName\fP) +Define an extension using the Java class named with the string argument className. Uses ScriptableObject.defineClass() to define the extension. +.IP deserialize(\fIfilename\fP) +Restore from the specified file an object previously written by a call to serialize. +.IP load(\fI[filename,\&.\&.\&.]\fP) +Load JavaScript source files named by string arguments. If multiple arguments are given, each file is read in and executed in turn. +.IP loadClass(\fIclassName\fP) +Load and execute the class named by the string argument className. The class must be a class that implements the Script interface, as will any script compiled by jsc. +.IP print(\fI[expr\&.\&.\&.]\fP) +Evaluate and print expressions. Evaluates each expression, converts the result to a string, and prints it. +.IP readFile(\fIpath[,characterCoding]\fP) +Read given file and convert its bytes to a string using the specified character coding or default character coding if explicit coding argument is not given. +.IP readUrl(\fIurl[,characterCoding]\fP) +Open an input connection to the given string url, read all its bytes and convert them to a string using the specified character coding or default character coding if explicit coding argument is not given. +.IP runCommand(\fIcommandName,[arg,\&.\&.\&.][options]\fP) +Execute the specified command with the given argument and options as a separate process and return the exit status of the process. For details, see JavaDoc for org.mozilla.javascript.tools.shell.Global#runCommand. +.IP serialize(\fIobject,filename\fP) +Serialize the given object to the specified file. +.IP spawn(\fIfunctionOrScript\fP) +Run the given function or script in a different thread. +.IP sync(\fIfunction\fP) +creates a synchronized function (in the sense of a Java synchronized method) from an existing function. The new function synchronizes on the this object of its invocation. +.IP quit() +Quit shell. The shell will also quit in interactive mode if an end-of-file character is typed at the prompt. +.IP version(\fI[number]\fP) +Get or set JavaScript version number. If no argument is supplied, the current version number is returned. If an argument is supplied, it is expected to be one of 100, 110, 120, 130, or 140 to indicate JavaScript version 1.0, 1.1, 1.2, 1.3, or 1.4 respectively. + +.SH SEE ALSO +The online documentation under http://www.mozilla.org/rhino/shell.html + +.SH AUTHOR +This manual page was written by Wolfgang Baer , +for the Debian project (but may be used by others). --- rhino-1.7R2.orig/debian/pom.xml +++ rhino-1.7R2/debian/pom.xml @@ -0,0 +1,21 @@ + + + + 4.0.0 + rhino + js + 1.7R2 + jar + Rhino + Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically embedded into Java applications to provide scripting to end users. + http://www.mozilla.org/rhino/ + + + + Mozilla Public License + http://www.mozilla.org/MPL/MPL-1.1.html + repo + + + + --- rhino-1.7R2.orig/debian/README.source +++ rhino-1.7R2/debian/README.source @@ -0,0 +1,9 @@ +Patch System +============ + +This package uses quilt to manage all modifications to the upstream +source. Changes are stored in the source package as diffs in +debian/patches and applied during the build. + +See /usr/share/doc/quilt/README.source for a detailed explanation. + --- rhino-1.7R2.orig/debian/ant.properties +++ rhino-1.7R2/debian/ant.properties @@ -0,0 +1,7 @@ +xbean.jar=/usr/share/java/xmlbeans.jar + +# JSR 173 (StAX) in included in JDK 6 +# Just set property to xmlbeans, to get build system happy +jsr173.jar=/usr/share/java/xmlbeans.jar + +no-e4x=true --- rhino-1.7R2.orig/debian/rhino.poms +++ rhino-1.7R2/debian/rhino.poms @@ -0,0 +1 @@ +debian/pom.xml --- rhino-1.7R2.orig/debian/rules +++ rhino-1.7R2/debian/rules @@ -0,0 +1,49 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/rules/patchsys-quilt.mk +include /usr/share/cdbs/1/class/ant.mk + +JAVA_HOME := /usr/lib/jvm/default-java +DEB_ANT_BUILD_TARGET := jar javadoc + +UVERSION := $(shell echo $(DEB_UPSTREAM_VERSION) | sed "s/~RC.//" | sed "s/~pre//") +BUILDDIRVERSION := $(subst .,_,$(UVERSION)) + +BUILDDIR=build/rhino$(BUILDDIRVERSION) + +POM_VERSION := $(UVERSION) +MAVEN_REPO := http://repository.sonatype.org/service/local/repositories/central/content + +clean:: + rm -rf toolsrc/org/mozilla/javascript/tools/debugger/downloaded/* + rm -rf build + -rm -rf debian/tmp + +# The upstream build file (toolsrc/org/mozilla/javascript/tools/debugger/build.xml) downloads +# a ZIP file containing some sample swing code, which is then modified and used as part of the +# debugger. This is obviously not permitted during a Debian build. +# Fortunately the sample code is DFSG-free, so it has been included in the debian directory (in +# its modified format). Copying it to the "downloaded" directory prevents the upstream +# build.xml from attempting to download it. +configure/rhino:: + mkdir -p toolsrc/org/mozilla/javascript/tools/debugger/downloaded + cp debian/src_from_treetable_article_see_bug409629/AbstractCellEditor.java toolsrc/org/mozilla/javascript/tools/debugger/downloaded/ + cp debian/src_from_treetable_article_see_bug409629/JTreeTable.java toolsrc/org/mozilla/javascript/tools/debugger/downloaded/ + cp debian/src_from_treetable_article_see_bug409629/TreeTableModel.java toolsrc/org/mozilla/javascript/tools/debugger/downloaded/ + cp debian/src_from_treetable_article_see_bug409629/TreeTableModelAdapter.java toolsrc/org/mozilla/javascript/tools/debugger/downloaded/ + +install/rhino:: + mh_installpoms -prhino + mh_installjar -prhino -l debian/pom.xml $(BUILDDIR)/js.jar + +install/rhino-doc:: + mv $(BUILDDIR)/javadoc $(BUILDDIR)/api + dh_install -prhino-doc $(BUILDDIR)/api /usr/share/doc/rhino/ + +get-orig-source: + uscan --force-download --repack + +get-orig-pom: + wget -O debian/pom.xml $(MAVEN_REPO)/rhino/js/$(POM_VERSION)/js-$(POM_VERSION).pom + --- rhino-1.7R2.orig/debian/watch +++ rhino-1.7R2/debian/watch @@ -0,0 +1,3 @@ +version=3 +opts=uversionmangle=s/-RC/~RC/;s/pre/~pre/ \ + ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino(.*)_(.*)\.zip debian uupdate --- rhino-1.7R2.orig/debian/copyright +++ rhino-1.7R2/debian/copyright @@ -0,0 +1,523 @@ +This package was debianized by Takashi Okamoto on +Fri, 16 Nov 2001 23:51:38 +0900. + +It is currently maintained by the Debian Java Maintainers +. + +It was downloaded from . + +Copyright (C) 2007 Marcus Better (Debian packaging) + +This software licensed under the Mozilla Public License version 1.1 +or, at your option, under the GNU General Public License version 2 or +later. + +On Debian GNU systems, the complete text of the GNU General Public +License 2.0 can be found in `/usr/share/common-licenses/GPL-2'. + + MOZILLA PUBLIC LICENSE + Version 1.1 + + --------------- + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Particiunless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] + + + +Additionally, some files (currently the contents of +toolsrc/org/mozilla/javascript/tools/debugger/treetable/) are available +only under the following license: + +============================================================================ + * Copyright 1997, 1998 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Sun Microsystems nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +============================================================================ + --- rhino-1.7R2.orig/debian/rhino-doc.examples +++ rhino-1.7R2/debian/rhino-doc.examples @@ -0,0 +1 @@ +examples/* --- rhino-1.7R2.orig/debian/rhino-debugger.1 +++ rhino-1.7R2/debian/rhino-debugger.1 @@ -0,0 +1,60 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH RHINO-DEBUGGER 1 "Friday 17, 2009" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +rhino-debugger \- invokes the rhino JavaScript debugger GUI + +.SH SYNOPSIS +.B rhino-debugger +.I [options] +.I script_filename_or_url +.I [script_arguments] + +.SH DESCRIPTION +This manual page documents briefly the +.B rhino-debugger +command. +This manual page was written for the Debian distribution because the original +program does not have a manual page. It is written according to the html documentation. +.PP +\fBrhino-debugger\fP is a start script for the rhino JavaScript debugger. The Rhino JavaScript debugger is a GUI that allows debugging of interpreted JavaScript scripts run in Rhino. Note that this debugger will not work with JavaScript scripts run in the mozilla browser since Rhino is not the engine used in such environments. + +.SH OPTIONS + +.IP -e\ \fIscript_source\fP +Executes script_source as a JavaScript script. +.IP -f\ \fIscript_filename_or_url\fP +Reads script_filename_or_url content and execute it as a JavaScript script. +.IP -opt,\ -O\ \fIoptLevel\fP +Optimizes at level optLevel, which must be an integer between 0 and 9. +.IP -version\ \fIversionNumber\fP +Specifies the language version to compile with. The string versionNumber must be one of 100, 110, 120, 130, or 140. See JavaScript Language Versions for more information on language versions. +.IP -strict +Enable strict mode. + +.SH EXAMPLE + +Example debugging the NervousText.js applet written in JavaScript. The example is provided in the rhino-doc package. + +$ rhino-debugger NervousText.js + +.SH SEE ALSO +The online documentation under http://www.mozilla.org/rhino/debugger.html + +.SH AUTHOR +This manual page was written by Damien Raude-Morvan , +for the Debian project (but may be used by others). --- rhino-1.7R2.orig/debian/rhino-jsc.1 +++ rhino-1.7R2/debian/rhino-jsc.1 @@ -0,0 +1,67 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH RHINO-JSC 1 "February 12, 2005" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +rhino-jsc \- invokes the rhino JavaScript compiler + +.SH SYNOPSIS +.B rhino-jsc +.I [options] +.I file1.js +.I [file2.js\&.\&.\&.] + +.SH DESCRIPTION +This manual page documents briefly the +.B rhino-jsc +command. +This manual page was written for the Debian distribution because the original +program does not have a manual page. It is written according to the html documentation. +.PP +\fBrhino-jsc\fP is a start script for the rhino JavaScript compiler. The JavaScript compiler translates JavaScript source into Java class files. The resulting Java class files can then be loaded and executed at another time, providing a convenient method for transferring JavaScript, and for avoiding translation cost. +Note that the top-level functions available to the shell (such as print) are not available to compiled scripts when they are run outside the shell. + +.SH OPTIONS + +.IP -extends\ \fIjava_class_name\fP +Specifies that a java class extending the Java class java_class_name should be generated from the incoming JavaScript source file. Each global function in the source file is made a method of the generated class, overriding any methods in the base class by the same name. +.IP -implements\ \fIjava_intf_name\fP +Specifies that a java class implementing the Java interface java_intf_name should be generated from the incoming JavaScript source file. Each global function in the source file is made a method of the generated class, implementing any methods in the interface by the same name. +.IP -debug,\ -g +Specifies that debug information should be generated. May not be combined with optimization at an optLevel greater than zero. +.IP -nosource +Does not save the source in the class file. Functions and scripts compiled this way cannot be decompiled. This option can be used to avoid distributing source or simply to save space in the resulting class file. +.IP -o\ \fIoutputFile\fP +Writes the class file to the given file (which should end in .class). The string outputFile must be a writable filename. +.IP -opt,\ -O\ \fIoptLevel\fP +Optimizes at level optLevel, which must be an integer between 0 and 9. +.IP -package\ \fIpackageName\fP +Specifies the package to generate the class into. The string packageName must be composed of valid identifier characters optionally separated by periods. +.IP -version\ \fIversionNumber\fP +Specifies the language version to compile with. The string versionNumber must be one of 100, 110, 120, 130, or 140. See JavaScript Language Versions for more information on language versions. + +.SH EXAMPLE + +Example compiling the NervousText.js applet written in JavaScript. The example is provided in the rhino-doc package. + +$ rhino-jsc \-extends java.applet.Applet \-implements java.lang.Runnable NervousText.js + +.SH SEE ALSO +The online documentation under http://www.mozilla.org/rhino/jsc.html + +.SH AUTHOR +This manual page was written by Wolfgang Baer , +for the Debian project (but may be used by others). --- rhino-1.7R2.orig/debian/rhino.prerm +++ rhino-1.7R2/debian/rhino.prerm @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +if [ "$1" = "remove" ]; then + update-alternatives --remove js /usr/bin/rhino +fi + +#DEBHELPER# --- rhino-1.7R2.orig/debian/compat +++ rhino-1.7R2/debian/compat @@ -0,0 +1 @@ +7 --- rhino-1.7R2.orig/debian/rhino.manpages +++ rhino-1.7R2/debian/rhino.manpages @@ -0,0 +1,3 @@ +debian/rhino.1 +debian/rhino-jsc.1 +debian/rhino-debugger.1 --- rhino-1.7R2.orig/debian/rhino.postinst +++ rhino-1.7R2/debian/rhino.postinst @@ -0,0 +1,9 @@ +#!/bin/bash +set -e + +if [ "$1" = "configure" -o "$1" = "abort-upgrade" ]; then + update-alternatives --install /usr/bin/js js /usr/bin/rhino 100 \ + --slave /usr/share/man/man1/js.1.gz js.1.gz /usr/share/man/man1/rhino.1.gz +fi + +#DEBHELPER# --- rhino-1.7R2.orig/debian/control +++ rhino-1.7R2/debian/control @@ -0,0 +1,34 @@ +Source: rhino +Section: interpreters +Priority: optional +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Debian Java Maintainers +Uploaders: Paul Cager , + Marcus Better , Michael Koch , Damien Raude-Morvan +Build-Depends: debhelper (>= 7), cdbs, ant, default-jdk, quilt, maven-repo-helper +Standards-Version: 3.8.4 +Homepage: http://www.mozilla.org/rhino/ +Vcs-Svn: svn://svn.debian.org/pkg-java/trunk/rhino/ +Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/rhino/ + +Package: rhino +Architecture: all +Depends: ${misc:Depends}, default-jre-headless (>= 1.5) | java5-runtime-headless, libjline-java +Suggests: rhino-doc +Description: JavaScript engine written in Java + Rhino is an implementation of the JavaScript language written + entirely in Java. It is typically embedded into Java applications to + provide scripting to end users. + +Package: rhino-doc +Section: doc +Architecture: all +Depends: ${misc:Depends} +Suggests: rhino +Description: Documentation for rhino Java Script Engine + Rhino is an implementation of the JavaScript language written + entirely in Java. It is typically embedded into Java applications to + provide scripting to end users. + . + This is the documentation, including API JavaDoc, for the Rhino + JavaScript engine. --- rhino-1.7R2.orig/debian/bin/rhino +++ rhino-1.7R2/debian/bin/rhino @@ -0,0 +1,22 @@ +#!/bin/sh + +JAVA_CMD="/usr/bin/java" +JAVA_OPTS="" +JAVA_CLASSPATH="/usr/share/java/js.jar:/usr/share/java/jline.jar" +JAVA_MAIN="org.mozilla.javascript.tools.shell.Main" + +## Fix for #512498 +## Change Bootclasspath when using OpenJDK because OpenJDK6 +## bundle his own release of Rhino. +## References: +## +## +## +isOpenJDK=`$JAVA_CMD -version 2>&1 | grep -i "OpenJDK" | wc -l` +if [ $isOpenJDK -gt 0 ] +then + JAVA_OPTS="-Xbootclasspath:/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar" +fi + + +$JAVA_CMD $JAVA_OPTS -classpath $JAVA_CLASSPATH $JAVA_MAIN $@ --- rhino-1.7R2.orig/debian/bin/rhino-jsc +++ rhino-1.7R2/debian/bin/rhino-jsc @@ -0,0 +1,9 @@ +#!/bin/sh + +JAVA_CMD="/usr/bin/java" +JAVA_OPTS="" +JAVA_CLASSPATH="/usr/share/java/js.jar" +JAVA_MAIN="org.mozilla.javascript.tools.jsc.Main" + +$JAVA_CMD $JAVA_OPTS -classpath $JAVA_CLASSPATH $JAVA_MAIN $@ + --- rhino-1.7R2.orig/debian/bin/rhino-debugger +++ rhino-1.7R2/debian/bin/rhino-debugger @@ -0,0 +1,8 @@ +#!/bin/sh + +JAVA_CMD="/usr/bin/java" +JAVA_OPTS="" +JAVA_CLASSPATH="/usr/share/java/js.jar" +JAVA_MAIN="org.mozilla.javascript.tools.debugger.Main" + +$JAVA_CMD $JAVA_OPTS -classpath $JAVA_CLASSPATH $JAVA_MAIN $@ --- rhino-1.7R2.orig/debian/src_from_treetable_article_see_bug409629/FileSystemModel2.java +++ rhino-1.7R2/debian/src_from_treetable_article_see_bug409629/FileSystemModel2.java @@ -0,0 +1,774 @@ +/* + * FileSystemModel2.java + * + * Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved. + * + * This software is the confidential and proprietary information of Sun + * Microsystems, Inc. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Sun. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +import java.io.IOException; +import java.io.File; +import java.util.Date; +import java.util.Stack; +import javax.swing.SwingUtilities; +import javax.swing.tree.TreePath; + +/** + * FileSystemModel2 is a TreeTableModel representing a hierarchical file + * system.

+ * This will recursively load all the children from the path it is + * created with. The loading is done with the method reloadChildren, and + * happens in another thread. The method isReloading can be invoked to check + * if there are active threads. The total size of all the files are also + * accumulated. + *

+ * By default links are not descended. java.io.File does not have a way + * to distinguish links, so a file is assumed to be a link if its canonical + * path does not start with its parent path. This may not cover all cases, + * but works for the time being. + *

Reloading happens such that all the files of the directory are + * loaded and immediately available. The background thread then recursively + * loads all the files of each of those directories. When each directory has + * finished loading all its sub files they are attached and an event is + * generated in the event dispatching thread. A more ambitious approach + * would be to attach each set of directories as they are loaded and generate + * an event. Then, once all the direct descendants of the directory being + * reloaded have finished loading, it is resorted based on total size. + *

+ * While you can invoke reloadChildren as many times as you want, care + * should be taken in doing this. You should not invoke reloadChildren + * on a node that is already being reloaded, or going to be reloaded + * (meaning its parent is reloading but it hasn't started reloading + * that directory yet). If this is done odd results may + * happen. FileSystemModel2 does not enforce any policy in this manner, + * and it is up to the user of FileSystemModel2 to ensure it doesn't + * happen. + * + * @version 1.12 05/12/98 + * @author Philip Milne + * @author Scott Violet + */ + +public class FileSystemModel2 extends AbstractTreeTableModel { + + // Names of the columns. + static protected String[] cNames = {"Name", "Size", "Type", "Modified"}; + + // Types of the columns. + static protected Class[] cTypes = { TreeTableModel.class, + Integer.class, String.class, + Date.class}; + + // The the returned file length for directories. + public static final Integer ZERO = new Integer(0); + + /** An array of MergeSorter sorters, that will sort based on size. */ + static Stack sorters = new Stack(); + + + /** True if the receiver is valid, once set to false all Threads + * loading files will stop. */ + protected boolean isValid; + + /** Node currently being reloaded, this becomes somewhat muddy if + * reloading is happening in multiple threads. */ + protected FileNode reloadNode; + + /** > 0 indicates reloading some nodes. */ + int reloadCount; + + /** Returns true if links are to be descended. */ + protected boolean descendLinks; + + + /** + * Returns a MergeSort that can sort on the totalSize of a FileNode. + */ + protected static MergeSort getSizeSorter() { + synchronized(sorters) { + if (sorters.size() == 0) { + return new SizeSorter(); + } + return (MergeSort)sorters.pop(); + } + } + + /** + * Should be invoked when a MergeSort is no longer needed. + */ + protected static void recycleSorter(MergeSort sorter) { + synchronized(sorters) { + sorters.push(sorter); + } + } + + + /** + * Creates a FileSystemModel2 rooted at File.separator, which is usually + * the root of the file system. This does not load it, you should invoke + * reloadChildren with the root to start loading. + */ + public FileSystemModel2() { + this(File.separator); + } + + /** + * Creates a FileSystemModel2 with the root being rootPath. + * This does not load it, you should invoke + * reloadChildren with the root to start loading. + */ + public FileSystemModel2(String rootPath) { + super(null); + isValid = true; + root = new FileNode(new File(rootPath)); + } + + // + // The TreeModel interface + // + + /** + * Returns the number of children of node. + */ + public int getChildCount(Object node) { + Object[] children = getChildren(node); + return (children == null) ? 0 : children.length; + } + + /** + * Returns the child of node at index i. + */ + public Object getChild(Object node, int i) { + return getChildren(node)[i]; + } + + /** + * Returns true if the passed in object represents a leaf, false + * otherwise. + */ + public boolean isLeaf(Object node) { + return ((FileNode)node).isLeaf(); + } + + // + // The TreeTableNode interface. + // + + /** + * Returns the number of columns. + */ + public int getColumnCount() { + return cNames.length; + } + + /** + * Returns the name for a particular column. + */ + public String getColumnName(int column) { + return cNames[column]; + } + + /** + * Returns the class for the particular column. + */ + public Class getColumnClass(int column) { + return cTypes[column]; + } + + /** + * Returns the value of the particular column. + */ + public Object getValueAt(Object node, int column) { + FileNode fn = (FileNode)node; + + try { + switch(column) { + case 0: + return fn.getFile().getName(); + case 1: + if (fn.isTotalSizeValid()) { + return new Integer((int)((FileNode)node).totalSize()); + } + return null; + case 2: + return fn.isLeaf() ? "File" : "Directory"; + case 3: + return fn.lastModified(); + } + } + catch (SecurityException se) { } + + return null; + } + + // + // Some convenience methods. + // + + /** + * Reloads the children of the specified node. + */ + public void reloadChildren(Object node) { + FileNode fn = (FileNode)node; + + synchronized(this) { + reloadCount++; + } + fn.resetSize(); + new Thread(new FileNodeLoader((FileNode)node)).start(); + } + + /** + * Stops and waits for all threads to finish loading. + */ + public void stopLoading() { + isValid = false; + synchronized(this) { + while (reloadCount > 0) { + try { + wait(); + } catch (InterruptedException ie) {} + } + } + isValid = true; + } + + /** + * If newValue is true, links are descended. Odd results + * may happen if you set this while other threads are loading. + */ + public void setDescendsLinks(boolean newValue) { + descendLinks = newValue; + } + + /** + * Returns true if links are to be automatically descended. + */ + public boolean getDescendsLinks() { + return descendLinks; + } + + /** + * Returns the path node represents. + */ + public String getPath(Object node) { + return ((FileNode)node).getFile().getPath(); + } + + /** + * Returns the total size of the receiver. + */ + public long getTotalSize(Object node) { + return ((FileNode)node).totalSize(); + } + + /** + * Returns true if the receiver is loading any children. + */ + public boolean isReloading() { + return (reloadCount > 0); + } + + /** + * Returns the path to the node that is being loaded. + */ + public TreePath getPathLoading() { + FileNode rn = reloadNode; + + if (rn != null) { + return new TreePath(rn.getPath()); + } + return null; + } + + /** + * Returns the node being loaded. + */ + public Object getNodeLoading() { + return reloadNode; + } + + protected File getFile(Object node) { + FileNode fileNode = ((FileNode)node); + return fileNode.getFile(); + } + + protected Object[] getChildren(Object node) { + FileNode fileNode = ((FileNode)node); + return fileNode.getChildren(); + } + + + protected static FileNode[] EMPTY_CHILDREN = new FileNode[0]; + + // Used to sort the file names. + static private MergeSort fileMS = new MergeSort() { + public int compareElementsAt(int beginLoc, int endLoc) { + return ((String)toSort[beginLoc]).compareTo + ((String)toSort[endLoc]); + } + }; + + + /** + * A FileNode is a derivative of the File class - though we delegate to + * the File object rather than subclassing it. It is used to maintain a + * cache of a directory's children and therefore avoid repeated access + * to the underlying file system during rendering. + */ + class FileNode { + /** java.io.File the receiver represents. */ + protected File file; + /** Parent FileNode of the receiver. */ + private FileNode parent; + /** Children of the receiver. */ + protected FileNode[] children; + /** Size of the receiver and all its children. */ + protected long totalSize; + /** Valid if the totalSize has finished being calced. */ + protected boolean totalSizeValid; + /** Path of the receiver. */ + protected String canonicalPath; + /** True if the canonicalPath of this instance does not start with + * the canonical path of the parent. */ + protected boolean isLink; + /** Date last modified. */ + protected Date lastModified; + + + protected FileNode(File file) { + this(null, file); + } + + protected FileNode(FileNode parent, File file) { + this.parent = parent; + this.file = file; + try { + canonicalPath = file.getCanonicalPath(); + } + catch (IOException ioe) { + canonicalPath = ""; + } + if (parent != null) { + isLink = !canonicalPath.startsWith(parent.getCanonicalPath()); + } + else { + isLink = false; + } + if (isLeaf()) { + totalSize = file.length(); + totalSizeValid = true; + } + } + + /** + * Returns the date the receiver was last modified. + */ + public Date lastModified() { + if (lastModified == null && file != null) { + lastModified = new Date(file.lastModified()); + } + return lastModified; + } + + /** + * Returns the the string to be used to display this leaf in the JTree. + */ + public String toString() { + return file.getName(); + } + + /** + * Returns the java.io.File the receiver represents. + */ + public File getFile() { + return file; + } + + /** + * Returns size of the receiver and all its children. + */ + public long totalSize() { + return totalSize; + } + + /** + * Returns the parent of the receiver. + */ + public FileNode getParent() { + return parent; + } + + /** + * Returns true if the receiver represents a leaf, that is it is + * isn't a directory. + */ + public boolean isLeaf() { + return file.isFile(); + } + + /** + * Returns true if the total size is valid. + */ + public boolean isTotalSizeValid() { + return totalSizeValid; + } + + /** + * Clears the date. + */ + protected void resetLastModified() { + lastModified = null; + } + + /** + * Sets the size of the receiver to be 0. + */ + protected void resetSize() { + alterTotalSize(-totalSize); + } + + /** + * Loads the children, caching the results in the children + * instance variable. + */ + protected FileNode[] getChildren() { + return children; + } + + /** + * Recursively loads all the children of the receiver. + */ + protected void loadChildren(MergeSort sorter) { + totalSize = file.length(); + children = createChildren(null); + for (int counter = children.length - 1; counter >= 0; counter--) { + Thread.yield(); // Give the GUI CPU time to draw itself. + if (!children[counter].isLeaf() && + (descendLinks || !children[counter].isLink())) { + children[counter].loadChildren(sorter); + } + totalSize += children[counter].totalSize(); + if (!isValid) { + counter = 0; + } + } + if (isValid) { + if (sorter != null) { + sorter.sort(children); + } + totalSizeValid = true; + } + } + + /** + * Loads the children of of the receiver. + */ + protected FileNode[] createChildren(MergeSort sorter) { + FileNode[] retArray = null; + + try { + String[] files = file.list(); + if(files != null) { + if (sorter != null) { + sorter.sort(files); + } + retArray = new FileNode[files.length]; + String path = file.getPath(); + for(int i = 0; i < files.length; i++) { + File childFile = new File(path, files[i]); + retArray[i] = new FileNode(this, childFile); + } + } + } catch (SecurityException se) {} + if (retArray == null) { + retArray = EMPTY_CHILDREN; + } + return retArray; + } + + /** + * Returns true if the children have been loaded. + */ + protected boolean loadedChildren() { + return (file.isFile() || (children != null)); + } + + /** + * Gets the path from the root to the receiver. + */ + public FileNode[] getPath() { + return getPathToRoot(this, 0); + } + + /** + * Returns the canonical path for the receiver. + */ + public String getCanonicalPath() { + return canonicalPath; + } + + /** + * Returns true if the receiver's path does not begin with the + * parent's canonical path. + */ + public boolean isLink() { + return isLink; + } + + protected FileNode[] getPathToRoot(FileNode aNode, int depth) { + FileNode[] retNodes; + + if(aNode == null) { + if(depth == 0) + return null; + else + retNodes = new FileNode[depth]; + } + else { + depth++; + retNodes = getPathToRoot(aNode.getParent(), depth); + retNodes[retNodes.length - depth] = aNode; + } + return retNodes; + } + + /** + * Sets the children of the receiver, updates the total size, + * and if generateEvent is true a tree structure changed event + * is created. + */ + protected void setChildren(FileNode[] newChildren, + boolean generateEvent) { + long oldSize = totalSize; + + totalSize = file.length(); + children = newChildren; + for (int counter = children.length - 1; counter >= 0; + counter--) { + totalSize += children[counter].totalSize(); + } + + if (generateEvent) { + FileNode[] path = getPath(); + + fireTreeStructureChanged(FileSystemModel2.this, path, null, + null); + + FileNode parent = getParent(); + + if (parent != null) { + parent.alterTotalSize(totalSize - oldSize); + } + } + } + + protected synchronized void alterTotalSize(long sizeDelta) { + if (sizeDelta != 0 && (parent = getParent()) != null) { + totalSize += sizeDelta; + nodeChanged(); + parent.alterTotalSize(sizeDelta); + } + else { + // Need a way to specify the root. + totalSize += sizeDelta; + } + } + + /** + * This should only be invoked on the event dispatching thread. + */ + protected synchronized void setTotalSizeValid(boolean newValue) { + if (totalSizeValid != newValue) { + nodeChanged(); + totalSizeValid = newValue; + + FileNode parent = getParent(); + + if (parent != null) { + parent.childTotalSizeChanged(this); + } + } + } + + /** + * Marks the receivers total size as valid, but does not invoke + * node changed, nor message the parent. + */ + protected synchronized void forceTotalSizeValid() { + totalSizeValid = true; + } + + /** + * Invoked when a childs total size has changed. + */ + protected synchronized void childTotalSizeChanged(FileNode child) { + if (totalSizeValid != child.isTotalSizeValid()) { + if (totalSizeValid) { + setTotalSizeValid(false); + } + else { + FileNode[] children = getChildren(); + + for (int counter = children.length - 1; counter >= 0; + counter--) { + if (!children[counter].isTotalSizeValid()) { + return; + } + } + setTotalSizeValid(true); + } + } + + } + + /** + * Can be invoked when a node has changed, will create the + * appropriate event. + */ + protected void nodeChanged() { + FileNode parent = getParent(); + + if (parent != null) { + FileNode[] path = parent.getPath(); + int[] index = { getIndexOfChild(parent, this) }; + Object[] children = { this }; + + fireTreeNodesChanged(FileSystemModel2.this, path, index, + children); + } + } + } + + + /** + * FileNodeLoader can be used to reload all the children of a + * particular node. It first resets the children of the FileNode + * it is created with, and in its run method will reload all of + * that nodes children. FileNodeLoader may not be running in the event + * dispatching thread. As swing is not thread safe it is important + * that we don't generate events in this thread. SwingUtilities.invokeLater + * is used so that events are generated in the event dispatching thread. + */ + class FileNodeLoader implements Runnable { + /** Node creating children for. */ + FileNode node; + /** Sorter. */ + MergeSort sizeMS; + + FileNodeLoader(FileNode node) { + this.node = node; + node.resetLastModified(); + node.setChildren(node.createChildren(fileMS), true); + node.setTotalSizeValid(false); + } + + public void run() { + FileNode[] children = node.getChildren(); + + sizeMS = getSizeSorter(); + for (int counter = children.length - 1; counter >= 0; counter--) { + if (!children[counter].isLeaf()) { + reloadNode = children[counter]; + loadChildren(children[counter]); + reloadNode = null; + } + if (!isValid) { + counter = 0; + } + } + recycleSorter(sizeMS); + if (isValid) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + MergeSort sorter = getSizeSorter(); + + sorter.sort(node.getChildren()); + recycleSorter(sorter); + node.setChildren(node.getChildren(), true); + synchronized(FileSystemModel2.this) { + reloadCount--; + FileSystemModel2.this.notifyAll(); + } + } + }); + } + else { + synchronized(FileSystemModel2.this) { + reloadCount--; + FileSystemModel2.this.notifyAll(); + } + } + } + + protected void loadChildren(FileNode node) { + if (!node.isLeaf() && (descendLinks || !node.isLink())) { + final FileNode[] children = node.createChildren(null); + + for (int counter = children.length - 1; counter >= 0; + counter--) { + if (!children[counter].isLeaf()) { + if (descendLinks || !children[counter].isLink()) { + children[counter].loadChildren(sizeMS); + } + else { + children[counter].forceTotalSizeValid(); + } + } + if (!isValid) { + counter = 0; + } + } + if (isValid) { + final FileNode fn = node; + + // Reset the children + SwingUtilities.invokeLater(new Runnable() { + public void run() { + MergeSort sorter = getSizeSorter(); + + sorter.sort(children); + recycleSorter(sorter); + fn.setChildren(children, true); + fn.setTotalSizeValid(true); + fn.nodeChanged(); + } + }); + } + } + else { + node.forceTotalSizeValid(); + } + } + } + + + /** + * Sorts the contents, which must be instances of FileNode based on + * totalSize. + */ + static class SizeSorter extends MergeSort { + public int compareElementsAt(int beginLoc, int endLoc) { + long firstSize = ((FileNode)toSort[beginLoc]).totalSize(); + long secondSize = ((FileNode)toSort[endLoc]).totalSize(); + + if (firstSize != secondSize) { + return (int)(secondSize - firstSize); + } + return ((FileNode)toSort[beginLoc]).toString().compareTo + (((FileNode)toSort[endLoc]).toString()); + } + } +} --- rhino-1.7R2.orig/debian/src_from_treetable_article_see_bug409629/AbstractCellEditor.java +++ rhino-1.7R2/debian/src_from_treetable_article_see_bug409629/AbstractCellEditor.java @@ -0,0 +1,63 @@ + + package org.mozilla.javascript.tools.debugger.downloaded; + import java.awt.Component; + +import java.awt.event.*; +import java.awt.AWTEvent; +import javax.swing.*; +import javax.swing.event.*; +import java.util.EventObject; +import java.io.Serializable; + +public class AbstractCellEditor implements CellEditor { + + protected EventListenerList listenerList = new EventListenerList(); + + public Object getCellEditorValue() { return null; } + public boolean isCellEditable(EventObject e) { return true; } + public boolean shouldSelectCell(EventObject anEvent) { return false; } + public boolean stopCellEditing() { return true; } + public void cancelCellEditing() {} + + public void addCellEditorListener(CellEditorListener l) { + listenerList.add(CellEditorListener.class, l); + } + + public void removeCellEditorListener(CellEditorListener l) { + listenerList.remove(CellEditorListener.class, l); + } + + /* + * Notify all listeners that have registered interest for + * notification on this event type. + * @see EventListenerList + */ + protected void fireEditingStopped() { + // Guaranteed to return a non-null array + Object[] listeners = listenerList.getListenerList(); + // Process the listeners last to first, notifying + // those that are interested in this event + for (int i = listeners.length-2; i>=0; i-=2) { + if (listeners[i]==CellEditorListener.class) { + ((CellEditorListener)listeners[i+1]).editingStopped(new ChangeEvent(this)); + } + } + } + + /* + * Notify all listeners that have registered interest for + * notification on this event type. + * @see EventListenerList + */ + protected void fireEditingCanceled() { + // Guaranteed to return a non-null array + Object[] listeners = listenerList.getListenerList(); + // Process the listeners last to first, notifying + // those that are interested in this event + for (int i = listeners.length-2; i>=0; i-=2) { + if (listeners[i]==CellEditorListener.class) { + ((CellEditorListener)listeners[i+1]).editingCanceled(new ChangeEvent(this)); + } + } + } +} --- rhino-1.7R2.orig/debian/src_from_treetable_article_see_bug409629/TreeTableExample2.java +++ rhino-1.7R2/debian/src_from_treetable_article_see_bug409629/TreeTableExample2.java @@ -0,0 +1,480 @@ +/* + * TreeTableExample2.java + * + * Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved. + * + * This software is the confidential and proprietary information of Sun + * Microsystems, Inc. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Sun. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import javax.swing.table.*; +import javax.swing.tree.*; +import java.awt.*; +import java.awt.event.*; +import java.text.NumberFormat; + +/** + * Assembles the UI. The UI consists of a JTreeTable and a status label. + * As nodes are loaded by the FileSystemModel2, in a background thread, + * the status label updates as well as the renderer to draw the node that + * is being loaded differently. + * + * @author Scott Violet + * @author Philip Milne + */ +public class TreeTableExample2 { + /** Number of instances of TreeTableExample2. */ + protected static int ttCount; + + /** Model for the JTreeTable. */ + protected FileSystemModel2 model; + /** Used to represent the model. */ + protected JTreeTable treeTable; + /** Row the is being reloaded. */ + protected int reloadRow; + /** TreePath being reloaded. */ + protected TreePath reloadPath; + /** A counter increment as the Timer fies and the same path is + * being reloaded. */ + protected int reloadCounter; + /** Timer used to update reload state. */ + protected Timer timer; + /** Used to indicate status. */ + protected JLabel statusLabel; + /** Frame containing everything. */ + protected JFrame frame; + /** Path created with. */ + protected String path; + + + public TreeTableExample2(String path) { + this.path = path; + ttCount++; + + frame = createFrame(); + + Container cPane = frame.getContentPane(); + JMenuBar mb = createMenuBar(); + + model = createModel(path); + treeTable = createTreeTable(); + statusLabel = createStatusLabel(); + cPane.add(new JScrollPane(treeTable)); + cPane.add(statusLabel, BorderLayout.SOUTH); + + reloadRow = -1; + frame.setJMenuBar(mb); + frame.pack(); + frame.show(); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + reload(model.getRoot()); + } + }); + } + + /** + * Creates and return a JLabel that is used to indicate the status + * of loading. + */ + protected JLabel createStatusLabel() { + JLabel retLabel = new JLabel(" "); + + retLabel.setHorizontalAlignment(JLabel.RIGHT); + retLabel.setBorder(new BevelBorder(BevelBorder.LOWERED)); + return retLabel; + } + + /** + * Creates and returns the instanceof JTreeTable that will be used. + * This also creates, but does not start, the Timer that is used to + * update the display as files are loaded. + */ + protected JTreeTable createTreeTable() { + JTreeTable treeTable = new JTreeTable(model); + + treeTable.getColumnModel().getColumn(1).setCellRenderer + (new IndicatorRenderer()); + + Reloader rl = new Reloader(); + + timer = new Timer(700, rl); + timer.setRepeats(true); + treeTable.getTree().addTreeExpansionListener(rl); + return treeTable; + } + + /** + * Creates the FileSystemModel2 that will be used. + */ + protected FileSystemModel2 createModel(String path) { + return new FileSystemModel2(path); + } + + /** + * Creates the JFrame that will contain everything. + */ + protected JFrame createFrame() { + JFrame retFrame = new JFrame("TreeTable II"); + + retFrame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent we) { + if (--ttCount == 0) { + System.exit(0); + } + } + }); + return retFrame; + } + + /** + * Creates a menu bar. + */ + protected JMenuBar createMenuBar() { + JMenu fileMenu = new JMenu("File"); + JMenuItem menuItem; + + menuItem = new JMenuItem("Open"); + menuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + JFileChooser fc = new JFileChooser(path); + + fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + int result = fc.showOpenDialog(frame); + + if (result == JFileChooser.APPROVE_OPTION) { + String newPath = fc.getSelectedFile().getPath(); + + new TreeTableExample2(newPath); + } + } + }); + fileMenu.add(menuItem); + fileMenu.addSeparator(); + + menuItem = new JMenuItem("Reload"); + menuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + TreePath path = treeTable.getTree().getSelectionPath(); + + if (path != null) { + model.stopLoading(); + reload(path.getLastPathComponent()); + } + } + }); + fileMenu.add(menuItem); + + menuItem = new JMenuItem("Stop"); + menuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + model.stopLoading(); + } + }); + fileMenu.add(menuItem); + + fileMenu.addSeparator(); + + menuItem = new JMenuItem("Exit"); + menuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + System.exit(0); + } + }); + fileMenu.add(menuItem); + + + // Create a menu bar + JMenuBar menuBar = new JMenuBar(); + + menuBar.add(fileMenu); + + // Menu for the look and feels (lafs). + UIManager.LookAndFeelInfo[] lafs = UIManager. + getInstalledLookAndFeels(); + ButtonGroup lafGroup = new ButtonGroup(); + + JMenu optionsMenu = new JMenu("Options"); + + menuBar.add(optionsMenu); + + for(int i = 0; i < lafs.length; i++) { + JRadioButtonMenuItem rb = new JRadioButtonMenuItem(lafs[i]. + getName()); + optionsMenu.add(rb); + rb.setSelected(UIManager.getLookAndFeel().getName().equals + (lafs[i].getName())); + rb.putClientProperty("UIKey", lafs[i]); + rb.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent ae) { + JRadioButtonMenuItem rb2 = (JRadioButtonMenuItem)ae. + getSource(); + if(rb2.isSelected()) { + UIManager.LookAndFeelInfo info = + (UIManager.LookAndFeelInfo) + rb2.getClientProperty("UIKey"); + try { + UIManager.setLookAndFeel(info.getClassName()); + SwingUtilities.updateComponentTreeUI(frame); + } + catch (Exception e) { + System.err.println("unable to set UI " + + e.getMessage()); + } + } + } + }); + lafGroup.add(rb); + } + return menuBar; + } + + /** + * Invoked to reload the children of a particular node. This will + * also restart the timer. + */ + protected void reload(Object node) { + model.reloadChildren(node); + if (!timer.isRunning()) { + timer.start(); + } + } + + /** + * Updates the status label based on reloadRow. + */ + protected void updateStatusLabel() { + if (reloadPath != null) { + statusLabel.setText("Reloading: " + model.getPath + (reloadPath.getLastPathComponent())); + if ((reloadCounter % 4) < 2) { + statusLabel.setForeground(Color.red); + } + else { + statusLabel.setForeground(Color.blue); + } + } + else if (!model.isReloading()) { + statusLabel.setText("Total Size: " + NumberFormat.getInstance(). + format(model.getTotalSize(model.getRoot()))); + statusLabel.setForeground(Color.black); + } + } + + + /** + * Reloader is the ActionListener used in the Timer. In response to + * the timer updating it will reset the reloadRow/reloadPath and + * generate the necessary event so that the display will update. It + * also implements the TreeExpansionListener so that if the tree is + * altered while loading the reloadRow is updated accordingly. + */ + class Reloader implements ActionListener, TreeExpansionListener { + public void actionPerformed(ActionEvent ae) { + if (!model.isReloading()) { + // No longer loading. + timer.stop(); + if (reloadRow != -1) { + generateChangeEvent(reloadRow); + } + reloadRow = -1; + reloadPath = null; + } + else { + // Still loading, see if paths changed. + TreePath newPath = model.getPathLoading(); + + if (newPath == null) { + // Hmm... Will usually indicate the reload thread + // completed between time we asked if reloading. + if (reloadRow != -1) { + generateChangeEvent(reloadRow); + } + reloadRow = -1; + reloadPath = null; + } + else { + // Ok, valid path, see if matches last path. + int newRow = treeTable.getTree().getRowForPath + (newPath); + + if (newPath.equals(reloadPath)) { + reloadCounter = (reloadCounter + 1) % 8; + if (newRow != reloadRow) { + int lastRow = reloadRow; + + reloadRow = newRow; + generateChangeEvent(lastRow); + } + generateChangeEvent(reloadRow); + } + else { + int lastRow = reloadRow; + + reloadCounter = 0; + reloadRow = newRow; + reloadPath = newPath; + if (lastRow != reloadRow) { + generateChangeEvent(lastRow); + } + generateChangeEvent(reloadRow); + } + } + } + updateStatusLabel(); + } + + /** + * Generates and update event for the specified row. FileSystemModel2 + * could do this, but it would not know when the row has changed + * as a result of expanding/collapsing nodes in the tree. + */ + protected void generateChangeEvent(int row) { + if (row != -1) { + AbstractTableModel tModel = (AbstractTableModel)treeTable. + getModel(); + + tModel.fireTableChanged(new TableModelEvent + (tModel, row, row, 1)); + } + } + + // + // TreeExpansionListener + // + + /** + * Invoked when the tree has expanded. + */ + public void treeExpanded(TreeExpansionEvent te) { + updateRow(); + } + + /** + * Invoked when the tree has collapsed. + */ + public void treeCollapsed(TreeExpansionEvent te) { + updateRow(); + } + + /** + * Updates the reloadRow and path, this does not genernate a + * change event. + */ + protected void updateRow() { + reloadPath = model.getPathLoading(); + + if (reloadPath != null) { + reloadRow = treeTable.getTree().getRowForPath(reloadPath); + } + } + } + + + /** + * A renderer that will give an indicator when a cell is being reloaded. + */ + class IndicatorRenderer extends DefaultTableCellRenderer { + /** Makes sure the number of displayed in an internationalized + * manner. */ + protected NumberFormat formatter; + /** Row that is currently being painted. */ + protected int lastRow; + + + IndicatorRenderer() { + setHorizontalAlignment(JLabel.RIGHT); + formatter = NumberFormat.getInstance(); + } + + /** + * Invoked as part of DefaultTableCellRenderers implemention. Sets + * the text of the label. + */ + public void setValue(Object value) { + setText((value == null) ? "---" : formatter.format(value)); + } + + /** + * Returns this. + */ + public Component getTableCellRendererComponent(JTable table, + Object value, boolean isSelected, boolean hasFocus, + int row, int column) { + super.getTableCellRendererComponent(table, value, isSelected, + hasFocus, row, column); + lastRow = row; + return this; + } + + /** + * If the row being painted is also being reloaded this will draw + * a little indicator. + */ + public void paint(Graphics g) { + if (lastRow == reloadRow) { + int width = getWidth(); + int height = getHeight(); + + g.setColor(getBackground()); + g.fillRect(0, 0, width, height); + g.setColor(getForeground()); + + int diameter = Math.min(width, height); + + if (reloadCounter < 5) { + g.fillArc((width - diameter) / 2, (height - diameter) / 2, + diameter, diameter, 90, -(reloadCounter * 90)); + } + else { + g.fillArc((width - diameter) / 2, (height - diameter) / 2, + diameter, diameter, 90, + (4 - reloadCounter % 4) * 90); + } + } + else { + super.paint(g); + } + } + } + + + public static void main(String[] args) { + if (args.length > 0) { + for (int counter = args.length - 1; counter >= 0; counter--) { + new TreeTableExample2(args[counter]); + } + } + else { + String path; + + try { + path = System.getProperty("user.home"); + if (path != null) { + new TreeTableExample2(path); + } + } + catch (SecurityException se) { + path = null; + } + if (path == null) { + System.out.println("Could not determine home directory"); + } + } + } +} --- rhino-1.7R2.orig/debian/src_from_treetable_article_see_bug409629/MergeSort.java +++ rhino-1.7R2/debian/src_from_treetable_article_see_bug409629/MergeSort.java @@ -0,0 +1,84 @@ +/* + * MergeSort.java + * + * Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved. + * + * This software is the confidential and proprietary information of Sun + * Microsystems, Inc. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Sun. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + +/** + * An implementation of MergeSort, needs to be subclassed to + * compare the terms. + * + * @author Scott Violet + */ +public abstract class MergeSort extends Object { + protected Object toSort[]; + protected Object swapSpace[]; + + public void sort(Object array[]) { + if(array != null && array.length > 1) + { + int maxLength; + + maxLength = array.length; + swapSpace = new Object[maxLength]; + toSort = array; + this.mergeSort(0, maxLength - 1); + swapSpace = null; + toSort = null; + } + } + + public abstract int compareElementsAt(int beginLoc, int endLoc); + + protected void mergeSort(int begin, int end) { + if(begin != end) + { + int mid; + + mid = (begin + end) / 2; + this.mergeSort(begin, mid); + this.mergeSort(mid + 1, end); + this.merge(begin, mid, end); + } + } + + protected void merge(int begin, int middle, int end) { + int firstHalf, secondHalf, count; + + firstHalf = count = begin; + secondHalf = middle + 1; + while((firstHalf <= middle) && (secondHalf <= end)) + { + if(this.compareElementsAt(secondHalf, firstHalf) < 0) + swapSpace[count++] = toSort[secondHalf++]; + else + swapSpace[count++] = toSort[firstHalf++]; + } + if(firstHalf <= middle) + { + while(firstHalf <= middle) + swapSpace[count++] = toSort[firstHalf++]; + } + else + { + while(secondHalf <= end) + swapSpace[count++] = toSort[secondHalf++]; + } + for(count = begin;count <= end;count++) + toSort[count] = swapSpace[count]; + } +} --- rhino-1.7R2.orig/debian/src_from_treetable_article_see_bug409629/AbstractTreeTableModel.java +++ rhino-1.7R2/debian/src_from_treetable_article_see_bug409629/AbstractTreeTableModel.java @@ -0,0 +1,195 @@ +/* + * @(#)AbstractTreeTableModel.java 1.2 98/10/27 + * + * Copyright 1997, 1998 by Sun Microsystems, Inc., + * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. + * All rights reserved. + * + * This software is the confidential and proprietary information + * of Sun Microsystems, Inc. ("Confidential Information"). You + * shall not disclose such Confidential Information and shall use + * it only in accordance with the terms of the license agreement + * you entered into with Sun. + */ + +import javax.swing.tree.*; +import javax.swing.event.*; + +/** + * @version 1.2 10/27/98 + * An abstract implementation of the TreeTableModel interface, handling the list + * of listeners. + * @author Philip Milne + */ + +public abstract class AbstractTreeTableModel implements TreeTableModel { + protected Object root; + protected EventListenerList listenerList = new EventListenerList(); + + public AbstractTreeTableModel(Object root) { + this.root = root; + } + + // + // Default implmentations for methods in the TreeModel interface. + // + + public Object getRoot() { + return root; + } + + public boolean isLeaf(Object node) { + return getChildCount(node) == 0; + } + + public void valueForPathChanged(TreePath path, Object newValue) {} + + // This is not called in the JTree's default mode: use a naive implementation. + public int getIndexOfChild(Object parent, Object child) { + for (int i = 0; i < getChildCount(parent); i++) { + if (getChild(parent, i).equals(child)) { + return i; + } + } + return -1; + } + + public void addTreeModelListener(TreeModelListener l) { + listenerList.add(TreeModelListener.class, l); + } + + public void removeTreeModelListener(TreeModelListener l) { + listenerList.remove(TreeModelListener.class, l); + } + + /* + * Notify all listeners that have registered interest for + * notification on this event type. The event instance + * is lazily created using the parameters passed into + * the fire method. + * @see EventListenerList + */ + protected void fireTreeNodesChanged(Object source, Object[] path, + int[] childIndices, + Object[] children) { + // Guaranteed to return a non-null array + Object[] listeners = listenerList.getListenerList(); + TreeModelEvent e = null; + // Process the listeners last to first, notifying + // those that are interested in this event + for (int i = listeners.length-2; i>=0; i-=2) { + if (listeners[i]==TreeModelListener.class) { + // Lazily create the event: + if (e == null) + e = new TreeModelEvent(source, path, + childIndices, children); + ((TreeModelListener)listeners[i+1]).treeNodesChanged(e); + } + } + } + + /* + * Notify all listeners that have registered interest for + * notification on this event type. The event instance + * is lazily created using the parameters passed into + * the fire method. + * @see EventListenerList + */ + protected void fireTreeNodesInserted(Object source, Object[] path, + int[] childIndices, + Object[] children) { + // Guaranteed to return a non-null array + Object[] listeners = listenerList.getListenerList(); + TreeModelEvent e = null; + // Process the listeners last to first, notifying + // those that are interested in this event + for (int i = listeners.length-2; i>=0; i-=2) { + if (listeners[i]==TreeModelListener.class) { + // Lazily create the event: + if (e == null) + e = new TreeModelEvent(source, path, + childIndices, children); + ((TreeModelListener)listeners[i+1]).treeNodesInserted(e); + } + } + } + + /* + * Notify all listeners that have registered interest for + * notification on this event type. The event instance + * is lazily created using the parameters passed into + * the fire method. + * @see EventListenerList + */ + protected void fireTreeNodesRemoved(Object source, Object[] path, + int[] childIndices, + Object[] children) { + // Guaranteed to return a non-null array + Object[] listeners = listenerList.getListenerList(); + TreeModelEvent e = null; + // Process the listeners last to first, notifying + // those that are interested in this event + for (int i = listeners.length-2; i>=0; i-=2) { + if (listeners[i]==TreeModelListener.class) { + // Lazily create the event: + if (e == null) + e = new TreeModelEvent(source, path, + childIndices, children); + ((TreeModelListener)listeners[i+1]).treeNodesRemoved(e); + } + } + } + + /* + * Notify all listeners that have registered interest for + * notification on this event type. The event instance + * is lazily created using the parameters passed into + * the fire method. + * @see EventListenerList + */ + protected void fireTreeStructureChanged(Object source, Object[] path, + int[] childIndices, + Object[] children) { + // Guaranteed to return a non-null array + Object[] listeners = listenerList.getListenerList(); + TreeModelEvent e = null; + // Process the listeners last to first, notifying + // those that are interested in this event + for (int i = listeners.length-2; i>=0; i-=2) { + if (listeners[i]==TreeModelListener.class) { + // Lazily create the event: + if (e == null) + e = new TreeModelEvent(source, path, + childIndices, children); + ((TreeModelListener)listeners[i+1]).treeStructureChanged(e); + } + } + } + + // + // Default impelmentations for methods in the TreeTableModel interface. + // + + public Class getColumnClass(int column) { return Object.class; } + + /** By default, make the column with the Tree in it the only editable one. + * Making this column editable causes the JTable to forward mouse + * and keyboard events in the Tree column to the underlying JTree. + */ + public boolean isCellEditable(Object node, int column) { + return getColumnClass(column) == TreeTableModel.class; + } + + public void setValueAt(Object aValue, Object node, int column) {} + + + // Left to be implemented in the subclass: + + /* + * public Object getChild(Object parent, int index) + * public int getChildCount(Object parent) + * public int getColumnCount() + * public String getColumnName(Object node, int column) + * public Object getValueAt(Object node, int column) + */ +} --- rhino-1.7R2.orig/debian/src_from_treetable_article_see_bug409629/JTreeTable.java +++ rhino-1.7R2/debian/src_from_treetable_article_see_bug409629/JTreeTable.java @@ -0,0 +1,356 @@ +/* + * @(#)JTreeTable.java 1.2 98/10/27 + * + * Copyright 1997, 1998 by Sun Microsystems, Inc., + * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. + * All rights reserved. + * + * This software is the confidential and proprietary information + * of Sun Microsystems, Inc. ("Confidential Information"). You + * shall not disclose such Confidential Information and shall use + * it only in accordance with the terms of the license agreement + * you entered into with Sun. + */ + + + package org.mozilla.javascript.tools.debugger.downloaded; + import javax.swing.*; + +import javax.swing.event.*; +import javax.swing.tree.*; +import javax.swing.table.*; + +import java.awt.Dimension; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Rectangle; + +import java.awt.event.MouseEvent; + +import java.util.EventObject; + +/** + * This example shows how to create a simple JTreeTable component, + * by using a JTree as a renderer (and editor) for the cells in a + * particular column in the JTable. + * + * @version 1.2 10/27/98 + * + * @author Philip Milne + * @author Scott Violet + */ +public class JTreeTable extends JTable { + /** A subclass of JTree. */ + protected TreeTableCellRenderer tree; + + public JTreeTable(TreeTableModel treeTableModel) { + super(); + + // Create the tree. It will be used as a renderer and editor. + tree = new TreeTableCellRenderer(treeTableModel); + + // Install a tableModel representing the visible rows in the tree. + super.setModel(new TreeTableModelAdapter(treeTableModel, tree)); + + // Force the JTable and JTree to share their row selection models. + ListToTreeSelectionModelWrapper selectionWrapper = new + ListToTreeSelectionModelWrapper(); + tree.setSelectionModel(selectionWrapper); + setSelectionModel(selectionWrapper.getListSelectionModel()); + + // Install the tree editor renderer and editor. + setDefaultRenderer(TreeTableModel.class, tree); + setDefaultEditor(TreeTableModel.class, new TreeTableCellEditor()); + + // No grid. + setShowGrid(false); + + // No intercell spacing + setIntercellSpacing(new Dimension(0, 0)); + + // And update the height of the trees row to match that of + // the table. + if (tree.getRowHeight() < 1) { + // Metal looks better like this. + setRowHeight(18); + } + } + + /** + * Overridden to message super and forward the method to the tree. + * Since the tree is not actually in the component hieachy it will + * never receive this unless we forward it in this manner. + */ + public void updateUI() { + super.updateUI(); + if(tree != null) { + tree.updateUI(); + } + // Use the tree's default foreground and background colors in the + // table. + LookAndFeel.installColorsAndFont(this, "Tree.background", + "Tree.foreground", "Tree.font"); + } + + /* Workaround for BasicTableUI anomaly. Make sure the UI never tries to + * paint the editor. The UI currently uses different techniques to + * paint the renderers and editors and overriding setBounds() below + * is not the right thing to do for an editor. Returning -1 for the + * editing row in this case, ensures the editor is never painted. + */ + public int getEditingRow() { + return (getColumnClass(editingColumn) == TreeTableModel.class) ? -1 : + editingRow; + } + + /** + * Overridden to pass the new rowHeight to the tree. + */ + public void setRowHeight(int rowHeight) { + super.setRowHeight(rowHeight); + if (tree != null && tree.getRowHeight() != rowHeight) { + tree.setRowHeight(getRowHeight()); + } + } + + /** + * Returns the tree that is being shared between the model. + */ + public JTree getTree() { + return tree; + } + + /** + * A TreeCellRenderer that displays a JTree. + */ + public class TreeTableCellRenderer extends JTree implements + TableCellRenderer { + /** Last table/tree row asked to renderer. */ + protected int visibleRow; + + public TreeTableCellRenderer(TreeModel model) { + super(model); + } + + /** + * updateUI is overridden to set the colors of the Tree's renderer + * to match that of the table. + */ + public void updateUI() { + super.updateUI(); + // Make the tree's cell renderer use the table's cell selection + // colors. + TreeCellRenderer tcr = getCellRenderer(); + if (tcr instanceof DefaultTreeCellRenderer) { + DefaultTreeCellRenderer dtcr = ((DefaultTreeCellRenderer)tcr); + // For 1.1 uncomment this, 1.2 has a bug that will cause an + // exception to be thrown if the border selection color is + // null. + // dtcr.setBorderSelectionColor(null); + dtcr.setTextSelectionColor(UIManager.getColor + ("Table.selectionForeground")); + dtcr.setBackgroundSelectionColor(UIManager.getColor + ("Table.selectionBackground")); + } + } + + /** + * Sets the row height of the tree, and forwards the row height to + * the table. + */ + public void setRowHeight(int rowHeight) { + if (rowHeight > 0) { + super.setRowHeight(rowHeight); + if (JTreeTable.this != null && + JTreeTable.this.getRowHeight() != rowHeight) { + JTreeTable.this.setRowHeight(getRowHeight()); + } + } + } + + /** + * This is overridden to set the height to match that of the JTable. + */ + public void setBounds(int x, int y, int w, int h) { + super.setBounds(x, 0, w, JTreeTable.this.getHeight()); + } + + /** + * Sublcassed to translate the graphics such that the last visible + * row will be drawn at 0,0. + */ + public void paint(Graphics g) { + g.translate(0, -visibleRow * getRowHeight()); + super.paint(g); + } + + /** + * TreeCellRenderer method. Overridden to update the visible row. + */ + public Component getTableCellRendererComponent(JTable table, + Object value, + boolean isSelected, + boolean hasFocus, + int row, int column) { + if(isSelected) + setBackground(table.getSelectionBackground()); + else + setBackground(table.getBackground()); + + visibleRow = row; + return this; + } + } + + + /** + * TreeTableCellEditor implementation. Component returned is the + * JTree. + */ + public class TreeTableCellEditor extends AbstractCellEditor implements + TableCellEditor { + public Component getTableCellEditorComponent(JTable table, + Object value, + boolean isSelected, + int r, int c) { + return tree; + } + + /** + * Overridden to return false, and if the event is a mouse event + * it is forwarded to the tree.

+ * The behavior for this is debatable, and should really be offered + * as a property. By returning false, all keyboard actions are + * implemented in terms of the table. By returning true, the + * tree would get a chance to do something with the keyboard + * events. For the most part this is ok. But for certain keys, + * such as left/right, the tree will expand/collapse where as + * the table focus should really move to a different column. Page + * up/down should also be implemented in terms of the table. + * By returning false this also has the added benefit that clicking + * outside of the bounds of the tree node, but still in the tree + * column will select the row, whereas if this returned true + * that wouldn't be the case. + *

By returning false we are also enforcing the policy that + * the tree will never be editable (at least by a key sequence). + */ + public boolean isCellEditable(EventObject e) { + if (e instanceof MouseEvent) { + for (int counter = getColumnCount() - 1; counter >= 0; + counter--) { + if (getColumnClass(counter) == TreeTableModel.class) { + MouseEvent me = (MouseEvent)e; + MouseEvent newME = new MouseEvent(tree, me.getID(), + me.getWhen(), me.getModifiers(), + me.getX() - getCellRect(0, counter, true).x, + me.getY(), me.getClickCount(), + me.isPopupTrigger()); + tree.dispatchEvent(newME); + break; + } + } + } + return false; + } + } + + + /** + * ListToTreeSelectionModelWrapper extends DefaultTreeSelectionModel + * to listen for changes in the ListSelectionModel it maintains. Once + * a change in the ListSelectionModel happens, the paths are updated + * in the DefaultTreeSelectionModel. + */ + public class ListToTreeSelectionModelWrapper extends DefaultTreeSelectionModel { + /** Set to true when we are updating the ListSelectionModel. */ + protected boolean updatingListSelectionModel; + + public ListToTreeSelectionModelWrapper() { + super(); + getListSelectionModel().addListSelectionListener + (createListSelectionListener()); + } + + /** + * Returns the list selection model. ListToTreeSelectionModelWrapper + * listens for changes to this model and updates the selected paths + * accordingly. + */ + public ListSelectionModel getListSelectionModel() { + return listSelectionModel; + } + + /** + * This is overridden to set updatingListSelectionModel + * and message super. This is the only place DefaultTreeSelectionModel + * alters the ListSelectionModel. + */ + public void resetRowSelection() { + if(!updatingListSelectionModel) { + updatingListSelectionModel = true; + try { + super.resetRowSelection(); + } + finally { + updatingListSelectionModel = false; + } + } + // Notice how we don't message super if + // updatingListSelectionModel is true. If + // updatingListSelectionModel is true, it implies the + // ListSelectionModel has already been updated and the + // paths are the only thing that needs to be updated. + } + + /** + * Creates and returns an instance of ListSelectionHandler. + */ + protected ListSelectionListener createListSelectionListener() { + return new ListSelectionHandler(); + } + + /** + * If updatingListSelectionModel is false, this will + * reset the selected paths from the selected rows in the list + * selection model. + */ + protected void updateSelectedPathsFromSelectedRows() { + if(!updatingListSelectionModel) { + updatingListSelectionModel = true; + try { + // This is way expensive, ListSelectionModel needs an + // enumerator for iterating. + int min = listSelectionModel.getMinSelectionIndex(); + int max = listSelectionModel.getMaxSelectionIndex(); + + clearSelection(); + if(min != -1 && max != -1) { + for(int counter = min; counter <= max; counter++) { + if(listSelectionModel.isSelectedIndex(counter)) { + TreePath selPath = tree.getPathForRow + (counter); + + if(selPath != null) { + addSelectionPath(selPath); + } + } + } + } + } + finally { + updatingListSelectionModel = false; + } + } + } + + /** + * Class responsible for calling updateSelectedPathsFromSelectedRows + * when the selection of the list changse. + */ + class ListSelectionHandler implements ListSelectionListener { + public void valueChanged(ListSelectionEvent e) { + updateSelectedPathsFromSelectedRows(); + } + } + } +} --- rhino-1.7R2.orig/debian/src_from_treetable_article_see_bug409629/TreeTableModel.java +++ rhino-1.7R2/debian/src_from_treetable_article_see_bug409629/TreeTableModel.java @@ -0,0 +1,71 @@ +/* + * TreeTableModel.java + * + * Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved. + * + * This software is the confidential and proprietary information of Sun + * Microsystems, Inc. ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Sun. + * + * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE + * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES + * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING + * THIS SOFTWARE OR ITS DERIVATIVES. + * + */ + + + package org.mozilla.javascript.tools.debugger.downloaded; + import javax.swing.tree.TreeModel; + + +/** + * TreeTableModel is the model used by a JTreeTable. It extends TreeModel + * to add methods for getting inforamtion about the set of columns each + * node in the TreeTableModel may have. Each column, like a column in + * a TableModel, has a name and a type associated with it. Each node in + * the TreeTableModel can return a value for each of the columns and + * set that value if isCellEditable() returns true. + * + * @author Philip Milne + * @author Scott Violet + */ +public interface TreeTableModel extends TreeModel +{ + /** + * Returns the number ofs availible column. + */ + public int getColumnCount(); + + /** + * Returns the name for column number column. + */ + public String getColumnName(int column); + + /** + * Returns the type for column number column. + */ + public Class getColumnClass(int column); + + /** + * Returns the value to be displayed for node node, + * at column number column. + */ + public Object getValueAt(Object node, int column); + + /** + * Indicates whether the the value for node node, + * at column number column is editable. + */ + public boolean isCellEditable(Object node, int column); + + /** + * Sets the value for node node, + * at column number column. + */ + public void setValueAt(Object aValue, Object node, int column); +} --- rhino-1.7R2.orig/debian/src_from_treetable_article_see_bug409629/TreeTableModelAdapter.java +++ rhino-1.7R2/debian/src_from_treetable_article_see_bug409629/TreeTableModelAdapter.java @@ -0,0 +1,128 @@ +/* + * @(#)TreeTableModelAdapter.java 1.2 98/10/27 + * + * Copyright 1997, 1998 by Sun Microsystems, Inc., + * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. + * All rights reserved. + * + * This software is the confidential and proprietary information + * of Sun Microsystems, Inc. ("Confidential Information"). You + * shall not disclose such Confidential Information and shall use + * it only in accordance with the terms of the license agreement + * you entered into with Sun. + */ + + + package org.mozilla.javascript.tools.debugger.downloaded; + import javax.swing.JTree; + +import javax.swing.SwingUtilities; +import javax.swing.table.AbstractTableModel; +import javax.swing.tree.TreePath; +import javax.swing.event.TreeExpansionEvent; +import javax.swing.event.TreeExpansionListener; +import javax.swing.event.TreeModelEvent; +import javax.swing.event.TreeModelListener; + +/** + * This is a wrapper class takes a TreeTableModel and implements + * the table model interface. The implementation is trivial, with + * all of the event dispatching support provided by the superclass: + * the AbstractTableModel. + * + * @version 1.2 10/27/98 + * + * @author Philip Milne + * @author Scott Violet + */ +public class TreeTableModelAdapter extends AbstractTableModel +{ + JTree tree; + TreeTableModel treeTableModel; + + public TreeTableModelAdapter(TreeTableModel treeTableModel, JTree tree) { + this.tree = tree; + this.treeTableModel = treeTableModel; + + tree.addTreeExpansionListener(new TreeExpansionListener() { + // Don't use fireTableRowsInserted() here; the selection model + // would get updated twice. + public void treeExpanded(TreeExpansionEvent event) { + fireTableDataChanged(); + } + public void treeCollapsed(TreeExpansionEvent event) { + fireTableDataChanged(); + } + }); + + // Install a TreeModelListener that can update the table when + // tree changes. We use delayedFireTableDataChanged as we can + // not be guaranteed the tree will have finished processing + // the event before us. + treeTableModel.addTreeModelListener(new TreeModelListener() { + public void treeNodesChanged(TreeModelEvent e) { + delayedFireTableDataChanged(); + } + + public void treeNodesInserted(TreeModelEvent e) { + delayedFireTableDataChanged(); + } + + public void treeNodesRemoved(TreeModelEvent e) { + delayedFireTableDataChanged(); + } + + public void treeStructureChanged(TreeModelEvent e) { + delayedFireTableDataChanged(); + } + }); + } + + // Wrappers, implementing TableModel interface. + + public int getColumnCount() { + return treeTableModel.getColumnCount(); + } + + public String getColumnName(int column) { + return treeTableModel.getColumnName(column); + } + + public Class getColumnClass(int column) { + return treeTableModel.getColumnClass(column); + } + + public int getRowCount() { + return tree.getRowCount(); + } + + protected Object nodeForRow(int row) { + TreePath treePath = tree.getPathForRow(row); + return treePath.getLastPathComponent(); + } + + public Object getValueAt(int row, int column) { + return treeTableModel.getValueAt(nodeForRow(row), column); + } + + public boolean isCellEditable(int row, int column) { + return treeTableModel.isCellEditable(nodeForRow(row), column); + } + + public void setValueAt(Object value, int row, int column) { + treeTableModel.setValueAt(value, nodeForRow(row), column); + } + + /** + * Invokes fireTableDataChanged after all the pending events have been + * processed. SwingUtilities.invokeLater is used to handle this. + */ + protected void delayedFireTableDataChanged() { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + fireTableDataChanged(); + } + }); + } +} + --- rhino-1.7R2.orig/debian/patches/02_exclude-jdk15.patch +++ rhino-1.7R2/debian/patches/02_exclude-jdk15.patch @@ -0,0 +1,12 @@ +Description: Exclude everything except "jdk1.5/**" when building + 1.5 specific source code. +--- a/src/build.xml ++++ b/src/build.xml +@@ -72,6 +72,7 @@ + + + + +@@ -76,6 +77,7 @@ + debug="${debug}" + target="${target-jvm}" + source="${source-level}" ++ nowarn="true" + > + + --- rhino-1.7R2.orig/debian/patches/series +++ rhino-1.7R2/debian/patches/series @@ -0,0 +1,2 @@ +01_rhino-nowarn.patch +02_exclude-jdk15.patch