functional/ControlsTests/src/javafx/scene/control/test/utils/ptables/PropertiesTable.java

Print this page

        

@@ -34,11 +34,10 @@
 import javafx.beans.property.ObjectProperty;
 import javafx.beans.property.Property;
 import javafx.beans.property.ReadOnlyProperty;
 import javafx.scene.Node;
 import javafx.scene.layout.FlowPane;
-import javafx.scene.layout.FlowPaneBuilder;
 import javafx.scene.layout.VBox;
 import static javafx.scene.control.test.utils.ptables.AbstractApplicationPropertiesRegystry.DEFAULT_DOMAIN_NAME;
 
 /**
  * @author Alexander Kirov

@@ -76,12 +75,12 @@
  */
 public class PropertiesTable extends VBox implements AbstractPropertiesTable, Refreshable {
 
     public final static String PROPERTIES_TABLE_SUFFIX_ID = "_PROPERTY_TABLE_ID";
     private final VBox linesVBox = new VBox(5);
-    private final FlowPane countersFlowPane = FlowPaneBuilder.create().vgap(5).hgap(5).build();
-    private final FlowPane listenersFlowPane = FlowPaneBuilder.create().vgap(5).hgap(5).build();
+    private final FlowPane countersFlowPane;
+    private final FlowPane listenersFlowPane;
     private final Object testedControl;
     private String domainName;
     /**
      * Matches property name, on its controller.
      */

@@ -95,10 +94,16 @@
      */
     private HashMap<String, AbstractPropertyValueListener> readonlyPropertyListeners = new HashMap<String, AbstractPropertyValueListener>();
 
     public PropertiesTable(Object testedControl) {
         super(5);
+        countersFlowPane = new FlowPane();
+        countersFlowPane.setVgap(5);
+        countersFlowPane.setHgap(5);
+        listenersFlowPane = new FlowPane();
+        listenersFlowPane.setVgap(5);
+        listenersFlowPane.setHgap(5);
         this.domainName = DEFAULT_DOMAIN_NAME;
         this.setId(DEFAULT_DOMAIN_NAME + PROPERTIES_TABLE_SUFFIX_ID);
         getChildren().add(0, countersFlowPane);
         getChildren().add(1, listenersFlowPane);
         getChildren().add(2, linesVBox);

@@ -149,11 +154,14 @@
     }
 
     @Override
     public void addDoublePropertyLine(final DoubleProperty bindableProperty, double min, double max, double initial, Object owningObject) {
         AbstractPropertyController controller = new PropertyValueController(bindableProperty, testedControl, min, initial, max);
-        propertyControllers.put(bindableProperty.getName().toUpperCase(), controller);
+        AbstractPropertyController old_controller = propertyControllers.put(bindableProperty.getName().toUpperCase(), controller);
+        if (old_controller != null) {
+            linesVBox.getChildren().remove(old_controller.getVisualRepresentation());
+        }
         linesVBox.getChildren().add(controller.getVisualRepresentation());
     }
 
     @Override
     public void addIntegerPropertyLine(final IntegerProperty bindableProperty, int min, int max, int initial) {