changeset 7232:da52f6e7f012

[Accessibility] Very rudimentary a11y support for TextFlow (note that TextFlow currently is not used by Controls, better support will be required is that ever changes)
author Felipe Heidrich <felipe.heidrich@oracle.com>
date Mon, 09 Jun 2014 15:28:01 -0700
parents 72d965b4d0f5
children 30b24988ef50
files modules/graphics/src/main/java/javafx/scene/text/TextFlow.java
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/javafx/scene/text/TextFlow.java	Tue Jun 10 11:20:09 2014 -0400
+++ b/modules/graphics/src/main/java/javafx/scene/text/TextFlow.java	Mon Jun 09 15:28:01 2014 -0700
@@ -37,6 +37,8 @@
 import javafx.geometry.Orientation;
 import javafx.geometry.VPos;
 import javafx.scene.Node;
+import javafx.scene.accessibility.Attribute;
+import javafx.scene.accessibility.Role;
 import javafx.scene.layout.Pane;
 import javafx.css.StyleableDoubleProperty;
 import javafx.css.StyleableObjectProperty;
@@ -551,4 +553,22 @@
     }
     /* end of copied code */
 
+    /** @treatAsPrivate */
+    @Override
+    public Object accGetAttribute(Attribute attribute, Object... parameters) {
+        switch (attribute) {
+            case ROLE: return Role.TEXT;
+            case TITLE: {
+                StringBuilder title = new StringBuilder();
+                for (Node node: getChildren()) {
+                    Object text = node.accGetAttribute(Attribute.TITLE, parameters);
+                    if (text != null) {
+                        title.append(text.toString());
+                    }
+                }
+                return title.toString();
+            }
+            default: return super.accGetAttribute(attribute, parameters);
+        }
+    }
 }