changeset 1554:aa020339c6e3

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/3.0/MASTER/jfx/rt
author Kinsley Wong
date Mon, 30 Jul 2012 13:08:41 -0700
parents fafdebfd5ff0 f3fae76bf85f
children b12d183216f6 2bd1ea66bfe4
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/SkinBase.java javafx-ui-controls/test/com/sun/javafx/scene/control/skin/SkinBaseTest.java
diffstat 109 files changed, 4823 insertions(+), 3642 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-charts/src/javafx/scene/chart/PieChart.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-charts/src/javafx/scene/chart/PieChart.java	Mon Jul 30 13:08:41 2012 -0700
@@ -125,7 +125,7 @@
                 dataItemAdded(i, item);
             }
             // update legend if any data has changed
-            if (c.getRemoved().size() > 0 || c.getFrom() < c.getTo()) updateLegend();
+            if (isLegendVisible() && (c.getRemoved().size() > 0 || c.getFrom() < c.getTo())) updateLegend();
             // re-layout everything
             }
             requestChartLayout();
@@ -378,6 +378,9 @@
                     new EventHandler<ActionEvent>() {
                         @Override public void handle(ActionEvent actionEvent) {
                             text.setOpacity(0);
+                            // RT-23597 : item's chart might have been set to null if
+                            // this item is added and removed before its add animation finishes.
+                            if (item.getChart() == null) item.setChart(PieChart.this);
                             item.getChart().getChartChildren().add(text);
                             FadeTransition ft = new FadeTransition(Duration.millis(150),text);
                             ft.setToValue(1);
@@ -474,7 +477,7 @@
         double[] labelAngles = null;
         double labelScale = 1;
         ArrayList<LabelLayoutInfo> fullPie = null;
-        boolean shouldShowLabels = true;
+        boolean shouldShowLabels = getLabelsVisible();
         if(getLabelsVisible()) {
             labelsX = new double[getDataSize()];
             labelsY = new double[getDataSize()];
@@ -678,6 +681,7 @@
      * This is called whenever a series is added or removed and the legend needs to be updated
      */
     private void updateLegend() {
+        if (getLegend() != legend) return; // RT-23569 dont update when user has set legend.
         legend.setVertical(getLegendSide().equals(Side.LEFT) || getLegendSide().equals(Side.RIGHT));
         legend.getItems().clear();
         if (getData() != null) {
--- a/javafx-ui-charts/src/javafx/scene/chart/StackedBarChart.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-charts/src/javafx/scene/chart/StackedBarChart.java	Mon Jul 30 13:08:41 2012 -0700
@@ -38,479 +38,499 @@
 import javafx.scene.layout.StackPane;
 import javafx.util.Duration;
 import com.sun.javafx.charts.Legend;
+import com.sun.javafx.css.StyleManager;
 import com.sun.javafx.css.StyleableDoubleProperty;
 import com.sun.javafx.css.StyleableProperty;
 import com.sun.javafx.css.converters.SizeConverter;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
 import javafx.beans.value.WritableValue;
 
 
-    /**
-     * StackedBarChart is a variation of {@link BarChart} that plots bars indicating 
-     * data values for a category. The bars can be vertical or horizontal depending 
-     * on which axis is a category axis. 
-     * The bar for each series is stacked on top of the previous series.
-     */
-    public class StackedBarChart<X, Y> extends XYChart<X, Y> {
+/**
+    * StackedBarChart is a variation of {@link BarChart} that plots bars indicating 
+    * data values for a category. The bars can be vertical or horizontal depending 
+    * on which axis is a category axis. 
+    * The bar for each series is stacked on top of the previous series.
+    */
+public class StackedBarChart<X, Y> extends XYChart<X, Y> {
         
-        // -------------- PRIVATE FIELDS -------------------------------------------
-        private Map<Series, Map<String, Data<X, Y>>> seriesCategoryMap = new HashMap<Series, Map<String, Data<X, Y>>>();
-        private Legend legend = new Legend();
-        private final Orientation orientation;
-        private CategoryAxis categoryAxis;
-        private ValueAxis valueAxis;
-        private int seriesDefaultColorIndex = 0;
-        private Map<Series<X, Y>, String> seriesDefaultColorMap = new HashMap<Series<X, Y>, String>();
-        
-        // -------------- PUBLIC PROPERTIES ----------------------------------------
-        /** The gap to leave between bars in separate categories */
-        private DoubleProperty categoryGap = new StyleableDoubleProperty(10) {
-            @Override protected void invalidated() {
-                get();
-                requestChartLayout();
-            }
-            
-            @Override
-            public Object getBean() {
-                return StackedBarChart.this;
-            }
+    // -------------- PRIVATE FIELDS -------------------------------------------
+    private Map<Series, Map<String, Data<X, Y>>> seriesCategoryMap = new HashMap<Series, Map<String, Data<X, Y>>>();
+    private Legend legend = new Legend();
+    private final Orientation orientation;
+    private CategoryAxis categoryAxis;
+    private ValueAxis valueAxis;
+    private int seriesDefaultColorIndex = 0;
+    private Map<Series<X, Y>, String> seriesDefaultColorMap = new HashMap<Series<X, Y>, String>();
 
-            @Override
-            public String getName() {
-                return "categoryGap";
-            }
-            
-            public StyleableProperty getStyleableProperty() {
-                return StackedBarChart.StyleableProperties.CATEGORY_GAP;
-            }
-        };
-        
-        public double getCategoryGap() {
-            return categoryGap.getValue();
+    // -------------- PUBLIC PROPERTIES ----------------------------------------
+    /** The gap to leave between bars in separate categories */
+    private DoubleProperty categoryGap = new StyleableDoubleProperty(10) {
+        @Override protected void invalidated() {
+            get();
+            requestChartLayout();
         }
 
-        public void setCategoryGap(double value) {
-            categoryGap.setValue(value);
+        @Override
+        public Object getBean() {
+            return StackedBarChart.this;
         }
 
-        public DoubleProperty categoryGapProperty() {
-            return categoryGap;
-        }
-        
-        // -------------- CONSTRUCTOR ----------------------------------------------
-        /**
-         * Construct a new StackedBarChart with the given axis. The two axis should be a ValueAxis/NumberAxis and a CategoryAxis,
-         * they can be in either order depending on if you want a horizontal or vertical bar chart.
-         *
-         * @param xAxis The x axis to use
-         * @param yAxis The y axis to use
-         */
-        public StackedBarChart(Axis<X> xAxis, Axis<Y> yAxis) {
-            this(xAxis, yAxis, FXCollections.<Series<X, Y>>observableArrayList());
+        @Override
+        public String getName() {
+            return "categoryGap";
         }
 
-        /**
-         * Construct a new StackedBarChart with the given axis and data. The two axis should be a ValueAxis/NumberAxis and a
-         * CategoryAxis, they can be in either order depending on if you want a horizontal or vertical bar chart.
-         *
-         * @param xAxis The x axis to use
-         * @param yAxis The y axis to use
-         * @param data The data to use, this is the actual list used so any changes to it will be reflected in the chart
-         */
-        public StackedBarChart(Axis<X> xAxis, Axis<Y> yAxis, ObservableList<Series<X, Y>> data) {
-            super(xAxis, yAxis);
-            getStyleClass().add("stacked-bar-chart");
-            setLegend(legend);
-            if (!((xAxis instanceof ValueAxis && yAxis instanceof CategoryAxis)
-                    || (yAxis instanceof ValueAxis && xAxis instanceof CategoryAxis))) {
-                throw new IllegalArgumentException("Axis type incorrect, one of X,Y should be CategoryAxis and the other NumberAxis");
+        public StyleableProperty getStyleableProperty() {
+            return StackedBarChart.StyleableProperties.CATEGORY_GAP;
+        }
+    };
+
+    public double getCategoryGap() {
+        return categoryGap.getValue();
+    }
+
+    public void setCategoryGap(double value) {
+        categoryGap.setValue(value);
+    }
+
+    public DoubleProperty categoryGapProperty() {
+        return categoryGap;
+    }
+
+    // -------------- CONSTRUCTOR ----------------------------------------------
+    /**
+        * Construct a new StackedBarChart with the given axis. The two axis should be a ValueAxis/NumberAxis and a CategoryAxis,
+        * they can be in either order depending on if you want a horizontal or vertical bar chart.
+        *
+        * @param xAxis The x axis to use
+        * @param yAxis The y axis to use
+        */
+    public StackedBarChart(Axis<X> xAxis, Axis<Y> yAxis) {
+        this(xAxis, yAxis, FXCollections.<Series<X, Y>>observableArrayList());
+    }
+
+    /**
+        * Construct a new StackedBarChart with the given axis and data. The two axis should be a ValueAxis/NumberAxis and a
+        * CategoryAxis, they can be in either order depending on if you want a horizontal or vertical bar chart.
+        *
+        * @param xAxis The x axis to use
+        * @param yAxis The y axis to use
+        * @param data The data to use, this is the actual list used so any changes to it will be reflected in the chart
+        */
+    public StackedBarChart(Axis<X> xAxis, Axis<Y> yAxis, ObservableList<Series<X, Y>> data) {
+        super(xAxis, yAxis);
+        getStyleClass().add("stacked-bar-chart");
+        setLegend(legend);
+        if (!((xAxis instanceof ValueAxis && yAxis instanceof CategoryAxis)
+                || (yAxis instanceof ValueAxis && xAxis instanceof CategoryAxis))) {
+            throw new IllegalArgumentException("Axis type incorrect, one of X,Y should be CategoryAxis and the other NumberAxis");
+        }
+        if (xAxis instanceof CategoryAxis) {
+            categoryAxis = (CategoryAxis) xAxis;
+            valueAxis = (ValueAxis) yAxis;
+            orientation = Orientation.VERTICAL;
+        } else {
+            categoryAxis = (CategoryAxis) yAxis;
+            valueAxis = (ValueAxis) xAxis;
+            orientation = Orientation.HORIZONTAL;
+        }
+        // update css
+        impl_pseudoClassStateChanged(PSEUDO_CLASS_HORIZONTAL);
+        impl_pseudoClassStateChanged(PSEUDO_CLASS_VERTICAL);
+        setData(data);
+    }
+
+    /**
+        * Construct a new StackedBarChart with the given axis and data. The two axis should be a ValueAxis/NumberAxis and a
+        * CategoryAxis, they can be in either order depending on if you want a horizontal or vertical bar chart.
+        *
+        * @param xAxis The x axis to use
+        * @param yAxis The y axis to use
+        * @param data The data to use, this is the actual list used so any changes to it will be reflected in the chart
+        * @param categoryGap The gap to leave between bars in separate categories
+        */
+    public StackedBarChart(Axis<X> xAxis, Axis<Y> yAxis, ObservableList<Series<X, Y>> data, double categoryGap) {
+        this(xAxis, yAxis);
+        setData(data);
+        setCategoryGap(categoryGap);
+    }
+
+    // -------------- METHODS --------------------------------------------------
+    @Override protected void dataItemAdded(Series<X, Y> series, int itemIndex, Data<X, Y> item) {
+        String category;
+        if (orientation == Orientation.VERTICAL) {
+            category = (String) item.getXValue();
+        } else {
+            category = (String) item.getYValue();
+        }
+        // Don't plot if category does not already exist ?
+//        if (!categoryAxis.getCategories().contains(category)) return;
+
+        Map<String, Data<X, Y>> categoryMap = seriesCategoryMap.get(series);
+
+        if (categoryMap == null) {
+            categoryMap = new HashMap<String, Data<X, Y>>();
+            seriesCategoryMap.put(series, categoryMap);
+        }
+        categoryMap.put(category, item);
+        Node bar = createBar(series, getData().indexOf(series), item, itemIndex);
+        if (shouldAnimate()) {
+            animateDataAdd(item, bar);
+        } else {
+            getPlotChildren().add(bar);
+        }
+    }
+
+    @Override protected void dataItemRemoved(final Data<X, Y> item, final Series<X, Y> series) {
+        final Node bar = item.getNode();
+        if (shouldAnimate()) {
+            Timeline t = createDataRemoveTimeline(item, bar, series);
+            t.setOnFinished(new EventHandler<ActionEvent>() {
+
+                public void handle(ActionEvent event) {
+                    removeDataItemFromDisplay(series, item);
+                }
+            });
+            t.play();
+        } else {
+            getPlotChildren().remove(bar);
+            removeDataItemFromDisplay(series, item);
+        }
+    }
+
+    /** @inheritDoc */
+    @Override protected void dataItemChanged(Data<X, Y> item) {
+        double barVal;
+        double currentVal;
+        if (orientation == Orientation.VERTICAL) {
+            barVal = ((Number) item.getYValue()).doubleValue();
+            currentVal = ((Number) getCurrentDisplayedYValue(item)).doubleValue();
+        } else {
+            barVal = ((Number) item.getXValue()).doubleValue();
+            currentVal = ((Number) getCurrentDisplayedXValue(item)).doubleValue();
+        }
+        if (currentVal > 0 && barVal < 0) { // going from positive to negative
+            // add style class negative
+            item.getNode().getStyleClass().add("negative");
+        } else if (currentVal < 0 && barVal > 0) { // going from negative to positive
+            // remove style class negative
+            item.getNode().getStyleClass().remove("negative");
+        }
+    }
+
+    private void animateDataAdd(Data<X, Y> item, Node bar) {
+        double barVal;
+        if (orientation == Orientation.VERTICAL) {
+            barVal = ((Number) item.getYValue()).doubleValue();
+            if (barVal < 0) {
+                bar.getStyleClass().add("negative");
             }
-            if (xAxis instanceof CategoryAxis) {
-                categoryAxis = (CategoryAxis) xAxis;
-                valueAxis = (ValueAxis) yAxis;
-                orientation = Orientation.VERTICAL;
-            } else {
-                categoryAxis = (CategoryAxis) yAxis;
-                valueAxis = (ValueAxis) xAxis;
-                orientation = Orientation.HORIZONTAL;
+            item.setYValue(getYAxis().toRealValue(getYAxis().getZeroPosition()));
+            setCurrentDisplayedYValue(item, getYAxis().toRealValue(getYAxis().getZeroPosition()));
+            getPlotChildren().add(bar);
+            item.setYValue(getYAxis().toRealValue(barVal));
+            animate(
+                    TimelineBuilder.create().keyFrames(
+                    new KeyFrame(Duration.ZERO, new KeyValue(currentDisplayedYValueProperty(item), getCurrentDisplayedYValue(item))),
+                    new KeyFrame(Duration.millis(700), new KeyValue(currentDisplayedYValueProperty(item), item.getYValue(), Interpolator.EASE_BOTH))).build());
+        } else {
+            barVal = ((Number) item.getXValue()).doubleValue();
+            if (barVal < 0) {
+                bar.getStyleClass().add("negative");
             }
-            setData(data);
+            item.setXValue(getXAxis().toRealValue(getXAxis().getZeroPosition()));
+            setCurrentDisplayedXValue(item, getXAxis().toRealValue(getXAxis().getZeroPosition()));
+            getPlotChildren().add(bar);
+            item.setXValue(getXAxis().toRealValue(barVal));
+            animate(
+                    TimelineBuilder.create().keyFrames(
+                    new KeyFrame(Duration.ZERO, new KeyValue(currentDisplayedXValueProperty(item), getCurrentDisplayedXValue(item))),
+                    new KeyFrame(Duration.millis(700), new KeyValue(currentDisplayedXValueProperty(item), item.getXValue(), Interpolator.EASE_BOTH))).build());
         }
+    }
 
-        /**
-         * Construct a new StackedBarChart with the given axis and data. The two axis should be a ValueAxis/NumberAxis and a
-         * CategoryAxis, they can be in either order depending on if you want a horizontal or vertical bar chart.
-         *
-         * @param xAxis The x axis to use
-         * @param yAxis The y axis to use
-         * @param data The data to use, this is the actual list used so any changes to it will be reflected in the chart
-         * @param categoryGap The gap to leave between bars in separate categories
-         */
-        public StackedBarChart(Axis<X> xAxis, Axis<Y> yAxis, ObservableList<Series<X, Y>> data, double categoryGap) {
-            this(xAxis, yAxis);
-            setData(data);
-            setCategoryGap(categoryGap);
-        }
-
-        // -------------- METHODS --------------------------------------------------
-        @Override protected void dataItemAdded(Series<X, Y> series, int itemIndex, Data<X, Y> item) {
+    /** @inheritDoc */
+    @Override protected void seriesAdded(Series<X, Y> series, int seriesIndex) {
+        String defaultColorStyleClass = "default-color" + (seriesDefaultColorIndex % 8);
+        seriesDefaultColorMap.put(series, defaultColorStyleClass);
+        seriesDefaultColorIndex++;
+        // handle any data already in series
+        // create entry in the map
+        Map<String, Data<X, Y>> categoryMap = new HashMap<String, Data<X, Y>>();
+        for (int j = 0; j < series.getData().size(); j++) {
+            Data<X, Y> item = series.getData().get(j);
+            Node bar = createBar(series, seriesIndex, item, j);
             String category;
             if (orientation == Orientation.VERTICAL) {
                 category = (String) item.getXValue();
             } else {
                 category = (String) item.getYValue();
             }
-            // Don't plot if category does not already exist ?
-//        if (!categoryAxis.getCategories().contains(category)) return;
-
-            Map<String, Data<X, Y>> categoryMap = seriesCategoryMap.get(series);
-
-            if (categoryMap == null) {
-                categoryMap = new HashMap<String, Data<X, Y>>();
-                seriesCategoryMap.put(series, categoryMap);
-            }
             categoryMap.put(category, item);
-            Node bar = createBar(series, getData().indexOf(series), item, itemIndex);
             if (shouldAnimate()) {
                 animateDataAdd(item, bar);
             } else {
+                double barVal = (orientation == Orientation.VERTICAL) ? ((Number)item.getYValue()).doubleValue() :
+                    ((Number)item.getXValue()).doubleValue();
+                if (barVal < 0) {
+                    bar.getStyleClass().add("negative");
+                }
                 getPlotChildren().add(bar);
             }
         }
+        if (categoryMap.size() > 0) {
+            seriesCategoryMap.put(series, categoryMap);
+        }
+    }
 
-        @Override protected void dataItemRemoved(final Data<X, Y> item, final Series<X, Y> series) {
-            final Node bar = item.getNode();
-            if (shouldAnimate()) {
-                Timeline t = createDataRemoveTimeline(item, bar, series);
-                t.setOnFinished(new EventHandler<ActionEvent>() {
+    private Timeline createDataRemoveTimeline(Data<X, Y> item, final Node bar, final Series<X, Y> series) {
+        Timeline t = new Timeline();
+        if (orientation == Orientation.VERTICAL) {
+            item.setYValue(getYAxis().toRealValue(getYAxis().getZeroPosition()));
+            t.getKeyFrames().addAll(
+                    new KeyFrame(Duration.ZERO, new KeyValue(currentDisplayedYValueProperty(item), getCurrentDisplayedYValue(item))),
+                    new KeyFrame(Duration.millis(700), new EventHandler<ActionEvent>() {
 
-                    public void handle(ActionEvent event) {
-                        removeDataItemFromDisplay(series, item);
+                @Override
+                public void handle(ActionEvent actionEvent) {
+                    getPlotChildren().remove(bar);
+                }
+            },
+                    new KeyValue(currentDisplayedYValueProperty(item), item.getYValue(), Interpolator.EASE_BOTH)));
+        } else {
+            item.setXValue(getXAxis().toRealValue(getXAxis().getZeroPosition()));
+            t.getKeyFrames().addAll(
+                    new KeyFrame(Duration.ZERO, new KeyValue(currentDisplayedXValueProperty(item), getCurrentDisplayedXValue(item))),
+                    new KeyFrame(Duration.millis(700), new EventHandler<ActionEvent>() {
+
+                @Override
+                public void handle(ActionEvent actionEvent) {
+                    getPlotChildren().remove(bar);
+                }
+            },
+                    new KeyValue(currentDisplayedXValueProperty(item), item.getXValue(), Interpolator.EASE_BOTH)));
+        }
+        return t;
+    }
+
+    @Override protected void seriesRemoved(final Series<X, Y> series) {
+        // remove all symbol nodes
+        if (shouldAnimate()) {
+            ParallelTransition pt = new ParallelTransition();
+            pt.setOnFinished(new EventHandler<ActionEvent>() {
+
+                public void handle(ActionEvent event) {
+                    removeSeriesFromDisplay(series);
+                }
+            });
+            for (Data<X, Y> d : series.getData()) {
+                final Node bar = d.getNode();
+                // Animate series deletion
+                if (getSeriesSize() > 1) {
+                    for (int j = 0; j < series.getData().size(); j++) {
+                        Data<X, Y> item = series.getData().get(j);
+                        Timeline t = createDataRemoveTimeline(item, bar, series);
+                        pt.getChildren().add(t);
                     }
-                });
-                t.play();
+                } else {
+                    // fade out last series
+                    FadeTransition ft = new FadeTransition(Duration.millis(700), bar);
+                    ft.setFromValue(1);
+                    ft.setToValue(0);
+                    ft.setOnFinished(new EventHandler<ActionEvent>() {
+
+                        @Override
+                        public void handle(ActionEvent actionEvent) {
+                            getPlotChildren().remove(bar);
+                        }
+                    });
+                    pt.getChildren().add(ft);
+                }
+            }
+            pt.play();
+        } else {
+            for (Data<X, Y> d : series.getData()) {
+                final Node bar = d.getNode();
+                getPlotChildren().remove(bar);
+            }
+            removeSeriesFromDisplay(series);
+        }
+    }
+
+    /** @inheritDoc */
+    @Override protected void updateAxisRange() {
+        // This override is necessary to update axis range based on cumulative Y value for the
+        // Y axis instead of the inherited way where the max value in the data range is used.
+        final Axis<X> xa = getXAxis();
+        final Axis<Y> ya = getYAxis();
+        if (xa.isAutoRanging()) {
+            List xData = new ArrayList<Number>();
+            if (xa instanceof CategoryAxis) {
+                xData.addAll(categoryAxis.getCategories());
             } else {
-                getPlotChildren().remove(bar);
-                removeDataItemFromDisplay(series, item);
+                int catIndex = 0;
+                for (String category : categoryAxis.getCategories()) {
+                    int index = 0;
+                    double totalX = 0;
+                    Iterator<Series<X, Y>> seriesIterator = getDisplayedSeriesIterator();
+                    while (seriesIterator.hasNext()) {
+                        Series<X, Y> series = seriesIterator.next();
+                        final Data<X, Y> item = getDataItem(series, index, catIndex, category);
+                        if (item != null) totalX += xa.toNumericValue(item.getXValue());
+                    }
+                    xData.add(totalX);
+                    catIndex++;
+                }
+            }
+            xa.invalidateRange(xData);
+        }
+        if (ya.isAutoRanging()) {
+            List yData = new ArrayList<Number>();
+            if (ya instanceof CategoryAxis) {
+                yData.addAll(categoryAxis.getCategories());
+            } else {
+                int catIndex = 0;
+                for (String category : categoryAxis.getCategories()) {
+                    int index = 0;
+                    double totalY = 0;
+                    Iterator<Series<X, Y>> seriesIterator = getDisplayedSeriesIterator();
+                    while (seriesIterator.hasNext()) {
+                        Series<X, Y> series = seriesIterator.next();
+                        final Data<X, Y> item = getDataItem(series, index, catIndex, category);
+                        if(item != null) 
+                            totalY += ya.toNumericValue(item.getYValue());
+                    }
+                    yData.add(totalY);
+                    catIndex++;
+                }
+            }
+            ya.invalidateRange(yData);
+        }
+    }
+
+    /** @inheritDoc */
+    @Override protected void layoutPlotChildren() {
+        double catSpace = categoryAxis.getCategorySpacing();
+        // calculate bar spacing
+        final double availableBarSpace = catSpace - getCategoryGap();
+        final double barWidth = availableBarSpace;
+        final double barOffset = -((catSpace - getCategoryGap()) / 2);
+        final double zeroPos = valueAxis.getZeroPosition();
+        // update bar positions and sizes
+        int catIndex = 0;
+        for (String category : categoryAxis.getCategories()) {
+            int index = 0;
+            int currentHeight = 0;
+            Iterator<Series<X, Y>> seriesIterator = getDisplayedSeriesIterator();
+            while (seriesIterator.hasNext()) {
+                Series<X, Y> series = seriesIterator.next();
+                final Data<X, Y> item = getDataItem(series, index, catIndex, category);
+                if (item != null) {
+                    final Node bar = item.getNode();
+                    final double categoryPos;
+                    final double valPos;
+                    if (orientation == Orientation.VERTICAL) {
+                        categoryPos = getXAxis().getDisplayPosition(getCurrentDisplayedXValue(item));
+                        valPos = getYAxis().getDisplayPosition(getCurrentDisplayedYValue(item));
+                    } else {
+                        categoryPos = getYAxis().getDisplayPosition(getCurrentDisplayedYValue(item));
+                        valPos = getXAxis().getDisplayPosition(getCurrentDisplayedXValue(item));
+                    }
+                    final double bottom = currentHeight + Math.min(valPos, zeroPos);
+                    final double top = currentHeight + Math.max(valPos, zeroPos);
+                    if (orientation == Orientation.VERTICAL) {
+                        bar.resizeRelocate(categoryPos + barOffset,
+                                bottom, barWidth, top - bottom);
+                    } else {
+                        //noinspection SuspiciousNameCombination
+                        bar.resizeRelocate(bottom,
+                                categoryPos + barOffset,
+                                top - bottom, barWidth);
+                    }
+                    if (orientation == Orientation.VERTICAL) {
+                        currentHeight -= top - bottom;
+                    } else {
+                        currentHeight += top - bottom;
+                    }
+                    index++;
+                }
+            }
+            catIndex++;
+        }
+    }
+
+    /**
+        * Computes the size of series linked list
+        * @return size of series linked list
+        */
+    @Override int getSeriesSize() {
+        int count = 0;
+        Iterator<Series<X, Y>> seriesIterator = getDisplayedSeriesIterator();
+        while (seriesIterator.hasNext()) {
+            seriesIterator.next();
+            count++;
+        }
+        return count;
+    }
+
+    /**
+        * This is called whenever a series is added or removed and the legend needs to be updated
+        */
+    @Override protected void updateLegend() {
+        legend.getItems().clear();
+        if (getData() != null) {
+            for (int seriesIndex = 0; seriesIndex < getData().size(); seriesIndex++) {
+                Series series = getData().get(seriesIndex);
+                Legend.LegendItem legenditem = new Legend.LegendItem(series.getName());
+                String defaultColorStyleClass = seriesDefaultColorMap.get(series);
+                legenditem.getSymbol().getStyleClass().addAll("chart-bar", "series" + seriesIndex, "bar-legend-symbol",
+                        defaultColorStyleClass);
+                legend.getItems().add(legenditem);
             }
         }
+        if (legend.getItems().size() > 0) {
+            if (getLegend() == null) {
+                setLegend(legend);
+            }
+        } else {
+            setLegend(null);
+        }
+    }
 
-        /** @inheritDoc */
-        @Override protected void dataItemChanged(Data<X, Y> item) {
-            double barVal;
-            double currentVal;
-            if (orientation == Orientation.VERTICAL) {
-                barVal = ((Number) item.getYValue()).doubleValue();
-                currentVal = ((Number) getCurrentDisplayedYValue(item)).doubleValue();
-            } else {
-                barVal = ((Number) item.getXValue()).doubleValue();
-                currentVal = ((Number) getCurrentDisplayedXValue(item)).doubleValue();
-            }
-            if (currentVal > 0 && barVal < 0) { // going from positive to negative
-                // add style class negative
-                item.getNode().getStyleClass().add("negative");
-            } else if (currentVal < 0 && barVal > 0) { // going from negative to positive
-                // remove style class negative
-                item.getNode().getStyleClass().add("negative");
-            }
+    private Node createBar(Series series, int seriesIndex, final Data item, int itemIndex) {
+        Node bar = item.getNode();
+        if (bar == null) {
+            bar = new StackPane();
+            item.setNode(bar);
         }
+        String defaultColorStyleClass = seriesDefaultColorMap.get(series);
+        bar.getStyleClass().setAll("chart-bar", "series" + seriesIndex, "data" + itemIndex, defaultColorStyleClass);
+        return bar;
+    }
 
-        private void animateDataAdd(Data<X, Y> item, Node bar) {
-            double barVal;
-            if (orientation == Orientation.VERTICAL) {
-                barVal = ((Number) item.getYValue()).doubleValue();
-                if (barVal < 0) {
-                    bar.getStyleClass().add("negative");
-                }
-                item.setYValue(getYAxis().toRealValue(getYAxis().getZeroPosition()));
-                setCurrentDisplayedYValue(item, getYAxis().toRealValue(getYAxis().getZeroPosition()));
-                getPlotChildren().add(bar);
-                item.setYValue(getYAxis().toRealValue(barVal));
-                animate(
-                        TimelineBuilder.create().keyFrames(
-                        new KeyFrame(Duration.ZERO, new KeyValue(currentDisplayedYValueProperty(item), getCurrentDisplayedYValue(item))),
-                        new KeyFrame(Duration.millis(700), new KeyValue(currentDisplayedYValueProperty(item), item.getYValue(), Interpolator.EASE_BOTH))).build());
-            } else {
-                barVal = ((Number) item.getXValue()).doubleValue();
-                if (barVal < 0) {
-                    bar.getStyleClass().add("negative");
-                }
-                item.setXValue(getXAxis().toRealValue(getXAxis().getZeroPosition()));
-                setCurrentDisplayedXValue(item, getXAxis().toRealValue(getXAxis().getZeroPosition()));
-                getPlotChildren().add(bar);
-                item.setXValue(getXAxis().toRealValue(barVal));
-                animate(
-                        TimelineBuilder.create().keyFrames(
-                        new KeyFrame(Duration.ZERO, new KeyValue(currentDisplayedXValueProperty(item), getCurrentDisplayedXValue(item))),
-                        new KeyFrame(Duration.millis(700), new KeyValue(currentDisplayedXValueProperty(item), item.getXValue(), Interpolator.EASE_BOTH))).build());
-            }
-        }
-
-        /** @inheritDoc */
-        @Override protected void seriesAdded(Series<X, Y> series, int seriesIndex) {
-            String defaultColorStyleClass = "default-color" + (seriesDefaultColorIndex % 8);
-            seriesDefaultColorMap.put(series, defaultColorStyleClass);
-            seriesDefaultColorIndex++;
-            // handle any data already in series
-            // create entry in the map
-            Map<String, Data<X, Y>> categoryMap = new HashMap<String, Data<X, Y>>();
-            for (int j = 0; j < series.getData().size(); j++) {
-                Data<X, Y> item = series.getData().get(j);
-                Node bar = createBar(series, seriesIndex, item, j);
-                String category;
-                if (orientation == Orientation.VERTICAL) {
-                    category = (String) item.getXValue();
-                } else {
-                    category = (String) item.getYValue();
-                }
-                categoryMap.put(category, item);
-                if (shouldAnimate()) {
-                    animateDataAdd(item, bar);
-                } else {
-                    getPlotChildren().add(bar);
-                }
-            }
-            if (categoryMap.size() > 0) {
-                seriesCategoryMap.put(series, categoryMap);
-            }
-        }
-
-        private Timeline createDataRemoveTimeline(Data<X, Y> item, final Node bar, final Series<X, Y> series) {
-            Timeline t = new Timeline();
-            if (orientation == Orientation.VERTICAL) {
-                item.setYValue(getYAxis().toRealValue(getYAxis().getZeroPosition()));
-                t.getKeyFrames().addAll(
-                        new KeyFrame(Duration.ZERO, new KeyValue(currentDisplayedYValueProperty(item), getCurrentDisplayedYValue(item))),
-                        new KeyFrame(Duration.millis(700), new EventHandler<ActionEvent>() {
-
-                    @Override
-                    public void handle(ActionEvent actionEvent) {
-                        getPlotChildren().remove(bar);
-                    }
-                },
-                        new KeyValue(currentDisplayedYValueProperty(item), item.getYValue(), Interpolator.EASE_BOTH)));
-            } else {
-                item.setXValue(getXAxis().toRealValue(getXAxis().getZeroPosition()));
-                t.getKeyFrames().addAll(
-                        new KeyFrame(Duration.ZERO, new KeyValue(currentDisplayedXValueProperty(item), getCurrentDisplayedXValue(item))),
-                        new KeyFrame(Duration.millis(700), new EventHandler<ActionEvent>() {
-
-                    @Override
-                    public void handle(ActionEvent actionEvent) {
-                        getPlotChildren().remove(bar);
-                    }
-                },
-                        new KeyValue(currentDisplayedXValueProperty(item), item.getXValue(), Interpolator.EASE_BOTH)));
-            }
-            return t;
-        }
-
-        @Override protected void seriesRemoved(final Series<X, Y> series) {
-            // remove all symbol nodes
-            if (shouldAnimate()) {
-                ParallelTransition pt = new ParallelTransition();
-                pt.setOnFinished(new EventHandler<ActionEvent>() {
-
-                    public void handle(ActionEvent event) {
-                        removeSeriesFromDisplay(series);
-                    }
-                });
-                for (Data<X, Y> d : series.getData()) {
-                    final Node bar = d.getNode();
-                    // Animate series deletion
-                    if (getSeriesSize() > 1) {
-                        for (int j = 0; j < series.getData().size(); j++) {
-                            Data<X, Y> item = series.getData().get(j);
-                            Timeline t = createDataRemoveTimeline(item, bar, series);
-                            pt.getChildren().add(t);
-                        }
-                    } else {
-                        // fade out last series
-                        FadeTransition ft = new FadeTransition(Duration.millis(700), bar);
-                        ft.setFromValue(1);
-                        ft.setToValue(0);
-                        ft.setOnFinished(new EventHandler<ActionEvent>() {
-
-                            @Override
-                            public void handle(ActionEvent actionEvent) {
-                                getPlotChildren().remove(bar);
-                            }
-                        });
-                        pt.getChildren().add(ft);
-                    }
-                }
-                pt.play();
-            } else {
-                for (Data<X, Y> d : series.getData()) {
-                    final Node bar = d.getNode();
-                    getPlotChildren().remove(bar);
-                }
-                removeSeriesFromDisplay(series);
-            }
-        }
-
-        /** @inheritDoc */
-        @Override protected void updateAxisRange() {
-            // This override is necessary to update axis range based on cumulative Y value for the
-            // Y axis instead of the inherited way where the max value in the data range is used.
-            final Axis<X> xa = getXAxis();
-            final Axis<Y> ya = getYAxis();
-            if (xa.isAutoRanging()) {
-                List xData = new ArrayList<Number>();
-                if (xa instanceof CategoryAxis) {
-                    xData.addAll(categoryAxis.getCategories());
-                } else {
-                    int catIndex = 0;
-                    for (String category : categoryAxis.getCategories()) {
-                        int index = 0;
-                        double totalX = 0;
-                        Iterator<Series<X, Y>> seriesIterator = getDisplayedSeriesIterator();
-                        while (seriesIterator.hasNext()) {
-                            Series<X, Y> series = seriesIterator.next();
-                            final Data<X, Y> item = getDataItem(series, index, catIndex, category);
-                            totalX += xa.toNumericValue(item.getXValue());
-                        }
-                        xData.add(totalX);
-                        catIndex++;
-                    }
-                }
-                xa.invalidateRange(xData);
-            }
-            if (ya.isAutoRanging()) {
-                List yData = new ArrayList<Number>();
-                if (ya instanceof CategoryAxis) {
-                    yData.addAll(categoryAxis.getCategories());
-                } else {
-                    int catIndex = 0;
-                    for (String category : categoryAxis.getCategories()) {
-                        int index = 0;
-                        double totalY = 0;
-                        Iterator<Series<X, Y>> seriesIterator = getDisplayedSeriesIterator();
-                        while (seriesIterator.hasNext()) {
-                            Series<X, Y> series = seriesIterator.next();
-                            final Data<X, Y> item = getDataItem(series, index, catIndex, category);
-                            if(item != null) 
-                                totalY += ya.toNumericValue(item.getYValue());
-                        }
-                        yData.add(totalY);
-                        catIndex++;
-                    }
-                }
-                ya.invalidateRange(yData);
-            }
-        }
-
-        /** @inheritDoc */
-        @Override protected void layoutPlotChildren() {
-            double catSpace = categoryAxis.getCategorySpacing();
-            // calculate bar spacing
-            final double availableBarSpace = catSpace - getCategoryGap();
-            final double barWidth = availableBarSpace;
-            final double barOffset = -((catSpace - getCategoryGap()) / 2);
-            final double zeroPos = valueAxis.getZeroPosition();
-            // update bar positions and sizes
-            int catIndex = 0;
-            for (String category : categoryAxis.getCategories()) {
-                int index = 0;
-                int currentHeight = 0;
-                Iterator<Series<X, Y>> seriesIterator = getDisplayedSeriesIterator();
-                while (seriesIterator.hasNext()) {
-                    Series<X, Y> series = seriesIterator.next();
-                    final Data<X, Y> item = getDataItem(series, index, catIndex, category);
-                    if (item != null) {
-                        final Node bar = item.getNode();
-                        final double categoryPos;
-                        final double valPos;
-                        if (orientation == Orientation.VERTICAL) {
-                            categoryPos = getXAxis().getDisplayPosition(getCurrentDisplayedXValue(item));
-                            valPos = getYAxis().getDisplayPosition(getCurrentDisplayedYValue(item));
-                        } else {
-                            categoryPos = getYAxis().getDisplayPosition(getCurrentDisplayedYValue(item));
-                            valPos = getXAxis().getDisplayPosition(getCurrentDisplayedXValue(item));
-                        }
-                        final double bottom = currentHeight + Math.min(valPos, zeroPos);
-                        final double top = currentHeight + Math.max(valPos, zeroPos);
-                        if (orientation == Orientation.VERTICAL) {
-                            bar.resizeRelocate(categoryPos + barOffset,
-                                    bottom, barWidth, top - bottom);
-                        } else {
-                            //noinspection SuspiciousNameCombination
-                            bar.resizeRelocate(bottom,
-                                    categoryPos + barOffset,
-                                    top - bottom, barWidth);
-                        }
-                        currentHeight -= top - bottom;
-                        index++;
-                    }
-                }
-                catIndex++;
-            }
-        }
-
-        /**
-         * Computes the size of series linked list
-         * @return size of series linked list
-         */
-        @Override int getSeriesSize() {
-            int count = 0;
-            Iterator<Series<X, Y>> seriesIterator = getDisplayedSeriesIterator();
-            while (seriesIterator.hasNext()) {
-                seriesIterator.next();
-                count++;
-            }
-            return count;
-        }
-
-        /**
-         * This is called whenever a series is added or removed and the legend needs to be updated
-         */
-        @Override protected void updateLegend() {
-            legend.getItems().clear();
-            if (getData() != null) {
-                for (int seriesIndex = 0; seriesIndex < getData().size(); seriesIndex++) {
-                    Series series = getData().get(seriesIndex);
-                    Legend.LegendItem legenditem = new Legend.LegendItem(series.getName());
-                    String defaultColorStyleClass = seriesDefaultColorMap.get(series);
-                    legenditem.getSymbol().getStyleClass().addAll("chart-bar", "series" + seriesIndex, "bar-legend-symbol",
-                            defaultColorStyleClass);
-                    legend.getItems().add(legenditem);
-                }
-            }
-            if (legend.getItems().size() > 0) {
-                if (getLegend() == null) {
-                    setLegend(legend);
-                }
-            } else {
-                setLegend(null);
-            }
-        }
-
-        private Node createBar(Series series, int seriesIndex, final Data item, int itemIndex) {
-            Node bar = item.getNode();
-            if (bar == null) {
-                bar = new StackPane();
-                item.setNode(bar);
-            }
-            String defaultColorStyleClass = seriesDefaultColorMap.get(series);
-            bar.getStyleClass().setAll("chart-bar", "series" + seriesIndex, "data" + itemIndex, defaultColorStyleClass);
-            return bar;
-        }
-
-        private Data<X, Y> getDataItem(Series<X, Y> series, int seriesIndex, int itemIndex, String category) {
-            Map<String, Data<X, Y>> catmap = seriesCategoryMap.get(series);
-            return catmap.get(category);
-        }
+    private Data<X, Y> getDataItem(Series<X, Y> series, int seriesIndex, int itemIndex, String category) {
+        Map<String, Data<X, Y>> catmap = seriesCategoryMap.get(series);
+        return catmap.get(category);
+    }
 
 // -------------- STYLESHEET HANDLING ------------------------------------------------------------------------------
 
+    /** Pseudoclass indicating this is a vertical chart. */
+    private static final String PSEUDO_CLASS_VERTICAL = "vertical";
+    /** Pseudoclass indicating this is a horizontal chart. */
+    private static final String PSEUDO_CLASS_HORIZONTAL = "horizontal";
+
     /**
-      * Super-lazy instantiation pattern from Bill Pugh.
-      * @treatAsPrivate implementation detail
-      */
-     private static class StyleableProperties {
-         
-         private static final StyleableProperty<StackedBarChart,Number> CATEGORY_GAP = 
-             new StyleableProperty<StackedBarChart,Number>("-fx-category-gap",
-                 SizeConverter.getInstance(), 10.0)  {
+    * Super-lazy instantiation pattern from Bill Pugh.
+    * @treatAsPrivate implementation detail
+    */
+    private static class StyleableProperties {
+
+        private static final StyleableProperty<StackedBarChart,Number> CATEGORY_GAP = 
+            new StyleableProperty<StackedBarChart,Number>("-fx-category-gap",
+                SizeConverter.getInstance(), 10.0)  {
 
             @Override
             public boolean isSettable(StackedBarChart node) {
@@ -519,12 +539,12 @@
 
             @Override
             public WritableValue<Number> getWritableValue(StackedBarChart node) {
-                 return node.categoryGapProperty();
+                return node.categoryGapProperty();
             }
         };
 
-         private static final List<StyleableProperty> STYLEABLES;
-         static {
+        private static final List<StyleableProperty> STYLEABLES;
+        static {
 
             final List<StyleableProperty> styleables =
                 new ArrayList<StyleableProperty>(XYChart.impl_CSS_STYLEABLES());
@@ -532,27 +552,43 @@
                 CATEGORY_GAP
             );
             STYLEABLES = Collections.unmodifiableList(styleables);
-         }
+        }
     }
-     
-     /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
-     */
+
+    /**
+    * @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 StackedBarChart.StyleableProperties.STYLEABLES;
     }
 
     /**
-     * RT-19263
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an experimental API that is not intended for general use and is subject to change in future versions
-     */
+    * RT-19263
+    * @treatAsPrivate implementation detail
+    * @deprecated This is an experimental API that is not intended for general use and is subject to change in future versions
+    */
     @Deprecated
     public List<StyleableProperty> impl_getStyleableProperties() {
         return impl_CSS_STYLEABLES();
     }
 
-}
+    private static final long VERTICAL_PSEUDOCLASS_STATE =
+            StyleManager.getInstance().getPseudoclassMask("vertical");
+    private static final long HORIZONTAL_PSEUDOCLASS_STATE =
+            StyleManager.getInstance().getPseudoclassMask("horizontal");
 
+    /**
+    * @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 long impl_getPseudoClassState() {
+        long mask = super.impl_getPseudoClassState();
+        mask |= (orientation == Orientation.VERTICAL) ?
+            VERTICAL_PSEUDOCLASS_STATE : HORIZONTAL_PSEUDOCLASS_STATE;
+        return mask;
+
+    }
+
+}
\ No newline at end of file
--- a/javafx-ui-common/src/com/sun/javafx/css/SizeUnits.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-common/src/com/sun/javafx/css/SizeUnits.java	Mon Jul 30 13:08:41 2012 -0700
@@ -262,11 +262,11 @@
 
     // RT-14711: The spec says 1px is equal to 0.75pt
     //           72 / 0.75 = 96
-    static final private int DOTS_PER_INCH = 96;
-    static final private int POINTS_PER_INCH = 72;
+    static final private double DOTS_PER_INCH = 96.0;
+    static final private double POINTS_PER_INCH = 72.0;
     static final private double CM_PER_INCH = 2.54;
     static final private double MM_PER_INCH = CM_PER_INCH * 10;
-    static final private int POINTS_PER_PICA = 12;
+    static final private double POINTS_PER_PICA = 12.0;
 
     /* Get the font size in points */
     private static double pointSize(Font font) {
--- a/javafx-ui-common/src/javafx/scene/Node.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/Node.java	Mon Jul 30 13:08:41 2012 -0700
@@ -2169,9 +2169,11 @@
 
                 @Override
                 protected void invalidated() {
-                    if (getParent() != null) {
-                        getParent().requestLayout();
+                    final Parent parent = getParent();
+                    if (parent != null) {
+                        parent.managedChildChanged();
                     }
+                    notifyManagedChanged();
                 }
 
                 @Override
@@ -2190,6 +2192,13 @@
     }
 
     /**
+     * Called whenever the "managed" flag has changed. This is only
+     * used by Parent as an optimization to keep track of whether a
+     * Parent node is a layout root or not.
+     */
+    void notifyManagedChanged() { }
+
+    /**
      * Defines the x coordinate of the translation that is added to this {@code Node}'s
      * transform for the purpose of layout.  The value should be computed as the
      * offset required to adjust the position of the node from its current
--- a/javafx-ui-common/src/javafx/scene/Parent.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/Parent.java	Mon Jul 30 13:08:41 2012 -0700
@@ -33,9 +33,7 @@
 
 import com.sun.javafx.jmx.MXNodeAlgorithm;
 import com.sun.javafx.jmx.MXNodeAlgorithmContext;
-import javafx.beans.property.ObjectProperty;
-import javafx.beans.property.SimpleBooleanProperty;
-import javafx.beans.property.SimpleObjectProperty;
+import javafx.beans.property.*;
 import javafx.collections.FXCollections;
 import javafx.collections.ListChangeListener.Change;
 import javafx.collections.ObservableList;
@@ -61,8 +59,6 @@
 import com.sun.javafx.sg.PGGroup;
 import com.sun.javafx.sg.PGNode;
 import com.sun.javafx.tk.Toolkit;
-import javafx.beans.property.ReadOnlyBooleanProperty;
-import javafx.beans.property.ReadOnlyBooleanWrapper;
 
 /**
  * The base class for all nodes that have children in the scene graph.
@@ -71,11 +67,10 @@
  * child nodes, marking branches dirty for layout and rendering, picking,
  * bounds calculations, and executing the layout pass on each pulse.
  * <p>
- * There are three direct concrete Parent subclasses
+ * There are two direct concrete Parent subclasses
  * <ul>
  * <li>{@link Group} effects and transforms to be applied to a collection of child nodes.</li>
  * <li>{@link javafx.scene.layout.Region} class for nodes that can be styled with CSS and layout children. </li>
- * <li>{@link javafx.scene.control.Control base Control} class for high-level skinnable nodes designed for user interaction.</li>
  * </ul>
  *
  */
@@ -91,7 +86,7 @@
      * Threshold when it's worth to populate list of removed children.
      */
     private static final int REMOVED_CHILDREN_THRESHOLD = 20;
-    
+
     /**
      * Do not populate list of removed children when its number exceeds threshold,
      * but mark whole parent dirty.
@@ -212,7 +207,7 @@
 
     //accumulates all removed nodes between pulses, for dirty area calculation.
     private List<Node> removed;
-    
+
     /**
      * A ObservableList of child {@code Node}s.
      * <p>
@@ -382,8 +377,9 @@
         protected void onChanged(Change<Node> c) {
             // proceed with updating the scene graph
             if (childrenModified) {
+                unmodifiableManagedChildren = null;
                 boolean relayout = false;
-                
+
                 while (c.next()) {
                     int from = c.getFrom();
                     int to = c.getTo();
@@ -413,7 +409,7 @@
                             relayout = true;
                         }
                     }
-                    
+
                     // update the parent and scene for each new node
                     for (int i = from; i < to; ++i) {
                         Node node = children.get(i);
@@ -461,8 +457,8 @@
                 // its siblings. Thus, it is only necessary to reapply css to
                 // the Node just added and not to this parent and all of its
                 // children. So the following call to impl_reapplyCSS was moved
-                // to Node.parentProperty. The orginal comment and code were
-                // purpopsely left here as documentation should there be any
+                // to Node.parentProperty. The original comment and code were
+                // purposely left here as documentation should there be any
                 // question about how the code used to work and why the change
                 // was made.
                 //
@@ -505,6 +501,24 @@
     };
 
     /**
+     * A constant reference to an unmodifiable view of the children, such that every time
+     * we ask for an unmodifiable list of children, we don't actually create a new
+     * collection and return it. The memory overhead is pretty lightweight compared
+     * to all the garbage we would otherwise generate.
+     */
+    private final ObservableList<Node> unmodifiableChildren =
+            FXCollections.unmodifiableObservableList(children);
+
+    /**
+     * A cached reference to the unmodifiable managed children of this Parent. This is
+     * created whenever first asked for, and thrown away whenever children are added
+     * or removed or when their managed state changes. This could be written
+     * differently, such that this list is essentially a filtered copy of the
+     * main children, but that additional overhead might not be worth it.
+     */
+    private List<Node> unmodifiableManagedChildren = null;
+
+    /**
      * Gets the list of children of this {@code Parent}.
      *
      * <p>
@@ -520,6 +534,13 @@
      * An {@link IllegalStateException} is thrown if this restriction is
      * violated.
      *
+     * <p>
+     * Note to subclasses: if you override this method, you must return from
+     * your implementation the result of calling this super method. The actual
+     * list instance returned from any getChildren() implementation must be
+     * the list owned and managed by this Parent. The only typical purpose
+     * for overriding this method is to promote the method to be public.
+     *
      * @return the list of children of this {@code Parent}.
      */
     protected ObservableList<Node> getChildren() {
@@ -534,7 +555,7 @@
      */
     @ReturnsUnmodifiableCollection
     public ObservableList<Node> getChildrenUnmodifiable() {
-        return FXCollections.unmodifiableObservableList(children);
+        return unmodifiableChildren;
     }
 
     /**
@@ -543,14 +564,28 @@
      * @param <E> the type of the children nodes
      * @return list of all managed children in this parent
      */
+    @ReturnsUnmodifiableCollection
     protected <E extends Node> List<E> getManagedChildren() {
-        List<E> managed = new ArrayList<E>();
-        for (E e : (ObservableList<E>)getChildren()) {
-            if (e != null && e.isManaged()) {
-                managed.add(e);
+        if (unmodifiableManagedChildren == null) {
+            unmodifiableManagedChildren = new ArrayList<Node>();
+            for (int i=0, max=children.size(); i<max; i++) {
+                Node e = children.get(i);
+                if (e != null && e.isManaged()) {
+                    unmodifiableManagedChildren.add(e);
+                }
             }
         }
-        return managed;
+        return (List<E>)unmodifiableManagedChildren;
+    }
+
+    /**
+     * Called by Node whenever its managed state may have changed, this
+     * method will cause the view of managed children to be updated
+     * such that it properly includes or excludes this child.
+     */
+    final void managedChildChanged() {
+        requestLayout();
+        unmodifiableManagedChildren = null;
     }
 
     // implementation of Node.toFront function
@@ -593,73 +628,40 @@
         }
     }
 
-    private void computeDirtyScene(Scene old) {
-        for (Node node : getChildren()) {
+    @Override void sceneChanged(final Scene old) {
+        // Give all of the children the new scene
+        final Scene scene = getScene();
+        for (int i=0, max=children.size(); i<max; i++) {
+            final Node node = children.get(i);
             if (node != null) {
-                node.setScene(getScene());
+                node.setScene(scene);
             }
         }
 
-        if (isNeedsLayout() && old != null) {
+        // If this node was in the old scene's dirty layout
+        // list, then remove it from that list so that it is
+        // not processed on the next pulse
+        final boolean awaitingLayout = isNeedsLayout();
+        if (awaitingLayout && old != null) {
             old.removeFromDirtyLayoutList(this);
         }
-        if (getScene() != null && isNeedsLayout() && isLayoutRoot()) {
-            getScene().addToDirtyLayoutList(this);
+
+        sceneRoot = scene != null && scene.getRoot() == this;
+        layoutRoot = !isManaged() || sceneRoot;
+
+        // If this node is dirty and the new scene is not null
+        // then add this node to the new scene's dirty list
+        if (scene != null && awaitingLayout && layoutRoot) {
+            scene.addToDirtyLayoutList(this);
         }
     }
 
-    @Override void sceneChanged(Scene old) {
-        computeDirtyScene(old);
-    }
-
-    // define focus traversal order
-    // keep it package private for now
-    Node getFirstChild() {
-        if (children.size() > 0) {
-            return children.get(0);
-        } else {
-            return null;
-        }
-    }
-
-    Node getLastChild() {
-        if (!children.isEmpty()) {
-            return children.get(children.size() - 1);
-        } else {
-            return null;
-        }
-    }
-
-    Node getNextChild(Node child) {
-        Node previous = null;
-        for (Node node : children)  {
-            if (child == previous) {
-                return node;
-            }
-            previous = node;
-        }
-        return null;
-    }
-
-    Node getPreviousChild(Node child) {
-        Node previous = null;
-        for (int i = (children.size()-1); i >= 0; i--) {
-            Node node = children.get(i);
-            if (child == previous) {
-                return node;
-            }
-            previous = node;
-        }
-        return null;
-    }
-
     @Override
     void setDerivedDepthTest(boolean value) {
         super.setDerivedDepthTest(value);
 
-        ObservableList<Node> myChildren = getChildren();
-        for (int i = 0; i < myChildren.size(); i++) {
-            Node node = myChildren.get(i);
+        for (int i=0, max=children.size(); i<max; i++) {
+            final Node node = children.get(i);
             node.computeDerivedDepthTest();
         }
     }
@@ -687,26 +689,26 @@
      */
     @Deprecated
     @Override protected Node impl_pickNodeLocal(PickRay pickRay) {
-            for (int i = children.size()-1; i >= 0; i--) {
-                Node picked = children.get(i).impl_pickNode(pickRay);
+        for (int i = children.size()-1; i >= 0; i--) {
+            Node picked = children.get(i).impl_pickNode(pickRay);
 
-                if (picked != null) {
-                    return picked;
-                }
+            if (picked != null) {
+                return picked;
             }
+        }
         return null;
     }
 
     @Override boolean isConnected() {
-        return super.isConnected() || isSceneRoot();
+        return super.isConnected() || sceneRoot;
     }
 
     @Override public Node lookup(String selector) {
         Node n = super.lookup(selector);
         if (n == null) {
-            int size = children.size();
-            for (int i = 0; i < size; ++i) {
-                n = children.get(i).lookup(selector);
+            for (int i=0, max=children.size(); i<max; i++) {
+                final Node node = children.get(i);
+                n = node.lookup(selector);
                 if (n != null) return n;
             }
         }
@@ -719,17 +721,16 @@
      */
     @Override List<Node> lookupAll(Selector selector, List<Node> results) {
         results = super.lookupAll(selector, results);
-        int size = children.size();
-            for (int i = 0; i < size; ++i) {
-            results = children.get(i).lookupAll(selector, results);
+        for (int i=0, max=children.size(); i<max; i++) {
+            final Node node = children.get(i);
+            results = node.lookupAll(selector, results);
         }
         return results;
     }
-    
+
     /** @treatAsPrivate implementation detail */
     private javafx.beans.property.ObjectProperty<TraversalEngine> impl_traversalEngine;
 
-
     /**
      * @treatAsPrivate implementation detail
      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
@@ -774,25 +775,18 @@
      * Indicates that this Node and its subnodes requires a layout pass on
      * the next pulse.
      */
-    private ReadOnlyBooleanWrapper needsLayout;
+    private ReadOnlyBooleanWrapper needsLayout = new ReadOnlyBooleanWrapper(this, "needsLayout", true);
 
     protected final void setNeedsLayout(boolean value) {
-        needsLayoutPropertyImpl().set(value);
+        needsLayout.set(value);
     }
 
     public final boolean isNeedsLayout() {
-        return needsLayout == null ? true : needsLayout.get();
+        return needsLayout.get();
     }
 
     public final ReadOnlyBooleanProperty needsLayoutProperty() {
-        return needsLayoutPropertyImpl().getReadOnlyProperty();
-    }
-
-    private ReadOnlyBooleanWrapper needsLayoutPropertyImpl() {
-        if (needsLayout == null) {
-            needsLayout = new ReadOnlyBooleanWrapper(this, "needsLayout", true);
-        }
-        return needsLayout;
+        return needsLayout.getReadOnlyProperty();
     }
 
     /**
@@ -830,15 +824,19 @@
             }
 
             setNeedsLayout(true);
-            if (isLayoutRoot()) {
-                if (getScene() != null) {
+            if (layoutRoot) {
+                final Scene scene = getScene();
+                if (scene != null) {
                     if (logger.isLoggable(PlatformLogger.FINER)) {
                         logger.finer(this.toString()+" layoutRoot added to scene dirty layout list");
                     }
-                    getScene().addToDirtyLayoutList(this);
+                    scene.addToDirtyLayoutList(this);
                 }
-            } else if (getParent() != null) {
-                getParent().requestLayout();
+            } else {
+                final Parent parent = getParent();
+                if (parent != null) {
+                    parent.requestLayout();
+                }
             }
         } else {
             clearSizeCache();
@@ -854,9 +852,10 @@
         prefHeightCache = -1;
         minWidthCache = -1;
         minHeightCache = -1;
-        if (!isLayoutRoot()) {
-            if (getParent() != null) {
-                getParent().clearSizeCache();
+        if (!layoutRoot) {
+            final Parent parent = getParent();
+            if (parent != null) {
+                parent.clearSizeCache();
             }
         }
     }
@@ -866,7 +865,7 @@
             if (prefWidthCache == -1) {
                 prefWidthCache = computePrefWidth(-1);
                 sizeCacheClear = false;
-            } 
+            }
             return prefWidthCache;
         } else {
             return computePrefWidth(height);
@@ -878,7 +877,7 @@
             if (prefHeightCache == -1) {
                 prefHeightCache = computePrefHeight(-1);
                 sizeCacheClear = false;
-            } 
+            }
             return prefHeightCache;
         } else {
             return computePrefHeight(width);
@@ -923,8 +922,8 @@
     protected double computePrefWidth(double height) {
         double minX = 0;
         double maxX = 0;
-        for (int i = 0; i < getChildren().size(); i++) {
-            Node node = getChildren().get(i);
+        for (int i=0, max=children.size(); i<max; i++) {
+            Node node = children.get(i);
             if (node.isManaged()) {
                 final double x = node.getLayoutBounds().getMinX() + node.getLayoutX();
                 minX = Math.min(minX, x);
@@ -948,8 +947,8 @@
     protected double computePrefHeight(double width) {
         double minY = 0;
         double maxY = 0;
-        for (int i = 0; i < getChildren().size(); i++) {
-            Node node = getChildren().get(i);
+        for (int i=0, max=children.size(); i<max; i++) {
+            Node node = children.get(i);
             if (node.isManaged()) {
                 final double y = node.getLayoutBounds().getMinY() + node.getLayoutY();
                 minY = Math.min(minY, y);
@@ -991,9 +990,8 @@
      * @return baseline offset
      */
     @Override public double getBaselineOffset() {
-        int size = children.size();
-        for (int i = 0; i < size; ++i) {
-            Node child = children.get(i);
+        for (int i=0, max=children.size(); i<max; i++) {
+            final Node child = children.get(i);
             if (child.isManaged()) {
                 return child.getLayoutBounds().getMinY() + child.getLayoutY() + child.getBaselineOffset();
             }
@@ -1020,12 +1018,10 @@
             setNeedsLayout(false);
 
             // Perform layout on each child, hoping it has random access performance!
-            final ObservableList<Node> _children_ = getChildren();
-            final int count = _children_.size();
-            for (int i=0; i<count; i++) {
-                final Node c = _children_.get(i);
-                if (c instanceof Parent) {
-                    ((Parent) c).layout();
+            for (int i=0, max=children.size(); i<max; i++) {
+                final Node child = children.get(i);
+                if (child instanceof Parent) {
+                    ((Parent) child).layout();
                 }
             }
             performingLayout = false;
@@ -1041,21 +1037,28 @@
      * Subclasses should override this function to layout content as needed.
      */
     protected void layoutChildren() {
-        int size = children.size();
-        for (int i = 0; i < size; ++i) {
-            Node node = children.get(i);
+        for (int i=0, max=children.size(); i<max; i++) {
+            final Node node = children.get(i);
             if (node.isResizable() && node.isManaged()) {
                 node.autosize();
             }
         }
     }
 
-    boolean isSceneRoot() {
-        return getScene() != null? getScene().getRoot() == this : false;
-    }
+    /**
+     * This field is managed by the Scene, and set on any node which is the
+     * root of a Scene.
+     */
+    private boolean sceneRoot = false;
 
-    boolean isLayoutRoot() {
-        return !isManaged() || isSceneRoot();
+    /**
+     * Keeps track of whether this node is a layout root. This is updated
+     * whenever the sceneRoot field changes, or whenever the managed
+     * property changes.
+     */
+    private boolean layoutRoot = false;
+    @Override final void notifyManagedChanged() {
+        layoutRoot = !isManaged() || sceneRoot;
     }
 
     /***********************************************************************
@@ -1096,7 +1099,6 @@
      */
     public final ObservableList<String> getStylesheets() { return stylesheets; }
     
-    
     /**
      * This method recurses up the parent chain until parent is null. As the
      * stack unwinds, if the Parent has stylesheets, they are added to the
@@ -1145,10 +1147,8 @@
         // Let the super implementation handle CSS for this node
         super.impl_processCSS(flag);
         // For each child, process CSS
-        final List kids = this.getChildren();
-        final int max = kids.size();
-        for (int c=0; c<max; c++) {
-            Node kid = (Node)kids.get(c);
+        for (int i=0, max=children.size(); i<max; i++) {
+            final Node kid = children.get(i);
             if (kid != null) {
                 kid.impl_processCSS(flag);
             }
@@ -1161,15 +1161,11 @@
      */
     @Deprecated
     @Override public void impl_cssResetInitialValues() {
-        
         // RT-9784
-        
         super.impl_cssResetInitialValues();
 
-        final List kids = this.getChildren();
-        final int max = kids.size();
-        for (int c=0; c<max; c++) {
-            Node kid = (Node)kids.get(c);
+        for (int i=0, max=children.size(); i<max; i++) {
+            final Node kid = children.get(i);
             if (kid != null) {
                 kid.impl_cssResetInitialValues();
             }
@@ -1188,11 +1184,7 @@
     /**
      * Constructs a new {@code Parent}.
      */
-    protected Parent() {
-        computeDirtyScene(null);
-        requestLayout();
-    }
-
+    protected Parent() { }
 
     /**
      * @treatAsPrivate implementation detail
@@ -1225,6 +1217,7 @@
      **************************************************************************/
 
     private BaseBounds tmp = new RectBounds();
+
     /**
      * The cached bounds for the Group. If the cachedBounds are invalid
      * then we have no history of what the bounds are, or were.
@@ -1291,7 +1284,8 @@
             double minX = Double.MAX_VALUE, minY = Double.MAX_VALUE, minZ = Double.MAX_VALUE;
             double maxX = Double.MIN_VALUE, maxY = Double.MIN_VALUE, maxZ = Double.MIN_VALUE;
             boolean first = true;
-            for (Node node : getChildren()) {
+            for (int i=0, max=children.size(); i<max; i++) {
+                final Node node = children.get(i);
                 if (node.isVisible()) {
                     bounds = node.getTransformedBounds(bounds, tx);
                     // if the bounds of the child are invalid, we don't want
@@ -1567,10 +1561,8 @@
                         node.boundsChanged = false;
                     }
                 } else {
-                    final ObservableList<Node> _children_ = getChildren();
-                    final int count = _children_.size();
-                    for (int i=0; i<count; i++) {
-                        final Node node = _children_.get(i);
+                    for (int i=0, max=children.size(); i<max; i++) {
+                        final Node node = children.get(i);
                         if (node == null)
                             continue;
                         if (node.isVisible() && node.boundsChanged) {
@@ -1643,10 +1635,8 @@
         // the bounds of each node, figure out the edge nodes, get the min/max
         // for the x/y/x2/y2 and then update cachedBounds and cachedBoundsInvalid
         boolean first = true;
-        final ObservableList<Node> _children_ = getChildren();
-        final int count = _children_.size();
-        for (int i=0; i<count; i++) {
-            final Node node = _children_.get(i);
+        for (int i=0, max=children.size(); i<max; i++) {
+            final Node node = children.get(i);
             if (node == null)
                 continue;
 
@@ -1746,7 +1736,8 @@
     @Override
     protected boolean impl_computeContains(double localX, double localY) {
         final Point2D tempPt = TempState.getInstance().point;
-        for (Node node : getChildren()) {
+        for (int i=0, max=children.size(); i<max; i++) {
+            final Node node = children.get(i);
             tempPt.x = (float)localX;
             tempPt.y = (float)localY;
             try {
--- a/javafx-ui-common/src/javafx/scene/Scene.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/Scene.java	Mon Jul 30 13:08:41 2012 -0700
@@ -982,7 +982,7 @@
                         throw new IllegalArgumentException(_value +
                                 "is set as a clip on another node, so cannot be set as root");
                     }
-                    if (_value.isSceneRoot() && _value.getScene() != Scene.this) {
+                    if (_value.getScene() != null && _value.getScene().getRoot() == _value && _value.getScene() != Scene.this) {
                         if (isBound()) forceUnbind();
                         throw new IllegalArgumentException(_value +
                                 "is already set as root of another scene");
--- a/javafx-ui-common/src/javafx/scene/layout/AnchorPane.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/layout/AnchorPane.java	Mon Jul 30 13:08:41 2012 -0700
@@ -26,40 +26,43 @@
 
 package javafx.scene.layout;
 
+import javafx.geometry.Bounds;
 import javafx.geometry.Insets;
 import javafx.geometry.Orientation;
 import javafx.scene.Node;
 
+import java.util.List;
+
 /**
  * AnchorPane allows the edges of child nodes to be anchored to an offset from
- * the anchorpane's edges.  If the anchorpane has a border and/or padding set, the
+ * the anchor pane's edges.  If the anchor pane has a border and/or padding set, the
  * offsets will be measured from the inside edge of those insets.
  * <p>
  * AnchorPane lays out each managed child regardless of the child's visible property value;
  * unmanaged children are ignored for all layout calculations.</p>
  * <p>
- * Anchorpanes may be styled with backgrounds and borders using CSS.  See
+ * AnchorPanes may be styled with backgrounds and borders using CSS.  See
  * {@link javafx.scene.layout.Region Region} superclass for details.</p>
  *
  * <h4>Anchor Constraints</h4>
  * The application sets anchor constraints on each child to configure the anchors
  * on one or more sides.  If a child is anchored on opposite sides (and is resizable), the
- * anchorpane will resize it to maintain both offsets, otherwise the anchorpane
+ * anchor pane will resize it to maintain both offsets, otherwise the anchor pane
  * will resize it to its preferred size.  If in the former case (anchored on opposite
  * sides) and the child is not resizable, then only the top/left anchor will be honored.
  * AnchorPane provides a static method for setting each anchor constraint.
  * <p>
  * <table border="1">
  * <tr><th>Constraint</th><th>Type</th><th>Description</th></tr>
- * <tr><td>topAnchor</td><td>double</td><td>distance from the anchorpane's top insets to the child's top edge.</td></tr>
- * <tr><td>leftAnchor</td><td>double</td><td>distance from the anchorpane's left insets to the child's left edge.</td></tr>
- * <tr><td>bottomAnchor</td><td>double</td><td>distance from the anchorpane's bottom insets to the child's bottom edge.</td></tr>
- * <tr><td>rightAnchor</td><td>double</td><td>distance from the anchorpane's right insets to the child's right edge.</td></tr>
+ * <tr><td>topAnchor</td><td>double</td><td>distance from the anchor pane's top insets to the child's top edge.</td></tr>
+ * <tr><td>leftAnchor</td><td>double</td><td>distance from the anchor pane's left insets to the child's left edge.</td></tr>
+ * <tr><td>bottomAnchor</td><td>double</td><td>distance from the anchor pane's bottom insets to the child's bottom edge.</td></tr>
+ * <tr><td>rightAnchor</td><td>double</td><td>distance from the anchor pane's right insets to the child's right edge.</td></tr>
  * </table>
  * <p>
  * AnchorPane Example:
- * <pre><code>     AnchorPane anchorpane = new AnchorPane();
- *     // List should stretch as anchorpane is resized
+ * <pre><code>     AnchorPane anchorPane = new AnchorPane();
+ *     // List should stretch as anchorPane is resized
  *     ListView list = new ListView();
  *    <b> AnchorPane.setTopAnchor(list, 10.0);
  *     AnchorPane.setLeftAnchor(list, 10.0);
@@ -68,12 +71,12 @@
  *     Button button = new Button("Add");
  *     <b>AnchorPane.setTopAnchor(button, 10.0);
  *     AnchorPane.setRightAnchor(button, 10.0);</b>
- *     anchorpane.getChildren().addAll(list, button);
+ *     anchorPane.getChildren().addAll(list, button);
  * </code></pre>
  *
  * <h4>Resizable Range</h4>
- * An anchorpane's parent will resize the anchorpane within the anchorpane's resizable range
- * during layout.   By default the anchorpane computes this range based on its content
+ * An anchor pane's parent will resize the anchor pane within the anchor pane's resizable range
+ * during layout.   By default the anchor pane computes this range based on its content
  * as outlined in the table below.
  * <p>
  * <table border="1">
@@ -88,20 +91,20 @@
  * <td>Double.MAX_VALUE</td><td>Double.MAX_VALUE</td></tr>
  * </table>
  * <p>
- * An anchorpane's unbounded maximum width and height are an indication to the parent that
+ * An anchor pane's unbounded maximum width and height are an indication to the parent that
  * it may be resized beyond its preferred size to fill whatever space is assigned
  * to it.
  * <p>
  * AnchorPane provides properties for setting the size range directly.  These
  * properties default to the sentinel value Region.USE_COMPUTED_SIZE, however the
  * application may set them to other values as needed:
- * <pre><code>     <b>anchorpane.setPrefSize(300, 300);</b>
+ * <pre><code>     <b>anchorPane.setPrefSize(300, 300);</b>
  * </code></pre>
  * Applications may restore the computed values by setting these properties back
  * to Region.USE_COMPUTED_SIZE.
  * <p>
  * AnchorPane does not clip its content by default, so it is possible that childrens'
- * bounds may extend outside its own bounds if the anchorpane is resized smaller
+ * bounds may extend outside its own bounds if the anchor pane is resized smaller
  * than its preferred size.</p>
  *
  */
@@ -117,13 +120,13 @@
      ********************************************************************/
 
     /**
-     * Sets the top anchor for the child when contained by an anchorpane.
-     * If set, the anchorpane will maintain the child's size and position so
-     * that it's top is always offset by that amount from the anchorpane's top
+     * Sets the top anchor for the child when contained by an anchor pane.
+     * If set, the anchor pane will maintain the child's size and position so
+     * that it's top is always offset by that amount from the anchor pane's top
      * content edge.
      * Setting the value to null will remove the constraint.
-     * @param child the child node of an anchorpane
-     * @param value the offset from the top of the anchorpane
+     * @param child the child node of an anchor pane
+     * @param value the offset from the top of the anchor pane
      */
     public static void setTopAnchor(Node child, Double value) {
         setConstraint(child, TOP_ANCHOR, value);
@@ -131,21 +134,21 @@
 
     /**
      * Returns the child's top anchor constraint if set.
-     * @param child the child node of an anchorpane
-     * @return the offset from the top of the anchorpane or null if no top anchor was set
+     * @param child the child node of an anchor pane
+     * @return the offset from the top of the anchor pane or null if no top anchor was set
      */
     public static Double getTopAnchor(Node child) {
         return (Double)getConstraint(child, TOP_ANCHOR);
     }
 
     /**
-     * Sets the left anchor for the child when contained by an anchorpane.
-     * If set, the anchorpane will maintain the child's size and position so
-     * that it's left is always offset by that amount from the anchorpane's left
+     * Sets the left anchor for the child when contained by an anchor pane.
+     * If set, the anchor pane will maintain the child's size and position so
+     * that it's left is always offset by that amount from the anchor pane's left
      * content edge.
      * Setting the value to null will remove the constraint.
-     * @param child the child node of an anchorpane
-     * @param value the offset from the left of the anchorpane
+     * @param child the child node of an anchor pane
+     * @param value the offset from the left of the anchor pane
      */
     public static void setLeftAnchor(Node child, Double value) {
         setConstraint(child, LEFT_ANCHOR, value);
@@ -153,21 +156,21 @@
 
     /**
      * Returns the child's left anchor constraint if set.
-     * @param child the child node of an anchorpane
-     * @return the offset from the left of the anchorpane or null if no left anchor was set
+     * @param child the child node of an anchor pane
+     * @return the offset from the left of the anchor pane or null if no left anchor was set
      */
     public static Double getLeftAnchor(Node child) {
         return (Double)getConstraint(child, LEFT_ANCHOR);
     }
 
     /**
-     * Sets the bottom anchor for the child when contained by an anchorpane.
-     * If set, the anchorpane will maintain the child's size and position so
-     * that it's bottom is always offset by that amount from the anchorpane's bottom
+     * Sets the bottom anchor for the child when contained by an anchor pane.
+     * If set, the anchor pane will maintain the child's size and position so
+     * that it's bottom is always offset by that amount from the anchor pane's bottom
      * content edge.
      * Setting the value to null will remove the constraint.
-     * @param child the child node of an anchorpane
-     * @param value the offset from the bottom of the anchorpane
+     * @param child the child node of an anchor pane
+     * @param value the offset from the bottom of the anchor pane
      */
     public static void setBottomAnchor(Node child, Double value) {
         setConstraint(child, BOTTOM_ANCHOR, value);
@@ -175,21 +178,21 @@
 
     /**
      * Returns the child's bottom anchor constraint if set.
-     * @param child the child node of an anchorpane
-     * @return the offset from the bottom of the anchorpane or null if no bottom anchor was set
+     * @param child the child node of an anchor pane
+     * @return the offset from the bottom of the anchor pane or null if no bottom anchor was set
      */
     public static Double getBottomAnchor(Node child) {
         return (Double)getConstraint(child, BOTTOM_ANCHOR);
     }
 
     /**
-     * Sets the bottom anchor for the child when contained by an anchorpane.
-     * If set, the anchorpane will maintain the child's size and position so
-     * that it's right is always offset by that amount from the anchorpane's right
+     * Sets the bottom anchor for the child when contained by an anchor pane.
+     * If set, the anchor pane will maintain the child's size and position so
+     * that it's right is always offset by that amount from the anchor pane's right
      * content edge.
      * Setting the value to null will remove the constraint.
-     * @param child the child node of an anchorpane
-     * @param value the offset from the right of the anchorpane
+     * @param child the child node of an anchor pane
+     * @param value the offset from the right of the anchor pane
      */
     public static void setRightAnchor(Node child, Double value) {
         setConstraint(child, RIGHT_ANCHOR, value);
@@ -197,15 +200,15 @@
 
     /**
      * Returns the child's right anchor constraint if set.
-     * @param child the child node of an anchorpane
-     * @return the offset from the right of the anchorpane or null if no right anchor was set
+     * @param child the child node of an anchor pane
+     * @return the offset from the right of the anchor pane or null if no right anchor was set
      */
     public static Double getRightAnchor(Node child) {
         return (Double)getConstraint(child, RIGHT_ANCHOR);
     }
 
     /**
-     * Removes all anchorpane constraints from the child node.
+     * Removes all anchor pane constraints from the child node.
      * @param child the child node
      */
     public static void clearConstraints(Node child) {
@@ -244,8 +247,9 @@
 
     private double computeWidth(boolean minimum, double height) {
         double max = 0;
-        for (int i = 0; i < getChildren().size(); i++) {
-            Node child = getChildren().get(i);
+        final List<Node> children = getChildren();
+        for (int i=0, size=children.size(); i<size; i++) {
+            Node child = children.get(i);
             if (child.isManaged()) {
                 Double leftAnchor = getLeftAnchor(child);
                 Double rightAnchor = getRightAnchor(child);
@@ -259,13 +263,16 @@
                 max = Math.max(max, left + (minimum? child.minWidth(height) : child.prefWidth(height)) + right);
             }
         }
-        return getInsets().getLeft() + max + getInsets().getRight();
+        
+        final Insets insets = getInsets();
+        return insets.getLeft() + max + insets.getRight();
     }
 
     private double computeHeight(boolean minimum, double width) {
         double max = 0;
-        for (int i = 0; i < getChildren().size(); i++) {
-            Node child = getChildren().get(i);
+        final List<Node> children = getChildren();
+        for (int i=0, size=children.size(); i<size; i++) {
+            Node child = children.get(i);
             if (child.isManaged()) {
                 Double topAnchor = getTopAnchor(child);
                 Double bottomAnchor = getBottomAnchor(child);
@@ -279,66 +286,72 @@
                 max = Math.max(max, top + (minimum? child.minHeight(width) : child.prefHeight(width)) + bottom);
             }
         }
-        return getInsets().getTop() + max + getInsets().getBottom();
+
+        final Insets insets = getInsets();
+        return insets.getTop() + max + insets.getBottom();
     }
 
     private double computeChildWidth(Node child, Double leftAnchor, Double rightAnchor, double height) {
         if (leftAnchor != null && rightAnchor != null && child.isResizable()) {
-             return getWidth() - getInsets().getLeft() - getInsets().getRight() - leftAnchor - rightAnchor;
+            final Insets insets = getInsets();
+            return getWidth() - insets.getLeft() - insets.getRight() - leftAnchor - rightAnchor;
         }
         return computeChildPrefAreaWidth(child, Insets.EMPTY, height);
     }
 
     private double computeChildHeight(Node child, Double topAnchor, Double bottomAnchor, double width) {
         if (topAnchor != null && bottomAnchor != null && child.isResizable()) {
-             return getHeight() - getInsets().getTop() - getInsets().getBottom() - topAnchor - bottomAnchor;
+            final Insets insets = getInsets();
+            return getHeight() - insets.getTop() - insets.getBottom() - topAnchor - bottomAnchor;
         }
         return computeChildPrefAreaHeight(child, Insets.EMPTY, width);
     }
 
     @Override protected void layoutChildren() {
-        Insets insets = getInsets();
-        
-        for (int i = 0; i < getChildren().size(); i++) {
-            Node child = getChildren().get(i);
+        final Insets insets = getInsets();
+        final List<Node> children = getChildren();
+        for (int i=0, size=children.size(); i<size; i++) {
+            Node child = children.get(i);
             if (child.isManaged()) {
-                Double topAnchor = getTopAnchor(child);
-                Double bottomAnchor = getBottomAnchor(child);
-                Double leftAnchor = getLeftAnchor(child);
-                Double rightAnchor = getRightAnchor(child);
+                final Double topAnchor = getTopAnchor(child);
+                final Double bottomAnchor = getBottomAnchor(child);
+                final Double leftAnchor = getLeftAnchor(child);
+                final Double rightAnchor = getRightAnchor(child);
+                final Bounds childLayoutBounds = child.getLayoutBounds();
+                final Orientation bias = child.getContentBias();
 
-                double x = child.getLayoutX() + child.getLayoutBounds().getMinX();
-                double y = child.getLayoutY() + child.getLayoutBounds().getMinY();
-
+                double x = child.getLayoutX() + childLayoutBounds.getMinX();
+                double y = child.getLayoutY() + childLayoutBounds.getMinY();
                 double w = -1;
                 double h = -1;
-                Orientation bias = child.getContentBias();
+
                 if (bias == Orientation.VERTICAL) {
                     // width depends on height
+                    // WARNING: The order of these calls is crucial, there is some
+                    // hidden ordering dependency here!
                     h = computeChildHeight(child, topAnchor, bottomAnchor, -1);
                     w = computeChildWidth(child, leftAnchor, rightAnchor, h);
-
                 } else if (bias == Orientation.HORIZONTAL) {
-                    // height depends on width
                     w = computeChildWidth(child, leftAnchor, rightAnchor, -1);
                     h = computeChildHeight(child, topAnchor, bottomAnchor, w);
-                } else {                    
+                } else {
+                    // bias may be null
                     w = computeChildWidth(child, leftAnchor, rightAnchor, -1);
                     h = computeChildHeight(child, topAnchor, bottomAnchor, -1);
                 }
 
                 if (leftAnchor != null) {
                     x = insets.getLeft() + leftAnchor;
-
                 } else if (rightAnchor != null) {                   
                     x = getWidth() - insets.getRight() - rightAnchor - w;
                 }
+                
                 if (topAnchor != null) {
                     y = insets.getTop() + topAnchor;
-
                 } else if (bottomAnchor != null) {
                     y = getHeight() - insets.getBottom() - bottomAnchor - h;
                 }
+                
                 child.resizeRelocate(x, y, w, h);
             }
         }
--- a/javafx-ui-common/src/javafx/scene/layout/BorderPane.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/layout/BorderPane.java	Mon Jul 30 13:08:41 2012 -0700
@@ -35,6 +35,8 @@
 import javafx.geometry.VPos;
 import javafx.scene.Node;
 
+import java.util.List;
+
 
 /**
  * BorderPane lays out children in top, left, right, bottom, and center positions.
@@ -42,13 +44,13 @@
  * <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
+ * extend the width of the border pane.  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>
+ * <pre><code>     <b>BorderPane borderPane = new BorderPane();</b>
  *     ToolBar toolbar = new ToolBar();
  *     HBox statusbar = new HBox();
  *     Node appContent = new AppContentNode();
@@ -82,9 +84,9 @@
  * BorderPane is commonly used as the root of a {@link javafx.scene.Scene Scene},
  * in which case its size will track the size of the scene.  If the scene or stage
  * size has not been directly set by the application, the scene size will be
- * initialized to the borderpane's preferred size.   However, if a borderpane
- * has a parent other than the scene, that parent will resize the borderpane within
- * the borderpane's resizable range during layout.   By default the borderpane
+ * initialized to the border pane's preferred size.   However, if a border pane
+ * has a parent other than the scene, that parent will resize the border pane within
+ * the border pane's resizable range during layout.   By default the border pane
  * computes this range based on its content as outlined in the table below.
  * <p>
  * <table border="1">
@@ -99,14 +101,14 @@
  * <td>Double.MAX_VALUE</td><td>Double.MAX_VALUE</td></tr>
  * </table>
  * <p>
- * A borderpane's unbounded maximum width and height are an indication to the parent that
+ * A border pane's unbounded maximum width and height are an indication to the parent that
  * it may be resized beyond its preferred size to fill whatever space is assigned to it.
  * <p>
  * BorderPane provides properties for setting the size range directly.  These
  * properties default to the sentinel value Region.USE_COMPUTED_SIZE, however the
  * application may set them to other values as needed:
  * <pre><code>
- *     <b>borderpane.setPrefSize(500,400);</b>
+ *     <b>borderPane.setPrefSize(500,400);</b>
  * </code></pre>
  * Applications may restore the computed values by setting these properties back
  * to Region.USE_COMPUTED_SIZE.
@@ -122,7 +124,7 @@
  * <p>
  * <table border="1">
  * <tr><th>Constraint</th><th>Type</th><th>Description</th></tr>
- * <tr><td>alignment</td><td>javafx.geometry.Pos</td><td>The alignment of the child within its area of the borderpane.</td></tr>
+ * <tr><td>alignment</td><td>javafx.geometry.Pos</td><td>The alignment of the child within its area of the border pane.</td></tr>
  * <tr><td>margin</td><td>javafx.geometry.Insets</td><td>Margin space around the outside of the child.</td></tr>
  * </table>
  * <p>
@@ -130,12 +132,11 @@
  * <pre><code>     ListView list = new ListView();
  *     <b>BorderPane.setAlignment(list, Pos.TOP_LEFT);
  *     BorderPane.setMargin(list, new Insets(12,12,12,12));</b>
- *     borderpane.setCenter(list);
+ *     borderPane.setCenter(list);
  * </code></pre>
  *
  */
 public class BorderPane extends Pane {
-    //TODO(aim): add topLeftCorner,topRightCorner,bottomLeftCorner,bottomRightCorner
     /********************************************************************
      *  BEGIN static methods
      ********************************************************************/
@@ -144,10 +145,10 @@
     private static final String ALIGNMENT = "borderpane-alignment";
 
     /**
-     * Sets the alignment for the child when contained by a borderpane.
-     * If set, will override the borderpane's default alignment for the child's position.
+     * Sets the alignment for the child when contained by a border pane.
+     * If set, will override the border pane's default alignment for the child's position.
      * Setting the value to null will remove the constraint.
-     * @param child the child node of a borderpane
+     * @param child the child node of a border pane
      * @param value the alignment position for the child
      */
     public static void setAlignment(Node child, Pos value) {
@@ -156,7 +157,7 @@
 
     /**
      * Returns the child's alignment constraint if set.
-     * @param child the child node of a borderpane
+     * @param child the child node of a border pane
      * @return the alignment position for the child or null if no alignment was set
      */
     public static Pos getAlignment(Node child) {
@@ -164,10 +165,10 @@
     }
 
     /**
-     * Sets the margin for the child when contained by a borderpane.
-     * If set, the borderpane will lay it out with the margin space around it.
+     * Sets the margin for the child when contained by a border pane.
+     * If set, the border pane will lay it out with the margin space around it.
      * Setting the value to null will remove the constraint.
-     * @param child the child node of a borderpane
+     * @param child the child node of a border pane
      * @param value the margin of space around the child
      */
     public static void setMargin(Node child, Insets value) {
@@ -176,7 +177,7 @@
 
     /**
      * Returns the child's margin constraint if set.
-     * @param child the child node of a borderpane
+     * @param child the child node of a border pane
      * @return the margin for the child or null if no margin was set
      */
     public static Insets getMargin(Node child) {
@@ -186,17 +187,18 @@
     // convenience for handling null margins
     private static Insets getNodeMargin(Node child) {
         Insets margin = getMargin(child);
-        return margin != null? margin : Insets.EMPTY;
+        return margin != null ? margin : Insets.EMPTY;
     }
 
     /**
-     * Removes all borderpane constraints from the child node.
+     * Removes all border pane constraints from the child node.
      * @param child the child node
      */
     public static void clearConstraints(Node child) {
         setAlignment(child, null);
         setMargin(child, null);
     }
+
     /********************************************************************
      *  END static methods
      ********************************************************************/
@@ -208,36 +210,6 @@
         super();
     }
 
-    private ObjectProperty<Node> createObjectPropertyModelImpl(
-            final String propertyName) {
-        return new ObjectPropertyBase<Node>() {
-
-                Node oldValue = null;
-
-                @Override
-                protected void invalidated() {
-                    Node _value = get();
-                    if (oldValue != null) {
-                        getChildren().remove(oldValue);
-                    }
-                    this.oldValue = _value;
-                    if (_value != null) {
-                        getChildren().add(_value);
-                    }
-                }
-
-                @Override
-                public Object getBean() {
-                    return BorderPane.this;
-                }
-
-                @Override
-                public String getName() {
-                    return propertyName;
-                }
-        };
-    }
-
     /**
      * The node placed in the center of this border pane.
      * If resizable, it will be resized fill the center of the border pane
@@ -248,7 +220,7 @@
      */
     public final ObjectProperty<Node> centerProperty() {
         if (center == null) {
-            center = createObjectPropertyModelImpl("center");
+            center = new BorderPositionProperty("center");
         }
         return center;
     }
@@ -266,7 +238,7 @@
      */
     public final ObjectProperty<Node> topProperty() {
         if (top == null) {
-            top = createObjectPropertyModelImpl("top");
+            top = new BorderPositionProperty("top");
         }
         return top;
     }
@@ -284,7 +256,7 @@
      */
     public final ObjectProperty<Node> bottomProperty() {
         if (bottom == null) {
-            bottom = createObjectPropertyModelImpl("bottom");
+            bottom = new BorderPositionProperty("bottom");
         }
         return bottom;
     }
@@ -302,7 +274,7 @@
      */
     public final ObjectProperty<Node> leftProperty() {
         if (left == null) {
-            left = createObjectPropertyModelImpl("left");
+            left = new BorderPositionProperty("left");
         }
         return left;
     }
@@ -320,7 +292,7 @@
      */
     public final ObjectProperty<Node> rightProperty() {
         if (right == null) {
-            right = createObjectPropertyModelImpl("right");
+            right = new BorderPositionProperty("right");
         }
         return right;
     }
@@ -332,17 +304,31 @@
      * @return null unless the center, right, bottom, left or top has a content bias.
      */
     @Override public Orientation getContentBias() {
-        if (getCenter() != null && getCenter().isManaged() && getCenter().getContentBias() != null) {
-            return getCenter().getContentBias();
-        } else if (getRight() != null && getRight().isManaged() && getRight().getContentBias() != null) {
-            return getRight().getContentBias();
-        } else if (getBottom() != null && getBottom().isManaged() && getBottom().getContentBias() != null) {
-            return getBottom().getContentBias();
-        } else if (getLeft() != null && getLeft().isManaged() && getLeft().getContentBias() != null) {
-            return getLeft().getContentBias();
-        } else if (getTop() != null && getTop().isManaged() && getTop().getContentBias() != null) {
-            return getTop().getContentBias();
+        final Node c = getCenter();
+        if (c != null && c.isManaged() && c.getContentBias() != null) {
+            return c.getContentBias();
         }
+
+        final Node r = getRight();
+        if (r != null && r.isManaged() && r.getContentBias() != null) {
+            return r.getContentBias();
+        }
+
+        final Node b = getBottom();
+        if (b != null && b.isManaged() && b.getContentBias() != null) {
+            return b.getContentBias();
+        }
+
+        final Node l = getLeft();
+        if (l != null && l.isManaged() && l.getContentBias() != null) {
+            return l.getContentBias();
+        }
+
+        final Node t = getTop();
+        if (t != null && t.isManaged() && t.getContentBias() != null) {
+            return t.getContentBias();
+        }
+
         return null;
     }
 
@@ -353,233 +339,267 @@
         double rightMinWidth;
         double bottomMinWidth;
 
+        final Node c = getCenter();
+        final Node r = getRight();
+        final Node b = getBottom();
+        final Node l = getLeft();
+        final Node t = getTop();
+
         if (getContentBias() == Orientation.VERTICAL) {
-            double h[] = adjustAreaHeight(height, -1);
+            final double h[] = adjustAreaHeight(height, -1);
+            topMinWidth = getAreaWidth(t, h[0], true);
+            leftMinWidth = getAreaWidth(l, h[1], true);
+            centerMinWidth = getAreaWidth(c, h[2], true);
+            rightMinWidth = getAreaWidth(r, h[3], true);
+            bottomMinWidth = getAreaWidth(b, h[4], true);
+        } else {
+            topMinWidth = t != null? computeChildMinAreaWidth(t, getMargin(t)) : 0;
+            leftMinWidth = l != null? computeChildMinAreaWidth(l, getMargin(l)) : 0;
+            centerMinWidth = c != null? computeChildMinAreaWidth(c, getMargin(c)) : 0;
+            rightMinWidth = r != null? computeChildMinAreaWidth(r, getMargin(r)) : 0;
+            bottomMinWidth = b != null? computeChildMinAreaWidth(b, getMargin(b)) : 0;
+        }
 
-            topMinWidth = getAreaWidth(getTop(), h[0], true);
-            leftMinWidth = getAreaWidth(getLeft(), h[1], true);
-            centerMinWidth = getAreaWidth(getCenter(), h[2], true);
-            rightMinWidth = getAreaWidth(getRight(), h[3], true);
-            bottomMinWidth = getAreaWidth(getBottom(), h[4], true);
-        } else {
-            topMinWidth = getTop() != null? computeChildMinAreaWidth(getTop(), getMargin(getTop())) : 0;
-            leftMinWidth = getLeft() != null? computeChildMinAreaWidth(getLeft(), getMargin(getLeft())) : 0;
-            centerMinWidth = getCenter() != null? computeChildMinAreaWidth(getCenter(), getMargin(getCenter())) : 0;
-            rightMinWidth = getRight() != null? computeChildMinAreaWidth(getRight(), getMargin(getRight())) : 0;
-            bottomMinWidth = getBottom() != null? computeChildMinAreaWidth(getBottom(), getMargin(getBottom())) : 0;
-        }
-        return getInsets().getLeft() +
+        final Insets insets = getInsets();
+        return insets.getLeft() +
                 Math.max(leftMinWidth + centerMinWidth + rightMinWidth, Math.max(topMinWidth,bottomMinWidth)) +
-                getInsets().getRight();
+                insets.getRight();
     }
 
     @Override protected double computeMinHeight(double width) {
-        double topMinHeight = 0;
-        double bottomMinHeight = 0;
-        double leftMinHeight = 0;
-        double centerMinHeight = 0;
-        double rightMinHeight = 0;
+        double topMinHeight;
+        double bottomMinHeight;
+        double leftMinHeight;
+        double centerMinHeight;
+        double rightMinHeight;
+
+        final Node c = getCenter();
+        final Node r = getRight();
+        final Node b = getBottom();
+        final Node l = getLeft();
+        final Node t = getTop();
 
         if (getContentBias() == Orientation.HORIZONTAL) {
-            double w[] = adjustAreaWidth(width, -1);
+            final double w[] = adjustAreaWidth(width, -1);
+            topMinHeight = getAreaHeight(t, width, true);
+            leftMinHeight = getAreaHeight(l, w[0], true);
+            centerMinHeight = getAreaHeight(c, w[1], true);
+            rightMinHeight = getAreaHeight(r, w[2], true);
+            bottomMinHeight = getAreaHeight(b, width, true);
+        } else {
+            topMinHeight = t != null? computeChildMinAreaHeight(t, getMargin(t)) : 0;
+            leftMinHeight = l != null? computeChildMinAreaHeight(l, getMargin(l)) : 0;
+            centerMinHeight = c != null? computeChildMinAreaHeight(c, getMargin(c)) : 0;
+            rightMinHeight = r != null? computeChildMinAreaHeight(r, getMargin(r)) : 0;
+            bottomMinHeight = b != null? computeChildMinAreaHeight(b, getMargin(b)) : 0;
+        }
 
-            topMinHeight = getAreaHeight(getTop(), width, true);
-            leftMinHeight = getAreaHeight(getLeft(), w[0], true);
-            centerMinHeight = getAreaHeight(getCenter(), w[1], true);
-            rightMinHeight = getAreaHeight(getRight(), w[2], true);
-            bottomMinHeight = getAreaHeight(getBottom(), width, true);
-        } else {
-            topMinHeight = getTop() != null? computeChildMinAreaHeight(getTop(), getMargin(getTop())) : 0;
-            leftMinHeight = getLeft() != null? computeChildMinAreaHeight(getLeft(), getMargin(getLeft())) : 0;
-            centerMinHeight = getCenter() != null? computeChildMinAreaHeight(getCenter(), getMargin(getCenter())) : 0;
-            rightMinHeight = getRight() != null? computeChildMinAreaHeight(getRight(), getMargin(getRight())) : 0;
-            bottomMinHeight = getBottom() != null? computeChildMinAreaHeight(getBottom(), getMargin(getBottom())) : 0;
-        }
-        return getInsets().getTop() + topMinHeight +
+        final Insets insets = getInsets();
+        return insets.getTop() + topMinHeight +
                 Math.max(centerMinHeight, Math.max(rightMinHeight,leftMinHeight)) +
-                bottomMinHeight + getInsets().getBottom();
+                bottomMinHeight + insets.getBottom();
     }
 
     @Override protected double computePrefWidth(double height) {
-        double topPrefWidth = 0;
-        double leftPrefWidth = 0;
-        double centerPrefWidth = 0;
-        double rightPrefWidth = 0;
-        double bottomPrefWidth = 0;
+        double topPrefWidth;
+        double leftPrefWidth;
+        double centerPrefWidth;
+        double rightPrefWidth;
+        double bottomPrefWidth;
+
+        final Node c = getCenter();
+        final Node r = getRight();
+        final Node b = getBottom();
+        final Node l = getLeft();
+        final Node t = getTop();
 
         if (getContentBias() == Orientation.VERTICAL) {
-            double h[] = adjustAreaHeight(height, -1);
+            final double h[] = adjustAreaHeight(height, -1);
+            topPrefWidth = getAreaWidth(t, h[0], false);
+            leftPrefWidth = getAreaWidth(l, h[1], false);
+            centerPrefWidth = getAreaWidth(c, h[2], false);
+            rightPrefWidth = getAreaWidth(r, h[3], false);
+            bottomPrefWidth = getAreaWidth(b, h[4], false);
+        } else {
+            double centerPrefHeight = c != null? computeChildPrefAreaHeight(c, getMargin(c)) : 0;
+            double leftPrefHeight = l != null? computeChildPrefAreaHeight(l, getMargin(l)) : 0;
+            double rightPrefHeight = r != null? computeChildPrefAreaHeight(r, getMargin(r)) : 0;
+            double maxHeight = Math.max(centerPrefHeight, Math.max(rightPrefHeight, leftPrefHeight));
+            leftPrefWidth = l != null? computeChildPrefAreaWidth(l, getMargin(l), maxHeight) : 0;
+            rightPrefWidth = r != null? computeChildPrefAreaWidth(r, getMargin(r), maxHeight) : 0;
+            centerPrefWidth = c != null? computeChildPrefAreaWidth(c, getMargin(c), maxHeight) : 0;
+            topPrefWidth = t != null? computeChildPrefAreaWidth(t, getMargin(t)) : 0;
+            bottomPrefWidth = b != null? computeChildPrefAreaWidth(b, getMargin(b)) : 0;
+        }
 
-            topPrefWidth = getAreaWidth(getTop(), h[0], false);
-            leftPrefWidth = getAreaWidth(getLeft(), h[1], false);
-            centerPrefWidth = getAreaWidth(getCenter(), h[2], false);
-            rightPrefWidth = getAreaWidth(getRight(), h[3], false);
-            bottomPrefWidth = getAreaWidth(getBottom(), h[4], false);
-        } else {
-            double centerPrefHeight = getCenter() != null? computeChildPrefAreaHeight(getCenter(), getMargin(getCenter())) : 0;
-            double leftPrefHeight = getLeft() != null? computeChildPrefAreaHeight(getLeft(), getMargin(getLeft())) : 0;
-            double rightPrefHeight = getRight() != null? computeChildPrefAreaHeight(getRight(), getMargin(getRight())) : 0;
-
-            double maxHeight = Math.max(centerPrefHeight, Math.max(rightPrefHeight, leftPrefHeight));
-
-            leftPrefWidth = getLeft() != null? computeChildPrefAreaWidth(getLeft(), getMargin(getLeft()), maxHeight) : 0;
-            rightPrefWidth = getRight() != null? computeChildPrefAreaWidth(getRight(), getMargin(getRight()), maxHeight) : 0;
-            centerPrefWidth = getCenter() != null? computeChildPrefAreaWidth(getCenter(), getMargin(getCenter()), maxHeight) : 0;
-
-            topPrefWidth = getTop() != null? computeChildPrefAreaWidth(getTop(), getMargin(getTop())) : 0;
-            bottomPrefWidth = getBottom() != null? computeChildPrefAreaWidth(getBottom(), getMargin(getBottom())) : 0;
-        }
-        return getInsets().getLeft() +
+        final Insets insets = getInsets();
+        return insets.getLeft() +
                 Math.max(leftPrefWidth + centerPrefWidth + rightPrefWidth, Math.max(topPrefWidth,bottomPrefWidth)) +
-                getInsets().getRight();
+                insets.getRight();
     }
 
     @Override protected double computePrefHeight(double width) {
-        double topPrefHeight = 0;
-        double bottomPrefHeight = 0;
-        double leftPrefHeight = 0;
-        double centerPrefHeight = 0;
-        double rightPrefHeight = 0;
-        double maxHeight = 0;
+        double topPrefHeight;
+        double bottomPrefHeight;
+        double leftPrefHeight;
+        double centerPrefHeight;
+        double rightPrefHeight;
+        double maxHeight;
+
+        final Node c = getCenter();
+        final Node r = getRight();
+        final Node b = getBottom();
+        final Node l = getLeft();
+        final Node t = getTop();
+        final Insets insets = getInsets();
 
         if (getContentBias() == Orientation.HORIZONTAL) {
-            double w[] = adjustAreaWidth(width, -1);
-
-            topPrefHeight = getAreaHeight(getTop(), width, false);
-            leftPrefHeight = getAreaHeight(getLeft(), w[0], false);
-            centerPrefHeight = getAreaHeight(getCenter(), w[1], false);
-            rightPrefHeight = getAreaHeight(getRight(), w[2], false);
-            bottomPrefHeight = getAreaHeight(getBottom(), width, false);
-
+            final double w[] = adjustAreaWidth(width, -1);
+            topPrefHeight = getAreaHeight(t, width, false);
+            leftPrefHeight = getAreaHeight(l, w[0], false);
+            centerPrefHeight = getAreaHeight(c, w[1], false);
+            rightPrefHeight = getAreaHeight(r, w[2], false);
+            bottomPrefHeight = getAreaHeight(b, width, false);
             maxHeight = Math.max(centerPrefHeight, Math.max(rightPrefHeight, leftPrefHeight));
         } else {
-            centerPrefHeight = getCenter() != null? computeChildPrefAreaHeight(getCenter(), getMargin(getCenter())) : 0;
-            leftPrefHeight = getLeft() != null? computeChildPrefAreaHeight(getLeft(), getMargin(getLeft())) : 0;
-            rightPrefHeight = getRight() != null? computeChildPrefAreaHeight(getRight(), getMargin(getRight())) : 0;
+            final Insets centerMargin = c == null ? null : getMargin(c);
+            final Insets rightMargin = r == null ? null : getMargin(r);
+            final Insets bottomMargin = b == null ? null : getMargin(b);
+            final Insets leftMargin = l == null ? null : getMargin(l);
+            final Insets topMargin = t == null ? null : getMargin(t);
+            centerPrefHeight = c != null? computeChildPrefAreaHeight(c, centerMargin) : 0;
+            leftPrefHeight = l != null? computeChildPrefAreaHeight(l, leftMargin) : 0;
+            rightPrefHeight = r != null? computeChildPrefAreaHeight(r, rightMargin) : 0;
+            maxHeight = Math.max(centerPrefHeight, Math.max(rightPrefHeight, leftPrefHeight));
+            double leftPrefWidth = l != null? computeChildPrefAreaWidth(l, leftMargin, maxHeight) : 0;
+            double rightPrefWidth = r != null? computeChildPrefAreaWidth(r, rightMargin, maxHeight) : 0;
+            double centerPrefWidth = c != null? computeChildPrefAreaWidth(c, centerMargin, maxHeight) : 0;
+            double topPrefWidth = t != null? computeChildPrefAreaWidth(t, topMargin) : 0;
+            double bottomPrefWidth = b != null? computeChildPrefAreaWidth(b, bottomMargin) : 0;
+            double prefWidth = insets.getLeft() +
+                    Math.max(leftPrefWidth + centerPrefWidth + rightPrefWidth, Math.max(topPrefWidth,bottomPrefWidth)) +
+                    insets.getRight();
 
-            maxHeight = Math.max(centerPrefHeight, Math.max(rightPrefHeight, leftPrefHeight));
-
-            double leftPrefWidth = getLeft() != null? computeChildPrefAreaWidth(getLeft(), getMargin(getLeft()), maxHeight) : 0;
-            double rightPrefWidth = getRight() != null? computeChildPrefAreaWidth(getRight(), getMargin(getRight()), maxHeight) : 0;
-            double centerPrefWidth = getCenter() != null? computeChildPrefAreaWidth(getCenter(), getMargin(getCenter()), maxHeight) : 0;
-
-            double topPrefWidth = getTop() != null? computeChildPrefAreaWidth(getTop(), getMargin(getTop())) : 0;
-            double bottomPrefWidth = getBottom() != null? computeChildPrefAreaWidth(getBottom(), getMargin(getBottom())) : 0;
-
-            double prefWidth = getInsets().getLeft() +
-                    Math.max(leftPrefWidth + centerPrefWidth + rightPrefWidth, Math.max(topPrefWidth,bottomPrefWidth)) +
-                    getInsets().getRight();
-
-            topPrefHeight = getTop() != null? computeChildPrefAreaHeight(getTop(), getMargin(getTop()), prefWidth) : 0;
-            bottomPrefHeight = getBottom() != null? computeChildPrefAreaHeight(getBottom(), getMargin(getBottom()), prefWidth) : 0;
+            topPrefHeight = t != null? computeChildPrefAreaHeight(t, topMargin, prefWidth) : 0;
+            bottomPrefHeight = b != null? computeChildPrefAreaHeight(b, bottomMargin, prefWidth) : 0;
         }
 
-        return getInsets().getTop() + topPrefHeight + maxHeight + bottomPrefHeight + getInsets().getBottom();
+        return insets.getTop() + topPrefHeight + maxHeight + bottomPrefHeight + insets.getBottom();
     }
 
     @Override protected void layoutChildren() {
-        double width = getWidth();
-        double height = getHeight();
-        double insideX = getInsets().getLeft();
-        double insideY = getInsets().getTop();
-        double insideWidth = width - insideX - getInsets().getRight();
-        double insideHeight = height - insideY - getInsets().getBottom();
-
-        double widths[] = adjustAreaWidth(width, height);
-        double heights[] = adjustAreaHeight(height, width);
+        final Insets insets = getInsets();
+        final double width = getWidth();
+        final double height = getHeight();
+        final double insideX = insets.getLeft();
+        final double insideY = insets.getTop();
+        final double insideWidth = width - insideX - insets.getRight();
+        final double insideHeight = height - insideY - insets.getBottom();
+        final double widths[] = adjustAreaWidth(width, height);
+        final double heights[] = adjustAreaHeight(height, width);
+        final Node c = getCenter();
+        final Node r = getRight();
+        final Node b = getBottom();
+        final Node l = getLeft();
+        final Node t = getTop();
 
         double topHeight = 0;
         Insets topMargin = null;
-        if (getTop() != null) {
-            topMargin = getNodeMargin(getTop());
+        if (t != null) {
+            topMargin = getNodeMargin(t);
             if (getContentBias() == Orientation.VERTICAL) {
-                topHeight = heights[0] == -1 ? getTop().prefHeight(-1) : heights[0];
+                topHeight = heights[0] == -1 ? t.prefHeight(-1) : heights[0];
             } else {
                 topHeight = snapSize(topMargin.getTop() +
-                        getTop().prefHeight(insideWidth - topMargin.getLeft() - topMargin.getRight()) +
+                        t.prefHeight(insideWidth - topMargin.getLeft() - topMargin.getRight()) +
                         topMargin.getBottom());
             }
         }
+
         double bottomHeight = 0;
         Insets bottomMargin = null;
-        if (getBottom() != null) {
-            bottomMargin = getNodeMargin(getBottom());
+        if (b != null) {
+            bottomMargin = getNodeMargin(b);
             if (getContentBias() == Orientation.VERTICAL) {
-                bottomHeight = heights[4] == -1 ? getBottom().prefHeight(-1) : heights[4];
+                bottomHeight = heights[4] == -1 ? b.prefHeight(-1) : heights[4];
             } else {
                 bottomHeight = snapSize(bottomMargin.getTop() +
-                        getBottom().prefHeight(insideWidth - bottomMargin.getLeft() - bottomMargin.getRight()) +
+                        b.prefHeight(insideWidth - bottomMargin.getLeft() - bottomMargin.getRight()) +
                         bottomMargin.getBottom());
             }
         }
+
         double leftWidth = 0;
         Insets leftMargin = null;
-        if (getLeft() != null) {
-            leftMargin = getNodeMargin(getLeft());
+        if (l != null) {
+            leftMargin = getNodeMargin(l);
             if (getContentBias() == Orientation.HORIZONTAL) {
-                leftWidth =  widths[0] == -1 ? getLeft().prefWidth(-1) : widths[0];
+                leftWidth =  widths[0] == -1 ? l.prefWidth(-1) : widths[0];
             } else {
                 leftWidth = snapSize(leftMargin.getLeft() +
-                    getLeft().prefWidth(insideHeight - topHeight - bottomHeight - leftMargin.getTop() - leftMargin.getBottom()) +
+                    l.prefWidth(insideHeight - topHeight - bottomHeight - leftMargin.getTop() - leftMargin.getBottom()) +
                     leftMargin.getRight());
             }
         }
+
         double rightWidth = 0;
         Insets rightMargin = null;
-        if (getRight() != null) {
-            rightMargin = getNodeMargin(getRight());
+        if (r != null) {
+            rightMargin = getNodeMargin(r);
             if (getContentBias() == Orientation.HORIZONTAL) {
-                rightWidth = widths[2] == -1 ? getRight().prefWidth(-1) : widths[2];
+                rightWidth = widths[2] == -1 ? r.prefWidth(-1) : widths[2];
             } else {
                 rightWidth = snapSize(rightMargin.getLeft() +
-                        getRight().prefWidth(insideHeight - topHeight - bottomHeight - rightMargin.getTop() - rightMargin.getBottom()) +
+                        r.prefWidth(insideHeight - topHeight - bottomHeight - rightMargin.getTop() - rightMargin.getBottom()) +
                         rightMargin.getRight());
             }
         }
 
-        if (getTop() != null) {
-            Pos alignment = getAlignment(getTop());
+        if (t != null) {
+            Pos alignment = getAlignment(t);
             topHeight = Math.min(topHeight, insideHeight);
-            layoutInArea(getTop(), insideX, insideY, insideWidth, topHeight, 0/*ignore baseline*/,
+            layoutInArea(t, insideX, insideY, insideWidth, topHeight, 0/*ignore baseline*/,
                     topMargin,
                     alignment != null? alignment.getHpos() : HPos.LEFT,
                     alignment != null? alignment.getVpos() : VPos.TOP);
         }
-        if (getBottom() != null) {
-            Pos alignment = getAlignment(getBottom());
+
+        if (b != null) {
+            Pos alignment = getAlignment(b);
             bottomHeight = Math.min(bottomHeight, insideHeight - topHeight);
-            layoutInArea(getBottom(), insideX, insideY + insideHeight - bottomHeight,
+            layoutInArea(b, insideX, insideY + insideHeight - bottomHeight,
                     insideWidth, bottomHeight, 0/*ignore baseline*/,
                     bottomMargin,
                     alignment != null? alignment.getHpos() : HPos.LEFT,
                     alignment != null? alignment.getVpos() : VPos.BOTTOM);
         }
         
-        if (getLeft() != null) {
-            Pos alignment = getAlignment(getLeft());
+        if (l != null) {
+            Pos alignment = getAlignment(l);
             leftWidth = Math.min(leftWidth, insideWidth);
-            layoutInArea(getLeft(), insideX, insideY + topHeight,
+            layoutInArea(l, insideX, insideY + topHeight,
                     leftWidth, insideHeight - topHeight - bottomHeight, 0/*ignore baseline*/,
                     leftMargin,
                     alignment != null? alignment.getHpos() : HPos.LEFT,
                     alignment != null? alignment.getVpos() : VPos.TOP);
         }
-        if (getRight() != null) {
-            Pos alignment = getAlignment(getRight());
+
+        if (r != null) {
+            Pos alignment = getAlignment(r);
             rightWidth = Math.min(rightWidth, insideWidth - leftWidth);
-            layoutInArea(getRight(), insideX + insideWidth - rightWidth, insideY + topHeight,
+            layoutInArea(r, insideX + insideWidth - rightWidth, insideY + topHeight,
                     rightWidth, insideHeight - topHeight - bottomHeight, 0/*ignore baseline*/,
                     rightMargin,
                     alignment != null? alignment.getHpos() : HPos.RIGHT,
                     alignment != null? alignment.getVpos() : VPos.TOP);
         }
 
-        if (getCenter() != null) {
-            Pos alignment = getAlignment(getCenter());
-            layoutInArea(getCenter(), insideX + leftWidth, insideY + topHeight,
+        if (c != null) {
+            Pos alignment = getAlignment(c);
+            layoutInArea(c, insideX + leftWidth, insideY + topHeight,
                     insideWidth - leftWidth - rightWidth,
                     insideHeight - topHeight - bottomHeight, 0/*ignore baseline*/,
-                    getNodeMargin(getCenter()),
+                    getNodeMargin(c),
                     alignment != null? alignment.getHpos() : HPos.CENTER,
                     alignment != null? alignment.getVpos() : VPos.CENTER);
         }
@@ -690,12 +710,18 @@
     }
 
     private double[] adjustAreaHeight(double height, double width) {
+        final Node c = getCenter();
+        final Node r = getRight();
+        final Node b = getBottom();
+        final Node l = getLeft();
+        final Node t = getTop();
+
         double actualHeight[] = new double[5];
-        actualHeight[0] = getAreaHeight(getTop(), -1, false);
-        actualHeight[1] = getAreaHeight(getLeft(), -1, false);
-        actualHeight[2] = getAreaHeight(getCenter(), -1, false);
-        actualHeight[3] = getAreaHeight(getRight(), -1, false);
-        actualHeight[4] = getAreaHeight(getBottom(), -1, false);
+        actualHeight[0] = getAreaHeight(t, -1, false);
+        actualHeight[1] = getAreaHeight(l, -1, false);
+        actualHeight[2] = getAreaHeight(c, -1, false);
+        actualHeight[3] = getAreaHeight(r, -1, false);
+        actualHeight[4] = getAreaHeight(b, -1, false);
 
         double contentHeight = Math.max(actualHeight[1], Math.max(actualHeight[2], actualHeight[3]));
         contentHeight += (actualHeight[0] + actualHeight[4]);
@@ -704,18 +730,18 @@
         boolean shrinking = extraHeight < 0;
 
         boolean contentBias[] = new boolean[5];
-        contentBias[0] = childHasContentBias(getTop(), Orientation.VERTICAL);
-        contentBias[1] = childHasContentBias(getLeft(), Orientation.VERTICAL);
-        contentBias[2] = childHasContentBias(getCenter(), Orientation.VERTICAL);
-        contentBias[3] = childHasContentBias(getRight(), Orientation.VERTICAL);
-        contentBias[4] = childHasContentBias(getBottom(), Orientation.VERTICAL);
+        contentBias[0] = childHasContentBias(t, Orientation.VERTICAL);
+        contentBias[1] = childHasContentBias(l, Orientation.VERTICAL);
+        contentBias[2] = childHasContentBias(c, Orientation.VERTICAL);
+        contentBias[3] = childHasContentBias(r, Orientation.VERTICAL);
+        contentBias[4] = childHasContentBias(b, Orientation.VERTICAL);
 
         double areaLimitHeight[] = new double[5];
-        areaLimitHeight[0] = getAreaLimitHeight(getTop(), shrinking, width);
-        areaLimitHeight[1] = getAreaLimitHeight(getLeft(), shrinking, width);
-        areaLimitHeight[2] = getAreaLimitHeight(getCenter(), shrinking, width);
-        areaLimitHeight[3] = getAreaLimitHeight(getRight(), shrinking, width);
-        areaLimitHeight[4] = getAreaLimitHeight(getBottom(), shrinking, width);
+        areaLimitHeight[0] = getAreaLimitHeight(t, shrinking, width);
+        areaLimitHeight[1] = getAreaLimitHeight(l, shrinking, width);
+        areaLimitHeight[2] = getAreaLimitHeight(c, shrinking, width);
+        areaLimitHeight[3] = getAreaLimitHeight(r, shrinking, width);
+        areaLimitHeight[4] = getAreaLimitHeight(b, shrinking, width);
 
         double availableHeight = height;
         double h[] = {-1, -1, -1, -1, -1};
@@ -773,9 +799,42 @@
 
     /***************************************************************************
      *                                                                         *
-     *                         Stylesheet Handling                             *
+     *                         Private Inner Class                             *
      *                                                                         *
      **************************************************************************/
 
+    private final class BorderPositionProperty extends ObjectPropertyBase<Node> {
+        private Node oldValue = null;
+        private String propertyName;
 
+        BorderPositionProperty(String propertyName) {
+            this.propertyName = propertyName;
+        }
+
+        @Override
+        protected void invalidated() {
+            final List<Node> children = getChildren();
+
+            if (oldValue != null) {
+                children.remove(oldValue);
+            }
+
+            final Node _value = get();
+            this.oldValue = _value;
+
+            if (_value != null) {
+                children.add(_value);
+            }
+        }
+
+        @Override
+        public Object getBean() {
+            return BorderPane.this;
+        }
+
+        @Override
+        public String getName() {
+            return propertyName;
+        }
+    }
 }
--- a/javafx-ui-common/src/javafx/scene/layout/FlowPane.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/layout/FlowPane.java	Mon Jul 30 13:08:41 2012 -0700
@@ -497,13 +497,15 @@
     @Override protected double computeMinWidth(double height) {
         if (getContentBias() == HORIZONTAL) {
             double maxPref = 0;
-            for (int i = 0; i < getChildren().size(); i++) {
-                Node child = getChildren().get(i);
+            final List<Node> children = getChildren();
+            for (int i=0, size=children.size(); i<size; i++) {
+                Node child = children.get(i);
                 if (child.isManaged()) {
                     maxPref = Math.max(maxPref, child.prefWidth(-1));
                 }
             }
-            return getInsets().getLeft() + snapSize(maxPref) + getInsets().getRight();
+            final Insets insets = getInsets();
+            return insets.getLeft() + snapSize(maxPref) + insets.getRight();
         }
         return computePrefWidth(height);
     }
@@ -511,48 +513,52 @@
     @Override protected double computeMinHeight(double width) {
         if (getContentBias() == VERTICAL) {
             double maxPref = 0;
-            for (int i = 0; i < getChildren().size(); i++) {
-                Node child = getChildren().get(i);
+            final List<Node> children = getChildren();
+            for (int i=0, size=children.size(); i<size; i++) {
+                Node child = children.get(i);
                 if (child.isManaged()) {
                     maxPref = Math.max(maxPref, child.prefHeight(-1));
                 }
             }
-            return getInsets().getTop() + snapSize(maxPref) + getInsets().getBottom();
+            final Insets insets = getInsets();
+            return insets.getTop() + snapSize(maxPref) + insets.getBottom();
         }
         return computePrefHeight(width);
     }
 
     @Override protected double computePrefWidth(double forHeight) {
+        final Insets insets = getInsets();
         if (getOrientation() == HORIZONTAL) {
             // horizontal
             double maxRunWidth = getPrefWrapLength();
             List<Run> hruns = getRuns(maxRunWidth);            
             double w = computeContentWidth(hruns);
             w = getPrefWrapLength() > w ? getPrefWrapLength() : w;            
-            return getInsets().getLeft() + snapSize(w) + getInsets().getRight();
+            return insets.getLeft() + snapSize(w) + insets.getRight();
         } else {
             // vertical
             double maxRunHeight = forHeight != -1?
-                forHeight - getInsets().getTop() - getInsets().getBottom() : getPrefWrapLength();
+                forHeight - insets.getTop() - insets.getBottom() : getPrefWrapLength();
             List<Run> vruns = getRuns(maxRunHeight);
-            return getInsets().getLeft() + computeContentWidth(vruns) + getInsets().getRight();
+            return insets.getLeft() + computeContentWidth(vruns) + insets.getRight();
         }
     }
 
     @Override protected double computePrefHeight(double forWidth) {
+        final Insets insets = getInsets();
         if (getOrientation() == HORIZONTAL) {
             // horizontal
             double maxRunWidth = forWidth != -1?
-                forWidth - getInsets().getLeft() - getInsets().getRight() : getPrefWrapLength();
+                forWidth - insets.getLeft() - insets.getRight() : getPrefWrapLength();
             List<Run> hruns = getRuns(maxRunWidth);
-            return getInsets().getTop() + computeContentHeight(hruns) + getInsets().getBottom();
+            return insets.getTop() + computeContentHeight(hruns) + insets.getBottom();
         } else {
             // vertical
             double maxRunHeight = getPrefWrapLength();
             List<Run> vruns = getRuns(maxRunHeight);
             double h = computeContentHeight(vruns);
             h = getPrefWrapLength() > h ? getPrefWrapLength() : h;            
-            return getInsets().getTop() + snapSize(h) + getInsets().getBottom();
+            return insets.getTop() + snapSize(h) + insets.getBottom();
         }
     }
 
@@ -578,8 +584,9 @@
             double vgap = snapSpace(this.getVgap());
             double hgap = snapSpace(this.getHgap());
 
-            for (int i = 0; i < getChildren().size(); i++) {
-                Node child = getChildren().get(i);
+            final List<Node> children = getChildren();
+            for (int i=0, size=children.size(); i<size; i++) {
+                Node child = children.get(i);
                 if (child.isManaged()) {
                     LayoutRect nodeRect = new LayoutRect();
                     nodeRect.node = child;
@@ -628,7 +635,7 @@
             ArrayList<Node> rownodes = new ArrayList();
             run.width = (run.rects.size()-1)*snapSpace(getHgap());
             Insets margins[] = new Insets[run.rects.size()];
-            for (int i = 0; i < run.rects.size(); i++) {
+            for (int i=0, max=run.rects.size(); i<max; i++) {
                 LayoutRect lrect = run.rects.get(i);
                 margins[i] = getMargin(lrect.node);
                 rownodes.add(lrect.node);
@@ -642,7 +649,7 @@
             // vertical
             run.height = (run.rects.size()-1)*snapSpace(getVgap());
             double maxw = 0;
-            for (int i = 0; i < run.rects.size(); i++) {
+            for (int i=0, max=run.rects.size(); i<max; i++) {
                 LayoutRect lrect = run.rects.get(i);
                 run.height += lrect.height;
                 lrect.x = runOffset;
@@ -651,13 +658,12 @@
 
             run.width = maxw;
             run.baselineOffset = run.height;
-
         }
     }
 
     private double computeContentWidth(List<Run> runs) {
         double cwidth = getOrientation() == HORIZONTAL ? 0 : (runs.size()-1)*snapSpace(getHgap());
-        for (int i = 0; i < runs.size(); i++) {
+        for (int i=0, max=runs.size(); i<max; i++) {
             Run run = runs.get(i);
             if (getOrientation() == HORIZONTAL) {
                 cwidth = Math.max(cwidth, run.width);
@@ -671,7 +677,7 @@
 
     private double computeContentHeight(List<Run> runs) {
         double cheight = getOrientation() == VERTICAL ? 0 : (runs.size()-1)*snapSpace(getVgap());
-        for (int i = 0; i < runs.size(); i++) {
+        for (int i=0, max=runs.size(); i<max; i++) {
             Run run = runs.get(i);
             if (getOrientation() == VERTICAL) {
                 cheight = Math.max(cheight, run.height);
@@ -684,27 +690,26 @@
     }
 
     @Override protected void layoutChildren() {
-        double width = getWidth();
-        double height = getHeight();
-        double top = getInsets().getTop();
-        double left = getInsets().getLeft();
-        double bottom = getInsets().getBottom();
-        double right = getInsets().getRight();
-        double vgap = snapSpace(getVgap());
-        double hgap = snapSpace(getHgap());
-        double insideWidth = width - left - right;
-        double insideHeight = height - top - bottom;
+        final Insets insets = getInsets();
+        final double width = getWidth();
+        final double height = getHeight();
+        final double top = insets.getTop();
+        final double left = insets.getLeft();
+        final double bottom = insets.getBottom();
+        final double right = insets.getRight();
+        final double insideWidth = width - left - right;
+        final double insideHeight = height - top - bottom;
 
         //REMIND(aim): need to figure out how to cache the runs to avoid over-calculation
-        List<Run> runs = getRuns(getOrientation() == HORIZONTAL ? insideWidth : insideHeight);
+        final List<Run> runs = getRuns(getOrientation() == HORIZONTAL ? insideWidth : insideHeight);
 
         // Now that the nodes are broken into runs, figure out alignments
-        for (int i = 0; i < runs.size(); i++) {
-            Run run = runs.get(i);
-            double xoffset = left + computeXOffset(insideWidth,
+        for (int i=0, max=runs.size(); i<max; i++) {
+            final Run run = runs.get(i);
+            final double xoffset = left + computeXOffset(insideWidth,
                                      getOrientation() == HORIZONTAL ? run.width : computeContentWidth(runs),
                                      getAlignment().getHpos());
-            double yoffset = top + computeYOffset(insideHeight,
+            final double yoffset = top + computeYOffset(insideHeight,
                                     getOrientation() == VERTICAL ? run.height : computeContentHeight(runs),
                                     getAlignment().getVpos());
             for (int j = 0; j < run.rects.size(); j++) {
--- a/javafx-ui-common/src/javafx/scene/layout/HBox.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/layout/HBox.java	Mon Jul 30 13:08:41 2012 -0700
@@ -339,8 +339,9 @@
      * @return null unless one of its children has a content bias.
      */
     @Override public Orientation getContentBias() {
-        for (int i = 0; i < getChildren().size(); i++) {
-            Node child = getChildren().get(i);
+        final List<Node> children = getChildren();
+        for (int i=0, size=children.size(); i<size; i++) {
+            Node child = children.get(i);
             if (child.isManaged() && child.getContentBias() != null) {
                 return child.getContentBias();
             }
@@ -427,7 +428,6 @@
         Insets insets = getInsets();
         double top = snapSpace(insets.getTop());
         double bottom = snapSpace(insets.getBottom());
-        double space = snapSpace(getSpacing());
 
         double contentWidth = computeContentWidth(areaWidths);
         double extraWidth = (width == -1? prefWidth(-1) : width) -
--- a/javafx-ui-common/src/javafx/scene/layout/Region.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-common/src/javafx/scene/layout/Region.java	Mon Jul 30 13:08:41 2012 -0700
@@ -70,6 +70,7 @@
 import com.sun.javafx.sg.Repeat;
 import com.sun.javafx.tk.Toolkit;
 import javafx.beans.property.*;
+import javafx.scene.image.Image;
 
 /**
  * A Region is an area of the screen that can contain other nodes and be styled
@@ -133,21 +134,21 @@
         return Math.min(Math.max(value, min), Math.max(min,max));
     }
 
-    static double snapSpace(double value, boolean snapToPixel) {
+    public static double snapSpace(double value, boolean snapToPixel) {
          return snapToPixel? Math.round(value) : value;
     }
 
-    static double snapSize(double value, boolean snapToPixel) {
+    public static double snapSize(double value, boolean snapToPixel) {
         return snapToPixel? Math.ceil(value) : value;
     }
 
-    static double snapPosition(double value, boolean snapToPixel) {
+    public static double snapPosition(double value, boolean snapToPixel) {
         return snapToPixel? Math.round(value) : value;
     }
 
     static double getMaxAreaBaselineOffset(List<Node> content, Insets margins[]) {
         double max = 0;
-        for (int i = 0; i < content.size(); i++) {
+        for (int i = 0, maxPos = content.size(); i < maxPos; i++) {
             Node node = content.get(i);
             Insets margin = margins[i] != null? margins[i] : Insets.EMPTY;
             max = Math.max(max, (margin != null? margin.getTop() : 0)  + node.getBaselineOffset());
@@ -157,7 +158,7 @@
 
     static double getMaxBaselineOffset(List<Node> content) {
         double max = 0;
-        for (int i = 0; i < content.size(); i++) {
+        for (int i = 0, maxPos = content.size(); i < maxPos; i++) {
             Node node = content.get(i);
             max = Math.max(max, node.getBaselineOffset());
         }
@@ -191,7 +192,7 @@
     static double max(List<Double> seq) {
         double max = 0;
         if (seq != null) {
-            for (int i = 0; i < seq.size(); i++) {
+            for (int i = 0, maxPos = seq.size(); i < maxPos; i++) {
                 double value = seq.get(i);
                 max = Math.max(max, value);
             }
@@ -208,13 +209,15 @@
     }
 
     /* END static convenience methods */
-
+    
+    
+    
     /***************************************************************************
      *                                                                         *
-     * Region properties                                                    *
+     * Constructors                                                            *
      *                                                                         *
      **************************************************************************/
-
+    
     /**
      * Creates a Region layout.
      */
@@ -222,6 +225,14 @@
         super();
         setPickOnBounds(true);
     }
+    
+    
+
+    /***************************************************************************
+     *                                                                         *
+     * Region properties                                                       *
+     *                                                                         *
+     **************************************************************************/
 
     /**
      * Defines whether this region rounds position/spacing and ceils size
@@ -230,23 +241,19 @@
     public final BooleanProperty snapToPixelProperty() {
         if (snapToPixel == null) {
             snapToPixel = new StyleableBooleanProperty(true) {
-                @Override
-                public void invalidated() {
+                @Override public void invalidated() {
                     requestLayout();
                 }
                     
-                @Override
-                public StyleableProperty getStyleableProperty() {   
+                @Override public StyleableProperty getStyleableProperty() {   
                     return StyleableProperties.SNAP_TO_PIXEL;
                 }
 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "snapToPixel";
                 }
             };
@@ -257,7 +264,7 @@
     private BooleanProperty snapToPixel;
     public final void setSnapToPixel(boolean value) { snapToPixelProperty().set(value); }
     public final boolean isSnapToPixel() { return snapToPixel == null ? true : snapToPixel.get(); }
-
+    
     /**
      * The top,right,bottom,left padding around the region's content.
      * This space will be included in the calculation of the region's
@@ -269,8 +276,7 @@
             padding = new StyleableObjectProperty<Insets>(Insets.EMPTY) {
                 private Insets lastValidValue = Insets.EMPTY;
 
-                @Override
-                public void invalidated() {
+                @Override public void invalidated() {
                     final Insets newValue = get();
                     if (newValue == null) {
                         // rollback
@@ -285,18 +291,15 @@
                     requestLayout();
                 }
                 
-                @Override
-                public StyleableProperty getStyleableProperty() {
+                @Override public StyleableProperty getStyleableProperty() {
                     return StyleableProperties.PADDING;
                 }
 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "padding";
                 }
             };
@@ -348,24 +351,26 @@
                 final List<BorderImage> image_borders = getImageBorders();
                 if (image_borders != null) {
                     for (int i = 0; i < image_borders.size(); i++) {
-                        Insets offsets = image_borders.get(i).getOffsets();
+                        BorderImage borderImage = image_borders.get(i);
+                        Insets offsets = borderImage.getOffsets();
                         // stoked borders assume centered strokes for now
-                        left = Math.max(left, offsets.getLeft() + image_borders.get(i).getLeftWidth());
-                        top = Math.max(top, offsets.getTop() + (image_borders.get(i).getTopWidth()));
-                        right = Math.max(right, offsets.getRight() + (image_borders.get(i).getRightWidth()));
-                        bottom = Math.max(bottom, offsets.getBottom() + (image_borders.get(i).getBottomWidth()));
+                        left = Math.max(left, offsets.getLeft() + borderImage.getLeftWidth());
+                        top = Math.max(top, offsets.getTop() + (borderImage.getTopWidth()));
+                        right = Math.max(right, offsets.getRight() + (borderImage.getRightWidth()));
+                        bottom = Math.max(bottom, offsets.getBottom() + (borderImage.getBottomWidth()));
                     }
                 }
                 
                 final List<StrokeBorder> stroke_borders = getStrokeBorders();
                 if (stroke_borders != null) {
                     for (int i = 0; i < stroke_borders.size(); i++) {
-                        Insets offsets = stroke_borders.get(i).getOffsets();
+                        StrokeBorder strokeBorder = stroke_borders.get(i);
+                        Insets offsets = strokeBorder.getOffsets();
                         // stoked borders assume centered strokes for now
-                        left = Math.max(left, offsets.getLeft() + (stroke_borders.get(i).getLeftWidth()));
-                        top = Math.max(top, offsets.getTop() + (stroke_borders.get(i).getTopWidth()));
-                        right = Math.max(right, offsets.getRight() + (stroke_borders.get(i).getRightWidth()));
-                        bottom = Math.max(bottom, offsets.getBottom() + (stroke_borders.get(i).getBottomWidth()));
+                        left = Math.max(left, offsets.getLeft() + (strokeBorder.getLeftWidth()));
+                        top = Math.max(top, offsets.getTop() + (strokeBorder.getTopWidth()));
+                        right = Math.max(right, offsets.getRight() + (strokeBorder.getRightWidth()));
+                        bottom = Math.max(bottom, offsets.getBottom() + (strokeBorder.getBottomWidth()));
                     }
                 }
                 Insets padding = getPadding();
@@ -382,23 +387,19 @@
             return get();
         }
 
-        @Override
-        public void addListener(InvalidationListener listener) {
+        @Override public void addListener(InvalidationListener listener) {
             helper = ExpressionHelper.addListener(helper, this, listener);
         }
 
-        @Override
-        public void removeListener(InvalidationListener listener) {
+        @Override public void removeListener(InvalidationListener listener) {
             helper = ExpressionHelper.removeListener(helper, listener);
         }
 
-        @Override
-        public void addListener(ChangeListener<? super Insets> listener) {
+        @Override public void addListener(ChangeListener<? super Insets> listener) {
             helper = ExpressionHelper.addListener(helper, this, listener);
         }
 
-        @Override
-        public void removeListener(ChangeListener<? super Insets> listener) {
+        @Override public void removeListener(ChangeListener<? super Insets> listener) {
             helper = ExpressionHelper.removeListener(helper, listener);
         }
     };
@@ -417,21 +418,19 @@
     private ReadOnlyDoubleWrapper widthPropertyImpl() {
         if (width == null) {
             width = new ReadOnlyDoubleWrapper(0.0) {
-                @Override
-                protected void invalidated() {
+                @Override protected void invalidated() {
+                    boundingBox = null;
                     impl_layoutBoundsChanged();
                     impl_geomChanged();
                     impl_markDirty(DirtyBits.NODE_GEOMETRY);
                     requestLayout();
                 }
 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "width";
                 }
             };
@@ -456,21 +455,19 @@
     private ReadOnlyDoubleWrapper heightPropertyImpl() {
         if (height == null) {
             height = new ReadOnlyDoubleWrapper(0.0) {
-                @Override
-                protected void invalidated() {
+                @Override protected void invalidated() {
+                    boundingBox = null;
                     impl_layoutBoundsChanged();
                     impl_geomChanged();
                     impl_markDirty(DirtyBits.NODE_GEOMETRY);
                     requestLayout();
                 }
 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "height";
                 }
             };
@@ -498,20 +495,18 @@
     public final DoubleProperty minWidthProperty() {
         if (minWidth == null) {
             minWidth = new DoublePropertyBase(USE_COMPUTED_SIZE) {
-                @Override
-                public void invalidated() {
-                    if (getParent() != null) {
-                        getParent().requestLayout();
+                @Override public void invalidated() {
+                    Parent parent = getParent();
+                    if (parent != null) {
+                        parent.requestLayout();
                     }
                 }
 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "minWidth";
                 }
             };
@@ -540,20 +535,18 @@
     public final DoubleProperty minHeightProperty() {
         if (minHeight == null) {
             minHeight = new DoublePropertyBase(USE_COMPUTED_SIZE) {
-                @Override
-                public void invalidated() {
-                    if (getParent() != null) {
-                        getParent().requestLayout();
+                @Override public void invalidated() {
+                    Parent parent = getParent();
+                    if (parent != null) {
+                        parent.requestLayout();
                     }
                 }
 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "minHeight";
                 }
             };
@@ -592,20 +585,18 @@
     public final DoubleProperty prefWidthProperty() {
         if (prefWidth == null) {
             prefWidth = new DoublePropertyBase(USE_COMPUTED_SIZE) {
-                @Override
-                public void invalidated() {
-                    if (getParent() != null) {
-                        getParent().requestLayout();
+                @Override public void invalidated() {
+                    Parent parent = getParent();
+                    if (parent != null) {
+                        parent.requestLayout();
                     }
                 }
 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "prefWidth";
                 }
             };
@@ -630,20 +621,18 @@
     public final DoubleProperty prefHeightProperty() {
         if (prefHeight == null) {
             prefHeight = new DoublePropertyBase(USE_COMPUTED_SIZE) {
-                @Override
-                public void invalidated() {
-                    if (getParent() != null) {
-                        getParent().requestLayout();
+                @Override public void invalidated() {
+                    Parent parent = getParent();
+                    if (parent != null) {
+                        parent.requestLayout();
                     }
                 }
 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "prefHeight";
                 }
             };
@@ -686,20 +675,18 @@
     public final DoubleProperty maxWidthProperty() {
         if (maxWidth == null) {
             maxWidth = new DoublePropertyBase(USE_COMPUTED_SIZE) {
-                @Override
-                public void invalidated() {
-                    if (getParent() != null) {
-                        getParent().requestLayout();
+                @Override public void invalidated() {
+                    Parent parent = getParent();
+                    if (parent != null) {
+                        parent.requestLayout();
                     }
                 }
 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "maxWidth";
                 }
             };
@@ -728,20 +715,18 @@
     public final DoubleProperty maxHeightProperty() {
         if (maxHeight == null) {
             maxHeight = new DoublePropertyBase(USE_COMPUTED_SIZE) {
-                @Override
-                public void invalidated() {
-                    if (getParent() != null) {
-                        getParent().requestLayout();
+                @Override public void invalidated() {
+                    Parent parent = getParent();
+                    if (parent != null) {
+                        parent.requestLayout();
                     }
                 }
 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "maxHeight";
                 }
             };
@@ -784,23 +769,17 @@
     private ObjectProperty<Shape> shapeProperty() {
         if (shape == null) {
             shape = new ObjectPropertyBase<Shape>() {
-
-                @Override
-                protected void invalidated() {
-                    
+                @Override protected void invalidated() {
                     impl_geomChanged();
                     requestLayout();
                     impl_markDirty(DirtyBits.REGION_SHAPE);
-                    
                 }
 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "shape";
                 }
 
@@ -814,48 +793,35 @@
     private StringProperty shapeContentProperty() {
         if (shapeContent == null) {
             shapeContent = new StyleableStringProperty() {
-
-                @Override
-                protected void invalidated() {
-
+                @Override protected void invalidated() {
                     final String newContent = get();
                     if (newContent != null && !newContent.isEmpty()) {
-                        
                         final Shape shape = getShape();
                         if (shape instanceof SVGPath) {
-                            
                             final SVGPath svgPath = (SVGPath)shape;
                             if (!newContent.equals(svgPath.getContent())) {
                                 svgPath.setContent(newContent);
                             }
-                            
                         } else {
-                            
                             final SVGPath svgPath = new SVGPath();
                             svgPath.setContent(newContent);
 //                            shapeProperty().set(svgPath);
                             impl_setShape(svgPath);
-                            
                         }
-                        
                     } else {
                         shapeProperty().set(null);
                     }                    
-
                 }
                 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "shapeContent";
                 }
 
-                @Override
-                public StyleableProperty getStyleableProperty() {
+                @Override public StyleableProperty getStyleableProperty() {
                     return StyleableProperties.SHAPE;
                 }
                 
@@ -871,7 +837,6 @@
      */
     @Deprecated
     public void impl_setShape(Shape value) {
-        
         final Shape thisShape = impl_getShape();
         if (thisShape != null && !thisShape.equals(value)) {
             thisShape.impl_setShapeChangeListener(null);
@@ -886,9 +851,7 @@
     private ShapeChangeListener getShapeChangeListener() {
         if (shapeChangeListener == null) {
             shapeChangeListener = new ShapeChangeListener() {
-
-                @Override
-                public void changed() {
+                @Override public void changed() {
                     impl_geomChanged();
                     requestLayout();
                     impl_markDirty(DirtyBits.REGION_SHAPE);
@@ -924,28 +887,22 @@
     private BooleanProperty scaleShapeProperty() {
         if (scaleShape == null) {
             scaleShape = new StyleableBooleanProperty(true) {
-
-                @Override 
-                public void invalidated() {
+                @Override public void invalidated() {
                     requestLayout();
                     impl_markDirty(DirtyBits.REGION_SHAPE);                    
                 }
                 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "scaleShape";
                 }
 
-                @Override
-                public StyleableProperty getStyleableProperty() {
+                @Override public StyleableProperty getStyleableProperty() {
                     return StyleableProperties.SCALE_SHAPE;
                 }
-                
             };
         }
         return scaleShape;
@@ -986,28 +943,22 @@
     private BooleanProperty positionShapeProperty() {
         if (positionShape == null) {
             positionShape = new StyleableBooleanProperty(true) {
-
-                @Override 
-                public void invalidated() {
+                @Override public void invalidated() {
                     requestLayout();
                     impl_markDirty(DirtyBits.REGION_SHAPE);                    
                 }
                 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "positionShape";
                 }
 
-                @Override
-                public StyleableProperty getStyleableProperty() {
+                @Override public StyleableProperty getStyleableProperty() {
                     return StyleableProperties.SCALE_SHAPE;
                 }
-                
             };
         }
         return positionShape;
@@ -1046,36 +997,29 @@
     private ObjectProperty<List<BackgroundFill>> backgroundFillsProperty() {
         if (backgroundFills == null) {
             backgroundFills = new StyleableObjectProperty<List<BackgroundFill>>() {
-
-                @Override 
-                public void invalidated() {
+                @Override public void invalidated() {
                     impl_geomChanged();
                     impl_markDirty(DirtyBits.SHAPE_FILL);                    
                 }
                 
-                @Override 
-                public void set(List<BackgroundFill> newValue) {
+                @Override public void set(List<BackgroundFill> newValue) {
                     final List<BackgroundFill> oldValue = get();                        
                     if (oldValue == null ? newValue != null :  !oldValue.equals(newValue)) {
                         super.set(newValue);
                     }
                 }
                 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "backgroundFills";
                 }
 
-                @Override
-                public StyleableProperty getStyleableProperty() {
+                @Override public StyleableProperty getStyleableProperty() {
                     return StyleableProperties.BACKGROUND_FILLS;
                 }
-                
             };
         }
         return backgroundFills;
@@ -1083,7 +1027,6 @@
     
     private List<BackgroundFill> getBackgroundFills() {
         return backgroundFills == null ? null : backgroundFills.get(); 
-
     }
     
     /**
@@ -1123,36 +1066,29 @@
     private ObjectProperty<List<BackgroundImage>> backgroundImagesProperty() {
         if (backgroundImages == null) {
             backgroundImages = new StyleableObjectProperty<List<BackgroundImage>>() {
-
-                @Override 
-                public void invalidated() {
+                @Override public void invalidated() {
                     impl_geomChanged();
                     impl_markDirty(DirtyBits.NODE_CONTENTS);                    
                 }
 
-                @Override 
-                public void set(List<BackgroundImage> newValue) {
+                @Override public void set(List<BackgroundImage> newValue) {
                     final List<BackgroundImage> oldValue = get();                        
                     if (oldValue == null ? newValue != null :  !oldValue.equals(newValue)) {
                         super.set(newValue);
                     }
                 }
                 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "backgroundImages";
                 }
 
-                @Override
-                public StyleableProperty getStyleableProperty() {
+                @Override public StyleableProperty getStyleableProperty() {
                     return StyleableProperties.BACKGROUND_IMAGES;
                 }
-                
             };
         }
         return backgroundImages;
@@ -1160,13 +1096,10 @@
     
     private List<BackgroundImage> getBackgroundImages() {
         return backgroundImages == null ?  null : backgroundImages.get();
-        
     }
     
     private void setBackgroundImages(List<BackgroundImage> value) {
-        
         final List<BackgroundImage> background_images =  getBackgroundImages();
-        
         if (background_images == null ? value == null : !background_images.equals(value)) {
             this.backgroundImagesProperty().set(value);
         }
@@ -1178,37 +1111,30 @@
     private ObjectProperty<List<StrokeBorder>> strokeBordersProperty() {
         if (strokeBorders == null) {
             strokeBorders = new StyleableObjectProperty<List<StrokeBorder>>() {
-
-                @Override 
-                public void invalidated() {
+                @Override public void invalidated() {
                     insets.fireValueChanged();
                     impl_geomChanged();
                     impl_markDirty(DirtyBits.SHAPE_STROKE);                    
                 }
 
-                @Override 
-                public void set(List<StrokeBorder> newValue) {
+                @Override public void set(List<StrokeBorder> newValue) {
                     final List<StrokeBorder> oldValue = get();                        
                     if (oldValue == null ? newValue != null :  !oldValue.equals(newValue)) {
                         super.set(newValue);
                     }
                 }
                 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "strokeBorders";
                 }
 
-                @Override
-                public StyleableProperty getStyleableProperty() {
+                @Override public StyleableProperty getStyleableProperty() {
                     return StyleableProperties.STROKE_BORDERS;
                 }
-                
             };
         }
         return strokeBorders;
@@ -1219,9 +1145,7 @@
     }
     
     private void setStrokeBorders(List<StrokeBorder> value) {
-
         final List<StrokeBorder> stroke_borders = getStrokeBorders();
-        
         if ((stroke_borders == null) ? (value != null) : !stroke_borders.equals(value)) { 
             this.strokeBordersProperty().set(value);
         }
@@ -1234,37 +1158,30 @@
     private ObjectProperty<List<BorderImage>> imageBordersProperty() {
         if (imageBorders == null) {
             imageBorders = new StyleableObjectProperty<List<BorderImage>>() {
-
-                @Override 
-                public void invalidated() {
+                @Override public void invalidated() {
                     insets.fireValueChanged();
                     impl_geomChanged();
                     impl_markDirty(DirtyBits.SHAPE_STROKE);                    
                 }
 
-                @Override 
-                public void set(List<BorderImage> newValue) {
+                @Override public void set(List<BorderImage> newValue) {
                     final List<BorderImage> oldValue = get();                        
                     if (oldValue == null ? newValue != null : !oldValue.equals(newValue)) {
                         super.set(newValue);
                     }
                 }
                 
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return Region.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "imageBorders";
                 }
 
-                @Override
-                public StyleableProperty getStyleableProperty() {
+                @Override public StyleableProperty getStyleableProperty() {
                     return StyleableProperties.IMAGE_BORDERS;
                 }
-                
             };
         }
         return imageBorders;
@@ -1275,14 +1192,14 @@
     }
     
     private void setImageBorders(List<BorderImage> value) {
-        
         final List<BorderImage> image_borders = getImageBorders();
-        
         if (image_borders == null ? value == null :  !image_borders.equals(value)) {
             this.imageBordersProperty().set(value);
         }
     }
     
+    
+    
     /***************************************************************************
      *                                                                         *
      * Layout                                                                  *
@@ -1403,7 +1320,7 @@
         return override;
     }
 
-   /**
+    /**
      * Called during layout to determine the maximum height for this node.
      * Returns the value from <code>computeMaxHeight(forWidth)</code> unless
      * the application overrode the maximum height by setting the maxHeight property.
@@ -1431,7 +1348,7 @@
      *
      * @return the computed minimum width of this region
      */
-    protected double computeMinWidth(double height) {
+    @Override protected double computeMinWidth(double height) {
         return getInsets().getLeft() + getInsets().getRight();
     }
 
@@ -1445,7 +1362,7 @@
      *
      * @return the computed minimum height for this region
      */
-    protected double computeMinHeight(double width) {
+    @Override protected double computeMinHeight(double width) {
         return getInsets().getTop() + getInsets().getBottom();
     }
 
@@ -1702,7 +1619,7 @@
         if (valignment == VPos.BASELINE) {
             double maxAbove = 0;
             double maxBelow = 0;
-            for (int i = 0; i < children.size(); i++) {
+            for (int i = 0, maxPos = children.size(); i < maxPos; i++) {
                 Node child = children.get(i);
                 double baseline = child.getBaselineOffset();
                 double top = childMargins[i] != null? snapSpace(childMargins[i].getTop()) : 0;
@@ -1713,10 +1630,9 @@
                         baseline + bottom);
             }
             return maxAbove + maxBelow; //remind(aim): ceil this value?
-
         } else {
             double max = 0;
-            for (int i = 0; i < children.size(); i++) {
+            for (int i = 0, maxPos = children.size(); i < maxPos; i++) {
                 Node child = children.get(i);
                 max = Math.max(max, minimum?
                     computeChildMinAreaHeight(child, childMargins[i], childWidths[i]) :
@@ -1729,7 +1645,7 @@
     /* utility method for computing the max of children's min or pref width, horizontal alignment is ignored for now */
     private double getMaxAreaWidth(List<Node> children, Insets childMargins[], double childHeights[], HPos halignment, boolean minimum) {
         double max = 0;
-        for (int i = 0; i < children.size(); i++) {
+        for (int i = 0, maxPos = children.size(); i < maxPos; i++) {
             Node child = children.get(i);
             max = Math.max(max, minimum?
                 computeChildMinAreaWidth(children.get(i), childMargins[i], childHeights[i]) :
@@ -1766,7 +1682,7 @@
     protected void positionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight,
                                double areaBaselineOffset, HPos halignment, VPos valignment) {
         positionInArea(child, areaX, areaY, areaWidth, areaHeight, areaBaselineOffset,
-                Insets.EMPTY, halignment, valignment);
+                Insets.EMPTY, halignment, valignment, isSnapToPixel());
     }
 
     /**
@@ -1798,14 +1714,16 @@
      * @param valignment the vertical alignment for the child within the area
      *
      */
-    protected void positionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight,
-                               double areaBaselineOffset, Insets margin, HPos halignment, VPos valignment) {
+    public static void positionInArea(Node child, double areaX, double areaY, double areaWidth, double areaHeight,
+                               double areaBaselineOffset, Insets margin, HPos halignment, VPos valignment, boolean isSnapToPixel) {
         Insets childMargin = margin != null? margin : Insets.EMPTY;
 
         position(child, areaX, areaY, areaWidth, areaHeight, areaBaselineOffset,
-                snapSpace(childMargin.getTop()), snapSpace(childMargin.getRight()),
-                snapSpace(childMargin.getBottom()), snapSpace(childMargin.getLeft()),
-                halignment, valignment);
+                snapSpace(childMargin.getTop(), isSnapToPixel), 
+                snapSpace(childMargin.getRight(), isSnapToPixel),
+                snapSpace(childMargin.getBottom(), isSnapToPixel), 
+                snapSpace(childMargin.getLeft(), isSnapToPixel),
+                halignment, valignment, isSnapToPixel);
     }
 
     /**
@@ -1971,11 +1889,20 @@
                                double areaBaselineOffset,
                                Insets margin, boolean fillWidth, boolean fillHeight,
                                HPos halignment, VPos valignment) {
+        layoutInArea(child, areaX, areaY, areaWidth, areaHeight, areaBaselineOffset, margin, fillWidth, fillHeight, halignment, valignment, isSnapToPixel());
+    }
+    
+    public static void layoutInArea(Node child, double areaX, double areaY,
+                               double areaWidth, double areaHeight,
+                               double areaBaselineOffset,
+                               Insets margin, boolean fillWidth, boolean fillHeight,
+                               HPos halignment, VPos valignment, boolean isSnapToPixel) {
+        
         Insets childMargin = margin != null? margin : Insets.EMPTY;
-        double top = snapSpace(childMargin.getTop());
-        double bottom = snapSpace(childMargin.getBottom());
-        double left = snapSpace(childMargin.getLeft());
-        double right = snapSpace(childMargin.getRight());
+        double top = snapSpace(childMargin.getTop(), isSnapToPixel);
+        double bottom = snapSpace(childMargin.getBottom(), isSnapToPixel);
+        double left = snapSpace(childMargin.getLeft(), isSnapToPixel);
+        double right = snapSpace(childMargin.getRight(), isSnapToPixel);
         if (child.isResizable()) {
             Orientation bias = child.getContentBias();
 
@@ -2009,16 +1936,16 @@
                                          Math.min(innerAreaWidth,child.prefWidth(childHeight)),
                                          child.minWidth(childHeight),child.maxWidth(childHeight));
             }
-            child.resize(snapSize(childWidth),snapSize(childHeight));
+            child.resize(snapSize(childWidth, isSnapToPixel),snapSize(childHeight, isSnapToPixel));
         }
         position(child, areaX, areaY, areaWidth, areaHeight, areaBaselineOffset,
-                top, right, bottom, left, halignment, valignment);
+                top, right, bottom, left, halignment, valignment, isSnapToPixel);
     }
 
-    private void position(Node child, double areaX, double areaY, double areaWidth, double areaHeight,
+    private static void position(Node child, double areaX, double areaY, double areaWidth, double areaHeight,
                           double areaBaselineOffset,
                           double topMargin, double rightMargin, double bottomMargin, double leftMargin,
-                          HPos hpos, VPos vpos) {
+                          HPos hpos, VPos vpos, boolean isSnapToPixel) {
         final double xoffset = leftMargin + computeXOffset(areaWidth - leftMargin - rightMargin,
                                                      child.getLayoutBounds().getWidth(), hpos);
         final double yoffset = topMargin +
@@ -2027,8 +1954,8 @@
                           computeYOffset(areaHeight - topMargin - bottomMargin,
                                          child.getLayoutBounds().getHeight(), vpos));
         // do not snap position if child is not resizable because it can cause gaps
-        final double x = child.isResizable()? snapPosition(areaX + xoffset) : areaX + xoffset;
-        final double y = child.isResizable()? snapPosition(areaY + yoffset) : areaY + yoffset;
+        final double x = child.isResizable()? snapPosition(areaX + xoffset, isSnapToPixel) : areaX + xoffset;
+        final double y = child.isResizable()? snapPosition(areaY + yoffset, isSnapToPixel) : areaY + yoffset;
 
         child.relocate(x,y);
     }
@@ -2047,6 +1974,8 @@
         if (impl_isDirty(DirtyBits.NODE_GEOMETRY)) {
             pg.setSize((float)getWidth(), (float)getHeight());
         }
+        
+        Toolkit toolkit = Toolkit.getToolkit();
 
         if (impl_isDirty(DirtyBits.SHAPE_FILL)) {
             // sync the backgrounds
@@ -2056,17 +1985,19 @@
                 final int backgroundFillCount = background_fills != null ? background_fills.size() : 0;
 
                 com.sun.javafx.sg.BackgroundFill[] b = new com.sun.javafx.sg.BackgroundFill[backgroundFillCount];
+                Insets offsets = null;
                 for (int i = 0; i < backgroundFillCount; i++) {
                     lastBf = background_fills.get(i);
+                    offsets = lastBf.getOffsets();
 
                     b[i] = new com.sun.javafx.sg.BackgroundFill(
-                        Toolkit.getToolkit().getPaint(background_fills.get(i).getFill()),
-                        (float)background_fills.get(i).getTopLeftCornerRadius(),
-                        (float)background_fills.get(i).getTopRightCornerRadius(),
-                        (float)background_fills.get(i).getBottomLeftCornerRadius(),
-                        (float)background_fills.get(i).getBottomRightCornerRadius(),
-                        (float)background_fills.get(i).getOffsets().getTop(), (float)background_fills.get(i).getOffsets().getLeft(),
-                        (float)background_fills.get(i).getOffsets().getBottom(), (float)background_fills.get(i).getOffsets().getRight()
+                        toolkit.getPaint(lastBf.getFill()),
+                        (float)lastBf.getTopLeftCornerRadius(),
+                        (float)lastBf.getTopRightCornerRadius(),
+                        (float)lastBf.getBottomLeftCornerRadius(),
+                        (float)lastBf.getBottomRightCornerRadius(),
+                        (float)offsets.getTop(), (float)offsets.getLeft(),
+                        (float)offsets.getBottom(), (float)offsets.getRight()
                     );
                 }
                 pg.setBackgroundFills(b);
@@ -2098,63 +2029,71 @@
             com.sun.javafx.sg.Border[] b2 = new com.sun.javafx.sg.Border[imageBorderCount + strokeBorderCount];
 
             for (int i = 0; i < imageBorderCount; i++) {
-
+                BorderImage borderImage = image_borders.get(i);
+                Image image = borderImage.getImage();
+                boolean proportionalWidth = borderImage.isProportionalWidth();
+                boolean proportionalSlice = borderImage.isProportionalSlice();
+                Insets offsets = borderImage.getOffsets();
+                
                 // width multiplier horizontal direction
-                double hwx = image_borders.get(i).isProportionalWidth() ? getWidth() : 1;
+                double hwx = proportionalWidth ? getWidth() : 1;
 
                 // width multiplier vertical direction
-                double vwx = image_borders.get(i).isProportionalWidth() ? getHeight() : 1;
+                double vwx = proportionalWidth ? getHeight() : 1;
 
                 // slice multiplier horizontal direction
-                double hsx = image_borders.get(i).isProportionalSlice() ? image_borders.get(i).getImage().getWidth() : 1.0f;
+                double hsx = proportionalSlice ? image.getWidth() : 1.0f;
 
                 // slice multiplier vertical direction
-                double vsx = image_borders.get(i).isProportionalSlice() ? image_borders.get(i).getImage().getHeight() : 1.0f;
+                double vsx = proportionalSlice ? image.getHeight() : 1.0f;
 
                 b2[i] = new com.sun.javafx.sg.ImageBorder(
-                    (float) (image_borders.get(i).getTopWidth()*vwx),
-                    (float) (image_borders.get(i).getLeftWidth()*hwx),
-                    (float) (image_borders.get(i).getBottomWidth()*vwx),
-                    (float) (image_borders.get(i).getRightWidth()*hwx),
-                    (float)image_borders.get(i).getOffsets().getTop(), (float)image_borders.get(i).getOffsets().getLeft(),
-                    (float)image_borders.get(i).getOffsets().getBottom(), (float)image_borders.get(i).getOffsets().getRight(),
-                    image_borders.get(i).getImage().impl_getPlatformImage(),
-                    (float) (image_borders.get(i).getTopSlice()*vsx),
-                    (float) (image_borders.get(i).getLeftSlice()*hsx),
-                    (float) (image_borders.get(i).getBottomSlice()*vsx),
-                    (float) (image_borders.get(i).getRightSlice()*hsx),
-                    com.sun.javafx.sg.Repeat.values()[image_borders.get(i).getRepeatX().ordinal()],
-                    com.sun.javafx.sg.Repeat.values()[image_borders.get(i).getRepeatY().ordinal()],
-                    image_borders.get(i).isFillCenter()
+                    (float) (borderImage.getTopWidth()*vwx),
+                    (float) (borderImage.getLeftWidth()*hwx),
+                    (float) (borderImage.getBottomWidth()*vwx),
+                    (float) (borderImage.getRightWidth()*hwx),
+                    (float) offsets.getTop(), (float) offsets.getLeft(),
+                    (float) offsets.getBottom(), (float) offsets.getRight(),
+                    image.impl_getPlatformImage(),
+                    (float) (borderImage.getTopSlice()*vsx),
+                    (float) (borderImage.getLeftSlice()*hsx),
+                    (float) (borderImage.getBottomSlice()*vsx),
+                    (float) (borderImage.getRightSlice()*hsx),
+                    com.sun.javafx.sg.Repeat.values()[borderImage.getRepeatX().ordinal()],
+                    com.sun.javafx.sg.Repeat.values()[borderImage.getRepeatY().ordinal()],
+                    borderImage.isFillCenter()
                 );
             }
             for (int i = 0; i < strokeBorderCount; i++) {
+                StrokeBorder strokeBorder = stroke_borders.get(i);
+                boolean proportionalWidth = strokeBorder.isProportionalWidth();
+                Insets offsets = strokeBorder.getOffsets();
 
                 // width multiplier horizontal direction
-                double hwx = stroke_borders.get(i).isProportionalWidth() ? getWidth() : 1;
+                double hwx = proportionalWidth ? getWidth() : 1;
 
                 // width multiplier vertical direction
-                double vwx = stroke_borders.get(i).isProportionalWidth() ? getHeight() : 1;
+                double vwx = proportionalWidth ? getHeight() : 1;
 
                 b2[i+imageBorderCount] = new com.sun.javafx.sg.StrokedBorder (
-                    (float) (stroke_borders.get(i).getTopWidth()*vwx),
-                    (float) (stroke_borders.get(i).getLeftWidth()*hwx),
-                    (float) (stroke_borders.get(i).getBottomWidth()*vwx),
-                    (float) (stroke_borders.get(i).getRightWidth()*hwx),
-                    (float) stroke_borders.get(i).getOffsets().getTop(), (float) stroke_borders.get(i).getOffsets().getLeft(),
-                    (float) stroke_borders.get(i).getOffsets().getBottom(), (float) stroke_borders.get(i).getOffsets().getRight(),
-                    (float) stroke_borders.get(i).getTopLeftCornerRadius(),
-                    (float) stroke_borders.get(i).getTopRightCornerRadius(),
-                    (float) stroke_borders.get(i).getBottomLeftCornerRadius(),
-                    (float) stroke_borders.get(i).getBottomRightCornerRadius(),
-                    Toolkit.getToolkit().getPaint(stroke_borders.get(i).getTopFill()),
-                    Toolkit.getToolkit().getPaint(stroke_borders.get(i).getLeftFill()),
-                    Toolkit.getToolkit().getPaint(stroke_borders.get(i).getBottomFill()),
-                    Toolkit.getToolkit().getPaint(stroke_borders.get(i).getRightFill()),
-                    createSgBorderStyle(stroke_borders.get(i).getTopStyle()),
-                    createSgBorderStyle(stroke_borders.get(i).getLeftStyle()),
-                    createSgBorderStyle(stroke_borders.get(i).getBottomStyle()),
-                    createSgBorderStyle(stroke_borders.get(i).getRightStyle())
+                    (float) (strokeBorder.getTopWidth()*vwx),
+                    (float) (strokeBorder.getLeftWidth()*hwx),
+                    (float) (strokeBorder.getBottomWidth()*vwx),
+                    (float) (strokeBorder.getRightWidth()*hwx),
+                    (float) offsets.getTop(), (float) offsets.getLeft(),
+                    (float) offsets.getBottom(), (float) offsets.getRight(),
+                    (float) strokeBorder.getTopLeftCornerRadius(),
+                    (float) strokeBorder.getTopRightCornerRadius(),
+                    (float) strokeBorder.getBottomLeftCornerRadius(),
+                    (float) strokeBorder.getBottomRightCornerRadius(),
+                    toolkit.getPaint(strokeBorder.getTopFill()),
+                    toolkit.getPaint(strokeBorder.getLeftFill()),
+                    toolkit.getPaint(strokeBorder.getBottomFill()),
+                    toolkit.getPaint(strokeBorder.getRightFill()),
+                    createSgBorderStyle(strokeBorder.getTopStyle()),
+                    createSgBorderStyle(strokeBorder.getLeftStyle()),
+                    createSgBorderStyle(strokeBorder.getBottomStyle()),
+                    createSgBorderStyle(strokeBorder.getRightStyle())
                 );
             }
             pg.setBorders(b2);
@@ -2242,27 +2181,29 @@
             if (theShape.contains(localX,localY)) {
                 return true;
             }
-            double shapeWidth = theShape.getLayoutBounds().getWidth();
-            double shapeHeight = theShape.getLayoutBounds().getHeight();
+            Bounds layoutBounds = theShape.getLayoutBounds();
+            double shapeWidth = layoutBounds.getWidth();
+            double shapeHeight = layoutBounds.getHeight();
             if (positionShape != null && positionShape.get()) {
                 bx0 = (getWidth() - shapeWidth)/2;
                 by0 = (getHeight() - shapeHeight)/2;
                 bx1 = bx0+shapeWidth;
                 by1 = by0+shapeHeight;
             } else {
-                bx0 = theShape.getLayoutBounds().getMinX();
-                by0 = theShape.getLayoutBounds().getMinY();
-                bx1 = theShape.getLayoutBounds().getMaxX();
-                by1 = theShape.getLayoutBounds().getMaxY();
+                bx0 = layoutBounds.getMinX();
+                by0 = layoutBounds.getMinY();
+                bx1 = layoutBounds.getMaxX();
+                by1 = layoutBounds.getMaxY();
             }
         }
         
         final List<BackgroundFill> background_fills = getBackgroundFills();
         if (background_fills != null) {
             for (int i = 0; i < background_fills.size(); i++) {
-                Insets offsets = background_fills.get(i).getOffsets();
+                BackgroundFill bgFill = background_fills.get(i);
+                Insets offsets = bgFill.getOffsets();
 
-                if (background_fills.get(i).getFill() != null) {
+                if (bgFill.getFill() != null) {
                     double rrx0 = bx0 + offsets.getLeft();
                     double rry0 = by0 + offsets.getTop();
                     double rrx1 = bx1 - offsets.getRight();
@@ -2270,10 +2211,10 @@
 
                     // Check for trivial rejection - point is inside bounding rectangle
                     if (localX >= rrx0 && localY >= rry0 && localX < rrx1 && localY < rry1) {
-                        double tlr = background_fills.get(i).getTopLeftCornerRadius() / 2f;
-                        double trr = background_fills.get(i).getTopRightCornerRadius() / 2f;
-                        double blr = background_fills.get(i).getBottomLeftCornerRadius() / 2f;
-                        double brr = background_fills.get(i).getBottomRightCornerRadius() / 2f;
+                        double tlr = bgFill.getTopLeftCornerRadius() / 2f;
+                        double trr = bgFill.getTopRightCornerRadius() / 2f;
+                        double blr = bgFill.getBottomLeftCornerRadius() / 2f;
+                        double brr = bgFill.getBottomRightCornerRadius() / 2f;
 
                         // need to check if pt is outside rounded corners
                         double x = 1.0;
@@ -2318,11 +2259,12 @@
 
         final List<BackgroundImage> background_images = getBackgroundImages();
         if (background_images != null) {
-            for (int i = 0; i < background_images.size(); i++) {
-                if (localX >= (bx0 + background_images.get(i).getLeft()) &&
-                    localX <= (bx1 - background_images.get(i).getRight()) &&
-                    localY >= (by0 + background_images.get(i).getTop()) &&
-                    localY <= (by1 - background_images.get(i).getBottom())) {
+            for (int i = 0, max = background_images.size(); i < max; i++) {
+                BackgroundImage backgroundImage = background_images.get(i);
+                if (localX >= (bx0 + backgroundImage.getLeft()) &&
+                    localX <= (bx1 - backgroundImage.getRight()) &&
+                    localY >= (by0 + backgroundImage.getTop()) &&
+                    localY <= (by1 - backgroundImage.getBottom())) {
                     return true;
                 }
             }
@@ -2330,13 +2272,14 @@
         
         final List<BorderImage> image_borders = getImageBorders();
         if (image_borders != null) {
-            for (int i = 0; i < image_borders.size(); i++) {
-                Insets offsets = image_borders.get(i).getOffsets();
+            for (int i = 0, max = image_borders.size(); i < max; i++) {
+                BorderImage borderImage = image_borders.get(i);
+                Insets offsets = borderImage.getOffsets();
                 if (borderContains(localX, localY,
                         bx0 + offsets.getLeft(), by0 + offsets.getTop(),
                         bx1 - offsets.getRight(), by1 - offsets.getBottom(),
-                        image_borders.get(i).getTopWidth(), image_borders.get(i).getRightWidth(),
-                        image_borders.get(i).getBottomWidth(), image_borders.get(i).getLeftWidth())) {
+                        borderImage.getTopWidth(), borderImage.getRightWidth(),
+                        borderImage.getBottomWidth(), borderImage.getLeftWidth())) {
                      return true;
                 }
             }
@@ -2344,13 +2287,14 @@
         
         final List<StrokeBorder> stroke_borders = getStrokeBorders();
         if (stroke_borders != null) {
-            for (int i = 0; i < stroke_borders.size(); i++) {
-                Insets offsets = stroke_borders.get(i).getOffsets();
+            for (int i = 0, max = stroke_borders.size(); i < max; i++) {
+                StrokeBorder strokeBorder = stroke_borders.get(i);
+                Insets offsets = strokeBorder.getOffsets();
                 if (borderContains(localX, localY,
                         bx0 + offsets.getLeft(), by0 + offsets.getTop(),
                         bx1 - offsets.getRight(), by1 - offsets.getBottom(),
-                        stroke_borders.get(i).getTopWidth(), stroke_borders.get(i).getRightWidth(),
-                        stroke_borders.get(i).getBottomWidth(), stroke_borders.get(i).getLeftWidth())) {
+                        strokeBorder.getTopWidth(), strokeBorder.getRightWidth(),
+                        strokeBorder.getBottomWidth(), strokeBorder.getLeftWidth())) {
                      return true;
                 }
             }
@@ -2377,7 +2321,7 @@
     @Override protected Node impl_pickNodeLocal(double localX, double localY) {
         if (containsBounds(localX, localY)) {
             ObservableList<Node> children = getChildren();
-            for (int i = children.size()-1; i >= 0; i--) {
+            for (int i = children.size() - 1; i >= 0; i--) {
                 Node picked = children.get(i).impl_pickNode(localX, localY);
                 if (picked != null) {
                     return picked;
@@ -2397,11 +2341,10 @@
      */
     @Deprecated
     @Override protected Node impl_pickNodeLocal(PickRay pickRay) {
-
         if (impl_intersects(pickRay)) {
             ObservableList<Node> children = getChildren();
 
-            for (int i = children.size()-1; i >= 0; i--) {
+            for (int i = children.size() - 1; i >= 0; i--) {
                 Node picked = children.get(i).impl_pickNode(pickRay);
 
                 if (picked != null) {
@@ -2415,6 +2358,8 @@
         return null;
     }
 
+    private Bounds boundingBox;
+    
     /**
      * The layout bounds of this region: {@code 0, 0  width x height}
      *
@@ -2422,8 +2367,12 @@
      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
      */
     @Deprecated
-    @Override protected Bounds impl_computeLayoutBounds() {
-        return new BoundingBox(0, 0, 0, getWidth(), getHeight(), 0);
+    @Override protected final Bounds impl_computeLayoutBounds() {
+        if (boundingBox == null) {
+            // we reuse the bounding box if the width and height haven't changed.
+            boundingBox = new BoundingBox(0, 0, 0, getWidth(), getHeight(), 0);
+        }
+        return boundingBox;
     }
 
     /**
@@ -2432,7 +2381,9 @@
      */
     @Deprecated
     @Override final protected void impl_notifyLayoutBoundsChanged() {
-        // change in geometric bounds does not necessarily change layoutBounds
+        // override Node's default behavior of having a geometric bounds change
+        // trigger a change in layoutBounds. For Resizable nodes, layoutBounds
+        // is unrelated to geometric bounds.
     }
 
     /**
@@ -2448,18 +2399,19 @@
         double by2 = getHeight();
         final Shape theShape = getShape();
         if (theShape != null && getScaleShape() == false) {
-            double shapeWidth = theShape.getLayoutBounds().getWidth();
-            double shapeHeight = theShape.getLayoutBounds().getHeight();
+            Bounds layoutBounds = theShape.getLayoutBounds();
+            double shapeWidth = layoutBounds.getWidth();
+            double shapeHeight = layoutBounds.getHeight();
             if (getPositionShape()) {
                 bx1 = (getWidth() - shapeWidth)/2;
                 by1 = (getHeight() - shapeHeight)/2;
                 bx2 = bx1+shapeWidth;
                 by2 = by1+shapeHeight;
             } else {
-                bx1 = theShape.getLayoutBounds().getMinX();
-                by1 = theShape.getLayoutBounds().getMinY();
-                bx2 = theShape.getLayoutBounds().getMaxX();
-                by2 = theShape.getLayoutBounds().getMaxY();
+                bx1 = layoutBounds.getMinX();
+                by1 = layoutBounds.getMinY();
+                bx2 = layoutBounds.getMaxX();
+                by2 = layoutBounds.getMaxY();
             }
         }
         double x1 = bx1;
@@ -2469,7 +2421,7 @@
         // calculate the bounds accounting for offsets and strokes
         final List<BackgroundFill> background_fills = getBackgroundFills();
         if (background_fills != null) {
-            for (int i = 0; i < background_fills.size(); i++) {
+            for (int i = 0, max = background_fills.size(); i < max; i++) {
                 Insets offsets = background_fills.get(i).getOffsets();
                 x1 = Math.min(x1, bx1 + offsets.getLeft());
                 y1 = Math.min(y1, by1 + offsets.getTop());
@@ -2480,35 +2432,38 @@
         
         final List<BackgroundImage> background_images = getBackgroundImages();
         if (background_images != null) {
-            for (int i = 0; i < background_images.size(); i++) {
-                x1 = Math.min(x1, bx1 + background_images.get(i).getLeft());
-                y1 = Math.min(y1, by1 + background_images.get(i).getTop());
-                x2 = Math.max(x2, bx2 - background_images.get(i).getRight());
-                y2 = Math.max(y2, by2 - background_images.get(i).getBottom());
+            for (int i = 0, max = background_images.size(); i < max; i++) {
+                BackgroundImage backgroundImage = background_images.get(i);
+                x1 = Math.min(x1, bx1 + backgroundImage.getLeft());
+                y1 = Math.min(y1, by1 + backgroundImage.getTop());
+                x2 = Math.max(x2, bx2 - backgroundImage.getRight());
+                y2 = Math.max(y2, by2 - backgroundImage.getBottom());
             }
         }
         
         final List<BorderImage> image_borders = getImageBorders();
         if (image_borders != null) {
-            for (int i = 0; i < image_borders.size(); i++) {
-                Insets offsets = image_borders.get(i).getOffsets();
+            for (int i = 0, max = image_borders.size(); i < max; i++) {
+                BorderImage borderImage = image_borders.get(i);
+                Insets offsets = borderImage.getOffsets();
                 // stoked borders assume centered strokes for now
-                x1 = Math.min(x1, bx1 + offsets.getLeft() - (image_borders.get(i).getLeftWidth()/2.0));
-                y1 = Math.min(y1, by1 + offsets.getTop() - (image_borders.get(i).getTopWidth()/2.0));
-                x2 = Math.max(x2, bx2 - offsets.getRight() + (image_borders.get(i).getRightWidth()/2.0));
-                y2 = Math.max(y2, by2 - offsets.getBottom() + (image_borders.get(i).getBottomWidth()/2.0));
+                x1 = Math.min(x1, bx1 + offsets.getLeft() - (borderImage.getLeftWidth()/2.0));
+                y1 = Math.min(y1, by1 + offsets.getTop() - (borderImage.getTopWidth()/2.0));
+                x2 = Math.max(x2, bx2 - offsets.getRight() + (borderImage.getRightWidth()/2.0));
+                y2 = Math.max(y2, by2 - offsets.getBottom() + (borderImage.getBottomWidth()/2.0));
             }
         }
         
         final List<StrokeBorder> stroke_borders = getStrokeBorders();
         if (stroke_borders != null) {
-            for (int i = 0; i < stroke_borders.size(); i++) {
-                Insets offsets = stroke_borders.get(i).getOffsets();
+            for (int i = 0, max = stroke_borders.size(); i < max; i++) {
+                StrokeBorder strokeBorder = stroke_borders.get(i);
+                Insets offsets = strokeBorder.getOffsets();
                 // stoked borders assume centered strokes for now
-                x1 = Math.min(x1, bx1 + offsets.getLeft() - (stroke_borders.get(i).getLeftWidth()/2.0));
-                y1 = Math.min(y1, by1 + offsets.getTop() - (stroke_borders.get(i).getTopWidth()/2.0));
-                x2 = Math.max(x2, bx2 - offsets.getRight() + (stroke_borders.get(i).getRightWidth()/2.0));
-                y2 = Math.max(y2, by2 - offsets.getBottom() + (stroke_borders.get(i).getBottomWidth()/2.0));
+                x1 = Math.min(x1, bx1 + offsets.getLeft() - (strokeBorder.getLeftWidth()/2.0));
+                y1 = Math.min(y1, by1 + offsets.getTop() - (strokeBorder.getTopWidth()/2.0));
+                x2 = Math.max(x2, bx2 - offsets.getRight() + (strokeBorder.getRightWidth()/2.0));
+                y2 = Math.max(y2, by2 - offsets.getBottom() + (strokeBorder.getBottomWidth()/2.0));
             }
         }
 
@@ -2585,16 +2540,13 @@
              new StyleableProperty<Region,Insets>("-fx-padding",
                  InsetsConverter.getInstance(), Insets.EMPTY) {
 
-            @Override
-            public boolean isSettable(Region node) {
+            @Override public boolean isSettable(Region node) {
                 return node.padding == null || !node.padding.isBound();
             }
 
-            @Override
-            public WritableValue<Insets> getWritableValue(Region node) {
+            @Override public WritableValue<Insets> getWritableValue(Region node) {
                 return node.paddingProperty();
             }
-                     
          };
 
          private static final StyleableProperty<Region,List<BackgroundFill>> BACKGROUND_FILLS =
@@ -2604,16 +2556,13 @@
                  false,
                  BackgroundFill.impl_CSS_STYLEABLES()) {
 
-            @Override
-            public boolean isSettable(Region node) {
+            @Override public boolean isSettable(Region node) {
                 return node.backgroundFills == null || !node.backgroundFills.isBound();                        
             }
 
-            @Override
-            public WritableValue<List<BackgroundFill>> getWritableValue(Region node) {
+            @Override public WritableValue<List<BackgroundFill>> getWritableValue(Region node) {
                 return node.backgroundFillsProperty();
             }
-                     
          };
 
          private static final StyleableProperty<Region,List<BackgroundImage>> BACKGROUND_IMAGES =
@@ -2623,16 +2572,13 @@
                  false,
                  BackgroundImage.impl_CSS_STYLEABLES()) {
 
-            @Override
-            public boolean isSettable(Region node) {
+            @Override public boolean isSettable(Region node) {
                 return node.backgroundImages == null || !node.backgroundImages.isBound();
             }
 
-            @Override
-            public WritableValue<List<BackgroundImage>> getWritableValue(Region node) {
+            @Override public WritableValue<List<BackgroundImage>> getWritableValue(Region node) {
                 return node.backgroundImagesProperty();
             }
-                     
          };
 
         private static final StyleableProperty<Region,List<BorderImage>> IMAGE_BORDERS =
@@ -2642,13 +2588,11 @@
                 false,
                 BorderImage.impl_CSS_STYLEABLES()) {
 
-            @Override
-            public boolean isSettable(Region node) {
+            @Override public boolean isSettable(Region node) {
                 return node.imageBorders == null || !node.imageBorders.isBound();
             }
 
-            @Override
-            public WritableValue<List<BorderImage>> getWritableValue(Region node) {
+            @Override public WritableValue<List<BorderImage>> getWritableValue(Region node) {
                 return node.imageBordersProperty();
             }
         };
@@ -2660,30 +2604,25 @@
                  false,
                  StrokeBorder.impl_CSS_STYLEABLES()) {
 
-            @Override
-            public boolean isSettable(Region node) {
+            @Override public boolean isSettable(Region node) {
                 return node.strokeBorders == null || !node.strokeBorders.isBound();
             }
 
-            @Override
-            public WritableValue<List<StrokeBorder>> getWritableValue(Region node) {
+            @Override public WritableValue<List<StrokeBorder>> getWritableValue(Region node) {
                 return node.strokeBordersProperty();
             }
-                     
          };
 
          private static final StyleableProperty<Region,String> SHAPE = 
              new StyleableProperty<Region,String>("-fx-shape",
                  StringConverter.getInstance()) {
 
-            @Override
-            public boolean isSettable(Region node) {
+            @Override public boolean isSettable(Region node) {
                 // isSettable depends on node.shape, not node.shapeContent
                 return node.shape == null || !node.shape.isBound();
             }
 
-            @Override
-            public WritableValue<String> getWritableValue(Region node) {
+            @Override public WritableValue<String> getWritableValue(Region node) {
                 return node.shapeContentProperty();
             }
          };
@@ -2692,13 +2631,11 @@
              new StyleableProperty<Region,Boolean>("-fx-scale-shape",
                  BooleanConverter.getInstance(), Boolean.TRUE){
 
-            @Override
-            public boolean isSettable(Region node) {
+            @Override public boolean isSettable(Region node) {
                 return node.scaleShape == null || !node.scaleShape.isBound();
             }
 
-            @Override
-            public WritableValue<Boolean> getWritableValue(Region node) {
+            @Override public WritableValue<Boolean> getWritableValue(Region node) {
                 return node.scaleShapeProperty();
             }
         };
@@ -2707,13 +2644,11 @@
              new StyleableProperty<Region,Boolean>("-fx-position-shape",
                  BooleanConverter.getInstance(), Boolean.TRUE){
 
-            @Override
-            public boolean isSettable(Region node) {
+            @Override public boolean isSettable(Region node) {
                 return node.positionShape == null || !node.positionShape.isBound();
             }
 
-            @Override
-            public WritableValue<Boolean> getWritableValue(Region node) {
+            @Override public WritableValue<Boolean> getWritableValue(Region node) {
                 return node.positionShapeProperty();
             }
         };
@@ -2722,14 +2657,12 @@
              new StyleableProperty<Region,Boolean>("-fx-snap-to-pixel",
                  BooleanConverter.getInstance(), Boolean.TRUE){
 
-            @Override
-            public boolean isSettable(Region node) {
+            @Override public boolean isSettable(Region node) {
                 return node.snapToPixel == null ||
                         !node.snapToPixel.isBound();
             }
 
-            @Override
-            public WritableValue<Boolean> getWritableValue(Region node) {
+            @Override public WritableValue<Boolean> getWritableValue(Region node) {
                 return node.snapToPixelProperty();
             }
         };
@@ -2751,7 +2684,6 @@
                     SNAP_TO_PIXEL
             );
             STYLEABLES = Collections.unmodifiableList(styleables);
-
          }
     }
 
@@ -2773,7 +2705,7 @@
      * @deprecated This is an experimental API that is not intended for general use and is subject to change in future versions
      */
     @Deprecated
-    public List<StyleableProperty> impl_getStyleableProperties() {
+    @Override public List<StyleableProperty> impl_getStyleableProperties() {
         return impl_CSS_STYLEABLES();
     }
 
--- a/javafx-ui-common/test/unit/com/sun/javafx/css/FontTypeTest.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-common/test/unit/com/sun/javafx/css/FontTypeTest.java	Mon Jul 30 13:08:41 2012 -0700
@@ -133,7 +133,7 @@
                 FontConverter.getInstance()
             );
 
-        expResult = Font.font(font.getFamily(), font.getSize() * (96/72));
+        expResult = Font.font(font.getFamily(), font.getSize() * (96.0/72.0));
         result = value.convert(font);
         checkFont(expResult, result);
         
--- a/javafx-ui-common/test/unit/com/sun/javafx/css/SizeTest.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-common/test/unit/com/sun/javafx/css/SizeTest.java	Mon Jul 30 13:08:41 2012 -0700
@@ -66,8 +66,8 @@
     public SizeTest() {
     }
 
-    static final private int DOTS_PER_INCH = 96;
-    static final private int POINTS_PER_INCH = 72;
+    static final private double DOTS_PER_INCH = 96.0;
+    static final private double POINTS_PER_INCH = 72.0;
 
     /**
      * Test of points method, of class Size.
--- a/javafx-ui-common/test/unit/javafx/scene/ParentTest.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-common/test/unit/javafx/scene/ParentTest.java	Mon Jul 30 13:08:41 2012 -0700
@@ -348,41 +348,6 @@
     }
 
     @Test
-    public void testChildrenTraversalOfEmptyParent() {
-        Group g = new Group();
-        Rectangle r = new Rectangle();
-
-        assertNull(g.getFirstChild());
-        assertNull(g.getLastChild());
-        assertNull(g.getNextChild(r));
-        assertNull(g.getPreviousChild(r));
-    }
-
-    @Test
-    public void testChildrenTraversal() {
-        Group g = new Group();
-        Rectangle r1 = new Rectangle();
-        Rectangle r2 = new Rectangle();
-        Rectangle r3 = new Rectangle();
-        Rectangle r4 = new Rectangle();
-
-        g.getChildren().add(r1);
-        g.getChildren().add(r2);
-        g.getChildren().add(r3);
-
-        assertSame(r1, g.getFirstChild());
-        assertSame(r3, g.getLastChild());
-        assertSame(r2, g.getNextChild(r1));
-        assertSame(r2, g.getPreviousChild(r3));
-        assertSame(r3, g.getNextChild(r2));
-        assertSame(r1, g.getPreviousChild(r2));
-        assertNull(g.getNextChild(r3));
-        assertNull(g.getPreviousChild(r1));
-        assertNull(g.getNextChild(r4));
-        assertNull(g.getPreviousChild(r4));
-    }
-
-    @Test
     public void testDuplicates() {
         Group g = new Group();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/preview/javafx/scene/control/TreeTableColumn.java	Mon Jul 30 13:08:41 2012 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2012, 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.preview.javafx.scene.control;
+
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.TreeItem;
+
+/**
+ *
+ */
+public class TreeTableColumn<S, T> extends TableColumn<TreeItem<S>, T> {
+
+    public TreeTableColumn() {
+    }
+    
+    public TreeTableColumn(String text) {
+        super(text);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/preview/javafx/scene/control/TreeTableRow.java	Mon Jul 30 13:08:41 2012 -0700
@@ -0,0 +1,434 @@
+/*
+ * Copyright (c) 2012, 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.preview.javafx.scene.control;
+
+import com.sun.javafx.css.StyleManager;
+import com.sun.javafx.scene.control.WeakListChangeListener;
+import java.lang.ref.WeakReference;
+import javafx.beans.InvalidationListener;
+import javafx.beans.Observable;
+import javafx.beans.WeakInvalidationListener;
+import javafx.beans.property.ObjectProperty;
+import javafx.beans.property.ReadOnlyObjectProperty;
+import javafx.beans.property.ReadOnlyObjectWrapper;
+import javafx.beans.property.SimpleObjectProperty;
+import javafx.collections.ListChangeListener;
+import javafx.scene.Node;
+import javafx.scene.control.*;
+
+/**
+ *
+ */
+public class TreeTableRow<T> extends TableRow<T> {
+    
+    
+    /***************************************************************************
+     *                                                                         *
+     * Constructors                                                            *
+     *                                                                         *
+     **************************************************************************/
+
+    /**
+     * Creates a default TreeTableRow instance.
+     */
+    public TreeTableRow() {
+        getStyleClass().addAll(DEFAULT_STYLE_CLASS);
+        indexProperty().addListener(indexListener);
+    }
+
+
+
+    /***************************************************************************
+     *                                                                         *
+     * Callbacks and events                                                    *
+     *                                                                         *
+     **************************************************************************/
+    
+    private final InvalidationListener indexListener = new InvalidationListener() {
+        @Override public void invalidated(Observable valueModel) {
+            // when the cell index changes, this may result in the cell
+            // changing state to be selected and/or focused.
+            updateItem();
+            updateSelection();
+            updateFocus();
+        }
+    };
+
+    private final ListChangeListener selectedListener = new ListChangeListener() {
+        @Override public void onChanged(ListChangeListener.Change c) {
+            updateSelection();
+        }
+    };
+
+    private final InvalidationListener focusedListener = new InvalidationListener() {
+        @Override public void invalidated(Observable valueModel) {
+            updateFocus();
+        }
+    };
+
+    private final InvalidationListener editingListener = new InvalidationListener() {
+        @Override public void invalidated(Observable valueModel) {
+            updateEditing();
+        }
+    };
+    
+    private final WeakListChangeListener weakSelectedListener = new WeakListChangeListener(selectedListener);
+    private final WeakInvalidationListener weakFocusedListener = new WeakInvalidationListener(focusedListener);
+    private final WeakInvalidationListener weakEditingListener = new WeakInvalidationListener(editingListener);
+    
+    
+    /***************************************************************************
+     *                                                                         *
+     * Properties                                                              *
+     *                                                                         *
+     **************************************************************************/
+    
+    // --- TreeItem
+    private ReadOnlyObjectWrapper<TreeItem<T>> treeItem = new ReadOnlyObjectWrapper<TreeItem<T>>(this, "treeItem");
+    private void setTreeItem(TreeItem<T> value) { treeItem.set(value); }
+    
+    /**
+     * Returns the TreeItem currently set in this TreeCell.
+     */
+    public final TreeItem<T> getTreeItem() { return treeItem.get(); }
+    
+    /**
+     * Each TreeCell represents at most a single {@link TreeItem}, which is
+     * represented by this property.
+     */
+    public final ReadOnlyObjectProperty<TreeItem<T>> treeItemProperty() { return treeItem.getReadOnlyProperty(); }
+
+    
+    
+    // --- Disclosure Node
+    private ObjectProperty<Node> disclosureNode = new SimpleObjectProperty<Node>(this, "disclosureNode");
+
+    /**
+     * The node to use as the "disclosure" triangle, or toggle, used for
+     * expanding and collapsing items. This is only used in the case of
+     * an item in the tree which contains child items. If not specified, the
+     * TreeCell's Skin implementation is responsible for providing a default
+     * disclosure node.
+     */
+    public final void setDisclosureNode(Node value) { disclosureNodeProperty().set(value); }
+    
+    /**
+     * Returns the current disclosure node set in this TreeCell.
+     */
+    public final Node getDisclosureNode() { return disclosureNode.get(); }
+    
+    /**
+     * The disclosure node is commonly seen represented as a triangle that rotates
+     * on screen to indicate whether or not the TreeItem that it is placed
+     * beside is expanded or collapsed.
+     */
+    public final ObjectProperty<Node> disclosureNodeProperty() { return disclosureNode; }
+    
+    
+    // --- TreeView
+    private ReadOnlyObjectWrapper<TreeTableView<T>> treeTableView = new ReadOnlyObjectWrapper<TreeTableView<T>>() {
+        private WeakReference<TreeTableView<T>> weakTreeTableViewRef;
+        @Override protected void invalidated() {
+            MultipleSelectionModel sm;
+            FocusModel fm;
+            
+            if (weakTreeTableViewRef != null) {
+                TreeTableView<T> oldTreeTableView = weakTreeTableViewRef.get();
+                if (oldTreeTableView != null) {
+                    // remove old listeners
+                    sm = oldTreeTableView.getSelectionModel();
+                    if (sm != null) {
+                        sm.getSelectedIndices().removeListener(weakSelectedListener);
+                    }
+
+                    fm = oldTreeTableView.getFocusModel();
+                    if (fm != null) {
+                        fm.focusedIndexProperty().removeListener(weakFocusedListener);
+                    }
+
+                    oldTreeTableView.editingItemProperty().removeListener(weakEditingListener);
+                }
+                
+                weakTreeTableViewRef = null;
+            }
+
+            if (get() != null) {
+                sm = get().getSelectionModel();
+                if (sm != null) {
+                    // listening for changes to treeView.selectedIndex and IndexedCell.index,
+                    // to determine if this cell is selected
+                    sm.getSelectedIndices().addListener(weakSelectedListener);
+                }
+
+                fm = get().getFocusModel();
+                if (fm != null) {
+                    // similar to above, but this time for focus
+                    fm.focusedIndexProperty().addListener(weakFocusedListener);
+                }
+
+                get().editingItemProperty().addListener(weakEditingListener);
+                
+                weakTreeTableViewRef = new WeakReference<TreeTableView<T>>(get());
+            }
+
+            requestLayout();
+        }
+
+        @Override
+        public Object getBean() {
+            return TreeTableRow.this;
+        }
+
+        @Override
+        public String getName() {
+            return "treeTableView";
+        }
+    };
+    
+    private void setTreeTableView(TreeTableView<T> value) { treeTableView.set(value); }
+
+    /**
+     * Returns the TreeView associated with this TreeCell.
+     */
+    public final TreeTableView<T> getTreeTableView() { return treeTableView.get(); }
+    
+    /**
+     * A TreeCell is explicitly linked to a single {@link TreeView} instance,
+     * which is represented by this property.
+     */
+    public final ReadOnlyObjectProperty<TreeTableView<T>> treeTableViewProperty() { return treeTableView.getReadOnlyProperty(); }
+
+
+
+    /***************************************************************************
+     *                                                                         *
+     * Public API                                                              *
+     *                                                                         *
+     **************************************************************************/
+
+    /** {@inheritDoc} */
+    @Override public void startEdit() {
+        final TreeView<T> tree = getTreeTableView();
+        if (! isEditable() || (tree != null && ! tree.isEditable())) {
+//            if (Logging.getControlsLogger().isLoggable(PlatformLogger.SEVERE)) {
+//                Logging.getControlsLogger().severe(
+//                    "Can not call TreeCell.startEdit() on this TreeCell, as it "
+//                        + "is not allowed to enter its editing state (TreeCell: "
+//                        + this + ", TreeView: " + tree + ").");
+//            }
+            return;
+        }
+        
+        // it makes sense to get the cell into its editing state before firing
+        // the event to the TreeView below, so that's what we're doing here
+        // by calling super.startEdit().
+        super.startEdit();
+        
+         // Inform the TreeView of the edit starting.
+        if (tree != null) {
+            tree.fireEvent(new TreeView.EditEvent<T>(tree,
+                    TreeView.<T>editStartEvent(),
+                    getTreeItem(),
+                    getItem(),
+                    null));
+            
+            tree.requestFocus();
+        }
+    }
+
+     /** {@inheritDoc} */
+    @Override public void commitEdit(T newValue) {
+        if (! isEditing()) return;
+        final TreeItem treeItem = getTreeItem();
+        final TreeView tree = getTreeTableView();
+        if (tree != null) {
+            // Inform the TreeView of the edit being ready to be committed.
+            tree.fireEvent(new TreeView.EditEvent<T>(tree,
+                    TreeView.<T>editCommitEvent(),
+                    treeItem,
+                    getItem(),
+                    newValue));
+        }
+        
+        // update the item within this cell, so that it represents the new value
+        if (treeItem != null) {
+            treeItem.setValue(newValue);
+            updateTreeItem(treeItem);
+            updateItem(newValue, false);
+        }
+        
+        // inform parent classes of the commit, so that they can switch us
+        // out of the editing state
+        super.commitEdit(newValue);
+
+        if (tree != null) {
+            // reset the editing item in the TreetView
+            tree.edit(null);
+            tree.requestFocus();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cancelEdit() {
+        if (! isEditing()) return;
+        
+        TreeView tree = getTreeTableView();
+        if (tree != null) {
+            tree.fireEvent(new TreeView.EditEvent<T>(tree,
+                    TreeView.<T>editCancelEvent(),
+                    getTreeItem(),
+                    getItem(),
+                    null));
+        }
+
+        super.cancelEdit();
+
+        if (tree != null) {
+            // reset the editing index on the TreeView
+            tree.edit(null);
+            tree.requestFocus();
+        }
+    }
+
+
+
+    /***************************************************************************
+     *                                                                         *
+     * Private Implementation                                                  *
+     *                                                                         *
+     **************************************************************************/
+    
+    private void updateItem() {
+        TreeView<T> tv = getTreeTableView();
+        if (tv == null) return;
+        
+        // Compute whether the index for this cell is for a real item
+        boolean valid = getIndex() >=0 && getIndex() < tv.impl_getTreeItemCount();
+
+        // get the new treeItem that is about to go in to the TreeCell
+        TreeItem<T> treeItem = valid ? tv.getTreeItem(getIndex()) : null;
+        
+        // Cause the cell to update itself
+        if (valid && treeItem != null) {
+            // update the TreeCell state.
+            // For the sake of RT-14279, it is important that the order of these
+            // method calls is as shown below. If the order is switched, it is
+            // likely that events will be fired where the item is null, even
+            // though calling cell.getTreeItem().getValue() returns the value
+            // as expected
+            updateTreeItem(treeItem);
+            updateItem(treeItem.getValue(), false);
+        } else {
+            updateTreeItem(null);
+            updateItem(null, true);
+        }
+    }
+
+    private void updateSelection() {
+        if (getIndex() == -1 || getTreeTableView() == null) return;
+        if (getTreeTableView().getSelectionModel() == null) return;
+        
+        updateSelected(getTreeTableView().getSelectionModel().isSelected(getIndex()));
+    }
+
+    private void updateFocus() {
+        if (getIndex() == -1 || getTreeTableView() == null) return;
+        if (getTreeTableView().getFocusModel() == null) return;
+        
+        setFocused(getTreeTableView().getFocusModel().isFocused(getIndex()));
+    }
+
+    private void updateEditing() {
+        if (getIndex() == -1 || getTreeTableView() == null || getTreeItem() == null) return;
+        
+        TreeItem editItem = getTreeTableView().getEditingItem();
+        if (! isEditing() && getTreeItem().equals(editItem)) {
+            startEdit();
+        } else if (isEditing() && ! getTreeItem().equals(editItem)) {
+            cancelEdit();
+        }
+    }
+
+
+
+    /***************************************************************************
+     *                                                                         *
+     * Expert API                                                              *
+     *                                                                         *
+     **************************************************************************/
+
+    /**
+     * Updates the TreeView associated with this TreeCell.
+     * 
+     * @param tree The new TreeView that should be associated with this TreeCell.
+     * @expert This function is intended to be used by experts, primarily
+     *         by those implementing new Skins. It is not common
+     *         for developers or designers to access this function directly.
+     */
+    public final void updateTreeTableView(TreeTableView<T> treeTable) {
+        setTreeTableView(treeTable); 
+    }
+
+    /**
+     * Updates the TreeItem associated with this TreeCell.
+     *
+     * @param treeItem The new TreeItem that should be associated with this 
+     *      TreeCell.
+     * @expert This function is intended to be used by experts, primarily
+     *      by those implementing new Skins. It is not common
+     *      for developers or designers to access this function directly.
+     */
+    public final void updateTreeItem(TreeItem<T> treeItem) {
+        setTreeItem(treeItem);
+    }
+
+
+    
+    /***************************************************************************
+     *                                                                         *
+     * Stylesheet Handling                                                     *
+     *                                                                         *
+     **************************************************************************/
+
+    private static final String DEFAULT_STYLE_CLASS = "tree-cell";
+
+//    private static final String PSEUDO_CLASS_EXPANDED = "expanded";
+//    private static final String PSEUDO_CLASS_COLLAPSED = "collapsed";
+
+    private static final long EXPANDED_PSEUDOCLASS_STATE = StyleManager.getInstance().getPseudoclassMask("expanded");
+    private static final long COLLAPSED_PSEUDOCLASS_STATE = StyleManager.getInstance().getPseudoclassMask("collapsed");
+
+   /**
+     * @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 long impl_getPseudoClassState() {
+        long mask = super.impl_getPseudoClassState();
+        if (getTreeItem() != null && ! getTreeItem().isLeaf()) {
+            mask |= getTreeItem().isExpanded() ? EXPANDED_PSEUDOCLASS_STATE : COLLAPSED_PSEUDOCLASS_STATE;
+        }
+        return mask;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/preview/javafx/scene/control/TreeTableView.java	Mon Jul 30 13:08:41 2012 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2012, 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.preview.javafx.scene.control;
+
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.scene.control.TreeView;
+
+/**
+ *
+ */
+public class TreeTableView<S> extends TreeView<S> {
+    
+    public TreeTableView() {
+        getStyleClass().setAll("tree-table-view");
+    }
+
+    // this is the only publicly writable list for columns. This represents the
+    // columns as they are given initially by the developer.
+    private final ObservableList<TreeTableColumn<S, ?>> columns = FXCollections.observableArrayList();
+    
+    /**
+     * The TableColumns that are part of this TableView. As the user reorders
+     * the TableView columns, this list will be updated to reflect the current
+     * visual ordering.
+     *
+     * <p>Note: to display any data in a TableView, there must be at least one
+     * TableColumn in this ObservableList.</p>
+     */
+    public final ObservableList<TreeTableColumn<S, ?>> getColumns() {
+        return columns;
+    }
+}
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/ChoiceBoxBehavior.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/ChoiceBoxBehavior.java	Mon Jul 30 13:08:41 2012 -0700
@@ -31,10 +31,11 @@
 import static javafx.scene.input.KeyEvent.KEY_PRESSED;
 import static javafx.scene.input.KeyEvent.KEY_RELEASED;
 import static javafx.scene.input.KeyCode.DOWN;
-import static javafx.scene.input.KeyCode.ENTER;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import javafx.scene.control.ChoiceBox;
 import javafx.scene.control.SelectionModel;
@@ -105,13 +106,7 @@
     @Override public void mousePressed(MouseEvent e) {
         ChoiceBox choiceButton = getControl();
         super.mousePressed(e);
-        if (choiceButton.isShowing()) {
-            getControl().hide(); // hide if already showing 
-        }
-        else {
-            if (choiceButton.isFocusTraversable()) choiceButton.requestFocus();
-            choiceButton.show();
-        }
+        if (choiceButton.isFocusTraversable()) choiceButton.requestFocus();
     }
 
     /**
@@ -122,8 +117,11 @@
     @Override public void mouseReleased(MouseEvent e) {
         ChoiceBox choiceButton = getControl();
         super.mouseReleased(e);
-        if (!choiceButton.contains(e.getX(), e.getY())) {
-            choiceButton.hide();
+        if (choiceButton.isShowing() || !choiceButton.contains(e.getX(), e.getY())) {
+            choiceButton.hide(); // hide if already showing 
+        }
+        else {
+            choiceButton.show();
         }
     }
 
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TextAreaBehavior.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TextAreaBehavior.java	Mon Jul 30 13:08:41 2012 -0700
@@ -386,8 +386,8 @@
                     }
 
                     if (menuPos != null) {
-                        Point2D p = skin.localToScene(menuPos);
-                        Scene scene = skin.getScene();
+                        Point2D p = getControl().localToScene(menuPos);
+                        Scene scene = getControl().getScene();
                         Window window = scene.getWindow();
                         Point2D location = new Point2D(window.getX() + scene.getX() + p.getX(),
                                                        window.getY() + scene.getY() + p.getY());
@@ -404,17 +404,17 @@
                 Rectangle2D bounds = currentScreen.getBounds();
 
                 if (menuX < bounds.getMinX()) {
-                    skin.getProperties().put("CONTEXT_MENU_SCREEN_X", screenX);
-                    skin.getProperties().put("CONTEXT_MENU_SCENE_X", sceneX);
+                    getControl().getProperties().put("CONTEXT_MENU_SCREEN_X", screenX);
+                    getControl().getProperties().put("CONTEXT_MENU_SCENE_X", sceneX);
                     contextMenu.show(getControl(), bounds.getMinX(), screenY);
                 } else if (screenX + menuWidth > bounds.getMaxX()) {
                     double leftOver = menuWidth - ( bounds.getMaxX() - screenX);
-                    skin.getProperties().put("CONTEXT_MENU_SCREEN_X", screenX);
-                    skin.getProperties().put("CONTEXT_MENU_SCENE_X", sceneX);
+                    getControl().getProperties().put("CONTEXT_MENU_SCREEN_X", screenX);
+                    getControl().getProperties().put("CONTEXT_MENU_SCENE_X", sceneX);
                     contextMenu.show(getControl(), screenX - leftOver, screenY);
                 } else {
-                    skin.getProperties().put("CONTEXT_MENU_SCREEN_X", 0);
-                    skin.getProperties().put("CONTEXT_MENU_SCENE_X", 0);
+                    getControl().getProperties().put("CONTEXT_MENU_SCREEN_X", 0);
+                    getControl().getProperties().put("CONTEXT_MENU_SCENE_X", 0);
                     contextMenu.show(getControl(), menuX, screenY);
                 }
             }
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TextFieldBehavior.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TextFieldBehavior.java	Mon Jul 30 13:08:41 2012 -0700
@@ -301,8 +301,8 @@
                     }
 
                     if (menuPos != null) {
-                        Point2D p = skin.localToScene(menuPos);
-                        Scene scene = skin.getScene();
+                        Point2D p = getControl().localToScene(menuPos);
+                        Scene scene = getControl().getScene();
                         Window window = scene.getWindow();
                         Point2D location = new Point2D(window.getX() + scene.getX() + p.getX(),
                                                        window.getY() + scene.getY() + p.getY());
@@ -319,17 +319,17 @@
                 Rectangle2D bounds = currentScreen.getBounds();
 
                 if (menuX < bounds.getMinX()) {
-                    skin.getProperties().put("CONTEXT_MENU_SCREEN_X", screenX);
-                    skin.getProperties().put("CONTEXT_MENU_SCENE_X", sceneX);
+                    getControl().getProperties().put("CONTEXT_MENU_SCREEN_X", screenX);
+                    getControl().getProperties().put("CONTEXT_MENU_SCENE_X", sceneX);
                     contextMenu.show(getControl(), bounds.getMinX(), screenY);
                 } else if (screenX + menuWidth > bounds.getMaxX()) {
                     double leftOver = menuWidth - ( bounds.getMaxX() - screenX);
-                    skin.getProperties().put("CONTEXT_MENU_SCREEN_X", screenX);
-                    skin.getProperties().put("CONTEXT_MENU_SCENE_X", sceneX);
+                    getControl().getProperties().put("CONTEXT_MENU_SCREEN_X", screenX);
+                    getControl().getProperties().put("CONTEXT_MENU_SCENE_X", sceneX);
                     contextMenu.show(getControl(), screenX - leftOver, screenY);
                 } else {
-                    skin.getProperties().put("CONTEXT_MENU_SCREEN_X", 0);
-                    skin.getProperties().put("CONTEXT_MENU_SCENE_X", 0);
+                    getControl().getProperties().put("CONTEXT_MENU_SCREEN_X", 0);
+                    getControl().getProperties().put("CONTEXT_MENU_SCENE_X", 0);
                     contextMenu.show(getControl(), menuX, screenY);
                 }
             }
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TextInputControlBehavior.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TextInputControlBehavior.java	Mon Jul 30 13:08:41 2012 -0700
@@ -33,8 +33,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import com.sun.javafx.scene.control.skin.SkinBase;
-
 import static javafx.scene.input.KeyEvent.KEY_PRESSED;
 
 import static com.sun.javafx.PlatformUtil.*;
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TitledPaneBehavior.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TitledPaneBehavior.java	Mon Jul 30 13:08:41 2012 -0700
@@ -81,24 +81,10 @@
             tps.getContentRegion().getImpl_traversalEngine().getTopLeftFocusableNode();
             // Are there any focusable node in the TitlePane content
             if (!tp.isExpanded() || tps.getContentRegion().getImpl_traversalEngine().registeredNodes.isEmpty()) {
-                // If the parent is an accordion we want to focus to go outside of the
-                // accordion and to the next focusable control.
-                if (getControl().getParent() != null && getControl().getParent() instanceof AccordionSkin) {
-                    tps.getContentRegion().getImpl_traversalEngine().trav(getControl().getParent(), Direction.NEXT);
-                } else {                    
-                    super.callAction(name);
-                }
+                super.callAction(name);
             }
         } else if ("TraversePrevious".equals(name)) {
-            TitledPane tp = getControl();
-            TitledPaneSkin tps = (TitledPaneSkin)tp.getSkin();
-            // If the parent is an accordion we want to focus to go outside of the
-            // accordion and to the next focusable control.
-            if (getControl().getParent() != null && getControl().getParent() instanceof AccordionSkin) {
-                tps.getContentRegion().getImpl_traversalEngine().trav(getControl().getParent(), Direction.PREVIOUS);
-            } else {
-                super.callAction(name);
-            }
+            super.callAction(name);
         } else {
             super.callAction(name);
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TreeTableRowBehavior.java	Mon Jul 30 13:08:41 2012 -0700
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2012, 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.behavior;
+
+import com.preview.javafx.scene.control.TreeTableView;
+import com.preview.javafx.scene.control.TreeTableRow;
+import javafx.scene.control.MultipleSelectionModel;
+import javafx.scene.control.TreeItem;
+import javafx.scene.input.MouseButton;
+import javafx.scene.input.MouseEvent;
+
+/**
+ *
+ */
+public class TreeTableRowBehavior<T> extends CellBehaviorBase<TreeTableRow<T>> {
+
+    public TreeTableRowBehavior(TreeTableRow<T> control) {
+        super(control);
+    }
+
+    @Override
+    public void mouseReleased(MouseEvent e) {
+        super.mouseReleased(e);
+        
+//        if (e.getClickCount() == 2) {
+//            ObservableList<T> items = getControl().getTableView().getItems();
+//            TreeItem<File> treeItem = items.get(getControl.getIndex());
+//            treeItem.setExpanded(! treeItem.isExpanded());
+//        }
+        
+        TreeTableView<T> tv = getControl().getTreeTableView();
+        TreeItem treeItem = getControl().getTreeItem();
+        int index = getControl().getIndex();
+        MultipleSelectionModel sm = tv.getSelectionModel();
+        boolean isAlreadySelected = sm.isSelected(index);
+
+        tv.getSelectionModel().clearAndSelect(index);
+
+        // handle editing, which only occurs with the primary mouse button
+        if (e.getButton() == MouseButton.PRIMARY) {
+            if (e.getClickCount() == 1 && isAlreadySelected) {
+                tv.edit(treeItem);
+            } else if (e.getClickCount() == 1) {
+                // cancel editing
+                tv.edit(null);
+            } else if (e.getClickCount() == 2/* && ! getControl().isEditable()*/) {
+                if (treeItem.isLeaf()) {
+                    // attempt to edit
+                    tv.edit(treeItem);
+                } else {
+                    // try to expand/collapse branch tree item
+                    treeItem.setExpanded(! treeItem.isExpanded());
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TreeTableViewBehavior.java	Mon Jul 30 13:08:41 2012 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2012, 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.behavior;
+
+import com.preview.javafx.scene.control.TreeTableView;
+
+/**
+ *
+ */
+public class TreeTableViewBehavior<T> extends BehaviorBase<TreeTableView<T>> {
+
+    public TreeTableViewBehavior(TreeTableView<T> control) {
+        super(control);
+    }
+    
+}
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/AccordionSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/AccordionSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -32,6 +32,7 @@
 import javafx.scene.control.Accordion;
 import javafx.scene.control.TitledPane;
 import javafx.scene.shape.Rectangle;
+import javafx.scene.control.SkinBase;
 
 import com.sun.javafx.scene.control.behavior.AccordionBehavior;
 
@@ -59,8 +60,8 @@
                     firstTitledPane.getStyleClass().add("first-titled-pane");
                 }
                 // TODO there may be a more efficient way to keep these in sync
-                getChildren().setAll(accordion.getPanes());                
-                while (c.next()) {          
+                getChildren().setAll(accordion.getPanes());
+                while (c.next()) {
                     removeTitledPaneListeners(c.getRemoved());
                     initTitledPaneListeners(c.getAddedSubList());
                 }
@@ -73,16 +74,29 @@
         }
 
         clipRect = new Rectangle();
-        setClip(clipRect);
+        getSkinnable().setClip(clipRect);
 
         initTitledPaneListeners(accordion.getPanes());
         getChildren().setAll(accordion.getPanes());
         requestLayout();
+
+        registerChangeListener(getSkinnable().widthProperty(), "WIDTH");
+        registerChangeListener(getSkinnable().heightProperty(), "HEIGHT");
+    }
+
+    @Override
+    protected void handleControlPropertyChanged(String property) {
+        super.handleControlPropertyChanged(property);
+        if (property == "WIDTH") {
+            clipRect.setWidth(getWidth());
+        } else if (property == "HEIGHT") {
+            clipRect.setHeight(getHeight());
+        }
     }
 
     @Override protected double computeMinHeight(double width) {
         double h = 0;
-        for (Node child: getManagedChildren()) {
+        for (Node child: getChildren()) {
             h += snapSize(child.minHeight(width));
         }
         return h;
@@ -90,16 +104,18 @@
 
     @Override protected double computePrefHeight(double width) {
         double h = 0;
-        // We want the current expanded pane or the currently collapsing one (previousPane).
-        // This is because getExpandedPane() will be null when the expanded pane
-        // is collapsing.
-        TitledPane expandedTitledPane = getSkinnable().getExpandedPane() != null ? getSkinnable().getExpandedPane() : previousPane;
-        if (expandedTitledPane != null) {
-            h = expandedTitledPane.prefHeight(-1);
+
+        if (expandedPane != null) {
+            h += expandedPane.prefHeight(-1);
         }
-        for (Node child: getManagedChildren()) {
+
+        if (previousPane != null && !previousPane.equals(expandedPane)) {
+            h += previousPane.prefHeight(-1);
+        }
+
+        for (Node child: getChildren()) {
             TitledPane pane = (TitledPane)child;
-            if (!pane.equals(expandedTitledPane)) {
+            if (!pane.equals(expandedPane) && !pane.equals(previousPane)) {
                 // The min height is the height of the TitledPane's title bar.
                 // We use the sum of all the TitledPane's title bars
                 // to compute the pref height of the accordion.
@@ -109,11 +125,15 @@
         return h + snapSpace(getInsets().getTop()) + snapSpace(getInsets().getBottom());
     }
 
-    @Override protected void layoutChildren() {
-        double w = snapSize(getWidth()) - (snapSpace(getInsets().getLeft()) + snapSpace(getInsets().getRight()));
-        double h = snapSize(getHeight()) - (snapSpace(getInsets().getTop()) + snapSpace(getInsets().getBottom()));
-        double x = snapSpace(getInsets().getLeft());
-        double y = snapSpace(getInsets().getTop());
+    @Override protected void layoutChildren(final double x, double y,
+            final double w, final double h) {
+
+        if (previousHeight != h) {
+            previousHeight = h;
+            resize = true;
+        } else {
+            resize = false;
+        }
 
         // TODO need to replace spacing with margins.
         double spacing = 0;
@@ -122,24 +142,12 @@
         // Compute height of all the collapsed panes
         for(Node n: getSkinnable().getPanes()) {
             TitledPane tp = ((TitledPane)n);
-            if (!tp.isExpanded()) {
+            if (!tp.equals(expandedPane)) {
                 // min height is the TitledPane's title bar height.
                 collapsedPanesHeight += snapSize(tp.minHeight(-1));
             }
         }
-
-        double maxTitledPaneHeight = 0;
-        if (previousPane != null && previousPane.equals(expandedPane) && getSkinnable().getExpandedPane() == null) {
-            if (getSkinnable().getPanes().size() ==  1) {
-                // Open and close same pane.
-                maxTitledPaneHeight = h;
-            } else {
-                // Open and close same pane if there are more than one pane.
-                maxTitledPaneHeight = h - collapsedPanesHeight + previousPane.minHeight(-1);
-            }
-        } else {
-            maxTitledPaneHeight = h - collapsedPanesHeight;
-        }
+        double maxTitledPaneHeight = h - collapsedPanesHeight;
 
         for(Node n: getSkinnable().getPanes()) {
             TitledPane tp = ((TitledPane)n);
@@ -183,27 +191,11 @@
         }
     }
 
-    @Override protected void setWidth(double value) {
-        super.setWidth(value);
-        clipRect.setWidth(value);
-    }
-
-    @Override protected void setHeight(double value) {
-        super.setHeight(value);
-        clipRect.setHeight(value);
-        if (previousHeight != value) {
-            previousHeight = value;
-            resize = true;
-        } else {
-            resize = false;
-        }
-    }
-
     private TitledPane expandedPane = null;
     private TitledPane previousPane = null;
     private Map<TitledPane, ChangeListener>listeners = new HashMap();
 
-    private void initTitledPaneListeners(List<? extends TitledPane> list) {        
+    private void initTitledPaneListeners(List<? extends TitledPane> list) {
         for (final TitledPane tp: list) {
             tp.setExpanded(tp == getSkinnable().getExpandedPane());
             if (tp.isExpanded()) {
@@ -214,16 +206,16 @@
             listeners.put(tp, changeListener);
         }
     }
-    
+
     private void removeTitledPaneListeners(List<? extends TitledPane> list) {
         for (final TitledPane tp: list) {
             if (listeners.containsKey(tp)) {
                 tp.expandedProperty().removeListener(listeners.get(tp));
                 listeners.remove(tp);
             }
-        }        
+        }
     }
-    
+
     private ChangeListener<Boolean> expandedPropertyListener(final TitledPane tp) {
         return new ChangeListener<Boolean>() {
             @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean wasExpanded, Boolean expanded) {
@@ -241,6 +233,6 @@
                     getSkinnable().setExpandedPane(null);
                 }
             }
-        };        
+        };
     }
 }
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ButtonSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ButtonSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -87,12 +87,12 @@
                 }
            }
         } else if (p == "PARENT") {
-            if (getSkinnable().getParent() == null && getScene() != null) {  
+            if (getSkinnable().getParent() == null && getSkinnable().getScene() != null) {  
                 if (getSkinnable().isDefaultButton()) {
-                    getScene().getAccelerators().remove(defaultAcceleratorKeyCodeCombination);
+                    getSkinnable().getScene().getAccelerators().remove(defaultAcceleratorKeyCodeCombination);
                 }
                 if (getSkinnable().isCancelButton()) {
-                    getScene().getAccelerators().remove(cancelAcceleratorKeyCodeCombination);
+                    getSkinnable().getScene().getAccelerators().remove(cancelAcceleratorKeyCodeCombination);
                 }
             }
         }
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/CellSkinBase.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/CellSkinBase.java	Mon Jul 30 13:08:41 2012 -0700
@@ -37,8 +37,9 @@
 import com.sun.javafx.scene.control.behavior.CellBehaviorBase;
 import javafx.beans.property.DoubleProperty;
 import javafx.beans.property.ReadOnlyDoubleProperty;
-import javafx.beans.property.ReadOnlyDoubleWrapper;
 import javafx.beans.value.WritableValue;
+import javafx.scene.control.IndexedCell;
+import javafx.scene.control.SkinBase;
 
 
 /**
@@ -53,7 +54,7 @@
      * is settable from CSS
      */
     private DoubleProperty cellSize;
-    boolean cellSizeSet = false;
+//    boolean cellSizeSet = false;
 
     public final double getCellSize() {
         return cellSize == null ? DEFAULT_CELL_SIZE : cellSize.get();
@@ -69,14 +70,15 @@
 
                 @Override
                 public void set(double value) {
-                    // Commented this out due to RT-19794, because otherwise
-                    // cellSizeSet would be false when the default caspian.css
-                    // cell size was set. This would lead to 
-                    // ListCellSkin.computePrefHeight computing the pref height
-                    // of the cell (which is about 22px), rather than use the 
-                    // value provided by caspian.css (which is 24px).
-                    cellSizeSet = true;//value != DEFAULT_CELL_SIZE;
-                    super.set(value);
+//                    // Commented this out due to RT-19794, because otherwise
+//                    // cellSizeSet would be false when the default caspian.css
+//                    // cell size was set. This would lead to 
+//                    // ListCellSkin.computePrefHeight computing the pref height
+//                    // of the cell (which is about 22px), rather than use the 
+//                    // value provided by caspian.css (which is 24px).
+//                    // cellSizeSet = true;//value != DEFAULT_CELL_SIZE;
+                     super.set(value);
+                    requestLayout();
                 }
                 
                 @Override
@@ -124,25 +126,27 @@
       * @treatAsPrivate implementation detail
       */
      private static class StyleableProperties {
-         private final static StyleableProperty<CellSkinBase,Number> CELL_SIZE =
-                new StyleableProperty<CellSkinBase,Number>("-fx-cell-size",
+         private final static StyleableProperty<Cell,Number> CELL_SIZE =
+                new StyleableProperty<Cell,Number>("-fx-cell-size",
                  SizeConverter.getInstance(), DEFAULT_CELL_SIZE) {
 
             @Override
-            public void set(CellSkinBase node, Number value) {
+            public void set(Cell node, Number value) {
                 double size = value == null ? DEFAULT_CELL_SIZE : ((Number)value).doubleValue();
                 // guard against a 0 or negative size
                 super.set(node, size <= 0 ? DEFAULT_CELL_SIZE : size);
             }
 
             @Override
-            public boolean isSettable(CellSkinBase n) {
-                return n.cellSize == null || !n.cellSize.isBound();
+            public boolean isSettable(Cell n) {
+                final CellSkinBase skin = (CellSkinBase) n.getSkin();
+                return skin.cellSize == null || !skin.cellSize.isBound();
             }
 
             @Override
-            public WritableValue<Number> getWritableValue(CellSkinBase n) {
-                return n.cellSizePropertyImpl();
+            public WritableValue<Number> getWritableValue(Cell n) {
+                final CellSkinBase skin = (CellSkinBase) n.getSkin();
+                return skin.cellSizePropertyImpl();
             }
         };
 
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/CheckBoxSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/CheckBoxSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -70,21 +70,20 @@
     }
 
 
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         Insets padding = getInsets();
 
-        final double w = getWidth() - padding.getLeft() - padding.getRight();
-        final double h = getHeight() - padding.getTop() - padding.getBottom();
         final double boxWidth = box.prefWidth(-1);
         final double boxHeight = box.prefHeight(-1);
-        final double labelWidth = Math.min(prefWidth(-1) - boxWidth, w - snapSize(boxWidth));
-        final double labelHeight = Math.min(prefHeight(labelWidth), h);
+        final double labelWidth = Math.min(getSkinnable().prefWidth(-1) - boxWidth, w - snapSize(boxWidth));
+        final double labelHeight = Math.min(getSkinnable().prefHeight(labelWidth), h);
         final double maxHeight = Math.max(boxHeight, labelHeight);
-        final double x = Utils.computeXOffset(w, labelWidth + boxWidth, getSkinnable().getAlignment().getHpos()) + padding.getLeft();
-        final double y = Utils.computeYOffset(h, maxHeight, getSkinnable().getAlignment().getVpos()) + padding.getTop();
+        final double xOffset = Utils.computeXOffset(w, labelWidth + boxWidth, getSkinnable().getAlignment().getHpos()) + padding.getLeft();
+        final double yOffset = Utils.computeYOffset(h, maxHeight, getSkinnable().getAlignment().getVpos()) + padding.getTop();
 
-        layoutLabelInArea(x + boxWidth, y, labelWidth, maxHeight, Pos.CENTER_LEFT);
+        layoutLabelInArea(xOffset + boxWidth, yOffset, labelWidth, maxHeight, Pos.CENTER_LEFT);
         box.resize(snapSize(boxWidth), snapSize(boxHeight));
-        positionInArea(box, x, y, boxWidth, maxHeight, getBaselineOffset(), HPos.CENTER, VPos.CENTER);
+        positionInArea(box, xOffset, yOffset, boxWidth, maxHeight, getBaselineOffset(), HPos.CENTER, VPos.CENTER);
     }
 }
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ChoiceBoxSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ChoiceBoxSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -46,6 +46,7 @@
 import javafx.scene.control.SelectionModel;
 import javafx.scene.control.Separator;
 import javafx.scene.control.SeparatorMenuItem;
+import javafx.scene.control.SkinBase;
 import javafx.scene.control.ToggleGroup;
 import javafx.scene.layout.StackPane;
 import javafx.scene.text.Text;
@@ -238,7 +239,7 @@
                 // choice box changes size when the popup is shown
                 // popup.setWidth(getWidth());
                 
-                popup.show(getSkinnable(), Side.BOTTOM, 0, y);
+                popup.show(getSkinnable(), Side.BOTTOM, 2, y);
             } else {
                 popup.hide();
             }
@@ -323,20 +324,15 @@
         }
     }
 
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         // open button width/height
         double obw = openButton.prefWidth(-1);
 
-        // calculate area available to the display (i.e. the label)
-        double height = getSkinnable().getHeight() - (getInsets().getTop()
-                + getInsets().getBottom());
-        double displayWidth = getSkinnable().getWidth() -
-                (getInsets().getLeft() + getInsets().getRight() + obw);
-
-        label.resizeRelocate(getInsets().getLeft(), getInsets().getTop(), displayWidth, height);
+        label.resizeRelocate(getInsets().getLeft(), getInsets().getTop(), w, h);
         openButton.resize(obw, openButton.prefHeight(-1));
         positionInArea(openButton, getWidth() - getInsets().getRight() - obw,
-                getInsets().getTop(), obw, height, /*baseline ignored*/0, HPos.CENTER, VPos.CENTER);
+                getInsets().getTop(), obw, h, /*baseline ignored*/0, HPos.CENTER, VPos.CENTER);
     }
 
     @Override protected double computeMinWidth(double height) {
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ColorPalette.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ColorPalette.java	Mon Jul 30 13:08:41 2012 -0700
@@ -111,6 +111,7 @@
         });
         
         initNavigation();
+        customColorGrid.getStyleClass().add("color-picker-grid");
         customColorGrid.setVisible(false);
         customColorGrid.setFocusTraversable(true);
         for (Color c : colorPicker.getCustomColors()) {
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ColorPickerSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ColorPickerSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -254,9 +254,10 @@
         }
     }
     
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         updateComboBoxMode();
-        super.layoutChildren();
+        super.layoutChildren(x,y,w,h);
     }
     
     /***************************************************************************
@@ -266,17 +267,18 @@
     **************************************************************************/
     
      private static class StyleableProperties {
-        private static final StyleableProperty<ColorPickerSkin,Boolean> COLOR_LABEL_VISIBLE = 
-                new StyleableProperty<ColorPickerSkin,Boolean>("-fx-color-label-visible",
+        private static final StyleableProperty<ColorPicker,Boolean> COLOR_LABEL_VISIBLE = 
+                new StyleableProperty<ColorPicker,Boolean>("-fx-color-label-visible",
                 BooleanConverter.getInstance(), Boolean.TRUE) {
 
-            @Override public WritableValue<Boolean> getWritableValue(ColorPickerSkin n) {
-                return n.colorLabelVisible;
+            @Override public boolean isSettable(ColorPicker n) {
+                final ColorPickerSkin skin = (ColorPickerSkin) n.getSkin();
+                return skin.colorLabelVisible == null || !skin.colorLabelVisible.isBound();
             }
-
-            @Override
-            public boolean isSettable(ColorPickerSkin n) {
-                return n.colorLabelVisible == null || !n.colorLabelVisible.isBound();
+            
+            @Override public WritableValue<Boolean> getWritableValue(ColorPicker n) {
+                final ColorPickerSkin skin = (ColorPickerSkin) n.getSkin();
+                return skin.colorLabelVisible;
             }
         };
         private static final List<StyleableProperty> STYLEABLES;
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxBaseSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxBaseSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -26,6 +26,7 @@
 package com.sun.javafx.scene.control.skin;
 
 import javafx.scene.control.ComboBoxBase;
+import javafx.scene.control.SkinBase;
 import com.sun.javafx.scene.control.behavior.ComboBoxBaseBehavior;
 import javafx.beans.value.ChangeListener;
 import javafx.beans.value.ObservableValue;
@@ -33,6 +34,7 @@
 import javafx.geometry.Insets;
 import javafx.geometry.VPos;
 import javafx.scene.Node;
+import javafx.scene.layout.Region;
 import javafx.scene.layout.StackPane;
 
 public abstract class ComboBoxBaseSkin<T> extends SkinBase<ComboBoxBase<T>, ComboBoxBaseBehavior<T>> {
@@ -48,16 +50,16 @@
     protected final void setMode(ComboBoxMode value) { mode = value; }
     
     public ComboBoxBaseSkin(final ComboBoxBase<T> comboBox, final ComboBoxBaseBehavior behavior) {
-        // Call the super method with the button we were just given in the 
+        // Call the super method with the ComboBox we were just given in the 
         // constructor, as well as an instance of the behavior class.
-        super(comboBox, behavior);//new ComboBoxBaseBehavior(comboBox));
+        super(comboBox, behavior);
         
         // open button / arrow
         arrow = new StackPane();
         arrow.setFocusTraversable(false);
         arrow.getStyleClass().setAll("arrow");
-        arrow.setMaxWidth(USE_PREF_SIZE);
-        arrow.setMaxHeight(USE_PREF_SIZE);
+        arrow.setMaxWidth(Region.USE_PREF_SIZE);
+        arrow.setMaxHeight(Region.USE_PREF_SIZE);
         arrowButton = new StackPane();
         arrowButton.setFocusTraversable(false);
         arrowButton.setId("arrow-button");
@@ -130,7 +132,8 @@
         return getMode() == ComboBoxMode.BUTTON;
     }
     
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         if (displayNode == null) {
             updateDisplayArea();
         }
@@ -138,12 +141,6 @@
         final Insets padding = getInsets();
         final Insets arrowButtonPadding = arrowButton.getInsets();
 
-        // x, y, w, h are the content area that will hold the label and arrow */
-        final double x = padding.getLeft();
-        final double y = padding.getTop();
-        final double w = getSkinnable().getWidth() - (padding.getLeft() + padding.getRight());
-        final double h = getSkinnable().getHeight() - (padding.getTop() + padding.getBottom());
-
         final double arrowWidth = snapSize(arrow.prefWidth(-1));
         final double arrowButtonWidth = (isButton()) ? 0 :
                 (snapSpace(arrowButtonPadding.getLeft()) + arrowWidth + 
@@ -155,9 +152,9 @@
         
         if (isButton()) return;
         
-        arrowButton.resize(arrowButtonWidth, getHeight() - padding.getTop() - padding.getBottom());
+        arrowButton.resize(arrowButtonWidth, h);
         positionInArea(arrowButton, getWidth() - padding.getRight() - arrowButtonWidth, 0, 
-                arrowButtonWidth, getHeight(), 0, HPos.CENTER, VPos.CENTER);
+                arrowButtonWidth, h, 0, HPos.CENTER, VPos.CENTER);
     }
     
     @Override protected double computePrefWidth(double height) {
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxListViewSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -267,7 +267,8 @@
         return 50;
     }
     
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         if (listViewSelectionDirty) {
             try {
                 listSelectionLock = true;
@@ -280,7 +281,7 @@
             }
         }
         
-        super.layoutChildren();
+        super.layoutChildren(x,y,w,h);
     }
     
     
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxPopupControl.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ComboBoxPopupControl.java	Mon Jul 30 13:08:41 2012 -0700
@@ -88,7 +88,7 @@
     
     private void positionAndShowPopup() {
         if (getPopup().getSkin() == null) {
-            getScene().getRoot().impl_processCSS(true);
+            getSkinnable().getScene().getRoot().impl_processCSS(true);
         }
         
         Point2D p = getPrefPopupPosition();
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ContextMenuContent.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ContextMenuContent.java	Mon Jul 30 13:08:41 2012 -0700
@@ -72,6 +72,7 @@
 import com.sun.javafx.css.StyleableProperty;
 import com.sun.javafx.css.StyleManager;
 import java.util.Iterator;
+import javafx.scene.control.*;
 import javafx.stage.Window;
 
 /**
@@ -825,7 +826,7 @@
         static {
 
             final List<StyleableProperty> styleables =
-                new ArrayList<StyleableProperty>(SkinBase.impl_CSS_STYLEABLES());
+                new ArrayList<StyleableProperty>(Region.impl_CSS_STYLEABLES());
 
             //
             // SkinBase only has Region's unique StlyleableProperty's, none of Nodes
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/EmbeddedTextContextMenuContent.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/EmbeddedTextContextMenuContent.java	Mon Jul 30 13:08:41 2012 -0700
@@ -61,14 +61,14 @@
             @Override public void invalidated(Observable arg0) {
                 if (contextMenu.getOwnerNode() instanceof TextArea) {
                     TextAreaSkin tas = (TextAreaSkin)((TextArea)contextMenu.getOwnerNode()).getSkin();
-                    tas.getProperties().addListener(new InvalidationListener() {
+                    tas.getSkinnable().getProperties().addListener(new InvalidationListener() {
                         @Override public void invalidated(Observable arg0) {
                             requestLayout();
                         }
                     });
                 } else if (contextMenu.getOwnerNode() instanceof TextField) {
                     TextFieldSkin tfs = (TextFieldSkin)((TextField)contextMenu.getOwnerNode()).getSkin();
-                    tfs.getProperties().addListener(new InvalidationListener() {
+                    tfs.getSkinnable().getProperties().addListener(new InvalidationListener() {
                         @Override public void invalidated(Observable arg0) {
                             requestLayout();
                         }
@@ -141,15 +141,15 @@
         if (contextMenu.getOwnerNode() instanceof TextArea) {
             TextArea ta = (TextArea)contextMenu.getOwnerNode();
             TextAreaSkin tas = (TextAreaSkin)ta.getSkin();
-            sceneX = Double.valueOf(tas.getProperties().get("CONTEXT_MENU_SCENE_X").toString());
-            screenX = Double.valueOf(tas.getProperties().get("CONTEXT_MENU_SCREEN_X").toString());
-            tas.getProperties().clear();
+            sceneX = Double.valueOf(tas.getSkinnable().getProperties().get("CONTEXT_MENU_SCENE_X").toString());
+            screenX = Double.valueOf(tas.getSkinnable().getProperties().get("CONTEXT_MENU_SCREEN_X").toString());
+            tas.getSkinnable().getProperties().clear();
         } else if (contextMenu.getOwnerNode() instanceof TextField) {
             TextField tf = (TextField)contextMenu.getOwnerNode();
             TextFieldSkin tfs = (TextFieldSkin)tf.getSkin();
-            sceneX = Double.valueOf(tfs.getProperties().get("CONTEXT_MENU_SCENE_X").toString());
-            screenX = Double.valueOf(tfs.getProperties().get("CONTEXT_MENU_SCREEN_X").toString());
-            tfs.getProperties().clear();
+            sceneX = Double.valueOf(tfs.getSkinnable().getProperties().get("CONTEXT_MENU_SCENE_X").toString());
+            screenX = Double.valueOf(tfs.getSkinnable().getProperties().get("CONTEXT_MENU_SCREEN_X").toString());
+            tfs.getSkinnable().getProperties().clear();
         }
         if (sceneX == 0) {
             pointerX = width/2;
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/FXVKSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/FXVKSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -206,7 +206,7 @@
 
                         if (oldNode == null || oldNode.getScene() != attachedNode.getScene()) {
                             fxvk.setPrefWidth(scene.getWidth());
-                            fxvk.setMaxWidth(USE_PREF_SIZE);
+                            fxvk.setMaxWidth(Region.USE_PREF_SIZE);
                             fxvk.setPrefHeight(200);
                         }
 
@@ -221,10 +221,10 @@
 
                         if (oldNode == null || oldNode.getScene() != attachedNode.getScene()) {
                             fxvk.setPrefWidth(VK_WIDTH);
-                            fxvk.setMinWidth(USE_PREF_SIZE);
-                            fxvk.setMaxWidth(USE_PREF_SIZE);
+                            fxvk.setMinWidth(Region.USE_PREF_SIZE);
+                            fxvk.setMaxWidth(Region.USE_PREF_SIZE);
                             fxvk.setPrefHeight(VK_HEIGHT);
-                            fxvk.setMinHeight(USE_PREF_SIZE);
+                            fxvk.setMinHeight(Region.USE_PREF_SIZE);
                         }
                     }
                 } else {
@@ -648,7 +648,8 @@
         }
     }
 
-    @Override public void layoutChildren() {
+    @Override public void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         double kw, kh;
         Insets insets = getInsets();
         if (vbox == null) {
@@ -688,7 +689,7 @@
             createKeys();
         }
 
-        super.layoutChildren();
+//        super.layoutChildren();
 
         for (Node vnode : vbox.getChildren()) {
             hbox = (HBox)vnode;
@@ -781,9 +782,9 @@
                 final double h = insets.getTop() + insets.getBottom() +
                                  nRows * primarySkin.keyHeight + (nRows-1) * vbox.getSpacing();
                 secondaryVK.setPrefWidth(w);
-                secondaryVK.setMinWidth(USE_PREF_SIZE);
+                secondaryVK.setMinWidth(Region.USE_PREF_SIZE);
                 secondaryVK.setPrefHeight(h);
-                secondaryVK.setMinHeight(USE_PREF_SIZE);
+                secondaryVK.setMinHeight(Region.USE_PREF_SIZE);
                 Platform.runLater(new Runnable() {
                     public void run() {
                         // Position popup on screen
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/LabeledImpl.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/LabeledImpl.java	Mon Jul 30 13:08:41 2012 -0700
@@ -41,6 +41,7 @@
 import java.util.List;
 import javafx.beans.value.WritableValue;
 import javafx.scene.Parent;
+import javafx.scene.layout.Region;
 
 
 public class LabeledImpl extends Label {
@@ -137,7 +138,7 @@
             // -fx-opacity (for example) would be meaningless to the Labeled. 
             // 
             final List<StyleableProperty> labeledStyleables = Labeled.impl_CSS_STYLEABLES();
-            final List<StyleableProperty> parentStyleables = Parent.impl_CSS_STYLEABLES();
+            final List<StyleableProperty> parentStyleables = Region.impl_CSS_STYLEABLES();
             final List<StyleableProperty> styleables = 
                 new ArrayList<StyleableProperty>(labeledStyleables);
             styleables.removeAll(parentStyleables);
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/LabeledSkinBase.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/LabeledSkinBase.java	Mon Jul 30 13:08:41 2012 -0700
@@ -29,9 +29,7 @@
 import com.sun.javafx.tk.FontMetrics;
 import javafx.beans.InvalidationListener;
 import javafx.beans.Observable;
-import javafx.collections.ObservableList;
 import javafx.geometry.HPos;
-import javafx.geometry.Insets;
 import javafx.geometry.Orientation;
 import javafx.geometry.Pos;
 import javafx.geometry.VPos;
@@ -49,17 +47,15 @@
 import javafx.scene.shape.Line;
 import javafx.scene.shape.Rectangle;
 import javafx.scene.text.Font;
-import javafx.scene.text.Text;
 
 import com.sun.javafx.scene.control.behavior.BehaviorBase;
 import com.sun.javafx.scene.control.behavior.TextBinding;
-import java.util.Collections;
 
 import static javafx.scene.control.ContentDisplay.*;
 import static javafx.scene.control.OverrunStyle.*;
 import javafx.scene.image.ImageView;
 
-public abstract class LabeledSkinBase<C extends Labeled, B extends BehaviorBase<C>> extends SkinBase<C, B> {
+public abstract class LabeledSkinBase<C extends Labeled, B extends BehaviorBase<C>> extends javafx.scene.control.SkinBase<C, B> {
 
     /**
      *  The Text node used to display the text. This is package only
@@ -471,7 +467,7 @@
             if (w == -1) {
                 w = availableWidth;
             }
-            double minW = Math.min(minWidth(-1), availableWidth);
+            double minW = Math.min(getSkinnable().minWidth(-1), availableWidth);
             if (horizontalPosition && !isIgnoreGraphic()) {
                 double graphicW = (labeled.getGraphic().getLayoutBounds().getWidth() + labeled.getGraphicTextGap());
                 w -= graphicW;
@@ -490,7 +486,7 @@
             if (h == -1) {
                 h = availableHeight;
             }
-            double minH = Math.min(minHeight(w), availableHeight);
+            double minH = Math.min(getSkinnable().minHeight(w), availableHeight);
             if (verticalPosition && labeled.getGraphic() != null) {
                 double graphicH = labeled.getGraphic().getLayoutBounds().getHeight() + labeled.getGraphicTextGap();
                 h -= graphicH;
@@ -849,12 +845,8 @@
      *    and the labeled's hpos and vpos
      *  - position the graphic and text
      */
-    @Override protected void layoutChildren() {
-        final double x = leftPadding();
-        final double y = topPadding();
-        final double w = getWidth() - (leftPadding() + rightPadding());
-        final double h = getHeight() - (topPadding() + bottomPadding());
-
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         layoutLabelInArea(x, y, w, h);
     }
 
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ListCellSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ListCellSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -45,13 +45,13 @@
     }
  
     @Override protected double computePrefHeight(double width) {
-        if (cellSizeSet) {
+//        if (cellSizeSet) {
             // Added the comparison between the default cell size and the requested
             // cell size to prevent the issue identified in RT-19873.
             double cellSize = getCellSize();
             return cellSize == DEFAULT_CELL_SIZE ? super.computePrefHeight(width) : cellSize;
-        } else {
-            return Math.max(DEFAULT_CELL_SIZE, super.computePrefHeight(width));
-        }
+//        } else {
+//            return Math.max(DEFAULT_CELL_SIZE, super.computePrefHeight(width));
+//        }
     }
 }
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ListViewSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ListViewSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -243,17 +243,13 @@
 //    }
 
     @Override
-    protected void layoutChildren() {
+    protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         if (itemCountDirty) {
             updateCellCount();
             itemCountDirty = false;
         }
         
-        double x = getInsets().getLeft();
-        double y = getInsets().getTop();
-        double w = getWidth() - (getInsets().getLeft() + getInsets().getRight());
-        double h = getHeight() - (getInsets().getTop() + getInsets().getBottom());
-        
         flow.resizeRelocate(x, y, w, h);
     }
     
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/MenuBarSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/MenuBarSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -50,6 +50,7 @@
 import javafx.scene.control.MenuButton;
 import javafx.scene.control.MenuItem;
 import javafx.scene.control.SeparatorMenuItem;
+import javafx.scene.control.SkinBase;
 import javafx.scene.input.KeyEvent;
 import javafx.scene.input.MouseEvent;
 import javafx.scene.layout.HBox;
@@ -188,6 +189,7 @@
         super(control, new BehaviorBase<MenuBar>(control));
         
         container = new HBox();
+        container.getStyleClass().add("container");
         getChildren().add(container);
         
         // Key navigation 
@@ -321,14 +323,14 @@
            acceleratorKeyCombo = KeyCombination.keyCombination("F10");
         }
         getSkinnable().getParent().getScene().getAccelerators().put(acceleratorKeyCombo, firstMenuRunnable);
-        engine = new TraversalEngine(this, false) {
+        engine = new TraversalEngine(getSkinnable(), false) {
             @Override public void trav(Node node, Direction dir) {
                 direction = dir;
                 super.trav(node,dir);
             }
         };
         engine.addTraverseListener(this);
-        setImpl_traversalEngine(engine);
+        getSkinnable().setImpl_traversalEngine(engine);
         
         control.sceneProperty().addListener(new ChangeListener<Scene>() {
             @Override
@@ -472,7 +474,7 @@
                 MenuBarSkin curMBSkin = (systemMenuMap != null) ? systemMenuMap.get(stage) : null;
                 if (getSkinnable().isUseSystemMenuBar() && !menusContainCustomMenuItem()) {
                     if (curMBSkin != null &&
-                        (curMBSkin.getScene() == null || curMBSkin.getScene().getWindow() == null)) {
+                        (curMBSkin.getSkinnable().getScene() == null || curMBSkin.getSkinnable().getScene().getWindow() == null)) {
                         // Fix for RT-20951. The MenuBar may have been removed from the Stage.
                         systemMenuMap.remove(stage);
                         curMBSkin = null;
@@ -910,13 +912,9 @@
      * Layout the menu bar. This is a simple horizontal layout like an hbox.
      * Any menu items which don't fit into it will simply be made invisible.
      */
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         // layout the menus one after another
-        double x = getInsets().getLeft();
-        double y = getInsets().getTop();
-        double w = getWidth() - (getInsets().getLeft() + getInsets().getRight());
-        double h = getHeight() - (getInsets().getTop() + getInsets().getBottom());
-        
         container.resizeRelocate(x, y, w, h);
     }
 
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/MenuButtonSkinBase.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/MenuButtonSkinBase.java	Mon Jul 30 13:08:41 2012 -0700
@@ -37,6 +37,7 @@
 import javafx.scene.control.ContextMenu;
 import javafx.scene.control.MenuButton;
 import javafx.scene.control.MenuItem;
+import javafx.scene.control.SkinBase;
 import javafx.scene.input.MouseEvent;
 import javafx.scene.layout.StackPane;
 
@@ -45,6 +46,7 @@
 import javafx.event.Event;
 import javafx.event.EventType;
 import javafx.scene.control.Menu;
+import javafx.scene.layout.Region;
 
 /**
  * Base class for MenuButtonSkin and SplitMenuButtonSkin. It consists of the
@@ -103,8 +105,8 @@
 
         arrow = new StackPane();
         arrow.getStyleClass().setAll("arrow");
-        arrow.setMaxWidth(USE_PREF_SIZE);
-        arrow.setMaxHeight(USE_PREF_SIZE);
+        arrow.setMaxWidth(Region.USE_PREF_SIZE);
+        arrow.setMaxHeight(Region.USE_PREF_SIZE);
 
         arrowButton = new StackPane();
         arrowButton.getStyleClass().setAll("arrow-button");
@@ -262,16 +264,11 @@
         return getSkinnable().prefHeight(width);
     }
 
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         final Insets padding = getInsets();
         final Insets arrowButtonPadding = arrowButton.getInsets();
 
-        // x, y, w, h are the content area that will hold the label and arrow */
-        final double x = padding.getLeft();
-        final double y = padding.getTop();
-        final double w = getWidth() - (padding.getLeft() + padding.getRight());
-        final double h = getHeight() - (padding.getTop() + padding.getBottom());
-
         final double arrowWidth = arrow.prefWidth(-1);
         final double arrowButtonWidth = arrowButtonPadding.getLeft() + arrowWidth + arrowButtonPadding.getRight();
 
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/PaginationSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/PaginationSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -106,9 +106,9 @@
     public PaginationSkin(final Pagination pagination) {
         super(pagination, new PaginationBehavior(pagination));
 
-        setManaged(false);
+//        setManaged(false);
         clipRect = new Rectangle();
-        setClip(clipRect);
+        getSkinnable().setClip(clipRect);
 
         this.pagination = pagination;
 
@@ -134,6 +134,8 @@
             }
         });
 
+        registerChangeListener(pagination.widthProperty(), "WIDTH");
+        registerChangeListener(pagination.heightProperty(), "HEIGHT");
         registerChangeListener(pagination.pageCountProperty(), "PAGE_COUNT");
         registerChangeListener(pagination.pageFactoryProperty(), "PAGE_FACTORY");
 
@@ -164,7 +166,7 @@
     private int direction;
 
     private void initializeSwipeAndTouchHandlers() {
-        setOnTouchPressed(new EventHandler<TouchEvent>() {
+        getSkinnable().setOnTouchPressed(new EventHandler<TouchEvent>() {
             @Override public void handle(TouchEvent e) {
                 if (touchEventId == -1) {
                     touchEventId = e.getTouchPoint().getId();
@@ -179,7 +181,7 @@
             }
         });
 
-        setOnTouchMoved(new EventHandler<TouchEvent>() {
+        getSkinnable().setOnTouchMoved(new EventHandler<TouchEvent>() {
             @Override public void handle(TouchEvent e) {
                 if (touchEventId != e.getTouchPoint().getId()) {
                     return;
@@ -259,7 +261,7 @@
             }
         });
 
-        setOnTouchReleased(new EventHandler<TouchEvent>() {
+        getSkinnable().setOnTouchReleased(new EventHandler<TouchEvent>() {
             @Override public void handle(TouchEvent e) {
                 if (touchEventId != e.getTouchPoint().getId()) {
                     return;
@@ -668,20 +670,15 @@
             resetIndexes(false);
             navigation.initializePageIndicators();
             navigation.updatePageIndicators();
+        } else if (p == "WIDTH") {
+            clipRect.setWidth(getWidth());
+        } else if (p == "HEIGHT") {
+            clipRect.setHeight(getHeight());
         }
+        
         requestLayout();
     }
 
-    @Override protected void setWidth(double value) {
-        super.setWidth(value);
-        clipRect.setWidth(value);
-    }
-
-    @Override protected void setHeight(double value) {
-        super.setHeight(value);
-        clipRect.setHeight(value);
-    }
-
     @Override protected double computeMinWidth(double height) {
         double left = snapSpace(getInsets().getLeft());
         double right = snapSpace(getInsets().getRight());
@@ -710,19 +707,16 @@
         return top + currentStackPane.prefHeight(width) + navigationHeight + bottom;
     }
 
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         double left = snapSpace(getInsets().getLeft());
-        double right = snapSpace(getInsets().getRight());
         double top = snapSpace(getInsets().getTop());
-        double bottom = snapSpace(getInsets().getBottom());
-        double width = snapSize(getWidth() - (left + right));
-        double height = snapSize(getHeight() - (top + bottom));
         double navigationHeight = navigation.isVisible() ? snapSize(navigation.prefHeight(-1)) : 0;
-        double stackPaneHeight = snapSize(height - navigationHeight);
+        double stackPaneHeight = snapSize(h - navigationHeight);
 
-        layoutInArea(currentStackPane, left, top, width, stackPaneHeight, 0, HPos.CENTER, VPos.CENTER);
-        layoutInArea(nextStackPane, left, top, width, stackPaneHeight, 0, HPos.CENTER, VPos.CENTER);
-        layoutInArea(navigation, left, stackPaneHeight, width, navigationHeight, 0, HPos.CENTER, VPos.CENTER);
+        layoutInArea(currentStackPane, left, top, w, stackPaneHeight, 0, HPos.CENTER, VPos.CENTER);
+        layoutInArea(nextStackPane, left, top, w, stackPaneHeight, 0, HPos.CENTER, VPos.CENTER);
+        layoutInArea(navigation, left, stackPaneHeight, h, navigationHeight, 0, HPos.CENTER, VPos.CENTER);
     }
 
     class NavigationControl extends StackPane {
@@ -1246,63 +1240,71 @@
     private static final Boolean DEFAULT_TOOLTIP_VISIBLE = Boolean.FALSE;
 
     private static class StyleableProperties {
-        private static final StyleableProperty<PaginationSkin,Boolean> ARROWS_VISIBLE =
-            new StyleableProperty<PaginationSkin,Boolean>("-fx-arrows-visible",
+        private static final StyleableProperty<Pagination,Boolean> ARROWS_VISIBLE =
+            new StyleableProperty<Pagination,Boolean>("-fx-arrows-visible",
                 BooleanConverter.getInstance(), DEFAULT_ARROW_VISIBLE) {
 
             @Override
-            public boolean isSettable(PaginationSkin n) {
-                return n.arrowsVisible == null || !n.arrowsVisible.isBound();
+            public boolean isSettable(Pagination n) {
+                final PaginationSkin skin = (PaginationSkin) n.getSkin();
+                return skin.arrowsVisible == null || !skin.arrowsVisible.isBound();
             }
 
             @Override
-            public WritableValue<Boolean> getWritableValue(PaginationSkin n) {
-                return n.arrowsVisibleProperty();
+            public WritableValue<Boolean> getWritableValue(Pagination n) {
+                final PaginationSkin skin = (PaginationSkin) n.getSkin();
+                return skin.arrowsVisibleProperty();
             }
         };
 
-        private static final StyleableProperty<PaginationSkin,Boolean> PAGE_INFORMATION_VISIBLE =
-            new StyleableProperty<PaginationSkin,Boolean>("-fx-page-information-visible",
+        private static final StyleableProperty<Pagination,Boolean> PAGE_INFORMATION_VISIBLE =
+            new StyleableProperty<Pagination,Boolean>("-fx-page-information-visible",
                 BooleanConverter.getInstance(), DEFAULT_PAGE_INFORMATION_VISIBLE) {
 
             @Override
-            public boolean isSettable(PaginationSkin n) {
-                return n.pageInformationVisible == null || !n.pageInformationVisible.isBound();
+            public boolean isSettable(Pagination n) {
+                final PaginationSkin skin = (PaginationSkin) n.getSkin();
+                return skin.pageInformationVisible == null || !skin.pageInformationVisible.isBound();
             }
 
             @Override
-            public WritableValue<Boolean> getWritableValue(PaginationSkin n) {
-                return n.pageInformationVisibleProperty();
+            public WritableValue<Boolean> getWritableValue(Pagination n) {
+                final PaginationSkin skin = (PaginationSkin) n.getSkin();
+                return skin.pageInformationVisibleProperty();
             }
         };
 
-        private static final StyleableProperty<PaginationSkin,Side> PAGE_INFORMATION_ALIGNMENT =
-            new StyleableProperty<PaginationSkin,Side>("-fx-page-information-alignment",
+        private static final StyleableProperty<Pagination,Side> PAGE_INFORMATION_ALIGNMENT =
+            new StyleableProperty<Pagination,Side>("-fx-page-information-alignment",
                 new EnumConverter<Side>(Side.class), DEFAULT_PAGE_INFORMATION_ALIGNMENT) {
 
             @Override
-            public boolean isSettable(PaginationSkin n) {
-                return n.pageInformationAlignment == null || !n.pageInformationAlignment.isBound();
+            public boolean isSettable(Pagination n) {
+                final PaginationSkin skin = (PaginationSkin) n.getSkin();
+                return skin.pageInformationAlignment == null || !skin.pageInformationAlignment.isBound();
             }
 
             @Override
-            public WritableValue<Side> getWritableValue(PaginationSkin n) {
-                return n.pageInformationAlignmentProperty();
+            public WritableValue<Side> getWritableValue(Pagination n) {
+                final PaginationSkin skin = (PaginationSkin) n.getSkin();
+                return skin.pageInformationAlignmentProperty();
             }
         };
 
-        private static final StyleableProperty<PaginationSkin,Boolean> TOOLTIP_VISIBLE =
-            new StyleableProperty<PaginationSkin,Boolean>("-fx-tooltip-visible",
+        private static final StyleableProperty<Pagination,Boolean> TOOLTIP_VISIBLE =
+            new StyleableProperty<Pagination,Boolean>("-fx-tooltip-visible",
                 BooleanConverter.getInstance(), DEFAULT_TOOLTIP_VISIBLE) {
 
             @Override
-            public boolean isSettable(PaginationSkin n) {
-                return n.tooltipVisible == null || !n.tooltipVisible.isBound();
+            public boolean isSettable(Pagination n) {
+                final PaginationSkin skin = (PaginationSkin) n.getSkin();
+                return skin.tooltipVisible == null || !skin.tooltipVisible.isBound();
             }
 
             @Override
-            public WritableValue<Boolean> getWritableValue(PaginationSkin n) {
-                return n.tooltipVisibleProperty();
+            public WritableValue<Boolean> getWritableValue(Pagination n) {
+                final PaginationSkin skin = (PaginationSkin) n.getSkin();
+                return skin.tooltipVisibleProperty();
             }
         };
 
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ProgressBarSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ProgressBarSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -38,6 +38,7 @@
 import javafx.event.ActionEvent;
 import javafx.event.EventHandler;
 import javafx.scene.control.ProgressBar;
+import javafx.scene.control.SkinBase;
 import javafx.scene.layout.StackPane;
 import javafx.scene.shape.Rectangle;
 import javafx.util.Duration;
@@ -270,7 +271,7 @@
          * used to prevent an indeterminate bar from drawing outside the skin
          */
         clipRectangle = new Rectangle();
-        setClip(clipRectangle);
+        getSkinnable().setClip(clipRectangle);
 
         initialize();
         requestLayout();
@@ -372,15 +373,10 @@
         return getSkinnable().prefHeight(width);
     }
 
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         boolean isIndeterminate = getSkinnable().isIndeterminate();
 
-        // compute x,y,w,h of content area
-        double x = getInsets().getLeft();
-        double y = getInsets().getTop();
-        double w = getWidth() - (getInsets().getLeft() + getInsets().getRight());
-        double h = getHeight() - (getInsets().getTop() + getInsets().getBottom());
-
         // Prevent the indeterminate bar from drawing outside the skin
         if (clipRectangle != null) {
             clipRectangle.setWidth(getWidth());
@@ -418,67 +414,75 @@
       * @treatAsPrivate implementation detail
       */
      private static class StyleableProperties {
-         private static final StyleableProperty<ProgressBarSkin,Number> INDETERMINATE_BAR_LENGTH =
-            new StyleableProperty<ProgressBarSkin,Number>("-fx-indeterminate-bar-length",
+         private static final StyleableProperty<ProgressBar,Number> INDETERMINATE_BAR_LENGTH =
+            new StyleableProperty<ProgressBar,Number>("-fx-indeterminate-bar-length",
                  SizeConverter.getInstance(), 60.0) {
 
             @Override
-            public boolean isSettable(ProgressBarSkin n) {
-                return n.indeterminateBarLength == null ||
-                        !n.indeterminateBarLength.isBound();
+            public boolean isSettable(ProgressBar n) {
+                final ProgressBarSkin skin = (ProgressBarSkin) n.getSkin();
+                return skin.indeterminateBarLength == null ||
+                        !skin.indeterminateBarLength.isBound();
             }
 
             @Override
-            public WritableValue<Number> getWritableValue(ProgressBarSkin n) {
-                return n.indeterminateBarLengthProperty();
+            public WritableValue<Number> getWritableValue(ProgressBar n) {
+                final ProgressBarSkin skin = (ProgressBarSkin) n.getSkin();
+                return skin.indeterminateBarLengthProperty();
             }
         };
          
-         private static final StyleableProperty<ProgressBarSkin,Boolean> INDETERMINATE_BAR_ESCAPE =
-            new StyleableProperty<ProgressBarSkin,Boolean>("-fx-indeterminate-bar-escape",
+         private static final StyleableProperty<ProgressBar,Boolean> INDETERMINATE_BAR_ESCAPE =
+            new StyleableProperty<ProgressBar,Boolean>("-fx-indeterminate-bar-escape",
                  BooleanConverter.getInstance(), Boolean.TRUE) {
 
             @Override
-            public boolean isSettable(ProgressBarSkin n) {
-                return n.indeterminateBarEscape == null || 
-                        !n.indeterminateBarEscape.isBound();
+            public boolean isSettable(ProgressBar n) {
+                final ProgressBarSkin skin = (ProgressBarSkin) n.getSkin();
+                return skin.indeterminateBarEscape == null || 
+                        !skin.indeterminateBarEscape.isBound();
             }
 
             @Override
-            public WritableValue<Boolean> getWritableValue(ProgressBarSkin n) {
-                return n.indeterminateBarEscapeProperty();
+            public WritableValue<Boolean> getWritableValue(ProgressBar n) {
+                final ProgressBarSkin skin = (ProgressBarSkin) n.getSkin();
+                return skin.indeterminateBarEscapeProperty();
             }
         };
          
-         private static final StyleableProperty<ProgressBarSkin,Boolean> INDETERMINATE_BAR_FLIP =
-            new StyleableProperty<ProgressBarSkin,Boolean>("-fx-indeterminate-bar-flip",
+         private static final StyleableProperty<ProgressBar,Boolean> INDETERMINATE_BAR_FLIP =
+            new StyleableProperty<ProgressBar,Boolean>("-fx-indeterminate-bar-flip",
                  BooleanConverter.getInstance(), Boolean.TRUE) {
 
             @Override
-            public boolean isSettable(ProgressBarSkin n) {
-                return n.indeterminateBarFlip == null ||
-                        !n.indeterminateBarFlip.isBound();
+            public boolean isSettable(ProgressBar n) {
+                final ProgressBarSkin skin = (ProgressBarSkin) n.getSkin();
+                return skin.indeterminateBarFlip == null ||
+                        !skin.indeterminateBarFlip.isBound();
             }
 
             @Override
-            public WritableValue<Boolean> getWritableValue(ProgressBarSkin n) {
-                return n.indeterminateBarFlipProperty();
+            public WritableValue<Boolean> getWritableValue(ProgressBar n) {
+                final ProgressBarSkin skin = (ProgressBarSkin) n.getSkin();
+                return skin.indeterminateBarFlipProperty();
             }
         }; 
          
-         private static final StyleableProperty<ProgressBarSkin,Number> INDETERMINATE_BAR_ANIMATION_TIME =
-            new StyleableProperty<ProgressBarSkin,Number>("-fx-indeterminate-bar-animation-time",
+         private static final StyleableProperty<ProgressBar,Number> INDETERMINATE_BAR_ANIMATION_TIME =
+            new StyleableProperty<ProgressBar,Number>("-fx-indeterminate-bar-animation-time",
                  SizeConverter.getInstance(), 2.0) {
 
             @Override
-            public boolean isSettable(ProgressBarSkin n) {
-                return n.indeterminateBarAnimationTime == null ||
-                        !n.indeterminateBarAnimationTime.isBound();
+            public boolean isSettable(ProgressBar n) {
+                final ProgressBarSkin skin = (ProgressBarSkin) n.getSkin();
+                return skin.indeterminateBarAnimationTime == null ||
+                        !skin.indeterminateBarAnimationTime.isBound();
             }
 
             @Override
-            public WritableValue<Number> getWritableValue(ProgressBarSkin n) {
-                return n.indeterminateBarAnimationTimeProperty();
+            public WritableValue<Number> getWritableValue(ProgressBar n) {
+                final ProgressBarSkin skin = (ProgressBarSkin) n.getSkin();
+                return skin.indeterminateBarAnimationTimeProperty();
             }
         };
 
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ProgressIndicatorSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ProgressIndicatorSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -35,6 +35,7 @@
 import javafx.geometry.VPos;
 import javafx.scene.Group;
 import javafx.scene.control.ProgressIndicator;
+import javafx.scene.control.SkinBase;
 import javafx.scene.layout.Region;
 import javafx.scene.layout.StackPane;
 import javafx.scene.paint.Color;
@@ -191,14 +192,14 @@
         }
     }
 
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         if (spinner != null && getSkinnable().isIndeterminate()) { 
             spinner.layoutChildren();
-            spinner.resizeRelocate(0, 0, getSkinnable().getWidth(), getSkinnable().getHeight());
-        }
-        else if (determinateIndicator != null) { 
+            spinner.resizeRelocate(0, 0, w, h);
+        } else if (determinateIndicator != null) { 
             determinateIndicator.layoutChildren();
-            determinateIndicator.resizeRelocate(0, 0, getSkinnable().getWidth(), getSkinnable().getHeight());
+            determinateIndicator.resizeRelocate(0, 0, w, h);
         }
     }
 
@@ -229,6 +230,8 @@
         public DeterminateIndicator(ProgressIndicator control, ProgressIndicatorSkin s) {
             this.control = control;
             this.skin = s;
+            
+            getStyleClass().add("determinate-indicator");
 
             intProgress = (int) Math.round(control.getProgress() * 100.0) ;
             degProgress = (int) (360 * control.getProgress());
@@ -553,19 +556,21 @@
      * @treatAsPrivate implementation detail
      */
     private static class StyleableProperties {
-        private static final StyleableProperty<ProgressIndicatorSkin,Paint> PROGRESS_COLOR =
-            new StyleableProperty<ProgressIndicatorSkin,Paint>("-fx-progress-color",
+        private static final StyleableProperty<ProgressIndicator,Paint> PROGRESS_COLOR =
+            new StyleableProperty<ProgressIndicator,Paint>("-fx-progress-color",
                 PaintConverter.getInstance(), Color.DODGERBLUE) {
 
             @Override
-            public boolean isSettable(ProgressIndicatorSkin n) {
-                return n.progressColor == null || 
-                        !n.progressColor.isBound();
+            public boolean isSettable(ProgressIndicator n) {
+                final ProgressIndicatorSkin skin = (ProgressIndicatorSkin) n.getSkin();
+                return skin.progressColor == null || 
+                        !skin.progressColor.isBound();
             }
 
             @Override
-            public WritableValue<Paint> getWritableValue(ProgressIndicatorSkin n) {
-                return n.progressColor;
+            public WritableValue<Paint> getWritableValue(ProgressIndicator n) {
+                final ProgressIndicatorSkin skin = (ProgressIndicatorSkin) n.getSkin();
+                return skin.progressColor;
             }
         };
 
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/RadioButtonSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/RadioButtonSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -87,21 +87,20 @@
                         getInsets().getTop() + radio.prefHeight(-1) + getInsets().getBottom());
     }
 
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         Insets padding = getInsets();
 
-        final double w = getWidth() - padding.getLeft() - padding.getRight();
-        final double h = getHeight() - padding.getTop() - padding.getBottom();
         final double radioWidth = radio.prefWidth(-1);
         final double radioHeight = radio.prefHeight(-1);
-        final double labelWidth = Math.min(prefWidth(-1) - radioWidth, w - snapSize(radioWidth));
-        final double labelHeight = Math.min(prefHeight(labelWidth), h);
+        final double labelWidth = Math.min(getSkinnable().prefWidth(-1) - radioWidth, w - snapSize(radioWidth));
+        final double labelHeight = Math.min(getSkinnable().prefHeight(labelWidth), h);
         final double maxHeight = Math.max(radioHeight, labelHeight);
-        final double x = Utils.computeXOffset(w, labelWidth + radioWidth, getSkinnable().getAlignment().getHpos()) + padding.getLeft();
-        final double y = Utils.computeYOffset(h, maxHeight, getSkinnable().getAlignment().getVpos()) + padding.getTop();
+        final double xOffset = Utils.computeXOffset(w, labelWidth + radioWidth, getSkinnable().getAlignment().getHpos()) + padding.getLeft();
+        final double yOffset = Utils.computeYOffset(h, maxHeight, getSkinnable().getAlignment().getVpos()) + padding.getTop();
 
-        layoutLabelInArea(x + radioWidth, y, labelWidth, maxHeight, Pos.CENTER_LEFT);
+        layoutLabelInArea(xOffset + radioWidth, yOffset, labelWidth, maxHeight, Pos.CENTER_LEFT);
         radio.resize(snapSize(radioWidth), snapSize(radioHeight));
-        positionInArea(radio, x, y, radioWidth, maxHeight, getBaselineOffset(), HPos.CENTER, VPos.CENTER);
+        positionInArea(radio, xOffset, yOffset, radioWidth, maxHeight, getBaselineOffset(), HPos.CENTER, VPos.CENTER);
     }
 }
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollBarSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollBarSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -37,10 +37,12 @@
 import javafx.scene.input.ScrollEvent;
 
 import com.sun.javafx.Utils;
+import com.sun.javafx.scene.control.behavior.BehaviorBase;
 import com.sun.javafx.scene.control.behavior.ScrollBarBehavior;
 import javafx.event.EventType;
+import javafx.scene.control.Control;
 
-public class ScrollBarSkin extends SkinBase<ScrollBar, ScrollBarBehavior> {
+public class ScrollBarSkin extends javafx.scene.control.SkinBase<ScrollBar, ScrollBarBehavior> {
 
     /***************************************************************************
      *                                                                         *
@@ -261,7 +263,7 @@
         });
 
 
-        setOnScroll(new EventHandler<javafx.scene.input.ScrollEvent>() {
+        getSkinnable().setOnScroll(new EventHandler<javafx.scene.input.ScrollEvent>() {
             @Override public void handle(ScrollEvent event) {
                 /*
                 ** if the tracklength isn't greater then do nothing....
@@ -442,15 +444,8 @@
         thumb.setTranslateY( s.getOrientation() == Orientation.VERTICAL ? trackPos + getInsets().getTop() : getInsets().getTop());
     }
 
-    @Override protected void layoutChildren() {
-        // compute x,y,w,h of content area
-        double x = getInsets().getLeft();
-        double y = getInsets().getTop();
-        double wTotal = snapSize(getWidth());
-        double hTotal = snapSize(getHeight());
-        double wNoInsets = snapSize(wTotal - (getInsets().getLeft() + getInsets().getRight()));
-        double hNoInsets = snapSize(hTotal - (getInsets().getTop() + getInsets().getBottom()));
-
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         /**
          * Compute the percentage length of thumb as (visibleAmount/range)
          * if max isn't greater than min then there is nothing to do here
@@ -468,25 +463,25 @@
                 double decHeight = snapSize(decButton.prefHeight(-1));
                 double incHeight = snapSize(incButton.prefHeight(-1));
 
-                decButton.resize(wNoInsets, decHeight);
-                incButton.resize(wNoInsets, incHeight);
+                decButton.resize(w, decHeight);
+                incButton.resize(w, incHeight);
 
-                trackLength = snapSize(hNoInsets - (decHeight + incHeight));
+                trackLength = snapSize(h - (decHeight + incHeight));
                 thumbLength = snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength));
 
-                trackBackground.resizeRelocate(snapPosition(x), snapPosition(y), wNoInsets, trackLength+decHeight+incHeight);
+                trackBackground.resizeRelocate(snapPosition(x), snapPosition(y), w, trackLength+decHeight+incHeight);
                 decButton.relocate(snapPosition(x), snapPosition(y));
-                incButton.relocate(snapPosition(x), snapPosition(y + hNoInsets - incHeight));
-                track.resizeRelocate(snapPosition(x), snapPosition(y + decHeight), wNoInsets, trackLength);
-                thumb.resize(snapSize(x >= 0 ? wNoInsets : wNoInsets + x), thumbLength); // Account for negative padding (see also RT-10719)
+                incButton.relocate(snapPosition(x), snapPosition(y + h - incHeight));
+                track.resizeRelocate(snapPosition(x), snapPosition(y + decHeight), w, trackLength);
+                thumb.resize(snapSize(x >= 0 ? w : w + x), thumbLength); // Account for negative padding (see also RT-10719)
                 positionThumb();
             }
             else {
-                trackLength = snapSize(hNoInsets);
+                trackLength = snapSize(h);
                 thumbLength = snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength));
 
-                track.resizeRelocate(snapPosition(x), snapPosition(y), wNoInsets, trackLength);
-                thumb.resize(snapSize(x >= 0 ? wNoInsets : wNoInsets + x), thumbLength); // Account for negative padding (see also RT-10719)
+                track.resizeRelocate(snapPosition(x), snapPosition(y), w, trackLength);
+                thumb.resize(snapSize(x >= 0 ? w : w + x), thumbLength); // Account for negative padding (see also RT-10719)
                 positionThumb();
             }
         } else {
@@ -494,34 +489,34 @@
                 double decWidth = snapSize(decButton.prefWidth(-1));
                 double incWidth = snapSize(incButton.prefWidth(-1));
 
-                decButton.resize(decWidth, hNoInsets);
-                incButton.resize(incWidth, hNoInsets);
+                decButton.resize(decWidth, h);
+                incButton.resize(incWidth, h);
 
-                trackLength = snapSize(wNoInsets - (decWidth + incWidth));
+                trackLength = snapSize(w - (decWidth + incWidth));
                 thumbLength = snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength));
 
-                trackBackground.resizeRelocate(snapPosition(x), snapPosition(y), trackLength+decWidth+incWidth, hNoInsets);
+                trackBackground.resizeRelocate(snapPosition(x), snapPosition(y), trackLength+decWidth+incWidth, h);
                 decButton.relocate(snapPosition(x), snapPosition(y));
-                incButton.relocate(snapPosition(x + wNoInsets - incWidth), snapPosition(y));
-                track.resizeRelocate(snapPosition(x + decWidth), snapPosition(y), trackLength, hNoInsets);
-                thumb.resize(thumbLength, snapSize(y >= 0 ? hNoInsets : hNoInsets + y)); // Account for negative padding (see also RT-10719)
+                incButton.relocate(snapPosition(x + w - incWidth), snapPosition(y));
+                track.resizeRelocate(snapPosition(x + decWidth), snapPosition(y), trackLength, h);
+                thumb.resize(thumbLength, snapSize(y >= 0 ? h : h + y)); // Account for negative padding (see also RT-10719)
                 positionThumb();
             }
             else {
-                trackLength = snapSize(wNoInsets);
+                trackLength = snapSize(w);
                 thumbLength = snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength));
 
-                track.resizeRelocate(snapPosition(x), snapPosition(y), trackLength, hNoInsets);
-                thumb.resize(thumbLength, snapSize(y >= 0 ? hNoInsets : hNoInsets + y)); // Account for negative padding (see also RT-10719)
+                track.resizeRelocate(snapPosition(x), snapPosition(y), trackLength, h);
+                thumb.resize(thumbLength, snapSize(y >= 0 ? h : h + y)); // Account for negative padding (see also RT-10719)
                 positionThumb();
             }
 
-            resize(snapSize(getWidth()), snapSize(getHeight()));
+            getSkinnable().resize(snapSize(getWidth()), snapSize(getHeight()));
         }
 
         // things should be invisible only when well below minimum length
-        if (getSkinnable().getOrientation() == Orientation.VERTICAL && hNoInsets >= (computeMinHeight(-1) - (getInsets().getTop()+getInsets().getBottom())) ||
-            getSkinnable().getOrientation() == Orientation.HORIZONTAL && wNoInsets >= (computeMinWidth(-1) - (getInsets().getLeft()+getInsets().getRight()))) {
+        if (getSkinnable().getOrientation() == Orientation.VERTICAL && h >= (computeMinHeight(-1) - (getInsets().getTop()+getInsets().getBottom())) ||
+            getSkinnable().getOrientation() == Orientation.HORIZONTAL && w >= (computeMinWidth(-1) - (getInsets().getLeft()+getInsets().getRight()))) {
             trackBackground.setVisible(true);
             track.setVisible(true);
             thumb.setVisible(true);
@@ -540,13 +535,13 @@
                 ** once the space is big enough for one button we 
                 ** can look at drawing
                 */
-                if (hNoInsets >= decButton.computeMinWidth(-1)) {
+                if (h >= decButton.computeMinWidth(-1)) {
                     decButton.setVisible(true);
                 }
                 else {
                     decButton.setVisible(false);
                 }
-                if (hNoInsets >= incButton.computeMinWidth(-1)) {
+                if (h >= incButton.computeMinWidth(-1)) {
                     incButton.setVisible(true);
                 }
                 else {
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ScrollPaneSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -54,6 +54,7 @@
 import javafx.scene.control.ScrollBar;
 import javafx.scene.control.ScrollPane;
 import javafx.scene.control.ScrollPane.ScrollBarPolicy;
+import javafx.scene.control.SkinBase;
 import javafx.scene.input.MouseEvent;
 import javafx.scene.input.ScrollEvent;
 import javafx.scene.input.TouchEvent;
@@ -213,7 +214,7 @@
 
     private void initialize() {
         // requestLayout calls below should not trigger requestLayout above ScrollPane
-        setManaged(false);
+//        setManaged(false);
 
         ScrollPane control = getSkinnable();
         scrollNode = control.getContent();
@@ -318,11 +319,11 @@
                if (getSkinnable().isPannable()) {
                  dragDetected = true;
                  if (saveCursor == null) {
-                     saveCursor = getCursor();
+                     saveCursor = getSkinnable().getCursor();
                      if (saveCursor == null) {
                          saveCursor = Cursor.DEFAULT;
                      }
-                     setCursor(Cursor.MOVE);
+                     getSkinnable().setCursor(Cursor.MOVE);
                      requestLayout();
                  }
                }
@@ -338,7 +339,7 @@
 
                  if (dragDetected == true) {
                      if (saveCursor != null) {
-                         setCursor(saveCursor);
+                         getSkinnable().setCursor(saveCursor);
                          saveCursor = null;
                          requestLayout();
                      }
@@ -459,7 +460,7 @@
         ** area, the above dispatcher having removed the ScrollBars
         ** scroll event handling.
         */
-        setOnScroll(new EventHandler<javafx.scene.input.ScrollEvent>() {
+        getSkinnable().setOnScroll(new EventHandler<javafx.scene.input.ScrollEvent>() {
             @Override public void handle(ScrollEvent event) {
                 if (PlatformUtil.isEmbedded()) {
                     startSBReleasedAnimation();
@@ -540,7 +541,7 @@
         ** there are certain animations that need to know if the touch is
         ** happening.....
         */
-        setOnTouchPressed(new EventHandler<TouchEvent>() {
+        getSkinnable().setOnTouchPressed(new EventHandler<TouchEvent>() {
             @Override public void handle(TouchEvent e) {
                 touchDetected = true;
                 startSBReleasedAnimation();
@@ -548,7 +549,7 @@
             }
         });
 
-        setOnTouchReleased(new EventHandler<TouchEvent>() {
+        getSkinnable().setOnTouchReleased(new EventHandler<TouchEvent>() {
             @Override public void handle(TouchEvent e) {
                 touchDetected = false;
                 startSBReleasedAnimation();
@@ -556,9 +557,9 @@
             }
         });
 
-        TraversalEngine traversalEngine = new TraversalEngine(this, false);
+        TraversalEngine traversalEngine = new TraversalEngine(getSkinnable(), false);
         traversalEngine.addTraverseListener(this);
-        setImpl_traversalEngine(traversalEngine);
+        getSkinnable().setImpl_traversalEngine(traversalEngine);
 
         // ScrollPanes do not block all MouseEvents by default, unlike most other UI Controls.
         consumeMouseEvents(false);
@@ -731,7 +732,8 @@
         return (h > 0) ? (3 * h) : (DEFAULT_MIN_SIZE);
     }
 
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         ScrollPane control = getSkinnable();
 
         vsb.setMin(control.getVmin());
@@ -741,8 +743,8 @@
         hsb.setMin(control.getHmin());
         hsb.setMax(control.getHmax());
 
-        contentWidth = control.getWidth() - (getInsets().getLeft() + getInsets().getRight());
-        contentHeight = control.getHeight() - (getInsets().getTop() + getInsets().getBottom());
+        contentWidth = w;
+        contentHeight = h;
 
         /*
         ** we want the scrollbars to go right to the border
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/SeparatorSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/SeparatorSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -27,6 +27,7 @@
 import javafx.geometry.Insets;
 import javafx.geometry.Orientation;
 import javafx.scene.control.Separator;
+import javafx.scene.control.SkinBase;
 import javafx.scene.layout.Region;
 
 import com.sun.javafx.scene.control.behavior.BehaviorBase;
@@ -88,24 +89,21 @@
      * Then position the line within the separator such that the alignment
      * properties are honored.
      */
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         final Separator sep = getSkinnable();
         final Insets p = getInsets();
 
-        // content width and height
-        final double cw = getWidth() - (p.getLeft() + p.getRight());
-        final double ch = getHeight() - (p.getTop() + p.getBottom());
-
         if (sep.getOrientation() == Orientation.HORIZONTAL) {
             // Resize to the content width, and the pref height of the line.
-            line.resize(cw, line.prefHeight(-1));
+            line.resize(w, line.prefHeight(-1));
         } else {
             // Resize to the pref width of the line and the content height.
-            line.resize(line.prefWidth(-1), ch);
+            line.resize(line.prefWidth(-1), h);
         }
 
         // Now that the line has been sized, simply position it
-        positionInArea(line, p.getLeft(), p.getTop(), cw, ch, 0, sep.getHalignment(), sep.getValignment());
+        positionInArea(line, p.getLeft(), p.getTop(), w, h, 0, sep.getHalignment(), sep.getValignment());
     }
 
     @Override protected double computePrefWidth(double h) {
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/SkinBase.java	Sat Jul 28 07:39:14 2012 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,358 +0,0 @@
-/*
- * Copyright (c) 2010, 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.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javafx.beans.value.ChangeListener;
-import javafx.beans.value.ObservableValue;
-import javafx.beans.value.WeakChangeListener;
-import javafx.event.EventHandler;
-import javafx.event.EventType;
-import javafx.scene.Node;
-import javafx.scene.Parent;
-import javafx.scene.control.ContextMenu;
-import javafx.scene.control.Control;
-import javafx.scene.control.Skin;
-import javafx.scene.input.ContextMenuEvent;
-import javafx.scene.input.MouseEvent;
-import javafx.scene.layout.StackPane;
-
-import com.sun.javafx.css.StyleableProperty;
-import com.sun.javafx.scene.control.WeakListChangeListener;
-import com.sun.javafx.scene.control.behavior.BehaviorBase;
-import javafx.collections.ListChangeListener;
-
-/**
- * The default base class from which all of the CSS-based skins extend. This
- * class is a Region based Skin. As a Region, it is a Container which gives
- * easy and convenient access to the layout machinery, and also since it is a
- * Parent it can have children directly, often removing extra unnecessary
- * levels of nesting.
- */
-public abstract class SkinBase<C extends Control, B extends BehaviorBase<C>> extends StackPane implements Skin<C> {
-    /**
-     * The {@code Control} that is referencing this Skin. There is a
-     * one-to-one relationship between a {@code Skin} and a {@code Control}.
-     * When a {@code Skin} is set on a {@code Control}, this variable is
-     * automatically updated.
-     *
-     * @profile common
-     */
-    private C control;
-
-    /**
-     * The {@link BehaviorBase} that encapsulates the interaction with the
-     * {@link Control} from this {@code Skin}. The {@code Skin} does not modify
-     * the {@code Control} directly, but rather redirects events into the
-     * {@code BehaviorBase} which then handles the events by modifying internal state
-     * and public state in the {@code Control}. Generally, specific
-     * {@code Skin} implementations will require specific {@code BehaviorBase}
-     * implementations. For example, a ButtonSkin might require a ButtonBehavior.
-     */
-    private B behavior;
-
-    /**
-     * Mouse handler used for consuming all mouse events (preventing them
-     * from bubbling up to parent)
-     */
-    private static final EventHandler<MouseEvent> mouseEventConsumer = new EventHandler<MouseEvent>() {
-        @Override public void handle(MouseEvent event) {
-            /*
-            ** we used to consume mouse wheel rotations here, 
-            ** be we've switched to ScrollEvents, and only consume those which we use.
-            ** See RT-13995 & RT-14480
-            */
-            event.consume();
-        }
-    };
-
-    /**
-     * Determines whether all mouse events should be automatically consumed.
-     */
-    protected final void consumeMouseEvents(boolean value) {
-        if (value) {
-            if (control != null) {
-                control.addEventHandler(MouseEvent.ANY, mouseEventConsumer);
-            }
-        } else {
-            if (control != null) {
-                control.removeEventHandler(MouseEvent.ANY, mouseEventConsumer);
-            }
-        }
-    }
-
-    /***************************************************************************
-     * Implementation of the Skin interface                                    *
-     **************************************************************************/
-
-    @Override public C getSkinnable() {
-        return control;
-    }
-
-    @Override public final Node getNode() {
-        return this;
-    }
-
-    /**
-     * If you override this, you must call super.dispose().
-     */
-    @Override public void dispose() {
-        // unhook listeners
-        for (ObservableValue value : propertyReferenceMap.keySet()) {
-            value.removeListener(controlPropertyChangedListener);
-        }
-
-        this.removeEventHandler(MouseEvent.MOUSE_ENTERED, mouseHandler);
-        this.removeEventHandler(MouseEvent.MOUSE_EXITED, mouseHandler);
-        this.removeEventHandler(MouseEvent.MOUSE_PRESSED, mouseHandler);
-        this.removeEventHandler(MouseEvent.MOUSE_RELEASED, mouseHandler);
-        this.removeEventHandler(MouseEvent.MOUSE_DRAGGED, mouseHandler);
-        
-        control.removeEventHandler(ContextMenuEvent.CONTEXT_MENU_REQUESTED, contextMenuHandler);
-
-        this.control = null;
-        this.behavior = null;
-    }
-
-    public SkinBase(final C control, final B behavior) {
-        if (control == null || behavior == null) {
-            throw new IllegalArgumentException("Cannot pass null for control or behavior");
-        }
-
-        // Update the control and behavior
-        this.control = control;
-        this.behavior = behavior;
-
-        // RT-7512 - skin needs to have styleClass of the control
-        getStyleClass().setAll(control.getStyleClass());
-        setStyle(control.getStyle());
-        setId(control.getId());
-
-        // RT-16368 - keep this skin's styleclass in sync with its control.
-       control.getStyleClass().addListener(new WeakListChangeListener(styleClassChangeListener));
-
-        // RT-16368 - keep this skin's style property in sync with its control.
-       registerChangeListener(control.styleProperty(), STYLE_PROPERTY_REF);
-
-        // RT-16368 - keep this skin's style property in sync with its control.
-       registerChangeListener(control.idProperty(), ID_PROPERTY_REF);
-
-        // We will auto-add listeners for wiring up Region mouse events to
-        // be sent to the behavior
-        this.addEventHandler(MouseEvent.MOUSE_ENTERED, mouseHandler);
-        this.addEventHandler(MouseEvent.MOUSE_EXITED, mouseHandler);
-        this.addEventHandler(MouseEvent.MOUSE_PRESSED, mouseHandler);
-        this.addEventHandler(MouseEvent.MOUSE_RELEASED, mouseHandler);
-        this.addEventHandler(MouseEvent.MOUSE_DRAGGED, mouseHandler);
-        
-        // we add a listener for menu request events to show the context menu
-        // that may be set on the Control
-        control.addEventHandler(ContextMenuEvent.CONTEXT_MENU_REQUESTED, contextMenuHandler);
-
-        // Default behavior for controls is to consume all mouse events
-        consumeMouseEvents(true);
-    }
-
-    public B getBehavior() {
-        return behavior;
-    }
-
-    public ContextMenu getContextMenu() {
-        return getSkinnable().getContextMenu();
-    }
-    
-    /**
-     * Called for key events with no specific mouse location.
-     *
-     * Subclasses override this to decide location and call show the context menu.
-     */
-    public boolean showContextMenu(ContextMenu menu, double x, double y, boolean isKeyboardTrigger) {
-        if (menu != null) {
-            menu.show(control, x, y);
-            return true;
-        }
-        return false;
-    }
-
-
-    /***************************************************************************
-     * Specialization of the Region                                            *
-     **************************************************************************/
-
-
-    /***************************************************************************
-     * Specialization of CSS handling code                                     *
-     **************************************************************************/
-
-    /**
-     * @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 long impl_getPseudoClassState() {
-        return getSkinnable().impl_getPseudoClassState();
-    }
-
-    private static class StyleableProperties {
-
-        private static final List<StyleableProperty> STYLEABLES;
-
-        static {
-            // We do this as we only want to take on the regions own keys,
-            // none of container's or Node's. This is because we share
-            // css with the Control and it would mean all of those
-            // properties like opacity would be applied twice.
-            final List<StyleableProperty> stackPaneKeys = StackPane.impl_CSS_STYLEABLES();
-            final List<StyleableProperty> parentKeys = Parent.impl_CSS_STYLEABLES();
-            final List<StyleableProperty> temp = new ArrayList<StyleableProperty>();
-            
-            final int offset = parentKeys.size();
-            for(int n=0, max=stackPaneKeys.size() - offset; n<max; n++) {
-                temp.add(stackPaneKeys.get(n + offset));
-            }
-            STYLEABLES = Collections.unmodifiableList(temp);
-        }
-
-    }
-
-     public static List<StyleableProperty> impl_CSS_STYLEABLES() {
-         return SkinBase.StyleableProperties.STYLEABLES;
-     }
-
-    /**
-     * RT-19263
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an experimental API that is not intended for general use and is subject to change in future versions
-     */
-    @Deprecated
-    public List<StyleableProperty> impl_getStyleableProperties() {
-        return impl_CSS_STYLEABLES();
-    }
-
-    /***************************************************************************
-     * Event handling mumbo jumbo                                              *
-     **************************************************************************/
-    private final ListChangeListener styleClassChangeListener = 
-        new ListChangeListener<String>() {
-            @Override
-            public void onChanged(Change<? extends String> c) {
-
-                while (c.next()) {
-                    // Don't setAll here since the skin might have added
-                    // a styleclass of its own and we want to retain that.
-                    if (c.wasRemoved()) {
-                        SkinBase.this.getStyleClass().removeAll(c.getRemoved());
-                    }
-                    if (c.wasAdded()) {
-                        SkinBase.this.getStyleClass().addAll(c.getAddedSubList());
-                    }
-                }
-            }
-        };
-
-    private final ChangeListener controlPropertyChangedListener = new ChangeListener() {
-        @Override public void changed(ObservableValue property, Object oldValue, Object newValue) {
-            handleControlPropertyChanged(propertyReferenceMap.get(property));
-        }
-    };
-
-    /**
-     * This is part of the workaround introduced during delomboking. We probably will
-     * want to adjust the way listeners are added rather than continuing to use this
-     * map (although it doesn't really do much harm).
-     */
-    private Map<ObservableValue,String> propertyReferenceMap =
-            new HashMap<ObservableValue,String>();
-
-    /**
-     * Subclasses can invoke this method to register that we want to listen to
-     * property change events for the given property.
-     *
-     * @param property
-     * @param reference
-     */
-    protected final void registerChangeListener(ObservableValue property, String reference) {
-        if (!propertyReferenceMap.containsKey(property)) {
-            propertyReferenceMap.put(property, reference);
-            property.addListener(new WeakChangeListener(controlPropertyChangedListener));
-        }
-    }
-
-    final static private String STYLE_PROPERTY_REF = "STYLE_PROPERTY_REF";
-    final static private String ID_PROPERTY_REF    = "ID_PROPERTY_REF";
-    /**
-     * Skin subclasses will override this method to handle changes in corresponding
-     * control's properties.
-     */
-    protected void handleControlPropertyChanged(String propertyReference) {
-        if (STYLE_PROPERTY_REF.equals(propertyReference)) {
-            setStyle(getSkinnable().getStyle());
-        } else if (ID_PROPERTY_REF.equals(propertyReference)) {
-            setId(getSkinnable().getId());
-        }
-    }
-
-    /**
-     * Forwards mouse events received by a MouseListener to the behavior.
-     * Note that we use this pattern to remove some of the anonymous inner
-     * classes which we'd otherwise have to create. When lambda expressions
-     * are supported, we could do it that way instead (or use MethodHandles).
-     */
-    private final EventHandler<MouseEvent> mouseHandler =
-            new EventHandler<MouseEvent>() {
-        @Override public void handle(MouseEvent e) {
-            final EventType<?> type = e.getEventType();
-
-            if (type == MouseEvent.MOUSE_ENTERED) behavior.mouseEntered(e);
-            else if (type == MouseEvent.MOUSE_EXITED) behavior.mouseExited(e);
-            else if (type == MouseEvent.MOUSE_PRESSED) behavior.mousePressed(e);
-            else if (type == MouseEvent.MOUSE_RELEASED) behavior.mouseReleased(e);
-            else if (type == MouseEvent.MOUSE_DRAGGED) behavior.mouseDragged(e);
-            else { // no op
-                throw new AssertionError("Unsupported event type received");
-            }
-        }
-    };
-    
-    /**
-     * Handles conext menu requests by popping up the menu.
-     * Note that we use this pattern to remove some of the anonymous inner
-     * classes which we'd otherwise have to create. When lambda expressions
-     * are supported, we could do it that way instead (or use MethodHandles).
-     */
-    private final EventHandler<ContextMenuEvent> contextMenuHandler = new EventHandler<ContextMenuEvent>() {
-        @Override public void handle(ContextMenuEvent event) {
-            // If a context menu was shown, consume the event to prevent multiple context menus
-            if (showContextMenu(getContextMenu (), event.getScreenX(), event.getScreenY(), event.isKeyboardTrigger())) {
-                event.consume();
-            }
-        }
-    };
-}
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/SliderSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/SliderSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -38,7 +38,7 @@
 /**
  * Region/css based skin for Slider
 */
-public class SliderSkin extends SkinBase<Slider, SliderBehavior> {
+public class SliderSkin extends javafx.scene.control.SkinBase<Slider, SliderBehavior> {
 
     /** Track if slider is vertical/horizontal and cause re layout */
 //    private boolean horizontal;
@@ -215,14 +215,10 @@
         thumb.setLayoutY(ly);
     }
 
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
          // calculate the available space
 
-        double x = getInsets().getLeft();
-        double y = getInsets().getTop();
-        double w = getWidth() - (getInsets().getLeft() + getInsets().getRight());
-        double h = getHeight() - (getInsets().getTop() + getInsets().getBottom());
-
         // resize thumb to preferred size
         thumbWidth = thumb.prefWidth(-1);
         thumbHeight = thumb.prefHeight(-1);
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/SplitPaneSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/SplitPaneSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -38,6 +38,7 @@
 import javafx.geometry.VPos;
 import javafx.scene.Cursor;
 import javafx.scene.Node;
+import javafx.scene.control.SkinBase;
 import javafx.scene.control.SplitPane;
 import javafx.scene.input.MouseEvent;
 import javafx.scene.layout.StackPane;
@@ -47,18 +48,19 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import javafx.scene.Group;
 
 public class SplitPaneSkin extends SkinBase<SplitPane, BehaviorBase<SplitPane>>  {
 
     private ObservableList<Content> contentRegions;
     private ObservableList<ContentDivider> contentDividers;
     private boolean horizontal;
-
+    
     public SplitPaneSkin(final SplitPane splitPane) {
         super(splitPane, new BehaviorBase<SplitPane>(splitPane));
-        setManaged(false);
+//        splitPane.setManaged(false);
         horizontal = getSkinnable().getOrientation() == Orientation.HORIZONTAL;
-
+        
         contentRegions = FXCollections.<Content>observableArrayList();
         contentDividers = FXCollections.<ContentDivider>observableArrayList();
 
@@ -525,7 +527,8 @@
     private boolean resize = false;
     private boolean checkDividerPos = true;
 
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         if (!getSkinnable().isVisible() || 
             (horizontal ? getWidth() == 0 : getHeight() == 0) ||
             contentRegions.isEmpty()) {
@@ -533,11 +536,9 @@
         }
         
         double dividerWidth = contentDividers.isEmpty() ? 0 : contentDividers.get(0).prefWidth(-1);
-        double w = getWidth() - (getInsets().getLeft() + getInsets().getRight());
-        double h = getHeight() - (getInsets().getTop() + getInsets().getBottom());
 
         if (contentDividers.size() > 0 && previousArea != -1 && previousArea != (getWidth() * getHeight())) {
-            //This algorithm adds/subracts a little to each panel on every resize
+            //This algorithm adds/subtracts a little to each panel on every resize
             List<Content> resizeList = new ArrayList<Content>();
             for (Content c: contentRegions) {
                 if (c.isResizableWithParent()) {
@@ -882,28 +883,29 @@
             return prefHeight + getInsets().getTop() + getInsets().getBottom();
         }
     }
+    
 
-    private void printDividerPositions() {
-        for (int i = 0; i < contentDividers.size(); i++) {
-            System.out.print("DIVIDER[" + i + "] " + contentDividers.get(i).getDividerPos() + " ");
-        } 
-        System.out.println("");
-    }
-    
-    private void printAreaAndAvailable() {
-        for (int i = 0; i < contentRegions.size(); i++) {
-            System.out.print("AREA[" + i + "] " + contentRegions.get(i).getArea() + " ");
-        }
-        System.out.println("");
-        for (int i = 0; i < contentRegions.size(); i++) {
-            System.out.print("AVAILABLE[" + i + "] " + contentRegions.get(i).getAvailable() + " ");
-        }
-        System.out.println("");
-        for (int i = 0; i < contentRegions.size(); i++) {
-            System.out.print("RESIZABLEWTIHPARENT[" + i + "] " + contentRegions.get(i).getResizableWithParentArea() + " ");
-        }
-        System.out.println("");
-    }
+//    private void printDividerPositions() {
+//        for (int i = 0; i < contentDividers.size(); i++) {
+//            System.out.print("DIVIDER[" + i + "] " + contentDividers.get(i).getDividerPos() + " ");
+//        } 
+//        System.out.println("");
+//    }
+//    
+//    private void printAreaAndAvailable() {
+//        for (int i = 0; i < contentRegions.size(); i++) {
+//            System.out.print("AREA[" + i + "] " + contentRegions.get(i).getArea() + " ");
+//        }
+//        System.out.println("");
+//        for (int i = 0; i < contentRegions.size(); i++) {
+//            System.out.print("AVAILABLE[" + i + "] " + contentRegions.get(i).getAvailable() + " ");
+//        }
+//        System.out.println("");
+//        for (int i = 0; i < contentRegions.size(); i++) {
+//            System.out.print("RESIZABLEWTIHPARENT[" + i + "] " + contentRegions.get(i).getResizableWithParentArea() + " ");
+//        }
+//        System.out.println("");
+//    }
 
     class ContentDivider extends StackPane {
         private double initialPos;
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TabPaneSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TabPaneSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -78,8 +78,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
-import javafx.application.Platform;
+import javafx.scene.control.SkinBase;
 import javafx.scene.input.*;
 
 public class TabPaneSkin extends SkinBase<TabPane, TabPaneBehavior> {
@@ -136,7 +135,7 @@
         super(tabPane, new TabPaneBehavior(tabPane));
 
         clipRect = new Rectangle();
-        setClip(clipRect);
+        getSkinnable().setClip(clipRect);
 
         tabContentRegions = FXCollections.<TabContentRegion>observableArrayList();
 
@@ -156,6 +155,8 @@
 
         registerChangeListener(tabPane.getSelectionModel().selectedItemProperty(), "SELECTED_TAB");
         registerChangeListener(tabPane.sideProperty(), "SIDE");
+        registerChangeListener(tabPane.widthProperty(), "WIDTH");
+        registerChangeListener(tabPane.heightProperty(), "HEIGHT");
 
         previousSelectedTab = null;        
         selectedTab = getSkinnable().getSelectionModel().getSelectedItem();
@@ -192,6 +193,10 @@
             requestLayout();
         } else if (property == "SIDE") {
             updateTabPosition();
+        } else if (property == "WIDTH") {
+            clipRect.setWidth(getWidth());
+        } else if (property == "HEIGHT") {
+            clipRect.setHeight(getHeight());
         }
     }
 
@@ -302,7 +307,7 @@
 
     private void updateTabPosition() {
         tabHeaderArea.setScrollOffset(0.0F);
-        impl_reapplyCSS();
+        getSkinnable().impl_reapplyCSS();
         requestLayout();
     }
 
@@ -324,13 +329,13 @@
 
     private void initializeSwipeHandlers() {
         if (PlatformUtil.isEmbedded()) {
-            setOnSwipeLeft(new EventHandler<SwipeEvent>() {
+            getSkinnable().setOnSwipeLeft(new EventHandler<SwipeEvent>() {
                 @Override public void handle(SwipeEvent t) {
                     getBehavior().selectNextTab();
                 }
             });
 
-            setOnSwipeRight(new EventHandler<SwipeEvent>() {
+            getSkinnable().setOnSwipeRight(new EventHandler<SwipeEvent>() {
                 @Override public void handle(SwipeEvent t) {
                     getBehavior().selectPreviousTab();
                 }
@@ -343,15 +348,15 @@
         return getSkinnable().getStyleClass().contains(TabPane.STYLE_CLASS_FLOATING);
     }
 
-    @Override protected void setWidth(double value) {
-        super.setWidth(value);
-        clipRect.setWidth(value);
-    }
-
-    @Override protected void setHeight(double value) {
-        super.setHeight(value);
-        clipRect.setHeight(value);
-    }
+//    @Override protected void setWidth(double value) {
+//        super.setWidth(value);
+//        clipRect.setWidth(value);
+//    }
+//
+//    @Override protected void setHeight(double value) {
+//        super.setHeight(value);
+//        clipRect.setHeight(value);
+//    }
 
     private double maxw = 0.0d;
     @Override protected double computePrefWidth(double height) {
@@ -379,15 +384,10 @@
         return tabHeaderArea.getBaselineOffset() + tabHeaderArea.getLayoutY();
     }
 
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         TabPane tabPane = getSkinnable();
         Side tabPosition = tabPane.getSide();
-        Insets padding = getInsets();
-
-        final double w = snapSize(getWidth()) - snapSize(padding.getLeft()) - snapSize(padding.getRight());
-        final double h = snapSize(getHeight()) - snapSize(padding.getTop()) - snapSize(padding.getBottom());
-        final double x = snapSize(padding.getLeft());
-        final double y = snapSize(padding.getTop());
 
         double headerHeight = snapSize(tabHeaderArea.prefHeight(-1));
         double tabsStartX = tabPosition.equals(Side.RIGHT)? x + w - headerHeight : x;
@@ -978,6 +978,7 @@
                     }
                 }
             };
+            inner.getStyleClass().add("tab-container");
             inner.setRotate(getSkinnable().getSide().equals(Side.BOTTOM) ? 180.0F : 0.0F);
             inner.getChildren().addAll(label, closeBtn);
 
@@ -1257,7 +1258,7 @@
             StyleManager.getInstance().getPseudoclassMask("disabled");    
 
 
-   /**************************************************************************
+    /**************************************************************************
      *
      * TabContentRegion: each tab has one to contain the tab's content node
      *
@@ -1452,6 +1453,7 @@
                             /*baseline ignored*/0, HPos.CENTER, VPos.CENTER);
                 }
             };
+            inner.getStyleClass().add("container");
             inner.getChildren().add(downArrowBtn);
 
             getChildren().add(inner);
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TableCellSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TableCellSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -30,6 +30,7 @@
 import javafx.scene.control.TableCell;
 
 import com.sun.javafx.scene.control.behavior.TableCellBehavior;
+import javafx.scene.control.TableColumn;
 import javafx.scene.shape.Rectangle;
 
 /**
@@ -56,21 +57,24 @@
     public TableCellSkin(TableCell control) {
         super(control, new TableCellBehavior(control));
         
+        TableCell skinnable = getSkinnable();
+        TableColumn tableColumn = skinnable.getTableColumn();
+        
         // RT-22038
         Rectangle clip = new Rectangle();
-        clip.widthProperty().bind(widthProperty());
-        clip.heightProperty().bind(heightProperty());
-        setClip(clip);
+        clip.widthProperty().bind(skinnable.widthProperty());
+        clip.heightProperty().bind(skinnable.heightProperty());
+        getSkinnable().setClip(clip);
         // --- end of RT-22038
         
-        if (getSkinnable().getTableColumn() != null) {
-            getSkinnable().getTableColumn().widthProperty().addListener(
+        if (tableColumn != null) {
+            tableColumn.widthProperty().addListener(
                 new WeakInvalidationListener(weakColumnWidthListener));
         }
 
         registerChangeListener(control.visibleProperty(), "VISIBLE");
         
-        if (getSkinnable().getProperties().containsKey(DEFER_TO_PARENT_PREF_WIDTH)) {
+        if (skinnable.getProperties().containsKey(DEFER_TO_PARENT_PREF_WIDTH)) {
             isDeferToParentForPrefWidth = true;
         }
     }
@@ -78,17 +82,12 @@
     @Override protected void handleControlPropertyChanged(String p) {
         super.handleControlPropertyChanged(p);
         if (p == "VISIBLE") {
-            setVisible(getSkinnable().getTableColumn().isVisible());
+            getSkinnable().setVisible(getSkinnable().getTableColumn().isVisible());
         }
     }
     
-    @Override protected void layoutChildren() {
-        // figure out the content area that is to be filled
-        double x = getInsets().getLeft();
-        double y = getInsets().getTop();
-        double w = snapSize(getWidth()) - (snapSpace(getInsets().getLeft()) + snapSpace(getInsets().getRight()));
-        double h = getHeight() - (getInsets().getTop() + getInsets().getBottom());
-        
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         // fit the cell within this space
         // FIXME the subtraction of bottom padding isn't right here - but it
         // results in better visuals, so I'm leaving it in place for now.
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TableRowSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TableRowSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -39,7 +39,9 @@
 import com.sun.javafx.scene.control.behavior.CellBehaviorBase;
 import com.sun.javafx.scene.control.WeakListChangeListener;
 import javafx.collections.ObservableList;
+import javafx.geometry.Insets;
 import javafx.scene.Node;
+import javafx.scene.control.*;
 
 /**
  */
@@ -107,7 +109,7 @@
         if (p == "ITEM") {
             updateCells = true;
             requestLayout();
-            layout();
+            getSkinnable().layout();
         } else if (p == "TABLE_VIEW") {
             for (int i = 0; i < getChildren().size(); i++) {
                 Node n = getChildren().get(i);
@@ -153,7 +155,8 @@
         }
     }
 
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(double x, final double y,
+            final double w, final double h) {
         doUpdateCheck();
         
         TableView<T> table = getSkinnable().getTableView();
@@ -162,12 +165,13 @@
         
         if (showColumns && ! table.getVisibleLeafColumns().isEmpty()) {
             // layout the individual column cells
-            double x = getInsets().getLeft();
             double width;
             double height;
             
-            double verticalPadding = getInsets().getTop() + getInsets().getBottom();
-            double horizontalPadding = getInsets().getLeft() + getInsets().getRight();
+            Insets insets = getInsets();
+            
+            double verticalPadding = insets.getTop() + insets.getBottom();
+            double horizontalPadding = insets.getLeft() + insets.getRight();
             
             for (int i = 0; i < getChildren().size(); i++) {
                 // in most cases all children are TableCell instances, but this
@@ -179,11 +183,11 @@
                 height = snapSize(height - verticalPadding);
                 
                 node.resize(width, height);
-                node.relocate(x, getInsets().getTop());
+                node.relocate(x, insets.getTop());
                 x += width;
             }
         } else {
-            super.layoutChildren();
+            super.layoutChildren(x,y,w,h);
         }
     }
 
@@ -215,6 +219,8 @@
         columnCount = columns.size();
         fullRefreshCounter--;
         
+        TableRow skinnable = getSkinnable();
+        
         for (TableColumn col : columns) {
             if (cellsMap.containsKey(col)) {
                 continue;
@@ -226,7 +232,7 @@
             // we set it's TableColumn, TableView and TableRow
             cell.updateTableColumn(col);
             cell.updateTableView(table);
-            cell.updateTableRow(getSkinnable());
+            cell.updateTableRow(skinnable);
 
             // and store this in our HashMap until needed
             cellsMap.put(col, cell);
@@ -242,34 +248,39 @@
         // cells aren't updated properly.
         cells.clear();
 
-        TableView<T> table = getSkinnable().getTableView();
+        TableRow skinnable = getSkinnable();
+        int skinnableIndex = skinnable.getIndex();
+        TableView<T> table = skinnable.getTableView();
         if (table != null) {
-            for (TableColumn<T,?> col : table.getVisibleLeafColumns()) {
+            List<TableColumn<T,?>> visibleLeafColumns = table.getVisibleLeafColumns();
+            for (int i = 0, max = visibleLeafColumns.size(); i < max; i++) {
+                TableColumn<T,?> col = visibleLeafColumns.get(i);
                 TableCell cell = cellsMap.get(col);
                 if (cell == null) continue;
 
-                cell.updateIndex(getSkinnable().getIndex());
-                cell.updateTableRow(getSkinnable());
+                cell.updateIndex(skinnableIndex);
+                cell.updateTableRow(skinnable);
                 cells.add(cell);
             }
         }
 
         // update children of each row
+        ObservableList<Node> children = getChildren();
         if (resetChildren) {
             if (showColumns) {
                 if (cells.isEmpty()) {
-                    getChildren().clear();
+                    children.clear();
                 } else {
                     // TODO we can optimise this by only showing cells that are 
                     // visible based on the table width and the amount of horizontal
                     // scrolling.
-                    getChildren().setAll(cells);
+                    children.setAll(cells);
                 }
             } else {
-                getChildren().clear();
+                children.clear();
 
                 if (!isIgnoreText() || !isIgnoreGraphic()) {
-                    getChildren().add(getSkinnable());
+                    children.add(skinnable);
                 }
             }
         }
@@ -282,7 +293,9 @@
             double prefWidth = 0.0F;
 
             if (getSkinnable().getTableView() != null) {
-                for (TableColumn<T,?> tableColumn : getSkinnable().getTableView().getVisibleLeafColumns()) {
+                List<TableColumn<T,?>> visibleLeafColumns = getSkinnable().getTableView().getVisibleLeafColumns();
+                for (int i = 0, max = visibleLeafColumns.size(); i < max; i++) {
+                    TableColumn<T,?> tableColumn = visibleLeafColumns.get(i);
                     prefWidth += tableColumn.getWidth();
                 }
             }
@@ -313,7 +326,7 @@
                 final TableCell tableCell = cells.get(i);
                 prefHeight = Math.max(prefHeight, tableCell.prefHeight(-1));
             }
-            return Math.max(prefHeight, Math.max(getCellSize(), minHeight(-1)));
+            return Math.max(prefHeight, Math.max(getCellSize(), getSkinnable().minHeight(-1)));
         } else {
             return super.computePrefHeight(width);
         }
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TableViewSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TableViewSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -53,15 +53,21 @@
 import com.sun.javafx.scene.control.skin.resources.ControlResources;
 import javafx.beans.WeakInvalidationListener;
 import javafx.beans.value.WeakChangeListener;
+import javafx.geometry.HPos;
+import javafx.geometry.VPos;
 
 public class TableViewSkin<T> extends VirtualContainerBase<TableView<T>, TableViewBehavior<T>, TableRow<T>> {
+    
+    private final TableView<T> tableView;
 
     public TableViewSkin(final TableView tableView) {
         super(tableView, new TableViewBehavior(tableView));
+        
+        this.tableView = tableView;
 
         // init the VirtualFlow
         flow.setPannable(false);
-        flow.setFocusTraversable(getSkinnable().isFocusTraversable());
+        flow.setFocusTraversable(tableView.isFocusTraversable());
         flow.setCreateCell(new Callback<VirtualFlow, TableRow>() {
             @Override public TableRow call(VirtualFlow flow) {
                 return TableViewSkin.this.createCell();
@@ -102,7 +108,7 @@
         tableHeaderRow.setColumnReorderLine(columnReorderLine);
         tableHeaderRow.setTablePadding(getInsets());
         tableHeaderRow.setFocusTraversable(false);
-        paddingProperty().addListener(new InvalidationListener() {
+        tableView.paddingProperty().addListener(new InvalidationListener() {
             @Override public void invalidated(Observable valueModel) {
                 tableHeaderRow.setTablePadding(getInsets());
             }
@@ -111,7 +117,7 @@
         getChildren().addAll(tableHeaderRow, flow, columnReorderOverlay, columnReorderLine);
 
         updateVisibleColumnCount();
-        updateVisibleLeafColumnWidthListeners(getSkinnable().getVisibleLeafColumns(), FXCollections.<TableColumn<T,?>>emptyObservableList());
+        updateVisibleLeafColumnWidthListeners(tableView.getVisibleLeafColumns(), FXCollections.<TableColumn<T,?>>emptyObservableList());
 
         tableHeaderRow.reorderingProperty().addListener(new InvalidationListener() {
             @Override public void invalidated(Observable valueModel) {
@@ -119,12 +125,12 @@
             }
         });
 
-        getSkinnable().getVisibleLeafColumns().addListener(weakVisibleLeafColumnsListener);
+        tableView.getVisibleLeafColumns().addListener(weakVisibleLeafColumnsListener);
         
-        updateTableItems(null, getSkinnable().getItems());
-        getSkinnable().itemsProperty().addListener(weakItemsChangeListener);
+        updateTableItems(null, tableView.getItems());
+        tableView.itemsProperty().addListener(weakItemsChangeListener);
 
-        getSkinnable().getProperties().addListener(new MapChangeListener<Object, Object>() {
+        tableView.getProperties().addListener(new MapChangeListener<Object, Object>() {
             @Override public void onChanged(Change<? extends Object, ? extends Object> c) {
                 if (c.wasAdded() && "TableView.refresh".equals(c.getKey())) {
                     refreshView();
@@ -186,7 +192,7 @@
 
         if (p == "ROW_FACTORY") {
             Callback<TableView<T>, ? extends TableRow<T>> oldFactory = rowFactory;
-            rowFactory = getSkinnable().getRowFactory();
+            rowFactory = tableView.getRowFactory();
 
             // TODO tighten this up
             if (oldFactory != rowFactory) {
@@ -195,7 +201,7 @@
         } else if (p == "PLACEHOLDER") {
             updatePlaceholderRegionVisibility();
         } else if (p == "FOCUS_TRAVERSABLE") {
-            flow.setFocusTraversable(getSkinnable().isFocusTraversable());
+            flow.setFocusTraversable(tableView.isFocusTraversable());
         } else if (p == "WIDTH") {
             tableHeaderRow.setTablePadding(getInsets());
         }
@@ -322,20 +328,20 @@
     
     /** {@inheritDoc} */
     @Override public int getItemCount() {
-        return getSkinnable().getItems() == null ? 0 : getSkinnable().getItems().size();
+        return tableView.getItems() == null ? 0 : tableView.getItems().size();
     }
     
     /** {@inheritDoc} */
     @Override public TableRow createCell() {
         TableRow cell;
 
-        if (getSkinnable().getRowFactory() != null) {
-            cell = getSkinnable().getRowFactory().call(getSkinnable());
+        if (tableView.getRowFactory() != null) {
+            cell = tableView.getRowFactory().call(tableView);
         } else {
             cell = new TableRow();
         }
 
-        cell.updateTableView(getSkinnable());
+        cell.updateTableView(tableView);
         return cell;
     }
 
@@ -347,10 +353,12 @@
         TableRow lastVisibleCell = (TableRow) flow.getLastVisibleCellWithinViewPort();
         if (lastVisibleCell == null) return -1;
         
+        int lastVisibleCellIndex = lastVisibleCell.getIndex();
+        
         boolean isSelected = lastVisibleCell.isSelected() || 
                 lastVisibleCell.isFocused() || 
-                isCellSelected(lastVisibleCell.getIndex()) ||
-                isCellFocused(lastVisibleCell.getIndex());
+                isCellSelected(lastVisibleCellIndex) ||
+                isCellFocused(lastVisibleCellIndex);
         
         if (isSelected) {
             // if the last visible cell is selected, we want to shift that cell up
@@ -372,10 +380,12 @@
         TableRow firstVisibleCell = (TableRow) flow.getFirstVisibleCellWithinViewPort();
         if (firstVisibleCell == null) return -1;
         
+        int firstVisibleCellIndex = firstVisibleCell.getIndex();
+        
         boolean isSelected = firstVisibleCell.isSelected() || 
                 firstVisibleCell.isFocused() || 
-                isCellSelected(firstVisibleCell.getIndex()) ||
-                isCellFocused(firstVisibleCell.getIndex());
+                isCellSelected(firstVisibleCellIndex) ||
+                isCellFocused(firstVisibleCellIndex);
         
         if (isSelected) {
             // if the first visible cell is selected, we want to shift that cell down
@@ -398,7 +408,7 @@
      **************************************************************************/    
     
     private static final double GOLDEN_RATIO_MULTIPLIER = 0.618033987;
-    
+
     @Override protected double computePrefHeight(double width) {
         return 400;
     }
@@ -407,13 +417,14 @@
     @Override protected double computePrefWidth(double height) {
         double prefHeight = computePrefHeight(-1);
         
-        List<TableColumn<T,?>> cols = getSkinnable().getVisibleLeafColumns();
+        List<TableColumn<T,?>> cols = tableView.getVisibleLeafColumns();
         if (cols == null || cols.isEmpty()) {
             return prefHeight * GOLDEN_RATIO_MULTIPLIER;
         } 
         
         double pw = getInsets().getLeft() + getInsets().getRight();
-        for (TableColumn<T,?> tc : cols) {
+        for (int i = 0, max = cols.size(); i < max; i++) {
+            TableColumn tc = cols.get(i);
             pw += Math.max(tc.getPrefWidth(), tc.getMinWidth());
         }
 //        return pw;
@@ -421,23 +432,19 @@
     }
     
     /** {@inheritDoc} */
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(final double x, double y,
+            final double w, final double h) {
         if (rowCountDirty) {
             updateRowCount();
             rowCountDirty = false;
         }
         
-        double x = getInsets().getLeft();
-        double y = getInsets().getTop();
-        double w = getWidth() - (getInsets().getLeft() + getInsets().getRight());
-        double h = getHeight() - (getInsets().getTop() + getInsets().getBottom());
-        
-        final double baselineOffset = getLayoutBounds().getHeight() / 2;
+        final double baselineOffset = tableView.getLayoutBounds().getHeight() / 2;
 
         // position the table header
         double tableHeaderRowHeight = tableHeaderRow.prefHeight(-1);
-        layoutInArea(tableHeaderRow, x, y, w, tableHeaderRowHeight, baselineOffset,
-                getAlignment().getHpos(), getAlignment().getVpos());
+        layoutInArea(tableHeaderRow, x, y, w, tableHeaderRowHeight, baselineOffset, 
+                HPos.CENTER, VPos.CENTER);
         y += tableHeaderRowHeight;
 
         // let the virtual flow take up all remaining space
@@ -449,11 +456,11 @@
             // show message overlay instead of empty table
             layoutInArea(placeholderRegion, x, y,
                     w, flowHeight,
-                    baselineOffset, getAlignment().getHpos(), getAlignment().getVpos());
+                    baselineOffset, HPos.CENTER, VPos.CENTER);
         } else {
             layoutInArea(flow, x, y,
                     w, flowHeight,
-                    baselineOffset, getAlignment().getHpos(), getAlignment().getVpos());
+                    baselineOffset, HPos.CENTER, VPos.CENTER);
         }
         
         // painting the overlay over the column being reordered
@@ -539,7 +546,7 @@
      * Keeps track of how many leaf columns are currently visible in this table.
      */
     private void updateVisibleColumnCount() {
-        visibleColCount = getSkinnable().getVisibleLeafColumns().size();
+        visibleColCount = tableView.getVisibleLeafColumns().size();
 
         updatePlaceholderRegionVisibility();
         reconfigureCells();
@@ -548,10 +555,12 @@
     private void updateVisibleLeafColumnWidthListeners(
             List<? extends TableColumn<T,?>> added, List<? extends TableColumn<T,?>> removed) {
         
-        for (TableColumn<T,?> tc : removed) {
+        for (int i = 0, max = removed.size(); i < max; i++) {
+            TableColumn tc = removed.get(i);
             tc.widthProperty().removeListener(weakWidthListener);
         }
-        for (TableColumn<T,?> tc : added) {
+        for (int i = 0, max = added.size(); i < max; i++) {
+            TableColumn tc = added.get(i);
             tc.widthProperty().addListener(weakWidthListener);
         }
         flow.reconfigureCells();
@@ -567,7 +576,7 @@
                 getChildren().add(placeholderRegion);
             }
             
-            Node placeholderNode = getSkinnable().getPlaceholder();
+            Node placeholderNode = tableView.getPlaceholder();
 
             if (placeholderNode == null) {
                 if (placeholderLabel == null) {
@@ -607,7 +616,7 @@
 
         // FIXME this isn't perfect, but it prevents RT-14885, which results in
         // undesired horizontal scrollbars when in constrained resize mode
-        getSkinnable().getProperties().put("TableView.contentWidth", Math.floor(contentWidth));
+        tableView.getProperties().put("TableView.contentWidth", Math.floor(contentWidth));
     }
 
     private void refreshView() {
@@ -641,28 +650,28 @@
     }
 
     private void onFocusPreviousCell() {
-        TableViewFocusModel fm = getSkinnable().getFocusModel();
+        TableViewFocusModel fm = tableView.getFocusModel();
         if (fm == null) return;
 
         flow.show(fm.getFocusedIndex());
     }
 
     private void onFocusNextCell() {
-        TableViewFocusModel fm = getSkinnable().getFocusModel();
+        TableViewFocusModel fm = tableView.getFocusModel();
         if (fm == null) return;
 
         flow.show(fm.getFocusedIndex());
     }
 
     private void onSelectPreviousCell() {
-        SelectionModel sm = getSkinnable().getSelectionModel();
+        SelectionModel sm = tableView.getSelectionModel();
         if (sm == null) return;
 
         flow.show(sm.getSelectedIndex());
     }
 
     private void onSelectNextCell() {
-        SelectionModel sm = getSkinnable().getSelectionModel();
+        SelectionModel sm = tableView.getSelectionModel();
         if (sm == null) return;
 
         flow.show(sm.getSelectedIndex());
@@ -676,19 +685,19 @@
         scrollHorizontally();
     }
     
-    private void moveToLeftMostColumn() {
-        scrollHorizontally(getSkinnable().getVisibleLeafColumn(0));
-    }
-    
-    private void moveToRightMostColumn() {
-        scrollHorizontally(getSkinnable().getVisibleLeafColumn(getSkinnable().getVisibleLeafColumns().size() - 1));
-    }
+//    private void moveToLeftMostColumn() {
+//        scrollHorizontally(tableView.getVisibleLeafColumn(0));
+//    }
+//    
+//    private void moveToRightMostColumn() {
+//        scrollHorizontally(tableView.getVisibleLeafColumn(tableView.getVisibleLeafColumns().size() - 1));
+//    }
 
     // Handles the horizontal scrolling when the selection mode is cell-based
     // and the newly selected cell belongs to a column which is not totally
     // visible.
     private void scrollHorizontally() {
-        TableViewFocusModel fm = getSkinnable().getFocusModel();
+        TableViewFocusModel fm = tableView.getFocusModel();
         if (fm == null) return;
 
         TableColumn col = fm.getFocusedCell().getTableColumn();
@@ -709,14 +718,14 @@
 //
 //        // work out where this column header is, and it's width (start -> end)
 //        double start = scrollX;
-//        for (TableColumn c : getSkinnable().getVisibleLeafColumns()) {
+//        for (TableColumn c : tableView.getVisibleLeafColumns()) {
 //            if (c.equals(col)) break;
 //            start += c.getWidth();
 //        }
 //        double end = start + col.getWidth();
 //
 //        // determine the width of the table
-//        double headerWidth = getSkinnable().getWidth() - getInsets().getLeft() + getInsets().getRight();
+//        double headerWidth = tableView.getWidth() - getInsets().getLeft() + getInsets().getRight();
 //        
 //        boolean isVisible =(start >= pos || end > pos) && (start < (headerWidth + pos) || end <= (headerWidth + pos));
 //        
@@ -739,14 +748,14 @@
 
         // work out where this column header is, and it's width (start -> end)
         double start = scrollX;
-        for (TableColumn c : getSkinnable().getVisibleLeafColumns()) {
+        for (TableColumn c : tableView.getVisibleLeafColumns()) {
             if (c.equals(col)) break;
             start += c.getWidth();
         }
         double end = start + col.getWidth();
 
         // determine the width of the table
-        double headerWidth = getSkinnable().getWidth() - getInsets().getLeft() + getInsets().getRight();
+        double headerWidth = tableView.getWidth() - getInsets().getLeft() + getInsets().getRight();
 
         // determine by how much we need to translate the table to ensure that
         // the start position of this column lines up with the left edge of the
@@ -754,7 +763,7 @@
         // right edge of the table
         double pos = flow.getHbar().getValue();
         double max = flow.getHbar().getMax();
-        double newPos = pos;
+        double newPos;
         
         if (start < pos && start >= 0) {
             newPos = start;
@@ -771,7 +780,7 @@
     }
 
     private void onMoveToFirstCell() {
-        SelectionModel sm = getSkinnable().getSelectionModel();
+        SelectionModel sm = tableView.getSelectionModel();
         if (sm == null) return;
 
         flow.show(0);
@@ -779,7 +788,7 @@
     }
 
     private void onMoveToLastCell() {
-        SelectionModel sm = getSkinnable().getSelectionModel();
+        SelectionModel sm = tableView.getSelectionModel();
         if (sm == null) return;
 
         int endPos = getItemCount();
@@ -788,10 +797,10 @@
     }
 
 //    private void updateSelection(TableRow tableRow) {
-//        TableViewSelectionModel sm = getSkinnable().getSelectionModel();
+//        TableViewSelectionModel sm = tableView.getSelectionModel();
 //        if (sm == null) return;
 //
-//        TableViewFocusModel fm = getSkinnable().getFocusModel();
+//        TableViewFocusModel fm = tableView.getFocusModel();
 //        if (fm == null) return;
 //
 //        int row = tableRow.getIndex();
@@ -802,13 +811,13 @@
 //    }
     
     private boolean isCellSelected(int row) {
-        TableView.TableViewSelectionModel sm = getSkinnable().getSelectionModel();
+        TableView.TableViewSelectionModel sm = tableView.getSelectionModel();
         if (sm == null) return false;
         if (! sm.isCellSelectionEnabled()) return false;
 
-        int columnCount = getSkinnable().getVisibleLeafColumns().size();
+        int columnCount = tableView.getVisibleLeafColumns().size();
         for (int col = 0; col < columnCount; col++) {
-            if (sm.isSelected(row, getSkinnable().getVisibleLeafColumn(col))) {
+            if (sm.isSelected(row, tableView.getVisibleLeafColumn(col))) {
                 return true;
             }
         }
@@ -816,12 +825,12 @@
     }
     
     private boolean isCellFocused(int row) {
-        TableViewFocusModel fm = getSkinnable().getFocusModel();
+        TableViewFocusModel fm = tableView.getFocusModel();
         if (fm == null) return false;
 
-        int columnCount = getSkinnable().getVisibleLeafColumns().size();
+        int columnCount = tableView.getVisibleLeafColumns().size();
         for (int col = 0; col < columnCount; col++) {
-            if (fm.isFocused(row, getSkinnable().getVisibleLeafColumn(col))) {
+            if (fm.isFocused(row, tableView.getVisibleLeafColumn(col))) {
                 return true;
             }
         }
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextAreaSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextAreaSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -91,7 +91,6 @@
         computedPrefHeight = Double.NEGATIVE_INFINITY;
     }
 
-
     private class ContentView extends Region {
         {
             getStyleClass().add("content");
@@ -170,13 +169,11 @@
 
             double prefHeight = 0;
 
-            int i = 0;
             for (Node node : paragraphNodes.getChildren()) {
                 Text paragraphNode = (Text)node;
                 prefHeight += Utils.computeTextHeight(paragraphNode.getFont(),
                                                       paragraphNode.getText(),
                                                       wrappingWidth);
-                i++;
             }
 
             prefHeight += padding.getTop() + padding.getBottom();
@@ -420,7 +417,7 @@
             }
         });
 
-        setManaged(false);
+//        setManaged(false);
 
         // Initialize content
         scrollPane = new ScrollPane();
@@ -764,11 +761,12 @@
         paragraphNode.impl_selectionFillProperty().bind(highlightTextFill);
     }
 
-    @Override public void layoutChildren() {
+    @Override public void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
         scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
 
-        super.layoutChildren();
+        super.layoutChildren(x,y,w,h);
 
         Bounds bounds = scrollPane.getViewportBounds();
         if (bounds != null && (bounds.getWidth() < contentView.minWidth(-1) ||
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextFieldSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextFieldSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -176,7 +176,7 @@
             }
         });
         textLeft = new DoubleBinding() {
-            { bind(insets()); }
+            { bind(getSkinnable().insets()); }
             @Override protected double computeValue() {
                 return getInsets().getLeft();
             }
@@ -192,7 +192,7 @@
         };
         textLeft.addListener(leftRightListener);
         textRight = new DoubleBinding() {
-            { bind(widthProperty(), insets()); }
+            { bind(getSkinnable().widthProperty(), getSkinnable().insets()); }
             @Override protected double computeValue() {
                 return getWidth() - getInsets().getRight();
             }
@@ -201,30 +201,30 @@
 
         // Pretty much everything here is getting managed set to false,
         // because we want to control when layout is triggered
-        setManaged(false);
+//        setManaged(false);
 
         // Once this was crucial for performance, not sure now.
         clip.setSmooth(false);
         clip.xProperty().bind(new DoubleBinding() {
-            { bind(insets()); }
+            { bind(getSkinnable().insets()); }
             @Override protected double computeValue() {
                 return getInsets().getLeft();
             }
         });
         clip.yProperty().bind(new DoubleBinding() {
-            { bind(insets()); }
+            { bind(getSkinnable().insets()); }
             @Override protected double computeValue() {
                 return getInsets().getTop();
             }
         });
         clip.widthProperty().bind(new DoubleBinding() {
-            { bind(widthProperty(), insets()); }
+            { bind(getSkinnable().widthProperty(), getSkinnable().insets()); }
             @Override protected double computeValue() {
                 return getWidth() - getInsets().getRight() - getInsets().getLeft();
             }
         });
         clip.heightProperty().bind(new DoubleBinding() {
-            { bind(heightProperty(), insets()); }
+            { bind(getSkinnable().heightProperty(), getSkinnable().insets()); }
             @Override protected double computeValue() {
                 return getHeight() - getInsets().getTop() - getInsets().getBottom();
             }
@@ -717,9 +717,8 @@
         textGroup.getChildren().removeAll(nodes);
     }
 
-    @Override protected void layoutChildren() {
-        super.layoutChildren();
-
+    @Override protected void layoutChildren(final double x, final double y,
+            final double w, final double h) {
         if (textNode != null) {
             double textY;
             Insets insets = getInsets();
@@ -748,7 +747,7 @@
             TextField textField = getSkinnable();
 
             // Resize handles for caret and anchor.
-            IndexRange selection = textField.getSelection();
+//            IndexRange selection = textField.getSelection();
             selectionHandle1.resize(selectionHandle1.prefWidth(-1),
                                     selectionHandle1.prefHeight(-1));
             selectionHandle2.resize(selectionHandle2.prefWidth(-1),
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextInputControlSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextInputControlSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -49,6 +49,7 @@
 import javafx.scene.control.IndexRange;
 import javafx.scene.control.MenuItem;
 import javafx.scene.control.SeparatorMenuItem;
+import javafx.scene.control.SkinBase;
 import javafx.scene.control.TextInputControl;
 import javafx.scene.input.Clipboard;
 import javafx.scene.input.InputMethodEvent;
@@ -363,13 +364,14 @@
             textInput.focusedProperty().addListener(new InvalidationListener() {
                 @Override public void invalidated(Observable observable) {
                     if (useFXVK) {
+                        Scene scene = getSkinnable().getScene();
                         if (textInput.isEditable() && textInput.isFocused()) {
                             FXVK.attach(textInput);
-                        } else if (getScene() == null ||
-                                   getScene().getWindow() == null ||
-                                   !getScene().getWindow().isFocused() ||
-                                   !(getScene().getFocusOwner() instanceof TextInputControl &&
-                                     ((TextInputControl)getScene().getFocusOwner()).isEditable())) {
+                        } else if (scene == null ||
+                                   scene.getWindow() == null ||
+                                   !scene.getWindow().isFocused() ||
+                                   !(scene.getFocusOwner() instanceof TextInputControl &&
+                                     ((TextInputControl)scene.getFocusOwner()).isEditable())) {
                             FXVK.detach();
                         }
                     }
@@ -387,10 +389,10 @@
 
         textInput.setInputMethodRequests(new InputMethodRequests() {
             @Override public Point2D getTextLocation(int offset) {
-                Scene scene = getScene();
+                Scene scene = getSkinnable().getScene();
                 Window window = scene.getWindow();
                 Rectangle2D characterBounds = getCharacterBounds(imstart + offset);
-                Point2D p = localToScene(characterBounds.getMinX(), characterBounds.getMaxY());
+                Point2D p = getSkinnable().localToScene(characterBounds.getMinX(), characterBounds.getMaxY());
                 // TODO: Find out where these offsets come from
                 Point2D location = new Point2D(window.getX() + scene.getX() + p.getX() -  6,
                                                window.getY() + scene.getY() + p.getY() - 42);
@@ -652,92 +654,104 @@
     }
 
     private static class StyleableProperties {
-        private static final StyleableProperty<TextInputControlSkin,Font> FONT =
-           new StyleableProperty.FONT<TextInputControlSkin>("-fx-font", Font.getDefault()) {
+        private static final StyleableProperty<TextInputControl,Font> FONT =
+           new StyleableProperty.FONT<TextInputControl>("-fx-font", Font.getDefault()) {
 
             @Override
-            public boolean isSettable(TextInputControlSkin n) {
-                return n.font == null || !n.font.isBound();
+            public boolean isSettable(TextInputControl n) {
+                final TextInputControlSkin skin = (TextInputControlSkin) n.getSkin();
+                return skin.font == null || !skin.font.isBound();
             }
 
             @Override
-            public WritableValue<Font> getWritableValue(TextInputControlSkin n) {
-                return n.font;
+            public WritableValue<Font> getWritableValue(TextInputControl n) {
+                final TextInputControlSkin skin = (TextInputControlSkin) n.getSkin();
+                return skin.font;
             }
         };
         
-        private static final StyleableProperty<TextInputControlSkin,Paint> TEXT_FILL =
-            new StyleableProperty<TextInputControlSkin,Paint>("-fx-text-fill",
+        private static final StyleableProperty<TextInputControl,Paint> TEXT_FILL =
+            new StyleableProperty<TextInputControl,Paint>("-fx-text-fill",
                 PaintConverter.getInstance(), Color.BLACK) {
 
             @Override
-            public boolean isSettable(TextInputControlSkin n) {
-                return n.textFill == null || !n.textFill.isBound();
+            public boolean isSettable(TextInputControl n) {
+                final TextInputControlSkin skin = (TextInputControlSkin) n.getSkin();
+                return skin.textFill == null || !skin.textFill.isBound();
             }
 
             @Override
-            public WritableValue<Paint> getWritableValue(TextInputControlSkin n) {
-                return n.textFill;
+            public WritableValue<Paint> getWritableValue(TextInputControl n) {
+                final TextInputControlSkin skin = (TextInputControlSkin) n.getSkin();
+                return skin.textFill;
             }
         };
        
-        private static final StyleableProperty<TextInputControlSkin,Paint> PROMPT_TEXT_FILL =
-            new StyleableProperty<TextInputControlSkin,Paint>("-fx-prompt-text-fill",
+        private static final StyleableProperty<TextInputControl,Paint> PROMPT_TEXT_FILL =
+            new StyleableProperty<TextInputControl,Paint>("-fx-prompt-text-fill",
                 PaintConverter.getInstance(), Color.GRAY) {
 
             @Override
-            public boolean isSettable(TextInputControlSkin n) {
-                return n.promptTextFill == null || !n.promptTextFill.isBound();
+            public boolean isSettable(TextInputControl n) {
+                final TextInputControlSkin skin = (TextInputControlSkin) n.getSkin();
+                return skin.promptTextFill == null || !skin.promptTextFill.isBound();
             }
 
             @Override
-            public WritableValue<Paint> getWritableValue(TextInputControlSkin n) {
-                return n.promptTextFill;
+            public WritableValue<Paint> getWritableValue(TextInputControl n) {
+                final TextInputControlSkin skin = (TextInputControlSkin) n.getSkin();
+                return skin.promptTextFill;
             }
         };
         
-        private static final StyleableProperty<TextInputControlSkin,Paint> HIGHLIGHT_FILL =
-            new StyleableProperty<TextInputControlSkin,Paint>("-fx-highlight-fill",
+        private static final StyleableProperty<TextInputControl,Paint> HIGHLIGHT_FILL =
+            new StyleableProperty<TextInputControl,Paint>("-fx-highlight-fill",
                 PaintConverter.getInstance(), Color.DODGERBLUE) {
 
             @Override
-            public boolean isSettable(TextInputControlSkin n) {
-                return n.highlightFill == null || !n.highlightFill.isBound();
+            public boolean isSettable(TextInputControl n) {
+                final TextInputControlSkin skin = (TextInputControlSkin) n.getSkin();
+                return skin.highlightFill == null || !skin.highlightFill.isBound();
             }
 
             @Override
-            public WritableValue<Paint> getWritableValue(TextInputControlSkin n) {
-                return n.highlightFill;
+            public WritableValue<Paint> getWritableValue(TextInputControl n) {
+                final TextInputControlSkin skin = (TextInputControlSkin) n.getSkin();
+                return skin.highlightFill;
             }
         };
         
-        private static final StyleableProperty<TextInputControlSkin,Paint> HIGHLIGHT_TEXT_FILL =
-            new StyleableProperty<TextInputControlSkin,Paint>("-fx-highlight-text-fill",
+        private static final StyleableProperty<TextInputControl,Paint> HIGHLIGHT_TEXT_FILL =
+            new StyleableProperty<TextInputControl,Paint>("-fx-highlight-text-fill",
                 PaintConverter.getInstance(), Color.WHITE) {
 
             @Override
-            public boolean isSettable(TextInputControlSkin n) {
-                return n.highlightTextFill == null || !n.highlightTextFill.isBound();
+            public boolean isSettable(TextInputControl n) {
+                final TextInputControlSkin skin = (TextInputControlSkin) n.getSkin();
+                return skin.highlightTextFill == null || !skin.highlightTextFill.isBound();
             }
 
             @Override
-            public WritableValue<Paint> getWritableValue(TextInputControlSkin n) {
-                return n.highlightTextFill;
+            public WritableValue<Paint> getWritableValue(TextInputControl n) {
+                final TextInputControlSkin skin = (TextInputControlSkin) n.getSkin();
+                return skin.highlightTextFill;
             }
         };
         
-        private static final StyleableProperty<TextInputControlSkin,Boolean> DISPLAY_CARET =
-            new StyleableProperty<TextInputControlSkin,Boolean>("-fx-display-caret",
+        private static final StyleableProperty<TextInputControl,Boolean> DISPLAY_CARET =
+            new StyleableProperty<TextInputControl,Boolean>("-fx-display-caret",
                 BooleanConverter.getInstance(), Boolean.TRUE) {
 
             @Override
-            public boolean isSettable(TextInputControlSkin n) {
-                return n.displayCaret == null || !n.displayCaret.isBound();
+            public boolean isSettable(TextInputControl n) {
+                final TextInputControlSkin skin = (TextInputControlSkin) n.getSkin();
+                return skin.displayCaret == null || !skin.displayCaret.isBound();
             }
 
             @Override
-            public WritableValue<Boolean> getWritableValue(TextInputControlSkin n) {
-                return n.displayCaret;
+            public WritableValue<Boolean> getWritableValue(TextInputControl n) {
+                final TextInputControlSkin skin = (TextInputControlSkin) n.getSkin();
+                return skin.displayCaret;
             }
         };
 
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TitledPaneSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TitledPaneSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -52,6 +52,7 @@
 import com.sun.javafx.scene.traversal.TraversalEngine;
 import com.sun.javafx.scene.traversal.TraverseListener;
 import javafx.geometry.Insets;
+import javafx.scene.control.Accordion;
 import javafx.scene.control.Labeled;
 import javafx.scene.text.Font;
 
@@ -68,25 +69,28 @@
     private Rectangle clipRect;
     private Pos pos;
     private HPos hpos;
-    private VPos vpos;    
+    private VPos vpos;
 
     public TitledPaneSkin(final TitledPane titledPane) {
         super(titledPane, new TitledPaneBehavior(titledPane));
 
         clipRect = new Rectangle();
-        setClip(clipRect);
+        getSkinnable().setClip(clipRect);
 
         transitionStartValue = 0;
         titleRegion = new TitleRegion();
 
         contentRegion = new Content(getSkinnable().getContent());
-        contentContainer = new ContentContainer();        
+        contentContainer = new ContentContainer();
         contentContainer.getChildren().setAll(contentRegion);
 
         if (titledPane.isExpanded()) {
             setExpanded(titledPane.isExpanded());
         } else {
             setTransition(0.0f);
+            if (contentRegion.getContent() != null) {
+                contentRegion.getContent().setVisible(false);
+            }
         }
 
         getChildren().setAll(contentContainer, titleRegion);
@@ -95,27 +99,19 @@
         registerChangeListener(titledPane.expandedProperty(), "EXPANDED");
         registerChangeListener(titledPane.collapsibleProperty(), "COLLAPSIBLE");
         registerChangeListener(titledPane.alignmentProperty(), "ALIGNMENT");
-        registerChangeListener(titleRegion.alignmentProperty(), "TITLE_REGION_ALIGNMENT");        
-        
+        registerChangeListener(titledPane.widthProperty(), "WIDTH");
+        registerChangeListener(titledPane.heightProperty(), "HEIGHT");
+        registerChangeListener(titleRegion.alignmentProperty(), "TITLE_REGION_ALIGNMENT");
+
         pos = titledPane.getAlignment();
         hpos = titledPane.getAlignment().getHpos();
-        vpos = titledPane.getAlignment().getVpos();      
+        vpos = titledPane.getAlignment().getVpos();
     }
 
     public StackPane getContentRegion() {
         return contentRegion;
     }
 
-    @Override protected void setWidth(double value) {
-        super.setWidth(value);
-        clipRect.setWidth(value);
-    }
-
-    @Override protected void setHeight(double value) {
-        super.setHeight(value);
-        clipRect.setHeight(value);
-    }
-
     @Override
     protected void handleControlPropertyChanged(String property) {
         super.handleControlPropertyChanged(property);
@@ -133,6 +129,10 @@
             pos = titleRegion.getAlignment();
             hpos = pos.getHpos();
             vpos = pos.getVpos();
+        } else if (property == "WIDTH") {
+            clipRect.setWidth(getWidth());
+        } else if (property == "HEIGHT") {
+            clipRect.setHeight(getHeight());
         }
     }
 
@@ -161,7 +161,9 @@
             } else {
                 setTransition(0.0f);
             }
-            contentRegion.setVisible(expanded);
+            if (contentRegion.getContent() != null) {
+                contentRegion.getContent().setVisible(expanded);
+             }
             requestLayout();
         }
     }
@@ -190,10 +192,12 @@
         return transition;
     }
 
-    @Override protected void layoutChildren() {
-        double w = snapSize(getWidth()) - (snapSpace(getInsets().getLeft()) + snapSpace(getInsets().getRight()));
-        double h = snapSize(getHeight()) - (snapSpace(getInsets().getTop()) + snapSpace(getInsets().getBottom()));
+    private boolean isInsideAccordion() {
+        return getSkinnable().getParent() != null && getSkinnable().getParent() instanceof Accordion;
+    }
 
+    @Override protected void layoutChildren(final double x, double y,
+            final double w, final double h) {
         // header
         double headerHeight = Math.max(MIN_HEADER_HEIGHT, snapSize(titleRegion.prefHeight(-1)));
 
@@ -204,19 +208,19 @@
         // content
         double contentWidth = w;
         double contentHeight = h - headerHeight;
-        if (getSkinnable().getParent() != null && getSkinnable().getParent() instanceof AccordionSkin) {
+        if (isInsideAccordion()) {
             if (prefHeightFromAccordion != 0) {
                 contentHeight = prefHeightFromAccordion - headerHeight;
             }
         }
 
-        double y = snapSpace(getInsets().getTop()) + snapSpace(headerHeight) - (contentHeight * (1 - getTransition()));
-        double clipY = contentHeight * (1 - getTransition());                
+        y = snapSpace(getInsets().getTop()) + snapSpace(headerHeight) - (contentHeight * (1 - getTransition()));
+        double clipY = contentHeight * (1 - getTransition());
         ((Rectangle)contentContainer.getClip()).setY(clipY);
 
         contentContainer.resize(contentWidth, contentHeight);
         positionInArea(contentContainer, snapSpace(getInsets().getLeft()), y,
-            w, contentHeight, /*baseline ignored*/0, HPos.CENTER, VPos.CENTER);              
+            w, contentHeight, /*baseline ignored*/0, HPos.CENTER, VPos.CENTER);
     }
 
     @Override protected double computeMinWidth(double height) {
@@ -227,7 +231,7 @@
         return Math.max(MIN_HEADER_HEIGHT, snapSize(titleRegion.prefHeight(-1)));
     }
 
-    @Override protected double computePrefWidth(double height) {        
+    @Override protected double computePrefWidth(double height) {
         double titleWidth = snapSize(titleRegion.prefWidth(height));
         double contentWidth = snapSize(contentContainer.prefWidth(height));
 
@@ -236,19 +240,14 @@
 
     @Override protected double computePrefHeight(double width) {
         double headerHeight = Math.max(MIN_HEADER_HEIGHT, snapSize(titleRegion.prefHeight(-1)));
-        double contentHeight = 0;
-        if (getSkinnable().getParent() != null && getSkinnable().getParent() instanceof AccordionSkin) {
-            contentHeight = contentContainer.prefHeight(-1);
-        } else {
-            contentHeight = contentContainer.prefHeight(-1) * getTransition();
-        }
+        double contentHeight = contentContainer.prefHeight(-1) * getTransition();
         return headerHeight + snapSize(contentHeight) + snapSpace(getInsets().getTop()) + snapSpace(getInsets().getBottom());
     }
-       
-    @Override protected double computeMaxWidth(double height) {        
+
+    @Override protected double computeMaxWidth(double height) {
         return Double.MAX_VALUE;
-    }    
-    
+    }
+
     private double prefHeightFromAccordion = 0;
     void setMaxTitledPaneHeightForAccordion(double height) {
         this.prefHeightFromAccordion = height;
@@ -350,7 +349,7 @@
 
             setOnMouseReleased(new EventHandler<MouseEvent>() {
                 @Override public void handle(MouseEvent e) {
-                    if (getSkinnable().isCollapsible() && getSkinnable().isFocused()) {                        
+                    if (getSkinnable().isCollapsible() && getSkinnable().isFocused()) {
                         getBehavior().toggle();
                     }
                 }
@@ -400,10 +399,10 @@
             double right = snapSpace(getInsets().getRight());
             double arrowWidth = 0;
             double labelPrefWidth = labelPrefWidth(height);
-            
+
             if (arrowRegion != null) {
                 arrowWidth = snapSize(arrowRegion.prefWidth(height));
-            }            
+            }
 
             return left + arrowWidth + labelPrefWidth + right;
         }
@@ -413,11 +412,11 @@
             double bottom = snapSpace(getInsets().getBottom());
             double arrowHeight = 0;
             double labelPrefHeight = labelPrefHeight(width);
-            
+
             if (arrowRegion != null) {
                 arrowHeight = snapSize(arrowRegion.prefHeight(width));
             }
-            
+
             return top + Math.max(arrowHeight, labelPrefHeight) + bottom;
         }
 
@@ -438,12 +437,12 @@
                 // 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);            
-            
+            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);
         }
 
@@ -523,7 +522,7 @@
 
         public Content(Node n) {
             setContent(n);
-            
+
             engine = new TraversalEngine(this, false) {
                 @Override public void trav(Node owner, Direction dir) {
                     direction = dir;
@@ -536,9 +535,10 @@
 
         public final void setContent(Node n) {
             this.content = n;
-            getChildren().clear();            
+            getChildren().clear();
             if (n != null) {
-                getChildren().setAll(n);                
+                content.setVisible(getSkinnable().isExpanded());
+                getChildren().setAll(n);
             }
         }
 
@@ -551,36 +551,32 @@
             int index = engine.registeredNodes.indexOf(node);
 
             if (index == -1 && direction.equals(Direction.PREVIOUS)) {
-                // If the parent is an accordion we want to focus to go outside of the
-                // accordion and to the previous focusable control.
-                if (getSkinnable().getParent() != null && getSkinnable().getParent() instanceof AccordionSkin) {
-                    new TraversalEngine(getSkinnable(), false).trav(getSkinnable().getParent(), Direction.PREVIOUS);
-                }
+                getSkinnable().requestFocus();
             }
             if (index == -1 && direction.equals(Direction.NEXT)) {
                 // If the parent is an accordion we want to focus to go outside of the
                 // accordion and to the next focusable control.
-                if (getSkinnable().getParent() != null && getSkinnable().getParent() instanceof AccordionSkin) {
+                if (isInsideAccordion()) {
                     new TraversalEngine(getSkinnable(), false).trav(getSkinnable().getParent(), Direction.NEXT);
                 }
             }
         }
     }
-    
+
     class ContentContainer extends StackPane {
         private Rectangle clipRect;
-        
+
         public ContentContainer() {
             getStyleClass().setAll("content");
             clipRect = new Rectangle();
             setClip(clipRect);
 
             // RT-20266: We want to align the content container so the bottom of the content
-            // is at the bottom of the title region.  If we do not do this the 
+            // is at the bottom of the title region.  If we do not do this the
             // content will be center aligned.
-            setAlignment(Pos.BOTTOM_CENTER);            
+            setAlignment(Pos.BOTTOM_CENTER);
         }
-        
+
         @Override protected void setWidth(double value) {
             super.setWidth(value);
             clipRect.setWidth(value);
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ToolBarSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/ToolBarSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -50,6 +50,7 @@
 import javafx.scene.control.CustomMenuItem;
 import javafx.scene.control.Separator;
 import javafx.scene.control.SeparatorMenuItem;
+import javafx.scene.control.SkinBase;
 import javafx.scene.control.ToolBar;
 import javafx.scene.input.KeyCode;
 import javafx.scene.input.KeyEvent;
@@ -89,7 +90,7 @@
         initialize();
         registerChangeListener(toolbar.orientationProperty(), "ORIENTATION");
 
-        engine = new TraversalEngine(this, false) {
+        engine = new TraversalEngine(getSkinnable(), false) {
             @Override public void trav(Node owner, Direction dir) {
                 // This allows the right arrow to select the overflow menu
                 // without it only the tab key can select the overflow menu.
@@ -104,7 +105,7 @@
             }
         };
         engine.addTraverseListener(this);
-        setImpl_traversalEngine(engine);
+        getSkinnable().setImpl_traversalEngine(engine);
 
         toolbar.focusedProperty().addListener(new ChangeListener<Boolean>() {
             @Override
@@ -292,8 +293,9 @@
                 Double.MAX_VALUE : snapSize(getSkinnable().prefHeight(-1));
     }
 
-    @Override protected void layoutChildren() {
-        super.layoutChildren();
+    @Override protected void layoutChildren(double x, double y,
+            final double w, final double h) {
+//        super.layoutChildren();
 
         if (getSkinnable().getOrientation() == Orientation.VERTICAL) {
             if (snapSize(getHeight()) != previousHeight || needsUpdate) {
@@ -327,8 +329,6 @@
 
         // If popup menu is not null show the overflowControl
         if (overflow) {
-            double x;
-            double y;
             double overflowMenuWidth = snapSize(overflowMenu.prefWidth(-1));
             double overflowMenuHeight = snapSize(overflowMenu.prefHeight(-1));
             if (getSkinnable().getOrientation() == Orientation.VERTICAL) {
@@ -619,33 +619,37 @@
       * @treatAsPrivate implementation detail
       */
      private static class StyleableProperties {
-         private static final StyleableProperty<ToolBarSkin,Number> SPACING =
-             new StyleableProperty<ToolBarSkin,Number>("-fx-spacing",
+         private static final StyleableProperty<ToolBar,Number> SPACING =
+             new StyleableProperty<ToolBar,Number>("-fx-spacing",
                  SizeConverter.getInstance(), 0.0) {
 
             @Override
-            public boolean isSettable(ToolBarSkin n) {
-                return n.spacing == null || !n.spacing.isBound();
+            public boolean isSettable(ToolBar n) {
+                final ToolBarSkin skin = (ToolBarSkin) n.getSkin();
+                return skin.spacing == null || !skin.spacing.isBound();
             }
 
             @Override
-            public WritableValue<Number> getWritableValue(ToolBarSkin n) {
-                return n.spacingProperty();
+            public WritableValue<Number> getWritableValue(ToolBar n) {
+                final ToolBarSkin skin = (ToolBarSkin) n.getSkin();
+                return skin.spacingProperty();
             }
         };
          
-        private static final StyleableProperty<ToolBarSkin,Pos>ALIGNMENT =
-                new StyleableProperty<ToolBarSkin,Pos>("-fx-alignment",
+        private static final StyleableProperty<ToolBar,Pos>ALIGNMENT =
+                new StyleableProperty<ToolBar,Pos>("-fx-alignment",
                 new EnumConverter<Pos>(Pos.class), Pos.TOP_LEFT ) {
 
             @Override
-            public boolean isSettable(ToolBarSkin n) {
-                return n.boxAlignment == null || !n.boxAlignment.isBound();
+            public boolean isSettable(ToolBar n) {
+                final ToolBarSkin skin = (ToolBarSkin) n.getSkin();
+                return skin.boxAlignment == null || !skin.boxAlignment.isBound();
             }
 
             @Override
-            public WritableValue<Pos> getWritableValue(ToolBarSkin n) {
-                return n.boxAlignmentProperty();
+            public WritableValue<Pos> getWritableValue(ToolBar n) {
+                final ToolBarSkin skin = (ToolBarSkin) n.getSkin();
+                return skin.boxAlignmentProperty();
             }
         };
 
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TreeCellSkin.java	Sat Jul 28 07:39:14 2012 -0700
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TreeCellSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -74,22 +74,17 @@
     public final DoubleProperty indentProperty() { 
         if (indent == null) {
             indent = new StyleableDoubleProperty(10.0) {
-
-                @Override
-                public Object getBean() {
+                @Override public Object getBean() {
                     return TreeCellSkin.this;
                 }
 
-                @Override
-                public String getName() {
+                @Override public String getName() {
                     return "indent";
                 }
 
-                @Override
-                public StyleableProperty getStyleableProperty() {
+                @Override public StyleableProperty getStyleableProperty() {
                     return StyleableProperties.INDENT;
                 }
-                
             };
         }
         return indent; 
@@ -131,26 +126,19 @@
         }
     }
 
-    @Override public void impl_processCSS(boolean reapply) {
-        // This is needed now that TreeCell is Labeled - otherwise RT-15450 occurs
+    @Override protected void updateChildren() {
+        super.updateChildren();
         updateDisclosureNode();
-        
-        super.impl_processCSS(reapply);
     }
     
-    @Override protected void layoutChildren() {
+    @Override protected void layoutChildren(double x, final double y,
+            double w, final double h) {
         TreeItem treeItem = getSkinnable().getTreeItem();
         if (treeItem == null) return;
         
         TreeView tree = getSkinnable().getTreeView();
         if (tree == null) return;
         
-        // figure out the content area that is to be filled
-        double x = getInsets().getLeft();
-        double y = getInsets().getTop();
-        double w = getWidth() - (getInsets().getLeft() + getInsets().getRight());
-        double h = getHeight() - (getInsets().getTop() + getInsets().getBottom());
-
         Node disclosureNode = getSkinnable().getDisclosureNode();
         
         int level = TreeView.getNodeLevel(getSkinnable().getTreeItem());
@@ -230,18 +218,19 @@
 
     /** @treatAsPrivate */
     private static class StyleableProperties {
-        private static final StyleableProperty<TreeCellSkin,Number> INDENT = 
-            new StyleableProperty<TreeCellSkin,Number>("-fx-indent",
+        
+        private static final StyleableProperty<TreeCell,Number> INDENT = 
+            new StyleableProperty<TreeCell,Number>("-fx-indent",
                 SizeConverter.getInstance(), 10.0) {
-
-            @Override
-            public boolean isSettable(TreeCellSkin n) {
-                return n.indent == null || !n.indent.isBound();
+                    
+            @Override public boolean isSettable(TreeCell n) {
+                DoubleProperty p = ((TreeCellSkin) n.getSkin()).indentProperty();
+                return p == null || !p.isBound();
             }
 
-            @Override
-            public WritableValue<Number> getWritableValue(TreeCellSkin n) {
-                return n.indentProperty();
+            @Override public WritableValue<Number> getWritableValue(TreeCell n) {
+                final TreeCellSkin skin = (TreeCellSkin) n.getSkin();
+                return skin.indentProperty();
             }
         };
         
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TreeTableRowSkin.java	Mon Jul 30 13:08:41 2012 -0700
@@ -0,0 +1,559 @@
+/*
+ * Copyright (c) 2010, 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 com.preview.javafx.scene.control.TreeTableRow;
+import com.preview.javafx.scene.control.TreeTableView;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import javafx.beans.property.DoubleProperty;
+import javafx.beans.property.SimpleDoubleProperty;
+import javafx.geometry.HPos;
+import javafx.geometry.VPos;
+import javafx.scene.Node;
+import javafx.scene.control.TreeItem;
+import javafx.scene.control.TreeView;
+
+import com.sun.javafx.css.Styleable;
+import com.sun.javafx.css.StyleableDoubleProperty;
+import com.sun.javafx.css.StyleableProperty;
+import com.sun.javafx.css.converters.SizeConverter;
+import com.sun.javafx.scene.control.WeakListChangeListener;
+import com.sun.javafx.scene.control.behavior.CellBehaviorBase;
+import com.sun.javafx.scene.control.behavior.TreeTableRowBehavior;
+import javafx.beans.value.WritableValue;
+import javafx.collections.ListChangeListener;
+import javafx.collections.ObservableList;
+import javafx.scene.control.*;
+
+/**
+ *
+ */
+public class TreeTableRowSkin<T> extends CellSkinBase<TreeTableRow<T>, CellBehaviorBase<TreeTableRow<T>>> {
+
+    /*
+     * This is rather hacky - but it is a quick workaround to resolve the
+     * issue that we don't know maximum width of a disclosure node for a given
+     * TreeView. If we don't know the maximum width, we have no way to ensure
+     * consistent indentation for a given TreeView.
+     *
+     * To work around this, we create a single WeakHashMap to store a max
+     * disclosureNode width per TreeView. We use WeakHashMap to help prevent
+     * any memory leaks.
+     */
+    private static final Map<TreeView, Double> maxDisclosureWidthMap = new WeakHashMap<TreeView, Double>();
+
+    /**
+     * The amount of space to multiply by the treeItem.level to get the left
+     * margin for this tree cell. This is settable from CSS
+     */
+    private DoubleProperty indent = null;
+    public final void setIndent(double value) { indentProperty().set(value); }
+    public final double getIndent() { return indent == null ? 10.0 : indent.get(); }
+    public final DoubleProperty indentProperty() { 
+        if (indent == null) {
+            indent = new StyleableDoubleProperty(10.0) {
+                @Override public Object getBean() {
+                    return TreeTableRowSkin.this;
+                }
+
+                @Override public String getName() {
+                    return "indent";
+                }
+
+                @Override public StyleableProperty getStyleableProperty() {
+                    return TreeTableRowSkin.StyleableProperties.INDENT;
+                }
+            };
+        }
+        return indent; 
+    }
+
+    public TreeTableRowSkin(TreeTableRow<T> control) {
+        super(control, new TreeTableRowBehavior<T>(control));
+        
+        updateDisclosureNode();
+        
+        recreateCells();
+        updateCells(true);
+
+        initBindings();
+
+        registerChangeListener(control.editingProperty(), "EDITING");
+        registerChangeListener(control.indexProperty(), "ROW");
+        registerChangeListener(control.tableViewProperty(), "TABLE_VIEW");
+        registerChangeListener(control.treeItemProperty(), "TREE_ITEM");
+    }
+    
+    @Override protected void handleControlPropertyChanged(String p) {
+        // we run this before the super call because we want to update whether
+        // we are showing columns or the node (if it isn't null) before the
+        // parent class updates the content
+        if (p == "TEXT" || p == "GRAPHIC" || p == "EDITING") {
+            updateShowColumns();
+        }
+
+        super.handleControlPropertyChanged(p);
+
+        if (p == "ROW") {
+            updateCells = true;
+            requestLayout();
+        } else if (p == "TABLE_VIEW") {
+//            for (int i = 0; i < getChildren().size(); i++) {
+//                ((TableCell)getChildren().get(i)).updateTableView(getSkinnable().getTableView());
+//            }
+        } else if ( p == "TREE_ITEM") {
+            updateDisclosureNode();
+        }
+        
+    }
+    
+    private void updateDisclosureNode() {
+        if (getSkinnable().isEmpty()) return;
+
+        Node disclosureNode = getSkinnable().getDisclosureNode();
+        if (disclosureNode == null) return;
+        
+        TreeItem treeItem = getSkinnable().getTreeItem();
+        
+        boolean disclosureVisible = treeItem != null && ! treeItem.isLeaf();
+        disclosureNode.setVisible(disclosureVisible);
+            
+        if (! disclosureVisible) {
+            getChildren().remove(disclosureNode);
+        } else if (disclosureNode.getParent() == null) {
+            getChildren().add(disclosureNode);
+            disclosureNode.toFront();
+        } else {
+            disclosureNode.toBack();
+        }
+    }
+
+    private boolean childrenDirty = false;
+    @Override protected void updateChildren() {
+        super.updateChildren();
+        updateDisclosureNode();
+        
+        if (childrenDirty) {
+            childrenDirty = false;
+            if (showColumns) {
+                if (cells.isEmpty()) {
+                    getChildren().clear();
+                } else {
+                    // TODO we can optimise this by only showing cells that are 
+                    // visible based on the table width and the amount of horizontal
+                    // scrolling.
+                    getChildren().addAll(cells);
+                }
+            } else {
+                getChildren().clear();
+
+                if (!isIgnoreText() || !isIgnoreGraphic()) {
+                    getChildren().add(getSkinnable());
+                }
+            }
+        }
+    }
+    
+    @Override protected void layoutChildren(double x, final double y,
+            double w, final double h) {
+        TreeItem treeItem = getSkinnable().getTreeItem();
+        if (treeItem == null) return;
+        
+        TreeView tree = getSkinnable().getTreeTableView();
+        if (tree == null) return;
+        
+        doUpdateCheck();
+
+        Node disclosureNode = getSkinnable().getDisclosureNode();
+        
+        int level = TreeView.getNodeLevel(getSkinnable().getTreeItem());
+        if (! tree.isShowRoot()) level--;
+        double leftMargin = getIndent() * level;
+
+        x += leftMargin;
+
+        // position the disclosure node so that it is at the proper indent
+        boolean disclosureVisible = disclosureNode != null && treeItem != null && ! treeItem.isLeaf();
+
+        final double defaultDisclosureWidth = maxDisclosureWidthMap.containsKey(tree) ?
+            maxDisclosureWidthMap.get(tree) : 0;
+        double disclosureWidth = defaultDisclosureWidth;
+
+        if (disclosureVisible) {
+            disclosureWidth = disclosureNode.prefWidth(-1);
+            if (disclosureWidth > defaultDisclosureWidth) {
+                maxDisclosureWidthMap.put(tree, disclosureWidth);
+            }
+
+            double ph = disclosureNode.prefHeight(-1);
+
+            System.out.println("disclosure visible: " + disclosureWidth + ", " + ph);
+            disclosureNode.resize(disclosureWidth, ph);
+            positionInArea(disclosureNode, x, y,
+                    disclosureWidth, h, /*baseline ignored*/0,
+                    HPos.CENTER, VPos.CENTER);
+        }
+
+        // determine starting point of the graphic or cell node, and the
+        // remaining width available to them
+        final int padding = treeItem.getGraphic() == null ? 0 : 3;
+        x += disclosureWidth + padding;
+        w -= (leftMargin + disclosureWidth + padding);
+
+//        layoutLabelInArea(x, y, w, h);
+        
+        
+        
+        
+        
+        
+        
+        
+        TableView<T> table = getSkinnable().getTableView();
+        if (table == null) return;
+        if (cellsMap.isEmpty()) return;
+        
+        if (showColumns && ! table.getVisibleLeafColumns().isEmpty()) {
+            // layout the individual column cells
+            TableColumn<T,?> col;
+            TableCell cell;
+//            double x = getInsets().getLeft();
+            double width;
+            double height;
+            List<TableColumn<T,?>> leafColumns = table.getVisibleLeafColumns();
+            
+            double verticalPadding = getInsets().getTop() + getInsets().getBottom();
+            double horizontalPadding = getInsets().getLeft() + getInsets().getRight();
+            
+            for (int i = 0; i < leafColumns.size(); i++) {
+                col = leafColumns.get(i);
+                cell = cellsMap.get(col);
+                if (cell == null) continue;
+
+                width = snapSize(cell.prefWidth(-1) - horizontalPadding);
+                height = Math.max(getHeight(), cell.prefHeight(-1));
+                height = snapSize(height - verticalPadding);
+                
+                if (i == 0) {
+                    cell.resize(width - leftMargin - disclosureWidth, height);
+                    cell.relocate(x, getInsets().getTop());
+                } else {
+                    cell.resize(width, height);
+                    cell.relocate(x - leftMargin - disclosureWidth, getInsets().getTop());
+                }
+                
+                x += width;
+            }
+        } else {
+            super.layoutChildren(x,y,w,h);
+        }
+    }
+
+    @Override protected double computePrefHeight(double width) {
+        doUpdateCheck();
+        
+        if (showColumns) {
+            // FIXME according to profiling, this method is slow and should
+            // be optimised
+            double prefHeight = 0.0f;
+            final int count = cells.size();
+            for (int i=0; i<count; i++) {
+                final TableCell tableCell = cells.get(i);
+                prefHeight = Math.max(prefHeight, tableCell.prefHeight(-1));
+            }
+            return Math.max(prefHeight, Math.max(getCellSize(), getSkinnable().minHeight(-1)));
+        } else {
+            double pref = super.computePrefHeight(width);
+            Node d = getSkinnable().getDisclosureNode();
+            return (d == null) ? pref : Math.max(d.prefHeight(-1), pref);
+        }
+    }
+    
+    @Override protected double computePrefWidth(double height) {
+        doUpdateCheck();
+        
+        if (showColumns) {
+            double pw = getInsets().getLeft() + getInsets().getRight();
+            
+            TreeTableView tree = getSkinnable().getTreeTableView();
+            if (tree == null) return pw;
+
+            TreeItem treeItem = getSkinnable().getTreeItem();
+            if (treeItem == null) return pw;
+            
+            // determine the amount of indentation
+            int level = TreeView.getNodeLevel(treeItem);
+            if (! tree.isShowRoot()) level--;
+            pw += getIndent() * level;
+
+            // include the disclosure node width
+            Node disclosureNode = getSkinnable().getDisclosureNode();
+            final double defaultDisclosureWidth = maxDisclosureWidthMap.containsKey(tree) ?
+                    maxDisclosureWidthMap.get(tree) : 0;
+            pw += Math.max(defaultDisclosureWidth, disclosureNode.prefWidth(-1));
+
+            // sum up width of all columns
+            if (getSkinnable().getTableView() != null) {
+                for (TableColumn<T,?> tableColumn : getSkinnable().getTableView().getVisibleLeafColumns()) {
+                    pw += tableColumn.getWidth();
+                }
+            }
+
+            return pw;
+        } else {
+            return super.computePrefWidth(height);
+        }
+    }
+
+    /***************************************************************************
+     *                                                                         *
+     *                         Stylesheet Handling                             *
+     *                                                                         *
+     **************************************************************************/
+
+    /** @treatAsPrivate */
+    private static class StyleableProperties {
+        
+        private static final StyleableProperty<TreeTableRow,Number> INDENT = 
+            new StyleableProperty<TreeTableRow,Number>("-fx-indent",
+                SizeConverter.getInstance(), 10.0) {
+                    
+            @Override public boolean isSettable(TreeTableRow n) {
+                DoubleProperty p = ((TreeTableRowSkin) n.getSkin()).indentProperty();
+                return p == null || !p.isBound();
+            }
+
+            @Override public WritableValue<Number> getWritableValue(TreeTableRow n) {
+                final TreeTableRowSkin skin = (TreeTableRowSkin) n.getSkin();
+                return skin.indentProperty();
+            }
+        };
+        
+        private static final List<StyleableProperty> STYLEABLES;
+        static {
+            final List<StyleableProperty> styleables =
+                new ArrayList<StyleableProperty>(CellSkinBase.impl_CSS_STYLEABLES());
+            Collections.addAll(styleables,
+                INDENT
+            );
+            STYLEABLES = Collections.unmodifiableList(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 TreeTableRowSkin.StyleableProperties.STYLEABLES;
+    }
+
+    /**
+     * RT-19263
+     * @treatAsPrivate implementation detail
+     * @deprecated This is an experimental API that is not intended for general use and is subject to change in future versions
+     */
+    @Deprecated
+    public List<StyleableProperty> impl_getStyleableProperties() {
+        return impl_CSS_STYLEABLES();
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    // Specifies the number of times we will call 'recreateCells()' before we blow
+    // out the cellsMap structure and rebuild all cells. This helps to prevent
+    // against memory leaks in certain extreme circumstances.
+    private static final int DEFAULT_FULL_REFRESH_COUNTER = 100;
+
+    /*
+     * A map that maps from TableColumn to TableCell (i.e. model to view).
+     * This is recreated whenever the leaf columns change, however to increase
+     * efficiency we create cells for all columns, even if they aren't visible,
+     * and we only create new cells if we don't already have it cached in this
+     * map.
+     *
+     * Note that this means that it is possible for this map to therefore be
+     * a memory leak if an application uses TableView and is creating and removing
+     * a large number of tableColumns. This is mitigated in the recreateCells()
+     * function below - refer to that to learn more.
+     */
+    private WeakHashMap<TableColumn, TableCell> cellsMap;
+
+    // This observableArrayList contains the currently visible table cells for this row.
+    private final List<TableCell> cells = new ArrayList<TableCell>();
+    
+    private int fullRefreshCounter = DEFAULT_FULL_REFRESH_COUNTER;
+
+    private boolean showColumns = true;
+    
+    private boolean isDirty = false;
+    private boolean updateCells = false;
+    
+    private ListChangeListener visibleLeafColumnsListener = new ListChangeListener() {
+        @Override public void onChanged(ListChangeListener.Change c) {
+            isDirty = true;
+            requestLayout();
+        }
+    };
+
+//    public TableRowSkin(TableRow<T> tableRow) {
+//        super(tableRow, new CellBehaviorBase<TableRow<T>>(tableRow));
+//
+//        recreateCells();
+//        updateCells(true);
+//
+//        initBindings();