changeset 6515:7123e5a61cee

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/8u/master/jfx/rt
author kcr
date Wed, 19 Mar 2014 13:06:06 -0700
parents c9411d50a822 d1d4b24e037d
children 4dc1ba8b86ee
files modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleButton.java modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleCheckBox.java modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleControl.java modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleList.java modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleListItem.java modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleMenuButton.java modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleRadioButton.java modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleSlider.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/AccessibleBasePatternProvider.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/AccessibleBaseProvider.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/AccessibleLogger.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/AccessibleRoot.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/mac/MacAccessibleAttributes.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/mac/MacAccessibleBasePatternProvider.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/mac/MacAccessibleBaseProvider.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/mac/MacAccessibleEventIds.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/mac/MacAccessibleRoles.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/mac/MacAccessibleRoot.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/mac/MacAccessibleSelectionItemProvider.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/mac/MacAccessibleSelectionProvider.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/mac/MacAccessibleToggleProvider.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/win/WinAccessibleBasePatternProvider.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/win/WinAccessibleBaseProvider.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/win/WinAccessibleGridItemProvider.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/win/WinAccessibleGridProvider.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/win/WinAccessibleRangeValueProvider.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/win/WinAccessibleRoot.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/win/WinAccessibleSelectionItemProvider.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/win/WinAccessibleSelectionProvider.java modules/graphics/src/main/java/com/sun/glass/ui/accessible/win/WinAccessibleToggleProvider.java modules/graphics/src/main/java/com/sun/javafx/accessible/AccessibleNode.java modules/graphics/src/main/java/com/sun/javafx/accessible/AccessibleStage.java modules/graphics/src/main/java/com/sun/javafx/accessible/AccessibleText.java modules/graphics/src/main/java/com/sun/javafx/accessible/providers/Accessible.java modules/graphics/src/main/java/com/sun/javafx/accessible/providers/AccessibleProvider.java modules/graphics/src/main/java/com/sun/javafx/accessible/providers/AccessibleStageProvider.java modules/graphics/src/main/java/com/sun/javafx/accessible/providers/ExpandCollapseProvider.java modules/graphics/src/main/java/com/sun/javafx/accessible/providers/GridItemProvider.java modules/graphics/src/main/java/com/sun/javafx/accessible/providers/GridProvider.java modules/graphics/src/main/java/com/sun/javafx/accessible/providers/InvokeProvider.java modules/graphics/src/main/java/com/sun/javafx/accessible/providers/RangeValueProvider.java modules/graphics/src/main/java/com/sun/javafx/accessible/providers/SelectionItemProvider.java modules/graphics/src/main/java/com/sun/javafx/accessible/providers/SelectionProvider.java modules/graphics/src/main/java/com/sun/javafx/accessible/providers/ToggleProvider.java modules/graphics/src/main/java/com/sun/javafx/accessible/providers/ValueProvider.java modules/graphics/src/main/java/com/sun/javafx/accessible/utils/ControlTypeIds.java modules/graphics/src/main/java/com/sun/javafx/accessible/utils/EventIds.java modules/graphics/src/main/java/com/sun/javafx/accessible/utils/ExpandCollapseState.java modules/graphics/src/main/java/com/sun/javafx/accessible/utils/NavigateDirection.java modules/graphics/src/main/java/com/sun/javafx/accessible/utils/OrientationType.java modules/graphics/src/main/java/com/sun/javafx/accessible/utils/PatternIds.java modules/graphics/src/main/java/com/sun/javafx/accessible/utils/PropertyIds.java modules/graphics/src/main/java/com/sun/javafx/accessible/utils/ProviderOptions.java modules/graphics/src/main/java/com/sun/javafx/accessible/utils/Rect.java modules/graphics/src/main/java/com/sun/javafx/accessible/utils/ToggleState.java modules/graphics/src/main/native-glass/mac/GlassAccessibleBaseProvider.h modules/graphics/src/main/native-glass/mac/GlassAccessibleBaseProvider.m modules/graphics/src/main/native-glass/mac/GlassAccessibleRoot.h modules/graphics/src/main/native-glass/mac/GlassAccessibleRoot.m modules/graphics/src/main/native-glass/mac/GlassAccessibleSelectionItemProvider.h modules/graphics/src/main/native-glass/mac/GlassAccessibleSelectionItemProvider.m modules/graphics/src/main/native-glass/mac/GlassAccessibleSelectionProvider.h modules/graphics/src/main/native-glass/mac/GlassAccessibleSelectionProvider.m modules/graphics/src/main/native-glass/mac/GlassAccessibleToggleProvider.h modules/graphics/src/main/native-glass/mac/GlassAccessibleToggleProvider.m modules/graphics/src/main/native-glass/win/AccessibleBasePatternProvider.cpp modules/graphics/src/main/native-glass/win/AccessibleBasePatternProvider.h modules/graphics/src/main/native-glass/win/AccessibleBaseProvider.cpp modules/graphics/src/main/native-glass/win/AccessibleBaseProvider.h modules/graphics/src/main/native-glass/win/AccessibleGridItemProvider.cpp modules/graphics/src/main/native-glass/win/AccessibleGridItemProvider.h modules/graphics/src/main/native-glass/win/AccessibleGridProvider.cpp modules/graphics/src/main/native-glass/win/AccessibleGridProvider.h modules/graphics/src/main/native-glass/win/AccessibleRangeValueProvider.cpp modules/graphics/src/main/native-glass/win/AccessibleRangeValueProvider.h modules/graphics/src/main/native-glass/win/AccessibleRoot.cpp modules/graphics/src/main/native-glass/win/AccessibleRoot.h modules/graphics/src/main/native-glass/win/AccessibleSelectionItemProvider.cpp modules/graphics/src/main/native-glass/win/AccessibleSelectionItemProvider.h modules/graphics/src/main/native-glass/win/AccessibleSelectionProvider.cpp modules/graphics/src/main/native-glass/win/AccessibleSelectionProvider.h modules/graphics/src/main/native-glass/win/AccessibleToggleProvider.cpp modules/graphics/src/main/native-glass/win/AccessibleToggleProvider.h
diffstat 383 files changed, 18878 insertions(+), 14915 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/.ant-targets-build.xml	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,12 @@
+clean
+compile
+debug
+default
+jar
+javadoc
+profile
+profile-single
+run
+run-main
+test
+test-single
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/README.txt	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,51 @@
+WebTerminal implements a general-purpose interactive console:
+Users can type commands which get sent to a command handler,
+which evaluates the command, and displays the results, typically
+in some kind of type-script format.
+
+Applications of WebTerminal include:
++ A chat/talk window.
++ A read-eval-print-loop for an interactive scripting language.
++ A command console.
++ A terminal emulator.
+
+WebTerminal used as a terminal emulator recognizes a subset of the
+standard ANSI/xterm terminal escape sequences for repositioning the
+cursor, erasing previous text, changing style, etc.  A large enough
+subset is recognized that you can run programs like the emacs text
+editor, with styling.  This requires you specify the correct terminal
+type (TERM), which is done automatically by the PtyTerminal
+application.  A matching terminfo entry is provided, but it also
+should work ok to specify TERM to a standard terminal name, like
+eterm-color, vte, gnome, konsole, and xterm (all with color),
+or vt100 or vt220 (both non-color).
+
+The terminfo directory defines the escape sequences supported by the
+"jfxterm" terminal type, using a terminfo descriptor.  The terminal emulation
+is a subset of the standard xterm/ansi/vt100 ones.
+
+There is an escape sequence to send HTML to WebTerminal.
+This allows you to embed images, forms, and other HTML elements
+in the console output.
+
+The primary class is webterminal.WebTerminal, which is
+an abstract (overridable) control you embed in your scenegraph.
+
+The utility class webterminal.RunInConsole make it easy to
+run an old-fashioned console-based Java application in a WebTerminal.
+It re-binds System.in, System.out, and System.err to the WebTerminal.
+
+For example, the jrunscript tool is a wrapper around the class
+com.sun.tools.script.shell.Main in tools.jar.  So to start up
+a JavaScript read-elavl-print-tool, do:
+
+  $ ant run-main -Drunmain.classpath=$JAVA_HOME/lib/tools.jar \
+  -Drunmain.class="com.sun.tools.script.shell.Main" \
+  -Drunmain.args="-l javascript"
+
+The application webterminal.ShellConsole uses java.lang.Process
+to run a process inside a WebTerminal.  Currently, it is hard-wired to
+run /bin/bash.  (It does work under Cygwin if you edit the
+commandWithArgs field.)
+
+Other example applications are in the separate WebTerminalApps directory.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/build.xml	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<!-- By default, only the Clean and Build commands use this build script. -->
+<!-- Commands such as Run, Debug, and Test only use this build script if -->
+<!-- the Compile on Save feature is turned off for the project. -->
+<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
+<!-- in the project's Project Properties dialog box.-->
+<project name="WebTerminal" default="default" basedir=".">
+    <description>Builds, tests, and runs the project WebTerminal.</description>
+    <import file="nbproject/build-impl.xml"/>
+    <!--
+
+    There exist several targets which are by default empty and which can be 
+    used for execution of your tasks. These targets are usually executed 
+    before and after some main targets. They are: 
+
+      -pre-init:                 called before initialization of project properties
+      -post-init:                called after initialization of project properties
+      -pre-compile:              called before javac compilation
+      -post-compile:             called after javac compilation
+      -pre-compile-single:       called before javac compilation of single file
+      -post-compile-single:      called after javac compilation of single file
+      -pre-compile-test:         called before javac compilation of JUnit tests
+      -post-compile-test:        called after javac compilation of JUnit tests
+      -pre-compile-test-single:  called before javac compilation of single JUnit test
+      -post-compile-test-single: called after javac compilation of single JUunit test
+      -pre-jar:                  called before JAR building
+      -post-jar:                 called after JAR building
+      -post-clean:               called after cleaning build products
+
+    (Targets beginning with '-' are not intended to be called on their own.)
+
+    Example of inserting an obfuscator after compilation could look like this:
+
+        <target name="-post-compile">
+            <obfuscate>
+                <fileset dir="${build.classes.dir}"/>
+            </obfuscate>
+        </target>
+
+    For list of available properties check the imported 
+    nbproject/build-impl.xml file. 
+
+
+    Another way to customize the build is by overriding existing main targets.
+    The targets of interest are: 
+
+      -init-macrodef-javac:     defines macro for javac compilation
+      -init-macrodef-junit:     defines macro for junit execution
+      -init-macrodef-debug:     defines macro for class debugging
+      -init-macrodef-java:      defines macro for class execution
+      -do-jar-with-manifest:    JAR building (if you are using a manifest)
+      -do-jar-without-manifest: JAR building (if you are not using a manifest)
+      run:                      execution of project 
+      -javadoc-build:           Javadoc generation
+      test-report:              JUnit report generation
+
+    An example of overriding the target for project execution could look like this:
+
+        <target name="run" depends="WebTerminal-impl.jar">
+            <exec dir="bin" executable="launcher.exe">
+                <arg file="${dist.jar}"/>
+            </exec>
+        </target>
+
+    Notice that the overridden target depends on the jar target and not only on 
+    the compile target as the regular run target does. Again, for a list of available 
+    properties which you can use, check the target you are overriding in the
+    nbproject/build-impl.xml file. 
+
+    -->
+
+   <target depends="init,compile" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" description="Run a main class." name="run-main">
+     <!-- Run an application (i.e. a class with a "main" method in a
+     WebTerminal, redirecting System.in, System.out, and System.err.
+
+     Set -Drunmain.classpath=EXTRA_PATH to expand the classpath.
+     -->
+     <j2seproject1:java classname="webterminal.RunInConsole"
+                        classpath="${run.classpath}:${runmain.classpath}">
+       <customize>
+         <arg line="${runmain.class} ${runmain.args}"/>
+       </customize>
+     </j2seproject1:java>
+    </target>
+ 
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/manifest.mf	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/nbproject/build-impl.xml	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,1042 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+*** GENERATED FROM project.xml - DO NOT EDIT  ***
+***         EDIT ../build.xml INSTEAD         ***
+
+For the purpose of easier reading the script
+is divided into following sections:
+
+  - initialization
+  - compilation
+  - jar
+  - execution
+  - debugging
+  - javadoc
+  - junit compilation
+  - junit execution
+  - junit debugging
+  - applet
+  - cleanup
+
+        -->
+<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="WebTerminal-impl">
+    <fail message="Please build using Ant 1.8.0 or higher.">
+        <condition>
+            <not>
+                <antversion atleast="1.8.0"/>
+            </not>
+        </condition>
+    </fail>
+    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
+    <!-- 
+                ======================
+                INITIALIZATION SECTION 
+                ======================
+            -->
+    <target name="-pre-init">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="-pre-init" name="-init-private">
+        <property file="nbproject/private/config.properties"/>
+        <property file="nbproject/private/configs/${config}.properties"/>
+        <property file="nbproject/private/private.properties"/>
+    </target>
+    <target depends="-pre-init,-init-private" name="-init-user">
+        <property file="${user.properties.file}"/>
+        <!-- The two properties below are usually overridden -->
+        <!-- by the active platform. Just a fallback. -->
+        <property name="default.javac.source" value="1.4"/>
+        <property name="default.javac.target" value="1.4"/>
+    </target>
+    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
+        <property file="nbproject/configs/${config}.properties"/>
+        <property file="nbproject/project.properties"/>
+    </target>
+    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
+        <available file="${manifest.file}" property="manifest.available"/>
+        <condition property="splashscreen.available">
+            <and>
+                <not>
+                    <equals arg1="${application.splash}" arg2="" trim="true"/>
+                </not>
+                <available file="${application.splash}"/>
+            </and>
+        </condition>
+        <condition property="main.class.available">
+            <and>
+                <isset property="main.class"/>
+                <not>
+                    <equals arg1="${main.class}" arg2="" trim="true"/>
+                </not>
+            </and>
+        </condition>
+        <condition property="manifest.available+main.class">
+            <and>
+                <isset property="manifest.available"/>
+                <isset property="main.class.available"/>
+            </and>
+        </condition>
+        <condition property="do.archive">
+            <not>
+                <istrue value="${jar.archive.disabled}"/>
+            </not>
+        </condition>
+        <condition property="do.mkdist">
+            <and>
+                <isset property="do.archive"/>
+                <isset property="libs.CopyLibs.classpath"/>
+                <not>
+                    <istrue value="${mkdist.disabled}"/>
+                </not>
+            </and>
+        </condition>
+        <condition property="manifest.available+main.class+mkdist.available">
+            <and>
+                <istrue value="${manifest.available+main.class}"/>
+                <isset property="do.mkdist"/>
+            </and>
+        </condition>
+        <condition property="do.archive+manifest.available">
+            <and>
+                <isset property="manifest.available"/>
+                <istrue value="${do.archive}"/>
+            </and>
+        </condition>
+        <condition property="do.archive+main.class.available">
+            <and>
+                <isset property="main.class.available"/>
+                <istrue value="${do.archive}"/>
+            </and>
+        </condition>
+        <condition property="do.archive+splashscreen.available">
+            <and>
+                <isset property="splashscreen.available"/>
+                <istrue value="${do.archive}"/>
+            </and>
+        </condition>
+        <condition property="do.archive+manifest.available+main.class">
+            <and>
+                <istrue value="${manifest.available+main.class}"/>
+                <istrue value="${do.archive}"/>
+            </and>
+        </condition>
+        <condition property="manifest.available-mkdist.available">
+            <or>
+                <istrue value="${manifest.available}"/>
+                <isset property="do.mkdist"/>
+            </or>
+        </condition>
+        <condition property="manifest.available+main.class-mkdist.available">
+            <or>
+                <istrue value="${manifest.available+main.class}"/>
+                <isset property="do.mkdist"/>
+            </or>
+        </condition>
+        <condition property="have.tests">
+            <or/>
+        </condition>
+        <condition property="have.sources">
+            <or>
+                <available file="${src.dir}"/>
+            </or>
+        </condition>
+        <condition property="netbeans.home+have.tests">
+            <and>
+                <isset property="netbeans.home"/>
+                <isset property="have.tests"/>
+            </and>
+        </condition>
+        <condition property="no.javadoc.preview">
+            <and>
+                <isset property="javadoc.preview"/>
+                <isfalse value="${javadoc.preview}"/>
+            </and>
+        </condition>
+        <property name="run.jvmargs" value=""/>
+        <property name="javac.compilerargs" value=""/>
+        <property name="work.dir" value="${basedir}"/>
+        <condition property="no.deps">
+            <and>
+                <istrue value="${no.dependencies}"/>
+            </and>
+        </condition>
+        <property name="javac.debug" value="true"/>
+        <property name="javadoc.preview" value="true"/>
+        <property name="application.args" value=""/>
+        <property name="source.encoding" value="${file.encoding}"/>
+        <property name="runtime.encoding" value="${source.encoding}"/>
+        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
+            <and>
+                <isset property="javadoc.encoding"/>
+                <not>
+                    <equals arg1="${javadoc.encoding}" arg2=""/>
+                </not>
+            </and>
+        </condition>
+        <property name="javadoc.encoding.used" value="${source.encoding}"/>
+        <property name="includes" value="**"/>
+        <property name="excludes" value=""/>
+        <property name="do.depend" value="false"/>
+        <condition property="do.depend.true">
+            <istrue value="${do.depend}"/>
+        </condition>
+        <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
+        <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
+            <length length="0" string="${endorsed.classpath}" when="greater"/>
+        </condition>
+        <condition else="false" property="jdkBug6558476">
+            <and>
+                <matches pattern="1\.[56]" string="${java.specification.version}"/>
+                <not>
+                    <os family="unix"/>
+                </not>
+            </and>
+        </condition>
+        <property name="javac.fork" value="${jdkBug6558476}"/>
+        <property name="jar.index" value="false"/>
+        <property name="jar.index.metainf" value="${jar.index}"/>
+        <property name="copylibs.rebase" value="true"/>
+        <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
+    </target>
+    <target name="-post-init">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
+        <fail unless="src.dir">Must set src.dir</fail>
+        <fail unless="build.dir">Must set build.dir</fail>
+        <fail unless="dist.dir">Must set dist.dir</fail>
+        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
+        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
+        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
+        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
+        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
+        <fail unless="dist.jar">Must set dist.jar</fail>
+    </target>
+    <target name="-init-macrodef-property">
+        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute name="name"/>
+            <attribute name="value"/>
+            <sequential>
+                <property name="@{name}" value="${@{value}}"/>
+            </sequential>
+        </macrodef>
+    </target>
+    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
+        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${src.dir}" name="srcdir"/>
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <attribute default="${javac.classpath}" name="classpath"/>
+            <attribute default="${javac.processorpath}" name="processorpath"/>
+            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
+            <attribute default="${includes}" name="includes"/>
+            <attribute default="${excludes}" name="excludes"/>
+            <attribute default="${javac.debug}" name="debug"/>
+            <attribute default="${empty.dir}" name="sourcepath"/>
+            <attribute default="${empty.dir}" name="gensrcdir"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <property location="${build.dir}/empty" name="empty.dir"/>
+                <mkdir dir="${empty.dir}"/>
+                <mkdir dir="@{apgeneratedsrcdir}"/>
+                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
+                    <src>
+                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
+                            <include name="*"/>
+                        </dirset>
+                    </src>
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <compilerarg line="${javac.compilerargs}"/>
+                    <compilerarg value="-processorpath"/>
+                    <compilerarg path="@{processorpath}:${empty.dir}"/>
+                    <compilerarg line="${ap.processors.internal}"/>
+                    <compilerarg line="${annotation.processing.processor.options}"/>
+                    <compilerarg value="-s"/>
+                    <compilerarg path="@{apgeneratedsrcdir}"/>
+                    <compilerarg line="${ap.proc.none.internal}"/>
+                    <customize/>
+                </javac>
+            </sequential>
+        </macrodef>
+    </target>
+    <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
+        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${src.dir}" name="srcdir"/>
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <attribute default="${javac.classpath}" name="classpath"/>
+            <attribute default="${javac.processorpath}" name="processorpath"/>
+            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
+            <attribute default="${includes}" name="includes"/>
+            <attribute default="${excludes}" name="excludes"/>
+            <attribute default="${javac.debug}" name="debug"/>
+            <attribute default="${empty.dir}" name="sourcepath"/>
+            <attribute default="${empty.dir}" name="gensrcdir"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <property location="${build.dir}/empty" name="empty.dir"/>
+                <mkdir dir="${empty.dir}"/>
+                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
+                    <src>
+                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
+                            <include name="*"/>
+                        </dirset>
+                    </src>
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <compilerarg line="${javac.compilerargs}"/>
+                    <customize/>
+                </javac>
+            </sequential>
+        </macrodef>
+    </target>
+    <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
+        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${src.dir}" name="srcdir"/>
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <attribute default="${javac.classpath}" name="classpath"/>
+            <sequential>
+                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                </depend>
+            </sequential>
+        </macrodef>
+        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <sequential>
+                <fail unless="javac.includes">Must set javac.includes</fail>
+                <pathconvert pathsep="${line.separator}" property="javac.includes.binary">
+                    <path>
+                        <filelist dir="@{destdir}" files="${javac.includes}"/>
+                    </path>
+                    <globmapper from="*.java" to="*.class"/>
+                </pathconvert>
+                <tempfile deleteonexit="true" property="javac.includesfile.binary"/>
+                <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
+                <delete>
+                    <files includesfile="${javac.includesfile.binary}"/>
+                </delete>
+                <delete>
+                    <fileset file="${javac.includesfile.binary}"/>
+                </delete>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-macrodef-junit">
+        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${includes}" name="includes"/>
+            <attribute default="${excludes}" name="excludes"/>
+            <attribute default="**" name="testincludes"/>
+            <sequential>
+                <property name="junit.forkmode" value="perTest"/>
+                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
+                    <batchtest todir="${build.test.results.dir}"/>
+                    <classpath>
+                        <path path="${run.test.classpath}"/>
+                    </classpath>
+                    <syspropertyset>
+                        <propertyref prefix="test-sys-prop."/>
+                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
+                    </syspropertyset>
+                    <formatter type="brief" usefile="false"/>
+                    <formatter type="xml"/>
+                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <jvmarg value="-ea"/>
+                    <jvmarg line="${run.jvmargs}"/>
+                </junit>
+            </sequential>
+        </macrodef>
+    </target>
+    <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
+    <target name="-profile-pre-init">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target name="-profile-post-init">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target name="-profile-init-macrodef-profile">
+        <macrodef name="resolve">
+            <attribute name="name"/>
+            <attribute name="value"/>
+            <sequential>
+                <property name="@{name}" value="${env.@{value}}"/>
+            </sequential>
+        </macrodef>
+        <macrodef name="profile">
+            <attribute default="${main.class}" name="classname"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <property environment="env"/>
+                <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
+                <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}">
+                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <jvmarg value="${profiler.info.jvmargs.agent}"/>
+                    <jvmarg line="${profiler.info.jvmargs}"/>
+                    <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
+                    <arg line="${application.args}"/>
+                    <classpath>
+                        <path path="${run.classpath}"/>
+                    </classpath>
+                    <syspropertyset>
+                        <propertyref prefix="run-sys-prop."/>
+                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
+                    </syspropertyset>
+                    <customize/>
+                </java>
+            </sequential>
+        </macrodef>
+    </target>
+    <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
+        <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
+        <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
+    </target>
+    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
+        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute default="${main.class}" name="name"/>
+            <attribute default="${debug.classpath}" name="classpath"/>
+            <attribute default="" name="stopclassname"/>
+            <sequential>
+                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                </nbjpdastart>
+            </sequential>
+        </macrodef>
+        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute default="${build.classes.dir}" name="dir"/>
+            <sequential>
+                <nbjpdareload>
+                    <fileset dir="@{dir}" includes="${fix.classes}">
+                        <include name="${fix.includes}*.class"/>
+                    </fileset>
+                </nbjpdareload>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-debug-args">
+        <property name="version-output" value="java version &quot;${ant.java.version}"/>
+        <condition property="have-jdk-older-than-1.4">
+            <or>
+                <contains string="${version-output}" substring="java version &quot;1.0"/>
+                <contains string="${version-output}" substring="java version &quot;1.1"/>
+                <contains string="${version-output}" substring="java version &quot;1.2"/>
+                <contains string="${version-output}" substring="java version &quot;1.3"/>
+            </or>
+        </condition>
+        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
+            <istrue value="${have-jdk-older-than-1.4}"/>
+        </condition>
+        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
+            <os family="windows"/>
+        </condition>
+        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
+            <isset property="debug.transport"/>
+        </condition>
+    </target>
+    <target depends="-init-debug-args" name="-init-macrodef-debug">
+        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${main.class}" name="classname"/>
+            <attribute default="${debug.classpath}" name="classpath"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <java classname="@{classname}" dir="${work.dir}" fork="true">
+                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <jvmarg line="${debug-args-line}"/>
+                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
+                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
+                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
+                    <jvmarg line="${run.jvmargs}"/>
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <syspropertyset>
+                        <propertyref prefix="run-sys-prop."/>
+                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
+                    </syspropertyset>
+                    <customize/>
+                </java>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-macrodef-java">
+        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute default="${main.class}" name="classname"/>
+            <attribute default="${run.classpath}" name="classpath"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <java classname="@{classname}" dir="${work.dir}" fork="true">
+                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
+                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
+                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
+                    <jvmarg line="${run.jvmargs}"/>
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <syspropertyset>
+                        <propertyref prefix="run-sys-prop."/>
+                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
+                    </syspropertyset>
+                    <customize/>
+                </java>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-macrodef-copylibs">
+        <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${manifest.file}" name="manifest"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
+                <pathconvert property="run.classpath.without.build.classes.dir">
+                    <path path="${run.classpath}"/>
+                    <map from="${build.classes.dir.resolved}" to=""/>
+                </pathconvert>
+                <pathconvert pathsep=" " property="jar.classpath">
+                    <path path="${run.classpath.without.build.classes.dir}"/>
+                    <chainedmapper>
+                        <flattenmapper/>
+                        <globmapper from="*" to="lib/*"/>
+                    </chainedmapper>
+                </pathconvert>
+                <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
+                <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
+                    <fileset dir="${build.classes.dir}"/>
+                    <manifest>
+                        <attribute name="Class-Path" value="${jar.classpath}"/>
+                        <customize/>
+                    </manifest>
+                </copylibs>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-presetdef-jar">
+        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}">
+                <j2seproject1:fileset dir="${build.classes.dir}"/>
+            </jar>
+        </presetdef>
+    </target>
+    <target name="-init-ap-cmdline-properties">
+        <property name="annotation.processing.enabled" value="true"/>
+        <property name="annotation.processing.processors.list" value=""/>
+        <property name="annotation.processing.processor.options" value=""/>
+        <property name="annotation.processing.run.all.processors" value="true"/>
+        <property name="javac.processorpath" value="${javac.classpath}"/>
+        <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
+        <condition property="ap.supported.internal" value="true">
+            <not>
+                <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
+            </not>
+        </condition>
+    </target>
+    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
+        <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
+            <isfalse value="${annotation.processing.run.all.processors}"/>
+        </condition>
+        <condition else="" property="ap.proc.none.internal" value="-proc:none">
+            <isfalse value="${annotation.processing.enabled}"/>
+        </condition>
+    </target>
+    <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
+        <property name="ap.cmd.line.internal" value=""/>
+    </target>
+    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
+    <!--
+                ===================
+                COMPILATION SECTION
+                ===================
+            -->
+    <target name="-deps-jar-init" unless="built-jar.properties">
+        <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
+        <delete file="${built-jar.properties}" quiet="true"/>
+    </target>
+    <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
+        <echo level="warn" message="Cycle detected: WebTerminal was already built"/>
+    </target>
+    <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
+        <mkdir dir="${build.dir}"/>
+        <touch file="${built-jar.properties}" verbose="false"/>
+        <property file="${built-jar.properties}" prefix="already.built.jar."/>
+        <antcall target="-warn-already-built-jar"/>
+        <propertyfile file="${built-jar.properties}">
+            <entry key="${basedir}" value=""/>
+        </propertyfile>
+    </target>
+    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
+    <target depends="init" name="-check-automatic-build">
+        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
+    </target>
+    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
+        <antcall target="clean"/>
+    </target>
+    <target depends="init,deps-jar" name="-pre-pre-compile">
+        <mkdir dir="${build.classes.dir}"/>
+    </target>
+    <target name="-pre-compile">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target if="do.depend.true" name="-compile-depend">
+        <pathconvert property="build.generated.subdirs">
+            <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
+                <include name="*"/>
+            </dirset>
+        </pathconvert>
+        <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
+    </target>
+    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
+        <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
+        <copy todir="${build.classes.dir}">
+            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+        </copy>
+    </target>
+    <target if="has.persistence.xml" name="-copy-persistence-xml">
+        <mkdir dir="${build.classes.dir}/META-INF"/>
+        <copy todir="${build.classes.dir}/META-INF">
+            <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
+        </copy>
+    </target>
+    <target name="-post-compile">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
+    <target name="-pre-compile-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
+        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
+        <j2seproject3:force-recompile/>
+        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
+    </target>
+    <target name="-post-compile-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
+    <!--
+                ====================
+                JAR BUILDING SECTION
+                ====================
+            -->
+    <target depends="init" name="-pre-pre-jar">
+        <dirname file="${dist.jar}" property="dist.jar.dir"/>
+        <mkdir dir="${dist.jar.dir}"/>
+    </target>
+    <target name="-pre-jar">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
+        <j2seproject1:jar/>
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
+        <j2seproject1:jar manifest="${manifest.file}"/>
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
+        <j2seproject1:jar manifest="${manifest.file}">
+            <j2seproject1:manifest>
+                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
+            </j2seproject1:manifest>
+        </j2seproject1:jar>
+        <echo level="info">To run this application from the command line without Ant, try:</echo>
+        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
+        <property location="${dist.jar}" name="dist.jar.resolved"/>
+        <pathconvert property="run.classpath.with.dist.jar">
+            <path path="${run.classpath}"/>
+            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
+        </pathconvert>
+        <echo level="info">java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
+    </target>
+    <target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available">
+        <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
+        <touch file="${tmp.manifest.file}" verbose="false"/>
+    </target>
+    <target depends="init" if="do.archive+manifest.available" name="-do-jar-with-libraries-copy-manifest">
+        <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
+        <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/>
+    </target>
+    <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+main.class.available" name="-do-jar-with-libraries-set-main">
+        <manifest file="${tmp.manifest.file}" mode="update">
+            <attribute name="Main-Class" value="${main.class}"/>
+        </manifest>
+    </target>
+    <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-with-libraries-set-splashscreen">
+        <basename file="${application.splash}" property="splashscreen.basename"/>
+        <mkdir dir="${build.classes.dir}/META-INF"/>
+        <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
+        <manifest file="${tmp.manifest.file}" mode="update">
+            <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
+        </manifest>
+    </target>
+    <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen" if="do.mkdist" name="-do-jar-with-libraries-pack">
+        <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
+        <echo level="info">To run this application from the command line without Ant, try:</echo>
+        <property location="${dist.jar}" name="dist.jar.resolved"/>
+        <echo level="info">java -jar "${dist.jar.resolved}"</echo>
+    </target>
+    <target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest">
+        <delete>
+            <fileset file="${tmp.manifest.file}"/>
+        </delete>
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen,-do-jar-with-libraries-pack,-do-jar-with-libraries-delete-manifest" name="-do-jar-with-libraries"/>
+    <target name="-post-jar">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
+    <!--
+                =================
+                EXECUTION SECTION
+                =================
+            -->
+    <target depends="init,compile" description="Run a main class." name="run">
+        <j2seproject1:java>
+            <customize>
+                <arg line="${application.args}"/>
+            </customize>
+        </j2seproject1:java>
+    </target>
+    <target name="-do-not-recompile">
+        <property name="javac.includes.binary" value=""/>
+    </target>
+    <target depends="init,compile-single" name="run-single">
+        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+        <j2seproject1:java classname="${run.class}"/>
+    </target>
+    <target depends="init,compile-test-single" name="run-test-with-main">
+        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+        <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
+    </target>
+    <!--
+                =================
+                DEBUGGING SECTION
+                =================
+            -->
+    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
+        <j2seproject1:nbjpdastart name="${debug.class}"/>
+    </target>
+    <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
+        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
+    </target>
+    <target depends="init,compile" name="-debug-start-debuggee">
+        <j2seproject3:debug>
+            <customize>
+                <arg line="${application.args}"/>
+            </customize>
+        </j2seproject3:debug>
+    </target>
+    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
+    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
+        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
+    </target>
+    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
+    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
+        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
+        <j2seproject3:debug classname="${debug.class}"/>
+    </target>
+    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
+    <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
+        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
+        <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
+    </target>
+    <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
+    <target depends="init" name="-pre-debug-fix">
+        <fail unless="fix.includes">Must set fix.includes</fail>
+        <property name="javac.includes" value="${fix.includes}.java"/>
+    </target>
+    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
+        <j2seproject1:nbjpdareload/>
+    </target>
+    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
+    <!--
+                =================
+                PROFILING SECTION
+                =================
+            -->
+    <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
+        <nbprofiledirect>
+            <classpath>
+                <path path="${run.classpath}"/>
+            </classpath>
+        </nbprofiledirect>
+        <profile/>
+    </target>
+    <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
+        <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
+        <nbprofiledirect>
+            <classpath>
+                <path path="${run.classpath}"/>
+            </classpath>
+        </nbprofiledirect>
+        <profile classname="${profile.class}"/>
+    </target>
+    <!--
+                =========================
+                APPLET PROFILING  SECTION
+                =========================
+            -->
+    <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
+        <nbprofiledirect>
+            <classpath>
+                <path path="${run.classpath}"/>
+            </classpath>
+        </nbprofiledirect>
+        <profile classname="sun.applet.AppletViewer">
+            <customize>
+                <arg value="${applet.url}"/>
+            </customize>
+        </profile>
+    </target>
+    <!--
+                =========================
+                TESTS PROFILING  SECTION
+                =========================
+            -->
+    <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
+        <nbprofiledirect>
+            <classpath>
+                <path path="${run.test.classpath}"/>
+            </classpath>
+        </nbprofiledirect>
+        <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
+            <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
+            <jvmarg value="${profiler.info.jvmargs.agent}"/>
+            <jvmarg line="${profiler.info.jvmargs}"/>
+            <test name="${profile.class}"/>
+            <classpath>
+                <path path="${run.test.classpath}"/>
+            </classpath>
+            <syspropertyset>
+                <propertyref prefix="test-sys-prop."/>
+                <mapper from="test-sys-prop.*" to="*" type="glob"/>
+            </syspropertyset>
+            <formatter type="brief" usefile="false"/>
+            <formatter type="xml"/>
+        </junit>
+    </target>
+    <!--
+                ===============
+                JAVADOC SECTION
+                ===============
+            -->
+    <target depends="init" if="have.sources" name="-javadoc-build">
+        <mkdir dir="${dist.javadoc.dir}"/>
+        <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}">
+            <and>
+                <isset property="endorsed.classpath.cmd.line.arg"/>
+                <not>
+                    <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/>
+                </not>
+            </and>
+        </condition>
+        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
+            <classpath>
+                <path path="${javac.classpath}"/>
+            </classpath>
+            <fileset dir="${src.dir}" excludes="*.java,${excludes}" includes="${includes}">
+                <filename name="**/*.java"/>
+            </fileset>
+            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
+                <include name="**/*.java"/>
+                <exclude name="*.java"/>
+            </fileset>
+            <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
+        </javadoc>
+        <copy todir="${dist.javadoc.dir}">
+            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
+                <filename name="**/doc-files/**"/>
+            </fileset>
+            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
+                <include name="**/doc-files/**"/>
+            </fileset>
+        </copy>
+    </target>
+    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
+        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
+    </target>
+    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
+    <!--
+                =========================
+                JUNIT COMPILATION SECTION
+                =========================
+            -->
+    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
+        <mkdir dir="${build.test.classes.dir}"/>
+    </target>
+    <target name="-pre-compile-test">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target if="do.depend.true" name="-compile-test-depend">
+        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir=""/>
+    </target>
+    <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
+        <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir=""/>
+        <copy todir="${build.test.classes.dir}"/>
+    </target>
+    <target name="-post-compile-test">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
+    <target name="-pre-compile-test-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
+        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
+        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
+        <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="" srcdir=""/>
+        <copy todir="${build.test.classes.dir}"/>
+    </target>
+    <target name="-post-compile-test-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
+    <!--
+                =======================
+                JUNIT EXECUTION SECTION
+                =======================
+            -->
+    <target depends="init" if="have.tests" name="-pre-test-run">
+        <mkdir dir="${build.test.results.dir}"/>
+    </target>
+    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
+        <j2seproject3:junit testincludes="**/*Test.java"/>
+    </target>
+    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
+        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
+    </target>
+    <target depends="init" if="have.tests" name="test-report"/>
+    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
+    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
+    <target depends="init" if="have.tests" name="-pre-test-run-single">
+        <mkdir dir="${build.test.results.dir}"/>
+    </target>
+    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
+        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
+        <j2seproject3:junit excludes="" includes="${test.includes}"/>
+    </target>
+    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
+        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
+    </target>
+    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
+    <!--
+                =======================
+                JUNIT DEBUGGING SECTION
+                =======================
+            -->
+    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
+        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
+        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
+        <delete file="${test.report.file}"/>
+        <mkdir dir="${build.test.results.dir}"/>
+        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
+            <customize>
+                <syspropertyset>
+                    <propertyref prefix="test-sys-prop."/>
+                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
+                </syspropertyset>
+                <arg value="${test.class}"/>
+                <arg value="showoutput=true"/>
+                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
+                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
+            </customize>
+        </j2seproject3:debug>
+    </target>
+    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
+        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
+    </target>
+    <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
+    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
+        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
+    </target>
+    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
+    <!--
+                =========================
+                APPLET EXECUTION SECTION
+                =========================
+            -->
+    <target depends="init,compile-single" name="run-applet">
+        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
+        <j2seproject1:java classname="sun.applet.AppletViewer">
+            <customize>
+                <arg value="${applet.url}"/>
+            </customize>
+        </j2seproject1:java>
+    </target>
+    <!--
+                =========================
+                APPLET DEBUGGING  SECTION
+                =========================
+            -->
+    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
+        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
+        <j2seproject3:debug classname="sun.applet.AppletViewer">
+            <customize>
+                <arg value="${applet.url}"/>
+            </customize>
+        </j2seproject3:debug>
+    </target>
+    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
+    <!--
+                ===============
+                CLEANUP SECTION
+                ===============
+            -->
+    <target name="-deps-clean-init" unless="built-clean.properties">
+        <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
+        <delete file="${built-clean.properties}" quiet="true"/>
+    </target>
+    <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
+        <echo level="warn" message="Cycle detected: WebTerminal was already built"/>
+    </target>
+    <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
+        <mkdir dir="${build.dir}"/>
+        <touch file="${built-clean.properties}" verbose="false"/>
+        <property file="${built-clean.properties}" prefix="already.built.clean."/>
+        <antcall target="-warn-already-built-clean"/>
+        <propertyfile file="${built-clean.properties}">
+            <entry key="${basedir}" value=""/>
+        </propertyfile>
+    </target>
+    <target depends="init" name="-do-clean">
+        <delete dir="${build.dir}"/>
+        <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
+    </target>
+    <target name="-post-clean">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
+    <target name="-check-call-dep">
+        <property file="${call.built.properties}" prefix="already.built."/>
+        <condition property="should.call.dep">
+            <not>
+                <isset property="already.built.${call.subproject}"/>
+            </not>
+        </condition>
+    </target>
+    <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
+        <ant antfile="${call.script}" inheritall="false" target="${call.target}">
+            <propertyset>
+                <propertyref prefix="transfer."/>
+                <mapper from="transfer.*" to="*" type="glob"/>
+            </propertyset>
+        </ant>
+    </target>
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/nbproject/genfiles.properties	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=e5603d91
+build.xml.script.CRC32=3684b868
+build.xml.stylesheet.CRC32=28e38971@1.48.0.46
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=e5603d91
+nbproject/build-impl.xml.script.CRC32=00e97611
+nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.48.0.46
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/nbproject/project.properties	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,73 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.processor.options=
+annotation.processing.processors.list=
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+    ${run.classpath}
+debug.test.classpath=\
+    ${run.test.classpath}
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/WebTerminal.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+excludes=
+file.reference.jfxrt.jar=../../../../artifacts/sdk/rt/lib/ext/jfxrt.jar
+file.reference.Library-src=src
+includes=**
+jar.compress=false
+javac.classpath=\
+    ${file.reference.jfxrt.jar}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.processorpath=\
+    ${javac.classpath}
+javac.source=1.6
+javac.target=1.6
+javac.test.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}
+javac.test.processorpath=\
+    ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+main.class=webterminal.ShellConsole
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=false
+platform.active=default_platform
+run.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project
+# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
+# or test-sys-prop.name=value to set system properties for unit tests):
+run.jvmargs=
+run.test.classpath=\
+    ${javac.test.classpath}:\
+    ${build.test.classes.dir}
+source.encoding=UTF-8
+src.dir=${file.reference.Library-src}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/nbproject/project.xml	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.java.j2seproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
+            <name>WebTerminal</name>
+            <source-roots>
+                <root id="src.dir"/>
+            </source-roots>
+            <test-roots/>
+        </data>
+    </configuration>
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/src/webterminal/NodeWriter.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2011, 2014 Oracle and/or its affiliates.
+ * All rights reserved. Use is subject to license terms.
+ *
+ * This file is available and licensed under the following license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  - Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the distribution.
+ *  - Neither the name of Oracle Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package webterminal;
+
+import org.w3c.dom.*;
+import java.io.*;
+
+/** Write out a Node in XML text format.
+ * Currently only used for debugging.
+ */
+
+public class NodeWriter {
+    Writer out;
+    public boolean asciiOnly = true;
+
+    public NodeWriter(Writer out) {
+        this.out = out;
+    }
+
+    public static void writeNode (Node node, Writer out) throws IOException {
+        new NodeWriter(out).writeNode(node);
+    }
+
+    public static String writeNodeToString(Node node) {
+        try {
+            StringWriter wr = new StringWriter();
+            new NodeWriter(wr).writeNode(node);
+            return wr.toString();
+        }
+        catch (Throwable ex) {
+            return "writeNodeToString threw "+ex;
+            }
+    }
+    
+    void writeNodeName(Node node) throws IOException {
+        out.write(node.getNodeName());
+    }
+
+    /** Control abbreviation of repeated characters in text.
+        If there are more than this many identical characters
+        in a row, abbreviate.  If 0, don't abbreviate.  */
+    int abbrevRepeatedMinimum = 3;
+
+    void writeData(String data, boolean attribute) throws IOException {
+        int start = 0;
+        int end = data.length();
+        for (int i = 0; i < end;  i++) {
+            char ch = data.charAt(i);
+            String ent = null;
+            int count = 1;
+            if (abbrevRepeatedMinimum > 0) {
+                while (i+count < end && data.charAt(i+count)==ch)
+                    count++;
+            }
+            if (ch == '&')
+                ent = "&amp;";
+            else if (attribute && ch == '\"')
+                ent = "&quot;";
+            else if (! attribute && ch == '<')
+                ent = "&lt;";
+            else if (! attribute && ch == '>')
+                ent = "&gt;";
+            else if (ch < ' ' || (asciiOnly && ch >= 127))
+                ent = "&#x"+Integer.toHexString(ch)+';';
+            if (ent != null) {
+                if (i > start)
+                    out.write(data, start, i-start);
+                start = i+1;
+                out.write(ent);
+            } else if (count >= abbrevRepeatedMinimum) {
+                out.write(data, start, i-start+1);
+                start = i+1;
+            }
+            if (count >= abbrevRepeatedMinimum) {
+                out.write("\\[*"+count+']');
+                i += count-1;
+                start = i+1;
+            }
+        }
+        if (end > start)
+            out.write(data, start, end-start);
+    }
+
+    public void writeNode (Node node) throws IOException {
+        switch (node.getNodeType()) {
+        case Node.DOCUMENT_NODE:
+        case Node.DOCUMENT_FRAGMENT_NODE:
+            writeNodeChildren(node);
+            break;
+
+        case Node.ELEMENT_NODE:
+            Element el = (Element) node;
+            out.write('<');
+            writeNodeName(node);
+            out.write("@"+Integer.toHexString(System.identityHashCode(el)));
+            NamedNodeMap attrs = el.getAttributes();
+            int nattrs = attrs.getLength();
+            for (int i = 0;  i < nattrs;  i++) {
+                writeNode(attrs.item(i));
+            }
+            if (node.getFirstChild() == null)
+                out.write("/>");
+            else {
+                out.write('>');
+                writeNodeChildren(node);
+                out.write("</");
+                writeNodeName(node);
+                out.write('>');
+            }
+            break;
+
+        case Node.ATTRIBUTE_NODE:
+            Attr at = (Attr) node;
+            out.write(' ');
+            writeNodeName(node);
+            out.write('=');
+            out.write('"');
+            writeData(at.getValue(), true);
+            out.write('"');
+            break;
+        
+        case Node.TEXT_NODE:
+            writeData(((Text) node).getData(), false);
+            break;
+
+        case Node.CDATA_SECTION_NODE:
+            writeData(node.getNodeValue(), false);
+            break;
+       
+        case Node.DOCUMENT_TYPE_NODE:
+        default:
+            ;
+        }
+    }
+
+    public void writeNodeChildren (Node node) throws IOException {
+        for (Node ch = node.getFirstChild(); ch != null;
+             ch = ch.getNextSibling()) {
+            writeNode(ch);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/src/webterminal/RunInConsole.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2011, 2014 Oracle and/or its affiliates.
+ * All rights reserved. Use is subject to license terms.
+ *
+ * This file is available and licensed under the following license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  - Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the distribution.
+ *  - Neither the name of Oracle Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package webterminal;
+import java.io.*;
+import java.lang.reflect.Method;
+import javafx.application.Application;
+import javafx.scene.layout.*;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+import javafx.scene.input.KeyEvent;
+
+/** Run a console-based Java application in a WebTerminal.
+ * Usage: java webterminal.RunInConsole [options] class.name class-args...
+ * This re-binds System.in, System.out, and System.err to a WebTerminal
+ * instance, and then invokes the main method of class.name, passing
+ * it the class-args, roughly as if you'd called:
+ * java class.name class-args...
+ * (Right now no 'options' are supported, but some may be added.)
+ */
+
+public class RunInConsole extends Application {
+
+    WebTerminal console;
+    PipedOutputStream inputSink;
+    Writer inputWriter;
+
+    Scene createScene() {
+        console = new WebTerminal() {
+                protected void enter (KeyEvent ke) {
+                    String text = console.handleEnter(ke);
+                    if (inputWriter != null) {
+                        synchronized (inputWriter) {
+                            try {
+                                inputWriter.write(text);
+                                inputWriter.write("\r\n");
+                                inputWriter.flush();
+                                //pin.notifyAll();
+                            }
+                            catch (Throwable ex) {
+                                ex.printStackTrace();
+                                System.exit(-1);
+                            }
+                        }
+                    }
+                }
+            };
+        //VBox.setVgrow(console.webView, Priority.ALWAYS);
+
+        VBox pane = console;
+        Scene scene = new Scene(pane);
+        // Make a bottom gray bar to free the resize corner on Mac
+        //scene.setFill(Color.GRAY);
+        return scene;
+    }
+
+    String[] restArgs;
+    Method mainMethod;
+    String className;
+
+    void getMainMethod() throws Throwable {
+        java.util.List<String> args = getParameters().getRaw();
+        int nargs = args.size();
+        className = args.get(0);
+        restArgs = new String[nargs-1];
+        args.subList(1, nargs).toArray(restArgs);
+        Class clas = Class.forName(className, false, RunInConsole.class.getClassLoader());
+        mainMethod = clas.getDeclaredMethod("main", String[].class);
+    }
+
+    @Override public void start(Stage stage) {
+        final Scene scene = createScene();
+        inputSink = new PipedOutputStream();
+        try {
+            getMainMethod();
+            inputWriter = new OutputStreamWriter(inputSink);
+            System.setIn(new PipedInputStream(inputSink));
+        }
+        catch (java.lang.ClassNotFoundException ex) {
+            System.err.println("can't find class "+className);
+            System.exit(-1);
+        }
+        catch (Throwable ex) {
+            WTDebug.println("caught "+ex);
+            System.exit(-1);
+        }
+        //WebTerminal.origErr = System.err;
+
+        stage.setTitle("Jfx-Shell");
+
+        stage.setScene(scene);
+        //stage.sizeToScene();
+        stage.setWidth(900);
+        stage.setHeight(700);
+        stage.show();
+
+        OutputStream wout = new WebOutputStream(new WebWriter(console, 'O'));
+        OutputStream werr = new WebOutputStream(new WebWriter(console, 'E'));
+        System.setOut(new PrintStream(new BufferedOutputStream(wout, 128), true));
+        System.setErr(new PrintStream(new BufferedOutputStream(werr, 128), true));
+        (new Thread() {
+                public void run() {
+                    try {
+                        mainMethod.invoke(null, new Object[] { restArgs });
+                    } catch (Throwable ex) {
+                        WTDebug.println("caught while executing main "+ex);
+                    }
+                }}).start();
+    }
+
+    public static void main(String[] args) {
+        WTDebug.init();
+        Application.launch(args);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/src/webterminal/ShellConsole.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2011, 2014 Oracle and/or its affiliates.
+ * All rights reserved. Use is subject to license terms.
+ *
+ * This file is available and licensed under the following license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  - Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the distribution.
+ *  - Neither the name of Oracle Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package webterminal;
+import javafx.scene.Node;
+import javafx.scene.Scene;
+import javafx.scene.layout.*;
+import javafx.application.Application;
+import javafx.application.Platform;
+import javafx.scene.input.KeyEvent;
+import javafx.scene.web.*;
+import javafx.stage.Stage;
+import java.io.*;
+import java.util.List;
+
+/** Application to run a Process in a WebTerminal window.
+ * The Process is run with standard input, output, and error streams
+ * bound to an interactive WebTerminal window.
+ * The WebTerminal window is bare, with no menubar or other "chrome".
+ * (That should probably change, at least when running as an Application.)
+ *
+ * Usage:
+ * <pre>
+ * java webterminal.ShellConsole [options] [command]
+ * </pre>
+ * So far no {@code [options]} are supported.
+ * The {@code [command]} is the arguments to the Process.
+ * The default for [command] is "bash" "--noediting" "-i".
+ */
+
+public class ShellConsole extends Application
+{
+    WebTerminal replNode;
+
+    Process process;
+
+    Scene createScene() {
+        replNode = new WebTerminal() {
+                protected void enter (KeyEvent ke) {
+                    String text = replNode.handleEnter(ke);
+                    if (pin != null) {
+                        synchronized (pin) {
+                            try {
+                                pin.write(text);
+                                pin.write("\n");
+                                pin.flush();
+                                //pin.notifyAll();
+                            }
+                            catch (Throwable ex) {
+                                ex.printStackTrace();
+                                System.exit(-1);
+                            }
+                        }
+                    }
+                }
+            };
+        VBox.setVgrow(replNode.webView, Priority.ALWAYS);
+
+        VBox pane = replNode;
+        Scene scene = new Scene(pane);
+        // Make a bottom gray bar to free the resize corner on Mac
+        //scene.setFill(Color.GRAY);
+        return scene;
+    }
+
+    Writer pin;
+    Reader pout;
+    Reader perr;
+
+    public static String[] defaultCommandWithArgs
+        = {"bash", "--noediting", "-i" };
+
+    @Override public void start(Stage stage) {
+        try {
+            List<String> args = getParameters().getRaw();
+            int argsSize = args.size();
+            String[] commandWithArgs = argsSize == 0 ? defaultCommandWithArgs
+                : args.toArray(new String[argsSize]);
+            ProcessBuilder pbuilder = new ProcessBuilder(commandWithArgs);
+            pbuilder.redirectErrorStream(true);
+            process = pbuilder.start();
+            pin = new OutputStreamWriter(process.getOutputStream());
+            pout = new InputStreamReader(process.getInputStream());
+            perr = new InputStreamReader(process.getErrorStream());
+        } catch (Throwable ex) {
+            ex.printStackTrace();
+            System.exit(-1);
+        }
+        final Scene scene = createScene();
+        stage.setTitle("Jfx-Shell");
+
+        stage.setScene(scene);
+        stage.setWidth(900);
+        stage.setHeight(700);
+        stage.show();
+
+        initialize0(); // ???
+    }
+
+    public static void main(String[] args) {
+        Application.launch(args);
+    }
+
+    private void copyThread(final Reader fromInferior, final WebWriter toPane) {
+        Thread th = new Thread() {
+                char[] buffer = new char[1024];
+                public void run () {
+                    for (;;) {
+                        try {
+                            int count = fromInferior.read(buffer);
+                            if (count < 0)
+                                break;
+                            toPane.write(buffer, 0, count);
+                        } catch (Throwable ex) {
+                            ex.printStackTrace();
+                            System.exit(-1);
+                        }
+                    }
+                }
+            }; 
+        th.start();
+    }
+
+    WebWriter out_stream;
+    WebWriter err_stream;
+    public void initialize0 () {
+        out_stream = new WebWriter(this.replNode, 'O');
+        err_stream = new WebWriter(this.replNode, 'E');
+        copyThread(pout, out_stream);
+        copyThread(perr, err_stream);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/src/webterminal/WTDebug.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2011, 2014 Oracle and/or its affiliates.
+ * All rights reserved. Use is subject to license terms.
+ *
+ * This file is available and licensed under the following license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  - Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the distribution.
+ *  - Neither the name of Oracle Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package webterminal;
+import java.io.*;
+import org.w3c.dom.*;
+
+/** Some debugging utilities. */
+
+public class WTDebug {
+static 
+    PrintStream origErr;
+    public static void init() {
+        if (origErr == null)
+            origErr = System.err;
+    }
+
+    static {
+        init();
+    }
+
+    public static void print(Object obj) {
+        origErr.print(""+obj);
+    }
+
+    public static void println(Object obj) {
+        origErr.println(""+obj);
+    }
+
+    public static String pnode(org.w3c.dom.Node n) {
+
+        if (n == null) return "(null)";
+        if (n instanceof CharacterData)
+            return n.toString()+'\"'+toQuoted(((CharacterData)n).getData())+'\"'+"@"+Integer.toHexString(System.identityHashCode(n));
+        return n+"/"+n.getNodeName()+"@"+Integer.toHexString(System.identityHashCode(n));
+    }
+
+    public static String toQuoted(String str) {
+        int len = str.length();
+        StringBuilder buf = new StringBuilder();
+        for (int i = 0;  i < len;  i++) {
+            char ch = str.charAt(i);
+            if (ch == '\n')
+                buf.append("\\n");
+            else if (ch == '\r')
+                buf.append("\\r");
+            else if (ch == '\t')
+                buf.append("\\t");
+            else if (ch == '\033')
+                buf.append("\\E");
+            else if (ch < ' ' || ch >= 127)
+                buf.append("\\"+(char)(((ch>>6)&7)+'0')+(char)(((ch>>3)&7)+'0')+(char)((ch&7)+'0'));
+            else {
+                if (ch == '\"' || ch == '\'')
+                    buf.append('\\');
+                buf.append(ch);
+            }
+        }
+        return buf.toString();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/src/webterminal/WebOutputStream.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2011, 2014 Oracle and/or its affiliates.
+ * All rights reserved. Use is subject to license terms.
+ *
+ * This file is available and licensed under the following license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  - Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the distribution.
+ *  - Neither the name of Oracle Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package webterminal;
+import java.io.*;
+
+/** A Simple OutputStream that decodes UTF-8 to a WebWriter.
+ */
+
+public class WebOutputStream extends OutputStream {
+    WebWriter out;
+    int partialChar;
+    int bytesNeeded = 0;
+
+    public WebOutputStream(WebWriter out) { this.out = out;}
+
+    public void write(int b) {
+        if (b >= 0) {
+            partialChar = b;
+            bytesNeeded = 0;
+        }
+        else if ((b & 0xC0) == 0x40) { // continuation byte
+            partialChar = (partialChar << 6) | (b & 0x3F);
+            bytesNeeded--;
+        }
+        else if ((b & 0xE0) == 0xC0) { // 1st of 2
+            partialChar = b & 0x1F;
+            bytesNeeded = 1;
+        }
+        else if ((b & 0xF0) == 0xE0) { // 1st of 3
+            partialChar = b & 0xF;
+            bytesNeeded = 2;
+        }
+        else if ((b & 0xF8) == 0xF0) { // 1st of 4
+            partialChar = b & 0x7;
+            bytesNeeded = 3;
+        }
+        else if ((b & 0xFC0) == 0xF8) { // 1st of 5
+            partialChar = b & 0x3;
+            bytesNeeded = 4;
+        }
+        if (bytesNeeded == 0) {
+            int ch = partialChar;
+            if (ch > 0x10000) {
+                out.write((char) (((ch - 0x10000) >> 10) + 0xD800));
+                ch = ((ch & 0x3FF) + 0xDC00);
+            }
+            out.write((char) ch);
+        }
+    }
+    public void flush() { out.flush(); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/src/webterminal/WebTerminal.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,1787 @@
+/*
+ * Copyright (c) 2011, 2014 Oracle and/or its affiliates.
+ * All rights reserved. Use is subject to license terms.
+ *
+ * This file is available and licensed under the following license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  - Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the distribution.
+ *  - Neither the name of Oracle Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package webterminal;
+
+import javafx.scene.web.*;
+import org.w3c.dom.*;
+import org.w3c.dom.Node;
+import javafx.scene.input.KeyEvent;
+import javafx.scene.layout.*;
+import org.w3c.dom.events.EventTarget;
+import netscape.javascript.JSObject;
+import javafx.application.Platform;
+import javafx.scene.input.KeyCode;
+import javafx.scene.control.Control;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
+import javafx.concurrent.Worker.State;
+import java.util.List;
+import java.util.ArrayList;
+
+/** Implements a "rich-term" console/terminal based on a WebView.
+ *
+ * A "line" is a sequence of text or inline elements - usually span elements.
+ * A div or paragraph of N lines has (N-1) br elements between lines.
+ * (br elements are only allowed in div or p elements.)
+ */
+public abstract class WebTerminal extends VBox // FIXME should extend Control
+      implements javafx.event.EventHandler, org.w3c.dom.events.EventListener
+                      /*implements KeyListener, ChangeListener*/ 
+{
+    WebView webView;
+    protected WebView getWebView() { return webView; } 
+
+    protected WebEngine webEngine;
+
+    String defaultBackgroundColor = "white";
+    String defaultForegroundColor = "black";
+
+    public boolean isLineEditing() { return lineEditing; }
+    public void setLineEditing(boolean lineEditing) {
+        this.lineEditing = lineEditing;
+    }
+    private boolean lineEditing = true;
+
+    public boolean outputLFasCRLF() { return isLineEditing(); }
+
+    /** The current input line.
+     * Note there is always a current (active) input line, even if the
+     * inferior isn't ready for it, and hasn't emitted a prompt.
+     * This is to support type-ahead, as well as application code
+     * reading from standard input.  (FUTURE - untested.)
+     */
+    public Element getInputLine() { return inputLine; }
+    public void setInputLine(Element inputLine) { this.inputLine = inputLine; }
+    Element inputLine;
+
+    Document documentNode;
+    Element bodyNode;
+
+    public Document getDocumentNode() { return documentNode; }
+
+    /** The element (normally a div or pre) which cursor navigation is relative to.
+     * Cursor motion is relative to the start of this element.
+     * "Erase screen" only erases in this element.
+     */
+    public Element getCursorHome() { return cursorHome; }
+    public void setCursorHome(Element cursorHome) { this.cursorHome = cursorHome; }
+    /** The element (normally div) which cursor navigation is relative to. */
+    private Element cursorHome;
+
+    /** Current line number, 0-origin, relative to start of cursorHome.
+     * -1 if unknown. */
+    int currentCursorLine = -1;
+    /** Current column number, 0-origin, relative to start of cursorHome.
+     * -1 if unknown. */
+    int currentCursorColumn = -1;
+
+    /** This is the column width at which the next line implicitly starts.
+     * Compare with wrapWidth - if both are less than Integer.MAX_VALUE
+     * then they should normally be equal. */
+    int columnWidth = Integer.MAX_VALUE;
+
+    /** If inserting a character at this column width, insert a wrap-break. */
+    int wrapWidth = 80;
+    boolean wrapOnLongLines = true;
+
+    public void resetCursorCache() {
+        currentCursorColumn = -1;
+        currentCursorLine = -1;
+    }
+
+    void updateCursorCache() {
+        long lcol = delta2D(cursorHome, outputBefore);
+        currentCursorLine = (int) (lcol >> 32);
+        currentCursorColumn = (int) (lcol >> 1) & 0x7fffffff;
+    }
+
+    /** Get line of current cursor position, starting with 0 at the top. */
+    public int getCursorLine() {
+        if (currentCursorLine < 0)
+            updateCursorCache();
+        return currentCursorLine;
+    }
+
+    /** Get column of current cursor position, starting with 0 at the left. */
+    public int getCursorColumn() {
+        if (currentCursorColumn < 0)
+            updateCursorCache();
+        return currentCursorColumn;
+    }
+
+    /** First (top) line of scroll region, 0-origin. */
+    int scrollRegionTop = 0;
+    /** Last (bottom) line of scroll region, 1-origin.
+     * Equivalently, first line following scroll region, 0-origin.
+     * The value -1 is equivalent to numRows. */
+    int scrollRegionBottom = -1;
+
+    public int getScrollTop() {
+        return scrollRegionTop;
+    }
+    public int getScrollBottom() {
+        return scrollRegionBottom < 0 ? getNumRows() : scrollRegionBottom;
+    }
+
+    // 0-origin
+    int savedCursorLine, savedCursorColumn;
+
+    public void saveCursor() {
+        savedCursorLine = getCursorLine();
+        savedCursorColumn = getCursorColumn();
+    }
+ 
+    public void restoreCursor() {
+        moveTo(savedCursorLine, savedCursorColumn);
+    }
+ 
+    /** The output position (cursor).
+     * Insert output before this node.
+     * (For now always (???) equal to inputLine except for temporary updates,
+     * but in the future they may be separated.)
+     * (For now, never null, but in the future, if it is null, it means
+     * append output to the end of the output container's children.)
+     */
+    public Node getOutputPosition() { return outputBefore; }
+    org.w3c.dom.Node outputBefore;
+    public void setOutputPosition(Node node) {
+        outputBefore = node; }
+
+    /** The parent node of the output position. */
+    public Node getOutputContainer() { return outputContainer; }
+    Node outputContainer;
+
+    /* * Index of outputContainer in which to insert output.
+     * Normally this is the same as outputNode's text length,
+     * but in the future we may support cursor movement commands.
+     */
+    //int outputPosition = -1;
+
+    int inputLineNumber = 0;
+
+    protected void loadSucceeded() {
+        addInputLine();
+        outputBefore = inputLine;
+    }
+
+    public WebTerminal() {
+        webView = new WebView();
+        webEngine = webView.getEngine();
+        webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<State>() {
+                public void changed(ObservableValue<? extends State> ov, State t, State newValue) {
+                    if (newValue == State.SUCCEEDED) {
+                        initialize();
+                        loadSucceeded();
+                    }
+                }});
+
+        loadPage(webEngine);
+        this.getChildren().add(webView);
+
+        // We run the key-event handlers during the filter (capture) phase,
+        // rather than the normal (bubbling) phase.  This allows us to
+        // consume the event, so it never gets to the bubbling phase - and
+        // thus never gets passed to the native component.  (In JavaScript
+        // one can call preventDefault or have the handler return false,
+        // but we don't have the functionality with JavaFX events.)
+        webView.addEventFilter(KeyEvent.KEY_PRESSED, this);
+        webView.addEventFilter(KeyEvent.KEY_TYPED, this);
+
+        VBox.setVgrow(webView, Priority.ALWAYS);
+    }
+
+    public static final boolean USE_XHTML = true;
+    public static final String XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
+    public static final String htmlNamespace = USE_XHTML ? XHTML_NAMESPACE : "";
+
+    /** URL for the initial page to be loaded. */
+    protected String pageUrl() {
+        String rname = USE_XHTML ? "repl.xml" : "repl.html";
+        java.net.URL rurl = WebTerminal.class.getResource(rname);
+        if (rurl == null)
+            throw new RuntimeException("no initial web page "+rname);
+        return rurl.toString();
+    }
+
+    /** Load the start page.  Do not call directly.
+     * Can be overridden to load a start page from a String:
+     * webEngibe.loadContent("initialContent", "MIME/type");
+     */
+    protected void loadPage(WebEngine webEngine) {
+        webEngine.load(pageUrl());
+    }
+
+    protected void initialize() {
+        documentNode = webEngine.getDocument();
+        bodyNode = documentNode.getElementById("body");
+
+        //((EventTarget) bodyNode).addEventListener("click", this, false);
+
+        //if (isLineEditing())             ((JSObject) bodyNode).call("focus");
+        // Element initial = documentNode.getElementById("initial"); FIXME LEAKS
+        Element initial = (Element) bodyNode.getFirstChild();
+        cursorHome = initial;
+        outputContainer = initial;
+    }
+
+    /** For debugging.*/
+    public String getHTMLText() {
+        if (true) {
+            return NodeWriter.writeNodeToString(bodyNode);
+        } /*else if (true) {
+        java.io.StringWriter sw = new java.io.StringWriter();
+        gnu.xml.XMLPrinter xp = new gnu.xml.XMLPrinter(sw, false);
+        ConsumeDOM.consumeNode(bodyNode, xp, true);
+        xp.flush();
+        return sw.toString();
+        } */ else if (false) {
+            return ((JSObject) (Object) bodyNode).getMember("innerHTML").toString();
+        } else {
+        com.sun.webkit.WebPage webPage = com.sun.javafx.webkit.Accessor.getPageFor(webEngine);
+        return "HTML="+webPage+"["+webPage.getHtml(webPage.getMainFrame())+"]";
+        //return  webEngine.getPage().toString(); //executeScript("document.innerHTML").toString();
+        }
+    }
+
+    /*
+    public void setHtmlText(String htmlText) {
+        ((HTMLEditorSkin)getSkin()).setHTMLText(htmlText);
+    }
+    */
+
+    protected void setEditable(Element element, boolean editable) {
+        ((JSObject) element).setMember("contentEditable", editable);
+    }
+    
+    protected void setEditable(boolean editable) {
+        setEditable(getInputLine(), editable);
+    }
+    
+    /** Add an input span as the last child of outputContainer.
+     */
+    public void addInputLine () {
+        Element inputNode = createSpanNode();
+        String id = "input"+(++inputLineNumber);
+
+        inputNode.setAttribute("id", id);
+        inputNode.setAttribute("std", "input");
+        setEditable(inputNode, true);
+        outputContainer.appendChild(inputNode);
+
+        // KLUDGE: The insertion caret isn't visible until something has inserted
+        // into the input line.  So we insert U-200B "zero width space".
+        // This gets removed in enter.
+        // (Note if a space is inserted and removed from the UI then the
+        // caret remains visible.  Thus a cleaner work-around would be if
+        // we could simulate this.  I haven't gotten that to work so far.)
+        Text dummyText = documentNode.createTextNode("\u200B");
+        //Text dummyText = documentNode.createTextNode("\n");
+        inputNode.appendChild(dummyText);
+        inputLine = inputNode;
+        setFocus();
+    }
+
+    public String inputAsString() { return toString(inputLine.getChildNodes());}
+
+    // DEBUGGING:
+    protected abstract void enter(KeyEvent ke);
+
+    public String grabInput(Element input) {
+        //WTDebug.println("grabInput input:"+WTDebug.pnode(input)+" firstCh:"+WTDebug.pnode(input.getFirstChild())+" inputL:"+WTDebug.pnode(inputLine));
+        String text = ((Text)input.getChildNodes().item(0)).getData();
+        //if (text == null) text = "";
+
+        // Replace Non-breaking space (inserted by webkit) with regular space.
+        text = text.replace((char) 160, ' ');
+        int tlen = text.length();
+        // See comment in addInputLine.
+        if (tlen > 0 && text.charAt(tlen-1) == (char) 0x200B) // OLD? 
+            text = text.substring(0, --tlen);
+        if (tlen > 0 && text.charAt(0) == (char) 0x200B) // NEW?
+        { tlen--; text = text.substring(1);}
+        return text;
+    }
+
+    protected String handleEnter (KeyEvent ke) {
+        /*
+        javafx.scene.input.Clipboard cc = javafx.scene.input.Clipboard.getSystemClipboard();
+        System.err.println("SCLIP has-h:"+cc.hasHtml()+" has-s:"+cc.hasString()+" str:"+cc.getString());
+        */
+        String text = grabInput(inputLine);
+        nextInputLine();
+        //super.processKeyEvent(ke);
+        return text;
+    }
+
+    protected void nextInputLine() {
+        outputBefore = inputLine.getNextSibling();
+        setEditable(false);
+        insertBreak();
+        addInputLine();
+        outputBefore = inputLine;
+    }
+
+    public void insertOutput (final String str, final char kind) {
+        Platform.runLater(new Runnable() {
+                public void run() {
+                    insertString(str, kind);
+                }
+            });
+    }
+
+    // States of escape sequences handler state machine.
+    static final int INITIAL_STATE = 0;
+    static final int SEEN_ESC_STATE = 1;
+    /** We have seen ESC '['. */
+    static final int SEEN_ESC_LBRACKET_STATE = 2;
+    /** We have seen ESC '[' '?'. */
+    static final int SEEN_ESC_LBRACKET_QUESTION_STATE = 3;
+    /** We have seen ESC ']'. */
+    static final int SEEN_ESC_RBRACKET_STATE = 4;
+    /** We have seen ESC ']' numeric-parameter ';'. */
+    static final int SEEN_ESC_BRACKET_TEXT_STATE = 5;
+    int controlSequenceState = INITIAL_STATE;
+
+    int prevParametersCount = 0; // number of semicolon argument separators seen.
+    // The actual number of arguments seen is:
+    // prevParametersCount+(curNumParameter>=0?1:0)
+    // Of these prevParametersCount are in the first prevParametersCount
+    // elements of prevNumParameters.
+    int curNumParameter = -1;
+    int[] prevNumParameters = null;
+    StringBuilder curTextParameter;
+
+    boolean insertMode;
+    public boolean inInsertMode() { return insertMode; }
+    public void setInsertMode(boolean enable) { insertMode = enable; }
+
+    int numRows = 24, numCols = 80;
+    public int getNumColumns() { return numCols; }
+    public int getNumRows() { return numRows; }
+    public void setRowsColumns(int rows, int columns) {
+        numCols = columns;
+        numRows = rows;
+        wrapWidth = columns;
+    }
+
+    public void handleBell() {
+        // Nothing.
+    }
+
+    public void handleOperatingSystemControl(int code, String text) {
+        if (code == 72) {
+            ((com.sun.webkit.dom.HTMLElementImpl) inputLine).insertAdjacentHTML("beforeBegin", text);
+        }
+        else {
+            // WTDebug.println("Saw Operating System Control #"+code+" \""+WTDebug.toQuoted(text)+"\"");
+        }
+    }
+
+    boolean usingAlternateScreenBuffer;
+    private Element savedCursorHome;
+    public void setAlternateScreenBuffer(boolean val) {
+        if (usingAlternateScreenBuffer != val) {
+            if (val) {
+                // FIXME should scroll top of new buffer to top of window.
+                Element buffer = createElement("pre");
+                savedCursorHome = cursorHome;
+                bodyNode.appendChild(buffer);
+                cursorHome = buffer;
+                outputContainer.removeChild(inputLine);
+                buffer.appendChild(inputLine);
+                outputContainer = buffer;
+                outputBefore = inputLine;
+                currentCursorColumn = 0;
+                currentCursorLine = 0;
+                setFocus();
+            } else { 
+                outputContainer.removeChild(inputLine);
+                cursorHome.getParentNode().removeChild(cursorHome);
+                cursorHome = savedCursorHome;
+                cursorHome.appendChild(inputLine);
+                outputContainer = cursorHome;
+                outputBefore = inputLine;
+                savedCursorHome = null;
+                outputContainer = cursorHome;
+                resetCursorCache();
+                setFocus();
+            }
+            usingAlternateScreenBuffer = val;
+            scrollRegionTop = 0;
+            scrollRegionBottom = -1;
+        }
+    }
+
+    public void handleControlSequence(char last) {
+        switch (last) {
+        case '@':
+            boolean saveInsertMode = inInsertMode();
+            setInsertMode(true);
+            if (curNumParameter<0) curNumParameter = 1;
+            insertSimpleOutput(makeSpaces(curNumParameter), 0, curNumParameter,
+                               'O', getCursorColumn()+curNumParameter);
+            cursorLeft(curNumParameter);
+            setInsertMode(saveInsertMode);
+            break;
+        case 'd': // Line Position Absolute
+            if (curNumParameter<0) curNumParameter = 1;
+            moveTo(curNumParameter-1, getCursorColumn());
+            break;
+        case 'h':
+            if (controlSequenceState == SEEN_ESC_LBRACKET_QUESTION_STATE) {
+                // DEC Private Mode Set (DECSET)
+                switch (curNumParameter) {
+                case 47:
+                case 1047:
+                    setAlternateScreenBuffer(true); break;
+                case 1048: saveCursor(); break;
+                case 1049: saveCursor(); setAlternateScreenBuffer(true); break;
+                }
+            }
+            else {
+                switch (curNumParameter) {
+                case 4: setInsertMode(true); break;
+                }
+            }
+            break;
+        case 'l':
+            if (controlSequenceState == SEEN_ESC_LBRACKET_QUESTION_STATE) {
+                // DEC Private Mode Reset (DECRST)
+                switch (curNumParameter) {
+                case 47:
+                case 1047:
+                    // should clear first?
+                    setAlternateScreenBuffer(false); break;
+                case 1048: restoreCursor(); break;
+                case 1049: setAlternateScreenBuffer(false); restoreCursor(); break;
+              }
+            }
+            else {
+                switch (curNumParameter) {
+                case 4: setInsertMode(false); break;
+                }
+            }
+            break;
+        case 'm':
+            for (int i = 0;  i <= prevParametersCount;  i++) {
+                int val = i < prevParametersCount ? prevNumParameters[i] : curNumParameter;
+                if (val <= 0) {
+                    currentStyles.clear();
+                }
+                else {
+                    int nstyles = currentStyles.size();
+                    switch (val) {
+                    case 1:
+                        pushSimpleStyle("font-weight:", "bold");
+                        break;
+                    case 22:
+                        pushSimpleStyle("font-weight:", null/*"normal"*/);
+                        break;
+                    case 4:
+                        pushSimpleStyle("text-decoration:", "underline");
+                        break;
+                    case 24:
+                        pushSimpleStyle("text-decoration:", null/*"none"*/);
+                        break;
+                    case 7:
+                        pushSimpleStyle("color:", defaultBackgroundColor);
+                        pushSimpleStyle("background-color:", defaultForegroundColor);
+                        break;
+                    case 27:
+                        pushSimpleStyle("color:", null/*defaultForegroundColor*/);
+                        pushSimpleStyle("background-color:", null/*defaultBackgroundColor*/);
+                        break;
+                    case 30: pushSimpleStyle("color:", "black"); break;
+                    case 31: pushSimpleStyle("color:", "red"); break;
+                    case 32: pushSimpleStyle("color:", "green"); break;
+                    case 33: pushSimpleStyle("color:", "yellow"); break;
+                    case 34: pushSimpleStyle("color:", "blue"); break;
+                    case 35: pushSimpleStyle("color:", "magenta"); break;
+                    case 36: pushSimpleStyle("color:", "cyan"); break;
+                    case 37: pushSimpleStyle("color:", "white"); break;
+                    case 39: pushSimpleStyle("color:", null/*defaultForegroundColor*/); break;
+                    case 40: pushSimpleStyle("background-color:", "black"); break;
+                    case 41: pushSimpleStyle("background-color:", "red"); break;
+                    case 42: pushSimpleStyle("background-color:", "green"); break;
+                    case 43: pushSimpleStyle("background-color:", "yellow"); break;
+                    case 44: pushSimpleStyle("background-color:", "blue"); break;
+                    case 45: pushSimpleStyle("background-color:", "magenta"); break;
+                    case 46: pushSimpleStyle("background-color:", "cyan"); break;
+                    case 47: pushSimpleStyle("background-color:", "white"); break;
+                    case 49: pushSimpleStyle("background-color:", null/*defaultBackgroundColor*/); break;
+                    }
+                }
+            }
+            adjustStyleNeeded = true;
+            break;
+        case 'r':
+            int top = prevParametersCount >= 1 ? prevNumParameters[0] : curNumParameter>=0 ? curNumParameter : 1;
+            int bottom = prevParametersCount >= 2 ? prevNumParameters[1]
+                : prevParametersCount==1 && curNumParameter>=0 ? curNumParameter : -1;
+            scrollRegionTop = top - 1;
+            scrollRegionBottom = bottom;
+            break;
+        case 'A': // cursor up
+            if (curNumParameter<0) curNumParameter = 1;
+            cursorDown(- curNumParameter);
+            break;
+        case 'B': // cursor down
+            if (curNumParameter<0) curNumParameter = 1;
+            cursorDown(curNumParameter);
+            break;
+        case 'C':
+            if (curNumParameter<0) curNumParameter = 1;
+            cursorRight(curNumParameter);
+            break;
+        case 'D':
+            if (curNumParameter<0) curNumParameter = 1;
+            cursorLeft(curNumParameter);
+            break;
+        case 'H':
+            int row = prevParametersCount >= 1 ? prevNumParameters[0] : curNumParameter>=0 ? curNumParameter : 1;
+            int col = prevParametersCount >= 2 ? prevNumParameters[1]
+                : prevParametersCount==1 && curNumParameter>=0 ? curNumParameter : 1;
+            moveTo(row-1, col-1);
+            break;
+        case 'J':
+            if (curNumParameter<0) curNumParameter = 0;
+            if (curNumParameter == 0) // Erase below.
+                eraseUntil(cursorHome);
+            else {
+                int saveLine = getCursorLine();
+                int saveCol = getCursorColumn();
+                if (curNumParameter == 1) { // Erase above
+                    for (int line = 0;  line < saveLine;  line++) {
+                        moveTo(line, 0);
+                        eraseLineRight();
+                    }
+                    if (saveCol != 0) {
+                        moveTo(saveLine, 0);
+                        eraseCharactersRight(saveCol, false);
+                    }
+                } else { // Erase all
+                    moveTo(0, 0);
+                    eraseUntil(cursorHome);
+                }
+                moveTo(saveLine, saveCol);
+            }
+            break;
+        case 'K':
+            if (curNumParameter!=1)
+                eraseLineRight();
+            if (curNumParameter>=1)
+                eraseLineLeft();
+            break;
+        case 'L': // Insert lines
+            if (curNumParameter<0) curNumParameter = 1;
+            insertLines(curNumParameter);
+            break;
+        case 'M': // Delete lines
+            if (curNumParameter<0) curNumParameter = 1;
+            deleteLines(curNumParameter);
+            break;
+        case 'P': // Delete characters
+            if (curNumParameter<0) curNumParameter = 1;
+            eraseCharactersRight(curNumParameter, true);
+            break;
+        case 'S':
+            if (curNumParameter<0) curNumParameter = 1;
+            scrollForward(curNumParameter);
+            break;
+        case 'T':
+            if (curNumParameter<0) curNumParameter = 1;
+            else if (curNumParameter >= 5)
+                ; // FIXME Initiate mouse tracking.
+            scrollReverse(curNumParameter);
+            break;
+        }
+    }
+
+    /** A stack of currently active "style" strings. */
+    public List<String> currentStyles = new ArrayList<String>();
+
+    /** True if currentStyles may not match the current style context.
+     * Thus the context needs to be adjusted before text is inserted. */
+    boolean adjustStyleNeeded;
+
+    /** Add a style property specifier to the currentStyles list.
+     * However, if the new specifier "cancels" an existing specifier,
+     * just remove the old one.
+     * @param styleNameWithColon style property name including colon,
+     *     (for example "text-decoration:").
+     * @param styleValue style property value string (for example "underline"),
+     *     or null to indicate the default value.
+     */
+    protected void pushSimpleStyle(String styleNameWithColon, String styleValue) {
+        int nstyles = currentStyles.size();
+        for (int i = 0;  i < nstyles;  ) {
+            String style = currentStyles.get(i);
+            if (style.startsWith(styleNameWithColon)) {
+                currentStyles.remove(i);
+                nstyles--;
+            } else
+                i++;
+        }
+        if (styleValue != null)
+            currentStyles.add(styleNameWithColon+' '+styleValue);
+    }
+
+    /** Adjust style at current position to match desired style.
+     * The desired style is a specified by the currentStyles list.
+     * This usually means adding {@code <span style=...>} nodes around the
+     * current position.  If the current position is already inside
+     * a {@code <span style=...>} node that doesn't match the desired style,
+     * then we have to split the {@code span} node so the current
+     * position is not inside the span node, but text before and after is.
+     */
+    protected void adjustStyle() {
+        adjustStyleNeeded = false;
+
+        List<String> parentStyles = new ArrayList<String>();
+        for (Node n = outputContainer;  n != bodyNode && n != null;
+             n = n.getParentNode()) {
+            String style;
+            if (n instanceof Element) {
+                style = ((Element) n).getAttribute("style");
+                if (style != null && style.length() > 0)
+                    parentStyles.add(style);
+            }
+        }
+
+        // Compare the parentStyles and currentStyles lists,
+        // so we can "keep" the styles where the match, and pop or add
+        // the styles where they don't match.
+        int keptStyles = 0;
+        int currentStylesLength = currentStyles.size();
+        int j;
+        for (j = parentStyles.size(); --j >= 0; ) {
+            String parentStyle = parentStyles.get(j);
+            if (parentStyle != null) {
+                if (keptStyles == currentStylesLength) {
+                    break;
+                }
+
+                // Matching is made more complicate because parentStyles
+                // may specify multiple properties in a single style attribute.
+                // For example "color: red; background-color: blue".
+                int k = 0;
+                while (k >= 0 && (parentStyle = parentStyle.trim()).length() > 0) {
+                    // Assume property values cannot contain semi-colons.
+                    // This may fail if there are string-valued properties,
+                    // since we don't check for quoted semi-colons.
+                    int semi = parentStyle.indexOf(';');
+                    String s;
+                    if (semi >= 0) {
+                        s = parentStyle.substring(0, semi).trim();
+                        parentStyle = parentStyle.substring(semi+1);
+                        if (s.length() == 0)
+                            continue;
+                    }
+                    else {
+                        s = parentStyle;
+                        parentStyle = "";
+                    }
+                    if (keptStyles+k < currentStylesLength
+                        && s.equals(currentStyles.get(keptStyles+k)))
+                        k++;
+                    else
+                        k = -1;
+                }
+                if (k >= 0)
+                    keptStyles += k;
+                else
+                    break;                   
+            }
+        }
+        int popCount = j+1;
+        while (--popCount >= 0) {
+            popStyle();
+        }
+        if (keptStyles < currentStylesLength) {
+            outputBefore = inputLine.getNextSibling();
+            outputContainer.removeChild(inputLine);
+            String styleValue = null;
+            do {
+                String s = currentStyles.get(keptStyles);
+                styleValue = styleValue == null ? s : styleValue + ';' + s;
+            } while (++keptStyles < currentStylesLength);
+            Element spanNode = createSpanNode();
+            spanNode.setAttribute("style", styleValue);
+            outputContainer.insertBefore(spanNode, outputBefore);
+            outputContainer = spanNode;
+            outputBefore = null;
+            spanNode.appendChild(inputLine);
+            outputBefore = inputLine;
+            setFocus();
+        }
+    }
+
+    public void setFocus() {
+        ((JSObject) inputLine).call("focus");
+    }
+
+    /** Move inputLine outside current (style) span. */
+    protected void popStyle() {
+        Node following = inputLine.getNextSibling();
+        Element span1 = (Element) inputLine.getParentNode();
+        Node parent = span1.getParentNode();
+        span1.removeChild(inputLine);
+        outputContainer = parent;
+        parent.insertBefore(inputLine, span1.getNextSibling());
+        outputBefore = inputLine;
+        if (following != null) {
+            Element span2 = createSpanNode();
+            String classAttr = span1.getAttribute("class");
+            String styleAttr = span1.getAttribute("style");
+            if (classAttr != null && classAttr.length() > 0)
+                span2.setAttribute("class", classAttr);
+            if (styleAttr != null && styleAttr.length() > 0)
+                span2.setAttribute("style", styleAttr);
+            parent.insertBefore(span2, inputLine.getNextSibling());
+            do {
+                Node ch = following;
+                following = ch.getNextSibling();
+                span1.removeChild(ch);
+                span2.appendChild(ch);
+            } while (following != null);
+        }
+        setFocus();
+    }
+
+    public void insertLinesIgnoreScroll(int count) {
+        StringBuilder builder = new StringBuilder(count);
+        while (--count >= 0)
+            builder.append('\n');
+        Text text = documentNode.createTextNode(builder.toString());
+        if (outputBefore == inputLine && inputLine != null)
+            outputContainer.insertBefore(text, outputBefore.getNextSibling());
+        else {
+            insertNode(text);
+            outputBefore = text;
+        }
+    }
+
+    public void deleteLinesIgnoreScroll(int count) {
+        for (int i = count; --i >= 0; ) {
+            eraseCharactersRight(-1, true);
+            Node current = outputBefore;
+            if (current==inputLine)
+                current=current.getNextSibling();
+            if (current instanceof Text) {
+                Text tnode = (Text) current;
+                String text = tnode.getTextContent();
+                int length = text.length();
+                if (length == 0 || text.charAt(0) != '\n') // Invalid usage
+                    break;
+                tnode.deleteData(0, 1);
+            }
+            else if (isBreakNode(current)) {
+                current.getParentNode().removeChild(current);
+                current=current.getNextSibling();
+            }
+            else {
+                // Invalid usage.
+                break;
+            }
+        }
+    }
+
+    public void insertLines(int count) {
+        int line = getCursorLine();
+        moveTo(getScrollBottom()-count, 0);
+        deleteLinesIgnoreScroll(count);
+        moveTo(line, 0);
+        insertLinesIgnoreScroll(count);
+    }
+
+    public void deleteLines(int count) {
+        deleteLinesIgnoreScroll(count);
+        int line = getCursorLine();
+        cursorLineStart(getScrollBottom() - line - count);
+        insertLinesIgnoreScroll(count);
+        moveTo(line, 0);
+    }
+
+    public void scrollForward(int count) {
+        int line = getCursorLine();
+        moveTo(getScrollTop(), 0);
+        deleteLinesIgnoreScroll(count);
+        int scrollRegionSize = getScrollBottom() - getScrollTop();
+        cursorLineStart(scrollRegionSize-count);
+        insertLinesIgnoreScroll(count);
+        moveTo(line, 0);
+    }
+
+    public void scrollReverse(int count) {
+        int line = getCursorLine();
+        moveTo(getScrollBottom()-count, 0);
+        deleteLinesIgnoreScroll(count);
+        moveTo(getScrollTop(), 0);
+        insertLinesIgnoreScroll(count);
+        moveTo(line, 0);
+    }
+
+    public void eraseLineLeft() {
+        int column = getCursorColumn();
+        cursorLineStart(0);
+        eraseCharactersRight(column, false);
+        cursorRight(column);
+    }
+
+    /** Erase from the current position until stopNode.
+     * If currently inside stopNode, erase to end of stopNode;
+     * otherwise erase until start of stopNode.
+     */
+    void eraseUntil(Node stopNode) {
+        Node current = outputBefore;
+        Node parent = outputContainer;
+        if (current==inputLine && current != null)
+            current=current.getNextSibling();
+        for (;;) {
+            if (current == stopNode)
+                return;
+            if (current == null) {
+                current = parent;
+                parent = current.getParentNode();
+            } else {
+                Node next = current.getNextSibling();
+                parent.removeChild(current);
+                current = next;
+            }
+        }
+    }
+
+    /** Erase or delete characters in current line.
+     * @param count number of characters to erase or -1 to end of line
+     * @param doDelete true if delete, false if erase
+     */
+    public void eraseCharactersRight(int count, boolean doDelete) {
+        if (count < 0)
+            count = Integer.MAX_VALUE;
+        // Note that the traversal logic is similar to move.
+        Node current = outputBefore;
+        Node parent = outputContainer;
+        if (current==inputLine && current != null)
+            current=current.getNextSibling();
+        int curColumn = -1;
+        int seen = 0; // Number of columns scanned so far.
+        for (;;) {
+            if (isBreakNode(current) || seen >= count) {
+                break;
+            }
+            else if (current instanceof Text) {
+                Text tnode = (Text) current;
+                String text = tnode.getTextContent();
+                int length = text.length();
+
+                int i = 0;
+                for (; i < length; i++) {
+                    if (seen >= count)
+                        break;
+                    char ch = text.charAt(i);
+                    // Optimization - don't need to calculate getCurrentColumn.
+                    if (ch >= ' ' && ch < 127) {
+                        seen++;
+                    }
+                    else if (ch == '\r' || ch == '\n' || ch == '\f') {
+                        count = seen;
+                        break;
+                    }
+                    else {
+                        if (curColumn < 0)
+                            curColumn = getCursorColumn();
+                        int col = updateColumn(ch, curColumn+seen);
+                        seen = col - curColumn;
+                        // general case using updateColumn FIXME
+                    }
+                }
+
+                if (i >= length && doDelete) {
+                    Node next = current.getNextSibling();
+                    parent.removeChild(current);
+                    current = next;
+                    //break;
+                }
+                else {
+                    if (doDelete)
+                        tnode.deleteData(0, i);
+                    else {
+                        tnode.replaceData(0, i, makeSpaces(i));
+                    }
+                }
+                continue;
+            } else if (current instanceof Element) {
+                if (isObjectElement((Element) current)) {
+                    Node next = current.getNextSibling();
+                    parent.removeChild(current);
+                    current = next;
+                    count--;
+                    continue;
+                }
+            }
+
+            Node ch;
+            if (current != null) {
+                // If there is a child, go to the first child next.
+                ch = current.getFirstChild();
+                if (ch != null) {
+                    parent = current;
+                    current = ch;
+                    continue;
+                }
+                // Otherwise, go to the next sibling.
+                ch = current.getNextSibling();
+                if (ch != null) {
+                    current = ch;
+                    continue;
+                }
+
+                // Otherwise go to the parent's sibling - but this gets complicated.
+                if (isBlockNode(current))
+                    break;
+            }
+
+            //ch = current;
+            for (;;) {
+                if (parent == bodyNode) {
+                    return;
+                }
+                Node sib = parent.getNextSibling();
+                Node pparent = parent.getParentNode();
+                if (isSpanNode(parent) && parent.getFirstChild() == null)
+                    pparent.removeChild(parent);
+                parent = pparent;
+                if (sib != null) {
+                    current = sib;
+                    break;
+                }
+            }
+        }
+    }
+
+    public void eraseLineRight() {
+        eraseCharactersRight(-1, true);
+    }
+
+    /** Move cursor to beginning of line, relative.
+     * @param deltaLines line number to move to, relative to current line.
+     */
+    public void cursorLineStart(int deltaLines) {
+        if (deltaLines > 0) // Optimization
+            moveTo(outputBefore, deltaLines, 0, true);
+        else
+            moveTo(getCursorLine()+deltaLines, 0);
+    }
+
+    public void cursorDown(int deltaLines) {
+        moveTo(getCursorLine()+deltaLines, getCursorColumn());
+    }
+
+    public void cursorRight(int count) {
+        if (false) {
+            moveTo(inputLine, 0, count, true);
+        } else {
+            // FIXME optimize same way cursorLeft is.
+            //long lcol = delta2D(cursorHome, outputBefore);
+            //inline = (int) (lcol >> 32);
+            //int col = (int) (lcol >> 1) & 0x7fffffff;
+            moveTo(getCursorLine(), getCursorColumn()+count);
+        }
+    }
+
+    public void cursorLeft(int count) {
+        if (count == 0)
+            return;
+        org.w3c.dom.Node prev = outputBefore.getPreviousSibling();
+        // Optimize common case
+        if (prev instanceof org.w3c.dom.Text) {
+            org.w3c.dom.Text ptext = (org.w3c.dom.Text) prev;
+            int len = ptext.getLength();
+            String tstr = ptext.getTextContent();
+            int tcols = 0;
+            int tcount = 0;
+            for (;;) {
+                if (tcols == count)
+                    break;
+                if (tcount == len) {
+                    tcount = -1;
+                    break;
+                }
+                tcount++;
+                char ch = tstr.charAt(len-tcount);
+                int chcols = charColumns(ch);
+                if (ch == '\n' || ch == '\r' || ch == '\f' || ch == 't'
+                    || chcols < 0 || tcols+chcols > count) {
+                    tcount = -1;
+                    break;
+                }
+                tcols += chcols;
+            }
+            if (tcount > 0) {
+                String after = tstr.substring(len-tcount);
+                ptext.deleteData(len-tcount, tcount);
+                count -= tcols;
+                org.w3c.dom.Node following = outputBefore.getNextSibling();
+                if (following instanceof org.w3c.dom.Text) {
+                    org.w3c.dom.Text rtext = (org.w3c.dom.Text) following;
+                    rtext.replaceData(0, 0, after);
+                } else {
+                    org.w3c.dom.Text nafter = documentNode.createTextNode(after);
+                    outputContainer.insertBefore(nafter, following);
+                }
+                if (currentCursorColumn > 0)
+                    currentCursorColumn -= tcols;
+            }
+        }
+        if (count > 0) {
+            moveTo(getCursorLine(), getCursorColumn()-count);
+        }
+    }
+
+    /** Return column number following a tab at initial {@code col}.
+     * Both {@code col} and result are 0-origin.
+     * Default implementation assumes tabs every 8 columns.
+     */
+    protected int nextTabCol(int col) {
+        return (col & ~7) + 8;
+    }
+
+    public Text createText(String data) {
+        return documentNode.createTextNode(data);
+    }
+    
+    public Element createElement(String tag) {
+        return USE_XHTML ? documentNode.createElementNS(htmlNamespace, tag)
+            : documentNode.createElement(tag);
+    }
+
+    protected Element createSpanNode() {
+        return createElement("span");
+    }
+
+    protected void insertString(String str, char kind) {
+        //WTDebug.println("insertString \""+WTDebug.toQuoted(str)+"\" len:"+str.length()+" in-is-out:"+(inputLine==outputBefore)+" DOM["+getHTMLText()+"]");
+        int prevEnd = 0;
+        int curColumn = getCursorColumn();
+        int slen = str.length();
+        int i = 0;
+        for (; i < slen;  i++) {
+            char ch = str.charAt(i);
+            switch (controlSequenceState) {
+            case SEEN_ESC_STATE:
+                switch (ch) {
+                case '[':
+                    controlSequenceState = SEEN_ESC_LBRACKET_STATE;
+                    curNumParameter = -1;
+                    prevParametersCount = 0;
+                    continue;
+                case ']':
+                    controlSequenceState = SEEN_ESC_RBRACKET_STATE;
+                    curNumParameter = -1;
+                    prevParametersCount = 0;
+                    continue;
+                case '7': // DECSC
+                    saveCursor();
+                    break;
+                case '8': // DECRC
+                    restoreCursor();
+                    break;
+                case 'M': // Reverse index
+                    insertLines(1);
+                    break;
+                }
+                controlSequenceState = INITIAL_STATE;
+                prevEnd = i + 1;
+                curColumn = getCursorColumn();
+                break;
+            case SEEN_ESC_LBRACKET_STATE:
+            case SEEN_ESC_LBRACKET_QUESTION_STATE:
+                if (ch >= '0' && ch <= '9') {
+                    curNumParameter = curNumParameter >= 0 ? 10 * curNumParameter : 0;
+                    curNumParameter += (ch - '0');
+                }
+                else if (ch == ';') {
+                    if (prevNumParameters == null)
+                        prevNumParameters = new int[4];
+                    else if (prevNumParameters.length <= prevParametersCount) {
+                        prevNumParameters = java.util.Arrays.copyOf(prevNumParameters, 2*prevParametersCount);
+                    }
+                    prevNumParameters[prevParametersCount] = curNumParameter;
+                    curNumParameter = -1;
+                    prevParametersCount++;
+                }
+                else if (ch == '?')
+                    controlSequenceState = SEEN_ESC_LBRACKET_QUESTION_STATE;
+                else {
+                    handleControlSequence(ch);
+                    prevNumParameters = null;
+                    prevEnd = i + 1;
+                    curColumn = getCursorColumn();
+                    controlSequenceState = INITIAL_STATE;
+                }
+                continue;
+
+            case SEEN_ESC_RBRACKET_STATE:
+                if (ch >= '0' && ch <= '9') {
+                    curNumParameter = curNumParameter >= 0 ? 10 * curNumParameter : 0;
+                    curNumParameter += (ch - '0');
+                }
+                else if (ch == ';') {
+                    controlSequenceState = SEEN_ESC_BRACKET_TEXT_STATE;
+                    curTextParameter = new StringBuilder();
+                }
+                else {
+                    prevNumParameters = null;
+                    prevEnd = i + 1;
+                    curColumn = getCursorColumn();
+                    controlSequenceState = INITIAL_STATE;
+                }
+                continue;
+
+            case SEEN_ESC_BRACKET_TEXT_STATE:
+                if (ch == '\007' || ch == '\000') {
+                    handleOperatingSystemControl(curNumParameter, curTextParameter.toString());
+                    curTextParameter = null;
+                    curColumn = getCursorColumn();
+                    controlSequenceState = INITIAL_STATE;
+                    prevNumParameters = null;
+                    prevEnd = i + 1;
+                } else {
+                    curTextParameter.append(ch);
+                }
+                continue;
+            case INITIAL_STATE:
+                switch (ch) {
+                case '\r':
+                    insertSimpleOutput(str, prevEnd, i, kind, curColumn);
+                    //currentCursorColumn = column;
+                    if (i+1 < slen && str.charAt(i+1) == '\n'
+                        && getCursorLine() != scrollRegionBottom-1) {
+                        cursorLineStart(1);
+                        i++;
+                    } else {
+                        cursorLineStart(0);
+                    }
+                    prevEnd = i + 1;
+                    curColumn = 0;
+                    break;
+                case '\n':
+                    insertSimpleOutput(str, prevEnd, i, kind, curColumn);
+                    if (outputLFasCRLF())
+                        cursorLineStart(1);
+                    // Only scroll if scrollRegionBottom explicitly set to a value >= 0.
+                    else if (getCursorLine() == scrollRegionBottom-1)
+                        scrollForward(1);
+                    else
+                        cursorDown(1);
+                    prevEnd = i + 1;
+                    curColumn = currentCursorColumn;
+                    break;
+                case '\b':
+                    insertSimpleOutput(str, prevEnd, i, kind, curColumn); 
+                    cursorLeft(1);
+                    //WTDebug.println("BACKSPACE after DOM["+getHTMLText()+"]");
+                    prevEnd = i + 1; 
+                    curColumn = currentCursorColumn;
+                    break;
+                case '\007': // Bell
+                    insertSimpleOutput(str, prevEnd, i, kind, curColumn); 
+                    //currentCursorColumn = column;
+                    handleBell();
+                    prevEnd = i + 1;
+                    break;
+                case '\033':
+                    insertSimpleOutput(str, prevEnd, i, kind, curColumn);
+                    //currentCursorColumn = column;
+                    prevEnd = i + 1;
+                    controlSequenceState = SEEN_ESC_STATE;
+                    continue;
+                case '\t':
+                    insertSimpleOutput(str, prevEnd, i, kind, curColumn);
+                    int nextStop = nextTabCol(getCursorColumn());
+                    //WTDebug.println("TAB cur:"+currentCursorColumn+" tab-to:"+nextStop+" move:"+(nextStop-currentCursorColumn));
+                    cursorRight(nextStop-currentCursorColumn);
+                    curColumn = currentCursorColumn;
+                    prevEnd = i + 1;
+                    break;
+                default:
+                    int nextColumn = updateColumn(ch, curColumn);
+                    if (nextColumn > wrapWidth) {
+                        if (wrapOnLongLines) {
+                            insertSimpleOutput(str, prevEnd, i, kind, curColumn);
+                            //currentCursorColumn = column;
+                            //insertWrapBreak();
+                            cursorLineStart(1);
+                            prevEnd = i;
+                        }
+                        //line++;
+                        nextColumn = updateColumn(ch, 0);
+                    }
+                    curColumn = nextColumn;
+                }
+            }
+        }
+        if (controlSequenceState == INITIAL_STATE) {
+            insertSimpleOutput(str, prevEnd, i, kind, curColumn);
+            //currentCursorColumn = column;
+        }
+        //long lcol = delta2D(cursorHome, outputBefore);
+    }
+
+    protected void insertSimpleOutput (String str, int beginIndex, int endIndex, char kind, int endColumn) {
+        int sslen = endIndex - beginIndex;
+        if (sslen == 0)
+            return;
+
+        if (adjustStyleNeeded)
+            adjustStyle();
+        int slen = str.length();
+        if (beginIndex > 0 || endIndex != slen)
+            str = str.substring(beginIndex, endIndex);
+        //WTDebug.println("[insertSimple \""+WTDebug.toQuoted(str)+"\" kind:"+kind+" DOM["+getHTMLText()+"] outBef:"+WTDebug.pnode(outputBefore)+" endCol:"+endColumn+" cur:"+getCursorColumn()+" ins:"+inInsertMode());
+        int column = getCursorColumn();
+        int widthInColums = endColumn-column;
+        if (! inInsertMode()) {
+            eraseCharactersRight(widthInColums, true);
+        } else if (wrapOnLongLines) {
+            moveTo(cursorHome, getCursorLine(), wrapWidth-widthInColums, false);
+            eraseCharactersRight(-1, true);
+            moveTo(getCursorLine(), column);
+        }
+        if (kind == 'E') {
+            Element errElement = createSpanNode();
+            errElement.setAttribute("std", "error");
+            //errElement.setAttribute("style", "font-weight: bold; color: green; background: blue");
+            //resetCursorCache(); // FIXME - should avoid
+            insertNode(errElement);
+            errElement.appendChild(documentNode.createTextNode(str));
+            outputBefore = errElement.getNextSibling();
+        }
+        else {
+            org.w3c.dom.Node previous = outputBefore != null ? outputBefore.getPreviousSibling()
+                : outputContainer.getLastChild();
+            if (previous instanceof Text)
+                ((Text) previous).appendData(str);
+            else {
+                Text text = documentNode.createTextNode(str);
+                insertNode(text);
+            }
+        }
+        currentCursorColumn = endColumn;
+    }
+
+    /** Insert a node at (before) current position.
+     * Caller needs to update cursor cache or call resetCursorCache. */
+    public void insertNode (org.w3c.dom.Node node) {
+        outputContainer.insertBefore(node, outputBefore);
+    }
+
+    /** Insert element at current position, and move to start of element. */
+    public void pushIntoElement(Element element) {
+        resetCursorCache(); // FIXME - not needed if element is span, say.
+        insertNode(element);
+        outputContainer = element;
+        outputBefore = null;
+    }
+
+    /** Move position to follow current container. */
+    public void popFromElement() {
+        Node element = outputContainer;
+        outputContainer = element.getParentNode();
+        outputBefore = element.getNextSibling();
+    }
+
+    public void insertPrompt (final String str) {
+        Platform.runLater(new Runnable() {
+                public void run() {
+                    // <span std="prompt">
+                    Element promptElement = createSpanNode();
+                    promptElement.setAttribute("std", "prompt");
+                    resetCursorCache(); // FIXME - should avoid
+                    insertNode(promptElement);
+                    boolean moveInputLine = false; //inputLine == outputBefore;
+                    org.w3c.dom.Node savedParent = outputContainer;
+                    Node savedBefore = outputBefore;
+                    if (moveInputLine) { // FIXME - useless code?
+                        outputContainer.removeChild(inputLine);
+                        outputContainer = promptElement;
+                        promptElement.appendChild(inputLine);
+                        outputBefore = inputLine;
+                    } else {
+                        outputContainer = promptElement;
+                        outputBefore = null;
+                    }
+                    insertString(str, '\0');
+                    // </span>
+                    if (moveInputLine) { // FIXME - useless code?
+                        outputContainer.removeChild(inputLine);
+                        savedParent.insertBefore(inputLine, promptElement.getNextSibling());
+                        setFocus();
+                    }
+                    else
+                        outputBefore = savedBefore;
+                    outputContainer = savedParent;
+                }
+            });
+    }
+
+    private void appendText(Node parent, String data) {
+        if (data.length() == 0)
+            return;
+        Node last = parent.getLastChild();
+        if (last instanceof Text)
+            ((Text) last).appendData(data);
+        else
+            parent.appendChild(documentNode.createTextNode(data));
+    }
+
+    /** Insert a {@code <br>} node. */
+    protected void insertBreak () {
+        org.w3c.dom.Node breakNode = createElement("br");
+        insertNode(breakNode);
+        currentCursorColumn = 0;
+        if (currentCursorLine >= 0)
+            currentCursorLine++;
+    }
+
+    /** Insert a line break because of wrapping an over-long line. */
+    protected void insertWrapBreak() {
+        insertBreak();
+    }
+
+    public void handleEvent(org.w3c.dom.events.Event event) {
+        //WTDebug.println("handle1Event "+event+" type:"+event.getType()+" INPUT:"+inputAsString());
+    }
+
+    public void handle(javafx.event.Event ke) {
+        if (ke instanceof javafx.event.ActionEvent)
+            handle((javafx.event.ActionEvent) ke);
+        if (ke instanceof javafx.scene.input.KeyEvent)
+            handle((javafx.scene.input.KeyEvent) ke);
+    }
+
+    public void handle(javafx.event.ActionEvent ke) {
+        //WTDebug.println("handle2 action "+ke+" INPUT:"+inputAsString());
+    }
+    
+    public boolean isApplicationMode() { return true; }
+
+    private void processArrowKey(char ch) {
+        processInputCharacters((isApplicationMode() ? "\033O" : "\033[")+ch);
+    }
+
+    public void handle(javafx.scene.input.KeyEvent ke) {
+        KeyCode code = ke.getCode();
+        if (!isLineEditing()) {
+            switch (code) {
+                //redundant case ENTER: processInputCharacters("\r");  break;
+            case UP: processArrowKey('A');  break;
+            case DOWN: processArrowKey('B');  break;
+            case RIGHT: processArrowKey('C');  break;
+            case LEFT: processArrowKey('D');  break;
+            case HOME: processInputCharacters("\033[1~"); break;
+            case END: processInputCharacters("\033[4~"); break;
+                //case DELETE: processInputCharacters("\033[3~"); break;
+            case INSERT: processInputCharacters("\033[2~"); break;
+            case PAGE_UP: processInputCharacters("\033[5~"); break;
+            case PAGE_DOWN: processInputCharacters("\033[6~"); break;
+            default:
+                String chars = ke.getCharacter();
+                if (chars != KeyEvent.CHAR_UNDEFINED && chars.length() > 0)
+                    processInputCharacters(chars);
+            }
+            ke.consume();
+        } else if (ke.getEventType() == KeyEvent.KEY_TYPED
+                   && "\r".equals(ke.getCharacter())) {
+            enter(ke);
+            ke.consume();
+        }
+    }
+
+    public void processInputCharacters(String text) {
+    }
+
+    /*
+    public boolean isDivNode(Node node) {
+        if (! (node instanceof Element)) return false;
+        String tag = ((Element) node).getTagName();
+        return "div".equals(tag);
+    }
+    */
+
+    /** True if an img/object/a element.
+     * These are treated as black boxes similar to a single
+     * 1-column character. */
+    public boolean isObjectElement(Element node) {
+        String tag = node.getTagName();
+        return "a".equals(tag) || "object".equals(tag) || "img".equals(tag);
+    }
+
+    public boolean isBlockNode(Node node) {
+        if (! (node instanceof Element)) return false;
+        String tag = ((Element) node).getTagName();
+        return "p".equals(tag) || "div".equals(tag) || "pre".equals(tag);
+    }
+
+    public boolean isBreakNode(Node node) {
+        if (! (node instanceof Element)) return false;
+        String tag = ((Element) node).getTagName();
+        return "br".equals(tag);
+    }
+
+    public boolean isSpanNode(Node node) {
+        if (! (node instanceof Element)) return false;
+        String tag = ((Element) node).getTagName();
+        return "span".equals(tag);
+    }
+
+    /** Move forwards relative to cursorHome. */
+    public void moveTo(int goalLine, int goalColumn) {
+        moveTo(cursorHome, goalLine, goalColumn, true);
+    }
+
+    /** Move forwards relative to startNode.
+     * Currently, assumes startNode==cursorHome; that may change.
+     */
+    public void moveTo(Node startNode, int goalLine, int goalColumn, boolean addSpaceAsNeeded) {
+        //WTDebug.println("move start:"+WTDebug.pnode(startNode)+" gl:"+goalLine+" gc:"+goalColumn+" inputL:"+inputLine);
+        //WTDebug.println("move DOM["+getHTMLText()+"]");
+        adjustStyleNeeded = true;
+        int line = 0, column = 0;
+        Node current;
+        Node parent;
+
+        if (startNode == cursorHome) {
+            if (currentCursorLine >= 0 && currentCursorColumn >= 0
+                && goalLine >= currentCursorLine
+                && (goalLine > currentCursorLine
+                    || goalColumn >= currentCursorColumn)) {
+                current = outputBefore;
+                parent = outputContainer;
+                line = currentCursorLine;
+                column = currentCursorColumn;
+            }
+            else {
+                parent = cursorHome;
+                current = cursorHome.getFirstChild();
+            }
+        } else {
+            current = startNode;
+            parent = current == null ? outputContainer : current.getParentNode();
+        }
+        // Temporarily remove inputLine from tree.
+        if (inputLine != null) {
+            Node inputParent = inputLine.getParentNode();
+            if (inputParent != null) {
+                if (outputBefore==inputLine)
+                    outputBefore = outputBefore.getNextSibling();
+                if (current==inputLine)
+                    current = current.getNextSibling();
+               inputParent.removeChild(inputLine);
+               // Removing input line may leave 2 Text nodes adjacent.
+               // These are merged below.
+            }
+        }
+
+        //if (parent==null||(current!=null&&parent!=current.getParentNode()))
+        //throw new Error("BAD PARENT "+WTDebug.pnode(parent)+" OF "+WTDebug.pnode(current));
+        mainLoop:
+        while (line < goalLine || column < goalColumn) {
+            //WTDebug.println("-move cur:"+WTDebug.pnode(current)+(current==null?"":(" .par:"+WTDebug.pnode(current.getParentNode())))+" parent:"+WTDebug.pnode(parent)+" l:"+line+" col:"+column+" DOM["+getHTMLText()+"]");
+            if (parent==null||(current!=null&&parent!=current.getParentNode()))
+                throw new Error("BAD PARENT "+WTDebug.pnode(parent)+" OF "+WTDebug.pnode(current));
+            if (isBreakNode(current)) {
+                if (line == goalLine) {
+                    if (addSpaceAsNeeded) {
+                        Node previous = current.getPreviousSibling();
+                        String str = makeSpaces(goalColumn-column);
+                        if (previous instanceof Text)
+                            ((Text) previous).appendData(str);
+                        else
+                            parent.insertBefore(createText(str), current);
+                        column = goalColumn;
+                    }
+                    else
+                        goalColumn = column;
+                    break;
+                } else {
+                    line++;
+                    column = 0;
+                }
+            }
+            else if (current instanceof Text) {
+                Text tnode = (Text) current;
+                int tstart = 0;
+                Node before;
+                while ((before = tnode.getPreviousSibling()) instanceof Text) {
+                    // merge nodes
+                    // (adjacent text nodes may happen after removing inputLine)
+                    String beforeData = ((Text) before).getData();
+                    tstart += beforeData.length();
+                    tnode.insertData(0, beforeData);
+                    parent.removeChild(before);
+                }
+                String text = tnode.getTextContent();
+                int tlen = text.length();
+                for (int i = tstart; i < tlen;  i++) {
+                    if (line >= goalLine && column >= goalColumn) {
+                        tnode.splitText(i);
+                        break;
+                    }
+                    char ch = text.charAt(i);
+                    int nextColumn = updateColumn(ch, column);
+                    if (nextColumn > columnWidth) {
+                        line++;
+                        column = updateColumn(ch, 0);
+                    }
+                    else if (nextColumn == -1) {
+                        if (line == goalLine) {
+                            int nspaces = goalColumn-column;
+                            if (addSpaceAsNeeded) {
+                                String spaces = makeSpaces(nspaces);
+                                tnode.insertData(i, spaces);
+                                tlen += nspaces;
+                                i += nspaces;
+                            }
+                            column = goalColumn;
+                            i--;
+                        } else {
+                            line++;
+                            column = 0;
+                            if (ch == '\r' && i+1<tlen && text.charAt(i+1) == '\n')
+                                i++;
+                        }
+                    }
+                    else
+                        column = nextColumn;
+                }
+            }
+
+            if (parent==null||(current!=null&&parent!=current.getParentNode()))
+                throw new Error("BAD PARENT "+WTDebug.pnode(parent)+" OF "+WTDebug.pnode(current));
+            // If there is a child, go the the first child next.
+            Node ch;
+            if (current != null) {
+                if (current instanceof Element
+                    && isObjectElement((Element) current))
+                    column += 1;
+                else {
+                    ch = current.getFirstChild();
+                    if (ch != null) {
+                        parent = current;
+                        current = ch;
+                        continue;
+                    }
+                }
+                // Otherwise, go to the next sibling.
+                ch = current.getNextSibling();
+                if (ch != null) {
+                    current = ch;
+                    if (parent==null||(current!=null&&parent!=current.getParentNode()))
+                        throw new Error("BAD PARENT "+WTDebug.pnode(parent)+" OF "+WTDebug.pnode(current));
+                    continue;
+                }
+
+                // Otherwise go to the parent's sibling - but this gets complicated.
+                if (isBlockNode(current))
+                    line++;
+            }
+
+            ch = current;
+            for (;;) {
+                if (parent == cursorHome || parent == bodyNode) {
+                    current = null;
+                    if (true) { 
+                        if (line < goalLine) {
+                            StringBuilder sb = new StringBuilder();
+                            while (line++ < goalLine)
+                                sb.append('\n');
+                            appendText(parent, sb.toString());
+                        }
+                    }
+                    else {
+                        while (line++ < goalLine) {
+                            parent.appendChild(createElement("br"));
+                        }
+                    }
+                    int fill = goalColumn - column;
+                    if (fill > 0) {
+                        appendText(parent, makeSpaces(fill));
+                    }
+                    line = goalLine;
+                    column = goalColumn;
+                    break mainLoop;
+                }
+                Node sib = parent.getNextSibling();
+                ch = parent; // ??
+                parent = parent.getParentNode();
+                //WTDebug.println("-at end sib:"+WTDebug.pnode(sib)+" pp:"+WTDebug.pnode(parent));
+                if (sib != null) {
+                    current = sib;
+                    //parent = ch;
+                    break;
+                }
+            }
+            continue;
+        }
+        if (parent==null||(current!=null&&parent!=current.getParentNode()))
+            throw new Error("BAD PARENT "+WTDebug.pnode(parent)+" OF "+WTDebug.pnode(current));
+        if (parent == bodyNode && isBlockNode(current)) {
+            parent = current;
+            current = parent.getFirstChild();
+        }
+        if (inputLine != null) {
+            parent.insertBefore(inputLine, current);
+            setFocus();
+        }
+        outputContainer = parent;
+        outputBefore = inputLine;
+        if (startNode == cursorHome) {
+            currentCursorLine = line;
+            currentCursorColumn = column;
+        }
+        else
+            resetCursorCache(); // ??? can we do better?
+    }
+
+    /** Returns number of columns needed for argument.
+     * Currently always returns 1.
+     * However, in the future we should handle zero-width characters
+     * as well as double-width characters, and composing charcters.
+     */
+    int charColumns(int ch) {
+        if (ch == 0x200B)
+            return 0;
+        return 1;
+    }
+
+    /** Calculate a "column state" after appending a given char.
+     * A non-negative column state is a number of columns.
+     * The value -1 as a return value indicates a newline character.
+     *
+     * In the future, a value less than -1 can be used to encode an
+     * initial part of a compound character, including a start surrogate.
+     * Compound character support is not implemented yet,
+     * nor is support for zero-width or double-width characters.
+     */
+    protected int updateColumn(char ch, int startState) {
+        if (ch == '\n' || ch == '\r' || ch == '\f')
+            return -1;
+        if (startState < 0) {
+            // TODO handle surrogates, compound characters, etc.
+        }
+        if (ch == '\t')
+            return nextTabCol(startState);
+        return startState+charColumns(ch);
+    }
+
+    /** Calculate (lines, columns) from startNode inclusive to stopNode (exclusive).
+     * @param startNode origin - the zero/start location
+     * @param stopNode the goal/end location
+     * @return {@code lines<<32|columns<<1|(stopSeen?1:0)}
+     */
+    public long delta2D(Node startNode, Node stopNode) {
+        //WTDebug.println("delta2D start:"+WTDebug.pnode(startNode)+" stop:"+WTDebug.pnode(stopNode));
+        return delta2D(startNode, 0, stopNode);
+    }
+    protected long delta2D(Node startNode, long startDelta, Node stopNode) {
+        //WTDebug.println("delta2Dr start:"+WTDebug.pnode(startNode)+" stD:"+(startDelta>>32)+"/"+((startDelta>>1)&0x7fffffff)+"?"+(startDelta&1)+" stop:"+WTDebug.pnode(stopNode));
+        long delta = startDelta;
+        if (startNode == stopNode)
+            return delta|1;
+        if (startNode instanceof Text) {
+            Text tnode = (Text) startNode;
+            String text = tnode.getTextContent();
+            int tlen = text.length();
+            int line = (int) (delta >> 32);
+            int col = ((int) delta) >> 1;
+            for (int i = 0; i < tlen;  i++) {
+                char ch = text.charAt(i);
+
+                col = updateColumn(ch, col);
+                if (col > columnWidth) {
+                    line++;
+                    col = updateColumn(ch, 0);
+                }
+                else if (col == -1) {
+                    line++;
+                    col = 0;
+                    if (ch == '\r' && i+1<tlen && text.charAt(i+1) == '\n')
+                        i++;
+                }
+            }
+            return ((long)line << 32)|((long) col << 1);
+        }
+        if (isBreakNode(startNode)) {
+            return ((delta >> 32) + 1) << 32;
+        }
+        if (startNode instanceof Element) {
+            if (isObjectElement((Element) startNode)) {
+                // FIXME
+            }
+            for (Node n = startNode.getFirstChild(); n != null;
+                 n = n.getNextSibling()) {
+                delta = delta2D(n, delta, stopNode);
+                if ((delta & 1) != 0)
+                    return delta;
+            }
+            if (isBlockNode(startNode))
+                delta = ((delta >> 32) + 1) << 32;
+        }
+        return delta;
+    }
+
+    public static String makeSpaces(int count) {
+        StringBuilder builder = new StringBuilder(count);
+        for (; count >= 8; count -= 8)
+            builder.append("        ");
+        while (--count >= 0)
+            builder.append(' ');
+        return builder.toString();
+    }
+
+  public static String toString(org.w3c.dom.NodeList ich)
+  {
+    if (ich.getLength() == 1)
+      {
+        org.w3c.dom.Node n = (org.w3c.dom.Node) ich.item(0);
+        if (n instanceof Text)
+          return '\"' + WTDebug.toQuoted(((Text) n).getData()) + '\"';
+        else
+          return n.toString();
+      }
+    else
+      return ""+ich.getLength()+"items";
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/src/webterminal/WebWriter.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2011, 2014 Oracle and/or its affiliates.
+ * All rights reserved. Use is subject to license terms.
+ *
+ * This file is available and licensed under the following license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  - Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the distribution.
+ *  - Neither the name of Oracle Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package webterminal;
+
+/** A Writer that inserts the written text into a WebTerminal.
+ */
+
+public class WebWriter extends java.io.Writer
+{
+    WebTerminal terminal;
+
+    StringBuilder sbuf = new StringBuilder();
+    char kind;
+
+    /** Which port is this?
+     * @return 'O': if output; 'E': if error stream; 'P': if prompt text
+     */
+    public char getKind() { return kind; }
+
+    public WebWriter (WebTerminal terminal, char kind) {
+        this.terminal = terminal;
+        this.kind = kind;
+    }
+
+    public synchronized void write (int x) {
+        sbuf.append((char) x);
+        //WebTerminal.origErr.println("after write1 "+WebTerminal.toQuoted(sbuf.toString()));
+        if (x == '\n')
+            flush();
+    }
+
+    public void write (String str) {
+        sbuf.append(str);
+        //WebTerminal.origErr.println("after writeS "+WebTerminal.toQuoted(sbuf.toString()));
+        flush();
+    }
+
+    public synchronized void write (char[] data, int off, int len) {
+        sbuf.append(data, off, len);
+        //WebTerminal.origErr.println("after writeN "+WebTerminal.toQuoted(sbuf.toString()));
+        flush();
+    }
+
+    public synchronized void flush() {
+        StringBuilder s = sbuf;
+        //WebTerminal.origErr.println("WebWr.flush "+WebTerminal.toQuoted(sbuf.toString()));
+
+        if (s.length() > 0) {
+            // FIXME optimize by passing sbuf to insertOutput?
+            terminal.insertOutput(s.toString(), kind);
+            s.setLength(0);
+        }
+    }
+
+    public void close () {
+        flush();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/src/webterminal/repl.html	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,22 @@
+<html>
+<head>
+<title>WebTerminal</title>
+<style type="text/css">
+ body { font-family: monospace }
+ span[std="output"] { }
+ span[std="error"] { color: red; }
+ span[std="prompt"] { color: green; margin: 0px; padding: 0px; border: 1px }
+ span[std="input"] { font-weight: bolder; color: blue }
+ input[std="input"] { font-weight: bolder; }
+ input[std="input"] {
+        border: 0px;
+	margin: 0px;
+	padding: 0px;
+  right: 0px;
+  width: auto;
+  left: auto;
+}
+</style>
+</head>
+<body id="body" ><pre id="initial"></pre></body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/src/webterminal/repl.xml	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>WebTerminal</title>
+<style type="text/css">
+ span[std="output"] { }
+ span[std="error"] { color: red; }
+ span[std="prompt"] { color: purple; margin: 0px; padding: 0px; border: 1px }
+ span[std="input"] { font-weight: bolder; color: blue }
+ input[std="input"] { font-weight: bolder; }
+ input[std="input"] {
+        border: 0px;
+	margin: 0px;
+	padding: 0px;
+  right: 0px;
+  width: auto;
+  left: auto;
+}
+</style>
+</head>
+<body id="body"><pre id="initial"></pre></body>
+</html>
Binary file apps/experiments/WebTerminal/terminfo/j/jfxterm has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/terminfo/j/jfxterm.ti	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,72 @@
+jfxterm|JavaFX WebNode terminal emulator,
+	colors#8,
+	cols#80,
+	lines#24,
+	pairs#64,
+	am,
+	mir,
+	msgr,
+	xenl,
+#	bel=^G,
+	bold=\E[1m,
+	clear=\E[H\E[J,
+	cr=\r,
+	csr=\E[%i%p1%d;%p2%dr,
+	cub1=\b,
+	cub=\E[%p1%dD,
+	cud1=\n,
+	cud=\E[%p1%dB,
+	cuf1=\E[C,
+	cuf=\E[%p1%dC,
+	cup=\E[%i%p1%d;%p2%dH,
+	cuu1=\E[A,
+	cuu=\E[%p1%dA,
+	dch1=\E[P,
+	dch=\E[%p1%dP,
+	dl1=\E[M,
+	dl=\E[%p1%dM,
+	ed=\E[J,
+	el1=\E[1K,
+	el=\E[K,
+	home=\E[H,
+	ht=\t,
+	ich1=\E[@,
+	ich=\E[%p1%d@,
+	il1=\E[L,
+	il=\E[%p1%dL,
+	ind=\n,
+        indn=\E[%p1%dS,
+#	invis=\E[8m,
+#	kbs=^?,
+	kcub1=\EOD,
+	kcud1=\EOB,
+	kcuf1=\EOC,
+	kcuu1=\EOA,
+	kdch1=\E[3~,
+	kend=\E[4~,
+	khome=\E[1~,
+	kich1=\E[2~,
+	knp=\E[6~,
+	kpp=\E[5~,
+	op=\E[39;49m,
+	rc=\E8,
+	rev=\E[7m,
+	ri=\EM,
+        rin=\E[%p1%dT,
+	rmir=\E[4l,
+	rmso=\E[27m,
+	rmul=\E[24m,
+#	rs1=\Ec,
+	sc=\E7,
+	setab=\E[%p1%{40}%+%dm,
+	setaf=\E[%p1%{30}%+%dm,
+	sgr0=\E[m,
+	smir=\E[4h,
+	smul=\E[4m,
+ 	smso=\E[7m,
+# 	u6=\E[%i%d;%dR,
+# 	u7=\E[6n,
+	smcup=\E[?47h,
+	rmcup=\E[?47l,
+        vpa=\E[%i%p1%dd,
+#       rs2 may need to be added
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/terminfo/j/xjfxterm.ti	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,11 @@
+jfxterm|JavaFX WebNode terminal enulator,
+	cols#80,
+        lines#24,
+	cr=\r,
+        cub1=\b,
+        cub=\E[%p1%dD,
+#	cuf1=\E[C,
+#	cuf=\E[%p1%dC,
+	home=\E[H,
+        cup=\E[%i%p1%d;%p2%dH,
+        home=\E[H,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/util/hcat	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,3 @@
+echo -n "]72;"
+cat
+echo -n ""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/experiments/WebTerminal/util/myemacs	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,7 @@
+# Convenience command to run emacs with working TERM and TERMINFO
+case "$0" in 
+  /* ) cmd="$0";;
+  *)   cmd=`pwd`/"$0";;
+esac
+dir=`dirname $cmd`
+TERMINFO=$dir/../terminfo TERM=jfxterm /usr/bin/emacs -nw "$@"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/toys/Hello/src/main/java/a11y/HelloPasswordField.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 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 a11y;
+
+import javafx.application.Application;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+import javafx.scene.control.PasswordField;
+import javafx.scene.layout.VBox;
+import javafx.stage.Stage;
+
+public class HelloPasswordField extends Application {
+
+
+    public static void main(String[] args) {
+        Application.launch(args);
+    }
+
+    @Override public void start(Stage stage) {
+
+        Label label = new Label("secret name:");
+        PasswordField pf = new PasswordField();
+        label.setLabelFor(pf);
+        pf.setText("senha");
+        Button button = new Button("push");
+        Scene scene = new Scene(new VBox(label, pf, button), 300, 300);
+        stage.setScene(scene);
+        stage.show();
+    }
+
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/toys/Hello/src/main/java/a11y/HelloSimpleCheckBox.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 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 a11y;
+
+import javafx.application.Application;
+import javafx.beans.binding.Bindings;
+import javafx.geometry.Pos;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.CheckBox;
+import javafx.scene.control.Label;
+import javafx.scene.layout.VBox;
+import javafx.scene.paint.Color;
+import javafx.stage.Stage;
+
+public class HelloSimpleCheckBox extends Application {
+        
+    @Override public void start(Stage stage) {
+        CheckBox cbox = new CheckBox("Choose this item");
+        cbox.setIndeterminate(true);
+        cbox.setAllowIndeterminate(true);
+
+        Label label = new Label();
+        label.textProperty().bind(
+                Bindings.when(cbox.indeterminateProperty()).
+                        then("The check box is indeterminate").
+                        otherwise(
+                                Bindings.when(cbox.selectedProperty()).
+                                        then("The check box is selected").
+                                        otherwise("The check box is not selected"))
+        );
+
+        VBox vbox = new VBox(7);
+        vbox.setAlignment(Pos.CENTER);
+        vbox.getChildren().addAll(label, cbox, new Button("OK"));
+        
+        Scene scene = new Scene(vbox, 400, 400);
+        scene.setFill(Color.SKYBLUE);
+        stage.setTitle("Hello CheckBox");
+        stage.setScene(scene);
+        stage.show();
+    }
+
+    public static void main(String[] args) {
+        Application.launch(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/toys/Hello/src/main/java/a11y/HelloSimpleListView.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 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 a11y;
+
+
+import javafx.application.Application;
+import javafx.beans.InvalidationListener;
+import javafx.beans.Observable;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.ListView;
+import javafx.scene.layout.VBox;
+import javafx.stage.Stage;
+
+public class HelloSimpleListView extends Application {
+
+    public void start(Stage stage) {
+        stage.setTitle(getClass().getSimpleName());
+        ListView<String> listView = new ListView<>();
+        ObservableList<String> list = FXCollections.observableArrayList();
+        for (int i=0; i<128; i++) {
+            list.add("JavaFX item " + i);
+        }
+        listView.setItems(list);
+        listView.getSelectionModel().selectedIndexProperty().addListener(new InvalidationListener() {
+            public void invalidated(Observable ov) {
+                System.out.println("SelectedIndex: " + listView.getSelectionModel().getSelectedIndex());
+            }
+        });
+
+        Button button = new Button("okay");
+        VBox group = new VBox(listView, button);
+        stage.setScene(new Scene(group, 800, 600));
+        stage.show();
+    }
+    
+    public static void main(String[] args) {
+        launch(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/toys/Hello/src/main/java/a11y/HelloSimpleTableView.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 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 a11y;
+
+import javafx.application.Application;
+import javafx.beans.InvalidationListener;
+import javafx.beans.Observable;
+import javafx.beans.binding.When;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.scene.Scene;
+import javafx.scene.control.SelectionMode;
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.TableView;
+import javafx.scene.control.ToggleButton;
+import javafx.scene.control.cell.PropertyValueFactory;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.VBox;
+import javafx.stage.Stage;
+import javafx.scene.input.KeyCode;
+
+public class HelloSimpleTableView extends Application {
+    
+    public class Item {
+        public String item;
+        public Item (String item) {
+            this.item = item;
+        }
+        public String getItem() {
+            return item;
+        }
+        public String getEmail() {
+            return item+"@oracle.com";
+        }
+    }
+
+    public void start(Stage stage) {
+        stage.setTitle(getClass().getSimpleName());
+        TableView<Item> tableView = new TableView<>();
+        ObservableList<Item> list = FXCollections.observableArrayList();
+        for (int i=0; i<128; i++) {
+            list.add(new Item("Item " + i));
+        }
+        tableView.setItems(list);
+        TableColumn<Item, String> column1 = new TableColumn<>("Name");
+        column1.setPrefWidth(100);
+        column1.setCellValueFactory(new PropertyValueFactory<Item, String>("item"));
+        TableColumn<Item, String> column2 = new TableColumn<>("Email");
+        column2.setPrefWidth(250);
+        column2.setCellValueFactory(new PropertyValueFactory<Item, String>("email"));
+        tableView.getColumns().addAll(column1, column2);
+        tableView.getSelectionModel().selectedIndexProperty().addListener(new InvalidationListener() {
+            public void invalidated(Observable ov) {
+                System.out.println("SelectedIndex: " + tableView.getSelectionModel().getSelectedIndex());
+            }
+        });
+        
+        ToggleButton button1 = new ToggleButton("cell selection");
+        tableView.getSelectionModel().cellSelectionEnabledProperty().bind(button1.selectedProperty());
+        ToggleButton button2 = new ToggleButton("multi selection");
+        tableView.getSelectionModel().selectionModeProperty().bind(new When(button2.selectedProperty()).then(SelectionMode.MULTIPLE).otherwise(SelectionMode.SINGLE));
+        ToggleButton button3 = new ToggleButton("parented");
+        VBox group = new VBox(new HBox(button1, button2, button3), tableView);
+        button3.setOnAction(e -> {
+            if (group.getChildren().contains(tableView)) {
+                group.getChildren().remove(tableView);
+            } else {
+                group.getChildren().add(tableView);
+            }
+        });
+        
+        Scene scene = new Scene(group, 800, 600);
+        scene.setOnKeyPressed(l -> {
+            if (l.getCode() == KeyCode.DIGIT1) {
+                button1.setSelected(!button1.isSelected());
+            }
+            if (l.getCode() == KeyCode.DIGIT2) {
+                button2.setSelected(!button2.isSelected());
+            }
+        });
+        stage.setScene(scene);
+        stage.show();
+    }
+    
+    public static void main(String[] args) {
+        launch(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/toys/Hello/src/main/java/a11y/HelloSimpleTreeTableView.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 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 a11y;
+
+import javafx.application.Application;
+import javafx.beans.InvalidationListener;
+import javafx.beans.Observable;
+import javafx.beans.binding.When;
+import javafx.scene.Scene;
+import javafx.scene.control.*;
+import javafx.scene.control.cell.TreeItemPropertyValueFactory;
+import javafx.scene.input.KeyCode;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.VBox;
+import javafx.stage.Stage;
+
+public class HelloSimpleTreeTableView extends Application {
+    
+    public class Item {
+        public String item;
+        public Item (String item) {
+            this.item = item;
+        }
+        public String getItem() {
+            return item;
+        }
+        public String getEmail() {
+            return item+"@oracle.com";
+        }
+    }
+
+    public void start(Stage stage) {
+        TreeTableView<Item> tableView = new TreeTableView<>();
+        TreeItem<Item> root = new TreeItem<>(new Item("Root"));
+        root.setExpanded(true);
+        for (int i=0; i<128; i++) {
+            root.getChildren().add(new TreeItem(new Item("Item " + i)));
+        }
+        tableView.setRoot(root);
+        TreeTableColumn<Item, String> column1 = new TreeTableColumn<>("Name");
+        column1.setPrefWidth(100);
+        column1.setCellValueFactory(new TreeItemPropertyValueFactory<>("item"));
+        TreeTableColumn<Item, String> column2 = new TreeTableColumn<>("Email");
+        column2.setPrefWidth(250);
+        column2.setCellValueFactory(new TreeItemPropertyValueFactory<>("email"));
+        tableView.getColumns().addAll(column1, column2);
+        tableView.getSelectionModel().selectedIndexProperty().addListener(new InvalidationListener() {
+            public void invalidated(Observable ov) {
+                System.out.println("SelectedIndex: " + tableView.getSelectionModel().getSelectedIndex());
+            }
+        });
+        
+        ToggleButton button1 = new ToggleButton("cell selection");
+        tableView.getSelectionModel().cellSelectionEnabledProperty().bind(button1.selectedProperty());
+        ToggleButton button2 = new ToggleButton("multi selection");
+        tableView.getSelectionModel().selectionModeProperty().bind(new When(button2.selectedProperty()).then(SelectionMode.MULTIPLE).otherwise(SelectionMode.SINGLE));
+        ToggleButton button3 = new ToggleButton("parented");
+        VBox group = new VBox(new HBox(button1, button2, button3), tableView);
+        button3.setOnAction(e -> {
+            if (group.getChildren().contains(tableView)) {
+                group.getChildren().remove(tableView);
+            } else {
+                group.getChildren().add(tableView);
+            }
+        });
+        
+        Scene scene = new Scene(group, 800, 600);
+        scene.setOnKeyPressed(l -> {
+            if (l.getCode() == KeyCode.DIGIT1) {
+                button1.setSelected(!button1.isSelected());
+            }
+            if (l.getCode() == KeyCode.DIGIT2) {
+                button2.setSelected(!button2.isSelected());
+            }
+        });
+        stage.setScene(scene);
+        stage.show();
+    }
+    
+    public static void main(String[] args) {
+        launch(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/toys/Hello/src/main/java/a11y/HelloSimpleTreeView.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 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 a11y;
+
+
+import javafx.application.Application;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+import javafx.scene.control.TreeItem;
+import javafx.scene.control.TreeView;
+import javafx.scene.layout.VBox;
+import javafx.stage.Stage;
+
+public class HelloSimpleTreeView extends Application {
+
+    public void start(Stage stage) {
+        
+        TreeItem<String> root = new TreeItem<>("Root node");
+        for (int i = 0; i < 200; i++) {
+            TreeItem<String> item = new TreeItem<>("Child node " + i);
+            root.getChildren().add(item);
+            if ((i % 3) == 0) {
+                for (int j = 0; j < 5; j++) {
+                    TreeItem<String> sitem = new TreeItem<>("sub item " + i + " " + j);
+                    item.getChildren().add(sitem);
+                }
+                if ((i % 2) == 0) item.setExpanded(true);
+            }
+        }
+        root.setExpanded(true);
+        TreeView<String> treeView = new TreeView<>(root);
+        Label label = new Label("JFX TreeView");
+        label.setLabelFor(treeView);
+        Button button = new Button("okay");
+        VBox group = new VBox(label, treeView, button);
+        stage.setScene(new Scene(group, 800, 600));
+        stage.show();
+    }
+    
+    public static void main(String[] args) {
+        launch(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/toys/Hello/src/main/java/a11y/HelloTabPane.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 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 a11y;
+
+import javafx.application.Application;
+import javafx.beans.InvalidationListener;
+import javafx.beans.Observable;
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
+import javafx.geometry.Side;
+import javafx.scene.Group;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.Tab;
+import javafx.scene.control.TabPane;
+import javafx.scene.control.ToggleButton;
+import javafx.scene.control.ToggleGroup;
+import javafx.scene.control.Tooltip;
+import javafx.scene.layout.Region;
+import javafx.scene.layout.VBox;
+import javafx.scene.paint.Color;
+import javafx.stage.Stage;
+
+public class HelloTabPane extends Application {
+
+    private TabPane tabPane;
+    private Tab tab1;
+    private Tab tab2;
+    private Tab tab3;
+
+    public static void main(String[] args) {
+        Application.launch(args);
+    }
+
+    @Override public void start(Stage stage) {
+        tabPane = new TabPane();
+        tab1 = new Tab();
+        tab2 = new Tab();
+        tab3 = new Tab();
+        stage.setTitle("Hello TabPane");
+        final Scene scene = new Scene(new Group(), 400, 400);
+        scene.setFill(Color.GHOSTWHITE);
+
+
+        tabPane.prefWidthProperty().bind(scene.widthProperty());
+        tabPane.prefHeightProperty().bind(scene.heightProperty());
+
+        tabPane.setRotateGraphic(false);
+        tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.SELECTED_TAB);
+        tabPane.setSide(Side.TOP);
+
+        {
+            tab1.setText("Tab 1");
+            tab1.setTooltip(new Tooltip("Tab 1 Tooltip"));
+
+            final VBox vbox = new VBox();
+            vbox.setSpacing(10);
+            vbox.setTranslateX(10);
+            vbox.setTranslateY(10);
+            {
+                final Button b = new Button("Toggle Tab Mode");
+                b.setOnAction(new EventHandler<ActionEvent>() {
+                    @Override public void handle(ActionEvent e) {
+                        toggleTabMode(tabPane);
+                    }
+                });
+                vbox.getChildren().add(b);
+            }
+            {
+                final Button b = new Button("Toggle Tab Position");
+                b.setOnAction(new EventHandler<ActionEvent>() {
+                    @Override public void handle(ActionEvent e) {
+                        toggleTabPosition(tabPane);
+                    }
+                });
+                vbox.getChildren().add(b);
+            }
+            {
+                final Button b = new Button("Switch to Empty Tab");
+                b.setOnAction(new EventHandler<ActionEvent>() {
+                    @Override public void handle(ActionEvent e) {
+                    }
+                });
+                vbox.getChildren().add(b);
+            }
+            {
+                final Button b = new Button("Switch to New Tab");
+                b.setOnAction(new EventHandler<ActionEvent>() {
+                    @Override public void handle(ActionEvent e) {
+                        Tab t = new Tab();
+                        t.setText("Testing");
+                        t.setContent(new Button("Howdy"));
+                        tabPane.getTabs().add(t);
+                        tabPane.getSelectionModel().select(t);
+                    }
+                });
+                vbox.getChildren().add(b);
+            }
+            {
+                final Button b = new Button("Add Tab");
+                b.setOnAction(new EventHandler<ActionEvent>() {
+                    @Override public void handle(ActionEvent e) {
+                        Tab t = new Tab();
+                        t.setText("New Tab");
+                        t.setContent(new Region());
+                        tabPane.getTabs().add(t);
+                    }
+                });
+                vbox.getChildren().add(b);
+            }
+            {
+                final Button b = new Button("Toggle Popup on Empty Tab");
+                b.setOnAction(new EventHandler<ActionEvent>() {
+                    @Override public void handle(ActionEvent e) {}
+                });
+                vbox.getChildren().add(b);
+            }
+            {
+                ToggleButton tb = new ToggleButton("Show scroll arrows");
+                vbox.getChildren().add(tb);
+            }
+            {
+                ToggleButton tb = new ToggleButton("Show Tab Menu Button");
+                vbox.getChildren().add(tb);
+            }
+            tab1.setContent(vbox);
+            tabPane.getTabs().add(tab1);
+        }
+        {
+            tab2.setText("Longer Tab");
+            final VBox vbox = new VBox();
+            vbox.setSpacing(10);
+            vbox.setTranslateX(10);
+            vbox.setTranslateY(10);
+
+            final ToggleGroup closingPolicy = new ToggleGroup();
+            for (TabPane.TabClosingPolicy policy: TabPane.TabClosingPolicy.values()) {
+                final ToggleButton button = new ToggleButton(policy.name());
+                button.setToggleGroup(closingPolicy);
+                button.selectedProperty().addListener(new InvalidationListener() {
+                    public void invalidated(Observable ov) {
+                        tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.valueOf(button.getText()));
+                    }
+                });
+                vbox.getChildren().add(button);
+            }
+
+            final ToggleButton rotateGraphics = new ToggleButton("Rotate Graphics");
+            rotateGraphics.selectedProperty().addListener(new InvalidationListener() {
+                    public void invalidated(Observable ov) {
+                    tabPane.setRotateGraphic(rotateGraphics.isSelected());
+                }
+            });
+            vbox.getChildren().add(rotateGraphics);
+
+            tab2.setContent(vbox);
+            tabPane.getTabs().add(tab2);
+        }
+        {
+            tab3.setText("Tab 3");
+            final VBox vbox = new VBox();
+            vbox.setSpacing(10);
+            vbox.setTranslateX(10);
+            vbox.setTranslateY(10);
+            {
+                final ToggleButton tb = new ToggleButton("Show Labels");
+                tb.setSelected(true);
+                tb.selectedProperty().addListener(new InvalidationListener() {
+                    public void invalidated(Observable ov) {
+                        if (tb.isSelected()) {
+                            tab1.setText("Tab 1");
+                            tab2.setText("Tab 2");
+                            tab3.setText("Tab 3");
+                        } else {
+                            tab1.setText("");
+                            tab2.setText("");
+                            tab3.setText("");
+                        }
+                    }
+                });
+                vbox.getChildren().add(tb);
+            }
+            {
+                final ToggleButton tb = new ToggleButton("Big Graphic 1");
+                vbox.getChildren().add(tb);
+            }
+            {
+                final ToggleButton tb = new ToggleButton("Big Graphic 2");
+                vbox.getChildren().add(tb);
+            }
+            {
+                final ToggleButton tb = new ToggleButton("Big Graphic 3");
+                vbox.getChildren().add(tb);
+            }
+            tab3.setContent(vbox);
+            tabPane.getTabs().add(tab3);
+        }
+        {
+            Tab tab = new Tab();
+            tab.setText("Tab 4");
+            tab.setClosable(false);
+            tab.setContent(new Region());
+            tabPane.getTabs().add(tab);
+        }
+
+        ((Group)scene.getRoot()).getChildren().add(tabPane);
+        stage.setScene(scene);
+        stage.show();
+    }
+
+
+    private void toggleTabPosition(TabPane tabPane) {
+        Side pos = tabPane.getSide();
+        if (pos == Side.TOP) {
+            tabPane.setSide(Side.RIGHT);
+        } else if (pos == Side.RIGHT) {
+            tabPane.setSide(Side.BOTTOM);
+        } else if (pos == Side.BOTTOM) {
+            tabPane.setSide(Side.LEFT);
+        } else {
+            tabPane.setSide(Side.TOP);
+        }
+    }
+
+    private void toggleTabMode(TabPane tabPane) {
+        if (!tabPane.getStyleClass().contains(TabPane.STYLE_CLASS_FLOATING)) {
+            tabPane.getStyleClass().add(TabPane.STYLE_CLASS_FLOATING);
+        } else {
+            tabPane.getStyleClass().remove(TabPane.STYLE_CLASS_FLOATING);
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/toys/Hello/src/main/java/a11y/HelloText.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 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 a11y;
+
+import javafx.application.Application;
+import javafx.scene.Scene;
+import javafx.scene.control.TextField;
+import javafx.scene.layout.VBox;
+import javafx.scene.paint.Color;
+import javafx.scene.text.Font;
+import javafx.scene.text.Text;
+import javafx.stage.Stage;
+
+public class HelloText extends Application {
+
+
+    public static void main(String[] args) {
+        Application.launch(args);
+    }
+
+    @Override public void start(Stage stage) {
+
+        final Text text = new Text("01234");
+        text.impl_selectionFillProperty().set(Color.BLUE);
+        text.setFont(Font.font(50));
+
+
+        TextField tf = new TextField("Hello Accessiblity");
+
+
+        Scene scene = new Scene(new VBox(text, tf, new Text("Text 2"), new TextField("text field 2")), 300, 300);
+//        scene.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
+//            @Override
+//            public void handle(KeyEvent event) {
+//                int start = text.getImpl_selectionStart();
+//                int end = text.getImpl_selectionEnd();
+//                if (start == -1) start = 0;
+//                if (end == -1) end = text.getText().length();
+//                switch (event.getCode()) {
+//                case LEFT: start--; break;
+//                case RIGHT: start++; break;
+//                case UP: end--; break;
+//                case DOWN: end++; break;
+//                default:
+//                }
+//                text.setImpl_selectionStart(start);
+//                text.setImpl_selectionEnd(end);
+////                System.out.println(start + " " + end);
+//            }
+//        });
+        stage.setScene(scene);
+        stage.show();
+    }
+
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/toys/Hello/src/main/java/a11y/HelloToolBar.java	Wed Mar 19 13:06:06 2014 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 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 a11y;
+
+import javafx.application.Application;
+import javafx.geometry.Orientation;
+import javafx.scene.Scene;
+import javafx.scene.control.Button;
+import javafx.scene.control.ToolBar;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.VBox;
+import javafx.stage.Stage;
+
+public class HelloToolBar extends Application {
+    public static void main(String[] args) {
+        Application.launch(args);
+    }
+
+    @Override public void start(Stage stage) {
+        stage.setTitle("ToolBar");
+        final VBox box = new VBox(10);
+        final Scene scene = new Scene(box, 500, 500);
+
+        final ToolBar tb = new ToolBar();
+        tb.setOrientation(Orientation.HORIZONTAL);
+        for (int i=0; i< 12; i++) {
+            tb.getItems().add(new Button("button " + i));
+        }
+
+        final ToolBar tb2 = new ToolBar();
+        tb2.setOrientation(Orientation.VERTICAL);
+        for (int i=0; i< 12; i++) {
+            tb2.getItems().add(new Button("button " + i));
+        }
+
+        box.getChildren().add(tb);
+
+        HBox hbox = new HBox();
+        hbox.getChildren().add(tb2);
+        box.getChildren().add(hbox);
+
+        stage.setScene(scene);
+        stage.show();
+    }
+}
--- a/build.gradle	Wed Mar 19 08:57:26 2014 -0700
+++ b/build.gradle	Wed Mar 19 13:06:06 2014 -0700
@@ -343,7 +343,7 @@
 ext.IS_FULL_TEST = Boolean.parseBoolean(FULL_TEST);
 
 // Specifies whether to run robot-based visual tests (only used when FULL_TEST is also enabled)
-defineProperty("USE_ROBOT", "true")
+defineProperty("USE_ROBOT", "false")
 ext.IS_USE_ROBOT = Boolean.parseBoolean(USE_ROBOT);
 
 // Specified whether to run tests in headless mode
@@ -808,6 +808,7 @@
             }
             if (properties.javahClasspath == null) {
                 classpath = project.files(project.sourceSets.main.output.classesDir)
+                classpath += project.sourceSets.main.compileClasspath
             } else {
                 classpath = project.files(properties.javahClasspath)
             }
@@ -1111,7 +1112,7 @@
     // entire SDK, a different javadoc command is used (see the javadoc task on the top level)
     javadoc {
         enabled = IS_BUILD_JAVADOC
-        exclude("com/**/*", "javafx/scene/ParentDesignInfo*", "Compile*", "javafx/builder/**/*");
+        exclude("com/**/*", "javafx/scene/ParentDesignInfo*", "Compile*", "javafx/builder/**/*", "javafx/scene/accessibility/**/*");
         executable = JAVADOC;
         options.windowTitle("JavaFX Project ${project.name} ${RELEASE_NAME}")
         options.links(JDK_DOCS);
@@ -2388,7 +2389,7 @@
     classpath += files(projectsToDocument.collect { project ->
         project.sourceSets.main.output
     });
-    exclude("com/**/*", "javafx/scene/ParentDesignInfo*", "Compile*", "javafx/builder/**/*");
+    exclude("com/**/*", "javafx/scene/ParentDesignInfo*", "Compile*", "javafx/builder/**/*", "javafx/scene/accessibility/**/*");
     options.windowTitle("${javadocTitle}")
     options.header("${javadocHeader}")
     options.bottom("${javadocBottom}")
--- a/buildSrc/android.gradle	Wed Mar 19 08:57:26 2014 -0700
+++ b/buildSrc/android.gradle	Wed Mar 19 13:06:06 2014 -0700
@@ -338,14 +338,12 @@
 ANDROID.jfxrtJarExcludes = [
     "**/*.hlsl",
     "com/sun/glass/ui/win",
-    "com/sun/glass/ui/accessible/win",
     "com/sun/prism/d3d",
     "com/sun/prism/es2/gl/win",
     "com/sun/prism/null3d",
     "com/sun/scenario/effect/impl/hw/d3d",
     "com/sun/glass/events/mac",
     "com/sun/glass/ui/mac",
-    "com/sun/glass/ui/accessible/mac",
     "com/sun/prism/es2/gl/mac",
     "com/sun/glass/ui/gtk",
     "com/sun/glass/ui/ios",
--- a/buildSrc/armv6hf.gradle	Wed Mar 19 08:57:26 2014 -0700
+++ b/buildSrc/armv6hf.gradle	Wed Mar 19 13:06:06 2014 -0700
@@ -85,7 +85,6 @@
 ARMV6HF.jfxrtJarExcludes = [
     "**/*.hlsl",
     "com/sun/glass/ui/win",
-    "com/sun/glass/ui/accessible/win",
     "com/sun/prism/d3d",
     "com/sun/prism/es2/gl/win",
     //"com/sun/prism/null3d",
@@ -93,7 +92,6 @@
     
     "com/sun/glass/events/mac",
     "com/sun/glass/ui/mac",
-    "com/sun/glass/ui/accessible/mac",
     "com/sun/prism/es2/gl/mac",
     
     "com/sun/glass/ui/android",
@@ -345,11 +343,11 @@
     "com/sun/glass/ui/lens/*",
     "com/sun/glass/ui/monocle/*",
     "com/sun/glass/ui/monocle/dispman/*",
+    "com/sun/glass/ui/monocle/mx6/*",
     "com/sun/glass/ui/monocle/linux/*",
     "com/sun/glass/ui/monocle/util/*",
     "com/sun/glass/ui/monocle/x11/*",
-    "com/sun/glass/ui/gtk/*",
-    "com/sun/glass/ui/accessible/gtk/*"]
+    "com/sun/glass/ui/gtk/*"]
 ARMV6HF.glass.lib = "glass"
 
 ARMV6HF.glass.lensport = [:]
@@ -366,6 +364,7 @@
 ARMV6HF.glass.monocle.nativeSource = [
         file("modules/graphics/src/main/native-glass/monocle"),
         file("modules/graphics/src/main/native-glass/monocle/dispman"),
+        file("modules/graphics/src/main/native-glass/monocle/mx6"),
         file("modules/graphics/src/main/native-glass/monocle/linux"),
         file("modules/graphics/src/main/native-glass/monocle/util") ]
 ARMV6HF.glass.monocle.compiler = compiler
--- a/buildSrc/armv6sf.gradle	Wed Mar 19 08:57:26 2014 -0700
+++ b/buildSrc/armv6sf.gradle	Wed Mar 19 13:06:06 2014 -0700
@@ -75,7 +75,6 @@
 ARMV6SF.jfxrtJarExcludes = [
     "**/*.hlsl",
     "com/sun/glass/ui/win",
-    "com/sun/glass/ui/accessible/win",
     "com/sun/prism/d3d",
     "com/sun/prism/es2/gl/win",
     //"com/sun/prism/null3d",
@@ -83,7 +82,6 @@
     
     "com/sun/glass/events/mac",
     "com/sun/glass/ui/mac",
-    "com/sun/glass/ui/accessible/mac",
     "com/sun/prism/es2/gl/mac",
         
     "com/sun/glass/ui/android",
@@ -353,8 +351,7 @@
     "com/sun/glass/ui/monocle/linux/*",
     "com/sun/glass/ui/monocle/util/*",
     "com/sun/glass/ui/monocle/x11/*",
-    "com/sun/glass/ui/gtk/*",
-    "com/sun/glass/ui/accessible/gtk/*"]
+    "com/sun/glass/ui/gtk/*"]
 ARMV6SF.glass.lib = "glass"
 
 ARMV6SF.glass.lensport = [:]
--- a/buildSrc/armv7hft.gradle	Wed Mar 19 08:57:26 2014 -0700
+++ b/buildSrc/armv7hft.gradle	Wed Mar 19 13:06:06 2014 -0700
@@ -85,7 +85,6 @@
 ARMV7HFT.jfxrtJarExcludes = [
     "**/*.hlsl",
     "com/sun/glass/ui/win",
-    "com/sun/glass/ui/accessible/win",
     "com/sun/prism/d3d",
     "com/sun/prism/es2/gl/win",
     //"com/sun/prism/null3d",
@@ -93,7 +92,6 @@
     
     "com/sun/glass/events/mac",
     "com/sun/glass/ui/mac",
-    "com/sun/glass/ui/accessible/mac",
     "com/sun/prism/es2/gl/mac",
     
     "com/sun/glass/ui/android",
@@ -344,8 +342,7 @@
     "com/sun/glass/ui/monocle/linux/*",
     "com/sun/glass/ui/monocle/util/*",
     "com/sun/glass/ui/monocle/x11/*",
-    "com/sun/glass/ui/gtk/*",
-    "com/sun/glass/ui/accessible/gtk/*"]
+    "com/sun/glass/ui/gtk/*"]
 ARMV7HFT.glass.lib = "glass"
 
 ARMV7HFT.glass.lensport = [:]
--- a/buildSrc/armv7sft.gradle	Wed Mar 19 08:57:26 2014 -0700
+++ b/buildSrc/armv7sft.gradle	Wed Mar 19 13:06:06 2014 -0700
@@ -75,7 +75,6 @@
 ARMV7SFT.jfxrtJarExcludes = [
     "**/*.hlsl",
     "com/sun/glass/ui/win",
-    "com/sun/glass/ui/accessible/win",
     "com/sun/prism/d3d",
     "com/sun/prism/es2/gl/win",
     //"com/sun/prism/null3d",
@@ -83,7 +82,6 @@
     
     "com/sun/glass/events/mac",
     "com/sun/glass/ui/mac",
-    "com/sun/glass/ui/accessible/mac",
     "com/sun/prism/es2/gl/mac",
         
     "com/sun/glass/ui/android",
@@ -353,8 +351,7 @@
     "com/sun/glass/ui/monocle/linux/*",
     "com/sun/glass/ui/monocle/util/*",
     "com/sun/glass/ui/monocle/x11/*",
-    "com/sun/glass/ui/gtk/*",
-    "com/sun/glass/ui/accessible/gtk/*"]
+    "com/sun/glass/ui/gtk/*"]
 ARMV7SFT.glass.lib = "glass"
 
 ARMV7SFT.glass.lensport = [:]
--- a/buildSrc/ios.gradle	Wed Mar 19 08:57:26 2014 -0700
+++ b/buildSrc/ios.gradle	Wed Mar 19 13:06:06 2014 -0700
@@ -64,7 +64,6 @@
 IOS.jfxrtJarExcludes = [
     "**/*.hlsl",
     "com/sun/glass/ui/win",
-    "com/sun/glass/ui/accessible/win",
     "com/sun/prism/d3d",
     "com/sun/prism/es2/gl/win",
     "com/sun/prism/null3d",
@@ -72,7 +71,6 @@
     
     "com/sun/glass/events/mac",
     "com/sun/glass/ui/mac",
-    "com/sun/glass/ui/accessible/mac",
     "com/sun/prism/es2/gl/mac",
     "com/sun/glass/ui/android",
     "com/sun/glass/ui/gtk",
--- a/buildSrc/linux.gradle	Wed Mar 19 08:57:26 2014 -0700
+++ b/buildSrc/linux.gradle	Wed Mar 19 13:06:06 2014 -0700
@@ -43,7 +43,6 @@
 LINUX.jfxrtJarExcludes = [
     "**/*.hlsl",
     "com/sun/glass/ui/win",
-    "com/sun/glass/ui/accessible/win",
     "com/sun/prism/d3d",
     "com/sun/prism/es2/gl/win",
     //"com/sun/prism/null3d", // TODO This is used in dev builds but not the final sdk
@@ -51,7 +50,6 @@
     
     "com/sun/glass/events/mac",
     "com/sun/glass/ui/mac",
-    "com/sun/glass/ui/accessible/mac",
     "com/sun/prism/es2/gl/mac",
         
     "com/sun/glass/ui/ios",
@@ -161,8 +159,7 @@
 LINUX.glass.javahInclude = [
     "com/sun/glass/events/**",
     "com/sun/glass/ui/*",
-    "com/sun/glass/ui/gtk/*",
-    "com/sun/glass/ui/accessible/gtk/*"]
+    "com/sun/glass/ui/gtk/*"]
 LINUX.glass.nativeSource = file("modules/graphics/src/main/native-glass/gtk")
 LINUX.glass.compiler = compiler
 LINUX.glass.ccFlags = [ccFlags].flatten()
--- a/buildSrc/mac.gradle	Wed Mar 19 08:57:26 2014 -0700
+++ b/buildSrc/mac.gradle	Wed Mar 19 13:06:06 2014 -0700
@@ -41,7 +41,6 @@
 MAC.jfxrtJarExcludes = [
     "**/*.hlsl",
     "com/sun/glass/ui/win",
-    "com/sun/glass/ui/accessible/win",
     "com/sun/prism/d3d",
     "com/sun/prism/es2/gl/win",
     //"com/sun/prism/null3d", // TODO This is used in dev builds but not the final sdk
@@ -101,8 +100,7 @@
 MAC.glass.javahInclude = [
     "com/sun/glass/events/**",
     "com/sun/glass/ui/*",
-    "com/sun/glass/ui/mac/*",
-    "com/sun/glass/ui/accessible/mac/*"]
+    "com/sun/glass/ui/mac/*"]
 MAC.glass.nativeSource = file("modules/graphics/src/main/native-glass/mac")
 MAC.glass.compiler = compiler
 MAC.glass.ccFlags = [ccFlags].flatten()
--- a/buildSrc/win.gradle	Wed Mar 19 08:57:26 2014 -0700
+++ b/buildSrc/win.gradle	Wed Mar 19 13:06:06 2014 -0700
@@ -40,7 +40,6 @@
 WIN.jfxrtJarExcludes = [
     "com/sun/glass/events/mac",
     "com/sun/glass/ui/mac",
-    "com/sun/glass/ui/accessible/mac",
     "com/sun/prism/es2/gl/mac",
     //"com/sun/prism/null3d", // TODO This is used in dev builds but not the final sdk
 
@@ -156,8 +155,7 @@
 WIN.glass.javahInclude = [
     "com/sun/glass/events/**",
     "com/sun/glass/ui/*",
-    "com/sun/glass/ui/win/*",
-    "com/sun/glass/ui/accessible/win/*"]
+    "com/sun/glass/ui/win/*"]
 WIN.glass.nativeSource = file("modules/graphics/src/main/native-glass/win")
 WIN.glass.compiler = compiler
 WIN.glass.rcCompiler = rcCompiler;
--- a/buildSrc/x86egl.gradle	Wed Mar 19 08:57:26 2014 -0700
+++ b/buildSrc/x86egl.gradle	Wed Mar 19 13:06:06 2014 -0700
@@ -77,7 +77,6 @@
 X86EGL.jfxrtJarExcludes = [
     "**/*.hlsl",
     "com/sun/glass/ui/win",
-    "com/sun/glass/ui/accessible/win",
     "com/sun/prism/d3d",
     "com/sun/prism/es2/gl/win",
     //"com/sun/prism/null3d",
@@ -85,7 +84,6 @@
     
     "com/sun/glass/events/mac",
     "com/sun/glass/ui/mac",
-    "com/sun/glass/ui/accessible/mac",
     "com/sun/prism/es2/gl/mac",
     
     "com/sun/glass/ui/android",
@@ -285,8 +283,7 @@
     "com/sun/glass/ui/monocle/linux/*",
     "com/sun/glass/ui/monocle/util/*",
     "com/sun/glass/ui/monocle/x11/*",
-    "com/sun/glass/ui/gtk/*",
-    "com/sun/glass/ui/accessible/gtk/*"]
+    "com/sun/glass/ui/gtk/*"]
 X86EGL.glass.lib = "glass"
 
 X86EGL.glass.monocle = [:]
--- a/gradle.properties.template	Wed Mar 19 08:57:26 2014 -0700
+++ b/gradle.properties.template	Wed Mar 19 13:06:06 2014 -0700
@@ -61,7 +61,7 @@
 # Specifies whether to enable robot-based visual tests when running a full test.
 # This flag is ignored if FULL_TEST is false.
 
-#USE_ROBOT = false
+#USE_ROBOT = true
 
 # Specifies whether to run system tests that depend on AWT.
 # This flag is ignored if FULL_TEST is false.
--- a/modules/controls/src/main/java/com/sun/javafx/charts/Legend.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/charts/Legend.java	Wed Mar 19 13:06:06 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -34,17 +34,18 @@
 import javafx.collections.FXCollections;
 import javafx.collections.ListChangeListener;
 import javafx.collections.ObservableList;
-import javafx.geometry.Dimension2D;
+import javafx.geometry.Orientation;
 import javafx.geometry.Pos;
 import javafx.scene.Node;
 import javafx.scene.control.ContentDisplay;
 import javafx.scene.control.Label;
 import javafx.scene.layout.Region;
+import javafx.scene.layout.TilePane;
 
 /**
  * A chart legend that displays a list of items with symbols in a box
  */
-public class Legend extends Region {
+public class Legend extends TilePane {
 
     private static final int GAP = 5;
 
@@ -65,7 +66,7 @@
      */
     private BooleanProperty vertical = new BooleanPropertyBase(false) {
         @Override protected void invalidated() {
-            requestLayout();
+            setOrientation(get() ? Orientation.VERTICAL : Orientation.HORIZONTAL);
         }
 
         @Override
@@ -116,79 +117,14 @@
     // -------------- CONSTRUCTORS ----------------------------------------------
 
     public Legend() {
+        super(GAP, GAP);
+        setTileAlignment(Pos.CENTER_LEFT);
         setItems(FXCollections.<LegendItem>observableArrayList());
         getStyleClass().setAll("chart-legend");
     }
 
     // -------------- METHODS ---------------------------------------------------
 
-    private Dimension2D getTileSize(){
-        double maxWidth = 0;
-        double maxHeight = 0;
-        for(LegendItem item: getItems()) {
-            maxWidth = Math.max(maxWidth, item.label.prefWidth(-1));
-            maxHeight = Math.max(maxHeight, item.label.prefHeight(-1));
-        }
-        return new Dimension2D(Math.ceil(maxWidth), Math.ceil(maxHeight));
-    }
-
-    @Override protected double computePrefWidth(double height) {
-        if (getItems().isEmpty()) return 0; // RT-31157 : no data - dont show legend
-        final double contentHeight = height - snappedTopInset() - snappedBottomInset();
-        Dimension2D tileSize = getTileSize();
-        if(height == -1) {
-            if(columns <= 1) return tileSize.getWidth() + snappedLeftInset() + snappedRightInset();
-        } else {
-            rows = (int) Math.max(1, Math.floor( contentHeight / (tileSize.getHeight() + GAP) ));
-            columns = (int)Math.ceil(getItems().size() / (double)rows);
-        }
-        if(columns == 1) rows = Math.min(rows, getItems().size());
-        return (columns*(tileSize.getWidth()+GAP)) - GAP + snappedLeftInset() + snappedRightInset();
-    }
-
-    @Override protected double computePrefHeight(double width) {
-        if (getItems().isEmpty()) return 0; // RT-31157 : no data - dont show legend
-        final double contentWidth = width - snappedLeftInset() - snappedRightInset();
-        Dimension2D tileSize = getTileSize();
-        if(width == -1) {
-            if(rows <= 1) return tileSize.getHeight() + snappedTopInset() + snappedBottomInset();
-        } else {
-            columns = (int) Math.max(1, Math.floor( contentWidth / (tileSize.getWidth() + GAP) ));
-            rows = (int)Math.ceil(getItems().size() / (double)columns);
-        }
-        if(rows == 1) columns = Math.min(columns, getItems().size());
-        return (rows*(tileSize.getHeight()+GAP)) - GAP + snappedTopInset() + snappedBottomInset();
-    }
-
-    @Override protected void layoutChildren() {
-        Dimension2D tileSize = getTileSize();
-        if(isVertical()) {
-            double left = snappedLeftInset();
-            outer: for (int col=0; col < columns; col++) {
-                double top = snappedTopInset();
-                for (int row=0; row < rows; row++) {
-                    int itemIndex = (col*rows) + row;
-                    if(itemIndex >= getItems().size()) break outer;
-                    getItems().get(itemIndex).label.resizeRelocate(left,top,tileSize.getWidth(),tileSize.getHeight());
-                    top += tileSize.getHeight() + GAP;
-                }
-                left += tileSize.getWidth() + GAP;
-            }
-        } else {
-            double top = snappedTopInset();
-            outer: for (int row=0; row < rows; row++) {
-                double left = snappedLeftInset();
-                for (int col=0; col < columns; col++) {
-                    int itemIndex = (row*columns) + col;
-                    if(itemIndex >= getItems().size()) break outer;
-                    getItems().get(itemIndex).label.resizeRelocate(left,top,tileSize.getWidth(),tileSize.getHeight());
-                    left += tileSize.getWidth() + GAP;
-                }
-                top += tileSize.getHeight() + GAP;
-            }
-        }
-    }
-
     /** A item to be displayed on a Legend */
     public static class LegendItem {
 
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleButton.java	Wed Mar 19 08:57:26 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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.sun.javafx.scene.control.accessible;
-
-import com.sun.javafx.accessible.utils.ControlTypeIds;
-import com.sun.javafx.accessible.utils.PropertyIds;
-import javafx.scene.control.ButtonBase;
-
-public class AccessibleButton extends AccessibleControl  {
-    
-    ButtonBase button ;
-    public AccessibleButton(ButtonBase button) {
-        super(button);
-        this.button = button ;       
-    }
-    
-    //
-    // Summary:
-    //     Retrieves the value of a property supported by the UI Automation provider.
-    //
-    // Parameters:
-    //   propertyId:
-    //     The property identifier.
-    //
-    // Returns:
-    //     The property value, or a null if the property is not supported by this provider,
-    //     or System.Windows.Automation.AutomationElementIdentifiers.NotSupported if
-    //     it is not supported at all.
-    @Override public Object getPropertyValue(int propertyId) {
-        Object retVal = null ;
-        switch(propertyId){
-            case PropertyIds.NAME:
-            case PropertyIds.DESCRIBED_BY:
-                retVal = (Object)this.button.getText() ;
-                break;
-            case PropertyIds.CONTROL_TYPE:
-                retVal = ControlTypeIds.BUTTON;
-                break;
-            case PropertyIds.IS_KEYBOARD_FOCUSABLE:
-                retVal = true;
-                break;
-            case PropertyIds.HAS_KEYBOARD_FOCUS:
-                retVal = button.isFocused();
-                break;
-            case PropertyIds.IS_CONTROL_ELEMENT:
-                retVal = true;
-                break;
-            case PropertyIds.IS_ENABLED:
-                retVal = !button.isDisabled();
-                break;
-            case PropertyIds.CLASS_NAME:
-                retVal = this.getClass().toString();
-                break;
-        }
-        return retVal;
-    }
-
-    // Summary:
-    //     Retrieves an object that provides support for a control pattern on a UI Automation
-    //     element.
-    //
-    // Parameters:
-    //   patternId:
-    //     Identifier of the pattern.
-    //
-    // Returns:
-    //     Object that implements the pattern interface, or null if the pattern is not
-    //     supported.
-    @Override public Object getPatternProvider(int patternId) {
-        return null ;
-    }
-
-}
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleCheckBox.java	Wed Mar 19 08:57:26 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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.sun.javafx.scene.control.accessible;
-
-import javafx.event.ActionEvent;
-import javafx.event.EventHandler;
-import javafx.scene.control.CheckBox;
-import com.sun.javafx.Logging;
-import com.sun.javafx.accessible.providers.ToggleProvider;
-import com.sun.javafx.accessible.utils.ControlTypeIds;
-import com.sun.javafx.accessible.utils.EventIds;
-import com.sun.javafx.accessible.utils.PropertyIds;
-import com.sun.javafx.accessible.utils.ToggleState;
-import sun.util.logging.PlatformLogger;
-import sun.util.logging.PlatformLogger.Level;
-
-public class AccessibleCheckBox extends AccessibleControl implements ToggleProvider {
-    CheckBox checkBox ;
-    public AccessibleCheckBox(CheckBox checkBox)
-    {
-        super(checkBox);
-        this.checkBox = checkBox ;
-
-        // initialize to receive state change event
-        checkBox.setOnAction(new EventHandler<ActionEvent>() {
-            @Override
-            public void handle(ActionEvent t) {
-                ToggleState toggleOldState, toggleCurrState=ToggleState.OFF; // Disabled
-                toggleOldState=ToggleState.ON;
-                CheckBox checkBox = (CheckBox)t.getSource();
-                if( checkBox.isIndeterminate() )
-                {
-                    toggleCurrState = ToggleState.INDETERMINATE;
-                    toggleOldState = ToggleState.OFF ;
-                }
-                if( checkBox.isSelected() )
-                {
-                    toggleCurrState = ToggleState.ON;
-                    toggleOldState = ToggleState.OFF ;
-                }
-                firePropertyChange(EventIds.AUTOMATION_PROPERTY_CHANGED,
-                        toggleOldState.hashCode(), toggleCurrState.hashCode());
-            }
-        });
-    }
-
-   public ToggleState getToggleState()
-   {
-       PlatformLogger logger = Logging.getAccessibilityLogger();
-        ToggleState toggleState=ToggleState.OFF; // Disabled
-        if( checkBox.isIndeterminate() )
-            toggleState = ToggleState.INDETERMINATE;
-        if( checkBox.isSelected() )
-            toggleState = ToggleState.ON;
-        if (logger.isLoggable(Level.FINER)) {
-            logger.finer(this.toString()+ "getToggleState" + toggleState.toString());
-        }
-        return toggleState ;
-
-   }
-    //
-    // Summary:
-    //     Retrieves the value of a property supported by the UI Automation provider.
-    //
-    // Parameters:
-    //   propertyId:
-    //     The property identifier.
-    //
-    // Returns:
-    //     The property value, or a null if the property is not supported by this provider,
-    //     or System.Windows.Automation.AutomationElementIdentifiers.NotSupported if
-    //     it is not supported at all.
-    @Override
-    public Object getPropertyValue(int propertyId)
-    {
-        Object retVal = null ;
-        switch(propertyId){
-            case PropertyIds.NAME:
-            case PropertyIds.DESCRIBED_BY:
-                retVal = (Object)checkBox.getText() ;
-                break;
-            case PropertyIds.CONTROL_TYPE:
-                retVal = ControlTypeIds.CHECK_BOX;
-                break;
-            case PropertyIds.IS_KEYBOARD_FOCUSABLE:
-                retVal = true;
-                break;
-            case PropertyIds.HAS_KEYBOARD_FOCUS:
-                retVal = checkBox.isFocused();
-                break;
-            case PropertyIds.IS_CONTROL_ELEMENT:
-                retVal = true;
-                break;
-            case PropertyIds.IS_ENABLED:
-                retVal = !checkBox.isDisabled();
-                break;
-            case PropertyIds.CLASS_NAME:
-                retVal = this.getClass().toString();
-                break;
-            case PropertyIds.TOGGLE_TOGGLE_STATE:
-                retVal = ToggleState.ON;
-                break;
-        }
-        return retVal;
-    }
-
-    // Summary:
-    //     Retrieves an object that provides support for a control pattern on a UI Automation
-    //     element.
-    //
-    // Parameters:
-    //   patternId:
-    //     Identifier of the pattern.
-    //
-    // Returns:
-    //     Object that implements the pattern interface, or null if the pattern is not
-    //     supported.
-    @Override
-    public Object getPatternProvider(int patternId)
-    {
-        return (Object)super.getAccessibleElement() ;
-    }
-
-    @Override
-    public void toggle()
-    {
-        checkBox.arm();
-    }
-}
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleControl.java	Wed Mar 19 08:57:26 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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.sun.javafx.scene.control.accessible;
-
-import javafx.beans.value.ChangeListener;
-import javafx.beans.value.ObservableValue;
-import javafx.scene.control.Control;
-import sun.util.logging.PlatformLogger;
-import sun.util.logging.PlatformLogger.Level;
-
-import com.sun.javafx.Logging;
-import com.sun.javafx.accessible.AccessibleNode;
-import com.sun.javafx.accessible.utils.EventIds;
-
-public class AccessibleControl extends AccessibleNode {
-    Control control ;
-    public AccessibleControl(Control control)
-    {
-	super(control);
-        this.control = control ;
-
-        control.focusedProperty().addListener(new ChangeListener<Boolean>() {
-
-            @Override
-            public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
-                PlatformLogger logger = Logging.getAccessibilityLogger();
-                if(!t && t1)
-                {
-                    if (logger.isLoggable(Level.FINER)) {
-                        logger.finer(this.toString() + " Focus Change: true");
-                    }
-                    fireEvent(EventIds.AUTOMATION_FOCUS_CHANGED);
-                }
-                else
-                    if (logger.isLoggable(Level.FINER)) {
-                        logger.finer(this.toString() + " Focus Change: false");
-                    }
-            }
-        } );
-    }
-
-    public void fireEvent(int id)
-    {
-        super.fireEvent(id);
-    }
-
-    public void firePropertyChange(int propertyId, int oldProperty, int newProperty) {
-        super.firePropertyChange(propertyId, oldProperty, newProperty);
-    }
-    public void firePropertyChange(int propertyId, boolean oldProperty, boolean newProperty) {
-        super.firePropertyChange(propertyId, oldProperty, newProperty);
-    }
-
-}
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleList.java	Wed Mar 19 08:57:26 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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.sun.javafx.scene.control.accessible;
-
-import com.sun.javafx.accessible.providers.GridProvider;
-import com.sun.javafx.accessible.providers.SelectionProvider;
-import com.sun.javafx.accessible.utils.ControlTypeIds;
-import com.sun.javafx.accessible.utils.OrientationType;
-import com.sun.javafx.accessible.utils.PropertyIds;
-import javafx.scene.control.ListView;
-
-public class AccessibleList extends AccessibleControl
-                            implements SelectionProvider, GridProvider {
-
-    ListView listView;
-    
-    /**
-     * Constructor
-     * 
-     * @param listView the associated FX control
-     */
-    public AccessibleList(ListView listView) {
-        super(listView);
-        this.listView = listView ; 
-       
-    }
-
-    /**
-     * Gets a property value
-     * 
-     * @param propertyId
-     * 
-     * @return the requested property value 
-     */
-    @Override public Object getPropertyValue(int propertyId) {
-        Object retVal = null ;
-        switch(propertyId){
-            case PropertyIds.NAME:
-            case PropertyIds.DESCRIBED_BY:
-                // return null for now
-                break;
-            case PropertyIds.CONTROL_TYPE:
-                retVal = ControlTypeIds.LIST;
-                break;
-            case PropertyIds.IS_KEYBOARD_FOCUSABLE:
-                retVal = listView.isFocusTraversable();
-                break;
-            case PropertyIds.HAS_KEYBOARD_FOCUS:
-                retVal = listView.isFocused();
-                break;
-            case PropertyIds.IS_CONTROL_ELEMENT:
-                retVal = true;
-                break;
-            case PropertyIds.IS_ENABLED:
-                retVal = !listView.isDisabled();
-                break;
-            case PropertyIds.CLASS_NAME:
-                retVal = this.getClass().toString();
-                break;
-            case PropertyIds.ORIENTATION:
-                switch(listView.getOrientation()) {
-                    case HORIZONTAL: 
-                        retVal = OrientationType.OrientationType_Horizontal;
-                        break;
-                    case VERTICAL:
-                        retVal = OrientationType.OrientationType_Vertical;
-                        break;
-                    default:
-                        retVal = OrientationType.OrientationType_None;
-                        break;
-                }
-                break;
-            case PropertyIds.IS_OFFSCREEN:
-                //TODO check if really offscreen - can be moved up to superclass 
-                retVal = true;
-                break;
-        }   
-        return retVal;
-    }
-
-    /**
-     * Determine if the list supports multiple selection
-     * 
-     * @return whether or not the list supports multiple selection 
-     */
-    @Override
-    public boolean canSelectMultiple() {
-        return false;
-    }
-
-    /**
-     * Get the Glass objects that are currently selected
-     * 
-     * @return return the Glass objects that are currently selected
-     */
-    @Override
-    public Object[] getSelection() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean isSelectionRequired() {
-        return true;
-    }
-
-
-    /**
-     * Get the number of columns in this list
-     * 
-     * @return the number of columns in this list 
-     */
-    @Override
-    public int getColumnCount() {
-        return 1;
-    }
-
-    /**
-     * Get the number of rows in this list
-     * 
-     * @return the number of rows in this list
-     */
-    @Override
-    public int getRowCount() {
-        return listView.getItems().size();
-    }
-
-    /**
-     * Gets the accessible Glass object of the specified item in the list.
-     * 
-     * @param row
-     * @param col
-     * 
-     * @return the accessible Glass object of the specified item in the list
-     */
-    @Override   
-    public Object getItem(int row, int col) {
-        throw new UnsupportedOperationException();
-    }
-
-    
-}
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleListItem.java	Wed Mar 19 08:57:26 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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.sun.javafx.scene.control.accessible;
-
-import com.sun.javafx.accessible.providers.GridItemProvider;
-import com.sun.javafx.accessible.providers.SelectionItemProvider;
-import com.sun.javafx.accessible.utils.ControlTypeIds;
-import com.sun.javafx.accessible.utils.PropertyIds;
-import javafx.scene.Node;
-import javafx.scene.control.Cell;
-import javafx.scene.control.ListView;
-
-public final class AccessibleListItem extends AccessibleControl implements 
-        SelectionItemProvider, GridItemProvider {
-
-    Cell listCell;
-    static ListView listView = null;
-
-    /**
-     * Constructor
-     * 
-     * @param listCell The associated list item cell
-     */
-    public AccessibleListItem(Cell listCell) {
-        super(listCell);
-        this.listCell = listCell ; 
-        Node node = listCell;
-        if (listView == null) {
-            while (node.getParent() != null) {
-                Node parent = node.getParent();
-                if (parent instanceof ListView) {
-                    listView = (ListView)parent;
-                    break;
-                }
-                node = node.getParent();
-            }
-        }
-    }
-    
-    /**
-     * Get the property value for the specified property ID.
-     * 
-     * @param propertyId    specifies which property to fetch
-     * 
-     * @return the requested property
-     */
-    @Override public Object getPropertyValue(int propertyId) {
-        Object retVal = null ;
-        switch(propertyId){
-            case PropertyIds.NAME:
-            case PropertyIds.DESCRIBED_BY:
-                retVal = listCell.getText();
-                break;
-            case PropertyIds.CONTROL_TYPE:
-                retVal = ControlTypeIds.LIST_ITEM;
-                break;
-            case PropertyIds.IS_KEYBOARD_FOCUSABLE:
-                retVal = listCell.isFocusTraversable();
-                break;
-            case PropertyIds.HAS_KEYBOARD_FOCUS:
-                retVal = listCell.isFocused();
-                break;
-            case PropertyIds.IS_CONTROL_ELEMENT:
-                retVal = true;
-                break;
-            case PropertyIds.IS_ENABLED:
-                retVal = !listCell.isDisabled();
-                break;
-            case PropertyIds.CLASS_NAME:
-                retVal = this.getClass().toString();
-                break;
-        }   
-        return retVal;
-    }
-    
-    /**
-     * Add this object to the selection.
-     */
-    @Override
-    public void addToSelection() {
-        listView.getSelectionModel().select(listCell);
-    }
-
-    /**
-     * Remove this object from the selection.
-     */
-    @Override
-    public void removeFromSelection() {
-        // TODO assuming single selection for now
-        listView.getSelectionModel().clearSelection();
-    }
-
-    /**
-     * Select this object.
-     */
-    @Override
-    public void select() {
-        listView.getSelectionModel().select(listCell);
-    }
-
-    /**
-     * Determine if this object is selected.
-     * 
-     * @return whether or not this object is selected
-     */
-    @Override
-    public boolean isSelected() {
-        return listCell == listView.getSelectionModel().getSelectedItem();
-    }
-
-    /**
-     * Get the Glass accessible for the container.
-     * 
-     * @return the Glass accessible of the container.
-     */
-    @Override
-    public Object getSelectionContainer() {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * For GridItemProvider Row property
-     *
-     * @return the row index of this object.
-     */
-    @Override
-    public int getRow() {
-        return listView.getItems().indexOf(listCell);
-    }
-
-    /**
-     * For GridItemProvider Column property
-     *
-     * @return the column index of this object.
-     */
-    @Override
-    public int getColumn() {
-        return 1;
-    }
-
-    /**
-     * For GridItemProvider RowSpan property
-     *
-     * @return the the number of rows spanned by this object.
-     */
-    @Override
-    public int getRowSpan() {
-        return listView.getItems().size();
-       
-    }
-
-    /**
-     * For GridItemProvider ColumnSpan property
-     *
-     * @return the the number of columns spanned by this object.
-     */
-    @Override
-    public int getColumnSpan() {
-        return 1;
-    }
-
-    /**
-     * For GridItemProvider ContainingGrid property
-     *
-     * @return the Glass provider that implements the GridProvider pattern and represents
-     *         the container of this object. 
-     */
-    @Override
-    public Object getContainingGrid() {
-        throw new UnsupportedOperationException();
-    }
-    
-}
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleMenuButton.java	Wed Mar 19 08:57:26 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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.sun.javafx.scene.control.accessible;
-
-import com.sun.javafx.accessible.providers.ToggleProvider;
-import com.sun.javafx.accessible.providers.ExpandCollapseProvider;
-import com.sun.javafx.accessible.providers.InvokeProvider;
-import com.sun.javafx.accessible.utils.ExpandCollapseState;
-import com.sun.javafx.accessible.utils.ToggleState;
-import javafx.scene.control.MenuButton;
-
-
-public class AccessibleMenuButton extends AccessibleButton implements ToggleProvider, InvokeProvider, 
-        ExpandCollapseProvider {
-    
-    MenuButton menuButton;
-    public AccessibleMenuButton(MenuButton b) {
-        super(b);
-        this.menuButton = b;
-    }
-    
-    @Override public void toggle() {
-        if ( menuButton.isShowing()) 
-            menuButton.hide();
-        else menuButton.show();
-    }
-
-    @Override public ToggleState getToggleState() {
-        if(menuButton.isShowing())
-            return ToggleState.ON;
-        else return ToggleState.OFF;
-    }
-
-    @Override public void invoke() {
-        menuButton.show();
-        // need to fire action event as well or may be only action event which 
-        // will automatically call menuButton.show. 
-    }
-
-    @Override public ExpandCollapseState getExpandCollapseState() {
-        if (menuButton.isShowing()) {
-            return ExpandCollapseState.ExpandCollapseState_Expanded;
-        } else {
-            return ExpandCollapseState.ExpandCollapseState_Collapsed;
-        }
-    }
-
-    @Override public void expand() {
-        menuButton.show();
-    }
-
-    @Override public void collapse() {
-        menuButton.hide();
-    }
-    
-    @Override public Object getPatternProvider(int patternId) {
-        return (Object)super.getAccessibleElement() ;
-    }
-}
-
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleRadioButton.java	Wed Mar 19 08:57:26 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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.sun.javafx.scene.control.accessible;
-
-import com.sun.javafx.accessible.utils.EventIds;
-import com.sun.javafx.accessible.utils.ControlTypeIds;
-import com.sun.javafx.accessible.utils.PropertyIds;
-import com.sun.javafx.accessible.providers.AccessibleProvider;
-import com.sun.javafx.accessible.providers.SelectionItemProvider;
-import javafx.scene.control.RadioButton;
-import javafx.event.ActionEvent;
-import javafx.event.EventHandler;
-
-public class AccessibleRadioButton extends AccessibleControl implements SelectionItemProvider {
-    RadioButton radioButton ;
-    public AccessibleRadioButton(RadioButton radioButton)
-    {
-        super(radioButton);
-        this.radioButton = radioButton;
-        // initialize to receive state change event
-        radioButton.setOnAction(new EventHandler<ActionEvent>() {
-            @Override
-            public void handle(ActionEvent t) {
-                RadioButton radioButton = (RadioButton)t.getSource();
-                boolean bOldVal, bCurrVal;
-                bCurrVal = true;
-                if( radioButton.isDisabled() ) 
-                    bCurrVal = false;
-                bOldVal = !bCurrVal;               
-                firePropertyChange(EventIds.AUTOMATION_PROPERTY_CHANGED, bOldVal, bCurrVal);
-            }
-        });
-    }
-
-    //
-    // Summary:
-    //     Retrieves the value of a property supported by the UI Automation provider.
-    //
-    // Parameters:
-    //   propertyId:
-    //     The property identifier.
-    //
-    // Returns:
-    //     The property value, or a null if the property is not supported by this provider,
-    //     or System.Windows.Automation.AutomationElementIdentifiers.NotSupported if
-    //     it is not supported at all.
-    @Override
-    public Object getPropertyValue(int propertyId)
-    {
-        Object retVal = null ;
-        switch(propertyId){
-            case PropertyIds.NAME:
-            case PropertyIds.DESCRIBED_BY:
-                retVal = (Object)radioButton.getText() ;
-                break;
-            case PropertyIds.CONTROL_TYPE:
-                retVal = ControlTypeIds.RADIO_BUTTON;
-                break;
-            case PropertyIds.IS_KEYBOARD_FOCUSABLE:
-                retVal = radioButton.isFocusTraversable();
-                break;
-            case PropertyIds.HAS_KEYBOARD_FOCUS:
-                retVal = radioButton.isFocused();
-                break;
-            case PropertyIds.IS_CONTROL_ELEMENT:
-                retVal = true;
-                break;
-            case PropertyIds.IS_ENABLED:
-                retVal = !radioButton.isDisabled();
-                break;
-            case PropertyIds.CLASS_NAME:
-                retVal = this.getClass().toString();
-                break;
-        }
-        return retVal;
-    }
-
-    // Summary:
-    //     Retrieves an object that provides support for a control pattern on a UI Automation
-    //     element.
-    //
-    // Parameters:
-    //   patternId:
-    //     Identifier of the pattern.
-    //
-    // Returns:
-    //     Object that implements the pattern interface, or null if the pattern is not
-    //     supported.
-    @Override
-    public Object getPatternProvider(int patternId)
-    {
-        return (Object)super.getAccessibleElement() ;
-    }
-
-
-    @Override
-    public void addToSelection()
-    {
-    }
-    
-    @Override
-    public void removeFromSelection()
-    {
-        
-    }
-
-    @Override
-    public void select()
-    {
-        
-    }
-    
-    @Override
-    public boolean isSelected()
-    {
-        return radioButton.isSelected();
-    }
-    
-    @Override
-    public AccessibleProvider getSelectionContainer()
-    {
-        return null;
-    }
-    
-}
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/accessible/AccessibleSlider.java	Wed Mar 19 08:57:26 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, 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.sun.javafx.scene.control.accessible;
-
-import com.sun.javafx.accessible.utils.EventIds;
-import com.sun.javafx.accessible.utils.ControlTypeIds;
-import com.sun.javafx.accessible.utils.PropertyIds;
-import com.sun.javafx.accessible.providers.RangeValueProvider;
-import javafx.scene.control.Slider;
-import javafx.beans.value.ChangeListener;
-import javafx.beans.value.ObservableValue;
-
-public class AccessibleSlider extends AccessibleControl implements RangeValueProvider {
-    
-    Slider slider;
-     public AccessibleSlider(Slider slider) {
-        super(slider);
-        this.slider = slider ; 
-        slider.valueProperty().addListener(new ChangeListener<Number>() {
-             @Override public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
-                 firePropertyChange(EventIds.AUTOMATION_PROPERTY_CHANGED, t.intValue(), t1.intValue());
-             }
-         });
-    }
-    
-    @Override public double getValue() {
-        return slider.getValue();
-    }
-
-    @Override public boolean isReadOnly() {
-        return false;
-    }
-
-    @Override public double getLargeValue() {
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override public double getMinimum() {
-        return slider.getMin();
-    }
-
-    @Override public double getMaximum() {
-        return slider.getMax();
-    }
-
-    @Override public double getSmallChange() {
-        // Need to store value, to find the difference with the current value
-        throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    @Override public Object getPropertyValue(int propertyId) {
-        Object retVal = null ;
-        switch(propertyId){
-            case PropertyIds.NAME:
-            case PropertyIds.DESCRIBED_BY:
-                retVal = new Double(slider.getValue()).toString();
-                break;
-            case PropertyIds.CONTROL_TYPE:
-                retVal = ControlTypeIds.SLIDER;
-                break;
-            case PropertyIds.IS_KEYBOARD_FOCUSABLE:
-                retVal = slider.isFocusTraversable();
-                break;
-            case PropertyIds.HAS_KEYBOARD_FOCUS:
-                retVal = slider.isFocused();
-                break;
-            case PropertyIds.IS_CONTROL_ELEMENT:
-                retVal = true;
-                break;
-            case PropertyIds.IS_ENABLED:
-                retVal = !slider.isDisabled();
-                break;
-            case PropertyIds.CLASS_NAME:
-                retVal = this.getClass().toString();
-                break;
-        }
-        return retVal;
-    }
-    
-     @Override
-    public Object getPatternProvider(int patternId) {
-        return (Object)super.getAccessibleElement() ;
-    }
-
-}
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/ColorPickerBehavior.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/ColorPickerBehavior.java	Wed Mar 19 13:06:06 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -96,29 +96,12 @@
     @Override public void onAutoHide() {
         // when we click on some non  interactive part of the 
         // Color Palette - we do not want to hide.
-        wasComboBoxButtonClickedForAutoHide = mouseInsideButton;
         ColorPicker colorPicker = (ColorPicker)getControl();
         ColorPickerSkin cpSkin = (ColorPickerSkin)colorPicker.getSkin();
         cpSkin.syncWithAutoUpdate();
+        // if the ColorPicker is no longer showing, then invoke the super method
+        // to keep its show/hide state in sync.
+        if (!colorPicker.isShowing()) super.onAutoHide();
     }
-    
-    @Override public void mouseReleased(MouseEvent e) {
-        // Overriding to not do the usual on mouseReleased.
-        // The event is handled by the skin instead, which calls
-        // the method below.
-    }
-//    
-    /**
-     * Handles mouse release events.  This will be called by the skin.
-     *
-     * @param e the mouse press event
-     * @param behaveLikeButton if true, this should act just like a button
-     */
-    public void mouseReleased(MouseEvent e, boolean showHidePopup) {
-        if (showHidePopup) {
-            super.mouseReleased(e);
-        } else {
-            disarm();
-        }
-    }
+
 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/ComboBoxBaseBehavior.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/ComboBoxBaseBehavior.java	Wed Mar 19 13:06:06 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -25,8 +25,11 @@
 
 package com.sun.javafx.scene.control.behavior;
 
+import javafx.event.EventTarget;
 import javafx.scene.Node;
 import javafx.scene.control.ComboBoxBase;
+import javafx.scene.control.Control;
+import javafx.scene.input.KeyEvent;
 import javafx.scene.input.MouseButton;
 import javafx.scene.input.MouseEvent;
 import java.util.ArrayList;
@@ -113,6 +116,12 @@
         COMBO_BOX_BASE_BINDINGS.add(new KeyBinding(ENTER, KEY_RELEASED, RELEASE_ACTION));
     }
 
+    @Override protected void callActionForEvent(KeyEvent e) {
+        // If popup is shown, KeyEvent causes popup to close
+        showPopupOnMouseRelease = true;
+        super.callActionForEvent(e);
+    }
+
     @Override protected void callAction(String name) {
         if (PRESS_ACTION.equals(name)) {
             keyPressed();
@@ -170,52 +179,46 @@
      * Mouse Events                                                           *
      *                                                                        *
      *************************************************************************/
-    
+
     @Override public void mousePressed(MouseEvent e) {
         super.mousePressed(e);
-        getFocus();
         arm(e);
-        wasComboBoxButtonClickedForAutoHide = false;
     }
-    
+
     @Override public void mouseReleased(MouseEvent e) {
-        super.mousePressed(e);
+        super.mouseReleased(e);
 
-        boolean wasArmed = getControl().isArmed();
         disarm();
 
-        // The wasComboBoxButtonClickedForAutoHide boolean was added to resolve
+        // The showPopupOnMouseRelease boolean was added to resolve
         // RT-18151: namely, clicking on the comboBox button shouldn't hide, 
-        // and then immediately show the popup, which was occuring because we 
-        // didn't know where the popup autohide was occurring. Another comment
-        // appears below in the autoHide() method.
-        if (getControl().isShowing()) {
-            hide();
-        } else if (! wasComboBoxButtonClickedForAutoHide 
-                && getControl().contains(e.getX(), e.getY())
-                && e.getButton() == MouseButton.PRIMARY
-                && wasArmed) {
+        // and then immediately show the popup, which was occurring because we
+        // can't know whether the popup auto-hide was coming because of a MOUSE_PRESS
+        // since PopupWindow calls hide() before it calls onAutoHide().
+        if (showPopupOnMouseRelease) {
             show();
         } else {
-            wasComboBoxButtonClickedForAutoHide = false;
+            showPopupOnMouseRelease = true;
+            hide();
         }
     }
 
     @Override public void mouseEntered(MouseEvent e) {
-        if (getControl().isEditable()) {
-            Node arrowButton = getControl().lookup("#arrow-button");
-            mouseInsideButton = arrowButton != null && arrowButton.localToScene(arrowButton.getBoundsInLocal()).contains(e.getSceneX(), e.getSceneY());
+        super.mouseEntered(e);
+
+        if (!getControl().isEditable()) {
+            mouseInsideButton = true;
         } else {
-            mouseInsideButton = true;
+            // This is strongly tied to ComboBoxBaseSkin
+            final EventTarget target = e.getTarget();
+            mouseInsideButton = (target instanceof Node && "arrow-button".equals(((Node) target).getId()));
         }
-        
-        super.mouseEntered(e);
         arm();
     }
 
     @Override public void mouseExited(MouseEvent e) {
+        super.mouseExited(e);
         mouseInsideButton = false;
-        super.mouseExited(e);
         disarm();
     }
     
@@ -246,18 +249,19 @@
             getControl().hide();
         }
     }
-    
-    boolean wasComboBoxButtonClickedForAutoHide = false;
-    boolean mouseInsideButton = false;
+
+    private boolean showPopupOnMouseRelease = true;
+    private boolean mouseInsideButton = false;
     public void onAutoHide() {
-        // if the ComboBox button was clicked, and it was this that forced the
-        // popup to disappear, we don't want the popup to immediately reappear,
-        // so we set wasComboBoxButtonClickedForAutoHide to reflect whether the
-        // mouse was within the comboBox button at the time of autohide occuring.
-        wasComboBoxButtonClickedForAutoHide = mouseInsideButton;
+        // RT-18151: if the ComboBox button was clicked, and it was this that forced the
+        // popup to disappear, we don't want the popup to immediately reappear.
+        // If the mouse was not within the comboBox button at the time of the auto-hide occurring,
+        // then showPopupOnMouseRelease returns to its default of true; otherwise, it toggles.
+        // Note that this logic depends on popup.setAutoHide(true) in ComboBoxPopupControl
         hide();
+        showPopupOnMouseRelease = mouseInsideButton ? !showPopupOnMouseRelease : true;
     }
-    
+
     public void arm() {
         if (getControl().isPressed()) {
             getControl().arm();
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/DatePickerBehavior.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/DatePickerBehavior.java	Wed Mar 19 13:06:06 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -101,41 +101,15 @@
         }
     }
 
-     /**************************************************************************
-     *                                                                        *
-     * Mouse Events                                                           *
-     *                                                                        *
-     *************************************************************************/
-     /**
-     * When a mouse button is pressed, we either want to behave like a button or
-     * show the popup.  This will be called by the skin.
-     */
     @Override public void onAutoHide() {
         // when we click on some non-interactive part of the
         // calendar - we do not want to hide.
-        wasComboBoxButtonClickedForAutoHide = mouseInsideButton;
         DatePicker datePicker = (DatePicker)getControl();
         DatePickerSkin cpSkin = (DatePickerSkin)datePicker.getSkin();
         cpSkin.syncWithAutoUpdate();
+        // if the DatePicker is no longer showing, then invoke the super method
+        // to keep its show/hide state in sync.
+        if (!datePicker.isShowing()) super.onAutoHide();
     }
 
-    @Override public void mouseReleased(MouseEvent e) {
-        // Overriding to not do the usual on mouseReleased.
-        // The event is handled by the skin instead, which calls
-        // the method below.
-    }
-
-    /**
-     * Handles mouse release events.  This will be called by the skin.
-     *
-     * @param e the mouse press event
-     * @param showHidePopup if true, this should act just like a button
-     */
-    public void mouseReleased(MouseEvent e, boolean showHidePopup) {
-        if (showHidePopup) {
-            super.mouseReleased(e);
-        } else {
-            disarm();
-        }
-    }
 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ColorPickerSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ColorPickerSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -176,48 +176,12 @@
     public ColorPickerSkin(final ColorPicker colorPicker) {
         super(colorPicker, new ColorPickerBehavior(colorPicker));
         updateComboBoxMode();
-        if (getMode() == ComboBoxMode.BUTTON || getMode() == ComboBoxMode.COMBOBOX) {
-             if (arrowButton.getOnMouseReleased() == null) {
-                arrowButton.setOnMouseReleased(new EventHandler<MouseEvent>() {
-                    @Override public void handle(MouseEvent e) {
-                        ((ColorPickerBehavior)getBehavior()).mouseReleased(e, true);
-                        e.consume();
-                    }
-                });
-            }
-        } else if (getMode() == ComboBoxMode.SPLITBUTTON) {
-            if (arrowButton.getOnMouseReleased() == null) {
-                arrowButton.setOnMouseReleased(new EventHandler<MouseEvent>() {
-                    @Override public void handle(MouseEvent e) {
-                        ((ColorPickerBehavior)getBehavior()).mouseReleased(e, true);
-                        e.consume();
-                    }
-                });
-            }
-        }
         registerChangeListener(colorPicker.valueProperty(), "VALUE");
 
         // create displayNode
         displayNode = new Label();
         displayNode.getStyleClass().add("color-picker-label");
-        if (getMode() == ComboBoxMode.BUTTON || getMode() == ComboBoxMode.COMBOBOX) {
-            if (displayNode.getOnMouseReleased() == null) {
-                displayNode.setOnMouseReleased(new EventHandler<MouseEvent>() {
-                    @Override public void handle(MouseEvent e) {
-                        ((ColorPickerBehavior)getBehavior()).mouseReleased(e, true);
-                    }
-                });
-            }
-        } else {
-            if (displayNode.getOnMouseReleased() == null) {
-                displayNode.setOnMouseReleased(new EventHandler<MouseEvent>() {
-                    @Override public void handle(MouseEvent e) {
-                        ((ColorPickerBehavior)getBehavior()).mouseReleased(e, false);
-                        e.consume();
-                    }
-                });
-            }
-        }
+
         // label graphic
         pickerColorBox = new PickerColorBox();
         pickerColorBox.getStyleClass().add("picker-color");
@@ -234,15 +198,6 @@
 
         pickerColorBox.getChildren().add(colorRect);
         displayNode.setGraphic(pickerColorBox);
-        if (displayNode.getOnMouseReleased() == null) {
-            displayNode.setOnMouseReleased(new EventHandler<MouseEvent>() {
-                @Override
-                public void handle(MouseEvent e) {
-                    ((ColorPickerBehavior)getBehavior()).mouseReleased(e, false);
-                    e.consume();
-                }
-            });
-        }
     }
 
 
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxBaseSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxBaseSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -26,12 +26,14 @@
 package com.sun.javafx.scene.control.skin;
 
 import com.sun.javafx.scene.control.behavior.ComboBoxBaseBehavior;
+import javafx.beans.InvalidationListener;
 import javafx.beans.value.ChangeListener;
 import javafx.beans.value.ObservableValue;
 import javafx.geometry.HPos;
 import javafx.geometry.VPos;
 import javafx.scene.Node;
 import javafx.scene.control.ComboBoxBase;
+import javafx.scene.input.MouseEvent;
 import javafx.scene.layout.Region;
 import javafx.scene.layout.StackPane;
 
@@ -58,15 +60,30 @@
         arrow = new Region();
         arrow.setFocusTraversable(false);
         arrow.getStyleClass().setAll("arrow");
+        arrow.setId("arrow");
         arrow.setMaxWidth(Region.USE_PREF_SIZE);
         arrow.setMaxHeight(Region.USE_PREF_SIZE);
+        arrow.setMouseTransparent(true);
+
         arrowButton = new StackPane();
         arrowButton.setFocusTraversable(false);
         arrowButton.setId("arrow-button");
         arrowButton.getStyleClass().setAll("arrow-button");
         arrowButton.getChildren().add(arrow);
+
+        if (comboBox.isEditable()) {
+            //
+            // arrowButton behaves like a button.
+            // This is strongly tied to the implementation in ComboBoxBaseBehavior.
+            //
+            arrowButton.addEventHandler(MouseEvent.MOUSE_ENTERED,  (e) -> getBehavior().mouseEntered(e));
+            arrowButton.addEventHandler(MouseEvent.MOUSE_PRESSED,  (e) -> { getBehavior().mousePressed(e);  e.consume(); });
+            arrowButton.addEventHandler(MouseEvent.MOUSE_RELEASED, (e) -> { getBehavior().mouseReleased(e); e.consume();});
+            arrowButton.addEventHandler(MouseEvent.MOUSE_EXITED, (e) -> getBehavior().mouseExited(e));
+
+        }
         getChildren().add(arrowButton);
-        
+
         // When ComboBoxBase focus shifts to another node, it should hide.
         getSkinnable().focusedProperty().addListener(new ChangeListener<Boolean>() {
             @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -41,6 +41,7 @@
 import javafx.event.EventTarget;
 import javafx.scene.Node;
 import javafx.scene.Parent;
+import javafx.scene.accessibility.Attribute;
 import javafx.scene.control.ComboBox;
 import javafx.scene.control.ListCell;
 import javafx.scene.control.ListView;
@@ -579,6 +580,13 @@
             @Override protected double computePrefHeight(double width) {
                 return getListViewPrefHeight();
             }
+
+            @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
+                switch (attribute) {
+                    case PARENT: return comboBox;
+                    default: return super.accGetAttribute(attribute, parameters);
+                }
+            }
         };
 
         _listView.setId("list-view");
@@ -592,6 +600,7 @@
                  int index = listView.getSelectionModel().getSelectedIndex();
                  comboBox.getSelectionModel().select(index);
                  updateDisplayNode();
+                 comboBox.accSendNotification(Attribute.TITLE);
              }
          });
          
@@ -696,4 +705,37 @@
             setFocused(b);
         }
     }
+
+    @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
+        switch (attribute) {
+            case CHILDREN: {
+                ObservableList<Node> children = comboBox.getChildrenUnmodifiable();
+                ObservableList<Node> list =  FXCollections.observableArrayList();
+                list.addAll(children);
+                if (!list.contains(listView)) list.add(listView);
+                return list;
+            }
+            case TITLE: {
+                String title = comboBox.isEditable() ? textField.getText() : buttonCell.getText();
+                if (title == null || title.isEmpty()) {
+                    title = comboBox.getPromptText();
+                }
+                return title;
+            }
+            case FOCUS_ITEM: if (!comboBox.isShowing()) return super.accGetAttribute(attribute, parameters);
+            //fall through
+            case ROW_COUNT:
+            case MULTIPLE_SELECTION:
+            case ROW_AT_INDEX:
+            case LEAF:
+            case SELECTED_ROWS: {
+                Object o = listView.accGetAttribute(attribute, parameters);
+                //if (o != null) return o;
+                return o;
+            }
+            //fall through
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
 }
+
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxPopupControl.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ComboBoxPopupControl.java	Wed Mar 19 13:06:06 2014 -0700
@@ -110,13 +110,16 @@
                     @Override public void dispose() { }
                 });
             }
+
         };
         popup.getStyleClass().add(COMBO_BOX_STYLE_CLASS);
+        popup.setConsumeAutoHidingEvents(false);
         popup.setAutoHide(true);
         popup.setAutoFix(true);
         popup.setHideOnEscape(true);
         popup.setOnAutoHide(new EventHandler<Event>() {
-            @Override public void handle(Event e) {
+            @Override
+            public void handle(Event e) {
                 getBehavior().onAutoHide();
             }
         });
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/CustomColorDialog.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/CustomColorDialog.java	Wed Mar 19 13:06:06 2014 -0700
@@ -727,6 +727,7 @@
             } 
             sliders[row].setMax(maxValue);
             sliders[row].valueProperty().bindBidirectional(prop);
+            labels[row].setLabelFor(sliders[row]);
             fields[row].setMaxValue(maxValue);
             fields[row].valueProperty().bindBidirectional(prop);
             bindedProperties[row] = prop;
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/DatePickerSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/DatePickerSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -45,6 +45,7 @@
 import javafx.scene.control.DatePicker;
 import javafx.scene.control.TextField;
 import javafx.scene.input.*;
+import javafx.scene.layout.Region;
 import javafx.util.StringConverter;
 
 import com.sun.javafx.scene.control.behavior.DatePickerBehavior;
@@ -69,14 +70,6 @@
             getChildren().add(textField);
         }
 
-        if (arrowButton.getOnMouseReleased() == null) {
-            arrowButton.setOnMouseReleased(new EventHandler<MouseEvent>() {
-                @Override public void handle(MouseEvent e) {
-                    ((DatePickerBehavior)getBehavior()).mouseReleased(e, true);
-                    e.consume();
-                }
-            });
-        }
 
         // The "arrow" is actually a rectangular svg icon resembling a calendar.
         // Round the size of the icon to whole integers to get sharp edges.
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ListViewSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ListViewSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -25,17 +25,22 @@
 
 package com.sun.javafx.scene.control.skin;
 
+import java.util.ArrayList;
+import java.util.List;
+import javafx.collections.FXCollections;
 import javafx.collections.ListChangeListener;
 import javafx.collections.ObservableList;
 import javafx.collections.WeakListChangeListener;
 import javafx.event.EventHandler;
 import javafx.geometry.Orientation;
 import javafx.scene.Node;
+import javafx.scene.accessibility.Attribute;
 import javafx.scene.control.FocusModel;
 import javafx.scene.control.IndexedCell;
 import javafx.scene.control.Label;
 import javafx.scene.control.ListCell;
 import javafx.scene.control.ListView;
+import javafx.scene.control.MultipleSelectionModel;
 import javafx.scene.control.SelectionModel;
 import javafx.scene.input.MouseEvent;
 import javafx.scene.layout.StackPane;
@@ -498,4 +503,35 @@
         flow.show(firstVisibleCell);
         return newSelectionIndex;
     }
+
+    @Override
+    public Object accGetAttribute(Attribute attribute, Object... parameters) {
+        switch (attribute) {
+            case FOCUS_ITEM: {
+                FocusModel<?> fm = getSkinnable().getFocusModel();
+                int focusedIndex = fm.getFocusedIndex();
+                return flow.getCell(focusedIndex);
+            }
+            case ROW_AT_INDEX: {
+                int rowIndex = (Integer)parameters[0];
+                return flow.getCell(rowIndex);
+            }
+            case SELECTED_ROWS: {
+                MultipleSelectionModel sm = getSkinnable().getSelectionModel();
+                ObservableList<Integer> indices = sm.getSelectedIndices();
+                List<Node> selection = new ArrayList<>(indices.size());
+                for (int i : indices) {
+                    ListCell<T> row = flow.getCell(i);
+
+                    // We should never, ever get row == null. If we do then
+                    // something is very wrong.
+                    assert row != null;
+
+                    if (row != null) selection.add(row);
+                }
+                return FXCollections.observableArrayList(selection);
+            }
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/PaginationSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/PaginationSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -56,6 +56,9 @@
 import javafx.geometry.Side;
 import javafx.geometry.VPos;
 import javafx.scene.Node;
+import javafx.scene.accessibility.Action;
+import javafx.scene.accessibility.Attribute;
+import javafx.scene.accessibility.Role;
 import javafx.scene.control.*;
 import javafx.scene.input.TouchEvent;
 import javafx.scene.layout.HBox;
@@ -709,6 +712,16 @@
         layoutInArea(navigation, x, stackPaneHeight, w, navigationHeight, 0, HPos.CENTER, VPos.CENTER);
     }
 
+    @Override protected Object accGetAttribute(Attribute attribute, Object... parameters) {
+        switch (attribute) {
+            // Role: Pagination (specified in Pagination class)
+            case FOCUS_ITEM: return navigation.indicatorButtons.getSelectedToggle();
+            case SELECTED_PAGE: return navigation.indicatorButtons.getSelectedToggle();
+            case PAGES: return navigation.indicatorButtons.getToggles();
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
+
     class NavigationControl extends StackPane {
 
         private HBox controlBox;
@@ -727,7 +740,15 @@
             controlBox = new HBox();
             controlBox.getStyleClass().add("control-box");
 
-            leftArrowButton = new Button();
+            leftArrowButton = new Button() {
+                @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
+                    switch (attribute) {
+                        case ROLE: return Role.BUTTON;
+                        case TITLE: return "Select previous page";
+                        default: return super.accGetAttribute(attribute, parameters);
+                    }
+                }
+            };
             minButtonSize = leftArrowButton.getFont().getSize() * 2;
             leftArrowButton.fontProperty().addListener(new ChangeListener<Font>() {
                 @Override public void changed(ObservableValue<? extends Font> arg0, Font arg1, Font newFont) {
@@ -753,7 +774,15 @@
             leftArrowButton.setGraphic(leftArrow);
             leftArrow.getStyleClass().add("left-arrow");
 
-            rightArrowButton = new Button();
+            rightArrowButton = new Button() {
+                @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
+                    switch (attribute) {
+                        case ROLE: return Role.BUTTON;
+                        case TITLE: return "Select next page";
+                        default: return super.accGetAttribute(attribute, parameters);
+                    }
+                }
+            };
             rightArrowButton.setMinSize(minButtonSize, minButtonSize);
             rightArrowButton.setPrefSize(minButtonSize, minButtonSize);
             rightArrowButton.getStyleClass().add("right-arrow-button");
@@ -1240,6 +1269,22 @@
                 super.fire();
             }
         }
+
+        @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
+            switch (attribute) {
+                case ROLE: return Role.PAGE;
+                case TITLE: return getText();
+                case SELECTED: return isSelected();
+                default: return super.accGetAttribute(attribute, parameters);
+            }
+        }
+
+        @Override public void accExecuteAction(Action action, Object... parameters) {
+            switch (action) {
+                case SELECT: setSelected(true); break;
+                default: super.accExecuteAction(action);
+            }
+        }
     }
 
     /***************************************************************************
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ScrollBarSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ScrollBarSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -28,7 +28,11 @@
 import javafx.event.EventHandler;
 import javafx.geometry.Orientation;
 import javafx.geometry.Point2D;
+import javafx.scene.accessibility.Action;
+import javafx.scene.accessibility.Attribute;
+import javafx.scene.accessibility.Role;
 import javafx.scene.control.ScrollBar;
+import javafx.scene.control.Slider;
 import javafx.scene.input.MouseButton;
 import javafx.scene.input.ScrollEvent;
 import javafx.scene.layout.Region;
@@ -91,13 +95,59 @@
         trackBackground = new StackPane();
         trackBackground.getStyleClass().setAll("track-background");
 
-        thumb = new StackPane();
+        thumb = new StackPane() {
+            @Override
+            public Object accGetAttribute(Attribute attribute, Object... parameters) {
+                switch (attribute) {
+                    case ROLE: return Role.THUMB;
+                    case VALUE: return getSkinnable().getValue();
+                    case MAX_VALUE: {
+                        // This is required for mac-support, to convert from pixel to percent
+                        return getSkinnable().getMax();
+                    }
+                    default: return super.accGetAttribute(attribute, parameters);
+                }
+            }
+
+            @Override
+            public void accExecuteAction(Action action, Object... parameters) {
+                switch (action) {
+                    case MOVE: {
+                        // FIXME for now we just take the x/y values as value, rather than pixel value
+                        final ScrollBar scrollBar = getSkinnable();
+                        final Orientation o = scrollBar.getOrientation();
+                        double value = (double) (o == Orientation.VERTICAL ? parameters[1] : parameters[0]);
+                        scrollBar.setValue(scrollBar.getValue() + value);
+                        break;
+                    }
+                    default: super.accExecuteAction(action, parameters);
+                }
+            }
+        };
         thumb.getStyleClass().setAll("thumb");
 
 
         if (!IS_TOUCH_SUPPORTED) {
             
-            incButton = new EndButton("increment-button", "increment-arrow");
+            incButton = new EndButton("increment-button", "increment-arrow") {
+                @Override
+                public Object accGetAttribute(Attribute attribute, Object... parameters) {
+                    switch (attribute) {
+                        case ROLE: return Role.INCREMENT_BUTTON;
+                        default: return super.accGetAttribute(attribute, parameters);
+                    }
+                }
+
+                @Override
+                public void accExecuteAction(Action action, Object... parameters) {
+                    switch (action) {
+                        case FIRE: 
+                            getSkinnable().increment();
+                            break;
+                        default: super.accExecuteAction(action, parameters);
+                    }
+                }
+            };
             incButton.setOnMousePressed(new EventHandler<javafx.scene.input.MouseEvent>() {
                @Override public void handle(javafx.scene.input.MouseEvent me) {
                    /*
@@ -121,7 +171,25 @@
                }
             });
 
-            decButton = new EndButton("decrement-button", "decrement-arrow");
+            decButton = new EndButton("decrement-button", "decrement-arrow") {
+                @Override
+                public Object accGetAttribute(Attribute attribute, Object... parameters) {
+                    switch (attribute) {
+                        case ROLE: return Role.DECREMENT_BUTTON;
+                        default: return super.accGetAttribute(attribute, parameters);
+                    }
+                }
+
+                @Override
+                public void accExecuteAction(Action action, Object... parameters) {
+                    switch (action) {
+                        case FIRE:
+                            getSkinnable().decrement();
+                            break;
+                        default: super.accExecuteAction(action, parameters);
+                    }
+                }
+            };
             decButton.setOnMousePressed(new EventHandler<javafx.scene.input.MouseEvent>() {
                @Override public void handle(javafx.scene.input.MouseEvent me) {
                    /*
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -48,6 +48,7 @@
 import javafx.geometry.Orientation;
 import javafx.scene.Cursor;
 import javafx.scene.Node;
+import javafx.scene.accessibility.Attribute;
 import javafx.scene.control.ScrollBar;
 import javafx.scene.control.ScrollPane;
 import javafx.scene.control.ScrollPane.ScrollBarPolicy;
@@ -1221,4 +1222,12 @@
         }
         return contentPosY;
     }
+
+    @Override protected Object accGetAttribute(Attribute attribute, Object... parameters) {
+        switch (attribute) {
+            case VERTICAL_SCROLLBAR: return vsb;
+            case HORIZONTAL_SCROLLBAR: return hsb;
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/SliderSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/SliderSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -30,6 +30,9 @@
 import javafx.geometry.Orientation;
 import javafx.geometry.Point2D;
 import javafx.geometry.Side;
+import javafx.scene.accessibility.Action;
+import javafx.scene.accessibility.Attribute;
+import javafx.scene.accessibility.Role;
 import javafx.scene.chart.NumberAxis;
 import javafx.scene.control.Slider;
 import javafx.scene.input.MouseEvent;
@@ -82,7 +85,35 @@
     }
 
     private void initialize() {
-        thumb = new StackPane();
+        thumb = new StackPane() {
+            @Override
+            public Object accGetAttribute(Attribute attribute, Object... parameters) {
+                switch (attribute) {
+                    case ROLE: return Role.THUMB;
+                    case VALUE: return getSkinnable().getValue();
+                    case MAX_VALUE: {
+                        // This is required for mac-support, to convert from pixel to percent
+                        return getSkinnable().getMax();
+                    }
+                    default: return super.accGetAttribute(attribute, parameters);
+                }
+            }
+
+            @Override
+            public void accExecuteAction(Action action, Object... parameters) {
+                switch (action) {
+                    case MOVE: {
+                        // FIXME for now we just take the x/y values as value, rather than pixel value
+                        final Slider slider = getSkinnable();
+                        final Orientation o = slider.getOrientation();
+                        double value = (double) (o == Orientation.VERTICAL ? parameters[1] : parameters[0]);
+                        slider.setValue(slider.getValue() + value);
+                        break;
+                    }
+                    default: super.accExecuteAction(action, parameters);
+                }
+            }
+        };
         thumb.getStyleClass().setAll("thumb");
         track = new StackPane();
         track.getStyleClass().setAll("track");
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TabPaneSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TabPaneSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -53,6 +53,8 @@
 import javafx.geometry.Side;
 import javafx.geometry.VPos;
 import javafx.scene.Node;
+import javafx.scene.accessibility.Attribute;
+import javafx.scene.accessibility.Role;
 import javafx.scene.control.ContextMenu;
 import javafx.scene.control.Label;
 import javafx.scene.control.MenuItem;
@@ -756,6 +758,7 @@
                         }
                     }
                 }
+
             };
             headersRegion.getStyleClass().setAll("headers-region");
             headersRegion.setClip(headerClip);
@@ -1069,6 +1072,13 @@
                 @Override protected double computePrefHeight(double w) {
                     return CLOSE_BTN_SIZE;
                 }
+                @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
+                    switch (attribute) {
+                        case ROLE: return Role.BUTTON;
+                        case TITLE: return "Close";
+                        default: return super.accGetAttribute(attribute, parameters);
+                    }
+                }
             };
             closeBtn.getStyleClass().setAll("tab-close-button");
             closeBtn.setOnMousePressed(new EventHandler<MouseEvent>() {
@@ -1403,6 +1413,14 @@
             clip.setHeight(value);
         }
     
+        @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
+            switch (attribute) {
+                case ROLE: return Role.TAB_ITEM;
+                case TITLE: return getTab().getText();
+                case SELECTED: return selectedTab == getTab();
+                default: return super.accGetAttribute(attribute, parameters);
+            }
+        }
     } /* End TabHeaderSkin */
 
     private static final PseudoClass SELECTED_PSEUDOCLASS_STATE =
@@ -1807,4 +1825,14 @@
             tab.disableProperty().removeListener(weakDisableListener);
         }
     }
+
+    @Override
+    public Object accGetAttribute(Attribute attribute, Object... parameters) {
+        switch (attribute) {
+            case FOCUS_ITEM: return tabHeaderArea.getTabHeaderSkin(selectedTab);
+            case SELECTED_TAB: return tabHeaderArea.getTabHeaderSkin(selectedTab);
+            case TABS: return tabHeaderArea.headersRegion.getChildren();
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableColumnHeader.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableColumnHeader.java	Wed Mar 19 13:06:06 2014 -0700
@@ -40,6 +40,8 @@
 import javafx.geometry.Pos;
 import javafx.geometry.VPos;
 import javafx.scene.Node;
+import javafx.scene.accessibility.Attribute;
+import javafx.scene.accessibility.Role;
 import javafx.scene.control.ContextMenu;
 import javafx.scene.control.Label;
 import javafx.scene.control.TableColumn;
@@ -996,4 +998,16 @@
     @Override public List<CssMetaData<? extends Styleable, ?>> getCssMetaData() {
         return getClassCssMetaData();
     }
+
+    @Override
+    public Object accGetAttribute(Attribute attribute, Object... parameters) {
+        switch (attribute) {
+            /* Having TableColumn role parented by TableColumn causes VoiceOver to be unhappy */
+            case ROLE: return column != null ? Role.TABLE_COLUMN : super.accGetAttribute(attribute, parameters);
+            case INDEX: return getIndex();
+            case TITLE: return column != null ? column.getText() : null;
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
+
 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableHeaderRow.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableHeaderRow.java	Wed Mar 19 13:06:06 2014 -0700
@@ -25,10 +25,7 @@
 
 package com.sun.javafx.scene.control.skin;
 
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 import javafx.beans.InvalidationListener;
 import javafx.beans.Observable;
@@ -416,6 +413,45 @@
         clip.setWidth(tableWidth);
     }
 
+    public TableColumnHeader getColumnHeaderFor(final TableColumnBase<?,?> col) {
+        if (col == null) return null;
+        List<TableColumnBase<?,?>> columnChain = new ArrayList<>();
+        columnChain.add(col);
+
+        TableColumnBase<?,?> parent = col.getParentColumn();
+        while (parent != null) {
+            columnChain.add(0, parent);
+            parent = parent.getParentColumn();
+        }
+
+        // we now have a list from top to bottom of a nested column hierarchy,
+        // and we can now navigate down to retrieve the header with ease
+        TableColumnHeader currentHeader = getRootHeader();
+        for (int depth = 0; depth < columnChain.size(); depth++) {
+            // this is the column we are looking for at this depth
+            TableColumnBase<?,?> column = columnChain.get(depth);
+
+            // and now we iterate through the nested table column header at this
+            // level to get the header
+            currentHeader = getColumnHeaderFor(column, currentHeader);
+        }
+        return currentHeader;
+    }
+
+    public TableColumnHeader getColumnHeaderFor(final TableColumnBase<?,?> col, TableColumnHeader currentHeader) {
+        if (currentHeader instanceof NestedTableColumnHeader) {
+            List<TableColumnHeader> headers = ((NestedTableColumnHeader)currentHeader).getColumnHeaders();
+
+            for (int i = 0; i < headers.size(); i++) {
+                TableColumnHeader header = headers.get(i);
+                if (header.getTableColumn() == col) {
+                    return header;
+                }
+            }
+        }
+
+        return null;
+    }
 
 
     /***************************************************************************
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableRowSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableRowSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -26,9 +26,15 @@
 package com.sun.javafx.scene.control.skin;
 
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
 import javafx.beans.property.DoubleProperty;
+import javafx.scene.accessibility.Attribute;
 import javafx.scene.control.TableCell;
 import javafx.scene.control.TableColumn;
+import javafx.scene.control.TablePosition;
 import javafx.scene.control.TableRow;
 import javafx.scene.control.TableView;
 
@@ -36,10 +42,12 @@
 import com.sun.javafx.scene.control.behavior.TableRowBehavior;
 
 import javafx.beans.property.ObjectProperty;
+import javafx.collections.FXCollections;
 import javafx.collections.ObservableList;
 import javafx.scene.Node;
 import javafx.scene.control.Control;
 import javafx.scene.control.TableColumnBase;
+import javafx.scene.control.TableView.TableViewFocusModel;
 
 /**
  */
@@ -121,4 +129,46 @@
             tableViewSkin = (TableViewSkin)tableView.getSkin();
         }
     }
+
+    @Override
+    protected Object accGetAttribute(Attribute attribute,
+                                     Object... parameters) {
+        switch (attribute) {
+            case SELECTED_CELLS: {
+                // FIXME this could be optimised to iterate over cellsMap only
+                // (selectedCells could be big, cellsMap is much smaller)
+                List<Node> selection = new ArrayList<>();
+                int index = getSkinnable().getIndex();
+                for (TablePosition pos : tableView.getSelectionModel().getSelectedCells()) {
+                    if (pos.getRow() == index) {
+                        TableColumn column = pos.getTableColumn();
+                        if (column == null) {
+                            /* This is the row-based case */
+                            column = tableView.getVisibleLeafColumn(0);
+                        }
+                        TableCell cell = cellsMap.get(column);
+                        if (cell != null) selection.add(cell);
+                    }
+                    return FXCollections.observableArrayList(selection);
+                }
+            }
+            case CELL_AT_ROWCOLUMN: {
+                int colIndex = (Integer)parameters[1];
+                TableColumn column = tableView.getVisibleLeafColumn(colIndex);
+                return cellsMap.get(column);
+            }
+            case FOCUS_ITEM: {
+                TableViewFocusModel<T> fm = tableView.getFocusModel();
+                TablePosition focusedCell = fm.getFocusedCell();
+                TableColumn column = focusedCell.getTableColumn();
+                if (column == null) {
+                    /* This is the row-based case */
+                    column = tableView.getVisibleLeafColumn(0);
+                }
+                return cellsMap.get(column);
+            }
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
+
 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableViewSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableViewSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -25,13 +25,18 @@
 
 package com.sun.javafx.scene.control.skin;
 
+import java.util.ArrayList;
 import java.util.List;
 
+import javafx.beans.InvalidationListener;
+import javafx.beans.Observable;
 import javafx.beans.property.BooleanProperty;
 import javafx.beans.property.ObjectProperty;
+import javafx.collections.FXCollections;
 import javafx.collections.ObservableList;
 import javafx.event.EventHandler;
 import javafx.scene.Node;
+import javafx.scene.accessibility.Attribute;
 import javafx.scene.control.ResizeFeaturesBase;
 import javafx.scene.control.TableCell;
 import javafx.scene.control.TableColumn;
@@ -40,6 +45,7 @@
 import javafx.scene.control.TableSelectionModel;
 import javafx.scene.control.TableView;
 import javafx.scene.control.TableView.TableViewFocusModel;
+import javafx.scene.control.TableView.TableViewSelectionModel;
 import javafx.scene.input.MouseEvent;
 import javafx.scene.layout.Region;
 import javafx.util.Callback;
@@ -112,6 +118,7 @@
         });
 
         registerChangeListener(tableView.fixedCellSizeProperty(), "FIXED_CELL_SIZE");
+
     }
 
     @Override protected void handleControlPropertyChanged(String p) {
@@ -294,7 +301,26 @@
         }
     }
     
-    
+    @Override
+    public Object accGetAttribute(Attribute attribute, Object... parameters) {
+        switch (attribute) {
+            case SELECTED_CELLS: {
+                List<Node> selection = new ArrayList<>();
+                TableViewSelectionModel<T> sm = getSkinnable().getSelectionModel();
+                for (TablePosition pos : sm.getSelectedCells()) {
+                    TableRow<T> row = flow.getCell(pos.getRow());
+                    if (row != null) selection.add(row);
+                }
+                return FXCollections.observableArrayList(selection);
+            }
+            case FOCUS_ITEM: // TableViewSkinBase
+            case CELL_AT_ROWCOLUMN: // TableViewSkinBase
+            case COLUMN_AT_INDEX: // TableViewSkinBase
+            case HEADER: // TableViewSkinBase
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
+
     /***************************************************************************
      *                                                                         *
      * Layout                                                                  *
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableViewSkinBase.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TableViewSkinBase.java	Wed Mar 19 13:06:06 2014 -0700
@@ -37,6 +37,7 @@
 import javafx.collections.ObservableList;
 import javafx.geometry.Insets;
 import javafx.scene.Node;
+import javafx.scene.accessibility.Attribute;
 import javafx.scene.control.*;
 
 import javafx.scene.layout.Region;
@@ -45,6 +46,8 @@
 
 import javafx.collections.WeakListChangeListener;
 import com.sun.javafx.scene.control.skin.resources.ControlResources;
+
+import java.util.ArrayList;
 import java.util.List;
 import javafx.beans.WeakInvalidationListener;
 import javafx.beans.property.BooleanProperty;
@@ -954,4 +957,31 @@
         
         return false;
     }
+
+
+    @Override
+    public Object accGetAttribute(Attribute attribute, Object... parameters) {
+        switch (attribute) {
+            case FOCUS_ITEM: {
+                TableFocusModel<S,?> fm = getFocusModel();
+                int focusedIndex = fm.getFocusedIndex();
+                return flow.getCell(focusedIndex);
+            }
+            case CELL_AT_ROWCOLUMN: {
+                int rowIndex = (Integer)parameters[0];
+                return flow.getCell(rowIndex);
+            }
+            case COLUMN_AT_INDEX: {
+                int index = (Integer)parameters[0];
+                TableColumnBase column = getVisibleLeafColumn(index);
+                return getTableHeaderRow().getColumnHeaderFor(column);
+            }
+            case HEADER: {
+                /* Not sure how this is used by Accessibility, but without this VoiceOver will not
+                 * look for column headers */
+                return getTableHeaderRow();
+            }
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ToolBarSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/ToolBarSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -47,6 +47,9 @@
 import javafx.geometry.VPos;
 import javafx.scene.Node;
 import javafx.scene.Parent;
+import javafx.scene.accessibility.Action;
+import javafx.scene.accessibility.Attribute;
+import javafx.scene.accessibility.Role;
 import javafx.scene.control.ContextMenu;
 import javafx.scene.control.MenuItem;
 import javafx.scene.control.CustomMenuItem;
@@ -572,19 +575,13 @@
             downArrow = new StackPane();
             downArrow.getStyleClass().setAll("arrow");
             downArrow.setOnMousePressed(new EventHandler<MouseEvent>() {
-                @Override public void handle(MouseEvent me) {                    
-                    if (popup.isShowing()) {
-                        popup.hide();
-                    } else {
-                        popup.getItems().clear();
-                        popup.getItems().addAll(menuItems);
-                        popup.show(downArrow, Side.BOTTOM, 0, 0);
-                    }
+                @Override public void handle(MouseEvent me) {
+                    fire();
                 }
             });
 
             setOnKeyPressed(new EventHandler<KeyEvent>() {
-                @Override public void handle(KeyEvent ke) {                    
+                @Override public void handle(KeyEvent ke) {
                     if (KeyCode.SPACE.equals(ke.getCode())) {
                         if (!popup.isShowing()) {
                             popup.getItems().clear();
@@ -598,13 +595,7 @@
                         }
                         ke.consume();
                     } else if (KeyCode.ENTER.equals(ke.getCode())) {
-                        if (popup.isShowing()) {
-                            popup.hide();
-                        } else {
-                            popup.getItems().clear();
-                            popup.getItems().addAll(menuItems);
-                            popup.show(downArrow, Side.BOTTOM, 0, 0);
-                        }
+                        fire();
                         ke.consume();
                     }
                 }
@@ -647,6 +638,16 @@
             getChildren().add(downArrow);            
         }
 
+        private void fire() {
+            if (popup.isShowing()) {
+                popup.hide();
+            } else {
+                popup.getItems().clear();
+                popup.getItems().addAll(menuItems);
+                popup.show(downArrow, Side.BOTTOM, 0, 0);
+            }
+        }
+
         @Override protected double computePrefWidth(double height) {
             return snappedLeftInset() + snappedRightInset();
         }
@@ -671,6 +672,21 @@
             positionInArea(downArrow, x, y, w, h,
                     /*baseline ignored*/0, HPos.CENTER, VPos.CENTER);
         }
+
+        @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
+            switch (attribute) {
+                case ROLE: return Role.BUTTON;
+                case TITLE: return "Overflow button";
+                default: return super.accGetAttribute(attribute, parameters);
+            }
+        }
+
+        @Override public void accExecuteAction(Action action, Object... parameters) {
+            switch (action) {
+                case FIRE: fire(); break;
+                default: super.accExecuteAction(action); break;
+            }
+        }
     }
 
     /***************************************************************************
@@ -757,4 +773,10 @@
         return getClassCssMetaData();
     }
 
+    @Override protected Object accGetAttribute(Attribute attribute, Object... parameters) {
+        switch (attribute) {
+            case OVERFLOW_BUTTON: return overflowMenu;
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeTableRowSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeTableRowSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -25,15 +25,23 @@
 
 package com.sun.javafx.scene.control.skin;
 
+import javafx.collections.FXCollections;
+import javafx.scene.accessibility.Attribute;
+import javafx.scene.control.Control;
+import javafx.scene.control.TableColumnBase;
+import javafx.scene.control.TreeItem;
+import javafx.scene.control.TreeTableCell;
+import javafx.scene.control.TreeTableColumn;
+import javafx.scene.control.TreeTablePosition;
 import javafx.scene.control.TreeTableRow;
 import javafx.scene.control.TreeTableView;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
 import javafx.beans.property.DoubleProperty;
 import javafx.scene.Node;
-import javafx.scene.control.TreeItem;
 
 import javafx.css.StyleableDoubleProperty;
 import javafx.css.CssMetaData;
@@ -45,10 +53,6 @@
 import javafx.collections.ObservableList;
 import javafx.css.Styleable;
 import javafx.css.StyleableProperty;
-import javafx.scene.control.Control;
-import javafx.scene.control.TableColumnBase;
-import javafx.scene.control.TreeTableCell;
-import javafx.scene.control.TreeTableColumn;
 import javafx.util.Callback;
 
 public class TreeTableRowSkin<T> extends TableRowSkinBase<TreeItem<T>, TreeTableRow<T>, TreeTableRowBehavior<T>, TreeTableCell<T,?>> {
@@ -397,4 +401,48 @@
     @Override public List<CssMetaData<? extends Styleable, ?>> getCssMetaData() {
         return getClassCssMetaData();
     }
+
+
+
+    @Override
+    protected Object accGetAttribute(Attribute attribute,
+                                     Object... parameters) {
+        final TreeTableView<T> treeTableView = getSkinnable().getTreeTableView();
+        switch (attribute) {
+            case SELECTED_CELLS: {
+                // FIXME this could be optimised to iterate over cellsMap only
+                // (selectedCells could be big, cellsMap is much smaller)
+                List<Node> selection = new ArrayList<>();
+                int index = getSkinnable().getIndex();
+                for (TreeTablePosition pos : treeTableView.getSelectionModel().getSelectedCells()) {
+                    if (pos.getRow() == index) {
+                        TreeTableColumn column = pos.getTableColumn();
+                        if (column == null) {
+                            /* This is the row-based case */
+                            column = treeTableView.getVisibleLeafColumn(0);
+                        }
+                        TreeTableCell cell = cellsMap.get(column);
+                        if (cell != null) selection.add(cell);
+                    }
+                    return FXCollections.observableArrayList(selection);
+                }
+            }
+            case CELL_AT_ROWCOLUMN: {
+                int colIndex = (Integer)parameters[1];
+                TreeTableColumn column = treeTableView.getVisibleLeafColumn(colIndex);
+                return cellsMap.get(column);
+            }
+            case FOCUS_ITEM: {
+                TreeTableView.TreeTableViewFocusModel<T> fm = treeTableView.getFocusModel();
+                TreeTablePosition focusedCell = fm.getFocusedCell();
+                TreeTableColumn column = focusedCell.getTableColumn();
+                if (column == null) {
+                    /* This is the row-based case */
+                    column = treeTableView.getVisibleLeafColumn(0);
+                }
+                return cellsMap.get(column);
+            }
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeTableViewSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeTableViewSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -29,12 +29,14 @@
 import com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList;
 
 import javafx.event.WeakEventHandler;
-import javafx.scene.control.TreeTableRow;
-import javafx.scene.control.TreeTableView;
+import javafx.scene.accessibility.Attribute;
+import javafx.scene.accessibility.Role;
+import javafx.scene.control.*;
 
 import com.sun.javafx.scene.control.behavior.TreeTableViewBehavior;
 
 import java.lang.ref.WeakReference;
+import java.util.ArrayList;
 import java.util.List;
 
 import javafx.beans.property.BooleanProperty;
@@ -45,13 +47,7 @@
 import javafx.event.EventHandler;
 import javafx.event.EventType;
 import javafx.scene.Node;
-import javafx.scene.control.ResizeFeaturesBase;
-import javafx.scene.control.TableSelectionModel;
-import javafx.scene.control.TreeItem;
-import javafx.scene.control.TreeTablePosition;
 import javafx.scene.control.TreeItem.TreeModificationEvent;
-import javafx.scene.control.TreeTableCell;
-import javafx.scene.control.TreeTableColumn;
 import javafx.scene.input.MouseEvent;
 import javafx.scene.layout.Region;
 import javafx.scene.layout.StackPane;
@@ -382,7 +378,14 @@
 
         // If there is no disclosure node, then add one of my own
         if (cell.getDisclosureNode() == null) {
-            final StackPane disclosureNode = new StackPane();
+            final StackPane disclosureNode = new StackPane() {
+                @Override public Object accGetAttribute(Attribute attribute, Object... parameters) {
+                    switch (attribute) {
+                        case ROLE: return Role.DISCLOSURE_NODE;
+                        default: return super.accGetAttribute(attribute, parameters);
+                    }
+                }
+            };
             disclosureNode.getStyleClass().setAll("tree-disclosure-node");
             disclosureNode.setMouseTransparent(true);
 
@@ -403,6 +406,56 @@
             flow.requestCellLayout();
         }
     }
+
+    @Override
+    public Object accGetAttribute(Attribute attribute, Object... parameters) {
+        switch (attribute) {
+            // --- TableView-specific attributes
+            case SELECTED_CELLS: {
+                List<Node> selection = new ArrayList<>();
+                TreeTableView.TreeTableViewSelectionModel<S> sm = getSkinnable().getSelectionModel();
+                for (TreeTablePosition pos : sm.getSelectedCells()) {
+                    TreeTableRow<S> row = flow.getCell(pos.getRow());
+                    if (row != null) selection.add(row);
+                }
+                return FXCollections.observableArrayList(selection);
+            }
+
+            // TreeView-specific attributes
+            case TREE_ITEM_AT_INDEX: {
+                final int rowIndex = (Integer)parameters[0];
+                return rowIndex < 0 ? null : flow.getCell(rowIndex);
+            }
+//            case CHILDREN: {
+//                return FXCollections.observableArrayList(flow.getCell(0));
+//            }
+//            case ROW_AT_INDEX: {
+//                int rowIndex = (Integer)parameters[0];
+//                return flow.getCell(rowIndex);
+//            }
+//            case SELECTED_ROWS: {
+//                MultipleSelectionModel sm = getSkinnable().getSelectionModel();
+//                ObservableList<Integer> indices = sm.getSelectedIndices();
+//                List<Node> selection = new ArrayList<>(indices.size());
+//                for (int i : indices) {
+//                    TreeTableCell<S> row = flow.getCell(i);
+//
+//                    // We should never, ever get row == null. If we do then
+//                    // something is very wrong.
+//                    assert row != null;
+//
+//                    if (row != null) selection.add(row);
+//                }
+//                return FXCollections.observableArrayList(selection);
+//            }
+
+            case FOCUS_ITEM: // TableViewSkinBase
+            case CELL_AT_ROWCOLUMN: // TableViewSkinBase
+            case COLUMN_AT_INDEX: // TableViewSkinBase
+            case HEADER: // TableViewSkinBase
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
     
     
     /***************************************************************************
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeViewSkin.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/TreeViewSkin.java	Wed Mar 19 13:06:06 2014 -0700
@@ -28,10 +28,14 @@
 import javafx.beans.InvalidationListener;
 import javafx.beans.Observable;
 import javafx.beans.WeakInvalidationListener;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
 import javafx.event.EventHandler;
 import javafx.event.EventType;
 import javafx.event.WeakEventHandler;
 import javafx.scene.Node;
+import javafx.scene.accessibility.Attribute;
+import javafx.scene.accessibility.Role;
 import javafx.scene.control.*;
 import javafx.scene.control.TreeItem.TreeModificationEvent;
 import javafx.scene.input.MouseEvent;
@@ -41,6 +45,8 @@
 import java.lang.ref.WeakReference;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.List;
 
 import com.sun.javafx.scene.control.behavior.TreeViewBehavior;
 
@@ -240,6 +246,21 @@
         // If there is no disclosure node, then add one of my own
         if (cell.getDisclosureNode() == null) {
             final StackPane disclosureNode = new StackPane();
+
+            /* This code is intentionally commented.
+             * Currently as it stands it does provided any functionality and interferes
+             * with TreeView. The VO cursor move over the DISCLOSURE_NODE instead of the 
+             * tree item itself. This is possibly caused by the order of item's children 
+             * (the Labeled and the disclosure node).
+             */
+//            final StackPane disclosureNode = new StackPane() {
+//                @Override protected Object accGetAttribute(Attribute attribute, Object... parameters) {
+//                    switch (attribute) {
+//                        case ROLE: return Role.DISCLOSURE_NODE;
+//                        default: return super.accGetAttribute(attribute, parameters);
+//                    }
+//                }
+//            };
             disclosureNode.getStyleClass().setAll("tree-disclosure-node");
 
             final StackPane disclosureNodeArrow = new StackPane();
@@ -486,4 +507,34 @@
         flow.show(firstVisibleCell);
         return newSelectionIndex;
     }
+
+    @Override
+    public Object accGetAttribute(Attribute attribute, Object... parameters) {
+        switch (attribute) {
+            case FOCUS_ITEM: {
+                FocusModel<?> fm = getSkinnable().getFocusModel();
+                int focusedIndex = fm.getFocusedIndex();
+                return flow.getCell(focusedIndex);
+            }
+            case ROW_AT_INDEX: {
+            	/* Note: Using getVisibleCell() is safer than getCell() for this case.
+            	 * getCell() frequently recycles cells for hidden items which can cause 
+            	 * next sibling traversal to infinite loop.
+            	 */
+                final int rowIndex = (Integer)parameters[0];
+                return rowIndex < 0 ? null : flow.getVisibleCell(rowIndex);
+            }
+            case SELECTED_ROWS: {
+                MultipleSelectionModel<TreeItem<T>> sm = getSkinnable().getSelectionModel();
+                ObservableList<Integer> indices = sm.getSelectedIndices();
+                List<Node> selection = new ArrayList<>(indices.size());
+                for (int i : indices) {
+                    TreeCell<T> row = flow.getCell(i);
+                    if (row != null) selection.add(row);
+                }
+                return FXCollections.observableArrayList(selection);
+            }
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
 }
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/Utils.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/Utils.java	Wed Mar 19 13:06:06 2014 -0700
@@ -363,7 +363,7 @@
 
         if (width < eWidth || height < eHeight) {
             // The ellipsis doesn't fit.
-            return "";
+            return text; // RT-30868 - return text, not empty string.
         }
 
         helper.setText(text);
--- a/modules/controls/src/main/java/javafx/scene/chart/Axis.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/chart/Axis.java	Wed Mar 19 13:06:06 2014 -0700
@@ -37,6 +37,7 @@
 import com.sun.javafx.css.converters.SizeConverter;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 
 import javafx.animation.FadeTransition;
@@ -646,32 +647,11 @@
                     maxWidth = Math.round(Math.max(maxWidth, measureTickMarkSize(value, range).getWidth()));
                 }
             }
-            // we have to work out what new or removed tick marks there are, then create new tick marks and their
-            // text nodes where needed
-            // find everything added or removed
-            List<T> added = new ArrayList<T>();
-            List<TickMark<T>> removed = new ArrayList<TickMark<T>>();
-            if(tickMarks.isEmpty()) {
-                added.addAll(newTickValues);
-            } else {
-                // find removed
-                for (TickMark<T> tick: tickMarks) {
-                    if(!newTickValues.contains(tick.getValue())) removed.add(tick);
-                }
-                // find added
-                for(T newValue: newTickValues) {
-                    boolean found = false;
-                    for (TickMark<T> tick: tickMarks) {
-                        if(tick.getValue().equals(newValue)) {
-                            found = true;
-                            break;
-                        }
-                    }
-                    if(!found) added.add(newValue);
-                }
-            }
-            // remove everything that needs to go
-            for(TickMark<T> tick: removed) {
+
+            // remove everything
+            Iterator<TickMark<T>> tickMarkIterator = tickMarks.iterator();
+            while (tickMarkIterator.hasNext()) {
+                TickMark<T> tick = tickMarkIterator.next();
                 final TickMark<T> tm = tick;
                 if (shouldAnimate()) {
                     FadeTransition ft = new FadeTransition(Duration.millis(250),tick.textNode);
@@ -686,10 +666,11 @@
                     getChildren().remove(tm.textNode);
                 }
                 // we have to remove the tick mark immediately so we don't draw tick line for it or grid lines and fills
-                tickMarks.remove(tm);
+                tickMarkIterator.remove();
             }
+
             // add new tick marks for new values
-            for(T newValue: added) {
+            for(T newValue: newTickValues) {
                 final TickMark<T> tick = new TickMark<T>();
                 tick.setValue(newValue);
                 tick.textNode.setText(getTickMarkLabel(newValue));
--- a/modules/controls/src/main/java/javafx/scene/chart/Chart.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/chart/Chart.java	Wed Mar 19 13:06:06 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -353,36 +353,36 @@
         if (legend != null) {
             boolean shouldShowLegend = isLegendVisible();
             if (shouldShowLegend) {
-                if (getLegendSide().equals(Side.TOP)) {
+                if (getLegendSide() == Side.TOP) {
                     final double legendHeight = snapSize(legend.prefHeight(width-left-right));
-                    final double legendWidth = snapSize(legend.prefWidth(-1));
+                    final double legendWidth = snapSize(legend.prefWidth(legendHeight));
                     legend.resizeRelocate(left + (((width - left - right)-legendWidth)/2), top, legendWidth, legendHeight);
                     if ((height - bottom - top - legendHeight) < MIN_HEIGHT_TO_LEAVE_FOR_CHART_CONTENT) {
                         shouldShowLegend = false;
                     } else {
                         top += legendHeight;
                     }
-                } else if (getLegendSide().equals(Side.BOTTOM)) {
+                } else if (getLegendSide() == Side.BOTTOM) {
                     final double legendHeight = snapSize(legend.prefHeight(width-left-right));
-                    final double legendWidth = snapSize(legend.prefWidth(-1));
+                    final double legendWidth = snapSize(legend.prefWidth(legendHeight));
                     legend.resizeRelocate(left + (((width - left - right)-legendWidth)/2), height-bottom-legendHeight, legendWidth, legendHeight);
                     if ((height - bottom - top - legendHeight) < MIN_HEIGHT_TO_LEAVE_FOR_CHART_CONTENT) {
                         shouldShowLegend = false;
                     } else {
                         bottom += legendHeight;
                     }
-                } else if (getLegendSide().equals(Side.LEFT)) {
+                } else if (getLegendSide() == Side.LEFT) {
                     final double legendWidth = snapSize(legend.prefWidth(height-top-bottom));
-                    final double legendHeight = snapSize(legend.prefHeight(-1));
+                    final double legendHeight = snapSize(legend.prefHeight(legendWidth));
                     legend.resizeRelocate(left,top +(((height-top-bottom)-legendHeight)/2),legendWidth,legendHeight);
                     if ((width - left - right - legendWidth) < MIN_WIDTH_TO_LEAVE_FOR_CHART_CONTENT) {
                         shouldShowLegend = false;
                     } else {
                         left += legendWidth;
                     }
-                } else if (getLegendSide().equals(Side.RIGHT)) {
+                } else if (getLegendSide() == Side.RIGHT) {
                     final double legendWidth = snapSize(legend.prefWidth(height-top-bottom));
-                    final double legendHeight = snapSize(legend.prefHeight(-1));
+                    final double legendHeight = snapSize(legend.prefHeight(legendWidth));
                     legend.resizeRelocate(width-right-legendWidth,top +(((height-top-bottom)-legendHeight)/2),legendWidth,legendHeight);
                     if ((width - left - right - legendWidth) < MIN_WIDTH_TO_LEAVE_FOR_CHART_CONTENT) {
                         shouldShowLegend = false;
--- a/modules/controls/src/main/java/javafx/scene/chart/ValueAxis.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/chart/ValueAxis.java	Wed Mar 19 13:06:06 2014 -0700
@@ -56,9 +56,6 @@
 
     private final Path minorTickPath  = new Path();
 
-    private boolean saveMinorTickVisible = false;
-    private boolean restoreMinorTickVisiblity = false;
-    
     private double offset;
     /** This is the minimum current data value and it is used while auto ranging. */
     private double dataMinValue;
@@ -359,21 +356,11 @@
         super.layoutChildren();
         int numMinorTicks = (getTickMarks().size() - 1)*(getMinorTickCount() - 1);
         double neededLength = (getTickMarks().size()+numMinorTicks)*2;
-        if (length < neededLength) {
-            if (!restoreMinorTickVisiblity) {
-                restoreMinorTickVisiblity = true;
-                saveMinorTickVisible = isMinorTickVisible();
-                setMinorTickVisible(false);
-            }
-        } else {
-            if (restoreMinorTickVisiblity) {
-                setMinorTickVisible(saveMinorTickVisible);
-                restoreMinorTickVisiblity = false;
-            }
-        }
+
         // Update minor tickmarks
         minorTickPath.getElements().clear();
-        if (getMinorTickLength() > 0) {
+        // Don't draw minor tick marks if there isn't enough space for them!
+        if ((neededLength < length) && (0 < getMinorTickLength())) {
             if (Side.LEFT.equals(side)) {
                 // snap minorTickPath to pixels
                 minorTickPath.setLayoutX(-0.5);
--- a/modules/controls/src/main/java/javafx/scene/control/Accordion.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/Accordion.java	Wed Mar 19 13:06:06 2014 -0700
@@ -33,6 +33,8 @@
 import com.sun.javafx.scene.control.skin.AccordionSkin;
 import javafx.beans.property.ObjectPropertyBase;
 import javafx.css.StyleableProperty;
+import javafx.scene.accessibility.Attribute;
+import javafx.scene.accessibility.Role;
 
 /**
  * <p>An accordion is a group of {@link TitledPane TitlePanes}.  Only one TitledPane can be opened at
@@ -206,4 +208,12 @@
         return Boolean.FALSE;
     }
 
+    /** @treatAsPrivate */
+    @Override
+    public Object accGetAttribute(Attribute attribute, Object... parameters) {
+        switch (attribute) {
+            case ROLE: return Role.ACCORDION;
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
 }
--- a/modules/controls/src/main/java/javafx/scene/control/Button.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/Button.java	Wed Mar 19 13:06:06 2014 -0700
@@ -29,9 +29,9 @@
 import javafx.beans.property.BooleanPropertyBase;
 import javafx.event.ActionEvent;
 import javafx.scene.Node;
+import javafx.scene.accessibility.Attribute;
+import javafx.scene.accessibility.Role;
 
-import com.sun.javafx.scene.control.accessible.AccessibleButton;
-import com.sun.javafx.accessible.providers.AccessibleProvider;
 import javafx.css.PseudoClass;
 import com.sun.javafx.scene.control.skin.ButtonSkin;
 
@@ -209,16 +209,13 @@
             = PseudoClass.getPseudoClass("default");
     private static final PseudoClass PSEUDO_CLASS_CANCEL
             = PseudoClass.getPseudoClass("cancel");
-    
-    private AccessibleButton accButton ;
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated @Override public AccessibleProvider impl_getAccessible() {
-        if( accButton == null)
-            accButton = new AccessibleButton(this);
-        return (AccessibleProvider)accButton ;
+
+    /** @treatAsPrivate */
+    @Override
+    public Object accGetAttribute(Attribute attribute, Object... parameters) {
+        switch (attribute) {
+            case ROLE: return Role.BUTTON;
+            default: return super.accGetAttribute(attribute, parameters);
+        }
     }
-    
 }
--- a/modules/controls/src/main/java/javafx/scene/control/ButtonBase.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/ButtonBase.java	Wed Mar 19 13:06:06 2014 -0700
@@ -31,6 +31,7 @@
 import javafx.event.ActionEvent;
 import javafx.event.EventHandler;
 import javafx.scene.Node;
+import javafx.scene.accessibility.Action;
 import javafx.beans.property.ReadOnlyBooleanProperty;
 import javafx.beans.property.ReadOnlyBooleanWrapper;
 
@@ -183,4 +184,14 @@
 
     private static final PseudoClass ARMED_PSEUDOCLASS_STATE = PseudoClass.getPseudoClass("armed");
 
+    /** @treatAsPrivate */
+    @Override 
+    public void accExecuteAction(Action action, Object... parameters) {
+        switch (action) {
+            case FIRE: 
+                fire();
+                break;
+            default: super.accExecuteAction(action);
+        }
+    }
 }
--- a/modules/controls/src/main/java/javafx/scene/control/Cell.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/Cell.java	Wed Mar 19 13:06:06 2014 -0700
@@ -36,8 +36,6 @@
 import javafx.scene.layout.GridPane;
 import javafx.scene.layout.HBox;
 import javafx.scene.shape.Rectangle;
-import com.sun.javafx.scene.control.accessible.AccessibleListItem;
-import com.sun.javafx.accessible.providers.AccessibleProvider;
 import javafx.css.PseudoClass;
 import javafx.beans.property.ReadOnlyBooleanProperty;
 import javafx.beans.property.ReadOnlyBooleanWrapper;
@@ -656,17 +654,6 @@
         if (selected && isEmpty()) return;
         setSelected(selected);
     }
-
-    private AccessibleListItem accListItem ;
-    /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
-    @Deprecated @Override public AccessibleProvider impl_getAccessible() {
-        if( accListItem == null)
-            accListItem = new AccessibleListItem(this);
-        return (AccessibleProvider)accListItem ;
-    }
     
     
     /***************************************************************************
--- a/modules/controls/src/main/java/javafx/scene/control/CheckBox.java	Wed Mar 19 08:57:26 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/CheckBox.java	Wed Mar 19 13:06:06 2014 -0700
@@ -31,9 +31,9 @@
 
 import javafx.event.ActionEvent;
 import javafx.geometry.Pos;
-import com.sun.javafx.scene.control.accessible.AccessibleCheckBox;
-import com.sun.javafx.accessible.providers.AccessibleProvider;
 import javafx.css.PseudoClass;
+import javafx.scene.accessibility.Attribute;
+import javafx.scene.accessibility.Role;
 import com.sun.javafx.scene.control.skin.CheckBoxSkin;
 
 /**
@@ -131,6 +131,7 @@
                     final boolean active = get();
                     pseudoClassStateChanged(PSEUDO_CLASS_DETERMINATE,  !active);
                     pseudoClassStateChanged(PSEUDO_CLASS_INDETERMINATE, active);
+                    accSendNotification(Attribute.TOGGLE_STATE);