changeset 316:a1590965f8b4 2.1-b10

RT-18813: Accordion doesn't change pane correctly programmatically.
author Kinsley Wong
date Tue, 24 Jan 2012 14:11:46 -0800
parents 1a40380a6c30
children dd487d21afcc 7603128a3d29 90103969cc77
files javafx-ui-controls/src/javafx/scene/control/Accordion.java
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/javafx/scene/control/Accordion.java	Tue Jan 24 11:22:32 2012 -0800
+++ b/javafx-ui-controls/src/javafx/scene/control/Accordion.java	Tue Jan 24 14:11:46 2012 -0800
@@ -109,7 +109,22 @@
      **************************************************************************/
 
     // --- Expanded Pane
-    private ObjectProperty<TitledPane> expandedPane = new SimpleObjectProperty<TitledPane>(this, "expandedPane");
+    private ObjectProperty<TitledPane> expandedPane = new SimpleObjectProperty<TitledPane>(this, "expandedPane") {
+        @Override public void set(final TitledPane newSelectedToggle) {
+            if (isBound()) {
+                throw new java.lang.RuntimeException("A bound value cannot be set.");
+            }            
+            if (newSelectedToggle != null) {
+                newSelectedToggle.setExpanded(true);
+            } else {
+                TitledPane old = get();
+                if (old != null) {
+                    old.setExpanded(false);
+                }
+            }
+            super.set(newSelectedToggle);
+        }
+    };
 
     /**
      * <p>The expanded {@link TitledPane} that is currently visible. While it is technically