changeset 10680:30e39831260a

8087541: [Accessibility] BubbleChart values are not getting read Reviewed-by: kcr, aghaisas
author pkbalakr
date Wed, 25 Oct 2017 16:51:58 +0530
parents 6c40427a4237
children 60a56874d865
files modules/javafx.controls/src/main/java/javafx/scene/chart/BubbleChart.java
diffstat 1 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.controls/src/main/java/javafx/scene/chart/BubbleChart.java	Tue Oct 24 14:33:58 2017 -0700
+++ b/modules/javafx.controls/src/main/java/javafx/scene/chart/BubbleChart.java	Wed Oct 25 16:51:58 2017 +0530
@@ -31,9 +31,12 @@
 
 import javafx.animation.FadeTransition;
 import javafx.animation.ParallelTransition;
+import javafx.application.Platform;
 import javafx.beans.NamedArg;
 import javafx.collections.FXCollections;
 import javafx.collections.ObservableList;
+import javafx.scene.AccessibleAttribute;
+import javafx.scene.AccessibleRole;
 import javafx.scene.Node;
 import javafx.scene.layout.StackPane;
 import javafx.scene.shape.Ellipse;
@@ -232,7 +235,25 @@
         Node bubble = item.getNode();
         // check if bubble has already been created
         if (bubble == null) {
-            bubble = new StackPane();
+            bubble = new StackPane() {
+                @Override
+                public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters) {
+                    switch (attribute) {
+                        case TEXT: {
+                            String accText = getAccessibleText();
+                            if (item.getExtraValue() == null) {
+                                return accText;
+                            } else {
+                                return accText + " Bubble radius is " + item.getExtraValue();
+                            }
+                        }
+                        default: return super.queryAccessibleAttribute(attribute, parameters);
+                    }
+                }
+            };
+            bubble.setAccessibleRole(AccessibleRole.TEXT);
+            bubble.setAccessibleRoleDescription("Bubble");
+            bubble.focusTraversableProperty().bind(Platform.accessibilityActiveProperty());
             item.setNode(bubble);
         }
         // set bubble styles