changeset 575:159ae36c5cbe 2.1-b16

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/2.1/MASTER/jfx/rt
author Kinsley Wong
date Tue, 06 Mar 2012 10:41:09 -0800
parents 12a91a4f9ee6 ca0f557cdc2d
children 6849d3d0ebf5 ff29bdcdba92 deee098bddff
files
diffstat 27 files changed, 1183 insertions(+), 94 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-designtime/src/javafx/scene/layout/GridPaneDesignInfo.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-designtime/src/javafx/scene/layout/GridPaneDesignInfo.java	Tue Mar 06 10:41:09 2012 -0800
@@ -63,22 +63,34 @@
         }
         return numColumns;
     }
-
+    
     public Bounds getCellBounds(GridPane pane, int columnIndex, int rowIndex) {
         final double snaphgap = pane.snapSpace(pane.getHgap());
         final double snapvgap = pane.snapSpace(pane.getVgap());
         final double top = pane.snapSpace(pane.getInsets().getTop());
+        final double right = pane.snapSpace(pane.getInsets().getRight());
+        final double bottom = pane.snapSpace(pane.getInsets().getBottom());
         final double left = pane.snapSpace(pane.getInsets().getLeft());
+        final double gridPaneHeight = pane.snapSize(pane.getHeight()) - (top + bottom);
+        final double gridPaneWidth = pane.snapSize(pane.getWidth()) - (left + right);
 
         // Compute row height
-        double[] rowHeights = pane.getRowHeights();        
+        double[] rowHeights = pane.getRowHeights();
         if (rowHeights == null || rowHeights.length == 0) {
             rowHeights = new double[] {0};
             rowIndex = 0;
         }
-        double minY = top;
+
+        // Compute the total row height
+        double rowTotal = 0;
+        for (int i = 0; i < rowHeights.length; i++) {
+            rowTotal += rowHeights[i];
+        }
+        rowTotal += ((rowHeights.length - 1) * snapvgap);
+
+        // Adjust for alignment
+        double minY = top + Region.computeYOffset(gridPaneHeight, rowTotal, pane.getAlignment().getVpos());
         double height = rowHeights[rowIndex];
-
         for (int j = 0; j < rowIndex; j++) {
             minY += rowHeights[j] + snapvgap;
         }
@@ -89,9 +101,17 @@
             columnWidths = new double[] {0};
             columnIndex = 0;
         }
-        double minX = left;
+
+        // Compute the total column width
+        double columnTotal = 0;
+        for (int i = 0; i < columnWidths.length; i++) {
+            columnTotal += columnWidths[i];
+        }
+        columnTotal += ((columnWidths.length - 1) * snaphgap);
+
+        // Adjust for alignment
+        double minX = left + Region.computeXOffset(gridPaneWidth, columnTotal, pane.getAlignment().getHpos());
         double width = columnWidths[columnIndex];
-
         for (int j = 0; j < columnIndex; j++) {
             minX += columnWidths[j] + snaphgap;
         }
--- a/javafx-designtime/test/javafx/scene/layout/GridPaneDesignInfoTest.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-designtime/test/javafx/scene/layout/GridPaneDesignInfoTest.java	Tue Mar 06 10:41:09 2012 -0800
@@ -8,6 +8,7 @@
 import static org.junit.Assert.assertEquals;
 import javafx.geometry.BoundingBox;
 import javafx.geometry.HPos;
+import javafx.geometry.Pos;
 import javafx.geometry.VPos;
 
 import org.junit.Before;
@@ -89,4 +90,51 @@
         assertEquals(new BoundingBox(205, 114, 75, 40), designInfo.getCellBounds(gridpane, 3, 2));
         assertEquals(new BoundingBox(285, 52, 110, 60), designInfo.getCellBounds(gridpane, 4, 1));
     }
+    
+    @Test public void testGridPaneGetCellBoundsWithCENTERAlignment() {
+        gridpane.setAlignment(Pos.CENTER);
+        MockResizable child1 = new MockResizable(75, 50, 75, 50, 75, 50);
+        MockResizable child2 = new MockResizable(90, 50, 90, 50, 90, 50);
+        MockResizable child3 = new MockResizable(115, 100, 115, 100, 115, 100);
+        MockResizable child4 = new MockResizable(75, 60, 75, 60, 75, 60);
+        MockResizable child5 = new MockResizable(75, 40, 75, 40, 75, 40);
+        MockResizable child6 = new MockResizable(110, 60, 110, 60, 110, 60);
+
+        gridpane.addColumn(0, child1, child2, child3, child4, child5, child6);
+
+        GridPane.setConstraints(child1, 0, 0);
+        GridPane.setConstraints(child2, 2, 0);
+        GridPane.setConstraints(child3, 1, 1);
+        GridPane.setConstraints(child4, 3, 1);
+        GridPane.setConstraints(child5, 4, 1);
+        GridPane.setConstraints(child6, 3, 2);
+        GridPane.setHalignment(child3, HPos.LEFT);
+        GridPane.setValignment(child3, VPos.TOP);
+
+        GridPane.setRowSpan(child3, 2);
+        GridPane.setColumnSpan(child3, 2);
+        gridpane.setHgap(5);
+        gridpane.setVgap(2);
+
+        ColumnConstraints column1 = new ColumnConstraints(75);
+        ColumnConstraints column2 = new ColumnConstraints(25);
+        ColumnConstraints column3 = new ColumnConstraints(90);
+        ColumnConstraints column4 = new ColumnConstraints(75);
+        ColumnConstraints column5 = new ColumnConstraints(110);
+        gridpane.getColumnConstraints().addAll(column1, column2, column3, column4, column5);
+
+        RowConstraints row1 = new RowConstraints(50);
+        RowConstraints row2 = new RowConstraints(60);
+        RowConstraints row3 = new RowConstraints(40);
+        RowConstraints row4 = new RowConstraints(50);
+        gridpane.getRowConstraints().addAll(row1, row2, row3, row4);
+        gridpane.layout();
+
+        assertEquals(new BoundingBox(-197.5, -103, 75, 50), designInfo.getCellBounds(gridpane, 0, 0));
+        assertEquals(new BoundingBox(-87.5, -103, 90, 50), designInfo.getCellBounds(gridpane, 2, 0));
+        assertEquals(new BoundingBox(-117.5, -51, 25, 60), designInfo.getCellBounds(gridpane, 1, 1));
+        assertEquals(new BoundingBox(7.5, -51, 75, 60), designInfo.getCellBounds(gridpane, 3, 1));
+        assertEquals(new BoundingBox(7.5, 11, 75, 40), designInfo.getCellBounds(gridpane, 3, 2));
+        assertEquals(new BoundingBox(87.5, -51, 110, 60), designInfo.getCellBounds(gridpane, 4, 1));
+    }     
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-charts/test/javafx/scene/chart/XYChartTest.java	Tue Mar 06 10:41:09 2012 -0800
@@ -0,0 +1,39 @@
+/*
+ * To change this template, choose Tools | Templates and open the template in
+ * the editor.
+ */
+package javafx.scene.chart;
+
+
+import org.junit.Test;
+import javafx.collections.*;
+
+import com.sun.javafx.pgstub.StubToolkit;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+
+
+
+public class XYChartTest extends ChartTestBase {
+    
+    NumberAxis yaxis;
+    CategoryAxis cataxis;
+    
+    protected Chart createChart() {
+        ObservableList<String> cat = FXCollections.observableArrayList();
+        cataxis = CategoryAxisBuilder.create().build();
+        yaxis = NumberAxisBuilder.create().build();
+        ObservableList<XYChart.Series<String, Number>> nodata = FXCollections.observableArrayList();
+        AreaChart<?, ?> areachart = new AreaChart<String, Number>(cataxis, yaxis, nodata);
+        areachart.setId("AreaChart");
+        return areachart;
+    }
+    
+    @Test
+    public void testTickMarksToString() {
+        startApp();
+        pulse();
+        yaxis.getTickMarks().toString(); 
+        System.out.println(" --- "+yaxis.getTickMarks().toString());
+    }
+}
--- a/javafx-ui-common/javafx-ui-common.iml	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-common/javafx-ui-common.iml	Tue Mar 06 10:41:09 2012 -0800
@@ -4,7 +4,7 @@
     <exclude-output />
     <content url="file://$MODULE_DIR$">
       <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/test/unit" isTestSource="true" />
       <excludeFolder url="file://$MODULE_DIR$/.externalToolBuilders" />
       <excludeFolder url="file://$MODULE_DIR$/.settings" />
       <excludeFolder url="file://$MODULE_DIR$/nbproject" />
--- a/javafx-ui-common/src/javafx/scene/Scene.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-common/src/javafx/scene/Scene.java	Tue Mar 06 10:41:09 2012 -0800
@@ -4204,7 +4204,7 @@
      * event handler. More detail about dragging gestures can be found
      * in the overview of {@link MouseEvent} and {@link MouseDragEvent}.
      *
-     * @see MosueEvent
+     * @see MouseEvent
      * @see MouseDragEvent
      * @throws IllegalStateException if the full press-drag-release gesture
      * cannot be started at this moment (it's called outside of
--- a/javafx-ui-common/src/javafx/scene/layout/BorderPane.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-common/src/javafx/scene/layout/BorderPane.java	Tue Mar 06 10:41:09 2012 -0800
@@ -38,12 +38,15 @@
 
 /**
  * BorderPane lays out children in top, left, right, bottom, and center positions.
+ * 
+ * <p> <img src="doc-files/borderpane.png"/> </p>
+ * 
  * The top and bottom children will be resized to their preferred heights and
  * extend the width of the borderpane.  The left and right children will be resized
  * to their preferred widths and extend the length between the top and bottom nodes.
  * And the center node will be resized to fill the available space in the middle.
  * Any of the positions may be null.
- *
+ *  
  * Example:
  * <pre><code>     <b>BorderPane borderpane = new BorderPane();</b>
  *     ToolBar toolbar = new ToolBar();
Binary file javafx-ui-common/src/javafx/scene/layout/doc-files/borderpane.png has changed
--- a/javafx-ui-common/test/unit/com/sun/javafx/pgstub/StubToolkit.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-common/test/unit/com/sun/javafx/pgstub/StubToolkit.java	Tue Mar 06 10:41:09 2012 -0800
@@ -65,6 +65,7 @@
 import com.sun.javafx.geom.PerspectiveCameraImpl;
 import com.sun.javafx.geom.Shape;
 import com.sun.javafx.geom.transform.BaseTransform;
+import com.sun.javafx.menu.MenuBase;
 import com.sun.javafx.perf.PerformanceTracker;
 import com.sun.javafx.runtime.async.AsyncOperation;
 import com.sun.javafx.runtime.async.AsyncOperationListener;
@@ -180,7 +181,7 @@
 
     @Override
     public TKSystemMenu getSystemMenu() {
-        throw new UnsupportedOperationException("Not supported yet.");
+	return new StubSystemMenu();
     }
 
     @Override
@@ -658,7 +659,10 @@
 
     @Override
     public PathElement[] convertShapeToFXPath(Object shape) {
-        throw new UnsupportedOperationException();
+        // Had to be mocked up for TextField tests (for the caret!)
+        // Since the "shape" could be anything, I'm just returning
+        // something here, doesn't matter what.
+        return new PathElement[0];
     }
 
     @Override
@@ -914,4 +918,18 @@
             return dpi;
         }
     }
+    
+    public static class StubSystemMenu implements TKSystemMenu {
+
+        @Override
+        public boolean isSupported() {
+            return false;
+        }
+
+        @Override
+        public void setMenus(List<MenuBase> menus) {
+            throw new UnsupportedOperationException("Not supported yet.");
+        }
+
+    }
 }
--- a/javafx-ui-common/test/unit/javafx/scene/FocusTest.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-common/test/unit/javafx/scene/FocusTest.java	Tue Mar 06 10:41:09 2012 -0800
@@ -182,6 +182,50 @@
     }
 
     /**
+     * Test removing the focus owner without another eligible node in the scene.
+     */
+    @Test
+    public void testRemove_ClearsFocusOnRemovedNode1() {
+        Node n = n();
+        scene.setRoot(new Group());
+        scene.getRoot().getChildren().add(n);
+        n.requestFocus();
+        scene.getRoot().getChildren().remove(n);
+        fireTestPulse();
+        assertNotFocused(scene, n);
+    }
+
+    /**
+     * Test removing the focus owner with another eligible node in the scene.
+     */
+    @Test
+    public void testRemove_ClearsFocusOnRemovedNode2() {
+        Node n = n();
+        scene.setRoot(new Group());
+        scene.getRoot().getChildren().addAll(n, n());
+        n.requestFocus();
+        scene.getRoot().getChildren().remove(n);
+        fireTestPulse();
+        assertNotFocused(scene, n);
+        assertIsFocused(scene, scene.getRoot().getChildren().get(0));
+    }
+
+    /**
+     * Test removing the focus owner without another eligible node in the scene.
+     */
+    @Test
+    public void testRemoveChildOfGroup_ClearsFocusOnRemovedNode1() {
+        Node n = n();
+        Group g = new Group(n);
+        scene.setRoot(new Group());
+        scene.getRoot().getChildren().add(g);
+        n.requestFocus();
+        g.getChildren().remove(n);
+        fireTestPulse();
+        assertNotFocused(scene, n);
+    }
+
+    /**
      * Test making the focus owner invisible without another eligible
      * node in the scene.
      */
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TextAreaBehavior.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TextAreaBehavior.java	Tue Mar 06 10:41:09 2012 -0800
@@ -137,6 +137,7 @@
                 } else {
 //                    skin.hideCaret();
                     focusGainedByMouseClick = false;
+                    setCaretAnimating(false);
                 }
             }
         });
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TextFieldBehavior.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TextFieldBehavior.java	Tue Mar 06 10:41:09 2012 -0800
@@ -113,6 +113,7 @@
         } else {
             textField.selectRange(0, 0);
             focusGainedByMouseClick = false;
+            setCaretAnimating(false);
         }
     }
 
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxBaseSkin.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxBaseSkin.java	Tue Mar 06 10:41:09 2012 -0800
@@ -158,7 +158,7 @@
         final Insets padding = getInsets();
 
         if (displayNode == null) {
-            final int DEFAULT_HEIGHT = 20;
+            final int DEFAULT_HEIGHT = 21;
             final Insets arrowButtonPadding = arrowButton.getInsets();
             double arrowHeight = arrowButtonPadding.getTop() + arrow.prefHeight(-1) + arrowButtonPadding.getBottom();
             return padding.getTop() + Math.max(DEFAULT_HEIGHT, arrowHeight) + padding.getBottom();
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Tue Mar 06 10:41:09 2012 -0800
@@ -89,7 +89,6 @@
                 // ever giving the event to the TextField.
                 if (t instanceof KeyEvent) {
                     KeyEvent ke = (KeyEvent)t;
-                    if (ke.getEventType() != KeyEvent.KEY_RELEASED) return;
                     
                     if (ke.getCode() == KeyCode.ENTER) {
                         StringConverter<T> c = comboBox.getConverter();
@@ -98,7 +97,7 @@
                         comboBox.setValue(value);
                         t.consume();
                         return;
-                    } else if (ke.getCode() == KeyCode.F4) {
+                    } else if (ke.getCode() == KeyCode.F4 && ke.getEventType() == KeyEvent.KEY_RELEASED) {
                         if (comboBox.isShowing()) comboBox.hide();
                         else comboBox.show();
                         t.consume();
@@ -316,7 +315,7 @@
                         rowsToMeasure = (Integer) comboBox.getProperties().get(COMBO_BOX_ROWS_TO_MEASURE_WIDTH_KEY);
                     }
                     
-                    pw = skin.getMaxCellWidth(rowsToMeasure) + 30;
+                    pw = Math.max(comboBox.getWidth(), skin.getMaxCellWidth(rowsToMeasure) + 30);
                 } else {
                     pw = Math.max(100, comboBox.getWidth());
                 }
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/LabeledSkinBase.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/LabeledSkinBase.java	Tue Mar 06 10:41:09 2012 -0800
@@ -63,7 +63,7 @@
      *  The Text node used to display the text. This is package only
      *  for the sake of testing!
      */
-    Text text;
+    LabeledText text;
 
     /**
      * Indicates that the text content is invalid and needs to be updated.
@@ -125,27 +125,11 @@
 
         // Configure the Text node with all of the attributes from the
         // Labeled which apply to it.
-        text = new Text();
-        text.getStyleClass().add("text");
-        //
-        // RT-16589: by binding text.fontProperty() to labeled.fontProperty(), 
-        // we achieve two things. First, the text's font stays in sync with
-        // labeled's and, second, it prevents text's font from being updated 
-        // by CSS. 
-        //
-        text.fontProperty().bind(labeled.fontProperty());
-        
-        // RT-18858: by binding text.fillProperty() to labeled.textFillProperty(),
-        // The text can only be styled through -fx-text-fill.
-        // The reason is because -fx-text-fill is encountered first by CSS and then 
-        // gets overwritten by the latter application of -fx-fill.
-        text.fillProperty().bind(labeled.textFillProperty());
+        text = new LabeledText(labeled);
         
         textClip = new Rectangle();
         text.setClip(textClip);
         
-        updateTextAlignment();
-        updateUnderline();
         updateChildren();
 
         // Labels do not block the mouse by default, unlike most other UI Controls.
@@ -223,14 +207,13 @@
             textMetricsChanged();
             invalidateWidths();
         } else if (p == "TEXT_ALIGNMENT") {
-            updateTextAlignment();
+            // NO-OP
         } else if (p == "TEXT_OVERRUN") {
             textMetricsChanged();
         } else if (p == "WRAP_TEXT") {
             updateWrappingWidth();
             textMetricsChanged();
         } else if (p == "UNDERLINE") {
-            updateUnderline();
             textMetricsChanged();
         }
     }
@@ -486,26 +469,6 @@
     }
 
     /**
-     * Updates the text alignment of the Text node. Although changing the font
-     * does affect the metrics used for text layout, this method does not
-     * call requestLayout or invalidate the text, since it may be called
-     * from the constructor and such work would be duplicative and wasted.
-     */
-    private void updateTextAlignment() {
-        text.setTextAlignment(getSkinnable().getTextAlignment());
-    }
-
-    /**
-     * Updates the underline of the text node. Although changing the font
-     * does affect the metrics used for text layout, this method does not
-     * call requestLayout or invalidate the text, since it may be called
-     * from the constructor and such work would be duplicative and wasted.
-     */
-    private void updateUnderline() {
-        text.setUnderline(getSkinnable().isUnderline());
-    }
-
-    /**
      * Updates the wrapping width of the text node. Although changing the font
      * does affect the metrics used for text layout, this method does not
      * call requestLayout or invalidate the text, since it may be called
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/LabeledText.java	Tue Mar 06 10:41:09 2012 -0800
@@ -0,0 +1,261 @@
+package com.sun.javafx.scene.control.skin;
+
+import com.sun.javafx.css.StyleableProperty;
+import com.sun.javafx.css.Stylesheet;
+import com.sun.javafx.css.converters.BooleanConverter;
+import com.sun.javafx.css.converters.EnumConverter;
+import com.sun.javafx.css.converters.PaintConverter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import javafx.beans.property.Property;
+import javafx.beans.value.WritableValue;
+import javafx.scene.control.Labeled;
+import javafx.scene.paint.Paint;
+import javafx.scene.text.Font;
+import javafx.scene.text.Text;
+import javafx.scene.text.TextAlignment;
+
+/**
+ * LabeledText allows the Text to be styled by the CSS properties of Labeled 
+ * that are meant to style the textual component of the Labeled. 
+ * 
+ * LabeledText has the style class "text"
+ */
+public class LabeledText extends Text {
+
+   private final Labeled labeled;
+
+   public LabeledText(Labeled labeled) {
+       super();
+       
+       if (labeled == null) {
+           throw new IllegalArgumentException("labeled cannot be null");
+       }
+       
+       this.labeled = labeled;
+       
+       //
+       // init the state of this Text object to that of the Labeled
+       // 
+       this.setFill(this.labeled.getTextFill());
+       this.setFont(this.labeled.getFont());
+       this.setTextAlignment(this.labeled.getTextAlignment());
+       this.setUnderline(this.labeled.isUnderline());
+       
+       //
+       // Bind the state of this Text object to that of the Labeled.
+       // Binding these properties prevents CSS from setting them
+       //
+       this.fillProperty().bind(this.labeled.textFillProperty());
+       this.fontProperty().bind(this.labeled.fontProperty());
+       // do not bind text - Text doesn't have -fx-text
+       this.textAlignmentProperty().bind(this.labeled.textAlignmentProperty());
+       this.underlineProperty().bind(this.labeled.underlineProperty());
+       
+       getStyleClass().addAll("text");        
+   }
+
+   /**
+    * @treatAsPrivate implementation detail
+    * @deprecated This is an internal API that is not intended for use and will be removed in the next version
+    */
+   @Deprecated
+   @Override public List<StyleableProperty> impl_getStyleableProperties() {
+       return impl_CSS_STYLEABLES();
+   }
+
+   /**
+    * @treatAsPrivate implementation detail
+    * @deprecated This is an internal API that is not intended for use and will be removed in the next version
+    */
+   @Deprecated
+   public static List<StyleableProperty> impl_CSS_STYLEABLES() {
+       return StyleableProperties.STYLEABLES;
+   }
+
+   //
+   // Replace all of Text's StyleableProperty instances that overlap with Labeled
+   // with instances of StyleableProperty that redirect to Labeled. Thus, when
+   // the Labeled is styled, 
+   //
+   private static class StyleableProperties {
+
+       private static final StyleableProperty<LabeledText,Font> FONT = 
+           new StyleableProperty.FONT<LabeledText>("-fx-font", Font.getDefault()) {
+
+            @Override
+            public void set(LabeledText node, Font value, Stylesheet.Origin origin) {
+                //
+                // In the case where the Labeled's textFill was set by an 
+                // inline style, this inline style should override values
+                // from lesser origins.
+                // 
+                WritableValue<Font> prop = node.labeled.fontProperty();
+                Stylesheet.Origin propOrigin = StyleableProperty.getOrigin(prop);
+                
+                // 
+                // if propOrigin is null, then the property is in init state
+                // if origin is null, then some code is initializing this prop
+                // if propOrigin is greater than origin, then the style should 
+                //    not override
+                // 
+                if (propOrigin == null || 
+                    origin == null || 
+                    propOrigin.compareTo(origin) <= 0) {
+                    super.set(node, value, origin);                
+                }
+            }
+                   
+           @Override
+           public boolean isSettable(LabeledText node) {
+               return node.labeled.fontProperty().isBound() == false;
+           }
+
+           @Override
+           public WritableValue<Font> getWritableValue(LabeledText node) {
+               return node.labeled.fontProperty();
+           }
+       };                        
+
+
+       private static final StyleableProperty<LabeledText,Paint> FILL =
+           new StyleableProperty<LabeledText,Paint>("-fx-fill", 
+               PaintConverter.getInstance(), null) {
+
+            @Override
+            public void set(LabeledText node, Paint value, Stylesheet.Origin origin) {
+                //
+                // In the case where the Labeled's textFill was set by an 
+                // inline style, this inline style should override values
+                // from lesser origins.
+                // 
+                WritableValue<Paint> prop = node.labeled.textFillProperty();
+                Stylesheet.Origin propOrigin = StyleableProperty.getOrigin(prop);
+                
+                // 
+                // if propOrigin is null, then the property is in init state
+                // if origin is null, then some code is initializing this prop
+                // if propOrigin is greater than origin, then the style should 
+                //    not override
+                // 
+                if (propOrigin == null || 
+                    origin == null || 
+                    propOrigin.compareTo(origin) <= 0) {
+                    super.set(node, value, origin);                
+                }
+            }
+                   
+           @Override
+           public boolean isSettable(LabeledText node) {
+               return node.labeled.textFillProperty().isBound() == false;
+           }
+
+           @Override
+           public WritableValue<Paint> getWritableValue(LabeledText node) {
+               return node.labeled.textFillProperty();
+           }
+       };     
+
+        private static final StyleableProperty<LabeledText,TextAlignment> TEXT_ALIGNMENT = 
+                new StyleableProperty<LabeledText,TextAlignment>("-fx-text-alignment",
+                new EnumConverter<TextAlignment>(TextAlignment.class),
+                TextAlignment.LEFT) {
+
+            @Override
+            public void set(LabeledText node, TextAlignment value, Stylesheet.Origin origin) {
+                //
+                // In the case where the Labeled's textFill was set by an 
+                // inline style, this inline style should override values
+                // from lesser origins.
+                // 
+                WritableValue<TextAlignment> prop = node.labeled.textAlignmentProperty();
+                Stylesheet.Origin propOrigin = StyleableProperty.getOrigin(prop);
+                
+                // 
+                // if propOrigin is null, then the property is in init state
+                // if origin is null, then some code is initializing this prop
+                // if propOrigin is greater than origin, then the style should 
+                //    not override
+                // 
+                if (propOrigin == null || 
+                    origin == null || 
+                    propOrigin.compareTo(origin) <= 0) {
+                    super.set(node, value, origin);                
+                }
+            }
+                   
+            @Override
+            public boolean isSettable(LabeledText node) {
+                return node.labeled.textAlignmentProperty().isBound() == false;
+            }
+
+            @Override
+            public WritableValue<TextAlignment> getWritableValue(LabeledText node) {
+                return node.labeled.textAlignmentProperty();
+            }
+        };
+
+        private static final StyleableProperty<LabeledText,Boolean> UNDERLINE = 
+                new StyleableProperty<LabeledText,Boolean>("-fx-underline",
+                BooleanConverter.getInstance(),
+                Boolean.FALSE) {
+
+            @Override
+            public void set(LabeledText node, Boolean value, Stylesheet.Origin origin) {
+                //
+                // In the case where the Labeled's textFill was set by an 
+                // inline style, this inline style should override values
+                // from lesser origins.
+                // 
+                WritableValue<Boolean> prop = node.labeled.underlineProperty();
+                Stylesheet.Origin propOrigin = StyleableProperty.getOrigin(prop);
+                
+                // 
+                // if propOrigin is null, then the property is in init state
+                // if origin is null, then some code is initializing this prop
+                // if propOrigin is greater than origin, then the style should 
+                //    not override
+                // 
+                if (propOrigin == null || 
+                    origin == null || 
+                    propOrigin.compareTo(origin) <= 0) {
+                    super.set(node, value, origin);                
+                }
+            }
+                   
+            @Override
+            public boolean isSettable(LabeledText node) {
+                return node.labeled.underlineProperty().isBound() == false;
+            }
+
+            @Override
+            public WritableValue<Boolean> getWritableValue(LabeledText node) {
+                return node.labeled.underlineProperty();
+            }
+        };
+        
+       private static final List<StyleableProperty> STYLEABLES;
+       static {
+
+           final List<StyleableProperty> styleables =
+               new ArrayList<StyleableProperty>(Text.impl_CSS_STYLEABLES());
+
+           for (int n=0,nMax=styleables.size(); n<nMax; n++) {
+               final String prop = styleables.get(n).getProperty();
+
+               if ("-fx-fill".equals(prop)) {
+                   styleables.set(n, FILL);
+               } else if ("-fx-font".equals(prop)) {
+                   styleables.set(n, FONT);                    
+               } else if ("-fx-text-alignment".equals(prop)) {
+                   styleables.set(n, TEXT_ALIGNMENT);
+               } else if ("-fx-underline".equals(prop)) {
+                   styleables.set(n, UNDERLINE);
+               }
+           }
+
+           STYLEABLES = Collections.unmodifiableList(styleables);
+       }
+   }
+}
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/MenuBarSkin.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/MenuBarSkin.java	Tue Mar 06 10:41:09 2012 -0800
@@ -209,7 +209,7 @@
         control.getScene().addEventFilter(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
             @Override
             public void handle(MouseEvent t) {
-                if (!container.getLayoutBounds().contains(t.getX(), t.getY())) {
+                if (!container.localToScene(container.getLayoutBounds()).contains(t.getX(), t.getY())) {
                     unSelectMenus();
                     firstF10 = true;
                 }
@@ -312,6 +312,14 @@
 
     private boolean pendingDismiss = false;
 
+    // For testing purpose only. 
+    MenuButton getNodeForMenu(int i) {
+        if (i < container.getChildren().size()) {
+            return (MenuBarButton)container.getChildren().get(i);
+        }
+        return null;
+    }
+    
     private boolean menusContainCustomMenuItem() {
         for (Menu menu : getSkinnable().getMenus()) {
             if (menuContainsCustomMenuItem(menu)) {
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TabPaneSkin.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TabPaneSkin.java	Tue Mar 06 10:41:09 2012 -0800
@@ -191,7 +191,7 @@
                             closedTabTimeline = createTimeline(tabRegion, Duration.millis(ANIMATION_SPEED * 1.5F), 0.0F, new EventHandler<ActionEvent>() {
 
                                 @Override
-                                public void handle(ActionEvent event) {
+                                public void handle(ActionEvent event) {       
                                     removeTab(tab);
                                     if (getSkinnable().getTabs().isEmpty()) {
                                         tabHeaderArea.setVisible(false);
@@ -501,18 +501,16 @@
                         setScrollOffset(0.0);
                     } else {
                         controlButtons.showTabsMenu(true);
-                        if (!removeTab.isEmpty()) {
+                        if (!removeTab.isEmpty()) {                            
                             double offset = 0;
                             double w = tabHeaderArea.getWidth() - snapSize(controlButtons.prefWidth(-1)) - firstTabIndent() - SPACER;
                             Iterator i = getChildren().iterator();
                             while (i.hasNext()) {
                                 TabHeaderSkin tabHeader = (TabHeaderSkin)i.next();
                                 double tabHeaderPrefWidth = snapSize(tabHeader.prefWidth(-1));
-                                if (removeTab.contains(tabHeader)) {
+                                if (removeTab.contains(tabHeader)) {                                    
                                     if (offset < w) {
                                         isSelectingTab = true;
-                                    } else {
-                                        setScrollOffset(getScrollOffset() + snapSize(tabHeader.prefWidth(-1)));
                                     }
                                     i.remove();
                                     removeTab.remove(tabHeader);
@@ -520,7 +518,7 @@
                                         break;
                                     }
                                 }
-                                offset += tabHeaderPrefWidth;
+                                offset += tabHeaderPrefWidth;                                
                             }
                         } else {
                             isSelectingTab = true;
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextInputControlSkin.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextInputControlSkin.java	Tue Mar 06 10:41:09 2012 -0800
@@ -228,7 +228,6 @@
     public TextInputControlSkin(final T textInput, final B behavior) {
         super(textInput, behavior);
 
-        caretTimeline = new Timeline();
         caretTimeline.setCycleCount(Timeline.INDEFINITE);
         caretTimeline.getKeyFrames().addAll(
             new KeyFrame(Duration.ZERO, new EventHandler<ActionEvent>() {
@@ -351,7 +350,7 @@
     }
 
  
-   /**
+    /**
      * Returns the character at a given offset.
      *
      * @param index
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TitledPaneSkin.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TitledPaneSkin.java	Tue Mar 06 10:41:09 2012 -0800
@@ -51,6 +51,11 @@
 import com.sun.javafx.scene.traversal.Direction;
 import com.sun.javafx.scene.traversal.TraversalEngine;
 import com.sun.javafx.scene.traversal.TraverseListener;
+import javafx.beans.InvalidationListener;
+import javafx.beans.Observable;
+import javafx.geometry.Insets;
+import javafx.scene.control.Labeled;
+import javafx.scene.text.Font;
 
 public class TitledPaneSkin extends LabeledSkinBase<TitledPane, TitledPaneBehavior>  {
 
@@ -62,6 +67,9 @@
     private Timeline timeline;
     private double transitionStartValue;
     private Rectangle clipRect;
+    private Pos pos;
+    private HPos hpos;
+    private VPos vpos;    
 
     public TitledPaneSkin(final TitledPane titledPane) {
         super(titledPane, new TitledPaneBehavior(titledPane));
@@ -70,7 +78,7 @@
         setClip(clipRect);
 
         transitionStartValue = 0;
-        titleRegion = new TitleRegion();
+        titleRegion = new TitleRegion();       
 
         contentRegion = new Content(getSkinnable().getContent());
 
@@ -79,12 +87,18 @@
         } else {
             setTransition(0.0f);
         }
-
+                
         getChildren().setAll(contentRegion, titleRegion);
-
+               
         registerChangeListener(titledPane.contentProperty(), "CONTENT");
         registerChangeListener(titledPane.expandedProperty(), "EXPANDED");
         registerChangeListener(titledPane.collapsibleProperty(), "COLLAPSIBLE");
+        registerChangeListener(titledPane.alignmentProperty(), "ALIGNMENT");
+        registerChangeListener(titleRegion.alignmentProperty(), "TITLE_REGION_ALIGNMENT");        
+        
+        pos = titledPane.getAlignment();
+        hpos = titledPane.getAlignment().getHpos();
+        vpos = titledPane.getAlignment().getVpos();      
     }
 
     public StackPane getContentRegion() {
@@ -102,7 +116,7 @@
     }
 
     @Override
-    protected void handleControlPropertyChanged(String property) {
+    protected void handleControlPropertyChanged(String property) {        
         super.handleControlPropertyChanged(property);
         if (property == "CONTENT") {
             contentRegion.setContent(getSkinnable().getContent());
@@ -110,6 +124,14 @@
             setExpanded(getSkinnable().isExpanded());
         } else if (property == "COLLAPSIBLE") {
             titleRegion.update();
+        } else if (property == "ALIGNMENT") {
+            pos = getSkinnable().getAlignment();
+            hpos = pos.getHpos();
+            vpos = pos.getVpos();
+        } else if (property == "TITLE_REGION_ALIGNMENT") {
+            pos = titleRegion.getAlignment();
+            hpos = pos.getHpos();
+            vpos = pos.getVpos();
         }
     }
 
@@ -187,8 +209,9 @@
             }
         }
 
+        double y = snapSpace(getInsets().getTop()) + snapSpace(headerHeight);
         contentRegion.resize(contentWidth, contentHeight);
-        positionInArea(contentRegion, snapSpace(getInsets().getLeft()), snapSpace(headerHeight),
+        positionInArea(contentRegion, snapSpace(getInsets().getLeft()), y,
             w, contentHeight, /*baseline ignored*/0, HPos.CENTER, VPos.CENTER);
     }
 
@@ -366,8 +389,7 @@
             double left = snapSpace(getInsets().getLeft());
             double right = snapSpace(getInsets().getRight());
             double arrowWidth = 0;
-            // We want to use the label's pref width computed by LabeledSkinBase.
-            double labelPrefWidth = TitledPaneSkin.super.computePrefWidth(height);
+            double labelPrefWidth = labelPrefWidth(height);
 
             if (arrowRegion != null) {
                 arrowWidth = snapSize(arrowRegion.prefWidth(height));
@@ -380,8 +402,7 @@
             double top = snapSpace(getInsets().getTop());
             double bottom = snapSpace(getInsets().getBottom());
             double arrowHeight = 0;
-            // We want to use the label's pref height computed by LabeledSkinBase.
-            double labelPrefHeight = TitledPaneSkin.super.computePrefHeight(width);
+            double labelPrefHeight = labelPrefHeight(width);
 
             if (arrowRegion != null) {
                 arrowHeight = snapSize(arrowRegion.prefHeight(width));
@@ -399,19 +420,89 @@
             double height = getHeight() - (top + bottom);
             double arrowWidth = snapSize(arrowRegion.prefWidth(-1));
             double arrowHeight = snapSize(arrowRegion.prefHeight(-1));
-            double labelWidth = snapSize(TitledPaneSkin.super.computePrefWidth(-1));
-            double labelHeight = snapSize(TitledPaneSkin.super.computePrefHeight(-1));
+            double labelWidth = snapSize(labelPrefWidth(-1));
+            double labelHeight = snapSize(labelPrefHeight(-1));
 
-            HPos hpos = getAlignment().getHpos();
-            VPos vpos = getAlignment().getVpos();
             double x = left + arrowWidth + Utils.computeXOffset(width - arrowWidth, labelWidth, hpos);
+            if (HPos.CENTER == hpos) {
+                // We want to center the region based on the entire width of the TitledPane.
+                x = left + Utils.computeXOffset(width, labelWidth, hpos);
+            }
             double y = top + Utils.computeYOffset(height, Math.max(arrowHeight, labelHeight), vpos);
 
             arrowRegion.resize(arrowWidth, arrowHeight);
             positionInArea(arrowRegion, left, top, arrowWidth, height,
                     /*baseline ignored*/0, HPos.CENTER, VPos.CENTER);
+                       
+            layoutLabelInArea(x, y, labelWidth, height, pos);
+        }
 
-            layoutLabelInArea(x, y, labelWidth, height, getAlignment());
+        // Copied from LabeledSkinBase because the padding from TitledPane was being
+        // applied to the Label when it should not be.
+        private double labelPrefWidth(double height) {
+            // Get the preferred width of the text
+            final Labeled labeled = getSkinnable();
+            final Font font = text.getFont();
+            final String string = labeled.getText();
+            boolean emptyText = string == null || string.isEmpty();
+            Insets labelPadding = labeled.getLabelPadding();
+            double widthPadding = labelPadding.getLeft() + labelPadding.getRight();
+            double textWidth = emptyText ? 0 : Utils.computeTextWidth(font, string, 0);
+
+            // Now add on the graphic, gap, and padding as appropriate
+            final Node graphic = labeled.getGraphic();
+            if (isIgnoreGraphic()) {
+                return textWidth + widthPadding;
+            } else if (isIgnoreText()) {
+                return graphic.prefWidth(-1) + widthPadding;
+            } else if (labeled.getContentDisplay() == ContentDisplay.LEFT
+                    || labeled.getContentDisplay() == ContentDisplay.RIGHT) {
+                return textWidth + labeled.getGraphicTextGap() + graphic.prefWidth(-1) + widthPadding;
+            } else {
+                return Math.max(textWidth, graphic.prefWidth(-1)) + widthPadding;
+            }
+        }
+
+        // Copied from LabeledSkinBase because the padding from TitledPane was being
+        // applied to the Label when it should not be.
+        private double labelPrefHeight(double width) {
+            final Labeled labeled = getSkinnable();
+            final Font font = text.getFont();
+            final ContentDisplay contentDisplay = labeled.getContentDisplay();
+            final double gap = labeled.getGraphicTextGap();
+            final Insets padding = getInsets();
+            final Insets labelPadding = labeled.getLabelPadding();
+            final double widthPadding = padding.getLeft() + padding.getRight() + labelPadding.getLeft() + labelPadding.getRight();
+
+            String str = labeled.getText();
+            if (str != null && str.endsWith("\n")) {
+                // Strip ending newline so we don't count another row.
+                str = str.substring(0, str.length() - 1);
+            }
+
+            if (!isIgnoreGraphic() &&
+                (contentDisplay == ContentDisplay.LEFT || contentDisplay == ContentDisplay.RIGHT)) {
+                width -= (graphic.prefWidth(-1) + gap);
+            }
+
+            width -= widthPadding;
+
+            // TODO figure out how to cache this effectively.
+            final double textHeight = Utils.computeTextHeight(font, str,
+                                                            labeled.isWrapText() ? width : 0);
+
+            // Now we want to add on the graphic if necessary!
+            double h = textHeight;
+            if (!isIgnoreGraphic()) {
+                final Node graphic = labeled.getGraphic();
+                if (contentDisplay == ContentDisplay.TOP || contentDisplay == ContentDisplay.BOTTOM) {
+                    h = graphic.prefHeight(-1) + gap + textHeight;
+                } else {
+                    h = Math.max(textHeight, graphic.prefHeight(-1));
+                }
+            }
+
+            return h + labelPadding.getTop() + labelPadding.getBottom();
         }
     }
 
--- a/javafx-ui-controls/src/javafx/scene/chart/Axis.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-controls/src/javafx/scene/chart/Axis.java	Tue Mar 06 10:41:09 2012 -0800
@@ -1025,7 +1025,7 @@
          * @return a string representation of this {@code TickMark} object.
          */ 
         @Override public String toString() {
-            return value.toString();
+            return value.get().toString();
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/test/com/sun/javafx/scene/control/skin/LabeledTextTest.css	Tue Mar 06 10:41:09 2012 -0800
@@ -0,0 +1,14 @@
+.label {
+    -fx-text-fill: red;
+    -fx-text-alignment: center;
+    -fx-text-font: 20px Amble;
+    -fx-underline: false;
+}
+
+.label > .text { 
+    -fx-fill: green; 
+    -fx-text-alignment: right;
+    -fx-font: 10px Amble;
+    -fx-underline: true;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/test/com/sun/javafx/scene/control/skin/LabeledTextTest.java	Tue Mar 06 10:41:09 2012 -0800
@@ -0,0 +1,350 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.sun.javafx.scene.control.skin;
+
+import com.sun.javafx.css.StyleableProperty;
+import com.sun.javafx.css.Stylesheet;
+import java.util.List;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
+import javafx.beans.value.WritableValue;
+import javafx.scene.Cursor;
+import javafx.scene.Scene;
+import javafx.scene.control.Label;
+import javafx.scene.effect.BlendMode;
+import javafx.scene.paint.Color;
+import javafx.scene.paint.Paint;
+import javafx.scene.text.Font;
+import javafx.scene.text.TextAlignment;
+import javafx.stage.Stage;
+import org.junit.*;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author dgrieve
+ */
+public class LabeledTextTest {
+    
+    Label label;
+    LabeledText labeledText;
+    Stage stage;
+    Scene scene;
+    Stylesheet stylesheet;
+    
+    public LabeledTextTest() {
+    }
+    
+    @Before public void setup() {
+        label = 
+            new Label("\"A computer once beat me at chess, "
+                + "but it was no match for me at kick boxing.\" Emo Philips");
+        stage = new Stage();
+        stage.setScene(scene = new Scene(label));
+        scene.getStylesheets().add(LabeledTextTest.class.getResource("LabeledTextTest.css").toExternalForm());
+        label.impl_processCSS(true);
+        labeledText = ((com.sun.javafx.scene.control.skin.LabeledSkinBase)label.getSkin()).text; 
+    }
+
+    @Test
+    public void testLabeledTextAlignmentStyleAffectsLabeledText() {
+        
+        label.setStyle("-fx-text-alignment: right;");
+        label.impl_processCSS(false);
+        assertEquals(TextAlignment.RIGHT, label.getTextAlignment());
+        assertEquals(TextAlignment.RIGHT, labeledText.getTextAlignment());
+    
+    }
+    
+    @Test
+    public void testLabeledTextAlignmentIsBound() {
+        try {
+            labeledText.setTextAlignment(TextAlignment.RIGHT);
+            fail();
+        } catch (RuntimeException re) {
+        }
+    }
+    
+
+    @Test
+    public void testLabeledFontStyleAffectsLabeledText() {
+        
+        label.setStyle("-fx-font: 10px Amble;");
+        label.impl_processCSS(false);
+        Font expected = Font.font("Amble", 10);
+        assertEquals(expected, label.getFont());
+        assertEquals(expected, labeledText.getFont());
+    
+    }
+    
+    @Test
+    public void testLabeledTextFontIsBound() {
+        try {
+            labeledText.setFont(Font.getDefault());
+            fail();
+        } catch (RuntimeException re) {
+        }
+    }
+    
+    
+    @Test
+    public void testLabeledTextFillStyleAffectsLabeledText() {
+        
+        label.setStyle("-fx-text-fill: rgb(255,0,0);");
+        label.impl_processCSS(false);
+        Color expected = Color.rgb(255, 0, 0);
+        assertEquals(expected, label.getTextFill());
+        assertEquals(expected, labeledText.getFill());
+    
+    }
+    
+    @Test
+    public void testLabeledTextFillIsBound() {
+        try {
+            labeledText.setFill(Color.RED);
+            fail();
+        } catch (RuntimeException re) {
+        }
+    }
+
+    
+    @Test
+    public void testLabeledUnderlineStyleAffectsLabeledText() {
+        
+        label.setStyle("-fx-underline: true;");
+        label.impl_processCSS(false);
+        assert(label.isUnderline() == true);
+        assert(labeledText.isUnderline() == true);
+    
+    }
+
+    @Test
+    public void testLabeledBlendModeStyleDoesNotAffectLabeledText() {
+        label.setStyle("-fx-blend-mode: color-burn;");
+        label.impl_processCSS(false);
+        assertEquals(BlendMode.COLOR_BURN,label.getBlendMode());
+        assertFalse(BlendMode.COLOR_BURN.equals(labeledText.getBlendMode())); 
+    }
+    
+    @Test
+    public void testLabeledCursorStyleDoesNotAffectLabeledText() {
+        label.setStyle("-fx-cursor: crosshair;");
+        label.impl_processCSS(false);
+        assertEquals(Cursor.CROSSHAIR,label.getCursor());
+        assertFalse(Cursor.CROSSHAIR.equals(labeledText.getCursor()));
+    }
+    
+    @Test
+    public void testLabeledEffectStyleDoesNotAffectLabeledText() {
+        label.setStyle("-fx-effect: dropshadow(one-pass-box, red, 64, .5, 2, 3);");
+        label.impl_processCSS(false);
+        assertNotNull(label.getEffect());
+        assertNull(labeledText.getEffect()); 
+    }
+    
+    @Test
+    public void testLabeledFocusTraversableStyleDoesNotAffectLabeledText() {
+        label.setStyle("-fx-focus-traversable: true;");
+        label.impl_processCSS(false);
+        assert(label.focusTraversableProperty().get() == true);   
+        assert(labeledText.focusTraversableProperty().get() == false);   
+    }
+    
+    @Test
+    public void testLabeledOpacityStyleDoesNotAffectLabeledText() {
+        label.setStyle("-fx-opacity: .5;");
+        label.impl_processCSS(false);
+        assertEquals(label.getOpacity(), .5, .0000001);   
+        assertEquals(labeledText.getOpacity(), 1, .0000001);   
+    }
+
+    @Test
+    public void testLabeledRotateStyleDoesNotAffectLabeledText() {
+        label.setStyle("-fx-rotate: 180;");
+        label.impl_processCSS(false);
+        assertEquals(label.getRotate(), 180, .0000001);
+        assertEquals(labeledText.getRotate(), 0, .0000001);   
+    }
+    
+    @Test
+    public void testLabeledScaleXStyleDoesNotAffectLabeledText() {
+        label.setStyle("-fx-scale-x: .5;");
+        label.impl_processCSS(false);
+        assertEquals(label.getScaleX(), .5, .0000001);
+        assertEquals(labeledText.getScaleX(), 1, .0000001);   
+    }
+    
+    @Test
+    public void testLabeledScaleYStyleDoesNotAffectLabeledText() {
+        label.setStyle("-fx-scale-y: .5;");
+        label.impl_processCSS(false);
+        assertEquals(label.getScaleY(), .5, .0000001);
+        assertEquals(labeledText.getScaleY(), 1, .0000001);   
+    }
+
+    @Test
+    public void testLabeledScaleZStyleDoesNotAffectLabeledText() {
+        label.setStyle("-fx-scale-z: .5;");
+        label.impl_processCSS(false);
+        assertEquals(label.getScaleZ(), .5, .0000001);
+        assertEquals(labeledText.getScaleZ(), 1, .0000001);   
+    }
+    
+    @Test
+    public void testLabeledTranslateXStyleDoesNotAffectLabeledText() {
+        label.setStyle("-fx-translate-x: .5;");
+        label.impl_processCSS(false);
+        assertEquals(label.getTranslateX(), .5, .0000001);
+        assertEquals(labeledText.getTranslateX(), 0, .0000001);   
+    }
+    
+    @Test
+    public void testLabeledTranslateYStyleDoesNotAffectLabeledText() {
+        label.setStyle("-fx-translate-y: .5;");
+        label.impl_processCSS(false);
+        assertEquals(label.getTranslateY(), .5, .0000001);
+        assertEquals(labeledText.getTranslateY(), 0, .0000001);   
+    }
+    
+    @Test
+    public void testLabeledTranslateZStyleDoesNotAffectLabeledText() {
+        label.setStyle("-fx-translate-z: .5;");
+        label.impl_processCSS(false);
+        assertEquals(label.getTranslateZ(), .5, .0000001);
+        assertEquals(labeledText.getTranslateZ(), 0, .0000001);   
+    }
+    
+    @Test
+    public void testLabeledVisibilityStyleDoesNotAffectLabeledText() {
+        label.setStyle("visibility: false;");
+        label.impl_processCSS(false);
+        assert(label.visibleProperty().get() == false);   
+        assert(labeledText.visibleProperty().get() == true);   
+    }
+    
+    private static StyleableProperty getStyleableProperty(String prop) {
+        for (StyleableProperty styleable : LabeledText.impl_CSS_STYLEABLES()) {
+            if (styleable.getProperty().equals(prop)) return styleable;
+        }
+        return null;
+    }
+    
+    @Test
+    public void testLabeledTextFillIsSettableByCss() {
+        
+        StyleableProperty sp = getStyleableProperty("-fx-fill");
+        assertTrue(sp.isSettable(labeledText));
+    }
+    
+    @Test
+    public void testCanStyleFillOnLabeledText() {
+        assertEquals(Color.GREEN, labeledText.getFill());    
+    }
+
+    
+    @Test
+    public void testLabeledTextTextAlignmentIsSettableByCss() {
+        
+        StyleableProperty sp = getStyleableProperty("-fx-text-alignment");
+        assertTrue(sp.isSettable(labeledText));
+    }
+    
+    @Test
+    public void testCanStyleTextAlignmentOnLabeledText() {
+        assertEquals(TextAlignment.RIGHT, labeledText.getTextAlignment());
+    }
+    
+    
+    @Test
+    public void testLabeledTextFontIsSettableByCss() {
+        
+        StyleableProperty sp = getStyleableProperty("-fx-font");
+        assertTrue(sp.isSettable(labeledText));
+    }
+    
+    @Test
+    public void testCanStyleFontOnLabeledText() {
+        assertEquals(Font.font("Amble", 10), labeledText.getFont());
+    }
+    
+    
+    @Test
+    public void testLabeledTextUnderlineIsSettableByCss() {
+        
+        StyleableProperty sp = getStyleableProperty("-fx-underline");
+        assertTrue(sp.isSettable(labeledText));
+    }
+    
+    @Test
+    public void testCanStyleUnderlineOnLabeledText() {
+        assertTrue(labeledText.isUnderline());
+    }
+    
+    @Test
+    public void testLabeledSetTextFillNotOverridenByUAStyleOnLabeledText() {
+        label = 
+            new Label("\"A computer once beat me at chess, "
+                + "but it was no match for me at kick boxing.\" Emo Philips") {
+                    @Override public String getUserAgentStylesheet() {
+                        return LabeledTextTest.class.getResource("LabeledTextTest.css").toExternalForm();
+                    }
+                };
+        label.setTextFill(Color.YELLOW);
+        stage.setScene(scene = new Scene(label));
+        label.impl_processCSS(true);
+        labeledText = ((com.sun.javafx.scene.control.skin.LabeledSkinBase)label.getSkin()).text; 
+        assertEquals(Color.YELLOW, labeledText.getFill());
+    }
+    
+    @Test
+    public void testLabeledSetFontNotOverridenByUAStyleOnLabeledText() {
+        label = 
+            new Label("\"A computer once beat me at chess, "
+                + "but it was no match for me at kick boxing.\" Emo Philips") {
+                    @Override public String getUserAgentStylesheet() {
+                        return LabeledTextTest.class.getResource("LabeledTextTest.css").toExternalForm();
+                    }
+                };
+        Font font = Font.font("Amble", 30);
+        label.setFont(font);
+        stage.setScene(scene = new Scene(label));
+        label.impl_processCSS(true);
+        labeledText = ((com.sun.javafx.scene.control.skin.LabeledSkinBase)label.getSkin()).text; 
+        assertEquals(font, labeledText.getFont());
+    }
+    
+    @Test
+    public void testLabeledSetTextAlignmentNotOverridenByUAStyleOnLabeledText() {
+        label = 
+            new Label("\"A computer once beat me at chess, "
+                + "but it was no match for me at kick boxing.\" Emo Philips") {
+                    @Override public String getUserAgentStylesheet() {
+                        return LabeledTextTest.class.getResource("LabeledTextTest.css").toExternalForm();
+                    }
+                };
+        label.setTextAlignment(TextAlignment.JUSTIFY);
+        stage.setScene(scene = new Scene(label));
+        label.impl_processCSS(true);
+        labeledText = ((com.sun.javafx.scene.control.skin.LabeledSkinBase)label.getSkin()).text; 
+        assertEquals(TextAlignment.JUSTIFY, labeledText.getTextAlignment());
+    }
+    
+    @Test
+    public void testLabeledSetUnderlineNotOverridenByUAStyleOnLabeledText() {
+        label = 
+            new Label("\"A computer once beat me at chess, "
+                + "but it was no match for me at kick boxing.\" Emo Philips") {
+                    @Override public String getUserAgentStylesheet() {
+                        return LabeledTextTest.class.getResource("LabeledTextTest.css").toExternalForm();
+                    }
+                };
+        label.setUnderline(true);
+        stage.setScene(scene = new Scene(label));
+        label.impl_processCSS(true);
+        labeledText = ((com.sun.javafx.scene.control.skin.LabeledSkinBase)label.getSkin()).text; 
+        assertTrue(labeledText.isUnderline());
+    }
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/test/com/sun/javafx/scene/control/skin/MenuBarMenuButtonRetriever.java	Tue Mar 06 10:41:09 2012 -0800
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.sun.javafx.scene.control.skin;
+
+import javafx.scene.control.MenuButton;
+
+
+/**
+ *
+ * @author paru
+ */
+public class MenuBarMenuButtonRetriever {
+    
+    // can only access the getNodeForMenu method in MenuBarSkin from this package.
+    public static MenuButton getNodeForMenu(MenuBarSkin skin, int i) {
+        return skin.getNodeForMenu(i);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/test/com/sun/javafx/scene/control/skin/TextInputControlSkinTest.java	Tue Mar 06 10:41:09 2012 -0800
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.javafx.scene.control.skin;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import javafx.scene.control.TextArea;
+import javafx.scene.control.TextField;
+import org.junit.Test;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/**
+ *
+ */
+public class TextInputControlSkinTest {
+    @Test public void caretStopsAnimatingWhenTextFieldLosesFocus() {
+        final AtomicBoolean caretAnimating = new AtomicBoolean(false);
+        FocusableTextField textField = new FocusableTextField();
+        TextFieldSkin skin = new TextFieldSkin(textField) {
+            @Override public void setCaretAnimating(boolean value) {
+                caretAnimating.set(value);
+                super.setCaretAnimating(value);
+            }
+        };
+        textField.setSkin(skin);
+        
+        textField.setFocus(true);
+        assertTrue(caretAnimating.get());
+        textField.setFocus(false);
+        assertFalse(caretAnimating.get());
+    }
+
+    @Test public void caretStopsAnimatingWhenTextAreaLosesFocus() {
+        final AtomicBoolean caretAnimating = new AtomicBoolean(false);
+        FocusableTextArea textArea = new FocusableTextArea();
+        TextAreaSkin skin = new TextAreaSkin(textArea) {
+            @Override public void setCaretAnimating(boolean value) {
+                caretAnimating.set(value);
+                super.setCaretAnimating(value);
+            }
+        };
+        textArea.setSkin(skin);
+
+        textArea.setFocus(true);
+        assertTrue(caretAnimating.get());
+        textArea.setFocus(false);
+        assertFalse(caretAnimating.get());
+    }
+
+    public class FocusableTextField extends TextField {
+        public void setFocus(boolean value) {
+            super.setFocused(value);
+        }
+    }
+
+    public class FocusableTextArea extends TextArea {
+        public void setFocus(boolean value) {
+            super.setFocused(value);
+        }
+    }
+}
--- a/javafx-ui-controls/test/javafx/scene/control/MenuBarTest.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-controls/test/javafx/scene/control/MenuBarTest.java	Tue Mar 06 10:41:09 2012 -0800
@@ -4,21 +4,22 @@
 
 package javafx.scene.control;
 
-import javafx.beans.property.SimpleBooleanProperty;
-import javafx.beans.property.SimpleObjectProperty;
-import javafx.event.Event;
+import com.sun.javafx.pgstub.StubToolkit;
+import com.sun.javafx.scene.control.skin.MenuBarMenuButtonRetriever;
+import com.sun.javafx.scene.control.skin.MenuBarSkin;
+import com.sun.javafx.tk.Toolkit;
 import javafx.event.EventHandler;
-import javafx.event.EventType;
-import javafx.geometry.Orientation;
-import javafx.geometry.Side;
-import javafx.scene.Node;
-import javafx.scene.shape.Rectangle;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.scene.input.MouseButton;
+import javafx.scene.input.MouseEvent;
+import javafx.scene.layout.AnchorPane;
+import javafx.stage.Stage;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
+import javafx.event.EventType;
+import javafx.scene.Node;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -30,9 +31,22 @@
  */
 public class MenuBarTest {
     private MenuBar menuBar;
+    private Toolkit tk;
+    private Scene scene;
+    private Stage stage;
 
     @Before public void setup() {
+        tk = (StubToolkit)Toolkit.getToolkit();
         menuBar = new MenuBar();
+        menuBar.setUseSystemMenuBar(false);
+    }
+    
+    protected void startApp(Parent root) {
+        scene = new Scene(root,800,600);
+        stage = new Stage();
+        stage.setScene(scene);
+        stage.show();
+        tk.firePulse();
     }
 
     @Test public void defaultConstructorHasFalseFocusTraversable() {
@@ -40,7 +54,7 @@
     }
 
     @Test public void defaultConstructorButSetTrueFocusTraversable() {
-        menuBar.setFocusTraversable(true);
+            menuBar.setFocusTraversable(true);
         assertTrue(menuBar.isFocusTraversable());
     }
 
@@ -58,5 +72,78 @@
         menuBar.getMenus().clear();
         assertEquals(0, menuBar.getMenus().size());
     }
+    
+    @Test public void testMenuShowHideWithMenuBarWithXYTranslation() {
+        final MouseEventGenerator generator = new MouseEventGenerator();
+        AnchorPane root = new AnchorPane();
+        Menu menu = new Menu("Menu");
+        menu.getItems().add(new MenuItem("MenuItem"));
+        menuBar.getMenus().add(menu);
+        menuBar.setLayoutX(100);
+        menuBar.setLayoutY(100);
+        root.getChildren().add(menuBar);
+        startApp(root);
+        tk.firePulse();
+        
+        MenuBarSkin skin = (MenuBarSkin)menuBar.getSkin();
+        assertTrue(skin != null);
+        
+        double xval = (menuBar.localToScene(menuBar.getLayoutBounds())).getMinX();
+        double yval = (menuBar.localToScene(menuBar.getLayoutBounds())).getMinY();
+   
+        MenuButton mb = MenuBarMenuButtonRetriever.getNodeForMenu(skin, 0);
+        mb.getScene().getWindow().requestFocus();
+        scene.impl_processMouseEvent(
+            generator.generateMouseEvent(MouseEvent.MOUSE_PRESSED, xval+20, yval+20));
+        scene.impl_processMouseEvent(
+            generator.generateMouseEvent(MouseEvent.MOUSE_RELEASED, xval+20, yval+20));
+        assertTrue(menu.isShowing());
+        
+    }
+
+    static final class MouseEventGenerator {
+        private boolean primaryButtonDown = false;
+
+        public MouseEvent generateMouseEvent(EventType<MouseEvent> type,
+                double x, double y) {
+
+            MouseButton button = MouseButton.NONE;
+            if (type == MouseEvent.MOUSE_PRESSED ||
+                    type == MouseEvent.MOUSE_RELEASED ||
+                    type == MouseEvent.MOUSE_DRAGGED) {
+                button = MouseButton.PRIMARY;
+            }
+
+            if (type == MouseEvent.MOUSE_PRESSED ||
+                    type == MouseEvent.MOUSE_DRAGGED) {
+                primaryButtonDown = true;
+            }
+
+            if (type == MouseEvent.MOUSE_RELEASED) {
+                primaryButtonDown = false;
+            }
+
+            MouseEvent event = MouseEvent.impl_mouseEvent(x, y, x, y, button,
+                    1, false, false, false, false, false, primaryButtonDown,
+                    false, false, type);
+
+            return event;
+        }
+    }
+    
+//    static final class MouseEventTracker {
+//        private Node node;
+//        
+//        public MouseEventTracker(final Node node) {
+//            this.node = node;
+//            
+//            node.setOnMouseClicked(new EventHandler<MouseEvent>() {
+//                @Override
+//                public void handle(MouseEvent t) {
+//                    // println here to check if node received mouse event
+//                }
+//            });
+//        }
+//    }
 
 }
--- a/javafx-ui-controls/test/javafx/scene/control/TitledPaneTest.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/javafx-ui-controls/test/javafx/scene/control/TitledPaneTest.java	Tue Mar 06 10:41:09 2012 -0800
@@ -7,13 +7,18 @@
 import com.sun.javafx.css.StyleableProperty;
 import static javafx.scene.control.ControlTestUtils.*;
 import com.sun.javafx.pgstub.StubToolkit;
+import com.sun.javafx.scene.control.skin.TitledPaneSkin;
 import com.sun.javafx.tk.Toolkit;
 import javafx.beans.property.BooleanProperty;
 import javafx.beans.property.ObjectProperty;
 import javafx.beans.property.SimpleBooleanProperty;
 import javafx.beans.property.SimpleObjectProperty;
+import javafx.geometry.Pos;
 import javafx.scene.Node;
+import javafx.scene.Scene;
+import javafx.scene.layout.StackPane;
 import javafx.scene.shape.Rectangle;
+import javafx.stage.Stage;
 import static org.junit.Assert.*;
 
 
@@ -29,15 +34,28 @@
     private TitledPane titledPaneWithTitleAndNode;//With title And Node
     private Node node;
     private Toolkit tk;
+    private Scene scene;
+    private Stage stage;
+    private StackPane root;  
 
     @Before public void setup() {
         node = new Rectangle();
         tk = (StubToolkit)Toolkit.getToolkit();//This step is not needed (Just to make sure StubToolkit is loaded into VM)
         titledPane = new TitledPane();
+        titledPane.setSkin(new TitledPaneSkin(titledPane));
         titledPaneWithTitleAndNode = new TitledPane("title", node);
+        root = new StackPane();
+        scene = new Scene(root);
+        stage = new Stage();
+        stage.setScene(scene);        
     }
     
-   
+    /*********************************************************************
+     * Helper methods                                                    *
+     ********************************************************************/
+    private void show() {
+        stage.show();
+    }   
    
     /*********************************************************************
      * Tests for default values                                         *
@@ -232,5 +250,14 @@
         assertFalse(titledPane.isCollapsible());
     }
     
-    
+    @Test public void setAlignment_RT20069() {        
+        titledPane.setExpanded(false);
+        titledPane.setAnimated(false);
+        titledPane.setStyle("-fx-alignment: BOTTOM_RIGHT;");
+                
+        root.getChildren().add(titledPane);
+        show();    
+        
+        assertEquals(Pos.BOTTOM_RIGHT, titledPane.getAlignment());              
+    }
 }
--- a/test-stub-toolkit/src/com/sun/javafx/pgstub/StubToolkit.java	Mon Mar 05 10:14:05 2012 -0800
+++ b/test-stub-toolkit/src/com/sun/javafx/pgstub/StubToolkit.java	Tue Mar 06 10:41:09 2012 -0800
@@ -65,6 +65,7 @@
 import com.sun.javafx.geom.PerspectiveCameraImpl;
 import com.sun.javafx.geom.Shape;
 import com.sun.javafx.geom.transform.BaseTransform;
+import com.sun.javafx.menu.MenuBase;
 import com.sun.javafx.perf.PerformanceTracker;
 import com.sun.javafx.runtime.async.AsyncOperation;
 import com.sun.javafx.runtime.async.AsyncOperationListener;
@@ -181,7 +182,7 @@
 
     @Override
     public TKSystemMenu getSystemMenu() {
-        throw new UnsupportedOperationException("Not supported yet.");
+        return new StubSystemMenu();
     }
 
     @Override
@@ -916,4 +917,18 @@
             return dpi;
         }
     }
+    
+    public static class StubSystemMenu implements TKSystemMenu {
+
+        @Override
+        public boolean isSupported() {
+            return false;
+        }
+
+        @Override
+        public void setMenus(List<MenuBase> menus) {
+            throw new UnsupportedOperationException("Not supported yet.");
+        }
+        
+    }
 }