changeset 1040:bb65505b749f

RT-21471: ControlTest testRT18097 fails due to improper initialization of alignmentProperty in CheckBoxTableCell
author jgiles
date Fri, 11 May 2012 12:19:05 +1200
parents 07e5fa9c1741
children bdef141ae0e6
files javafx-ui-controls/src/javafx/scene/control/cell/CheckBoxTableCell.java
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/javafx/scene/control/cell/CheckBoxTableCell.java	Fri May 11 12:13:42 2012 +1200
+++ b/javafx-ui-controls/src/javafx/scene/control/cell/CheckBoxTableCell.java	Fri May 11 12:19:05 2012 +1200
@@ -24,6 +24,7 @@
  */
 package javafx.scene.control.cell;
 
+import com.sun.javafx.css.StyleableProperty;
 import javafx.beans.binding.Bindings;
 import javafx.beans.property.BooleanProperty;
 import javafx.beans.property.ObjectProperty;
@@ -243,10 +244,14 @@
         this.showLabel = converter != null;
         
         this.checkBox = new CheckBox();
-//        this.checkBox.setAlignment(Pos.TOP_CENTER);
+        setGraphic(checkBox);
         
-//        setAlignment(Pos.CENTER);
-        setGraphic(checkBox);
+        // alignment is styleable through css. Calling setAlignment
+        // makes it look to css like the user set the value and css will not 
+        // override. Initializing alignment by calling set on the 
+        // StyleableProperty ensures that css will be able to override the value.
+        final StyleableProperty prop = StyleableProperty.getStyleableProperty(alignmentProperty());
+        prop.set(this, Pos.CENTER);
         
         if (showLabel) {
             this.checkBox.setAlignment(Pos.CENTER_LEFT);