[Git][java-team/libjide-oss-java][upstream] New upstream version 3.7.6+dfsg

Markus Koschany gitlab at salsa.debian.org
Sat Jul 20 04:41:15 BST 2019



Markus Koschany pushed to branch upstream at Debian Java Maintainers / libjide-oss-java


Commits:
76a1cfff by Markus Koschany at 2019-07-20T02:38:29Z
New upstream version 3.7.6+dfsg
- - - - -


23 changed files:

- + .gitignore
- ChangeLog
- JIDE Common Layer.iml
- pom.xml
- + pom_compile.xml
- + pom_deploy.xml
- properties/com/jidesoft/swing/swing_da.properties
- + src-apple/README.txt
- + src-apple/apple/laf/JRSUIConstants.java
- + src-apple/com/apple/laf/AquaPopupMenuUI.java
- + src-apple/com/apple/laf/AquaSliderUI.java
- + src-apple/com/apple/laf/ScreenPopupFactory.java
- src/com/jidesoft/plaf/LookAndFeelFactory.java
- src/com/jidesoft/plaf/basic/BasicJideButtonUI.java
- src/com/jidesoft/plaf/basic/BasicJideLabelUI.java
- src/com/jidesoft/plaf/basic/BasicJideSplitButtonUI.java
- src/com/jidesoft/plaf/basic/BasicJideTabbedPaneUI.java
- src/com/jidesoft/plaf/office2007/Office2007Painter.java
- src/com/jidesoft/swing/CheckBoxListCellRenderer.java
- src/com/jidesoft/swing/JideToggleSplitButton.java
- + src/com/jidesoft/swing/LegacyCheckBoxTree.java
- + src/com/jidesoft/swing/LegacyCheckBoxTreeCellRenderer.java
- + src/com/jidesoft/swing/LegacyCheckBoxTreeSelectionModel.java


Changes:

=====================================
.gitignore
=====================================
@@ -0,0 +1 @@
+/target/
\ No newline at end of file


=====================================
ChangeLog
=====================================
@@ -1,3 +1,67 @@
+2019-02-15  Wenjie Qiao <wqiao2 at gmail.com>
+
+	* JIDE Common Layer.iml,
+	src/com/jidesoft/plaf/office2007/Office2007Painter.java,
+	src/com/jidesoft/swing/CheckBoxListCellRenderer.java: 3.7.6 release
+
+2019-01-25  Wenjie Qiao <wqiao2 at gmail.com>
+
+	* src/com/jidesoft/swing/JideToggleSplitButton.java: 
+	Common,B,JideToggleSplitButton,Fixed the SELECTED_KEY is not updated
+	correctly when the selection state changed in
+	JideToggleSplitButton,,no
+
+2019-01-24  Wenjie Qiao <wqiao2 at gmail.com>
+
+	* src/com/jidesoft/swing/JideToggleSplitButton.java: 
+	Common,B,JideToggleSplitButton,Fixed the SELECTED_KEY is not updated
+	correctly when the selection state changed in
+	JideToggleSplitButton,,no
+
+2019-01-10  jidesoft <support at jidesoft.com>
+
+	* : Merge pull request #36 from wishkres/feature/LegacyCheckBoxTree Added LegacyCheckBoxTree component that uses LegacyTristateCheckBox
+	i…
+
+2018-12-15  jidesoft <anderson at jidesoft.com>
+
+	* src/com/jidesoft/plaf/LookAndFeelFactory.java: 
+	Common,B,LookAndFeelFactory,Fixed NoClassDefFoundError on Linux in
+	LookAndFeelFactory,83622,no
+
+2018-11-20  jidesoft <anderson at jidesoft.com>
+
+	* properties/com/jidesoft/swing/swing_da.properties,
+	src/com/jidesoft/plaf/basic/BasicJideButtonUI.java,
+	src/com/jidesoft/plaf/basic/BasicJideLabelUI.java,
+	src/com/jidesoft/plaf/basic/BasicJideSplitButtonUI.java,
+	src/com/jidesoft/plaf/basic/BasicJideTabbedPaneUI.java: 
+	Common,B,JideButton,Fixed a bug that the text is clipped on JDK
+	11,,no
+
+2018-10-24  jidesoft <anderson at jidesoft.com>
+
+	* JIDE Common Layer.iml: Grids,DualTable,Fixed a type in
+	addSelectionInterval etc. methods,,no Grids,ValueEditor,Set a
+	minimum size for the combobox in the ValueEditor,,no
+
+2018-09-27  jidesoft <support at jidesoft.com>
+
+	* : Merge pull request #32 from bourgesl/fix_build Fix maven build on JDK 8 / 9+
+
+2018-09-12  bourgesl <bourges.laurent at gmail.com>
+
+	* .gitignore, pom.xml, src-apple/README.txt,
+	src-apple/apple/laf/JRSUIConstants.java,
+	src-apple/com/apple/laf/AquaPopupMenuUI.java,
+	src-apple/com/apple/laf/AquaSliderUI.java,
+	src-apple/com/apple/laf/ScreenPopupFactory.java: Fixed JIDE-OSS
+	maven build: missing apple classes / use multi-release jar (8 / 9+)
+
+2018-06-22  frank <frank at jidesoft.com>
+
+	* pom.xml, pom_compile.xml, pom_deploy.xml: update pom
+
 2018-06-22  frank <frank at jidesoft.com>
 
 	* README.txt: update README.txt


=====================================
JIDE Common Layer.iml
=====================================
@@ -6,9 +6,8 @@
   <component name="NewModuleRootManager" inherit-compiler-output="true">
     <exclude-output />
     <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/properties" isTestSource="false" />
       <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/properties" type="java-resource" />
       <sourceFolder url="file://$MODULE_DIR$/src-jdk9" isTestSource="false" />
       <excludeFolder url="file://$MODULE_DIR$/classes" />
       <excludeFolder url="file://$MODULE_DIR$/javadoc" />


=====================================
pom.xml
=====================================
@@ -12,14 +12,17 @@
         <artifactId>oss-parent</artifactId>
         <version>7</version>
     </parent>
+
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.jidesoft</groupId>
     <artifactId>jide-oss</artifactId>
     <name>JIDE Common Layer</name>
     <version>3.7.4</version>
+
     <packaging>jar</packaging>
     <description>JIDE Common Layer (Professional Swing Components)</description>
     <url>https://github.com/jidesoft/jide-oss</url>
+
     <licenses>
         <license>
             <name>GPL with classpath exception</name>
@@ -32,6 +35,7 @@
             <distribution>repo</distribution>
         </license>
     </licenses>
+
     <developers>
         <developer>
             <id>jidesoft</id>
@@ -39,8 +43,19 @@
             <email>support at jidesoft.com</email>
         </developer>
     </developers>
+
+    <properties>
+        <!-- path to JDK9+ -->
+        <java9.jdk>/home/bourgesl/apps/jdk-9/</java9.jdk>
+        <java9.sourceDirectory>${project.basedir}/src-jdk9</java9.sourceDirectory>
+        <java9.build.outputDirectory>${project.build.directory}/classes-jdk9</java9.build.outputDirectory>
+        <!-- enable release tasks (javadoc, sources, release) -->
+        <skipRelease>true</skipRelease>
+    </properties>
+
     <build>
-        <sourceDirectory>src,src-jdk6</sourceDirectory>
+        <!-- define base src folder (common) -->
+        <sourceDirectory>src</sourceDirectory>
         <resources>
             <resource>
                 <directory>src</directory>
@@ -52,16 +67,136 @@
                 </includes>
             </resource>
         </resources>
+
         <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>3.0.0</version>
+                <executions>
+                    <execution>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <!-- add src-jdk8 and src-apple for JDK8 build -->
+                            <sources>
+                                <source>src-jdk8</source>
+                                <source>src-apple</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.7.0</version>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <version>1.8</version>
+                <executions>
+                    <execution>
+                        <id>compile-java9</id>
+                        <phase>compile</phase>
+                        <configuration>
+                            <tasks>
+                                <!-- build JDK9+ specific classes -->
+
+                                <mkdir dir="${java9.build.outputDirectory}" />
+                                <javac srcdir="${java9.sourceDirectory}"
+                                       destdir="${java9.build.outputDirectory}"
+                                       classpath="${project.build.outputDirectory}"
+                                       includeantruntime="false"
+                                       executable="${java9.jdk}/bin/javac" fork="true">
+
+                                    <compilerarg value="--add-exports"/>
+                                    <compilerarg value="java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED"/>
+                                    <compilerarg value="--add-exports"/>
+                                    <compilerarg value="java.desktop/sun.swing=ALL-UNNAMED"/>
+                                    <compilerarg value="--add-exports"/>
+                                    <compilerarg value="java.desktop/sun.awt.image=ALL-UNNAMED"/>
+                                    <compilerarg value="--add-exports"/>
+                                    <compilerarg value="java.desktop/sun.awt.windows=ALL-UNNAMED"/>
+                                    <compilerarg value="--add-exports"/>
+                                    <compilerarg value="java.base/sun.security.action=ALL-UNNAMED"/>
+
+                                    <!-- useless extra arguments (see Readme JDK9.txt) -->
+                                    <!--
+                                    -add-exports java.desktop/javax.swing.plaf.synth=ALL-UNNAMED
+                                    -add-exports java.desktop/sun.awt=ALL-UNNAMED
+                                    -add-exports java.desktop/sun.awt.shell=ALL-UNNAMED
+                                    -add-exports java.desktop/sun.awt.dnd=ALL-UNNAMED
+                                    -->
+                                </javac>
+                            </tasks>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <version>3.1.0</version>
+                <executions>
+                    <execution>
+                        <id>copy-resources</id>
+                        <phase>prepare-package</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <!-- copy JDK9+ specific classes into main classes (version 9+)-->
+                            <outputDirectory>${project.build.outputDirectory}/META-INF/versions/9</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${java9.build.outputDirectory}</directory>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>3.1.0</version>
                 <configuration>
-                    <source>1.5</source>
-                    <target>1.5</target>
+                    <excludes>
+                        <exclude>apple/**</exclude>
+                        <exclude>com/apple/**</exclude>
+                    </excludes>
+                    <archive>
+                        <!-- enable Multi-Release Jar file -->
+                        <manifestEntries>
+                            <Multi-Release>true</Multi-Release>
+                        </manifestEntries>
+                    </archive>
                 </configuration>
+                <executions>
+                    <execution>
+                        <id>default-jar</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
             </plugin>
             <plugin>
                 <artifactId>maven-source-plugin</artifactId>
+                <version>3.0.1</version>
+                <configuration>
+                    <skipSource>${skipRelease}</skipSource>
+                </configuration>
                 <executions>
                     <execution>
                         <goals>
@@ -72,6 +207,10 @@
             </plugin>
             <plugin>
                 <artifactId>maven-javadoc-plugin</artifactId>
+                <version>3.0.1</version>
+                <configuration>
+                    <skip>${skipRelease}</skip>
+                </configuration>
                 <executions>
                     <execution>
                         <goals>
@@ -89,11 +228,12 @@
             </extension>
         </extensions>
     </build>
+
     <profiles>
         <profile>
             <id>aqua</id>
             <activation>
-                <activeByDefault>true</activeByDefault>
+                <activeByDefault>!${skipRelease}</activeByDefault>
                 <property>
                     <name>performRelease</name>
                     <value>true</value>
@@ -123,12 +263,14 @@
             </build>
         </profile>
     </profiles>
+
     <distributionManagement>
         <repository>
             <id>sonatype-nexus-staging</id>
             <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
         </repository>
     </distributionManagement>
+
     <scm>
         <connection>scm:git:git://github.com/jidesoft/jide-oss.git</connection>
         <developerConnection>scm:git:https://jidesoft@github.com/jidesoft/jide-oss.git</developerConnection>


=====================================
pom_compile.xml
=====================================
@@ -0,0 +1,153 @@
+	<?xml version="1.0"?>
+<!--
+  ~ @(#)pom.xml 5/16/2012
+  ~
+  ~ Copyright 2002 - 2012 JIDE Software Inc. All rights reserved.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.sonatype.oss</groupId>
+        <artifactId>oss-parent</artifactId>
+        <version>7</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>com.jidesoft</groupId>
+    <artifactId>jide-oss</artifactId>
+    <name>JIDE Common Layer</name>
+    <version>3.7.4</version>
+    <packaging>jar</packaging>
+    <description>JIDE Common Layer (Professional Swing Components)</description>
+    <url>https://github.com/jidesoft/jide-oss</url>
+    <licenses>
+        <license>
+            <name>GPL with classpath exception</name>
+            <url>http://www.gnu.org/licenses/gpl.txt</url>
+            <distribution>repo</distribution>
+        </license>
+        <license>
+            <name>Free commercial license</name>
+            <url>http://www.jidesoft.com/purchase/SLA.htm</url>
+            <distribution>repo</distribution>
+        </license>
+    </licenses>
+    <developers>
+        <developer>
+            <id>jidesoft</id>
+            <name>jidesoft</name>
+            <email>support at jidesoft.com</email>
+        </developer>
+    </developers>
+    <build>
+        <sourceDirectory>src,src-jdk6</sourceDirectory>
+        <resources>
+            <resource>
+                <directory>src</directory>
+                <includes>
+                    <include>**/*.properties</include>
+                    <include>**/*.gif</include>
+                    <include>**/*.jpg</include>
+                    <include>**/*.png</include>
+                </includes>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-source-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+        <extensions>
+            <extension>
+                <groupId>org.apache.maven.wagon</groupId>
+                <artifactId>wagon-ssh</artifactId>
+                <version>2.0</version>
+            </extension>
+        </extensions>
+    </build>
+    <profiles>
+        <profile>
+            <id>aqua</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+                <property>
+                    <name>performRelease</name>
+                    <value>true</value>
+                </property>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>aqua_ui</groupId>
+                    <artifactId>ui</artifactId>
+                    <version>5.0</version>
+                    <scope>system</scope>
+                    <systemPath>${basedir}/libs/ui.jar</systemPath>
+                </dependency>
+                <dependency>
+                    <groupId>aqua_ui</groupId>
+                    <artifactId>jrs</artifactId>
+                    <version>5.0</version>
+                    <scope>system</scope>
+                    <systemPath>${basedir}/libs/ui.jar</systemPath>
+                </dependency>
+            </dependencies>
+            <properties>
+                <gpg.keyname>7929F719</gpg.keyname>
+                <release.username>jidesoft</release.username>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-gpg-plugin</artifactId>
+                        <version>1.0-alpha-4</version>
+                        <executions>
+                            <execution>
+                                <id>sign-artifacts</id>
+                                <phase>verify</phase>
+                                <goals>
+                                    <goal>sign</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+    <distributionManagement>
+        <repository>
+            <id>sonatype-nexus-staging</id>
+            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
+        </repository>
+    </distributionManagement>
+    <scm>
+        <connection>scm:git:git://github.com/jidesoft/jide-oss.git</connection>
+        <developerConnection>scm:git:https://jidesoft@github.com/jidesoft/jide-oss.git</developerConnection>
+        <url>https://github.com/jidesoft/jide-oss</url>
+    </scm>
+</project>


=====================================
pom_deploy.xml
=====================================
@@ -0,0 +1,137 @@
+<?xml version="1.0"?>
+<!--
+~ @(#)pom.xml 5/16/2012
+~
+~ Copyright 2002 - 2012 JIDE Software Inc. All rights reserved.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.sonatype.oss</groupId>
+        <artifactId>oss-parent</artifactId>
+        <version>7</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>com.jidesoft</groupId>
+    <artifactId>jide-oss</artifactId>
+    <name>JIDE Common Layer</name>
+    <version>3.7.4</version>
+    <packaging>jar</packaging>
+    <description>JIDE Common Layer (Professional Swing Components)</description>
+    <url>https://github.com/jidesoft/jide-oss</url>
+    <licenses>
+        <license>
+            <name>GPL with classpath exception</name>
+            <url>http://www.gnu.org/licenses/gpl.txt</url>
+            <distribution>repo</distribution>
+        </license>
+        <license>
+            <name>Free commercial license</name>
+            <url>http://www.jidesoft.com/purchase/SLA.htm</url>
+            <distribution>repo</distribution>
+        </license>
+    </licenses>
+    <developers>
+        <developer>
+            <id>jidesoft</id>
+            <name>jidesoft</name>
+            <email>support at jidesoft.com</email>
+        </developer>
+    </developers>
+    <build>
+        <sourceDirectory>src</sourceDirectory>
+        <resources>
+            <resource>
+                <directory>src</directory>
+                <includes>
+                    <include>**/*.properties</include>
+                    <include>**/*.gif</include>
+                    <include>**/*.jpg</include>
+                    <include>**/*.png</include>
+                </includes>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-source-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+        <extensions>
+            <extension>
+                <groupId>org.apache.maven.wagon</groupId>
+                <artifactId>wagon-ssh</artifactId>
+                <version>2.0</version>
+            </extension>
+        </extensions>
+    </build>
+    <profiles>
+        <profile>
+            <id>aqua</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+                <property>
+                    <name>performRelease</name>
+                    <value>true</value>
+                </property>
+            </activation>
+            <properties>
+                <gpg.keyname>7929F719</gpg.keyname>
+                <release.username>jidesoft</release.username>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-gpg-plugin</artifactId>
+                        <version>1.0-alpha-4</version>
+                        <executions>
+                            <execution>
+                                <id>sign-artifacts</id>
+                                <phase>verify</phase>
+                                <goals>
+                                    <goal>sign</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+    <distributionManagement>
+        <repository>
+            <id>sonatype-nexus-staging</id>
+            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
+        </repository>
+    </distributionManagement>
+    <scm>
+        <connection>scm:git:git://github.com/jidesoft/jide-oss.git</connection>
+        <developerConnection>scm:git:https://jidesoft@github.com/jidesoft/jide-oss.git</developerConnection>
+        <url>https://github.com/jidesoft/jide-oss</url>
+    </scm>
+</project>


=====================================
properties/com/jidesoft/swing/swing_da.properties
=====================================
@@ -11,7 +11,7 @@ SearchableBar.find=Find:
 SearchableBar.find.mnemonic=F
 SearchableBar.findNext=Find N\u00E6ste
 SearchableBar.findNext.mnemonic=N
-SearchableBar.findNext.tooltip=Find n\u00E6ste forekost af frasen
+SearchableBar.findNext.tooltip=Find n\u00E6ste forekomst af frasen
 SearchableBar.findPrevious=Find Tidligere
 SearchableBar.findPrevious.mnemonic=P
 SearchableBar.findPrevious.tooltip=Find tidligere forekomster af frasen


=====================================
src-apple/README.txt
=====================================
@@ -0,0 +1,4 @@
+#
+# Fake apple / com.apple source code (from openjdk) to let jide-oss build on jdk8
+#
+# these classes are not packaged in jide-oss-x.y.jar


=====================================
src-apple/apple/laf/JRSUIConstants.java
=====================================
@@ -0,0 +1,857 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package apple.laf;
+
+import java.nio.ByteBuffer;
+
+import java.lang.annotation.Native;
+
+public final class JRSUIConstants {
+
+    /**
+     * There is no way to get width of focus border, so it is hardcoded here.
+     * All components, which can be focused should take care about it.
+     */
+    public static final int FOCUS_SIZE = 4;
+
+    private static native long getPtrForConstant(final int constant);
+
+    static class Key {
+        @Native protected static final int _value = 20;
+        public static final Key VALUE = new Key(_value);
+
+        @Native protected static final int _thumbProportion = 24;
+        public static final Key THUMB_PROPORTION = new Key(_thumbProportion);
+
+        @Native protected static final int _thumbStart = 25;
+        public static final Key THUMB_START = new Key(_thumbStart);
+
+        @Native protected static final int _windowTitleBarHeight = 28;
+        public static final Key WINDOW_TITLE_BAR_HEIGHT = new Key(_windowTitleBarHeight);
+
+        @Native protected static final int _animationFrame = 23;
+        public static final Key ANIMATION_FRAME = new Key(_animationFrame);
+
+        final int constant;
+        private long ptr;
+
+        private Key(final int constant) {
+            this.constant = constant;
+        }
+
+        long getConstantPtr() {
+            if (ptr != 0) return ptr;
+            ptr = getPtrForConstant(constant);
+            if (ptr != 0) return ptr;
+            throw new RuntimeException("Constant not implemented in native: " + this);
+        }
+
+        private String getConstantName(Key hit) {
+            if (hit == VALUE) {
+                return "VALUE";
+            } else if (hit == THUMB_PROPORTION) {
+                return "THUMB_PROPORTION";
+            } else if (hit == THUMB_START) {
+                return "THUMB_START";
+            } else if (hit == WINDOW_TITLE_BAR_HEIGHT) {
+                return "WINDOW_TITLE_BAR_HEIGHT";
+            } else if (hit == ANIMATION_FRAME) {
+                return "ANIMATION_FRAME";
+            }
+            return getClass().getSimpleName();
+        }
+
+        public String toString() {
+            return getConstantName(this) + (ptr == 0 ? "(unlinked)" : "");
+        }
+    }
+
+    static class DoubleValue {
+        @Native protected static final byte TYPE_CODE = 1;
+
+        final double doubleValue;
+
+        DoubleValue(final double doubleValue) {
+            this.doubleValue = doubleValue;
+        }
+
+        public byte getTypeCode() {
+            return TYPE_CODE;
+        }
+
+        public void putValueInBuffer(final ByteBuffer buffer) {
+            buffer.putDouble(doubleValue);
+        }
+
+        public boolean equals(final Object obj) {
+            return (obj instanceof DoubleValue) && (((DoubleValue)obj).doubleValue == doubleValue);
+        }
+
+        public int hashCode() {
+            final long bits = Double.doubleToLongBits(doubleValue);
+            return (int)(bits ^ (bits >>> 32));
+        }
+
+        public String toString() {
+            return Double.toString(doubleValue);
+        }
+    }
+
+
+    static class PropertyEncoding {
+        final long mask;
+        final byte shift;
+
+        PropertyEncoding(final long mask, final byte shift) {
+            this.mask = mask;
+            this.shift = shift;
+        }
+    }
+
+    static class Property {
+        final PropertyEncoding encoding;
+        final long value;
+        final byte ordinal;
+
+        Property(final PropertyEncoding encoding, final byte ordinal) {
+            this.encoding = encoding;
+            this.value = ((long)ordinal) << encoding.shift;
+            this.ordinal = ordinal;
+        }
+
+        /**
+         * Applies this property value to the provided state
+         * @param encodedState the incoming JRSUI encoded state
+         * @return the composite of the provided JRSUI encoded state and this value
+         */
+        public long apply(final long encodedState) {
+            return (encodedState & ~encoding.mask) | value;
+        }
+
+        public String toString() {
+            return getClass().getSimpleName();
+        }
+    }
+
+    public static class Size extends Property {
+        @Native private static final byte SHIFT = 0;
+        @Native private static final byte SIZE = 3;
+        @Native private static final long MASK = (long)0x7 << SHIFT;
+        private static final PropertyEncoding size = new PropertyEncoding(MASK, SHIFT);
+
+        Size(final byte value) {
+            super(size, value);
+        }
+
+        @Native private static final byte _mini = 1;
+        public static final Size MINI = new Size(_mini);
+        @Native private static final byte _small = 2;
+        public static final Size SMALL = new Size(_small);
+        @Native private static final byte _regular = 3;
+        public static final Size REGULAR = new Size(_regular);
+        @Native private static final byte _large = 4;
+        public static final Size LARGE = new Size(_large);
+    }
+
+    public static class State extends Property {
+        @Native private static final byte SHIFT = Size.SHIFT + Size.SIZE;
+        @Native private static final byte SIZE = 4;
+        @Native private static final long MASK = (long)0xF << SHIFT;
+        private static final PropertyEncoding state = new PropertyEncoding(MASK, SHIFT);
+
+        State(final byte value) {
+            super(state, value);
+        }
+
+        @Native private static final byte _active = 1;
+        public static final State ACTIVE = new State(_active);
+        @Native private static final byte _inactive = 2;
+        public static final State INACTIVE = new State(_inactive);
+        @Native private static final byte _disabled = 3;
+        public static final State DISABLED = new State(_disabled);
+        @Native private static final byte _pressed = 4;
+        public static final State PRESSED = new State(_pressed);
+        @Native private static final byte _pulsed = 5;
+        public static final State PULSED = new State(_pulsed);
+        @Native private static final byte _rollover = 6;
+        public static final State ROLLOVER = new State(_rollover);
+        @Native private static final byte _drag = 7;
+        public static final State DRAG = new State(_drag);
+    }
+
+    public static class Direction extends Property {
+        @Native private static final byte SHIFT = State.SHIFT + State.SIZE;
+        @Native private static final byte SIZE = 4;
+        @Native private static final long MASK = (long)0xF << SHIFT;
+        private static final PropertyEncoding direction = new PropertyEncoding(MASK, SHIFT);
+
+        Direction(final byte value) {
+            super(direction, value);
+        }
+
+        @Native private static final byte _none = 1;
+        public static final Direction NONE = new Direction(_none);
+        @Native private static final byte _up = 2;
+        public static final Direction UP = new Direction(_up);
+        @Native private static final byte _down = 3;
+        public static final Direction DOWN = new Direction(_down);
+        @Native private static final byte _left = 4;
+        public static final Direction LEFT = new Direction(_left);
+        @Native private static final byte _right = 5;
+        public static final Direction RIGHT = new Direction(_right);
+        @Native private static final byte _north = 6;
+        public static final Direction NORTH = new Direction(_north);
+        @Native private static final byte _south = 7;
+        public static final Direction SOUTH = new Direction(_south);
+        @Native private static final byte _east = 8;
+        public static final Direction EAST = new Direction(_east);
+        @Native private static final byte _west = 9;
+        public static final Direction WEST = new Direction(_west);
+    }
+
+    public static class Orientation extends Property {
+        @Native private static final byte SHIFT = Direction.SHIFT + Direction.SIZE;
+        @Native private static final byte SIZE = 2;
+        @Native private static final long MASK = (long)0x3 << SHIFT;
+        private static final PropertyEncoding orientation = new PropertyEncoding(MASK, SHIFT);
+
+        Orientation(final byte value) {
+            super(orientation, value);
+        }
+
+        @Native private static final byte _horizontal = 1;
+        public static final Orientation HORIZONTAL = new Orientation(_horizontal);
+        @Native private static final byte _vertical = 2;
+        public static final Orientation VERTICAL = new Orientation(_vertical);
+    }
+
+    public static class AlignmentVertical extends Property {
+        @Native private static final byte SHIFT = Orientation.SHIFT + Orientation.SIZE;
+        @Native private static final byte SIZE = 2;
+        @Native private static final long MASK = (long)0x3 << SHIFT;
+        private static final PropertyEncoding alignmentVertical = new PropertyEncoding(MASK, SHIFT);
+
+        AlignmentVertical(final byte value){
+            super(alignmentVertical, value);
+        }
+
+        @Native private static final byte _top = 1;
+        public static final AlignmentVertical TOP = new AlignmentVertical(_top);
+        @Native private static final byte _center = 2;
+        public static final AlignmentVertical CENTER = new AlignmentVertical(_center);
+        @Native private static final byte _bottom = 3;
+        public static final AlignmentVertical BOTTOM = new AlignmentVertical(_bottom);
+    }
+
+    public static class AlignmentHorizontal extends Property {
+        @Native private static final byte SHIFT = AlignmentVertical.SHIFT + AlignmentVertical.SIZE;
+        @Native private static final byte SIZE = 2;
+        @Native private static final long MASK = (long)0x3 << SHIFT;
+        private static final PropertyEncoding alignmentHorizontal = new PropertyEncoding(MASK, SHIFT);
+
+        AlignmentHorizontal(final byte value){
+            super(alignmentHorizontal, value);
+        }
+
+        @Native private static final byte _left = 1;
+        public static final AlignmentHorizontal LEFT = new AlignmentHorizontal(_left);
+        @Native private static final byte _center =  2;
+        public static final AlignmentHorizontal CENTER = new AlignmentHorizontal(_center);
+        @Native private static final byte _right = 3;
+        public static final AlignmentHorizontal RIGHT = new AlignmentHorizontal(_right);
+    }
+
+    public static class SegmentPosition extends Property {
+        @Native private static final byte SHIFT = AlignmentHorizontal.SHIFT + AlignmentHorizontal.SIZE;
+        @Native private static final byte SIZE = 3;
+        @Native private static final long MASK = (long)0x7 << SHIFT;
+        private static final PropertyEncoding segmentPosition = new PropertyEncoding(MASK, SHIFT);
+
+        SegmentPosition(final byte value) {
+            super(segmentPosition, value);
+        }
+
+        @Native private static final byte _first = 1;
+        public static final SegmentPosition FIRST = new SegmentPosition(_first);
+        @Native private static final byte _middle = 2;
+        public static final SegmentPosition MIDDLE = new SegmentPosition(_middle);
+        @Native private static final byte _last = 3;
+        public static final SegmentPosition LAST = new SegmentPosition(_last);
+        @Native private static final byte _only = 4;
+        public static final SegmentPosition ONLY = new SegmentPosition(_only);
+    }
+
+    public static class ScrollBarPart extends Property {
+        @Native private static final byte SHIFT = SegmentPosition.SHIFT + SegmentPosition.SIZE;
+        @Native private static final byte SIZE = 4;
+        @Native private static final long MASK = (long)0xF << SHIFT;
+        private static final PropertyEncoding scrollBarPart = new PropertyEncoding(MASK, SHIFT);
+
+        ScrollBarPart(final byte value) {
+            super(scrollBarPart, value);
+        }
+
+        @Native private static final byte _none = 1;
+        public static final ScrollBarPart NONE = new ScrollBarPart(_none);
+        @Native private static final byte _thumb = 2;
+        public static final ScrollBarPart THUMB = new ScrollBarPart(_thumb);
+        @Native private static final byte _arrowMin = 3;
+        public static final ScrollBarPart ARROW_MIN = new ScrollBarPart(_arrowMin);
+        @Native private static final byte _arrowMax = 4;
+        public static final ScrollBarPart ARROW_MAX = new ScrollBarPart(_arrowMax);
+        @Native private static final byte _arrowMaxInside = 5;
+        public static final ScrollBarPart ARROW_MAX_INSIDE = new ScrollBarPart(_arrowMaxInside);
+        @Native private static final byte _arrowMinInside = 6;
+        public static final ScrollBarPart ARROW_MIN_INSIDE = new ScrollBarPart(_arrowMinInside);
+        @Native private static final byte _trackMin = 7;
+        public static final ScrollBarPart TRACK_MIN = new ScrollBarPart(_trackMin);
+        @Native private static final byte _trackMax = 8;
+        public static final ScrollBarPart TRACK_MAX = new ScrollBarPart(_trackMax);
+    }
+
+    public static class Variant extends Property {
+        @Native private static final byte SHIFT = ScrollBarPart.SHIFT + ScrollBarPart.SIZE;
+        @Native private static final byte SIZE = 4;
+        @Native private static final long MASK = (long)0xF << SHIFT;
+        private static final PropertyEncoding variant = new PropertyEncoding(MASK, SHIFT);
+
+        Variant(final byte value) {
+            super(variant, value);
+        }
+
+        @Native private static final byte _menuGlyph = 1;
+        public static final Variant MENU_GLYPH = new Variant(_menuGlyph);
+        @Native private static final byte _menuPopup = Variant._menuGlyph + 1;
+        public static final Variant MENU_POPUP = new Variant(_menuPopup);
+        @Native private static final byte _menuPulldown = Variant._menuPopup + 1;
+        public static final Variant MENU_PULLDOWN = new Variant(_menuPulldown);
+        @Native private static final byte _menuHierarchical = Variant._menuPulldown + 1;
+        public static final Variant MENU_HIERARCHICAL = new Variant(_menuHierarchical);
+
+        @Native private static final byte _gradientListBackgroundEven = Variant._menuHierarchical + 1;
+        public static final Variant GRADIENT_LIST_BACKGROUND_EVEN = new Variant(_gradientListBackgroundEven);
+        @Native private static final byte _gradientListBackgroundOdd = Variant._gradientListBackgroundEven + 1;
+        public static final Variant GRADIENT_LIST_BACKGROUND_ODD = new Variant(_gradientListBackgroundOdd);
+        @Native private static final byte _gradientSideBar = Variant._gradientListBackgroundOdd + 1;
+        public static final Variant GRADIENT_SIDE_BAR = new Variant(_gradientSideBar);
+        @Native private static final byte _gradientSideBarSelection = Variant._gradientSideBar + 1;
+        public static final Variant GRADIENT_SIDE_BAR_SELECTION = new Variant(_gradientSideBarSelection);
+        @Native private static final byte _gradientSideBarFocusedSelection = Variant._gradientSideBarSelection + 1;
+        public static final Variant GRADIENT_SIDE_BAR_FOCUSED_SELECTION = new Variant(_gradientSideBarFocusedSelection);
+    }
+
+    public static class WindowType extends Property {
+        @Native private static final byte SHIFT = Variant.SHIFT + Variant.SIZE;
+        @Native private static final byte SIZE = 2;
+        @Native private static final long MASK = (long)0x3 << SHIFT;
+        private static final PropertyEncoding windowType = new PropertyEncoding(MASK, SHIFT);
+
+        WindowType(final byte value){
+            super(windowType, value);
+        }
+
+        @Native private static final byte _document = 1;
+        public static final WindowType DOCUMENT = new WindowType(_document);
+        @Native private static final byte _utility = 2;
+        public static final WindowType UTILITY = new WindowType(_utility);
+        @Native private static final byte _titlelessUtility = 3;
+        public static final WindowType TITLELESS_UTILITY = new WindowType(_titlelessUtility);
+    }
+
+    public static class Focused extends Property {
+        @Native private static final byte SHIFT = WindowType.SHIFT + WindowType.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
+        private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
+
+        Focused(final byte value) {
+            super(focused, value);
+        }
+
+        @Native private static final byte _no = 0;
+        public static final Focused NO = new Focused(_no);
+        @Native private static final byte _yes = 1;
+        public static final Focused YES = new Focused(_yes);
+    }
+
+    public static class IndicatorOnly extends Property {
+        @Native private static final byte SHIFT = Focused.SHIFT + Focused.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
+        private static final PropertyEncoding indicatorOnly = new PropertyEncoding(MASK, SHIFT);
+
+        IndicatorOnly(final byte value) {
+            super(indicatorOnly, value);
+        }
+
+        @Native private static final byte _no = 0;
+        public static final IndicatorOnly NO = new IndicatorOnly(_no);
+        @Native private static final byte _yes = 1;
+        public static final IndicatorOnly YES = new IndicatorOnly(_yes);
+    }
+
+    public static class NoIndicator extends Property {
+        @Native private static final byte SHIFT = IndicatorOnly.SHIFT + IndicatorOnly.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
+        private static final PropertyEncoding noIndicator = new PropertyEncoding(MASK, SHIFT);
+
+        NoIndicator(final byte value) {
+            super(noIndicator, value);
+        }
+
+        @Native private static final byte _no = 0;
+        public static final NoIndicator NO = new NoIndicator(_no);
+        @Native private static final byte _yes = 1;
+        public static final NoIndicator YES = new NoIndicator(_yes);
+    }
+
+    public static class ArrowsOnly extends Property {
+        @Native private static final byte SHIFT = NoIndicator.SHIFT + NoIndicator.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
+        private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
+
+        ArrowsOnly(final byte value) {
+            super(focused, value);
+        }
+
+        @Native private static final byte _no = 0;
+        public static final ArrowsOnly NO = new ArrowsOnly(_no);
+        @Native private static final byte _yes = 1;
+        public static final ArrowsOnly YES = new ArrowsOnly(_yes);
+    }
+
+    public static class FrameOnly extends Property {
+        @Native private static final byte SHIFT = ArrowsOnly.SHIFT + ArrowsOnly.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
+        private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
+
+        FrameOnly(final byte value) {
+            super(focused, value);
+        }
+
+        @Native private static final byte _no = 0;
+        public static final FrameOnly NO = new FrameOnly(_no);
+        @Native private static final byte _yes = 1;
+        public static final FrameOnly YES = new FrameOnly(_yes);
+    }
+
+    public static class SegmentTrailingSeparator extends Property {
+        @Native private static final byte SHIFT = FrameOnly.SHIFT + FrameOnly.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
+        private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
+
+        SegmentTrailingSeparator(final byte value) {
+            super(focused, value);
+        }
+
+        @Native private static final byte _no = 0;
+        public static final SegmentTrailingSeparator NO = new SegmentTrailingSeparator(_no);
+        @Native private static final byte _yes = 1;
+        public static final SegmentTrailingSeparator YES = new SegmentTrailingSeparator(_yes);
+    }
+
+    public static class SegmentLeadingSeparator extends Property {
+        @Native private static final byte SHIFT = SegmentTrailingSeparator.SHIFT + SegmentTrailingSeparator.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
+        private static final PropertyEncoding leadingSeparator = new PropertyEncoding(MASK, SHIFT);
+
+        SegmentLeadingSeparator(final byte value) {
+            super(leadingSeparator, value);
+        }
+
+        @Native private static final byte _no = 0;
+        public static final SegmentLeadingSeparator NO = new SegmentLeadingSeparator(_no);
+        @Native private static final byte _yes = 1;
+        public static final SegmentLeadingSeparator YES = new SegmentLeadingSeparator(_yes);
+    }
+
+    public static class NothingToScroll extends Property {
+        @Native private static final byte SHIFT = SegmentLeadingSeparator.SHIFT + SegmentLeadingSeparator.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
+        private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
+
+        NothingToScroll(final byte value) {
+            super(focused, value);
+        }
+
+        @Native private static final byte _no = 0;
+        public static final NothingToScroll NO = new NothingToScroll(_no);
+        @Native private static final byte _yes = 1;
+        public static final NothingToScroll YES = new NothingToScroll(_yes);
+    }
+
+    public static class WindowTitleBarSeparator extends Property {
+        @Native private static final byte SHIFT = NothingToScroll.SHIFT + NothingToScroll.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
+        private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
+
+        WindowTitleBarSeparator(final byte value) {
+            super(focused, value);
+        }
+
+        @Native private static final byte _no = 0;
+        public static final WindowTitleBarSeparator NO = new WindowTitleBarSeparator(_no);
+        @Native private static final byte _yes = 1;
+        public static final WindowTitleBarSeparator YES = new WindowTitleBarSeparator(_yes);
+    }
+
+    public static class WindowClipCorners extends Property {
+        @Native private static final byte SHIFT = WindowTitleBarSeparator.SHIFT + WindowTitleBarSeparator.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
+        private static final PropertyEncoding focused = new PropertyEncoding(MASK, SHIFT);
+
+        WindowClipCorners(final byte value) {
+            super(focused, value);
+        }
+
+        @Native private static final byte _no = 0;
+        public static final WindowClipCorners NO = new WindowClipCorners(_no);
+        @Native private static final byte _yes = 1;
+        public static final WindowClipCorners YES = new WindowClipCorners(_yes);
+    }
+
+    public static class ShowArrows extends Property {
+        @Native private static final byte SHIFT = WindowClipCorners.SHIFT + WindowClipCorners.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
+        private static final PropertyEncoding showArrows = new PropertyEncoding(MASK, SHIFT);
+
+        ShowArrows(final byte value) {
+            super(showArrows, value);
+        }
+
+        @Native private static final byte _no = 0;
+        public static final ShowArrows NO = new ShowArrows(_no);
+        @Native private static final byte _yes = 1;
+        public static final ShowArrows YES = new ShowArrows(_yes);
+    }
+
+    public static class BooleanValue extends Property {
+        @Native private static final byte SHIFT = ShowArrows.SHIFT + ShowArrows.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
+        private static final PropertyEncoding booleanValue = new PropertyEncoding(MASK, SHIFT);
+
+        BooleanValue(final byte value) {
+            super(booleanValue, value);
+        }
+
+        @Native private static final byte _no = 0;
+        public static final BooleanValue NO = new BooleanValue(_no);
+        @Native private static final byte _yes = 1;
+        public static final BooleanValue YES = new BooleanValue(_yes);
+    }
+
+    public static class Animating extends Property {
+        @Native private static final byte SHIFT = BooleanValue.SHIFT + BooleanValue.SIZE;
+        @Native private static final byte SIZE = 1;
+        @Native private static final long MASK = (long)0x1 << SHIFT;
+        private static final PropertyEncoding animating = new PropertyEncoding(MASK, SHIFT);
+
+        Animating(final byte value) {
+            super(animating, value);
+        }
+
+        @Native private static final byte _no = 0;
+        public static final Animating NO = new Animating(_no);
+        @Native private static final byte _yes = 1;
+        public static final Animating YES = new Animating(_yes);
+    }
+
+    public static class Widget extends Property {
+        @Native private static final byte SHIFT = Animating.SHIFT + Animating.SIZE;
+        @Native private static final byte SIZE = 7;
+        @Native private static final long MASK = (long)0x7F << SHIFT;
+        private static final PropertyEncoding widget = new PropertyEncoding(MASK, SHIFT);
+
+        Widget(final byte constant) {
+            super(widget, constant);
+        }
+
+        @Native private static final byte _background = 1;
+        public static final Widget BACKGROUND = new Widget(_background);
+
+        @Native private static final byte _buttonBevel = _background + 1;
+        public static final Widget BUTTON_BEVEL = new Widget(_buttonBevel);
+        @Native private static final byte _buttonBevelInset = _buttonBevel + 1;
+        public static final Widget BUTTON_BEVEL_INSET = new Widget(_buttonBevelInset);
+        @Native private static final byte _buttonBevelRound = _buttonBevelInset + 1;
+        public static final Widget BUTTON_BEVEL_ROUND = new Widget(_buttonBevelRound);
+
+        @Native private static final byte _buttonCheckBox = _buttonBevelRound + 1;
+        public static final Widget BUTTON_CHECK_BOX = new Widget(_buttonCheckBox);
+
+        @Native private static final byte _buttonComboBox = _buttonCheckBox + 1;
+        public static final Widget BUTTON_COMBO_BOX = new Widget(_buttonComboBox);
+        @Native private static final byte _buttonComboBoxInset = _buttonComboBox + 1;
+        public static final Widget BUTTON_COMBO_BOX_INSET = new Widget(_buttonComboBoxInset); // not hooked up in JRSUIConstants.m
+
+        @Native private static final byte _buttonDisclosure = _buttonComboBoxInset + 1;
+        public static final Widget BUTTON_DISCLOSURE = new Widget(_buttonDisclosure);
+
+        @Native private static final byte _buttonListHeader = _buttonDisclosure + 1;
+        public static final Widget BUTTON_LIST_HEADER = new Widget(_buttonListHeader);
+
+        @Native private static final byte _buttonLittleArrows = _buttonListHeader + 1;
+        public static final Widget BUTTON_LITTLE_ARROWS = new Widget(_buttonLittleArrows);
+
+        @Native private static final byte _buttonPopDown = _buttonLittleArrows + 1;
+        public static final Widget BUTTON_POP_DOWN = new Widget(_buttonPopDown);
+        @Native private static final byte _buttonPopDownInset = _buttonPopDown + 1;
+        public static final Widget BUTTON_POP_DOWN_INSET = new Widget(_buttonPopDownInset);
+        @Native private static final byte _buttonPopDownSquare = _buttonPopDownInset + 1;
+        public static final Widget BUTTON_POP_DOWN_SQUARE = new Widget(_buttonPopDownSquare);
+
+        @Native private static final byte _buttonPopUp = _buttonPopDownSquare + 1;
+        public static final Widget BUTTON_POP_UP = new Widget(_buttonPopUp);
+        @Native private static final byte _buttonPopUpInset = _buttonPopUp + 1;
+        public static final Widget BUTTON_POP_UP_INSET = new Widget(_buttonPopUpInset);
+        @Native private static final byte _buttonPopUpSquare = _buttonPopUpInset + 1;
+        public static final Widget BUTTON_POP_UP_SQUARE = new Widget(_buttonPopUpSquare);
+
+        @Native private static final byte _buttonPush = _buttonPopUpSquare + 1;
+        public static final Widget BUTTON_PUSH = new Widget(_buttonPush);
+        @Native private static final byte _buttonPushScope = _buttonPush + 1;
+        public static final Widget BUTTON_PUSH_SCOPE = new Widget(_buttonPushScope);
+        @Native private static final byte _buttonPushScope2 = _buttonPushScope + 1;
+        public static final Widget BUTTON_PUSH_SCOPE2 = new Widget(_buttonPushScope2);
+        @Native private static final byte _buttonPushTextured = _buttonPushScope2 + 1;
+        public static final Widget BUTTON_PUSH_TEXTURED = new Widget(_buttonPushTextured);
+        @Native private static final byte _buttonPushInset = _buttonPushTextured + 1;
+        public static final Widget BUTTON_PUSH_INSET = new Widget(_buttonPushInset);
+        @Native private static final byte _buttonPushInset2 = _buttonPushInset + 1;
+        public static final Widget BUTTON_PUSH_INSET2 = new Widget(_buttonPushInset2);
+
+        @Native private static final byte _buttonRadio = _buttonPushInset2 + 1;
+        public static final Widget BUTTON_RADIO = new Widget(_buttonRadio);
+
+        @Native private static final byte _buttonRound = _buttonRadio + 1;
+        public static final Widget BUTTON_ROUND = new Widget(_buttonRound);
+        @Native private static final byte _buttonRoundHelp = _buttonRound + 1;
+        public static final Widget BUTTON_ROUND_HELP = new Widget(_buttonRoundHelp);
+        @Native private static final byte _buttonRoundInset = _buttonRoundHelp + 1;
+        public static final Widget BUTTON_ROUND_INSET = new Widget(_buttonRoundInset);
+        @Native private static final byte _buttonRoundInset2 =_buttonRoundInset + 1;
+        public static final Widget BUTTON_ROUND_INSET2 = new Widget(_buttonRoundInset2);
+
+        @Native private static final byte _buttonSearchFieldCancel = _buttonRoundInset2 + 1;
+        public static final Widget BUTTON_SEARCH_FIELD_CANCEL = new Widget(_buttonSearchFieldCancel);
+        @Native private static final byte _buttonSearchFieldFind = _buttonSearchFieldCancel + 1;
+        public static final Widget BUTTON_SEARCH_FIELD_FIND = new Widget(_buttonSearchFieldFind);
+
+        @Native private static final byte _buttonSegmented = _buttonSearchFieldFind + 1;
+        public static final Widget BUTTON_SEGMENTED = new Widget(_buttonSegmented);
+        @Native private static final byte _buttonSegmentedInset = _buttonSegmented + 1;
+        public static final Widget BUTTON_SEGMENTED_INSET = new Widget(_buttonSegmentedInset);
+        @Native private static final byte _buttonSegmentedInset2 = _buttonSegmentedInset + 1;
+        public static final Widget BUTTON_SEGMENTED_INSET2 = new Widget(_buttonSegmentedInset2);
+        @Native private static final byte _buttonSegmentedSCurve = _buttonSegmentedInset2 + 1;
+        public static final Widget BUTTON_SEGMENTED_SCURVE = new Widget(_buttonSegmentedSCurve);
+        @Native private static final byte _buttonSegmentedTextured = _buttonSegmentedSCurve + 1;
+        public static final Widget BUTTON_SEGMENTED_TEXTURED = new Widget(_buttonSegmentedTextured);
+        @Native private static final byte _buttonSegmentedToolbar = _buttonSegmentedTextured + 1;
+        public static final Widget BUTTON_SEGMENTED_TOOLBAR = new Widget(_buttonSegmentedToolbar);
+
+        @Native private static final byte _dial = _buttonSegmentedToolbar + 1;
+        public static final Widget DIAL = new Widget(_dial);
+
+        @Native private static final byte _disclosureTriangle = _dial + 1;
+        public static final Widget DISCLOSURE_TRIANGLE = new Widget(_disclosureTriangle);
+
+        @Native private static final byte _dividerGrabber = _disclosureTriangle + 1;
+        public static final Widget DIVIDER_GRABBER = new Widget(_dividerGrabber);
+        @Native private static final byte _dividerSeparatorBar = _dividerGrabber + 1;
+        public static final Widget DIVIDER_SEPARATOR_BAR = new Widget(_dividerSeparatorBar);
+        @Native private static final byte _dividerSplitter = _dividerSeparatorBar + 1;
+        public static final Widget DIVIDER_SPLITTER = new Widget(_dividerSplitter);
+
+        @Native private static final byte _focus = _dividerSplitter + 1;
+        public static final Widget FOCUS = new Widget(_focus);
+
+        @Native private static final byte _frameGroupBox = _focus + 1;
+        public static final Widget FRAME_GROUP_BOX = new Widget(_frameGroupBox);
+        @Native private static final byte _frameGroupBoxSecondary = _frameGroupBox + 1;
+        public static final Widget FRAME_GROUP_BOX_SECONDARY = new Widget(_frameGroupBoxSecondary);
+
+        @Native private static final byte _frameListBox = _frameGroupBoxSecondary + 1;
+        public static final Widget FRAME_LIST_BOX = new Widget(_frameListBox);
+
+        @Native private static final byte _framePlacard = _frameListBox + 1;
+        public static final Widget FRAME_PLACARD = new Widget(_framePlacard);
+
+        @Native private static final byte _frameTextField = _framePlacard + 1;
+        public static final Widget FRAME_TEXT_FIELD = new Widget(_frameTextField);
+        @Native private static final byte _frameTextFieldRound = _frameTextField + 1;
+        public static final Widget FRAME_TEXT_FIELD_ROUND = new Widget(_frameTextFieldRound);
+
+        @Native private static final byte _frameWell = _frameTextFieldRound + 1;
+        public static final Widget FRAME_WELL = new Widget(_frameWell);
+
+        @Native private static final byte _growBox = _frameWell + 1;
+        public static final Widget GROW_BOX = new Widget(_growBox);
+        @Native private static final byte _growBoxTextured = _growBox + 1;
+        public static final Widget GROW_BOX_TEXTURED = new Widget(_growBoxTextured);
+
+        @Native private static final byte _gradient = _growBoxTextured + 1;
+        public static final Widget GRADIENT = new Widget(_gradient);
+
+        @Native private static final byte _menu = _gradient + 1;
+        public static final Widget MENU = new Widget(_menu);
+        @Native private static final byte _menuItem = _menu + 1;
+        public static final Widget MENU_ITEM = new Widget(_menuItem);
+        @Native private static final byte _menuBar = _menuItem + 1;
+        public static final Widget MENU_BAR = new Widget(_menuBar);
+        @Native private static final byte _menuTitle = _menuBar + 1;
+        public static final Widget MENU_TITLE = new Widget(_menuTitle);
+
+        @Native private static final byte _progressBar = _menuTitle + 1;
+        public static final Widget PROGRESS_BAR = new Widget(_progressBar);
+        @Native private static final byte _progressIndeterminateBar = _progressBar + 1;
+        public static final Widget PROGRESS_INDETERMINATE_BAR = new Widget(_progressIndeterminateBar);
+        @Native private static final byte _progressRelevance = _progressIndeterminateBar + 1;
+        public static final Widget PROGRESS_RELEVANCE = new Widget(_progressRelevance);
+        @Native private static final byte _progressSpinner = _progressRelevance + 1;
+        public static final Widget PROGRESS_SPINNER = new Widget(_progressSpinner);
+
+        @Native private static final byte _scrollBar = _progressSpinner + 1;
+        public static final Widget SCROLL_BAR = new Widget(_scrollBar);
+
+        @Native private static final byte _scrollColumnSizer = _scrollBar + 1;
+        public static final Widget SCROLL_COLUMN_SIZER = new Widget(_scrollColumnSizer);
+
+        @Native private static final byte _slider = _scrollColumnSizer + 1;
+        public static final Widget SLIDER = new Widget(_slider);
+        @Native private static final byte _sliderThumb = _slider + 1;
+        public static final Widget SLIDER_THUMB = new Widget(_sliderThumb);
+
+        @Native private static final byte _synchronization = _sliderThumb + 1;
+        public static final Widget SYNCHRONIZATION = new Widget(_synchronization);
+
+        @Native private static final byte _tab = _synchronization + 1;
+        public static final Widget TAB = new Widget(_tab);
+
+        @Native private static final byte _titleBarCloseBox = _tab + 1;
+        public static final Widget TITLE_BAR_CLOSE_BOX = new Widget(_titleBarCloseBox);
+        @Native private static final byte _titleBarCollapseBox = _titleBarCloseBox + 1;
+        public static final Widget TITLE_BAR_COLLAPSE_BOX = new Widget(_titleBarCollapseBox);
+        @Native private static final byte _titleBarZoomBox = _titleBarCollapseBox + 1;
+        public static final Widget TITLE_BAR_ZOOM_BOX = new Widget(_titleBarZoomBox);
+
+        @Native private static final byte _titleBarToolbarButton = _titleBarZoomBox + 1;
+        public static final Widget TITLE_BAR_TOOLBAR_BUTTON = new Widget(_titleBarToolbarButton);
+
+        @Native private static final byte _toolbarItemWell = _titleBarToolbarButton + 1;
+        public static final Widget TOOLBAR_ITEM_WELL = new Widget(_toolbarItemWell);
+
+        @Native private static final byte _windowFrame = _toolbarItemWell + 1;
+        public static final Widget WINDOW_FRAME = new Widget(_windowFrame);
+    }
+
+    public static class Hit {
+        @Native private static final int _unknown = -1;
+        public static final Hit UNKNOWN = new Hit(_unknown);
+        @Native private static final int _none = 0;
+        public static final Hit NONE = new Hit(_none);
+        @Native private static final int _hit = 1;
+        public static final Hit HIT = new Hit(_hit);
+
+        final int hit;
+        Hit(final int hit) { this.hit = hit; }
+
+        public boolean isHit() {
+            return hit > 0;
+        }
+
+        private String getConstantName(Hit hit) {
+            if (hit == UNKNOWN) {
+                return "UNKNOWN";
+            } else if (hit == NONE) {
+                return "NONE";
+            } else if (hit == HIT) {
+                return "HIT";
+            }
+            return getClass().getSimpleName();
+        }
+
+        public String toString() {
+            return getConstantName(this);
+        }
+    }
+
+    public static class ScrollBarHit extends Hit {
+        @Native private static final int _thumb = 2;
+        public static final ScrollBarHit THUMB = new ScrollBarHit(_thumb);
+
+        @Native private static final int _trackMin = 3;
+        public static final ScrollBarHit TRACK_MIN = new ScrollBarHit(_trackMin);
+        @Native private static final int _trackMax = 4;
+        public static final ScrollBarHit TRACK_MAX = new ScrollBarHit(_trackMax);
+
+        @Native private static final int _arrowMin = 5;
+        public static final ScrollBarHit ARROW_MIN = new ScrollBarHit(_arrowMin);
+        @Native private static final int _arrowMax = 6;
+        public static final ScrollBarHit ARROW_MAX = new ScrollBarHit(_arrowMax);
+        @Native private static final int _arrowMaxInside = 7;
+        public static final ScrollBarHit ARROW_MAX_INSIDE = new ScrollBarHit(_arrowMaxInside);
+        @Native private static final int _arrowMinInside = 8;
+        public static final ScrollBarHit ARROW_MIN_INSIDE = new ScrollBarHit(_arrowMinInside);
+
+        ScrollBarHit(final int hit) { super(hit); }
+    }
+
+    static Hit getHit(final int hit) {
+        switch (hit) {
+            case Hit._none:
+                return Hit.NONE;
+            case Hit._hit:
+                return Hit.HIT;
+
+            case ScrollBarHit._thumb:
+                return ScrollBarHit.THUMB;
+            case ScrollBarHit._trackMin:
+                return ScrollBarHit.TRACK_MIN;
+            case ScrollBarHit._trackMax:
+                return ScrollBarHit.TRACK_MAX;
+            case ScrollBarHit._arrowMin:
+                return ScrollBarHit.ARROW_MIN;
+            case ScrollBarHit._arrowMax:
+                return ScrollBarHit.ARROW_MAX;
+            case ScrollBarHit._arrowMaxInside:
+                return ScrollBarHit.ARROW_MAX_INSIDE;
+            case ScrollBarHit._arrowMinInside:
+                return ScrollBarHit.ARROW_MIN_INSIDE;
+        }
+        return Hit.UNKNOWN;
+    }
+}


=====================================
src-apple/com/apple/laf/AquaPopupMenuUI.java
=====================================
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.apple.laf;
+
+import java.awt.*;
+import java.awt.event.MouseEvent;
+
+import javax.swing.*;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicPopupMenuUI;
+
+public class AquaPopupMenuUI extends BasicPopupMenuUI {
+    public static ComponentUI createUI(final JComponent x) {
+        return new AquaPopupMenuUI();
+    }
+
+    public boolean isPopupTrigger(final MouseEvent e) {
+        // Use the awt popup trigger code since this only runs on our OS!
+        return e.isPopupTrigger();
+    }
+
+    @Override
+    public void paint(final Graphics g, final JComponent c) {
+        if (!(g instanceof Graphics2D)) {
+            super.paint(g, c);
+            return;
+        }
+
+        if (!(PopupFactory.getSharedInstance() instanceof ScreenPopupFactory)) {
+            super.paint(g, c);
+            return;
+        }
+
+        // round off and put back edges in a new Graphics
+        final Graphics2D g2d = (Graphics2D)g.create();
+        final Rectangle popupBounds = popupMenu.getBounds(); // NB: origin is still at 0,0
+        paintRoundRect(g2d, popupBounds);
+        clipEdges(g2d, popupBounds);
+        g2d.dispose();
+
+        // if any subsequent drawing occurs over these corners, the window is square again
+        super.paint(g, c);
+    }
+
+    protected void paintRoundRect(final Graphics2D g2d, final Rectangle popupBounds) {
+        // setup the graphics context to blast alpha for every primitive we draw
+        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+        g2d.setComposite(AlphaComposite.Clear);
+
+        // draw the 3px round-rect line around the outer bounds of the window,
+        // this gives the appearance of rounded corners
+        g2d.setStroke(new BasicStroke(3.0f));
+        g2d.drawRoundRect(-2, -2, popupBounds.width + 3, popupBounds.height + 3, 12, 12);
+    }
+
+    static final int OVERLAP_SLACK = 10;
+    protected void clipEdges(final Graphics2D g2d, final Rectangle popupBounds) {
+        final Component invoker = popupMenu.getInvoker();
+        if (!(invoker instanceof JMenu)) return; // only point corners originating from menu items
+
+        final Rectangle invokerBounds = invoker.getBounds();
+
+        // only get location on screen when necessary
+        invokerBounds.setLocation(invoker.getLocationOnScreen());
+        popupBounds.setLocation(popupMenu.getLocationOnScreen());
+
+        final Point invokerCenter = new Point((int)invokerBounds.getCenterX(), (int)invokerBounds.getCenterY());
+        if (popupBounds.contains(invokerCenter)) {
+            // invoker is "behind" the popup, no corners should be pointed
+            return;
+        }
+
+        // blast opaque background over the corners we want to "put back"
+        g2d.setComposite(AlphaComposite.SrcOver);
+        g2d.setColor(popupMenu.getBackground());
+
+        final Point popupCenter = new Point((int)popupBounds.getCenterX(), (int)popupBounds.getCenterY());
+        final boolean invokerMidpointAbovePopupMidpoint = invokerCenter.y <= popupCenter.y;
+
+        if (invokerBounds.x + invokerBounds.width < popupBounds.x + OVERLAP_SLACK) {
+            // popup is far right of invoker
+            if (invokerMidpointAbovePopupMidpoint) {
+                // point upper left corner, most common case
+                g2d.fillRect(-2, -2, 8, 8);
+                return;
+            }
+            // point lower left corner
+            g2d.fillRect(-2, popupBounds.height - 6, 8, 8);
+            return;
+        }
+
+        if (popupBounds.x + popupBounds.width < invokerBounds.x + OVERLAP_SLACK) {
+            // popup is far left of invoker
+            if (invokerMidpointAbovePopupMidpoint) {
+                // point upper right corner
+                g2d.fillRect(popupBounds.width - 6, -2, 8, 8);
+                return;
+            }
+            // point lower right corner
+            g2d.fillRect(popupBounds.width - 6, popupBounds.height - 6, 8, 8);
+            return;
+        }
+
+        // popup is neither "far right" or "far left" of it's invoker
+        if (invokerBounds.y + invokerBounds.height < popupBounds.y + OVERLAP_SLACK) {
+            // popup is "middle" below it's invoker,
+            // this is probably the "connected" case where both upper corners should touch
+            g2d.fillRect(-2, -2, popupBounds.width + 4, 8);
+            return;
+        }
+
+        // if none of these cases match...don't make any corners pointed
+    }
+}


=====================================
src-apple/com/apple/laf/AquaSliderUI.java
=====================================
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.apple.laf;
+
+import java.awt.*;
+
+import javax.swing.*;
+import javax.swing.plaf.basic.BasicSliderUI;
+
+
+public class AquaSliderUI extends BasicSliderUI {
+    /* 
+    * EMPTY implementation to make build pass
+    */
+    protected transient boolean fIsDragging = false;
+
+    public AquaSliderUI(final JSlider b) {
+        super(b);
+    }
+    
+    public void paintThumb(Graphics g, JComponent cg, apple.laf.JRSUIConstants.Orientation orientation, apple.laf.JRSUIConstants.State state) {
+    }
+}


=====================================
src-apple/com/apple/laf/ScreenPopupFactory.java
=====================================
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.apple.laf;
+
+import javax.swing.PopupFactory;
+
+
+class ScreenPopupFactory extends PopupFactory {
+    /* 
+    * EMPTY implementation to make build pass
+    */
+}


=====================================
src/com/jidesoft/plaf/LookAndFeelFactory.java
=====================================
@@ -1871,7 +1871,7 @@ public class LookAndFeelFactory implements ProductNames {
                 Class c = Class.forName(WINDOWS_LNF);
                 return c.isInstance(lnf);
             }
-            catch (ClassNotFoundException cnfe) {
+            catch (ClassNotFoundException | NoClassDefFoundError ignore) {
                 // if it is not possible to load the Windows LnF class, the
                 // given lnf instance cannot be an instance of the Windows
                 // LnF class
@@ -1897,7 +1897,7 @@ public class LookAndFeelFactory implements ProductNames {
                 Class c = Class.forName(WINDOWS_CLASSIC_LNF);
                 return c.isInstance(lnf);
             }
-            catch (ClassNotFoundException cnfe) {
+            catch (ClassNotFoundException | NoClassDefFoundError ignore) {
                 // if it is not possible to load the Windows LnF class, the
                 // given lnf instance cannot be an instance of the Windows
                 // LnF class


=====================================
src/com/jidesoft/plaf/basic/BasicJideButtonUI.java
=====================================
@@ -262,7 +262,7 @@ public class BasicJideButtonUI extends JideButtonUI {
         }
 
 
-        FontMetrics fm = g.getFontMetrics();
+        FontMetrics fm = c.getFontMetrics(c.getFont());
 
         Insets i = c.getInsets();
 
@@ -412,7 +412,7 @@ public class BasicJideButtonUI extends JideButtonUI {
         }
 
         ButtonModel model = b.getModel();
-        FontMetrics fm = g.getFontMetrics();
+        FontMetrics fm = c.getFontMetrics(c.getFont());
         // JDK PORTING HINT
         // JDK1.3: No getDisplayedMnemonicIndex, use getMnemonic
         int mnemonicIndex = b.getDisplayedMnemonicIndex();


=====================================
src/com/jidesoft/plaf/basic/BasicJideLabelUI.java
=====================================
@@ -67,7 +67,7 @@ public class BasicJideLabelUI extends BasicLabelUI {
             return;
         }
 
-        FontMetrics fm = g.getFontMetrics();
+        FontMetrics fm = c.getFontMetrics(c.getFont());
         paintViewInsets = c.getInsets(paintViewInsets);
 
         paintViewR.x = paintViewInsets.left;


=====================================
src/com/jidesoft/plaf/basic/BasicJideSplitButtonUI.java
=====================================
@@ -957,7 +957,7 @@ public class BasicJideSplitButtonUI extends VsnetMenuUI {
         // Note: This method is almost identical to the same method in WindowsMenuItemUI
         ButtonModel model = menuItem.getModel();
 
-        FontMetrics fm = g.getFontMetrics();
+        FontMetrics fm = menuItem.getFontMetrics(menuItem.getFont());
         if (!(menuItem instanceof JMenu) || !((JMenu) menuItem).isTopLevelMenu()) {
             int defaultTextIconGap = UIDefaultsLookup.getInt("MenuItem.textIconGap");
             int defaultShadowWidth = UIDefaultsLookup.getInt("MenuItem.shadowWidth");


=====================================
src/com/jidesoft/plaf/basic/BasicJideTabbedPaneUI.java
=====================================
@@ -1086,7 +1086,7 @@ public class BasicJideTabbedPaneUI extends JideTabbedPaneUI implements SwingCons
             font = font.deriveFont(Font.BOLD);
         }
 
-        FontMetrics metrics = g.getFontMetrics(font);
+        FontMetrics metrics = _tabPane.getFontMetrics(font);
 
 //        while (title == null || title.length() < 3)
 //            title += " ";


=====================================
src/com/jidesoft/plaf/office2007/Office2007Painter.java
=====================================
@@ -69,7 +69,7 @@ public class Office2007Painter extends BasicPainter {
 
     public void installDefaults() {
         Boolean highContrast = UIManager.getBoolean("Theme.highContrast");
-        if (highContrast) {
+        if (highContrast) {           
             super.installDefaults();
         }
     }


=====================================
src/com/jidesoft/swing/CheckBoxListCellRenderer.java
=====================================
@@ -185,7 +185,7 @@ public class CheckBoxListCellRenderer extends JPanel implements ListCellRenderer
     }
 
     private String convertElementToString(Locale locale, Object value) {
-        if (CheckBoxList.ALL_ENTRY.equals(value)) {
+        if (CheckBoxList.ALL_ENTRY.equals(value) || "(All)".equals(value)) {
             return Resource.getResourceBundle(locale).getString("CheckBoxList.all");
         }
         return (value == null) ? "" : value.toString();


=====================================
src/com/jidesoft/swing/JideToggleSplitButton.java
=====================================
@@ -118,9 +118,9 @@ public class JideToggleSplitButton extends JideSplitButton implements Accessible
         if (selected != isSelected()) {
             // This won't notify ActionListeners, but that should be
             // ok as the change is coming from the Action.
-            setSelected(selected);
+            setButtonSelected(selected);
             // Make sure the change actually took effect
-            if (!selected && isSelected()) {
+            if (!selected && isButtonSelected()) {
                 if (getModel() instanceof DefaultButtonModel) {
                     ButtonGroup group = (ButtonGroup)
                             ((DefaultButtonModel) getModel()).getGroup();
@@ -157,10 +157,10 @@ public class JideToggleSplitButton extends JideSplitButton implements Accessible
     private void updateSelectedKey() {
         if (shouldUpdateSelectedStateFromAction()) {
             Action action = getAction();
-            if (action != null && action.getValue(Action.SELECTED_KEY) != null) {
-                boolean selected = isSelected();
-                boolean isActionSelected = Boolean.TRUE.equals(action.getValue(Action.SELECTED_KEY));
-                if (isActionSelected != selected) {
+            if (action != null) {
+                boolean selected = isButtonSelected();
+                Object existingKey = action.getValue(Action.SELECTED_KEY);
+                if (existingKey == null || Boolean.TRUE.equals(existingKey) != selected) {
                     action.putValue(Action.SELECTED_KEY, selected);
                 }
             }


=====================================
src/com/jidesoft/swing/LegacyCheckBoxTree.java
=====================================
@@ -0,0 +1,560 @@
+/*
+ * @(#)CheckBoxTree.java 8/11/2005
+ *
+ * Copyright 2002 - 2005 JIDE Software Inc. All rights reserved.
+ */
+package com.jidesoft.swing;
+
+import javax.swing.*;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.text.Position;
+import javax.swing.tree.*;
+import java.awt.*;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Hashtable;
+import java.util.Vector;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * <strong>This class is deprecated and provided to support compatibility with {@link LegacyTristateCheckBox}. We will not provide support
+ * for this class. You likely want to use {@link CheckBoxTree}.</strong>
+ * <p/>
+ * CheckBoxTree is a special JTree which uses JCheckBox as the tree renderer. In addition to regular JTree's features,
+ * it also allows you select any number of tree nodes in the tree by selecting the check boxes. <p>To select an element,
+ * user can mouse click on the check box, or select one or several tree nodes and press SPACE key to toggle the check
+ * box selection for all selected tree nodes.
+ * <p/>
+ * In order to retrieve which tree paths are selected, you need to call {@link #getCheckBoxTreeSelectionModel()}. It
+ * will return the selection model that keeps track of which tree paths have been checked. For example {@link
+ * CheckBoxTreeSelectionModel#getSelectionPaths()} will give the list of paths which have been checked.
+ * @deprecated Use {@link CheckBoxTree}.
+ */
+public class LegacyCheckBoxTree extends JTree {
+
+    public static final String PROPERTY_CHECKBOX_ENABLED = "checkBoxEnabled";
+    public static final String PROPERTY_CLICK_IN_CHECKBOX_ONLY = "clickInCheckBoxOnly";
+    public static final String PROPERTY_DIG_IN = "digIn";
+
+    protected LegacyCheckBoxTreeCellRenderer _treeCellRenderer;
+
+    private LegacyCheckBoxTreeSelectionModel _checkBoxTreeSelectionModel;
+
+    private boolean _checkBoxEnabled = true;
+    private boolean _clickInCheckBoxOnly = true;
+    private PropertyChangeListener _modelChangeListener;
+    private LegacyTristateCheckBox _checkBox;
+    private boolean _selectPartialOnToggling = true;
+
+    public LegacyCheckBoxTree() {
+        init();
+    }
+
+    public LegacyCheckBoxTree(Object[] value) {
+        super(value);
+        init();
+    }
+
+    public LegacyCheckBoxTree(Vector<?> value) {
+        super(value);
+        init();
+    }
+
+    public LegacyCheckBoxTree(Hashtable<?, ?> value) {
+        super(value);
+        init();
+    }
+
+    public LegacyCheckBoxTree(TreeNode root) {
+        super(root);
+        init();
+    }
+
+    public LegacyCheckBoxTree(TreeNode root, boolean asksAllowsChildren) {
+        super(root, asksAllowsChildren);
+        init();
+    }
+
+    public LegacyCheckBoxTree(TreeModel newModel) {
+        super(newModel);
+        init();
+    }
+
+    /**
+     * Initialize the CheckBoxTree.
+     */
+    protected void init() {
+        _checkBoxTreeSelectionModel = createCheckBoxTreeSelectionModel(getModel());
+        _checkBoxTreeSelectionModel.setTree(this);
+        Handler handler = createHandler();
+        JideSwingUtilities.insertMouseListener(this, handler, 0);
+        addKeyListener(handler);
+        _checkBoxTreeSelectionModel.addTreeSelectionListener(handler);
+
+        if (_modelChangeListener == null) {
+            _modelChangeListener = new PropertyChangeListener() {
+                public void propertyChange(PropertyChangeEvent evt) {
+                    if (JTree.SELECTION_MODEL_PROPERTY.equals(evt.getPropertyName())) {
+                        updateRowMapper();
+                    }
+                    if ("model".equals(evt.getPropertyName()) && evt.getNewValue() instanceof TreeModel) {
+                        _checkBoxTreeSelectionModel.setModel((TreeModel) evt.getNewValue());
+                    }
+                }
+            };
+        }
+        addPropertyChangeListener(JTree.SELECTION_MODEL_PROPERTY, _modelChangeListener);
+        addPropertyChangeListener("model", _modelChangeListener);
+        updateRowMapper();
+    }
+
+    /**
+     * Creates the CheckBoxTreeSelectionModel.
+     *
+     * @param model the tree model.
+     * @return the CheckBoxTreeSelectionModel.
+     */
+    protected LegacyCheckBoxTreeSelectionModel createCheckBoxTreeSelectionModel(TreeModel model) {
+        return new LegacyCheckBoxTreeSelectionModel(model);
+    }
+
+    /**
+     * RowMapper is necessary for contiguous selection.
+     */
+    private void updateRowMapper() {
+        _checkBoxTreeSelectionModel.setRowMapper(getSelectionModel().getRowMapper());
+    }
+
+    private TreeCellRenderer _defaultRenderer;
+
+    /**
+     * Gets the cell renderer with check box.
+     *
+     * @return CheckBoxTree's own cell renderer which has the check box. The actual cell renderer you set by
+     *         setCellRenderer() can be accessed by using {@link #getActualCellRenderer()}.
+     */
+    @Override
+    public TreeCellRenderer getCellRenderer() {
+        TreeCellRenderer cellRenderer = getActualCellRenderer();
+        if (cellRenderer == null) {
+            cellRenderer = getDefaultRenderer();
+        }
+
+        if (_treeCellRenderer == null) {
+            _treeCellRenderer = createCellRenderer(cellRenderer);
+        }
+        else {
+            _treeCellRenderer.setActualTreeRenderer(cellRenderer);
+        }
+        return _treeCellRenderer;
+    }
+
+    private TreeCellRenderer getDefaultRenderer() {
+        if (_defaultRenderer == null)
+            _defaultRenderer = new DefaultTreeCellRenderer();
+        return _defaultRenderer;
+    }
+
+    /**
+     * Gets the actual cell renderer. Since CheckBoxTree has its own check box cell renderer, this method will give you
+     * access to the actual cell renderer which is either the default tree cell renderer or the cell renderer you set
+     * using {@link #setCellRenderer(javax.swing.tree.TreeCellRenderer)}.
+     *
+     * @return the actual cell renderer
+     */
+    public TreeCellRenderer getActualCellRenderer() {
+        if (_treeCellRenderer != null) {
+            return _treeCellRenderer.getActualTreeRenderer();
+        }
+        else {
+            return super.getCellRenderer();
+        }
+    }
+
+    @Override
+    public void setCellRenderer(TreeCellRenderer x) {
+        if (x == null) {
+            x = getDefaultRenderer();
+        }
+        super.setCellRenderer(x);
+        if (_treeCellRenderer != null) {
+            _treeCellRenderer.setActualTreeRenderer(x);
+        }
+    }
+
+
+    /**
+     * Creates the cell renderer.
+     *
+     * @param renderer the actual renderer for the tree node. This method will return a cell renderer that use a check
+     *                 box and put the actual renderer inside it.
+     * @return the cell renderer.
+     */
+    protected LegacyCheckBoxTreeCellRenderer createCellRenderer(TreeCellRenderer renderer) {
+        final LegacyCheckBoxTreeCellRenderer checkBoxTreeCellRenderer = new LegacyCheckBoxTreeCellRenderer(renderer, getCheckBox());
+        addPropertyChangeListener(CELL_RENDERER_PROPERTY, new PropertyChangeListener() {
+            public void propertyChange(PropertyChangeEvent evt) {
+                TreeCellRenderer treeCellRenderer = (TreeCellRenderer) evt.getNewValue();
+                if (treeCellRenderer != checkBoxTreeCellRenderer) {
+                    checkBoxTreeCellRenderer.setActualTreeRenderer(treeCellRenderer);
+                }
+                else {
+                    checkBoxTreeCellRenderer.setActualTreeRenderer(null);
+                }
+            }
+        });
+        return checkBoxTreeCellRenderer;
+    }
+
+    /**
+     * Creates the mouse listener and key listener used by CheckBoxTree.
+     *
+     * @return the Handler.
+     */
+    protected Handler createHandler() {
+        return new Handler(this);
+    }
+
+    /**
+     * Get the CheckBox used for CheckBoxTreeCellRenderer.
+     *
+     * @see #setCheckBox(LegacyTristateCheckBox)
+     * @return the check box.
+     */
+    public LegacyTristateCheckBox getCheckBox() {
+        return _checkBox;
+    }
+
+    /**
+     * Set the CheckBox used for CheckBoxTreeCellRenderer.
+     * <p>
+     * By default, it's null. CheckBoxTreeCellRenderer then will create a default TristateCheckBox.
+     *
+     * @param checkBox the check box
+     */
+    public void setCheckBox(LegacyTristateCheckBox checkBox) {
+        if (_checkBox != checkBox) {
+            _checkBox = checkBox;
+            _treeCellRenderer = null;
+            revalidate();
+            repaint();
+        }
+    }
+
+    /**
+     * Gets the flag indicating if toggling should select or deselect the partially selected node.
+     *
+     * @return true if select first. Otherwise false.
+     * @see #setSelectPartialOnToggling(boolean)
+     */
+    public boolean isSelectPartialOnToggling() {
+        return _selectPartialOnToggling;
+    }
+
+    /**
+     * Sets the flag indicating if toggling should select or deselect the partially selected node.
+     * <p/>
+     * By default, the value is true to keep original behavior.
+     *
+     * @param selectPartialOnToggling the flag
+     */
+    public void setSelectPartialOnToggling(boolean selectPartialOnToggling) {
+        _selectPartialOnToggling = selectPartialOnToggling;
+    }
+
+    protected static class Handler implements MouseListener, KeyListener, TreeSelectionListener {
+        protected LegacyCheckBoxTree _tree;
+        int _hotspot = new JCheckBox().getPreferredSize().width;
+        private int _toggleCount = -1;
+
+        public Handler(LegacyCheckBoxTree tree) {
+            _tree = tree;
+        }
+
+        protected TreePath getTreePathForMouseEvent(MouseEvent e) {
+            if (!SwingUtilities.isLeftMouseButton(e)) {
+                return null;
+            }
+
+            if (!_tree.isCheckBoxEnabled()) {
+                return null;
+            }
+
+            TreePath path = _tree.getPathForLocation(e.getX(), e.getY());
+            if (path == null)
+                return null;
+
+            if (clicksInCheckBox(e, path) || !_tree.isClickInCheckBoxOnly()) {
+                return path;
+            }
+            else {
+                return null;
+            }
+        }
+
+        protected boolean clicksInCheckBox(MouseEvent e, TreePath path) {
+            if (!_tree.isCheckBoxVisible(path)) {
+                return false;
+            }
+            else {
+                Rectangle bounds = _tree.getPathBounds(path);
+                if (_tree.getComponentOrientation().isLeftToRight()) {
+                    return e.getX() < bounds.x + _hotspot;
+                }
+                else {
+                    return e.getX() > bounds.x + bounds.width - _hotspot;
+                }
+            }
+        }
+
+        private TreePath preventToggleEvent(MouseEvent e) {
+            TreePath pathForMouseEvent = getTreePathForMouseEvent(e);
+            if (pathForMouseEvent != null) {
+                int toggleCount = _tree.getToggleClickCount();
+                if (toggleCount != -1) {
+                    _toggleCount = toggleCount;
+                    _tree.setToggleClickCount(-1);
+                }
+            }
+            return pathForMouseEvent;
+        }
+
+        public void mouseClicked(MouseEvent e) {
+            if (e.isConsumed()) {
+                return;
+            }
+
+            preventToggleEvent(e);
+        }
+
+        public void mousePressed(MouseEvent e) {
+            if (e.isConsumed()) {
+                return;
+            }
+
+            TreePath path = preventToggleEvent(e);
+            if (path != null) {
+                toggleSelections(new TreePath[] {path});
+                e.consume();
+            }
+        }
+
+        public void mouseReleased(MouseEvent e) {
+            if (e.isConsumed()) {
+                return;
+            }
+
+            TreePath path = preventToggleEvent(e);
+            if (path != null) {
+                e.consume();
+            }
+            if (_toggleCount != -1) {
+                _tree.setToggleClickCount(_toggleCount);
+            }
+        }
+
+        public void mouseEntered(MouseEvent e) {
+        }
+
+        public void mouseExited(MouseEvent e) {
+        }
+
+        public void keyPressed(KeyEvent e) {
+            if (e.isConsumed()) {
+                return;
+            }
+
+            if (!_tree.isCheckBoxEnabled()) {
+                return;
+            }
+
+            if (e.getModifiers() == 0 && e.getKeyChar() == KeyEvent.VK_SPACE)
+                toggleSelections();
+        }
+
+        public void keyTyped(KeyEvent e) {
+        }
+
+        public void keyReleased(KeyEvent e) {
+        }
+
+        public void valueChanged(TreeSelectionEvent e) {
+            _tree.treeDidChange();
+        }
+
+        protected void toggleSelections() {
+            TreePath[] treePaths = _tree.getSelectionPaths();
+            toggleSelections(treePaths);
+        }
+
+        private void toggleSelections(TreePath[] treePaths) {
+            if (treePaths == null || treePaths.length == 0 || !_tree.isEnabled()) {
+                return;
+            }
+            if (treePaths.length == 1 && !_tree.isCheckBoxEnabled(treePaths[0])) {
+                return;
+            }
+            LegacyCheckBoxTreeSelectionModel selectionModel = _tree.getCheckBoxTreeSelectionModel();
+            List<TreePath> pathToAdded = new ArrayList<TreePath>();
+            List<TreePath> pathToRemoved = new ArrayList<TreePath>();
+            for (TreePath treePath : treePaths) {
+                boolean selected = selectionModel.isPathSelected(treePath, selectionModel.isDigIn());
+                if (selected) {
+                    pathToRemoved.add(treePath);
+                }
+                else {
+                    if (!_tree.isSelectPartialOnToggling() && selectionModel.isPartiallySelected(treePath)) {
+                        TreePath[] selectionPaths = selectionModel.getSelectionPaths();
+                        if (selectionPaths != null) {
+                            for (TreePath selectionPath : selectionPaths) {
+                                if (selectionModel.isDescendant(selectionPath, treePath)) {
+                                    pathToRemoved.add(selectionPath);
+                                }
+                            }
+                        }
+                    }
+                    else {
+                        pathToAdded.add(treePath);
+                    }
+                }
+            }
+            selectionModel.removeTreeSelectionListener(this);
+            try {
+                if (pathToAdded.size() > 0) {
+                    selectionModel.addSelectionPaths(pathToAdded.toArray(new TreePath[pathToAdded.size()]));
+                }
+                if (pathToRemoved.size() > 0) {
+                    selectionModel.removeSelectionPaths(pathToRemoved.toArray(new TreePath[pathToRemoved.size()]));
+                }
+            }
+            finally {
+                selectionModel.addTreeSelectionListener(this);
+                _tree.treeDidChange();
+            }
+        }
+    }
+
+    @Override
+    public TreePath getNextMatch(String prefix, int startingRow, Position.Bias bias) {
+        return null;
+    }
+
+    /**
+     * Gets the selection model for the check boxes. To retrieve the state of check boxes, you should use this selection
+     * model.
+     *
+     * @return the selection model for the check boxes.
+     */
+    public LegacyCheckBoxTreeSelectionModel getCheckBoxTreeSelectionModel() {
+        return _checkBoxTreeSelectionModel;
+    }
+
+    /**
+     * Gets the value of property checkBoxEnabled. If true, user can click on check boxes on each tree node to select
+     * and deselect. If false, user can't click but you as developer can programmatically call API to select/deselect
+     * it.
+     *
+     * @return the value of property checkBoxEnabled.
+     */
+    public boolean isCheckBoxEnabled() {
+        return _checkBoxEnabled;
+    }
+
+    /**
+     * Sets the value of property checkBoxEnabled.
+     *
+     * @param checkBoxEnabled true to allow to check the check box. False to disable it which means user can see whether
+     *                        a row is checked or not but they cannot change it.
+     */
+    public void setCheckBoxEnabled(boolean checkBoxEnabled) {
+        if (checkBoxEnabled != _checkBoxEnabled) {
+            Boolean oldValue = _checkBoxEnabled ? Boolean.TRUE : Boolean.FALSE;
+            Boolean newValue = checkBoxEnabled ? Boolean.TRUE : Boolean.FALSE;
+            _checkBoxEnabled = checkBoxEnabled;
+            firePropertyChange(PROPERTY_CHECKBOX_ENABLED, oldValue, newValue);
+            repaint();
+        }
+    }
+
+    /**
+     * Checks if check box is enabled. There is no setter for it. The only way is to override this method to return true
+     * or false.
+     * <p/>
+     * However, in digIn mode, user can still select the disabled node by selecting all children nodes of that node.
+     * Also if user selects the parent node, the disabled children nodes will be selected too.
+     *
+     * @param path the tree path.
+     * @return true or false. If false, the check box on the particular tree path will be disabled.
+     */
+    public boolean isCheckBoxEnabled(TreePath path) {
+        return true;
+    }
+
+    /**
+     * Checks if check box is visible. There is no setter for it. The only way is to override this method to return true
+     * or false.
+     *
+     * @param path the tree path.
+     * @return true or false. If false, the check box on the particular tree path will be disabled.
+     */
+    public boolean isCheckBoxVisible(TreePath path) {
+        return true;
+    }
+
+    /**
+     * Gets the dig-in mode. If the CheckBoxTree is in dig-in mode, checking the parent node will check all the
+     * children. Correspondingly, getSelectionPaths() will only return the parent tree path. If not in dig-in mode, each
+     * tree node can be checked or unchecked independently
+     *
+     * @return true or false.
+     */
+    public boolean isDigIn() {
+        return getCheckBoxTreeSelectionModel().isDigIn();
+    }
+
+    /**
+     * Sets the dig-in mode. If the CheckBoxTree is in dig-in mode, checking the parent node will check all the
+     * children. Correspondingly, getSelectionPaths() will only return the parent tree path. If not in dig-in mode, each
+     * tree node can be checked or unchecked independently
+     *
+     * @param digIn the new digIn mode.
+     */
+    public void setDigIn(boolean digIn) {
+        boolean old = isDigIn();
+        if (old != digIn) {
+            getCheckBoxTreeSelectionModel().setDigIn(digIn);
+            firePropertyChange(PROPERTY_DIG_IN, old, digIn);
+        }
+    }
+
+    /**
+     * Gets the value of property clickInCheckBoxOnly. If true, user can click on check boxes on each tree node to
+     * select and deselect. If false, user can't click but you as developer can programmatically call API to
+     * select/deselect it.
+     *
+     * @return the value of property clickInCheckBoxOnly.
+     */
+    public boolean isClickInCheckBoxOnly() {
+        return _clickInCheckBoxOnly;
+    }
+
+    /**
+     * Sets the value of property clickInCheckBoxOnly.
+     *
+     * @param clickInCheckBoxOnly true to allow to check the check box. False to disable it which means user can see
+     *                            whether a row is checked or not but they cannot change it.
+     */
+    public void setClickInCheckBoxOnly(boolean clickInCheckBoxOnly) {
+        if (clickInCheckBoxOnly != _clickInCheckBoxOnly) {
+            boolean old = _clickInCheckBoxOnly;
+            _clickInCheckBoxOnly = clickInCheckBoxOnly;
+            firePropertyChange(PROPERTY_CLICK_IN_CHECKBOX_ONLY, old, _clickInCheckBoxOnly);
+        }
+    }
+}


=====================================
src/com/jidesoft/swing/LegacyCheckBoxTreeCellRenderer.java
=====================================
@@ -0,0 +1,163 @@
+/*
+ * @(#)CheckBoxTreeCellRenderer.java 8/11/2005
+ *
+ * Copyright 2002 - 2005 JIDE Software Inc. All rights reserved.
+ */
+
+package com.jidesoft.swing;
+
+import javax.swing.*;
+import javax.swing.border.Border;
+import javax.swing.tree.TreeCellRenderer;
+import javax.swing.tree.TreePath;
+import java.awt.*;
+import java.awt.event.MouseEvent;
+import java.io.Serializable;
+
+/**
+ * <strong>This class is deprecated and provided to support compatibility with {@link LegacyTristateCheckBox}. We will not provide support
+ * for this class. You likely want to use {@link CheckBoxTreeCellRenderer}.</strong>
+ * <p/>
+ * Renderers an item in a tree using JCheckBox.
+ * @deprecated Use {@link CheckBoxTreeCellRenderer}.
+ */
+public class LegacyCheckBoxTreeCellRenderer extends JPanel implements TreeCellRenderer, Serializable {
+    private static final long serialVersionUID = 30207434500313004L;
+
+    /**
+     * The checkbox that is used to paint the check box in cell renderer
+     */
+    protected LegacyTristateCheckBox _checkBox = null;
+    protected JComponent _emptyBox = null;
+    protected JCheckBox _protoType;
+
+    /**
+     * The label which appears after the check box.
+     */
+    protected TreeCellRenderer _actualTreeRenderer;
+
+    /**
+     * Constructs a default renderer object for an item in a list.
+     */
+    public LegacyCheckBoxTreeCellRenderer() {
+        this(null);
+    }
+
+    public LegacyCheckBoxTreeCellRenderer(TreeCellRenderer renderer) {
+        this(renderer, null);
+    }
+
+    public LegacyCheckBoxTreeCellRenderer(TreeCellRenderer renderer, LegacyTristateCheckBox checkBox) {
+        _protoType = new LegacyTristateCheckBox();
+        if (checkBox == null) {
+            _checkBox = createCheckBox();
+        }
+        else {
+            _checkBox = checkBox;
+        }
+        _emptyBox = (JComponent) Box.createHorizontalStrut(_protoType.getPreferredSize().width);
+        setLayout(new BorderLayout(0, 0));
+        setOpaque(false);
+        _actualTreeRenderer = renderer;
+    }
+
+    /**
+     * Create the check box in the cell.
+     * <p>
+     * By default, it creates a LegacyTristateCheckBox and set opaque to false.
+     *
+     * @return the check box instance.
+     */
+    protected LegacyTristateCheckBox createCheckBox() {
+        LegacyTristateCheckBox checkBox = new LegacyTristateCheckBox();
+        checkBox.setOpaque(false);
+        return checkBox;
+    }
+
+    public TreeCellRenderer getActualTreeRenderer() {
+        return _actualTreeRenderer;
+    }
+
+    public void setActualTreeRenderer(TreeCellRenderer actualTreeRenderer) {
+        _actualTreeRenderer = actualTreeRenderer;
+    }
+
+    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
+        removeAll();
+        _checkBox.setPreferredSize(new Dimension(_protoType.getPreferredSize().width, 0));
+        _emptyBox.setPreferredSize(new Dimension(_protoType.getPreferredSize().width, 0));
+        applyComponentOrientation(tree.getComponentOrientation());
+
+        TreePath path = tree.getPathForRow(row);
+        if (path != null && tree instanceof LegacyCheckBoxTree) {
+            LegacyCheckBoxTreeSelectionModel selectionModel = ((LegacyCheckBoxTree) tree).getCheckBoxTreeSelectionModel();
+            if (selectionModel != null) {
+                boolean enabled = tree.isEnabled() && ((LegacyCheckBoxTree) tree).isCheckBoxEnabled() && ((LegacyCheckBoxTree) tree).isCheckBoxEnabled(path);
+                if (!enabled && !selected) {
+                    if (getBackground() != null) {
+                        setForeground(getBackground().darker());
+                    }
+                }
+                _checkBox.setEnabled(enabled);
+                updateCheckBoxState(_checkBox, path, selectionModel);
+            }
+        }
+
+        if (_actualTreeRenderer != null) {
+            JComponent treeCellRendererComponent = (JComponent) _actualTreeRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
+            Border border = treeCellRendererComponent.getBorder();
+            setBorder(border);
+            treeCellRendererComponent.setBorder(BorderFactory.createEmptyBorder());
+            if (path == null || !(tree instanceof LegacyCheckBoxTree) || ((LegacyCheckBoxTree) tree).isCheckBoxVisible(path)) {
+                remove(_emptyBox);
+                add(_checkBox, BorderLayout.BEFORE_LINE_BEGINS);
+            }
+            else {
+                remove(_checkBox);
+                add(_emptyBox, BorderLayout.AFTER_LINE_ENDS); // expand the tree node size to be the same as the one with check box.
+            }
+            add(treeCellRendererComponent);
+        }
+
+        return this;
+    }
+
+    /**
+     * Updates the check box state based on the selection in the selection model. By default, we check if the path is
+     * selected. If yes, we mark the check box as TristateCheckBox.SELECTED. If not, we will check if the path is
+     * partially selected, if yes, we set the check box as null or TristateCheckBox.DONT_CARE to indicate the path is
+     * partially selected. Otherwise, we set it to TristateCheckBox.NOT_SELECTED.
+     *
+     * @param checkBox       the TristateCheckBox for the particular tree path.
+     * @param path           the tree path.
+     * @param selectionModel the CheckBoxTreeSelectionModel.
+     */
+    protected void updateCheckBoxState(LegacyTristateCheckBox checkBox, TreePath path, LegacyCheckBoxTreeSelectionModel selectionModel) {
+        if (selectionModel.isPathSelected(path, selectionModel.isDigIn()))
+            checkBox.setState(LegacyTristateCheckBox.SELECTED);
+        else
+            checkBox.setState(selectionModel.isDigIn() && selectionModel.isPartiallySelected(path) ? null : LegacyTristateCheckBox.NOT_SELECTED);
+    }
+
+    @Override
+    public String getToolTipText(MouseEvent event) {
+        if (_actualTreeRenderer instanceof JComponent) {
+            Point p = event.getPoint();
+            p.translate(-_checkBox.getWidth(), 0);
+            MouseEvent newEvent = new MouseEvent(((JComponent) _actualTreeRenderer), event.getID(),
+                    event.getWhen(),
+                    event.getModifiers(),
+                    p.x, p.y, event.getClickCount(),
+                    event.isPopupTrigger());
+
+            String tip = ((JComponent) _actualTreeRenderer).getToolTipText(
+                    newEvent);
+
+            if (tip != null) {
+                return tip;
+            }
+        }
+        return super.getToolTipText(event);
+    }
+
+}


=====================================
src/com/jidesoft/swing/LegacyCheckBoxTreeSelectionModel.java
=====================================
@@ -0,0 +1,741 @@
+package com.jidesoft.swing;
+
+import javax.swing.event.TreeModelEvent;
+import javax.swing.event.TreeModelListener;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.tree.DefaultTreeSelectionModel;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
+import java.util.*;
+
+/**
+ * <strong>This class is deprecated and provided to support compatibility with {@link LegacyTristateCheckBox}. We will not provide support
+ * for this class. You likely want to use {@link CheckBoxTreeSelectionModel}.</strong>
+ * <p/>
+ * <code>CheckBoxTreeSelectionModel</code> is a selection _model based on {@link DefaultTreeSelectionModel} and use in
+ * {@link CheckBoxTree} to keep track of the checked tree paths.
+ *
+ * @author Santhosh Kumar T
+ * @deprecated Use {@link CheckBoxTreeSelectionModel}.
+ */
+public class LegacyCheckBoxTreeSelectionModel extends DefaultTreeSelectionModel implements TreeModelListener {
+    private TreeModel _model;
+    private boolean _digIn = true;
+    private LegacyCheckBoxTree _tree;
+    /**
+     * Used in {@link #areSiblingsSelected(javax.swing.tree.TreePath)} for those paths pending added so that they are not
+     * in the selection model right now.
+     */
+    protected Set<TreePath> _pathHasAdded;
+
+    private boolean _singleEventMode = false;
+    private static final long serialVersionUID = 1368502059666946634L;
+
+    public LegacyCheckBoxTreeSelectionModel(TreeModel model) {
+        setModel(model);
+        setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
+    }
+
+    void setTree(LegacyCheckBoxTree tree) {
+        _tree = tree;
+    }
+
+    public LegacyCheckBoxTreeSelectionModel(TreeModel model, boolean digIn) {
+        setModel(model);
+        _digIn = digIn;
+    }
+
+    public TreeModel getModel() {
+        return _model;
+    }
+
+    public void setModel(TreeModel model) {
+        if (_model != model) {
+            if (_model != null) {
+                _model.removeTreeModelListener(this);
+            }
+            _model = model;
+            if (_model != null) {
+                _model.addTreeModelListener(this);
+            }
+        }
+    }
+
+    /**
+     * Gets the dig-in mode. If the CheckBoxTree is in dig-in mode, checking the parent node will check all the
+     * children. Correspondingly, getSelectionPaths() will only return the parent tree path. If not in dig-in mode, each
+     * tree node can be checked or unchecked independently
+     *
+     * @return true or false.
+     */
+    public boolean isDigIn() {
+        return _digIn;
+    }
+
+    /**
+     * Sets the dig-in mode. If the CheckBoxTree is in dig-in mode, checking the parent node will check all the
+     * children. Correspondingly, getSelectionPaths() will only return the parent tree path. If not in dig-in mode, each
+     * tree node can be checked or unchecked independently
+     *
+     * @param digIn true to enable dig-in mode. False to disable it.
+     */
+    public void setDigIn(boolean digIn) {
+        _digIn = digIn;
+    }
+
+    /**
+     * Tests whether there is any unselected node in the subtree of given path.
+     * <p/>
+     * Inherited from JTree, the TreePath must be a path instance inside the tree model. If you populate a new TreePath
+     * instance on the fly, it would not work.
+     *
+     * @param path check if the path is partially selected.
+     * @return true if partially. Otherwise false.
+     */
+    public boolean isPartiallySelected(TreePath path) {
+        if (!isDigIn()) {
+            return isPathSelected(path, false);
+        }
+        if (isPathSelected(path, true))
+            return false;
+        TreePath[] selectionPaths = getSelectionPaths();
+        if (selectionPaths == null)
+            return false;
+        for (TreePath selectionPath : selectionPaths) {
+            if (isDescendant(selectionPath, path))
+                return true;
+        }
+        return false;
+    }
+
+    @Override
+    public boolean isRowSelected(int row) {
+        return isPathSelected(_tree.getPathForRow(row), _tree.isDigIn());
+    }
+
+    /**
+     * Check if the parent path is really selected.
+     * <p/>
+     * The default implementation is just return true. In filterable scenario, you could override this method to check
+     * more.
+     * <p/>
+     * Inherited from JTree, the TreePath must be a path instance inside the tree model. If you populate a new TreePath
+     * instance on the fly, it would not work.
+     *
+     * @param path   the original path to be checked
+     * @param parent the parent part which is closest to the original path and is selected
+     * @return true if the path is actually selected without any doubt. Otherwise false.
+     */
+    protected boolean isParentActuallySelected(TreePath path, TreePath parent) {
+        return true;
+    }
+
+    /**
+     * Tells whether given path is selected. if dig is true, then a path is assumed to be selected, if one of its
+     * ancestor is selected.
+     * <p/>
+     * Inherited from JTree, the TreePath must be a path instance inside the tree model. If you populate a new TreePath
+     * instance on the fly, it would not work.
+     *
+     * @param path  check if the path is selected.
+     * @param digIn whether we will check its descendants.
+     * @return true if the path is selected.
+     */
+    public boolean isPathSelected(TreePath path, boolean digIn) {
+        if (path == null) {
+            return false;
+        }
+
+        if (!digIn)
+            return super.isPathSelected(path);
+
+        TreePath parent = path;
+        while (parent != null && !super.isPathSelected(parent)) {
+            parent = parent.getParentPath();
+        }
+
+        if (parent != null) {
+            return isParentActuallySelected(path, parent);
+        }
+
+        if (_model == null) {
+            return true;
+        }
+
+        Object node = path.getLastPathComponent();
+        if (getChildrenCount(node) == 0) {
+            return false;
+        }
+
+        // find out if all children are selected
+        boolean allChildrenSelected = true;
+        for (int i = 0; i < getChildrenCount(node); i++) {
+            Object childNode = getChild(node, i);
+            if (!isPathSelected(path.pathByAddingChild(childNode), true)) {
+                allChildrenSelected = false;
+                break;
+            }
+        }
+        // if all children are selected, let's select the parent path only
+        if (_tree.isCheckBoxVisible(path) && allChildrenSelected) {
+            addSelectionPaths(new TreePath[]{path}, false);
+        }
+        return allChildrenSelected;
+    }
+
+    /**
+     * is path1 descendant of path2.
+     * <p/>
+     * Inherited from JTree, the TreePath must be a path instance inside the tree model. If you populate a new TreePath
+     * instance on the fly, it would not work.
+     *
+     * @param path1 the first path
+     * @param path2 the second path
+     * @return true if the first path is the descendant of the second path.
+     */
+    boolean isDescendant(TreePath path1, TreePath path2) {
+        Object obj1[] = path1.getPath();
+        Object obj2[] = path2.getPath();
+        if (obj1.length < obj2.length)
+            return false;
+        for (int i = 0; i < obj2.length; i++) {
+            if (obj1[i] != obj2[i])
+                return false;
+        }
+        return true;
+    }
+
+    private boolean _fireEvent = true;
+
+    @SuppressWarnings({"RawUseOfParameterizedType"})
+    @Override
+    protected void notifyPathChange(Vector changedPaths, TreePath oldLeadSelection) {
+        if (_fireEvent) {
+            super.notifyPathChange(changedPaths, oldLeadSelection);
+        }
+    }
+
+    /**
+     * Overrides the method in DefaultTreeSelectionModel to consider digIn mode.
+     * <p/>
+     * Inherited from JTree, the TreePath must be a path instance inside the tree model. If you populate a new TreePath
+     * instance on the fly, it would not work.
+     *
+     * @param pPaths the tree paths to be selected.
+     */
+    @Override
+    public void setSelectionPaths(TreePath[] pPaths) {
+        if (!isDigIn() || selectionMode == TreeSelectionModel.SINGLE_TREE_SELECTION) {
+            super.setSelectionPaths(pPaths);
+        }
+        else {
+            clearSelection();
+            addSelectionPaths(pPaths);
+        }
+    }
+
+    /**
+     * Overrides the method in DefaultTreeSelectionModel to consider digIn mode.
+     * <p/>
+     * Inherited from JTree, the TreePath must be a path instance inside the tree model. If you populate a new TreePath
+     * instance on the fly, it would not work.
+     *
+     * @param paths the tree paths to be added to selection paths.
+     */
+    @Override
+    public void addSelectionPaths(TreePath[] paths) {
+        addSelectionPaths(paths, true);
+    }
+
+    /**
+     * Add the selection paths.
+     *
+     * @param paths                  the paths to be added
+     * @param needCheckPathSelection the flag to indicating if the path selection should be checked to improve performance
+     */
+    protected void addSelectionPaths(TreePath[] paths, boolean needCheckPathSelection) {
+        if (!isDigIn()) {
+            super.addSelectionPaths(paths);
+            return;
+        }
+
+        setBatchMode(true);
+        boolean fireEventAtTheEnd = false;
+        if (isSingleEventMode() && _fireEvent) {
+            _fireEvent = false;
+            fireEventAtTheEnd = true;
+        }
+
+        try {
+            if (needCheckPathSelection) {
+                _pathHasAdded = new HashSet<TreePath>();
+                for (TreePath path : paths) {
+                    if (isPathSelected(path, isDigIn())) {
+                        continue; // for non batch mode scenario, check if it is already selected by adding its parent possibly
+                    }
+                    // if the path itself is added by other insertion, just remove it
+                    if (_toBeAdded.contains(path)) {
+                        addToExistingSet(_pathHasAdded, path);
+                        continue;
+                    }
+                    // check if its ancestor has already been added. If so, do nothing
+                    boolean findAncestor = false;
+                    for (TreePath addPath : _pathHasAdded) {
+                        if (addPath.isDescendant(path)) {
+                            findAncestor = true;
+                            break;
+                        }
+                    }
+                    if (findAncestor) {
+                        continue;
+                    }
+                    TreePath temp = null;
+                    // if all siblings are selected then deselect them and select parent recursively
+                    // otherwise just select that path.
+                    while (areSiblingsSelected(path)) {
+                        temp = path;
+                        if (path.getParentPath() == null)
+                            break;
+                        path = path.getParentPath();
+                    }
+                    if (temp != null) {
+                        if (temp.getParentPath() != null) {
+                            delegateAddSelectionPaths(new TreePath[] {temp.getParentPath()});
+                        }
+                        else {
+                            delegateAddSelectionPaths(new TreePath[]{temp});
+                        }
+                    }
+                    else {
+                        delegateAddSelectionPaths(new TreePath[]{path});
+                    }
+                    addToExistingSet(_pathHasAdded, path);
+                }
+                // deselect all descendants of paths[]
+                List<TreePath> toBeRemoved = new ArrayList<TreePath>();
+                for (TreePath path : _toBeAdded) {
+                    TreePath[] selectionPaths = getSelectionPaths();
+                    if (selectionPaths == null)
+                        break;
+                    for (TreePath selectionPath : selectionPaths) {
+                        if (isDescendant(selectionPath, path))
+                            toBeRemoved.add(selectionPath);
+                    }
+                }
+                if (toBeRemoved.size() > 0) {
+                    delegateRemoveSelectionPaths(toBeRemoved.toArray(new TreePath[toBeRemoved.size()]));
+                }
+            }
+            else {
+                // deselect all descendants of paths[]
+                List<TreePath> toBeRemoved = new ArrayList<TreePath>();
+                for (TreePath path : paths) {
+                    TreePath[] selectionPaths = getSelectionPaths();
+                    if (selectionPaths == null)
+                        break;
+                    for (TreePath selectionPath : selectionPaths) {
+                        if (isDescendant(selectionPath, path))
+                            toBeRemoved.add(selectionPath);
+                    }
+                }
+                if (toBeRemoved.size() > 0) {
+                    delegateRemoveSelectionPaths(toBeRemoved.toArray(new TreePath[toBeRemoved.size()]));
+                }
+
+                // if all siblings are selected then deselect them and select parent recursively
+                // otherwise just select that path.
+                for (TreePath path : paths) {
+                    TreePath temp = null;
+                    while (areSiblingsSelected(path)) {
+                        temp = path;
+                        if (path.getParentPath() == null)
+                            break;
+                        path = path.getParentPath();
+                    }
+                    if (temp != null) {
+                        if (temp.getParentPath() != null) {
+                            addSelectionPath(temp.getParentPath());
+                        }
+                        else {
+                            if (!isSelectionEmpty()) {
+                                removeSelectionPaths(getSelectionPaths(), !fireEventAtTheEnd);
+                            }
+                            delegateAddSelectionPaths(new TreePath[]{temp});
+                        }
+                    }
+                    else {
+                        delegateAddSelectionPaths(new TreePath[]{path});
+                    }
+                }
+            }
+        }
+        finally {
+            _fireEvent = true;
+            setBatchMode(false);
+            if (isSingleEventMode() && fireEventAtTheEnd) {
+                notifyPathChange(paths, true, paths[0]);
+            }
+        }
+    }
+
+    /**
+     * tells whether all siblings of given path are selected.
+     * <p/>
+     * Inherited from JTree, the TreePath must be a path instance inside the tree model. If you populate a new TreePath
+     * instance on the fly, it would not work.
+     *
+     * @param path the tree path
+     * @return true if the siblings are all selected.
+     */
+    protected boolean areSiblingsSelected(TreePath path) {
+        TreePath parent = path.getParentPath();
+        if (parent == null)
+            return true;
+        Object node = path.getLastPathComponent();
+        Object parentNode = parent.getLastPathComponent();
+
+        int childCount = getChildrenCount(parentNode);
+        for (int i = 0; i < childCount; i++) {
+            Object childNode = getChild(parentNode, i);
+            if (childNode == node)
+                continue;
+            TreePath childPath = parent.pathByAddingChild(childNode);
+            if (_tree != null && !_tree.isCheckBoxVisible(childPath)) {
+                // if the checkbox is not visible, we check its children
+                if (!isPathSelected(childPath, true) && (_pathHasAdded == null || !_pathHasAdded.contains(childPath))) {
+                    return false;
+                }
+            }
+            if (!isPathSelected(childPath) && (_pathHasAdded == null || !_pathHasAdded.contains(childPath))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public void removeSelectionPaths(TreePath[] paths) {
+        removeSelectionPaths(paths, true);
+    }
+
+    public void removeSelectionPaths(TreePath[] paths, boolean doFireEvent) {
+        if (!isDigIn()) {
+            super.removeSelectionPaths(paths);
+            return;
+        }
+
+        boolean fireEventAtTheEnd = false;
+        if (doFireEvent) {
+            if (isSingleEventMode() && _fireEvent) {
+                _fireEvent = false;
+                fireEventAtTheEnd = true;
+            }
+        }
+        setBatchMode(true);
+        try {
+            Set<TreePath> pathHasRemoved = new HashSet<TreePath>();
+            for (TreePath path : paths) {
+                if (!isPathSelected(path, isDigIn())) {
+                    continue; // for non batch mode scenario, check if it is already deselected by removing its parent possibly
+                }
+                TreePath upperMostSelectedAncestor = null;
+                if (_toBeAdded.contains(path)) {
+                    _toBeAdded.remove(path);
+                    addToExistingSet(pathHasRemoved, path);
+                    continue;
+                }
+                // check if its ancestor has already been removed. If so, do nothing
+                boolean findAncestor = false;
+                for (TreePath removedPath : pathHasRemoved) {
+                    if (removedPath.isDescendant(path)) {
+                        findAncestor = true;
+                        break;
+                    }
+                }
+                if (findAncestor) {
+                    continue;
+                }
+                // remove all children path added by other removal
+                Set<TreePath> pathToRemoved = new HashSet<TreePath>();
+                for (TreePath pathToAdded : _toBeAdded) {
+                    if (path.isDescendant(pathToAdded)) {
+                        pathToRemoved.add(pathToAdded);
+                    }
+                }
+                _toBeAdded.removeAll(pathToRemoved);
+                // find a parent path added by other removal, then use that parent to do following actions
+                for (TreePath pathToAdded : _toBeAdded) {
+                    if (pathToAdded.isDescendant(path)) {
+                        upperMostSelectedAncestor = pathToAdded;
+                        break;
+                    }
+                }
+                TreePath parent = path.getParentPath();
+                Stack<TreePath> stack = new Stack<TreePath>();
+                while (parent != null && (upperMostSelectedAncestor == null ? !isPathSelected(parent) : parent != upperMostSelectedAncestor)) {
+                    stack.push(parent);
+                    parent = parent.getParentPath();
+                }
+                if (parent != null)
+                    stack.push(parent);
+                else {
+                    delegateRemoveSelectionPaths(new TreePath[]{path});
+                    addToExistingSet(pathHasRemoved, path);
+                    continue;
+                }
+
+                List<TreePath> toBeAdded = new ArrayList<TreePath>();
+                while (!stack.isEmpty()) {
+                    TreePath temp = stack.pop();
+                    TreePath peekPath = stack.isEmpty() ? path : stack.peek();
+                    Object node = temp.getLastPathComponent();
+                    Object peekNode = peekPath.getLastPathComponent();
+                    int childCount = getChildrenCount(node);
+                    for (int i = 0; i < childCount; i++) {
+                        Object childNode = getChild(node, i);
+                        if (childNode != peekNode) {
+                            TreePath treePath = temp.pathByAddingChild(childNode);
+                            toBeAdded.add(treePath);
+                        }
+                    }
+                }
+                if (toBeAdded.size() > 0) {
+                    delegateAddSelectionPaths(toBeAdded.toArray(new TreePath[toBeAdded.size()]));
+                }
+                delegateRemoveSelectionPaths(new TreePath[]{parent});
+                addToExistingSet(pathHasRemoved, path);
+            }
+        }
+        finally {
+            _fireEvent = true;
+            setBatchMode(false);
+            if (isSingleEventMode() && fireEventAtTheEnd) {
+                notifyPathChange(paths, false, paths[0]);
+            }
+        }
+    }
+
+    /**
+     * Get the child of node in the designated index.
+     *
+     * @param node the parent node
+     * @param i    the child index
+     * @return the child node
+     */
+    protected Object getChild(Object node, int i) {
+        return _model.getChild(node, i);
+    }
+
+    /**
+     * Get the children count
+     *
+     * @param node the parent node
+     * @return the children count of the parent node.
+     */
+    protected int getChildrenCount(Object node) {
+        return _model.getChildCount(node);
+    }
+
+    private void addToExistingSet(Set<TreePath> pathHasOperated, TreePath pathToOperate) {
+        if (pathHasOperated.contains(pathToOperate)) {
+            return; // it is already removed
+        }
+        for (TreePath path : pathHasOperated) {
+            if (path.isDescendant(pathToOperate)) {
+                return; // its parent is removed, no need to add it
+            }
+        }
+        // remove all children path exists in the set
+        Set<TreePath> duplicatePathToErase = new HashSet<TreePath>();
+        for (TreePath path : pathHasOperated) {
+            if (pathToOperate.isDescendant(path)) {
+                duplicatePathToErase.add(path);
+            }
+        }
+        pathHasOperated.removeAll(duplicatePathToErase);
+        pathHasOperated.add(pathToOperate);
+    }
+
+    public boolean isSingleEventMode() {
+        return _singleEventMode;
+    }
+
+    /**
+     * Single event mode is a mode that always fires only one event when you select or deselect a tree node.
+     * <p/>
+     * Taking this tree as an example,
+     * <p/>
+     * <code><pre>
+     * A -- a
+     *   |- b
+     *   |- c
+     * </code></pre>
+     * Case 1: Assuming b and c are selected at this point, you click on a. <br> <ul> <li>In non-single event mode, you
+     * will get select-A, deselect-b and deselect-c three events <li>In single event mode, you will only get select-a.
+     * </ul>
+     * <p/>
+     * Case 2: Assuming none of the nodes are selected, you click on A. In this case, both modes result in the same
+     * behavior. <ul> <li>In non-single event mode, you will get only select-A event. <li>In single event mode, you will
+     * only get select-A too. </ul> Case 3: Assuming b and c are selected and now you click on A. <ul> <li>In non-single
+     * event mode, you will get select-A event as well as deselect-b and deselect-c event. <li>In single event mode, you
+     * will only get select-A. </ul> As you can see, single event mode will always fire the event on the nodes you
+     * select. However it doesn't reflect what really happened inside the selection model. So if you want to get a
+     * complete picture of the selection state inside selection model, you should use {@link #getSelectionPaths()} to
+     * find out. In non-single event mode, the events reflect what happened inside the selection model. So you can get a
+     * complete picture of the exact state without asking the selection model. The downside is it will generate too many
+     * events. With this option, you can decide which mode you want to use that is the best for your case.
+     * <p/>
+     * By default, singleEventMode is set to false to be compatible with the older versions that don't have this
+     * option.
+     *
+     * @param singleEventMode true or false.
+     */
+    public void setSingleEventMode(boolean singleEventMode) {
+        _singleEventMode = singleEventMode;
+    }
+
+    /**
+     * Notifies listeners of a change in path. changePaths should contain instances of PathPlaceHolder.
+     *
+     * @param changedPaths     the paths that are changed.
+     * @param isNew            is it a new path.
+     * @param oldLeadSelection the old selection.
+     */
+    protected void notifyPathChange(TreePath[] changedPaths, boolean isNew, TreePath oldLeadSelection) {
+        if (_fireEvent) {
+            int cPathCount = changedPaths.length;
+            boolean[] newness = new boolean[cPathCount];
+
+            for (int counter = 0; counter < cPathCount; counter++) {
+                newness[counter] = isNew;
+            }
+
+            TreeSelectionEvent event = new TreeSelectionEvent
+                    (this, changedPaths, newness, oldLeadSelection, leadPath);
+
+            fireValueChanged(event);
+        }
+    }
+
+    // do not use it for now
+    private boolean _batchMode = false;
+
+    boolean isBatchMode() {
+        return _batchMode;
+    }
+
+    public void setBatchMode(boolean batchMode) {
+        _batchMode = batchMode;
+        if (!_batchMode) {
+            TreePath[] treePaths = _toBeAdded.toArray(new TreePath[_toBeAdded.size()]);
+            _toBeAdded.clear();
+            super.addSelectionPaths(treePaths);
+            treePaths = _toBeRemoved.toArray(new TreePath[_toBeRemoved.size()]);
+            _toBeRemoved.clear();
+            super.removeSelectionPaths(treePaths);
+        }
+    }
+
+    private Set<TreePath> _toBeAdded = new HashSet<TreePath>();
+    private Set<TreePath> _toBeRemoved = new HashSet<TreePath>();
+
+    private void delegateRemoveSelectionPaths(TreePath[] paths) {
+        if (!isBatchMode()) {
+            super.removeSelectionPaths(paths);
+        }
+        else {
+            for (TreePath path : paths) {
+                _toBeRemoved.add(path);
+                _toBeAdded.remove(path);
+            }
+        }
+    }
+
+//    private void delegateRemoveSelectionPath(TreePath path) {
+//        if (!isBatchMode()) {
+//            super.removeSelectionPath(path);
+//        }
+//        else {
+//            _toBeRemoved.add(path);
+//            _toBeAdded.remove(path);
+//        }
+//
+//    }
+//
+    private void delegateAddSelectionPaths(TreePath[] paths) {
+        if (!isBatchMode()) {
+            super.addSelectionPaths(paths);
+        }
+        else {
+            for (TreePath path : paths) {
+                addToExistingSet(_toBeAdded, path);
+                _toBeRemoved.remove(path);
+            }
+        }
+    }
+
+//    private void delegateAddSelectionPath(TreePath path) {
+//        if (!isBatchMode()) {
+//            super.addSelectionPath(path);
+//        }
+//        else {
+//            _toBeAdded.add(path);
+//            _toBeRemoved.remove(path);
+//        }
+//    }
+//
+    public void treeNodesChanged(TreeModelEvent e) {
+        revalidateSelectedTreePaths();
+    }
+
+    public void treeNodesInserted(TreeModelEvent e) {
+
+    }
+
+    public void treeNodesRemoved(TreeModelEvent e) {
+        revalidateSelectedTreePaths();
+    }
+
+    private boolean isTreePathValid(TreePath path) {
+        Object parent = _model.getRoot();
+        for (int i = 0; i < path.getPathCount(); i++) {
+            Object pathComponent = path.getPathComponent(i);
+            if (i == 0) {
+                if (pathComponent != parent) {
+                    return false;
+                }
+            }
+            else {
+                boolean found = false;
+                for (int j = 0; j < getChildrenCount(parent); j++) {
+                    Object child = getChild(parent, j);
+                    if (child == pathComponent) {
+                        found = true;
+                        break;
+                    }
+                }
+                if (!found) {
+                    return false;
+                }
+                parent = pathComponent;
+            }
+        }
+        return true;
+    }
+
+    public void treeStructureChanged(TreeModelEvent e) {
+        revalidateSelectedTreePaths();
+    }
+
+    private void revalidateSelectedTreePaths() {
+        TreePath[] treePaths = getSelectionPaths();
+        if (treePaths != null) {
+            for (TreePath treePath : treePaths) {
+                if (treePath != null && !isTreePathValid(treePath)) {
+                    super.removeSelectionPath(treePath);
+                }
+            }
+        }
+    }
+}
\ No newline at end of file



View it on GitLab: https://salsa.debian.org/java-team/libjide-oss-java/commit/76a1cfff0ec4be767be88c9f92b1871ac5e94f24

-- 
View it on GitLab: https://salsa.debian.org/java-team/libjide-oss-java/commit/76a1cfff0ec4be767be88c9f92b1871ac5e94f24
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20190720/449a5c13/attachment.html>


More information about the pkg-java-commits mailing list