changeset 874:bc96fe004617

RT-19452: TableView: Item renderers and item editors
author jgiles
date Fri, 20 Apr 2012 12:11:25 +1200
parents e80d39015aa3
children 8f6e1d3273ea
files javafx-ui-controls/src/com/sun/javafx/scene/control/CheckBoxTreeItem.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/CellUtils.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/CheckBoxCellFactory.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/CheckBoxListCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/CheckBoxTableCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/CheckBoxTreeCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ChoiceBoxCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ChoiceBoxCellFactory.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ChoiceBoxListCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ChoiceBoxTableCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ChoiceBoxTreeCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ComboBoxCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ComboBoxCellFactory.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ComboBoxListCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ComboBoxTableCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ComboBoxTreeCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/MapValueFactory.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ProgressBarCellFactory.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ProgressBarTableCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringConverterCellFactory.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringConverterListCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringConverterTableCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringConverterTreeCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringFormatCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringFormatCellFactory.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringFormatListCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringFormatTableCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringFormatTreeCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/TextFieldCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/TextFieldCellFactory.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/TextFieldListCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/TextFieldTableCell.java javafx-ui-controls/src/com/sun/javafx/scene/control/cell/TextFieldTreeCell.java
diffstat 33 files changed, 4622 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/CheckBoxTreeItem.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,347 @@
+/*
+ * 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;
+
+import com.sun.javafx.scene.control.cell.CheckBoxCellFactory;
+import com.sun.javafx.scene.control.cell.CheckBoxTreeCell;
+import javafx.beans.property.BooleanProperty;
+import javafx.beans.property.SimpleBooleanProperty;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
+import javafx.event.Event;
+import javafx.event.EventType;
+import javafx.scene.Node;
+import javafx.scene.control.CheckBox;
+import javafx.scene.control.TreeItem;
+
+/**
+ * TreeItem subclass that adds support for being in selected, unselected, and
+ * indeterminate states. This is useful when used in conjunction with a TreeView
+ * which has a {@link CheckBoxCellFactory} installed.
+ * 
+ * <p>A CheckBoxTreeItem can be {@link #independentProperty() independent} or 
+ * dependent. By default, CheckBoxTreeItem instances are dependent, which means 
+ * that any changes to the selection state of a TreeItem will have an impact on 
+ * parent and children CheckBoxTreeItem instances. 
+ * 
+ * <p>A simple example of using the CheckBoxTreeItem class, in conjunction with 
+ * {@link CheckBoxCellFactory} or {@link CheckBoxTreeCell} classes is shown 
+ * below:
+ * 
+ * <pre><code>
+ * // create the tree model
+ * CheckBoxTreeItem&lt;String&gt; jonathanGiles = new CheckBoxTreeItem&lt;String&gt;("Jonathan");
+ * CheckBoxTreeItem&lt;String&gt; juliaGiles = new CheckBoxTreeItem&lt;String&gt;("Julia");
+ * CheckBoxTreeItem&lt;String&gt; mattGiles = new CheckBoxTreeItem&lt;String&gt;("Matt");
+ * CheckBoxTreeItem&lt;String&gt; sueGiles = new CheckBoxTreeItem&lt;String&gt;("Sue");
+ * CheckBoxTreeItem&lt;String&gt; ianGiles = new CheckBoxTreeItem&lt;String&gt;("Ian");
+ * 
+ * CheckBoxTreeItem&lt;String&gt; gilesFamily = new CheckBoxTreeItem&lt;String&gt;("Giles Family");
+ * gilesFamily.setExpanded(true);
+ * gilesFamily.getChildren().addAll(jonathanGiles, juliaGiles, mattGiles, sueGiles, ianGiles);
+ * 
+ * // create the treeView
+ * final TreeView&lt;String&gt; treeView = new TreeView&lt;String&gt;();
+ * treeView.setRoot(gilesFamily);
+ *       
+ * // set the cell factory
+ * treeView.setCellFactory(CheckBoxCellFactory.&lt;String&gt;forTreeView());</code></pre>
+ *
+ * @see CheckBoxTreeCell
+ * @see CheckBoxCellFactory
+ * @see TreeItem
+ * @see CheckBox
+ */
+// TODO the TreeModificationEvent doesn't actually bubble in the same way as
+// TreeItem - it just looks that way as the 'bubbling' is done via changing the
+// state of all parent items.
+public class CheckBoxTreeItem<T> extends TreeItem<T> {
+    
+    /**
+     * An EventType used when the CheckBoxTreeItem selection / indeterminate
+     * state changes.
+     * 
+     * @param <T> The type of the value contained within the TreeItem.
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> EventType<TreeModificationEvent<T>> checkBoxSelectionChangedEvent() {
+        return (EventType<TreeModificationEvent<T>>) CHECK_BOX_SELECTION_CHANGED_EVENT;
+    }
+    private static final EventType<?> CHECK_BOX_SELECTION_CHANGED_EVENT
+            = new EventType<TreeModificationEvent<Object>>("checkBoxSelectionChangedEvent");
+
+    /***************************************************************************
+     *                                                                         *
+     * Constructors                                                            *
+     *                                                                         *
+     **************************************************************************/
+    
+    /**
+     * Creates a CheckBoxTreeItem with the value property set to the provided 
+     * object.
+     * 
+     * @param value The object to be stored as the value of this TreeItem.
+     */
+    public CheckBoxTreeItem(T value) {
+        this(value, null, false);
+    }
+
+    /**
+     * Creates a CheckBoxTreeItem with the value property set to the provided 
+     * object, and the graphic set to the provided Node.
+     * 
+     * @param value The object to be stored as the value of this CheckBoxTreeItem.
+     * @param graphic The Node to show in the TreeView next to this CheckBoxTreeItem.
+     */
+    public CheckBoxTreeItem(T value, Node graphic) {
+        this(value, graphic, false);
+    }
+    
+    /**
+     * Creates a CheckBoxTreeItem with the value property set to the provided 
+     * object, the graphic set to the provided Node, and the initial state
+     * of the {@link #selectedProperty()} set to the provided boolean value.
+     * 
+     * @param value The object to be stored as the value of this CheckBoxTreeItem.
+     * @param graphic The Node to show in the TreeView next to this CheckBoxTreeItem.
+     * @param selected The initial value of the 
+     *            {@link #selectedProperty() selected} property.
+     */
+    public CheckBoxTreeItem(T value, Node graphic, boolean selected) {
+        this(value, graphic, selected, false);
+    }
+
+    /**
+     * Creates a CheckBoxTreeItem with the value property set to the provided 
+     * object, the graphic set to the provided Node, the initial state
+     * of the {@link #selectedProperty()} set to the provided boolean value, and
+     * the initial state of the {@link #independentProperty() independent} 
+     * property to the provided boolean value.
+     * 
+     * @param value The object to be stored as the value of this CheckBoxTreeItem.
+     * @param graphic The Node to show in the TreeView next to this CheckBoxTreeItem.
+     * @param selected The initial value of the 
+     *            {@link #selectedProperty() selected} property.
+     * @param independent The initial value of the 
+     *            {@link #independentProperty() independent} property
+     */
+    public CheckBoxTreeItem(T value, Node graphic, boolean selected, boolean independent) {
+        super(value, graphic);
+        setSelected(selected);
+        setIndependent(independent);
+        
+        selectedProperty().addListener(stateChangeListener);
+        indeterminateProperty().addListener(stateChangeListener);
+    }
+
+    
+    
+    /***************************************************************************
+     *                                                                         *
+     * Callbacks                                                               *
+     *                                                                         *
+     **************************************************************************/   
+    private final ChangeListener<Boolean> stateChangeListener = new ChangeListener<Boolean>() {
+        @Override public void changed(ObservableValue<? extends Boolean> ov, Boolean oldVal, Boolean newVal) {
+            updateState();
+        }
+    };
+    
+    
+    /***************************************************************************
+     *                                                                         *
+     * Properties                                                              *
+     *                                                                         *
+     **************************************************************************/ 
+    
+    // --- Selected
+    private final BooleanProperty selected = new SimpleBooleanProperty(this, "selected", false) {
+        @Override protected void invalidated() {
+            super.invalidated();
+            fireEvent(CheckBoxTreeItem.this, true);
+        }
+    };
+    /** Sets the selected state of this CheckBoxTreeItem. */
+    public final void setSelected(Boolean value) { selectedProperty().setValue(value); }
+    /** Returns the selected state of this CheckBoxTreeItem. */
+    public final Boolean isSelected() { return selected == null ? false : selected.getValue(); }
+    /** A {@link BooleanProperty} used to represent the selected state of this CheckBoxTreeItem. */
+    public final BooleanProperty selectedProperty() { return selected; }
+    
+    
+    // --- Indeterminate
+    private final BooleanProperty indeterminate = new SimpleBooleanProperty(this, "indeterminate", false) {
+        @Override protected void invalidated() {
+            super.invalidated();
+            fireEvent(CheckBoxTreeItem.this, false);
+        }
+    };
+    /** Sets the indeterminate state of this CheckBoxTreeItem. */
+    public final void setIndeterminate(Boolean value) { indeterminateProperty().setValue(value); }
+    /** Returns the indeterminate state of this CheckBoxTreeItem. */
+    public final Boolean isIndeterminate() { return indeterminate == null ? false : indeterminate.getValue(); }
+    /** A {@link BooleanProperty} used to represent the indeterminate state of this CheckBoxTreeItem. */
+    public final BooleanProperty indeterminateProperty() { return indeterminate; }
+    
+    
+    // --- Independent
+    /** 
+     * A {@link BooleanProperty} used to represent the independent state of this CheckBoxTreeItem. 
+     * The independent state is used to represent whether changes to a single
+     * CheckBoxTreeItem should influence the state of its parent and children.
+     * 
+     * <p>By default, the independent property is false, which means that when
+     * a CheckBoxTreeItem has state changes to the selected or indeterminate
+     * properties, the state of related CheckBoxTreeItems will possibly be changed.
+     * If the independent property is set to true, the state of related CheckBoxTreeItems
+     * will <b>never</b> change.
+     */
+    public final BooleanProperty independentProperty() { return independent; }
+    private final BooleanProperty independent = new SimpleBooleanProperty(this, "independent", false);
+    public final void setIndependent(Boolean value) { independentProperty().setValue(value); }
+    public final Boolean isIndependent() { return independent == null ? false : independent.getValue(); }
+    
+    
+    
+    /***************************************************************************
+     *                                                                         *
+     * Private Implementation                                                  *
+     *                                                                         *
+     **************************************************************************/
+    
+    private static boolean updateLock = false;
+    
+    private void updateState() {
+        if (isIndependent()) return;
+        
+        boolean firstLock = ! updateLock;
+        
+        // toggle parent (recursively up to root)
+        updateLock = true;
+        updateUpwards();
+        
+        if (firstLock) updateLock = false;
+        
+        // toggle children
+        if (updateLock) return;
+        updateDownwards();
+    }
+
+    private void updateUpwards() {
+        if (! (getParent() instanceof CheckBoxTreeItem)) return;
+        
+        CheckBoxTreeItem<?> parent = (CheckBoxTreeItem<?>) getParent();
+        int selectCount = 0;
+        int indeterminateCount = 0;
+        for (TreeItem<?> child : parent.getChildren()) {
+            if (! (child instanceof CheckBoxTreeItem)) continue;
+            
+            CheckBoxTreeItem<?> cbti = (CheckBoxTreeItem<?>) child;
+            
+            selectCount += cbti.isSelected() && ! cbti.isIndeterminate() ? 1 : 0;
+            indeterminateCount += cbti.isIndeterminate() ? 1 : 0;
+        }
+        
+        if (selectCount == parent.getChildren().size()) {
+            parent.setSelected(true);
+            parent.setIndeterminate(false);
+        } else if (selectCount == 0 && indeterminateCount == 0) {
+            parent.setSelected(false);
+            parent.setIndeterminate(false);
+        } else {
+            parent.setIndeterminate(true);
+        }
+    }
+    
+    private void updateDownwards() {
+        // If this node is not a leaf, we also put all
+        // children into the same state as this branch
+        if (! isLeaf()) {
+            for (TreeItem<T> child : getChildren()) {
+                if (child instanceof CheckBoxTreeItem) {
+                    CheckBoxTreeItem<?> cbti = ((CheckBoxTreeItem<?>) child);
+                    cbti.setSelected(isSelected());
+                }
+            }
+        }
+    }
+    
+    private void fireEvent(CheckBoxTreeItem item, boolean selectionChanged) {
+        Event evt = new CheckBoxTreeItem.TreeModificationEvent(CHECK_BOX_SELECTION_CHANGED_EVENT, item, selectionChanged);
+        Event.fireEvent(this, evt);
+    }
+    
+    
+    /**
+     * A TreeModificationEvent class that works in a similar vein to the 
+     * {@link javafx.scene.control.TreeItem.TreeModificationEvent} class, in that
+     * this event will bubble up the CheckBoxTreeItem hierarchy, until the parent
+     * node is null.
+     * 
+     * @param <T> The type of the value contained within the
+     *      {@link CheckBoxTreeItem#valueProperty() value} property.
+     */
+    public static class TreeModificationEvent<T> extends Event {
+
+        private final CheckBoxTreeItem<T> treeItem;
+        private final boolean selectionChanged;
+
+        /**
+         * Creates a default TreeModificationEvent instance to represent the 
+         * change in selection/indeterminate states for the given CheckBoxTreeItem
+         * instance.
+         */
+        public TreeModificationEvent(EventType<? extends Event> eventType, CheckBoxTreeItem<T> treeItem, boolean selectionChanged) {
+            super(eventType);
+            this.treeItem = treeItem;
+            this.selectionChanged = selectionChanged;
+        }
+        
+        /** 
+         * Returns the CheckBoxTreeItem that this event occurred upon.
+         * @return The CheckBoxTreeItem that this event occurred upon.
+         */
+        public CheckBoxTreeItem<T> getTreeItem() {
+            return treeItem;
+        }
+        
+        /**
+         * Indicates the the reason for this event is that the selection on the
+         * CheckBoxTreeItem changed (as opposed to it becoming indeterminate).
+         */
+        public boolean wasSelectionChanged() {
+            return selectionChanged;
+        }
+        
+        /**
+         * Indicates the the reason for this event is that the indeterminate
+         * state on the CheckBoxTreeItem changed (as opposed to it becoming 
+         * selected or unselected).
+         */
+        public boolean wasIndeterminateChanged() {
+            return ! selectionChanged;
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/CellUtils.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,65 @@
+/*
+ * 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.cell;
+
+import javafx.scene.control.TreeItem;
+import javafx.util.StringConverter;
+
+// Package protected - not intended for external use
+class CellUtils {
+    
+    /*
+     * Simple method to provide a StringConverter implementation in various cell
+     * implementations.
+     */
+    static <T> StringConverter<T> defaultStringConverter() {
+        return new StringConverter<T>() {
+            @Override public String toString(T t) {
+                return t == null ? null : t.toString();
+            }
+
+            @Override public T fromString(String string) {
+                return (T) string;
+            }
+        };
+    }
+    
+    /*
+     * Simple method to provide a TreeItem-specific StringConverter 
+     * implementation in various cell implementations.
+     */
+    static <T> StringConverter<TreeItem<T>> defaultTreeItemStringConverter() {
+        return new StringConverter<TreeItem<T>>() {
+            @Override public String toString(TreeItem<T> treeItem) {
+                return (treeItem == null || treeItem.getValue() == null) ? 
+                        "" : treeItem.getValue().toString();
+            }
+
+            @Override public TreeItem<T> fromString(String string) {
+                return new TreeItem(string);
+            }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/CheckBoxCellFactory.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,443 @@
+/*
+ * 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.cell;
+
+import com.sun.javafx.beans.annotations.NoBuilder;
+import com.sun.javafx.scene.control.CheckBoxTreeItem;
+import javafx.beans.value.ObservableValue;
+import javafx.scene.control.CheckBox;
+import javafx.scene.control.ListCell;
+import javafx.scene.control.ListView;
+import javafx.scene.control.TableCell;
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.TreeCell;
+import javafx.scene.control.TreeItem;
+import javafx.scene.control.TreeView;
+import javafx.util.Callback;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing cell factories that use {@link CheckBox CheckBox} instances, 
+ * although the precise way in which these cell factories work differs between 
+ * controls. Be sure to read the API documentation for each static method, as 
+ * well as the class documentation for {@link CheckBoxListCell}, 
+ * {@link CheckBoxTableCell} and {@link CheckBoxTreeCell} before using it.
+ * 
+ * @see CheckBox
+ * @see CheckBoxListCell
+ * @see CheckBoxTreeCell
+ * @see CheckBoxTableCell
+ */
+@NoBuilder
+public final class CheckBoxCellFactory {
+    
+    private CheckBoxCellFactory() { }
+    
+    /**
+     * Creates a cell factory for use in ListView controls. When used in a 
+     * ListView, the {@link CheckBoxListCell} is rendered with a CheckBox on the 
+     * left-hand side of the ListView, with the text related to the list item 
+     * taking up all remaining horizontal space. 
+     * 
+     * @param <T> The type of the elements contained within the ListView.
+     * @param getSelectedProperty A {@link Callback} that, given an object of 
+     *      type T (which is a value taken out of the 
+     *      {@code ListView<T>.items} list), 
+     *      will return an {@code ObservableValue<Boolean>} that represents 
+     *      whether the given item is selected or not. This ObservableValue will 
+     *      be bound bidirectionally (meaning that the CheckBox in the cell will 
+     *      set/unset this property based on user interactions, and the CheckBox 
+     *      will reflect the state of the ObservableValue, if it changes 
+     *      externally).
+     * @return A {@link Callback} that will return a ListCell that is able to 
+     *      work on the type of element contained within the ListView items list.
+     */
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(
+            final Callback<T, ObservableValue<Boolean>> getSelectedProperty) {
+        return forListView(getSelectedProperty, null);
+    }
+    
+    /**
+     * Creates a cell factory for use in ListView controls. When used in a 
+     * ListView, the {@link CheckBoxListCell} is rendered with a CheckBox on the
+     * left-hand side of the ListView, with the text related to the list item 
+     * taking up all remaining horizontal space. 
+     * 
+     * @param <T> The type of the elements contained within the ListView.
+     * @param getSelectedProperty A {@link Callback} that, given an object 
+     *      of type T (which is a value taken out of the 
+     *      {@code ListView<T>.items} list), 
+     *      will return an {@code ObservableValue<Boolean>} that represents 
+     *      whether the given item is selected or not. This ObservableValue will 
+     *      be bound bidirectionally (meaning that the CheckBox in the cell will 
+     *      set/unset this property based on user interactions, and the CheckBox 
+     *      will reflect the state of the ObservableValue, if it changes 
+     *      externally).
+     * @param converter A StringConverter that, give an object of type T, will 
+     *      return a String that can be used to represent the object visually. 
+     * @return A {@link Callback} that will return a ListCell that is able to 
+     *      work on the type of element contained within the ListView.
+     */
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(
+            final Callback<T, ObservableValue<Boolean>> getSelectedProperty, 
+            final StringConverter<T> converter) {
+        return new Callback<ListView<T>, ListCell<T>>() {
+            @Override public ListCell<T> call(ListView<T> list) {
+                return new CheckBoxListCell<T>(getSelectedProperty, converter);
+            }
+        };
+    }
+    
+    /**
+     * Creates a cell factory for use in a TreeView control, although there is a 
+     * major assumption when used in a TreeView: this cell factory assumes that 
+     * the TreeView root, and <b>all</b> children are instances of 
+     * {@link CheckBoxTreeItem}, rather than the default {@link TreeItem} class 
+     * that is used normally.
+     * 
+     * <p>When used in a TreeView, the CheckBoxCell is rendered with a CheckBox 
+     * to the right of the 'disclosure node' (i.e. the arrow). The item stored 
+     * in {@link CheckBoxTreeItem#getValue()} will then have the StringConverter
+     * called on it, and this text will take all remaining horizontal space. 
+     * Additionally, by using {@link CheckBoxTreeItem}, the TreeView will 
+     * automatically handle situations such as:
+     * 
+     * <ul>
+     *   <li>Clicking on the {@link CheckBox} beside an item that has children 
+     *      will result in all children also becoming selected/unselected.</li>
+     *   <li>Clicking on the {@link CheckBox} beside an item that has a parent 
+     *      will possibly toggle the state of the parent. For example, if you 
+     *      select a single child, the parent will become indeterminate (indicating
+     *      partial selection of children). If you proceed to select all 
+     *      children, the parent will then show that it too is selected. This is
+     *      recursive, with all parent nodes updating as expected.</li>
+     * </ul>
+     * 
+     * <p>Unfortunately, due to limitations in Java, it is necessary to provide 
+     * an explicit cast when using this method. For example:
+     * 
+     * <pre>
+     * {@code
+     * final TreeView<String> treeView = new TreeView<String>();
+     * treeView.setCellFactory(CheckBoxCell.<String>forTreeView());}</pre>
+     * 
+     * @param <T> The type of the elements contained within the 
+     *      {@link CheckBoxTreeItem} instances.
+     * @return A {@link Callback} that will return a TreeCell that is able to 
+     *      work on the type of element contained within the TreeView root, and 
+     *      all of its children (recursively).
+     */
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView() {
+        Callback<TreeItem<T>, ObservableValue<Boolean>> getSelectedProperty = 
+                new Callback<TreeItem<T>, ObservableValue<Boolean>>() {
+            @Override public ObservableValue<Boolean> call(TreeItem<T> item) {
+                if (item instanceof CheckBoxTreeItem<?>) {
+                    return ((CheckBoxTreeItem<?>)item).selectedProperty();
+                }
+                return null;
+            }
+        };
+        Callback<TreeItem<T>, ObservableValue<Boolean>> getIndeterminateProperty = 
+                new Callback<TreeItem<T>, ObservableValue<Boolean>>() {
+            @Override public ObservableValue<Boolean> call(TreeItem<T> item) {
+                if (item instanceof CheckBoxTreeItem<?>) {
+                    return ((CheckBoxTreeItem<?>)item).indeterminateProperty();
+                }
+                return null;
+            }
+        };
+        return forTreeView(getSelectedProperty, 
+                           CellUtils.<T>defaultTreeItemStringConverter(), 
+                           getIndeterminateProperty);
+    }
+    
+    /**
+     * Creates a cell factory for use in a TreeView control. Unlike 
+     * {@link #forTreeView()}, this method does not assume that all TreeItem 
+     * instances in the TreeView are {@link CheckBoxTreeItem} instances.
+     * 
+     * <p>When used in a TreeView, the CheckBoxCell is rendered with a CheckBox 
+     * to the right of the 'disclosure node' (i.e. the arrow). The item stored 
+     * in {@link CheckBoxTreeItem#getValue()} will then have the StringConverter
+     * called on it, and this text will take all remaining horizontal space. 
+     * 
+     * <p>Unlike {@link #forTreeView()}, this cell factory does not handle 
+     * updating the state of parent or children TreeItems - it simply toggles 
+     * the {@code ObservableValue<Boolean>} that is provided, and no more. Of 
+     * course, this functionality can then be implemented externally by adding 
+     * observers to the {@code ObservableValue<Boolean>}, and toggling the state 
+     * of other properties as necessary.
+     * 
+     * @param <T> The type of the elements contained within the {@link TreeItem}
+     *      instances.
+     * @param getSelectedProperty A {@link Callback} that, given an object of 
+     *      type TreeItem<T>, will return an {@code ObservableValue<Boolean>} 
+     *      that represents whether the given item is selected or not. This 
+     *      {@code ObservableValue<Boolean>} will be bound bidirectionally 
+     *      (meaning that the CheckBox in the cell will set/unset this property 
+     *      based on user interactions, and the CheckBox will reflect the state 
+     *      of the {@code ObservableValue<Boolean>}, if it changes externally).
+     * @return A {@link Callback} that will return a TreeCell that is able to 
+     *      work on the type of element contained within the TreeView root, and 
+     *      all of its children (recursively).
+     */
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(
+            final Callback<TreeItem<T>, 
+            ObservableValue<Boolean>> getSelectedProperty) {
+        return forTreeView(getSelectedProperty, CellUtils.<T>defaultTreeItemStringConverter());
+    }
+    
+    /**
+     * Creates a cell factory for use in a TreeView control. Unlike 
+     * {@link #forTreeView()}, this method does not assume that all TreeItem 
+     * instances in the TreeView are {@link CheckBoxTreeItem}.
+     * 
+     * <p>When used in a TreeView, the CheckBoxCell is rendered with a CheckBox
+     * to the right of the 'disclosure node' (i.e. the arrow). The item stored 
+     * in {@link TreeItem#getValue()} will then have the the StringConverter
+     * called on it, and this text will take all remaining horizontal space. 
+     * 
+     * <p>Unlike {@link #forTreeView()}, this cell factory does not handle 
+     * updating the state of parent or children TreeItems - it simply toggles 
+     * the {@code ObservableValue<Boolean>} that is provided, and no more. Of 
+     * course, this functionality can then be implemented externally by adding 
+     * observers to the {@code ObservableValue<Boolean>}, and toggling the state 
+     * of other properties as necessary.
+     * 
+     * @param <T> The type of the elements contained within the {@link TreeItem} 
+     *      instances.
+     * @param getSelectedProperty A Callback that, given an object of 
+     *      type TreeItem<T>, will return an {@code ObservableValue<Boolean>} 
+     *      that represents whether the given item is selected or not. This 
+     *      {@code ObservableValue<Boolean>} will be bound bidirectionally 
+     *      (meaning that the CheckBox in the cell will set/unset this property 
+     *      based on user interactions, and the CheckBox will reflect the state of 
+     *      the {@code ObservableValue<Boolean>}, if it changes externally).
+     * @param converter A StringConverter that, give an object of type TreeItem<T>, 
+     *      will return a String that can be used to represent the object
+     *      visually. The default implementation in {@link #forTreeView(Callback)} 
+     *      is to simply call .toString() on all non-null items (and to just 
+     *      return an empty string in cases where the given item is null).      
+     * @return A {@link Callback} that will return a TreeCell that is able to 
+     *      work on the type of element contained within the TreeView root, and 
+     *      all of its children (recursively).
+     */
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(
+            final Callback<TreeItem<T>, ObservableValue<Boolean>> getSelectedProperty, 
+            final StringConverter<TreeItem<T>> converter) {
+        return forTreeView(getSelectedProperty, converter, null);
+    }
+    
+    /**
+     * Creates a cell factory for use in a TreeView control. Unlike 
+     * {@link #forTreeView()}, this method does not assume that all TreeItem 
+     * instances in the TreeView are {@link CheckBoxTreeItem}.
+     * 
+     * <p>To call this method, it is necessary to provide three 
+     * {@link Callback Callbacks}:
+     * 
+     * <ol>
+     *   <li><b>getSelectedProperty</b>: A Callback that, given an object of type 
+     *      TreeItem<T>, will return an {@code ObservableValue<Boolean>} that 
+     *      represents whether the given item is selected or not. This 
+     *      {@code ObservableValue<Boolean>} will be bound bidirectionally 
+     *      (meaning that the CheckBox in the cell will set/unset this property 
+     *      based on user interactions, and the CheckBox will reflect the state of 
+     *      the {@code ObservableValue<Boolean>}, if it changes externally).</li>
+     *   <li><b>converter</b>: A StringConverter that, give an object of type TreeItem<T>, 
+     *      will return a String that can be used to represent the object
+     *      visually. The default implementation in {@link #forTreeView(Callback)} 
+     *      is to simply call .toString() on all non-null items (and to just 
+     *      return an empty string in cases where the given item is null).</li>
+     *   <li><b>getIndeterminateProperty</b>: A Callback that, given an object 
+     *      of type TreeItem<T>, will return an {@code ObservableValue<Boolean>} 
+     *      that represents whether the given item is in an indeterminate state 
+     *      or not (refer to the {@link CheckBox#indeterminateProperty()} for
+     *      more information on what an indeterminate state is. This 
+     *      {@code ObservableValue<Boolean>} will be bound bidirectionally 
+     *      (meaning that the CheckBox in the cell will set/unset this property 
+     *      based on user interactions, and the CheckBox will reflect the state of 
+     *      the {@code ObservableValue<Boolean>}, if it changes externally).</li>
+     * </ol>
+     * 
+     * <p>When used in a TreeView, the CheckBoxCell is rendered with a CheckBox 
+     * to the right of the 'disclosure node' (i.e. the arrow). The item stored 
+     * in {@link TreeItem#getValue()} will then have the toString Callback 
+     * called on it, and this text will take all remaining horizontal space.
+     * 
+     * <p>Unlike {@link #forTreeView()}, this cell factory does not handle 
+     * updating the state of parent or children TreeItems - it simply toggles 
+     * the BooleanProperties that are provided via the 
+     * <code>getSelectedProperty</code> and <code>getIndeterminateProperty</code>
+     * callbacks, and no more. Of course, this functionality can then be 
+     * implemented externally by adding observers to the BooleanProperties, and 
+     * toggling the state of other properties as necessary.
+     * 
+     * @param <T> The type of the elements contained within the {@link TreeItem} 
+     *      instances.
+     * @param getSelectedProperty A {@link Callback} that will return an 
+     *      {@code ObservableValue<Boolean>} that represents whether the given 
+     *      item is selected or not.
+     * @param converter A StringConverter that, give an object of type TreeItem<T>, will 
+     *      return a String that can be used to represent the object visually.
+     * @param getIndeterminateProperty A {@link Callback} that will return an 
+     *      {@code ObservableValue<Boolean>} that represents whether the given 
+     *      item is indeterminate or not.
+     * @return A {@link Callback} that will return a TreeCell that is able to 
+     *      work on the type of element contained within the TreeView root, and 
+     *      all of its children (recursively).
+     */
+    // TODO this is not currently public API, as we don't even use the indeterminate property!
+    private static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(
+            final Callback<TreeItem<T>, ObservableValue<Boolean>> getSelectedProperty, 
+            final StringConverter<TreeItem<T>> converter, 
+            final Callback<TreeItem<T>, ObservableValue<Boolean>> getIndeterminateProperty) {
+        return new Callback<TreeView<T>, TreeCell<T>>() {
+            @Override public TreeCell<T> call(TreeView<T> list) {
+                return new CheckBoxTreeCell<T>(getSelectedProperty, converter/*, getIndeterminateProperty*/);
+            }
+        };
+    }
+    
+    /**
+     * Creates a cell factory for use in a {@link TableColumn} cell factory. 
+     * This method requires that the TableColumn be of type {@link Boolean}.
+     * 
+     * <p>When used in a TableColumn, the CheckBoxCell is rendered with a 
+     * CheckBox centered in the column.
+     * 
+     * <p>The {@code ObservableValue<Boolean>} contained within each cell in the 
+     * column will be bound bidirectionally. This means that the  CheckBox in 
+     * the cell will set/unset this property based on user interactions, and the 
+     * CheckBox will reflect the state of the {@code ObservableValue<Boolean>}, 
+     * if it changes externally).</li>
+     * 
+     * @return A {@link Callback} that will return a {@link TableCell} that is 
+     *      able to work on the type of element contained within the TableColumn.
+     */
+    public static <S> Callback<TableColumn<S,Boolean>, TableCell<S,Boolean>> forTableColumn(
+            final TableColumn<S, Boolean> column) {
+        return forTableColumn(null, null);
+    }
+    
+    /**
+     * Creates a cell factory for use in a {@link TableColumn} cell factory. 
+     * This method requires that the TableColumn be of type
+     * {@code ObservableValue<Boolean>}.
+     * 
+     * <p>When used in a TableColumn, the CheckBoxCell is rendered with a 
+     * CheckBox centered in the column.
+     * 
+     * @param <T> The type of the elements contained within the {@link TableColumn} 
+     *      instance.
+     * @param getSelectedProperty A Callback that, given an object of 
+     *      type {@code TableColumn<S,T>}, will return an 
+     *      {@code ObservableValue<Boolean>} 
+     *      that represents whether the given item is selected or not. This 
+     *      {@code ObservableValue<Boolean>} will be bound bidirectionally 
+     *      (meaning that the CheckBox in the cell will set/unset this property 
+     *      based on user interactions, and the CheckBox will reflect the state of 
+     *      the {@code ObservableValue<Boolean>}, if it changes externally).
+     * @return A {@link Callback} that will return a {@link TableCell} that is 
+     *      able to work on the type of element contained within the TableColumn.
+     */
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final Callback<Integer, ObservableValue<Boolean>> getSelectedProperty) {
+        return forTableColumn(getSelectedProperty, null);
+    }
+    
+    /**
+     * Creates a cell factory for use in a {@link TableColumn} cell factory. 
+     * This method requires that the TableColumn be of type
+     * {@code ObservableValue<Boolean>}.
+     * 
+     * <p>When used in a TableColumn, the CheckBoxCell is rendered with a 
+     * CheckBox centered in the column.
+     * 
+     * @param <T> The type of the elements contained within the {@link TableColumn} 
+     *      instance.
+     * @param getSelectedProperty A Callback that, given an object of 
+     *      type {@code TableColumn<S,T>}, will return an 
+     *      {@code ObservableValue<Boolean>} 
+     *      that represents whether the given item is selected or not. This 
+     *      {@code ObservableValue<Boolean>} will be bound bidirectionally 
+     *      (meaning that the CheckBox in the cell will set/unset this property 
+     *      based on user interactions, and the CheckBox will reflect the state of 
+     *      the {@code ObservableValue<Boolean>}, if it changes externally).
+     * @param showLabel In some cases, it may be desirable to show a label in 
+     *      the TableCell beside the {@link CheckBox}. By default a label is not 
+     *      shown, but by setting this to true the item in the cell will also 
+     *      have toString() called on it. If this is not the desired behavior, 
+     *      consider using {@link #forTableColumn(Callback, Callback)}, which 
+     *      allows for you to provide a callback that specifies the label for a 
+     *      given row item.
+     * @return A {@link Callback} that will return a {@link TableCell} that is 
+     *      able to work on the type of element contained within the TableColumn.
+     */
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final Callback<Integer, ObservableValue<Boolean>> getSelectedProperty, 
+            final boolean showLabel) {
+        StringConverter<T> converter = ! showLabel ? 
+                null : CellUtils.<T>defaultStringConverter();
+        return forTableColumn(getSelectedProperty, converter);
+    }
+    
+    /**
+     * Creates a cell factory for use in a {@link TableColumn} cell factory. 
+     * This method requires that the TableColumn be of type
+     * {@code ObservableValue<Boolean>}.
+     * 
+     * <p>When used in a TableColumn, the CheckBoxCell is rendered with a 
+     * CheckBox centered in the column.
+     * 
+     * @param <T> The type of the elements contained within the {@link TableColumn} 
+     *      instance.
+     * @param getSelectedProperty A Callback that, given an object of type 
+     *      {@code TableColumn<S,T>}, will return an 
+     *      {@code ObservableValue<Boolean>} that represents whether the given 
+     *      item is selected or not. This {@code ObservableValue<Boolean>} will 
+     *      be bound bidirectionally (meaning that the CheckBox in the cell will 
+     *      set/unset this property based on user interactions, and the CheckBox 
+     *      will reflect the state of the {@code ObservableValue<Boolean>}, if 
+     *      it changes externally).
+     * @param converter A StringConverter that, give an object of type T, will return a 
+     *      String that can be used to represent the object visually. The default 
+     *      implementation in {@link #forTableColumn(Callback, boolean)} (when 
+     *      showLabel is true) is to simply call .toString() on all non-null 
+     *      items (and to just return an empty string in cases where the given 
+     *      item is null).
+     * @return A {@link Callback} that will return a {@link TableCell} that is 
+     *      able to work on the type of element contained within the TableColumn.
+     */
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final Callback<Integer, ObservableValue<Boolean>> getSelectedProperty, 
+            final StringConverter<T> converter) {
+        return new Callback<TableColumn<S,T>, TableCell<S,T>>() {
+            @Override public TableCell<S,T> call(TableColumn<S,T> list) {
+                return new CheckBoxTableCell<S,T>(getSelectedProperty, converter);
+            }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/CheckBoxListCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,123 @@
+/*
+ * 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.cell;
+
+import javafx.beans.property.BooleanProperty;
+import javafx.beans.value.ObservableValue;
+import javafx.geometry.Pos;
+import javafx.scene.control.CheckBox;
+import javafx.scene.control.ContentDisplay;
+import javafx.scene.control.ListCell;
+import javafx.scene.control.ListView;
+import javafx.util.Callback;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing a {@link ListCell} implementation that draws a 
+ * {@link CheckBox} node inside the cell, optionally with a label to indicate 
+ * what the checkbox represents.
+ * 
+ * <p>The CheckBoxListCell is rendered with a CheckBox on the left-hand side of 
+ * the {@link ListView}, and the text related to the list item taking up all 
+ * remaining horizontal space. 
+ * 
+ * <p>To construct an instance of this class, it is necessary to provide a 
+ * {@link Callback} that, given an object of type T, will return a 
+ * {@code ObservableValue<Boolean>} that represents whether the given item is 
+ * selected or not. This ObservableValue will be bound bidirectionally (meaning 
+ * that the CheckBox in the cell will set/unset this property based on user 
+ * interactions, and the CheckBox will reflect the state of the 
+ * ObservableValue<Boolean>, if it changes externally).
+ * 
+ * @see CheckBoxCellFactory
+ * @see CheckBox
+ * @see ListCell
+ * @param <T> The type of the elements contained within the ListView.
+ */
+public class CheckBoxListCell<T> extends ListCell<T> {
+    private final CheckBox checkBox;
+    
+    private final StringConverter<T> converter;
+
+    private final Callback<T, ObservableValue<Boolean>> getSelectedProperty;
+    private ObservableValue<Boolean> booleanProperty;
+    
+    /**
+     * Creates a default CheckBoxListCell.
+     * 
+     * @param getSelectedProperty A {@link Callback} that will return an 
+     *      {@code ObservableValue<Boolean>} given an item from the ListView.
+     */
+    public CheckBoxListCell(
+            final Callback<T, ObservableValue<Boolean>> getSelectedProperty) {
+        this(getSelectedProperty, CellUtils.<T>defaultStringConverter());
+    }
+    
+    /**
+     * Creates a CheckBoxListCell with a custom string converter.
+     * 
+     * @param getSelectedProperty A {@link Callback} that will return an 
+     *      {@code ObservableValue<Boolean>} given an item from the ListView.
+     * @param converter A StringConverter that, given an object of type T, will 
+     *      return a String that can be used to represent the object visually.
+     */
+    public CheckBoxListCell(
+            final Callback<T, ObservableValue<Boolean>> getSelectedProperty, 
+            final StringConverter<T> converter) {
+        if (getSelectedProperty == null) {
+            throw new NullPointerException("getSelectedProperty can not be null");
+        }
+        this.getSelectedProperty = getSelectedProperty;
+        this.converter = converter;
+        
+        this.checkBox = new CheckBox();
+        
+        setAlignment(Pos.CENTER_LEFT);
+        setContentDisplay(ContentDisplay.LEFT);
+        setGraphic(checkBox);
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(T item, boolean empty) {
+        super.updateItem(item, empty);
+        
+        if (! empty) {
+            setGraphic(checkBox);
+            setText(converter != null ? 
+                    converter.toString(item) : (item == null ? "" : item.toString()));
+            
+            if (booleanProperty != null) {
+                checkBox.selectedProperty().unbindBidirectional((BooleanProperty)booleanProperty);
+            }
+            booleanProperty = getSelectedProperty.call(item);
+            if (booleanProperty != null) {
+                checkBox.selectedProperty().bindBidirectional((BooleanProperty)booleanProperty);
+            }
+        } else {
+            setGraphic(null);
+            setText(null);
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/CheckBoxTableCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,145 @@
+/*
+ * 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.cell;
+
+import javafx.beans.binding.Bindings;
+import javafx.beans.property.BooleanProperty;
+import javafx.beans.value.ObservableValue;
+import javafx.geometry.Pos;
+import javafx.scene.control.CheckBox;
+import javafx.scene.control.TableCell;
+import javafx.util.Callback;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing a {@link TableCell} implementation that draws a 
+ * {@link CheckBox} node inside the cell, optionally with a label to indicate 
+ * what the checkbox represents.
+ * 
+ * <p>By default, the CheckBoxTableCell is rendered with a CheckBox centred in 
+ * the TableColumn. If a label is required, it is necessary to provide a 
+ * non-null StringConverter instance to the 
+ * {@link #CheckBoxTableCell(Callback, StringConverter)} constructor.
+ * 
+ * <p>To construct an instance of this class, it is necessary to provide a 
+ * {@link Callback} that, given an object of type T, will return an 
+ * {@code ObservableProperty<Boolean>} that represents whether the given item is
+ * selected or not. This ObservableValue will be bound bidirectionally (meaning 
+ * that the CheckBox in the cell will set/unset this property based on user 
+ * interactions, and the CheckBox will reflect the state of the ObservableValue, 
+ * if it changes externally).
+ * 
+ * @param <T> The type of the elements contained within the TableColumn.
+ */
+public class CheckBoxTableCell<S,T> extends TableCell<S,T> {
+    private final CheckBox checkBox;
+    
+    private final boolean showLabel;
+    
+    private final StringConverter<T> converter;
+    
+    private final Callback<Integer, ObservableValue<Boolean>> getSelectedProperty;
+    private ObservableValue<Boolean> booleanProperty;
+    
+    private CheckBoxTableCell() {
+        this(null, null);
+    }
+    
+    /**
+     * Creates a default CheckBoxTableCell with a custom {@link Callback} to 
+     * retrieve an ObservableValue for a given cell index.
+     * 
+     * @param getSelectedProperty A {@link Callback} that will return an {@link 
+     *      ObservableValue} given an index from the TableColumn.
+     */
+    public CheckBoxTableCell(
+            final Callback<Integer, ObservableValue<Boolean>> getSelectedProperty) {
+        this(getSelectedProperty, null);
+    }
+
+    /**
+     * Creates a CheckBoxTableCell with a custom string converter.
+     * 
+     * @param getSelectedProperty A {@link Callback} that will return a {@link 
+     *      ObservableValue} given an index from the TableColumn.
+     * @param converter A StringConverter that, given an object of type T, will return a 
+     *      String that can be used to represent the object visually.
+     */
+    public CheckBoxTableCell(
+            final Callback<Integer, ObservableValue<Boolean>> getSelectedProperty, 
+            final StringConverter<T> converter) {
+        // we let getSelectedProperty be null here, as we can always defer to the
+        // TableColumn
+        this.getSelectedProperty = getSelectedProperty;
+        this.converter = converter;
+        this.showLabel = converter != null;
+        
+        this.checkBox = new CheckBox();
+//        this.checkBox.setAlignment(Pos.TOP_CENTER);
+        
+        setAlignment(Pos.CENTER);
+        setGraphic(checkBox);
+        
+        if (showLabel) {
+            this.checkBox.setAlignment(Pos.CENTER_LEFT);
+        }
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(T item, boolean empty) {
+        super.updateItem(item, empty);
+        
+        if (empty) {
+            setText(null);
+            setGraphic(null);
+        } else {
+            if (showLabel) {
+                setText(converter.toString(item));
+            }
+            setGraphic(checkBox);
+            
+            if (booleanProperty instanceof BooleanProperty) {
+                checkBox.selectedProperty().unbindBidirectional((BooleanProperty)booleanProperty);
+            }
+            ObservableValue obsValue = getSelectedProperty();
+            if (obsValue instanceof BooleanProperty) {
+                booleanProperty = obsValue;
+                checkBox.selectedProperty().bindBidirectional((BooleanProperty)booleanProperty);
+            }
+            
+            checkBox.disableProperty().bind(Bindings.not(
+                    getTableView().editableProperty().and(
+                    getTableColumn().editableProperty()).and(
+                    editableProperty())
+                ));
+        }
+    }
+    
+    private ObservableValue getSelectedProperty() {
+        return getSelectedProperty != null ?
+                getSelectedProperty.call(getIndex()) :
+                getTableColumn().getCellObservableValue(getIndex());
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/CheckBoxTreeCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,224 @@
+/*
+ * 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.cell;
+
+import com.sun.javafx.scene.control.CheckBoxTreeItem;
+import javafx.beans.property.BooleanProperty;
+import javafx.beans.value.ObservableValue;
+import javafx.scene.control.CheckBox;
+import javafx.scene.control.TreeCell;
+import javafx.scene.control.TreeItem;
+import javafx.util.Callback;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing a {@link TreeCell} implementation that draws a 
+ * {@link CheckBox} node inside the cell, along with support for common 
+ * interactions (discussed in more depth shortly).
+ * 
+ * <p>To make creating TreeViews with CheckBoxes easier, a convenience class 
+ * called {@link CheckBoxTreeItem} is provided. It is <b>highly</b> recommended 
+ * that developers use this class, rather than the regular {@link TreeItem}
+ * class, when constructing their TreeView tree structures. Refer to the 
+ * CheckBoxTreeItem API documentation for an example on how these two classes
+ * can be combined.
+ * 
+ * <p>When used in a TreeView, the CheckBoxCell is rendered with a CheckBox to 
+ * the right of the 'disclosure node' (i.e. the arrow). The item stored in 
+ * {@link CheckBoxTreeItem#getValue()} will then have the StringConverter called 
+ * on it, and this text will take all remaining horizontal space. Additionally, 
+ * by using {@link CheckBoxTreeItem}, the TreeView will automatically handle 
+ * situations such as:
+ * 
+ * <ul>
+ *   <li>Clicking on the {@link CheckBox} beside an item that has children will 
+ *      result in all children also becoming selected/unselected.
+ *   <li>Clicking on the {@link CheckBox} beside an item that has a parent will 
+ *      possibly toggle the state of the parent. For example, if you select a 
+ *      single child, the parent will become indeterminate (indicating partial 
+ *      selection of children). If you proceed to select all children, the 
+ *      parent will then show that it too is selected. This is recursive, with 
+ *      all parent nodes updating as expected.
+ * </ul>
+ * 
+ * If it is decided that using {@link CheckBoxTreeItem} is not desirable, 
+ * then it is necessary to call one of the constructors where a {@link Callback}
+ * is provided that can return an {@code ObservableValue<Boolean>}
+ * given a {@link TreeItem} instance. This {@code ObservableValue<Boolean>} 
+ * should represent the boolean state of the given {@link TreeItem}.
+ * 
+ * @param <T> The type of the elements contained within the TreeView TreeItem 
+ *      instances.
+ */
+public class CheckBoxTreeCell<T> extends TreeCell<T> {
+    private final CheckBox checkBox;
+    
+    private final StringConverter<TreeItem<T>> converter;
+    
+    private final Callback<TreeItem<T>, ObservableValue<Boolean>> getSelectedProperty;
+    private ObservableValue<Boolean> booleanProperty;
+    
+    private BooleanProperty indeterminateProperty;
+    
+    /**
+     * Creates a default {@link CheckBoxTreeCell} that assumes the TreeView is 
+     * constructed with {@link CheckBoxTreeItem} instances, rather than the 
+     * default {@link TreeItem}.
+     * By using {@link CheckBoxTreeItem}, it will internally manage the selected 
+     * and indeterminate state of each item in the tree.
+     */
+    public CheckBoxTreeCell() {
+        // getSelectedProperty as anonymous inner class to deal with situation
+        // where the user is using CheckBoxTreeItem instances in their tree
+        this(new Callback<TreeItem<T>, ObservableValue<Boolean>>() {
+            @Override public ObservableValue<Boolean> call(TreeItem<T> item) {
+                if (item instanceof CheckBoxTreeItem<?>) {
+                    return ((CheckBoxTreeItem<?>)item).selectedProperty();
+                }
+                return null;
+            }
+        });
+    }
+    
+    /**
+     * Creates a {@link CheckBoxTreeCell} for use in a TreeView control via a 
+     * cell factory. Unlike {@link CheckBoxTreeCell#CheckBoxTreeCell()}, this 
+     * method does not assume that all TreeItem instances in the TreeView are 
+     * {@link CheckBoxTreeItem}.
+     * 
+     * <p>To call this method, it is necessary to provide a 
+     * {@link Callback} that, given an object of type TreeItem<T>, will return 
+     * an {@code ObservableValue<Boolean>} that represents whether the given 
+     * item is selected or not. This {@code ObservableValue<Boolean>} will be 
+     * bound bidirectionally (meaning that the CheckBox in the cell will 
+     * set/unset this property based on user interactions, and the CheckBox will 
+     * reflect the state of the {@code ObservableValue<Boolean>}, if it changes 
+     * externally).
+     * 
+     * <p>If the items are not {@link CheckBoxTreeItem} instances, it becomes 
+     * the developers responsibility to handle updating the state of parent and 
+     * children TreeItems. This means that, given a TreeItem, this class will 
+     * simply toggles the {@code ObservableValue<Boolean>} that is provided, and 
+     * no more. Of course, this functionality can then be implemented externally 
+     * by adding observers to the {@code ObservableValue<Boolean>}, and toggling 
+     * the state of other properties as necessary.
+     * 
+     * @param getSelectedProperty A {@link Callback} that will return an 
+     *      {@code ObservableValue<Boolean>} that represents whether the given 
+     *      item is selected or not.
+     */
+    public CheckBoxTreeCell(
+            final Callback<TreeItem<T>, ObservableValue<Boolean>> getSelectedProperty) {
+        this(getSelectedProperty, CellUtils.<T>defaultTreeItemStringConverter(), null);
+    }
+    
+    /**
+     * Creates a {@link CheckBoxTreeCell} for use in a TreeView control via a 
+     * cell factory. Unlike {@link CheckBoxTreeCell#CheckBoxTreeCell()}, this 
+     * method does not assume that all TreeItem instances in the TreeView are 
+     * {@link CheckBoxTreeItem}.
+     * 
+     * <p>To call this method, it is necessary to provide a {@link Callback} 
+     * that, given an object of type TreeItem<T>, will return an 
+     * {@code ObservableValue<Boolean>} that represents whether the given item 
+     * is selected or not. This {@code ObservableValue<Boolean>} will be bound 
+     * bidirectionally (meaning that the CheckBox in the cell will set/unset 
+     * this property based on user interactions, and the CheckBox will reflect
+     * the state of the {@code ObservableValue<Boolean>}, if it changes 
+     * externally).
+     * 
+     * <p>If the items are not {@link CheckBoxTreeItem} instances, it becomes 
+     * the developers responsibility to handle updating the state of parent and 
+     * children TreeItems. This means that, given a TreeItem, this class will 
+     * simply toggles the {@code ObservableValue<Boolean>} that is provided, and 
+     * no more. Of course, this functionality can then be implemented externally 
+     * by adding observers to the {@code ObservableValue<Boolean>}, and toggling 
+     * the state of other properties as necessary.
+     * 
+     * @param getSelectedProperty A {@link Callback} that will return an 
+     *      {@code ObservableValue<Boolean>} that represents whether the given 
+     *      item is selected or not.
+     * @param converter A StringConverter that, give an object of type TreeItem<T>, will 
+     *      return a String that can be used to represent the object visually.
+     */
+    public CheckBoxTreeCell(
+            final Callback<TreeItem<T>, ObservableValue<Boolean>> getSelectedProperty, 
+            final StringConverter<TreeItem<T>> converter) {
+        this(getSelectedProperty, converter, null);
+    }
+
+    private CheckBoxTreeCell(
+            final Callback<TreeItem<T>, ObservableValue<Boolean>> getSelectedProperty, 
+            final StringConverter<TreeItem<T>> converter, 
+            final Callback<TreeItem<T>, ObservableValue<Boolean>> getIndeterminateProperty) {
+        if (getSelectedProperty == null) {
+            throw new NullPointerException("getSelectedProperty can not be null");
+        }
+        this.getSelectedProperty = getSelectedProperty;
+        this.converter = converter;
+        
+        this.checkBox = new CheckBox();
+        this.checkBox.setAllowIndeterminate(false);
+        setGraphic(checkBox);
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(T item, boolean empty) {
+        super.updateItem(item, empty);
+        
+        if (empty) {
+            setText(null);
+            setGraphic(null);
+        } else {
+            // update the node content
+            setText(converter.toString(getTreeItem()));
+            setGraphic(checkBox);
+            
+            // uninstall bindings
+            if (booleanProperty != null) {
+                checkBox.selectedProperty().unbindBidirectional((BooleanProperty)booleanProperty);
+            }
+            if (indeterminateProperty != null) {
+                checkBox.indeterminateProperty().unbindBidirectional(indeterminateProperty);
+            }
+
+            // install new bindings.
+            // We special case things when the TreeItem is a CheckBoxTreeItem
+            if (getTreeItem() instanceof CheckBoxTreeItem) {
+                CheckBoxTreeItem<T> cbti = (CheckBoxTreeItem<T>) getTreeItem();
+                booleanProperty = cbti.selectedProperty();
+                checkBox.selectedProperty().bindBidirectional((BooleanProperty)booleanProperty);
+                
+                indeterminateProperty = cbti.indeterminateProperty();
+                checkBox.indeterminateProperty().bindBidirectional(indeterminateProperty);
+            } else {
+                booleanProperty = getSelectedProperty.call(getTreeItem());
+                if (booleanProperty != null) {
+                    checkBox.selectedProperty().bindBidirectional((BooleanProperty)booleanProperty);
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ChoiceBoxCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,72 @@
+/*
+ * 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.cell;
+
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
+import javafx.collections.ObservableList;
+import javafx.scene.control.Cell;
+import javafx.scene.control.ChoiceBox;
+import javafx.util.StringConverter;
+
+// Package protected - not intended for external use
+class ChoiceBoxCell {
+    
+    static <T> void updateItem(
+            final Cell<T> cell, ChoiceBox<T> choiceBox, 
+            final StringConverter<T> converter) {
+        if (cell.isEmpty()) {
+            cell.setText(null);
+            cell.setGraphic(null);
+        } else {
+            if (cell.isEditing()) {
+                if (choiceBox != null) {
+                    choiceBox.getSelectionModel().select(cell.getItem());
+                }
+                cell.setText(null);
+                cell.setGraphic(choiceBox);
+            } else {
+                cell.setText(converter.toString(cell.getItem()));
+                cell.setGraphic(null);
+            }
+        }
+    };
+    
+    static <T> ChoiceBox<T> createChoiceBox(
+            final Cell<T> cell, 
+            final ObservableList<T> items) {
+        ChoiceBox<T> choiceBox = new ChoiceBox<T>(items);
+        choiceBox.setMaxWidth(Double.MAX_VALUE);
+        choiceBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<T>() {
+            @Override
+            public void changed(ObservableValue<? extends T> ov, T oldValue, T newValue) {
+                if (cell.isEditing()) {
+                    cell.commitEdit(newValue);
+                }
+            }
+        });
+        return choiceBox;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ChoiceBoxCellFactory.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,343 @@
+/*
+ * 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.cell;
+
+import com.sun.javafx.beans.annotations.NoBuilder;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.event.EventHandler;
+import javafx.scene.control.ChoiceBox;
+import javafx.scene.control.Label;
+import javafx.scene.control.ListCell;
+import javafx.scene.control.ListView;
+import javafx.scene.control.TableCell;
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.TreeCell;
+import javafx.scene.control.TreeItem;
+import javafx.scene.control.TreeView;
+import javafx.util.Callback;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing cell factories that use {@link ChoiceBox}, although the 
+ * precise way in which these cell factories work differs between controls. Be 
+ * sure to read the API documentation for each static method, as well as the 
+ * class documentation for {@link ChoiceBoxListCell}, {@link ChoiceBoxTableCell} 
+ * and {@link ChoiceBoxTreeCell} before using it!
+ * 
+ * @see ChoiceBox
+ * @see ChoiceBoxListCell
+ * @see ChoiceBoxTreeCell
+ * @see ChoiceBoxTableCell
+ */
+@NoBuilder
+public final class ChoiceBoxCellFactory {
+    
+    private ChoiceBoxCellFactory() { }
+    
+    /**
+     * Creates a ChoiceBox cell factory for use in {@link ListView} controls. 
+     * By default, the ChoiceBoxCell is rendered as a {@link Label} when not 
+     * being edited, and as a ChoiceBox when in editing mode. The ChoiceBox will, 
+     * by default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the ListView.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ChoiceBox} menu is showing. These items must be of the same 
+     *      type as the ListView items list, such that upon selection, they 
+     *      replace the existing value in the 
+     *      {@link ListView#itemsProperty() items} list.
+     * @return A {@link Callback} that will return a ListCell that is able to 
+     *      work on the type of element contained within the ListView.
+     */
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(final T... items) {
+        return forListView(FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a ChoiceBox cell factory for use in {@link ListView} controls. By
+     * default, the ChoiceBoxCell is rendered as a {@link Label} when not being 
+     * edited, and as a ChoiceBox when in editing mode. The ChoiceBox will, by 
+     * default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the ListView.
+     * @param converter A {@link StringConverter} to convert the given item (of type T) 
+     *      to a String for displaying to the user.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ChoiceBox} menu is showing. These items must be of the same 
+     *      type as the ListView items list, such that upon selection, they 
+     *      replace the existing value in the 
+     *      {@link ListView#itemsProperty() items} list.
+     * @return A {@link Callback} that will return a ListCell that is able to 
+     *      work on the type of element contained within the ListView.
+     */
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(
+            final StringConverter<T> converter, 
+            final T... items) {
+        return forListView(converter, FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a ChoiceBox cell factory for use in {@link ListView} controls. 
+     * By default, the ChoiceBoxCell is rendered as a {@link Label} when not 
+     * being edited, and as a ChoiceBox when in editing mode. The ChoiceBox 
+     * will, by default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the ListView.
+     * @param items An {@link ObservableList} containing zero or more items that 
+     *      will be shown to the user when the {@link ChoiceBox} menu is showing. 
+     *      These items must be of the same type as the ListView items sequence, 
+     *      such that upon selection, they replace the existing value in the 
+     *      {@link ListView#itemsProperty() items} list.
+     * @return A {@link Callback} that will return a ListCell that is able to 
+     *      work on the type of element contained within the ListView.
+     */
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(
+            final ObservableList<T> items) {
+        return forListView(null, items);
+    }
+    
+    /**
+     * Creates a ChoiceBox cell factory for use in {@link ListView} controls. By 
+     * default, the ChoiceBoxCell is rendered as a {@link Label} when not being 
+     * edited, and as a ChoiceBox when in editing mode. The ChoiceBox will, by 
+     * default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the ListView.
+     * @param converter A {@link StringConverter} to convert the given item (of type T) 
+     *      to a String for displaying to the user.
+     * @param items An {@link ObservableList} containing zero or more items that 
+     *      will be shown to the user when the {@link ChoiceBox} menu is showing. 
+     *      These items must be of the same type as the ListView items sequence, 
+     *      such that upon selection, they replace the existing value in the 
+     *      {@link ListView#itemsProperty() items} list.
+     * @return A {@link Callback} that will return a ListCell that is able to 
+     *      work on the type of element contained within the ListView.
+     */
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(
+            final StringConverter<T> converter, 
+            final ObservableList<T> items) {
+        return new Callback<ListView<T>, ListCell<T>>() {
+            @Override public ListCell<T> call(ListView<T> list) {
+                return new ChoiceBoxListCell<T>(converter, items);
+            }
+        };
+    }
+    
+    /**
+     * Creates a ChoiceBox cell factory for use in {@link TreeView} controls. By
+     * default, the ChoiceBoxCell is rendered as a {@link Label} when not being 
+     * edited, and as a ChoiceBox when in editing mode. The ChoiceBox will, by 
+     * default, stretch to fill the entire tree cell.
+     * 
+     * @param <T> The type of the elements contained within the TreeView.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ChoiceBox} menu is showing. These items must be of the same 
+     *      type as the TreeView<T>, such that upon selection, they replace the 
+     *      existing value in the TreeItem {@link TreeItem#valueProperty() value} 
+     *      property.
+     * @return A {@link Callback} that will return a TreeCell that is able to 
+     *      work on the type of element contained within the TreeView.
+     */    
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(T... items) {
+        return forTreeView(FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a ChoiceBox cell factory for use in {@link TreeView} controls. By 
+     * default, the ChoiceBoxCell is rendered as a {@link Label} when not being 
+     * edited, and as a ChoiceBox when in editing mode. The ChoiceBox will, by 
+     * default, stretch to fill the entire tree cell, excluding the space 
+     * allocated to the tree cell indentation and disclosure node (i.e. the 
+     * arrow).
+     * 
+     * @param <T> The type of the {@link TreeItem} elements contained within the 
+     *      TreeView.
+     * @param items An {@link ObservableList} containing zero or more items that 
+     *      will be shown to the user when the {@link ChoiceBox} menu is showing. 
+     *      These items must be of the same type as the TreeView generic type, 
+     *      such that upon selection, they replace the existing value in the 
+     *      {@link TreeItem} that is being edited (as noted in the 
+     *      {@link TreeView#editingItemProperty()}.
+     * @return A {@link Callback} that will return a TreeCell that is able to 
+     *      work on the type of element contained within the TreeView.
+     */
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(
+            final ObservableList<T> items) {
+        return forTreeView(null, items);
+    }
+    
+    /**
+     * Creates a ChoiceBox cell factory for use in {@link TreeView} controls. By 
+     * default, the ChoiceBoxCell is rendered as a {@link Label} when not being 
+     * edited, and as a ChoiceBox when in editing mode. The ChoiceBox will, by 
+     * default, stretch to fill the entire tree cell.
+     * 
+     * @param <T> The type of the elements contained within the TreeView.
+     * @param converter A {@link StringConverter} to convert the given item (of type T) 
+     *      to a String for displaying to the user.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ChoiceBox} menu is showing. These items must be of the same 
+     *      type as the TreeView<T>, such that upon selection, they replace the 
+     *      existing value in the TreeItem {@link TreeItem#valueProperty() value} 
+     *      property.
+     * @return A {@link Callback} that will return a TreeCell that is able to 
+     *      work on the type of element contained within the TreeView.
+     */  
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(
+            final StringConverter<T> converter, 
+            final T... items) {
+        return forTreeView(converter, FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a ChoiceBox cell factory for use in {@link TreeView} controls. By
+     * default, the ChoiceBoxCell is rendered as a {@link Label} when not being 
+     * edited, and as a ChoiceBox when in editing mode. The ChoiceBox will, by 
+     * default, stretch to fill the entire tree cell.
+     * 
+     * @param <T> The type of the elements contained within the TreeView.
+     * @param converter A {@link StringConverter} to convert the given item (of type T) 
+     *      to a String for displaying to the user.
+     * @param items An {@link ObservableList} containing zero or more items that 
+     *      will be shown to the user when the {@link ChoiceBox} menu is showing. 
+     *      These items must be of the same type as the TreeView generic type, 
+     *      such that upon selection, they replace the existing value in the 
+     *      {@link TreeItem} that is being edited (as noted in the 
+     *      {@link TreeView#editingItemProperty()}.
+     * @return A {@link Callback} that will return a TreeCell that is able to 
+     *      work on the type of element contained within the TreeView.
+     */  
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(
+            final StringConverter<T> converter, 
+            final ObservableList<T> items) {
+        return new Callback<TreeView<T>, TreeCell<T>>() {
+          @Override public TreeCell<T> call(TreeView<T> list) {
+              return new ChoiceBoxTreeCell<T>(converter, items);
+          }
+      };
+    }
+    
+    /**
+     * Creates a ChoiceBox cell factory for use in {@link TableColumn} controls. 
+     * By default, the ChoiceBoxCell is rendered as a {@link Label} when not 
+     * being edited, and as a ChoiceBox when in editing mode. The ChoiceBox will, 
+     * by default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the TableColumn.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ChoiceBox} menu is showing. These items must be of the same 
+     *      type as the TableColumn. Note that it is up to the developer to set 
+     *      {@link EventHandler event handlers} to listen to edit events in the 
+     *      TableColumn, and react accordingly. Methods of interest include 
+     *      {@link TableColumn#setOnEditStart(EventHandler) setOnEditStart},
+     *      {@link TableColumn#setOnEditCommit(javafx.event.EventHandler) setOnEditCommit}, 
+     *      and {@link TableColumn#setOnEditCancel(EventHandler) setOnEditCancel}.
+     * @return A {@link Callback} that will return a TableCell that is able to 
+     *      work on the type of element contained within the TableColumn.
+     */
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(final T... items) {
+        return forTableColumn(null, items);
+    }
+    
+    /**
+     * Creates a ChoiceBox cell factory for use in {@link TableColumn} controls. 
+     * By default, the ChoiceBoxCell is rendered as a {@link Label} when not 
+     * being edited, and as a ChoiceBox when in editing mode. The ChoiceBox 
+     * will, by default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the TableColumn.
+     * @param converter A {@link StringConverter} to convert the given item (of type T) 
+     *      to a String for displaying to the user.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ChoiceBox} menu is showing. These items must be of the same
+     *      type as the TableColumn. Note that it is up to the developer to set 
+     *      {@link EventHandler event handlers} to listen to edit events in the 
+     *      TableColumn, and react accordingly. Methods of interest include 
+     *      {@link TableColumn#setOnEditStart(EventHandler) setOnEditStart},
+     *      {@link TableColumn#setOnEditCommit(javafx.event.EventHandler) setOnEditCommit}, 
+     *      and {@link TableColumn#setOnEditCancel(EventHandler) setOnEditCancel}.
+     * @return A {@link Callback} that will return a TableCell that is able to 
+     *      work on the type of element contained within the TableColumn.
+     */
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final StringConverter<T> converter, 
+            final T... items) {
+        return forTableColumn(converter, FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a ChoiceBox cell factory for use in {@link TableColumn} controls. 
+     * By default, the ChoiceBoxCell is rendered as a {@link Label} when not 
+     * being edited, and as a ChoiceBox when in editing mode. The ChoiceBox will, 
+     * by default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the TableColumn.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ChoiceBox} menu is showing. These items must be of the same 
+     *      type as the TableColumn. Note that it is up to the developer to set 
+     *      {@link EventHandler event handlers} to listen to edit events in the 
+     *      TableColumn, and react accordingly. Methods of interest include 
+     *      {@link TableColumn#setOnEditStart(EventHandler) setOnEditStart},
+     *      {@link TableColumn#setOnEditCommit(javafx.event.EventHandler) setOnEditCommit}, 
+     *      and {@link TableColumn#setOnEditCancel(EventHandler) setOnEditCancel}.
+     * @return A {@link Callback} that will return a TableCell that is able to 
+     *      work on the type of element contained within the TableColumn.
+     */
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final ObservableList<T> items) {
+        return forTableColumn(null, items);
+    }
+    
+    /**
+     * Creates a ChoiceBox cell factory for use in {@link TableColumn} controls. 
+     * By default, the ChoiceBoxCell is rendered as a {@link Label} when not 
+     * being edited, and as a ChoiceBox when in editing mode. The ChoiceBox will, 
+     * by default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the TableColumn.
+     * @param converter A {@link StringConverter} to convert the given item (of type T) 
+     * to a String for displaying to the user.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ChoiceBox} menu is showing. These items must be of the same 
+     *      type as the TableColumn. Note that it is up to the developer to set 
+     *      {@link EventHandler event handlers} to listen to edit events in the 
+     *      TableColumn, and react accordingly. Methods of interest include 
+     *      {@link TableColumn#setOnEditStart(EventHandler) setOnEditStart},
+     *      {@link TableColumn#setOnEditCommit(javafx.event.EventHandler) setOnEditCommit}, 
+     *      and {@link TableColumn#setOnEditCancel(EventHandler) setOnEditCancel}.
+     * @return A {@link Callback} that will return a TableCell that is able to 
+     *      work on the type of element contained within the TableColumn.
+     */
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final StringConverter<T> converter, 
+            final ObservableList<T> items) {
+        return new Callback<TableColumn<S,T>, TableCell<S,T>>() {
+            @Override public TableCell<S,T> call(TableColumn<S,T> list) {
+                return new ChoiceBoxTableCell<S,T>(converter, items);
+            }
+        };
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ChoiceBoxListCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,145 @@
+/*
+ * 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.cell;
+
+import static com.sun.javafx.scene.control.cell.ChoiceBoxCell.createChoiceBox;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.scene.control.ChoiceBox;
+import javafx.scene.control.Label;
+import javafx.scene.control.ListCell;
+import javafx.scene.control.ListView;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing a {@link ListCell} implementation that draws a 
+ * {@link ChoiceBox} node inside the cell.
+ * 
+ * <p>By default, the ChoiceBoxListCell is rendered as a {@link Label} when not 
+ * being edited, and as a ChoiceBox when in editing mode. The ChoiceBox will, by 
+ * default, stretch to fill the entire list cell.
+ * 
+ * <p>To create a ChoiceBoxListCell, it is necessary to provide zero or more 
+ * items that will be shown to the user when the {@link ChoiceBox} menu is 
+ * showing. These items must be of the same type as the ListView items sequence, 
+ * such that upon selection, they replace the existing value in the 
+ * {@link ListView#itemsProperty() items} list.
+ * 
+ * @param <T> The type of the elements contained within the ListView.
+ */
+public class ChoiceBoxListCell<T> extends ListCell<T> {
+    
+    private final ObservableList<T> items;
+
+    private ChoiceBox<T> choiceBox;
+    
+    private final StringConverter<T> converter;
+    
+    /**
+     * Creates a default {@link ChoiceBoxListCell} instance with the given items
+     * being used to populate the {@link ChoiceBox} when it is shown.
+     * 
+     * @param items The items to show in the ChoiceBox popup menu when selected 
+     *      by the user.
+     */
+    public ChoiceBoxListCell(T... items) {
+        this(FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a {@link ChoiceBoxListCell} instance with the given items
+     * being used to populate the {@link ChoiceBox} when it is shown, and the 
+     * {@link StringConverter} being used to convert the item in to a 
+     * user-readable form.
+     * 
+     * @param converter A {@link StringConverter} that can convert an item of type T 
+     *      into a user-readable string so that it may then be shown in the 
+     *      ChoiceBox popup menu.
+     * @param items The items to show in the ChoiceBox popup menu when selected 
+     *      by the user.
+     */
+    public ChoiceBoxListCell(StringConverter<T> converter, T... items) {
+        this(converter, FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a default {@link ChoiceBoxListCell} instance with the given items
+     * being used to populate the {@link ChoiceBox} when it is shown.
+     * 
+     * @param items The items to show in the ChoiceBox popup menu when selected 
+     *      by the user.
+     */
+    public ChoiceBoxListCell(ObservableList<T> items) {
+        this(null, items);
+    }
+
+    /**
+     * Creates a {@link ChoiceBoxListCell} instance with the given items
+     * being used to populate the {@link ChoiceBox} when it is shown, and the 
+     * {@link StringConverter} being used to convert the item in to a 
+     * user-readable form.
+     * 
+     * @param converter A {@link StringConverter} that can convert an item of type T 
+     *      into a user-readable string so that it may then be shown in the 
+     *      ChoiceBox popup menu.
+     * @param items The items to show in the ChoiceBox popup menu when selected 
+     *      by the user.
+     */
+    public ChoiceBoxListCell(StringConverter<T> converter, ObservableList<T> items) {
+        this.items = items;
+        this.converter = converter != null ? converter : CellUtils.<T>defaultStringConverter();
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void startEdit() {
+        if (! isEditable() || ! getListView().isEditable()) {
+            return;
+        }
+        
+        if (choiceBox == null) {
+            choiceBox = createChoiceBox(this, items);
+        }
+        
+        choiceBox.getSelectionModel().select(getItem());
+        
+        super.startEdit();
+        setText(null);
+        setGraphic(choiceBox);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cancelEdit() {
+        super.cancelEdit();
+        
+        setText(converter.toString(getItem()));
+        setGraphic(null);
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(T item, boolean empty) {
+        super.updateItem(item, empty);
+        ChoiceBoxCell.updateItem(this, choiceBox, converter);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ChoiceBoxTableCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,142 @@
+/*
+ * 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.cell;
+
+import static com.sun.javafx.scene.control.cell.ChoiceBoxCell.createChoiceBox;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.scene.control.ChoiceBox;
+import javafx.scene.control.Label;
+import javafx.scene.control.TableCell;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing a {@link TableCell} implementation that draws a 
+ * {@link ChoiceBox} node inside the cell.
+ * 
+ * <p>By default, the ChoiceBoxTableCell is rendered as a {@link Label} when not 
+ * being edited, and as a ChoiceBox when in editing mode. The ChoiceBox will, by 
+ * default, stretch to fill the entire table cell.
+ * 
+ * <p>To create a ChoiceBoxTableCell, it is necessary to provide zero or more 
+ * items that will be shown to the user when the {@link ChoiceBox} menu is 
+ * showing. These items must be of the same type as the TableColumn.
+ * 
+ * @param <T> The type of the elements contained within the TableColumn.
+ */
+public class ChoiceBoxTableCell<S,T> extends TableCell<S,T> {
+        
+    private final ObservableList<T> items;
+
+    private ChoiceBox<T> choiceBox;
+
+    private final StringConverter<T> converter;
+    
+    /**
+     * Creates a default {@link ChoiceBoxTableCell} instance with the given items
+     * being used to populate the {@link ChoiceBox} when it is shown.
+     * 
+     * @param items The items to show in the ChoiceBox popup menu when selected 
+     *      by the user.
+     */
+    public ChoiceBoxTableCell(T... items) {
+        this(FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a {@link ChoiceBoxTableCell} instance with the given items
+     * being used to populate the {@link ChoiceBox} when it is shown, and the 
+     * {@link StringConverter} being used to convert the item in to a 
+     * user-readable form.
+     * 
+     * @param converter A {@link StringConverter} that can convert an item of type T 
+     *      into a user-readable string so that it may then be shown in the 
+     *      ChoiceBox popup menu.
+     * @param items The items to show in the ChoiceBox popup menu when selected 
+     *      by the user.
+     */
+    public ChoiceBoxTableCell(StringConverter<T> converter, T... items) {
+        this(converter, FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a default {@link ChoiceBoxTableCell} instance with the given items
+     * being used to populate the {@link ChoiceBox} when it is shown.
+     * 
+     * @param items The items to show in the ChoiceBox popup menu when selected 
+     *      by the user.
+     */
+    public ChoiceBoxTableCell(ObservableList<T> items) {
+        this(null, items);
+    }
+
+    /**
+     * Creates a {@link ChoiceBoxTableCell} instance with the given items
+     * being used to populate the {@link ChoiceBox} when it is shown, and the 
+     * {@link StringConverter} being used to convert the item in to a 
+     * user-readable form.
+     * 
+     * @param converter A {@link StringConverter} that can convert an item of type T 
+     *      into a user-readable string so that it may then be shown in the 
+     *      ChoiceBox popup menu.
+     * @param items The items to show in the ChoiceBox popup menu when selected 
+     *      by the user.
+     */
+    public ChoiceBoxTableCell(StringConverter<T> converter, ObservableList<T> items) {
+        this.items = items;
+        this.converter = converter != null ? converter : CellUtils.<T>defaultStringConverter();
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void startEdit() {
+        if (! isEditable() || ! getTableView().isEditable() || ! getTableColumn().isEditable()) {
+            return;
+        }
+        
+        if (choiceBox == null) {
+            choiceBox = createChoiceBox(this, items);
+        }
+        
+        choiceBox.getSelectionModel().select(getItem());
+        
+        super.startEdit();
+        setText(null);
+        setGraphic(choiceBox);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cancelEdit() {
+        super.cancelEdit();
+        
+        setText(converter.toString(getItem()));
+        setGraphic(null);
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(T item, boolean empty) {
+        super.updateItem(item, empty);
+        ChoiceBoxCell.updateItem(this, choiceBox, converter);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ChoiceBoxTreeCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,144 @@
+/*
+ * 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.cell;
+
+import static com.sun.javafx.scene.control.cell.ChoiceBoxCell.createChoiceBox;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.scene.control.ChoiceBox;
+import javafx.scene.control.Label;
+import javafx.scene.control.ListCell;
+import javafx.scene.control.TreeCell;
+import javafx.scene.control.TreeItem;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing a {@link ListCell} implementation that draws a 
+ * {@link ChoiceBox} node inside the cell.
+ * 
+ * <p>By default, the ChoiceBoxTreeCell is rendered as a {@link Label} when not 
+ * being edited, and as a ChoiceBox when in editing mode. The ChoiceBox will, by
+ * default, stretch to fill the entire tree cell.
+ * 
+ * <p>To create a ChoiceBoxTreeCell, it is necessary to provide zero or more 
+ * items that will be shown to the user when the {@link ChoiceBox} menu is 
+ * showing. These items must be of the same type as the TreeView TreeItems, such 
+ * that upon selection, they replace the existing value in the 
+ * {@link TreeItem#valueProperty()}.
+ * 
+ * @param <T> The type of the TreeItems contained within the TreeView.
+ */
+public class ChoiceBoxTreeCell<T> extends TreeCell<T> {
+    private final ObservableList<T> items;
+
+    private ChoiceBox<T> choiceBox;
+    
+    private final StringConverter<T> converter;
+
+    /**
+     * Creates a default {@link ChoiceBoxTreeCell} instance with the given items
+     * being used to populate the {@link ChoiceBox} when it is shown.
+     * 
+     * @param items The items to show in the ChoiceBox popup menu when selected 
+     * by the user.
+     */
+    public ChoiceBoxTreeCell(T... items) {
+        this(FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a {@link ChoiceBoxTreeCell} instance with the given items
+     * being used to populate the {@link ChoiceBox} when it is shown, and the 
+     * {@link StringConverter} being used to convert the item in to a 
+     * user-readable form.
+     * 
+     * @param converter A {@link Callback} that can convert an item of type T 
+     *      into a user-readable string so that it may then be shown in the 
+     *      ChoiceBox popup menu.
+     * @param items The items to show in the ChoiceBox popup menu when selected 
+     *      by the user.
+     */
+    public ChoiceBoxTreeCell(StringConverter<T> converter, T... items) {
+        this(converter, FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a default {@link ChoiceBoxTreeCell} instance with the given items
+     * being used to populate the {@link ChoiceBox} when it is shown.
+     * 
+     * @param items The items to show in the ChoiceBox popup menu when selected 
+     *      by the user.
+     */
+    public ChoiceBoxTreeCell(ObservableList<T> items) {
+        this(null, items);
+    }
+
+    /**
+     * Creates a {@link ChoiceBoxTreeCell} instance with the given items
+     * being used to populate the {@link ChoiceBox} when it is shown, and the 
+     * {@link StringConverter} being used to convert the item in to a 
+     * user-readable form.
+     * 
+     * @param converter A {@link Callback} that can convert an item of type T 
+     *      into a user-readable string so that it may then be shown in the 
+     *      ChoiceBox popup menu.
+     * @param items The items to show in the ChoiceBox popup menu when selected 
+     *      by the user.
+     */
+    public ChoiceBoxTreeCell(StringConverter<T> converter, ObservableList<T> items) {
+        this.items = items;
+        this.converter = converter != null ? converter : CellUtils.<T>defaultStringConverter();
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void startEdit() {
+        if (! isEditable() || ! getTreeView().isEditable()) {
+            return;
+        }
+        if (choiceBox == null) {
+            choiceBox = createChoiceBox(this, items);
+        }
+        
+        choiceBox.getSelectionModel().select(getTreeItem().getValue());
+        
+        super.startEdit();
+        setText(null);
+        setGraphic(choiceBox);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cancelEdit() {
+        super.cancelEdit();
+        
+        setText(converter.toString(getItem()));
+        setGraphic(null);
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(T item, boolean empty) {
+        super.updateItem(item, empty);
+        ChoiceBoxCell.updateItem(this, choiceBox, converter);
+    };
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ComboBoxCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,67 @@
+/*
+ * 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.cell;
+
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
+import javafx.collections.ObservableList;
+import javafx.scene.control.Cell;
+import javafx.scene.control.ComboBox;
+import javafx.util.StringConverter;
+
+// Package protected - not intended for external use
+class ComboBoxCell {
+    
+    static <T> void updateItem(Cell<T> cell, ComboBox<T> comboBox, StringConverter<T> converter) {
+        if (cell.isEmpty()) {
+            cell.setText(null);
+            cell.setGraphic(null);
+        } else {
+            if (cell.isEditing()) {
+                if (comboBox != null) {
+                    comboBox.getSelectionModel().select(cell.getItem());
+                }
+                cell.setText(null);
+                cell.setGraphic(comboBox);
+            } else {
+                cell.setText(converter.toString(cell.getItem()));
+                cell.setGraphic(null);
+            }
+        }
+    };
+    
+    static <T> ComboBox<T> createComboBox(final Cell<T> cell, ObservableList<T> items) {
+        ComboBox<T> comboBox = new ComboBox<T>(items);
+        comboBox.setMaxWidth(Double.MAX_VALUE);
+        comboBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<T>() {
+            @Override public void changed(ObservableValue<? extends T> ov, T oldValue, T newValue) {
+                if (cell.isEditing()) {
+                    cell.commitEdit(newValue);
+                }
+            }
+        });
+        return comboBox;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ComboBoxCellFactory.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,343 @@
+/*
+ * 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.cell;
+
+import com.sun.javafx.beans.annotations.NoBuilder;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.event.EventHandler;
+import javafx.scene.control.ComboBox;
+import javafx.scene.control.Label;
+import javafx.scene.control.ListCell;
+import javafx.scene.control.ListView;
+import javafx.scene.control.TableCell;
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.TreeCell;
+import javafx.scene.control.TreeItem;
+import javafx.scene.control.TreeView;
+import javafx.util.Callback;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing cell factories that use {@link ComboBox}, although the 
+ * precise way in which these cell factories work differs between controls. Be 
+ * sure to read the API documentation for each static method, as well as the 
+ * class documentation for {@link ComboBoxListCell}, {@link ComboBoxTableCell} 
+ * and {@link ComboBoxTreeCell} before using it!
+ * 
+ * @see ComboBox
+ * @see ComboBoxListCell
+ * @see ComboBoxTreeCell
+ * @see ComboBoxTableCell
+ */
+@NoBuilder
+public final class ComboBoxCellFactory {
+    
+    private ComboBoxCellFactory() { }
+    
+    /**
+     * Creates a ComboBox cell factory for use in {@link ListView} controls. By 
+     * default, the ComboBoxCell is rendered as a {@link Label} when not being 
+     * edited, and as a ComboBox when in editing mode. The ComboBox will, by 
+     * default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the ListView.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ComboBox} menu is showing. These items must be of the same 
+     *      type as the ListView items list, such that upon selection, they 
+     *      replace the existing value in the 
+     *      {@link ListView#itemsProperty() items} list.
+     * @return A {@link Callback} that will return a ListCell that is able to 
+     *      work on the type of element contained within the ListView.
+     */
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(final T... items) {
+        return forListView(FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a ComboBox cell factory for use in {@link ListView} controls. By 
+     * default, the ComboBoxCell is rendered as a {@link Label} when not being 
+     * edited, and as a ComboBox when in editing mode. The ComboBox will, by 
+     * default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the ListView.
+     * @param converter A {@link StringConverter} to convert the given item (of 
+     *      type T) to a String for displaying to the user.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ComboBox} menu is showing. These items must be of the same 
+     *      type as the ListView items list, such that
+     *      upon selection, they replace the existing value in the 
+     *      {@link ListView#itemsProperty() items} list.
+     * @return A {@link Callback} that will return a ListCell that is able to 
+     *      work on the type of element contained within the ListView.
+     */
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(
+                final StringConverter<T> converter, 
+                final T... items) {
+        return forListView(converter, FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a ComboBox cell factory for use in {@link ListView} controls. By 
+     * default, the ComboBoxCell is rendered as a {@link Label} when not being 
+     * edited, and as a ComboBox when in editing mode. The ComboBox will, by 
+     * default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the ListView.
+     * @param items An {@link ObservableList} containing zero or more items that 
+     *      will be shown to the user when the {@link ComboBox} menu is showing. 
+     *      These items must be of the same type as the ListView items sequence, 
+     *      such that upon selection, they replace the existing value in the 
+     *      {@link ListView#itemsProperty() items} list.
+     * @return A {@link Callback} that will return a ListCell that is able to 
+     *      work on the type of element contained within the ListView.
+     */
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(
+            final ObservableList<T> items) {
+        return forListView(null, items);
+    }
+    
+    /**
+     * Creates a ComboBox cell factory for use in {@link ListView} controls. By 
+     * default, the ComboBoxCell is rendered as a {@link Label} when not being 
+     * edited, and as a ComboBox when in editing mode. The ComboBox will, by 
+     * default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the ListView.
+     * @param converter A {@link StringConverter} to convert the given item (of 
+     *      type T) to a String for displaying to the user.
+     * @param items An {@link ObservableList} containing zero or more items that 
+     *      will be shown to the user when the {@link ComboBox} menu is showing. 
+     *      These items must be of the same type as the ListView items sequence, 
+     *      such that upon selection, they replace the existing value in the 
+     *      {@link ListView#itemsProperty() items} list.
+     * @return A {@link Callback} that will return a ListCell that is able to 
+     *      work on the type of element contained within the ListView.
+     */
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(
+            final StringConverter<T> converter, 
+            final ObservableList<T> items) {
+        return new Callback<ListView<T>, ListCell<T>>() {
+            @Override public ListCell<T> call(ListView<T> list) {
+                return new ComboBoxListCell<T>(converter, items);
+            }
+        };
+    }
+    
+    /**
+     * Creates a ComboBox cell factory for use in {@link TreeView} controls. By 
+     * default, the ComboBoxCell is rendered as a {@link Label} when not being 
+     * edited, and as a ComboBox when in editing mode. The ComboBox will, by 
+     * default, stretch to fill the entire tree cell.
+     * 
+     * @param <T> The type of the elements contained within the TreeView.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ComboBox} menu is showing. These items must be of the same 
+     *      type as the TreeView<T>, such that upon selection, they replace the 
+     *      existing value in the TreeItem {@link TreeItem#valueProperty() value} 
+     *      property.
+     * @return A {@link Callback} that will return a TreeCell that is able to 
+     *      work on the type of element contained within the TreeView.
+     */    
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(T... items) {
+        return forTreeView(FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a ComboBox cell factory for use in {@link TreeView} controls. By 
+     * default, the ComboBoxCell is rendered as a {@link Label} when not being 
+     * edited, and as a ComboBox when in editing mode. The ComboBox will, by 
+     * default, stretch to fill the entire tree cell, excluding the space 
+     * allocated to the tree cell indentation and disclosure node(i.e. the arrow).
+     * 
+     * @param <T> The type of the {@link TreeItem} elements contained within the 
+     *      TreeView.
+     * @param items An {@link ObservableList} containing zero or more items that 
+     *      will be shown to the user when the {@link ComboBox} menu is showing. 
+     *      These items must be of the same type as the TreeView generic type, 
+     *      such that upon selection, they replace the existing value in the 
+     *      {@link TreeItem} that is being edited (as noted in the 
+     *      {@link TreeView#editingItemProperty()}.
+     * @return A {@link Callback} that will return a TreeCell that is able to 
+     *      work on the type of element contained within the TreeView.
+     */
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(
+            final ObservableList<T> items) {
+        return forTreeView(null, items);
+    }
+    
+    /**
+     * Creates a ComboBox cell factory for use in {@link TreeView} controls. By 
+     * default, the ComboBoxCell is rendered as a {@link Label} when not being 
+     * edited, and as a ComboBox when in editing mode. The ComboBox will, by 
+     * default, stretch to fill the entire tree cell.
+     * 
+     * @param <T> The type of the elements contained within the TreeView.
+     * @param converter A {@link StringConverter} to convert the given item (of 
+     *      type T) to a String for displaying to the user.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ComboBox} menu is showing. These items must be of the same 
+     *      type as the TreeView<T>, such that upon selection, they replace the 
+     *      existing value in the TreeItem {@link TreeItem#valueProperty() value} 
+     *      property.
+     * @return A {@link Callback} that will return a TreeCell that is able to 
+     *      work on the type of element contained within the TreeView.
+     */  
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(
+            final StringConverter<T> converter, 
+            final T... items) {
+        return forTreeView(converter, FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a ComboBox cell factory for use in {@link TreeView} controls. By 
+     * default, the ComboBoxCell is rendered as a {@link Label} when not being 
+     * edited, and as a ComboBox when in editing mode. The ComboBox will, by 
+     * default, stretch to fill the entire tree cell.
+     * 
+     * @param <T> The type of the elements contained within the TreeView.
+     * @param converter A {@link StringConverter} to convert the given item (of 
+     *      type T) to a String for displaying to the user.
+     * @param items An {@link ObservableList} containing zero or more items that 
+     *      will be shown to the user when the {@link ComboBox} menu is showing. 
+     *      These items must be of the same type as the TreeView generic type, 
+     *      such that upon selection, they replace the existing value in the 
+     *      {@link TreeItem} that is being edited (as noted in the 
+     *      {@link TreeView#editingItemProperty()}.
+     * @return A {@link Callback} that will return a TreeCell that is able to 
+     *      work on the type of element contained within the TreeView.
+     */  
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(
+            final StringConverter<T> converter, 
+            final ObservableList<T> items) {
+        return new Callback<TreeView<T>, TreeCell<T>>() {
+          @Override public TreeCell<T> call(TreeView<T> list) {
+              return new ComboBoxTreeCell<T>(converter, items);
+          }
+      };
+    }
+    
+    /**
+     * Creates a ComboBox cell factory for use in {@link TableColumn} controls. 
+     * By default, the ComboBoxCell is rendered as a {@link Label} when not 
+     * being edited, and as a ComboBox when in editing mode. The ComboBox will, 
+     * by default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the TableColumn.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ComboBox} menu is showing. These items must be of the same 
+     *      type as the TableColumn. Note that it is up to the developer to set 
+     *      {@link EventHandler event handlers} to listen to edit events in the 
+     *      TableColumn, and react accordingly. Methods of interest include 
+     *      {@link TableColumn#setOnEditStart(EventHandler) setOnEditStart},
+     *      {@link TableColumn#setOnEditCommit(javafx.event.EventHandler) setOnEditCommit}, 
+     *      and {@link TableColumn#setOnEditCancel(EventHandler) setOnEditCancel}.
+     * @return A {@link Callback} that will return a TableCell that is able to 
+     *      work on the type of element contained within the TableColumn.
+     */
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final T... items) {
+        return forTableColumn(null, items);
+    }
+    
+    /**
+     * Creates a ComboBox cell factory for use in {@link TableColumn} controls. 
+     * By default, the ComboBoxCell is rendered as a {@link Label} when not 
+     * being edited, and as a ComboBox when in editing mode. The ComboBox will, 
+     * by default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the TableColumn.
+     * @param converter A {@link StringConverter} to convert the given item (of 
+     *      type T) to a String for displaying to the user.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ComboBox} menu is showing. These items must be of the same 
+     *      type as the TableColumn. Note that it is up to the developer to set 
+     *      {@link EventHandler event handlers} to listen to edit events in the 
+     *      TableColumn, and react accordingly. Methods of interest include 
+     *      {@link TableColumn#setOnEditStart(EventHandler) setOnEditStart},
+     *      {@link TableColumn#setOnEditCommit(javafx.event.EventHandler) setOnEditCommit}, 
+     *      and {@link TableColumn#setOnEditCancel(EventHandler) setOnEditCancel}.
+     * @return A {@link Callback} that will return a TableCell that is able to 
+     *      work on the type of element contained within the TableColumn.
+     */
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final StringConverter<T> converter, 
+            final T... items) {
+        return forTableColumn(converter, FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a ComboBox cell factory for use in {@link TableColumn} controls. 
+     * By default, the ComboBoxCell is rendered as a {@link Label} when not 
+     * being edited, and as a ComboBox when in editing mode. The ComboBox will, 
+     * by default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the TableColumn.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ComboBox} menu is showing. These items must be of the same 
+     *      type as the TableColumn. Note that it is up to the developer to set 
+     *      {@link EventHandler event handlers} to listen to edit events in the 
+     *      TableColumn, and react accordingly. Methods of interest include 
+     *      {@link TableColumn#setOnEditStart(EventHandler) setOnEditStart},
+     *      {@link TableColumn#setOnEditCommit(javafx.event.EventHandler) setOnEditCommit}, 
+     *      and {@link TableColumn#setOnEditCancel(EventHandler) setOnEditCancel}.
+     * @return A {@link Callback} that will return a TableCell that is able to 
+     *      work on the type of element contained within the TableColumn.
+     */
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final ObservableList<T> items) {
+        return forTableColumn(null, items);
+    }
+    
+    /**
+     * Creates a ComboBox cell factory for use in {@link TableColumn} controls. 
+     * By default, the ComboBoxCell is rendered as a {@link Label} when not 
+     * being edited, and as a ComboBox when in editing mode. The ComboBox will, 
+     * by default, stretch to fill the entire list cell.
+     * 
+     * @param <T> The type of the elements contained within the TableColumn.
+     * @param converter A {@link StringConverter} to convert the given item (of 
+     *      type T) to a String for displaying to the user.
+     * @param items Zero or more items that will be shown to the user when the
+     *      {@link ComboBox} menu is showing. These items must be of the same 
+     *      type as the TableColumn. Note that it is up to the developer to set 
+     *      {@link EventHandler event handlers} to listen to edit events in the 
+     *      TableColumn, and react accordingly. Methods of interest include 
+     *      {@link TableColumn#setOnEditStart(EventHandler) setOnEditStart},
+     *      {@link TableColumn#setOnEditCommit(javafx.event.EventHandler) setOnEditCommit}, 
+     *      and {@link TableColumn#setOnEditCancel(EventHandler) setOnEditCancel}.
+     * @return A {@link Callback} that will return a TableCell that is able to 
+     *      work on the type of element contained within the TableColumn.
+     */
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final StringConverter<T> converter, 
+            final ObservableList<T> items) {
+        return new Callback<TableColumn<S,T>, TableCell<S,T>>() {
+            @Override public TableCell<S,T> call(TableColumn<S,T> list) {
+                return new ComboBoxTableCell<S,T>(converter, items);
+            }
+        };
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ComboBoxListCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,143 @@
+/*
+ * 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.cell;
+
+import static com.sun.javafx.scene.control.cell.ComboBoxCell.createComboBox;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.scene.control.*;
+import javafx.util.Callback;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing a {@link ListCell} implementation that draws a 
+ * {@link ComboBox} node inside the cell.
+ * 
+ * <p>By default, the ComboBoxListCell is rendered as a {@link Label} when not 
+ * being edited, and as a ComboBox when in editing mode. The ComboBox will, by 
+ * default, stretch to fill the entire list cell.
+ * 
+ * <p>To create a ComboBoxListCell, it is necessary to provide zero or more 
+ * items that will be shown to the user when the {@link ComboBox} menu is 
+ * showing. These items must be of the same type as the ListView items sequence, 
+ * such that upon selection, they replace the existing value in the 
+ * {@link ListView#itemsProperty() items} list.
+ * 
+ * @param <T> The type of the elements contained within the ListView.
+ */
+public class ComboBoxListCell<T> extends ListCell<T> {
+    
+    private final ObservableList<T> items;
+
+    private ComboBox<T> comboBox;
+    
+    private final StringConverter<T> converter;
+    
+    /**
+     * Creates a default {@link ComboBoxListCell} instance with the given items
+     * being used to populate the {@link ComboBox} when it is shown.
+     * 
+     * @param items The items to show in the ComboBox popup menu when selected 
+     *      by the user.
+     */
+    public ComboBoxListCell(T... items) {
+        this(FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a {@link ComboBoxListCell} instance with the given items
+     * being used to populate the {@link ComboBox} when it is shown, and the 
+     * {@link StringConverter} being used to convert the item in to a 
+     * user-readable form.
+     * 
+     * @param converter A {@link StringConverter} that can convert an item of 
+     *      type T into a user-readable string so that it may then be shown in 
+     *      the ComboBox popup menu.
+     * @param items The items to show in the ComboBox popup menu when selected 
+     *      by the user.
+     */
+    public ComboBoxListCell(StringConverter<T> converter, T... items) {
+        this(converter, FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a default {@link ComboBoxListCell} instance with the given items
+     * being used to populate the {@link ComboBox} when it is shown.
+     * 
+     * @param items The items to show in the ComboBox popup menu when selected 
+     *      by the user.
+     */
+    public ComboBoxListCell(ObservableList<T> items) {
+        this(null, items);
+    }
+
+    /**
+     * Creates a {@link ComboBoxListCell} instance with the given items
+     * being used to populate the {@link ComboBox} when it is shown, and the 
+     * {@link StringConverter} being used to convert the item in to a 
+     * user-readable form.
+     * 
+     * @param converter A {@link StringConverter} that can convert an item of 
+     *      type T into a user-readable string so that it may then be shown in 
+     *      the ComboBox popup menu.
+     * @param items The items to show in the ComboBox popup menu when selected 
+     *      by the user.
+     */
+    public ComboBoxListCell(StringConverter<T> converter, ObservableList<T> items) {
+        this.items = items;
+        this.converter = converter != null ? converter : CellUtils.<T>defaultStringConverter();
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void startEdit() {
+        if (! isEditable() || ! getListView().isEditable()) {
+            return;
+        }
+        
+        if (comboBox == null) {
+            comboBox = createComboBox(this, items);
+        }
+        
+        comboBox.getSelectionModel().select(getItem());
+        
+        super.startEdit();
+        setText(null);
+        setGraphic(comboBox);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cancelEdit() {
+        super.cancelEdit();
+        
+        setText(converter.toString(getItem()));
+        setGraphic(null);
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(T item, boolean empty) {
+        super.updateItem(item, empty);
+        ComboBoxCell.updateItem(this, comboBox, converter);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ComboBoxTableCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,143 @@
+/*
+ * 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.cell;
+
+import static com.sun.javafx.scene.control.cell.ComboBoxCell.createComboBox;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.scene.control.ComboBox;
+import javafx.scene.control.Label;
+import javafx.scene.control.TableCell;
+import javafx.util.Callback;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing a {@link TableCell} implementation that draws a 
+ * {@link ComboBox} node inside the cell.
+ * 
+ * <p>By default, the ComboBoxTableCell is rendered as a {@link Label} when not 
+ * being edited, and as a ComboBox when in editing mode. The ComboBox will, by 
+ * default, stretch to fill the entire table cell.
+ * 
+ * <p>To create a ComboBoxTableCell, it is necessary to provide zero or more 
+ * items that will be shown to the user when the {@link ComboBox} menu is 
+ * showing. These items must be of the same type as the TableColumn.
+ * 
+ * @param <T> The type of the elements contained within the TableColumn.
+ */
+public class ComboBoxTableCell<S,T> extends TableCell<S,T> {
+        
+    private final ObservableList<T> items;
+
+    private ComboBox<T> comboBox;
+
+    private final StringConverter<T> converter;
+    
+    /**
+     * Creates a default {@link ComboBoxTableCell} instance with the given items
+     * being used to populate the {@link ComboBox} when it is shown.
+     * 
+     * @param items The items to show in the ComboBox popup menu when selected 
+     *      by the user.
+     */
+    public ComboBoxTableCell(T... items) {
+        this(FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a {@link ComboBoxTableCell} instance with the given items
+     * being used to populate the {@link ComboBox} when it is shown, and the 
+     * {@link StringConverter} being used to convert the item in to a 
+     * user-readable form.
+     * 
+     * @param converter A {@link StringConverter} that can convert an item of type T 
+     *      into a user-readable string so that it may then be shown in the 
+     *      ComboBox popup menu.
+     * @param items The items to show in the ComboBox popup menu when selected 
+     *      by the user.
+     */
+    public ComboBoxTableCell(StringConverter<T> converter, T... items) {
+        this(converter, FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a default {@link ComboBoxTableCell} instance with the given items
+     * being used to populate the {@link ComboBox} when it is shown.
+     * 
+     * @param items The items to show in the ComboBox popup menu when selected 
+     *      by the user.
+     */
+    public ComboBoxTableCell(ObservableList<T> items) {
+        this(null, items);
+    }
+
+    /**
+     * Creates a {@link ComboBoxTableCell} instance with the given items
+     * being used to populate the {@link ComboBox} when it is shown, and the 
+     * {@link StringConverter} being used to convert the item in to a 
+     * user-readable form.
+     * 
+     * @param converter A {@link StringConverter} that can convert an item of type T 
+     *      into a user-readable string so that it may then be shown in the 
+     *      ComboBox popup menu.
+     * @param items The items to show in the ComboBox popup menu when selected 
+     *      by the user.
+     */
+    public ComboBoxTableCell(StringConverter<T> converter, ObservableList<T> items) {
+        this.items = items;
+        this.converter = converter != null ? converter : CellUtils.<T>defaultStringConverter();
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void startEdit() {
+        if (! isEditable() || ! getTableView().isEditable() || ! getTableColumn().isEditable()) {
+            return;
+        }
+        
+        if (comboBox == null) {
+            comboBox = createComboBox(this, items);
+        }
+        
+        comboBox.getSelectionModel().select(getItem());
+        
+        super.startEdit();
+        setText(null);
+        setGraphic(comboBox);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cancelEdit() {
+        super.cancelEdit();
+        
+        setText(converter.toString(getItem()));
+        setGraphic(null);
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(T item, boolean empty) {
+        super.updateItem(item, empty);
+        ComboBoxCell.updateItem(this, comboBox, converter);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ComboBoxTreeCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,144 @@
+/*
+ * 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.cell;
+
+import static com.sun.javafx.scene.control.cell.ComboBoxCell.createComboBox;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.scene.control.ComboBox;
+import javafx.scene.control.Label;
+import javafx.scene.control.TreeCell;
+import javafx.scene.control.TreeItem;
+import javafx.util.Callback;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing a {@link TreeCell} implementation that draws a 
+ * {@link ComboBox} node inside the cell.
+ * 
+ * <p>By default, the ComboBoxTreeCell is rendered as a {@link Label} when not 
+ * being edited, and as a ComboBox when in editing mode. The ComboBox will, by 
+ * default, stretch to fill the entire tree cell.
+ * 
+ * <p>To create a ComboBoxTreeCell, it is necessary to provide zero or more 
+ * items that will be shown to the user when the {@link ComboBox} menu is 
+ * showing. These items must be of the same type as the TreeView TreeItems, such 
+ * that upon selection, they replace the existing value in the 
+ * {@link TreeItem#valueProperty()}.
+ * 
+ * @param <T> The type of the TreeItems contained within the TreeView.
+ */
+public class ComboBoxTreeCell<T> extends TreeCell<T> {
+    private final ObservableList<T> items;
+
+    private ComboBox<T> comboBox;
+    
+    private final StringConverter<T> converter;
+
+    /**
+     * Creates a default {@link ComboBoxTreeCell} instance with the given items
+     * being used to populate the {@link ComboBox} when it is shown.
+     * 
+     * @param items The items to show in the ComboBox popup menu when selected 
+     *      by the user.
+     */
+    public ComboBoxTreeCell(T... items) {
+        this(FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a {@link ComboBoxTreeCell} instance with the given items
+     * being used to populate the {@link ComboBox} when it is shown, and the 
+     * {@link StringConverter} being used to convert the item in to a 
+     * user-readable form.
+     * 
+     * @param converter A {@link StringConverter} that can convert an item of 
+     *      type T into a user-readable string so that it may then be shown in 
+     *      the ComboBox popup menu.
+     * @param items The items to show in the ComboBox popup menu when selected 
+     *      by the user.
+     */
+    public ComboBoxTreeCell(StringConverter<T> converter, T... items) {
+        this(converter, FXCollections.observableArrayList(items));
+    }
+    
+    /**
+     * Creates a default {@link ComboBoxTreeCell} instance with the given items
+     * being used to populate the {@link ComboBox} when it is shown.
+     * 
+     * @param items The items to show in the ComboBox popup menu when selected 
+     *      by the user.
+     */
+    public ComboBoxTreeCell(ObservableList<T> items) {
+        this(null, items);
+    }
+
+    /**
+     * Creates a {@link ComboBoxTreeCell} instance with the given items
+     * being used to populate the {@link ComboBox} when it is shown, and the 
+     * {@link StringConverter} being used to convert the item in to a 
+     * user-readable form.
+     * 
+     * @param converter A {@link StringConverter} that can convert an item of 
+     *      type T into a user-readable string so that it may then be shown in 
+     *      the ComboBox popup menu.
+     * @param items The items to show in the ComboBox popup menu when selected 
+     *      by the user.
+     */
+    public ComboBoxTreeCell(StringConverter<T> converter, ObservableList<T> items) {
+        this.items = items;
+        this.converter = converter != null ? converter : CellUtils.<T>defaultStringConverter();
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void startEdit() {
+        if (! isEditable() || ! getTreeView().isEditable()) {
+            return;
+        }
+        if (comboBox == null) {
+            comboBox = createComboBox(this, items);
+        }
+        
+        comboBox.getSelectionModel().select(getTreeItem().getValue());
+        
+        super.startEdit();
+        setText(null);
+        setGraphic(comboBox);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cancelEdit() {
+        super.cancelEdit();
+        
+        setText(converter.toString(getItem()));
+        setGraphic(null);
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(T item, boolean empty) {
+        super.updateItem(item, empty);
+        ComboBoxCell.updateItem(this, comboBox, converter);
+    };
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/MapValueFactory.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,117 @@
+/*
+ * 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.cell;
+
+import java.util.Map;
+
+import javafx.beans.property.ReadOnlyBooleanWrapper;
+import javafx.beans.property.ReadOnlyDoubleWrapper;
+import javafx.beans.property.ReadOnlyFloatWrapper;
+import javafx.beans.property.ReadOnlyIntegerWrapper;
+import javafx.beans.property.ReadOnlyLongWrapper;
+import javafx.beans.property.ReadOnlyObjectWrapper;
+import javafx.beans.property.ReadOnlyStringWrapper;
+import javafx.beans.value.ObservableValue;
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.TableColumn.CellDataFeatures;
+import javafx.scene.control.cell.PropertyValueFactory;
+import javafx.util.Callback;
+
+/**
+ * A convenience implementation of the Callback interface, designed specifically
+ * for use within the {@link TableColumn} 
+ * {@link TableColumn#cellValueFactoryProperty() cell value factory}. An example
+ * of how to use this class is:
+ * 
+ * <pre><code>
+ * ObservableList<Map> personsMapList = ...
+ * 
+ * TableColumn&lt;Map, String&gt; firstNameColumn = new TableColumn&lt;Map, String&gt;("First Name");
+ * firstNameColumn.setCellValueFactory(new MapValueFactory&lt;String&gt;("firstName"));
+ * 
+ * TableView<Map> table = new TableView<Map>(personMapList);
+ * tableView.getColumns().setAll(firstNameColumn);
+ * </code></pre>
+ * 
+ * <p>In this example, there is a list of Map instances, where each Map instance 
+ * representsa single row in the TableView. The "firstName" string is used as a 
+ * key into this map, and the value corresponding to this key is returned, if 
+ * one exists. If the value is an {@link ObservableValue}, then this is returned
+ * directly, otherwise the value is wrapped in a {@link ReadOnlyObjectWrapper}.
+ * 
+ * @see TableColumn
+ * @see TableView
+ * @see TableCell
+ * @see PropertyValueFactory
+ * @param <T> The type of the class contained within the TableColumn cells.
+ */
+public class MapValueFactory<T> implements Callback<CellDataFeatures<Map,T>, ObservableValue<T>> {
+
+    private final Object key;
+    
+    public MapValueFactory(final Object key) {
+        this.key = key;
+    }
+    
+    @Override public ObservableValue<T> call(CellDataFeatures<Map, T> cdf) {
+        Map map = cdf.getValue();
+        Object value = map.get(key);
+        
+        // ideally the map will contain observable values directly, and in which
+        // case we can just return this observable value.
+        if (value instanceof ObservableValue) {
+            return (ObservableValue)value;
+        }
+        
+        // TODO
+        // If we are here, the value in the map for the given key is not observable,
+        // but perhaps the Map is an ObservableMap. If this is the case, we
+        // can add a listener to the map for the given key, and possibly observe
+        // it for changes and return these
+//        if (map instanceof ObservableMap) {
+//            ObservableMap oMap = (ObservableMap) map;
+//            // ....
+//        }
+        
+        // Often time there is special case code to deal with specific observable
+        // value types, so we try to wrap in the most specific type.
+        if (value instanceof Boolean) {
+            return (ObservableValue<T>) new ReadOnlyBooleanWrapper((Boolean)value);
+        } else if (value instanceof Integer) {
+            return (ObservableValue<T>) new ReadOnlyIntegerWrapper((Integer)value);
+        } else if (value instanceof Float) {
+            return (ObservableValue<T>) new ReadOnlyFloatWrapper((Float)value);
+        } else if (value instanceof Long) {
+            return (ObservableValue<T>) new ReadOnlyLongWrapper((Long)value);
+        } else if (value instanceof Double) {
+            return (ObservableValue<T>) new ReadOnlyDoubleWrapper((Double)value);
+        } else if (value instanceof String) {
+            return (ObservableValue<T>) new ReadOnlyStringWrapper((String)value);
+        }
+        
+        // fall back to an object wrapper
+        return new ReadOnlyObjectWrapper<T>((T)value);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ProgressBarCellFactory.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,62 @@
+/*
+ * 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.cell;
+
+import com.sun.javafx.beans.annotations.NoBuilder;
+import javafx.scene.control.ProgressBar;
+import javafx.scene.control.TableCell;
+import javafx.scene.control.TableColumn;
+import javafx.util.Callback;
+
+/**
+ * A class containing cell factories that use {@link ProgressBar progress bars}. 
+ * Be sure to read the API documentation for each static method before using it!
+ * 
+ * @see ProgressBar
+ * @see ProgressBarTableCell
+ */
+@NoBuilder
+public final class ProgressBarCellFactory {
+    
+    private ProgressBarCellFactory() { }
+    
+    /**
+     * Provides a {@link ProgressBar} that allows easy visualisation of a Number 
+     * value as it proceeds from 0.0 to 1.0. If the value is -1, the progress 
+     * bar will appear indeterminate.
+     * 
+     * @return A {@link Callback} that can be inserted into the 
+     *      {@link TableColumn#cellFactoryProperty() cell factory property} of a
+     *      TableColumn, that enables visualisation of a Number as it progresses 
+     *      from 0.0 to 1.0.
+     */
+    public static <S> Callback<TableColumn<S,Double>, TableCell<S,Double>> forTableColumn() {
+        return new Callback<TableColumn<S, Double>, TableCell<S, Double>>() {
+            @Override public TableCell<S, Double> call(TableColumn<S, Double> param) {
+                return new ProgressBarTableCell<S, Double>();
+            }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/ProgressBarTableCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,71 @@
+/*
+ * 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.cell;
+
+import javafx.beans.value.ObservableValue;
+import javafx.scene.control.ProgressBar;
+import javafx.scene.control.TableCell;
+
+/**
+ * A class containing a {@link TableCell} implementation that draws a 
+ * {@link ProgressBar} node inside the cell.
+ * 
+ * @param <S> The type of the elements contained within the TableView.
+ */
+public class ProgressBarTableCell<S,Double> extends TableCell<S, java.lang.Double> {
+    
+    private final ProgressBar progressBar;
+    private ObservableValue observable;
+    
+    /**
+     * Creates a default {@link ProgressBarTableCell} instance
+     */
+    public ProgressBarTableCell() {
+        this.getStyleClass().add("progress-bar-table-cell");
+        
+        this.progressBar = new ProgressBar();
+        setGraphic(progressBar);
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(java.lang.Double item, boolean empty) {
+        super.updateItem(item, empty);
+        
+        if (empty) {
+            setGraphic(null);
+        } else {
+            progressBar.progressProperty().unbind();
+            
+            observable = getTableColumn().getCellObservableValue(getIndex());
+            if (observable != null) {
+                progressBar.progressProperty().bind(observable);
+            } else {
+                progressBar.setProgress(item);
+            }
+            
+            setGraphic(progressBar);
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringConverterCellFactory.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,92 @@
+/*
+ * 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.cell;
+
+import com.sun.javafx.beans.annotations.NoBuilder;
+import java.text.Format;
+import javafx.scene.control.ListCell;
+import javafx.scene.control.ListView;
+import javafx.scene.control.TableCell;
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.TreeCell;
+import javafx.scene.control.TreeView;
+import javafx.scene.text.TextAlignment;
+import javafx.util.Callback;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing cell factories that make it easy to convert objects into
+ * String representations for display within ListView, TreeView and TableView 
+ * controls.
+ * 
+ * @see StringConverter
+ * @see StringConverterListCell
+ * @see StringConverterTreeCell
+ * @see StringConverterTableCell
+ */
+@NoBuilder
+public final class StringConverterCellFactory {
+    
+    private StringConverterCellFactory() { }
+    
+    /**
+     * Returns a cell factory that creates a {@link StringConverterListCell} 
+     * by setting the {@link StringConverter} to the provided instance.
+     */
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(
+            final StringConverter converter) {
+        return new Callback<ListView<T>, ListCell<T>>() {
+            @Override public ListCell<T> call(ListView<T> list) {
+                return new StringConverterListCell<T>(converter);
+            }
+        };
+    }
+    
+    /**
+     * Returns a cell factory that creates a {@link StringConverterTreeCell} 
+     * by setting the {@link StringConverter} to the provided instance.
+     */
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(
+            final StringConverter converter) {
+        return new Callback<TreeView<T>, TreeCell<T>>() {
+            @Override public TreeCell<T> call(TreeView<T> list) {
+                return new StringConverterTreeCell<T>(converter);
+            }
+        };
+    }
+    
+    /**
+     * Returns a cell factory that creates a {@link StringConverterTableCell} 
+     * by setting the {@link StringConverter} to the provided instance.
+     */
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final StringConverter converter) {
+        return new Callback<TableColumn<S,T>, TableCell<S,T>>() {
+            @Override public TableCell<S,T> call(TableColumn<S,T> list) {
+                return new StringConverterTableCell<S,T>(converter);
+            }
+        };
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringConverterListCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,54 @@
+/*
+ * 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.cell;
+
+import javafx.scene.control.ListCell;
+import javafx.util.StringConverter;
+
+/**
+ *
+ */
+public class StringConverterListCell<T> extends ListCell<T> {
+    private StringConverter<T> converter;
+    
+    public StringConverterListCell(StringConverter<T> converter) {
+        if (this.converter == null) {
+            throw new IllegalArgumentException("StringConverter must not be null");
+        }
+        
+        this.converter = converter;
+    }
+
+    @Override
+    protected void updateItem(T item, boolean empty) {
+        super.updateItem(item, empty);
+        
+        if (empty) {
+            setText("");
+        } else {
+            setText(converter.toString(item));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringConverterTableCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,54 @@
+/*
+ * 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.cell;
+
+import javafx.scene.control.TableCell;
+import javafx.util.StringConverter;
+
+/**
+ *
+ */
+public class StringConverterTableCell<S,T> extends TableCell<S,T> {
+    private StringConverter<T> converter;
+    
+    public StringConverterTableCell(StringConverter<T> converter) {
+        if (this.converter == null) {
+            throw new IllegalArgumentException("StringConverter must not be null");
+        }
+        
+        this.converter = converter;
+    }
+
+    @Override
+    protected void updateItem(T item, boolean empty) {
+        super.updateItem(item, empty);
+        
+        if (empty) {
+            setText("");
+        } else {
+            setText(converter.toString(item));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringConverterTreeCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,54 @@
+/*
+ * 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.cell;
+
+import javafx.scene.control.TreeCell;
+import javafx.util.StringConverter;
+
+/**
+ *
+ */
+public class StringConverterTreeCell<T> extends TreeCell<T> {
+    private StringConverter<T> converter;
+    
+    public StringConverterTreeCell(StringConverter<T> converter) {
+        if (this.converter == null) {
+            throw new IllegalArgumentException("StringConverter must not be null");
+        }
+        
+        this.converter = converter;
+    }
+
+    @Override
+    protected void updateItem(T item, boolean empty) {
+        super.updateItem(item, empty);
+        
+        if (empty) {
+            setText("");
+        } else {
+            setText(converter.toString(item));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringFormatCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,52 @@
+/*
+ * 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.cell;
+
+import java.text.Format;
+import javafx.scene.Node;
+import javafx.scene.control.Cell;
+
+// Package protected - not intended for external use
+class StringFormatCell {
+    
+    static <T> void doUpdate(final Cell<T> cell, 
+                             final T item, 
+                             final boolean empty, 
+                             final Format format, 
+                             final String text) {
+        if (item == null || empty) {
+            cell.setText(null);
+            cell.setGraphic(null);
+        } else if (format != null) {
+            cell.setText(format.format(item));
+        } else if (item instanceof Node) {
+            cell.setText(null);
+            cell.setGraphic((Node)item);
+        } else {
+            cell.setText(text);
+            cell.setGraphic(null);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringFormatCellFactory.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,200 @@
+/*
+ * 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.cell;
+
+import com.sun.javafx.beans.annotations.NoBuilder;
+import java.text.Format;
+import javafx.scene.control.ListCell;
+import javafx.scene.control.ListView;
+import javafx.scene.control.TableCell;
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.TreeCell;
+import javafx.scene.control.TreeView;
+import javafx.scene.text.TextAlignment;
+import javafx.util.Callback;
+
+/**
+ * A class containing cell factories that make it easy to manipulate the String 
+ * representation of items contained within ListView, TreeView and TableView 
+ * controls.
+ * 
+ * @see Format
+ * @see TextAlignment
+ * @see StringFormatListCell
+ * @see StringFormatTreeCell
+ * @see StringFormatTableCell
+ */
+@NoBuilder
+public final class StringFormatCellFactory {
+    
+    private StringFormatCellFactory() { }
+    
+    /**
+     * Returns a cell factory that creates a default {@link StringFormatListCell}.
+     */
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView() {
+        return forListView(TextAlignment.LEFT);
+    }
+    
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(
+            final TextAlignment align) {
+        return forListView(align, null);
+    }
+    
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(
+            final Format format) {
+        return forListView(TextAlignment.LEFT, format);
+    }
+    
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(
+            final TextAlignment align, 
+            final Format format) {
+        return new Callback<ListView<T>, ListCell<T>>() {
+            @Override public ListCell<T> call(ListView<T> list) {
+                return new StringFormatListCell<T>(align, format);
+            }
+        };
+    }
+    
+    /**
+     * Returns a cell factory that creates a {@link StringFormatListCell} that 
+     * uses the provided {@link Callback} to convert from the generic T type to 
+     * a String, such that it is rendered appropriately.
+     * 
+     * @param toString A {@link Callback} that converts an instance of type T to
+     *      a String, for rendering in the {@link LabelCellFactory}.
+     */
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(
+            final Callback<T, String> toString) {
+        return new Callback<ListView<T>, ListCell<T>>() {
+            @Override public ListCell<T> call(ListView<T> list) {
+                return new StringFormatListCell<T>() {
+                    @Override public String toString(T item) {
+                        return toString == null ? 
+                                super.toString(item) : toString.call(item);
+                    };
+                };
+            }
+        };
+    }
+    
+    /**
+     * Returns a cell factory that creates a default {@link StringFormatTreeCell}.
+     */
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView() {
+        return forTreeView(TextAlignment.LEFT);
+    }
+    
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(
+            final TextAlignment align) {
+        return forTreeView(align, null);
+    }
+    
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(
+            final Format format) {
+        return forTreeView(TextAlignment.LEFT, format);
+    }
+    
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(
+            final TextAlignment align, 
+            final Format format) {
+        return new Callback<TreeView<T>, TreeCell<T>>() {
+            @Override public TreeCell<T> call(TreeView<T> list) {
+                return new StringFormatTreeCell<T>(align, format);
+            }
+        };
+    }
+    
+    /**
+     * Returns a cell factory that creates a {@link StringFormatTableCell} that 
+     * uses the provided {@link Callback} to convert from the generic T type to 
+     * a String, such that it is rendered appropriately.
+     * 
+     * @param toString A {@link Callback} that converts an instance of type T to 
+     *      a String, for rendering in the {@link TableCell}.
+     */
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(
+            final Callback<T, String> toString) {
+        return new Callback<TreeView<T>, TreeCell<T>>() {
+            @Override public TreeCell<T> call(TreeView<T> list) {
+                return new StringFormatTreeCell<T>() {
+                    @Override public String toString(T item) {
+                        return toString == null ? 
+                                super.toString(item) : toString.call(item);
+                    };
+                };
+            }
+        };
+    }
+    
+    /**
+     * Returns a cell factory that creates a default {@link StringFormatTableCell}.
+     */
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn() {
+        return forTableColumn(TextAlignment.LEFT);
+    }
+    
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final TextAlignment align) {
+        return forTableColumn(align, null);
+    }
+    
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final Format format) {
+        return forTableColumn(TextAlignment.LEFT, format);
+    }
+    
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final TextAlignment align, 
+            final Format format) {
+        return new Callback<TableColumn<S,T>, TableCell<S,T>>() {
+            @Override public TableCell<S,T> call(TableColumn<S,T> list) {
+                return new StringFormatTableCell<S,T>(align, format);
+            }
+        };
+    }
+    
+    /**
+     * Returns a cell factory that creates a {@link StringFormatTreeCell} that 
+     * uses the provided {@link Callback} to convert from the generic T type to 
+     * a String, such that it is rendered appropriately.
+     * 
+     * @param toString A {@link Callback} that converts an instance of type T to 
+     *      a String, for rendering in the {@link TreeCell}.
+     */
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final Callback<T, String> toString) {
+        return new Callback<TableColumn<S,T>, TableCell<S,T>>() {
+            @Override public TableCell<S,T> call(TableColumn<S,T> list) {
+                return new StringFormatTableCell<S,T>() {
+                    @Override public String toString(T item) {
+                        return toString == null ? 
+                                super.toString(item) : toString.call(item);
+                    };
+                };
+            }
+        };
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringFormatListCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,105 @@
+/*
+ * 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.cell;
+
+import java.text.Format;
+import javafx.scene.Node;
+import javafx.scene.control.*;
+import javafx.scene.text.TextAlignment;
+
+/**
+ * A class containing a {@link ListCell} implementation that draws a 
+ * {@link Label} node inside the cell. This Label is exposed to the developer to 
+ * allow for easy customization, either via code or using the APIs exposed in 
+ * the {@link CSSListCell} class, from which this class extends.
+ * 
+ * @param <T> The type of the elements contained within the ListView.
+ */
+public class StringFormatListCell<T> extends ListCell<T> {
+    
+    private Format format;
+    
+    /**
+     * Creates a default {@link LabelListCell} instance with the label position 
+     * set to {@link TextAlignment#LEFT}.
+     */
+    public StringFormatListCell() {
+        this(TextAlignment.LEFT);
+    }
+    
+    public StringFormatListCell(Format format) {
+        this(TextAlignment.LEFT, format);
+    }
+    
+    /**
+     * Creates a {@link LabelListCell} instance with the label position set
+     * to the provided {@link TextAlignment} value.
+     */
+    public StringFormatListCell(TextAlignment align) {
+        this(align, null);
+    }
+    
+    public StringFormatListCell(TextAlignment align, Format format) {
+        this.getStyleClass().add("label-cell");
+        setTextAlignment(align);
+        setFormat(format);
+    }
+    
+    // --- Format
+    public Format getFormat() { 
+        return format; 
+    }
+    public void setFormat(Format format) { 
+        this.format = format;
+        doUpdate();
+    }
+    
+    /**
+     * A method that can be overridden by the developer to specify an alternate
+     * formatting of the given item argument. By default, this just calls 
+     * toString() on the item, or returns an empty string if the item is null.
+     * 
+     * @param item The item for which a String representation is required.
+     * @return An empty string if item is null, or a string representation if it 
+     *      is not.
+     */
+    public String toString(T item) {
+        return item == null ? "" : item.toString();
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(T item, boolean empty) {
+        if (item == getItem()) return;
+
+        super.updateItem(item, empty);
+
+        doUpdate();
+    }
+    
+    private void doUpdate() {
+        T item = getItem();
+        StringFormatCell.doUpdate(this, item, isEmpty(), getFormat(), toString(item));
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringFormatTableCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,105 @@
+/*
+ * 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.cell;
+
+import java.text.Format;
+import javafx.scene.control.Label;
+import javafx.scene.control.TableCell;
+import javafx.scene.text.TextAlignment;
+
+/**
+ * A class containing a {@link TableCell} implementation that draws a 
+ * {@link Label} node inside the cell. This Label is exposed to the developer to 
+ * allow for easy customization, either via code or using the APIs exposed in 
+ * the {@link CSSTableCell} class, from which this class extends.
+ * 
+ * @param <T> The type of the elements contained within the TableColumn.
+ */
+public class StringFormatTableCell<S,T> extends TableCell<S,T> {
+    
+    private Format format;
+    
+    /**
+     * Creates a default {@link LabelTableCell} instance with the label position 
+     * set to {@link TextAlignment#LEFT}.
+     */
+    public StringFormatTableCell() {
+        this(TextAlignment.LEFT);
+    }
+    
+    public StringFormatTableCell(Format format) {
+        this(TextAlignment.LEFT, format);
+    }
+    
+    /**
+     * Creates a {@link LabelTableCell} instance with the label position set
+     * to the provided {@link TextAlignment} value.
+     */
+    public StringFormatTableCell(TextAlignment align) {
+        this(align, null);
+    }
+    
+    public StringFormatTableCell(TextAlignment align, Format format) {
+        this.getStyleClass().add("label-cell");
+        setTextAlignment(align);
+        setFormat(format);
+    }
+    
+    // --- Format
+    public Format getFormat() { 
+        return format; 
+    }
+    public void setFormat(Format format) { 
+        this.format = format;
+        doUpdate();
+    }
+    
+    /**
+     * A method that can be overridden by the developer to specify an alternate
+     * formatting of the given item argument. By default, this just calls 
+     * toString() on the item, or returns an empty string if the item is null.
+     * 
+     * @param item The item for which a String representation is required.
+     * @return An empty string if item is null, or a string representation if it 
+     *      is not.
+     */
+    public String toString(T item) {
+        return item == null ? "" : item.toString();
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(T item, boolean empty) {
+        if (item == getItem()) return;
+
+        super.updateItem(item, empty);
+
+        doUpdate();
+    }
+    
+    private void doUpdate() {
+        T item = getItem();
+        StringFormatCell.doUpdate(this, item, isEmpty(), getFormat(), toString(item));
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/StringFormatTreeCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,102 @@
+/*
+ * 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.cell;
+
+import java.text.Format;
+import javafx.scene.control.*;
+import javafx.scene.text.TextAlignment;
+
+/**
+ * A class containing a {@link TreeCell} implementation that draws a 
+ * {@link Label} node inside the cell. This Label is exposed to the developer to 
+ * allow for easy customization, either via code or using the APIs exposed in 
+ * the {@link CSSTreeCell} class, from which this class extends.
+ * 
+ * @param <T> The type of the TreeItems contained within the TreeView.
+ */
+public class StringFormatTreeCell<T> extends TreeCell<T> {
+    
+    private Format format;
+    
+    /**
+     * Creates a default {@link LabelTreeCell} instance with the label position 
+     * set to {@link TextAlignment#LEFT}.
+     */
+    public StringFormatTreeCell() {
+        this(TextAlignment.LEFT);
+    }
+    
+    public StringFormatTreeCell(Format format) {
+        this(TextAlignment.LEFT, format);
+    }
+    
+    /**
+     * Creates a {@link LabelTreeCell} instance with the label position set
+     * to the provided {@link TextAlignment} value.
+     */
+    public StringFormatTreeCell(TextAlignment align) {
+        this(align, null);
+    }
+    
+    public StringFormatTreeCell(TextAlignment align, Format format) {
+        this.getStyleClass().add("label-cell");
+        setTextAlignment(align);
+        setFormat(format);
+    }
+    
+    // --- Format
+    public Format getFormat() { 
+        return format; 
+    }
+    public void setFormat(Format format) { 
+        this.format = format;
+        doUpdate();
+    }
+    
+    /**
+     * A method that can be overridden by the developer to specify an alternate
+     * formatting of the given item argument. By default, this just calls 
+     * toString() on the item, or returns an empty string if the item is null.
+     * 
+     * @param item The item for which a String representation is required.
+     * @return An empty string if item is null, or a string representation if it 
+     *      is not.
+     */
+    public String toString(T item) {
+        return item == null ? "" : item.toString();
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(T item, boolean empty) {
+        if (item == getItem()) return;
+
+        doUpdate();
+    }
+    
+    private void doUpdate() {
+        T item = getItem();
+        StringFormatCell.doUpdate(this, item, isEmpty(), getFormat(), toString(item));
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/TextFieldCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,93 @@
+/*
+ * 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.cell;
+
+import javafx.event.EventHandler;
+import javafx.scene.control.Cell;
+import javafx.scene.control.TextField;
+import javafx.scene.input.KeyCode;
+import javafx.scene.input.KeyEvent;
+import javafx.util.Callback;
+import javafx.util.StringConverter;
+
+// Package protected - not intended for external use
+class TextFieldCell {
+
+    static <T> void updateItem(Cell<T> cell, TextField textField) {
+        if (cell.isEmpty()) {
+            cell.setText(null);
+            cell.setGraphic(null);
+        } else {
+            if (cell.isEditing()) {
+                if (textField != null) {
+                    textField.setText(getItemText(cell));
+                }
+                cell.setText(null);
+                cell.setGraphic(textField);
+            } else {
+                cell.setText(getItemText(cell));
+                cell.setGraphic(null);
+            }
+        }
+    }
+    
+    static <T> void startEdit(
+            final Cell<T> cell, 
+            TextField textField, 
+            final StringConverter<T> converter) {
+        if (textField == null) {
+            textField = createTextField(cell, converter);
+        }
+        textField.setText(getItemText(cell));
+        
+        cell.setText(null);
+        cell.setGraphic(textField);
+        
+        textField.selectAll();
+    }
+    
+    static <T> void cancelEdit(Cell<T> cell) {
+        cell.setText(getItemText(cell));
+        cell.setGraphic(null);
+    }
+    
+    private static <T> TextField createTextField(final Cell<T> cell, final StringConverter<T> converter) {
+        final TextField textField = new TextField(getItemText(cell));
+        textField.setOnKeyReleased(new EventHandler<KeyEvent>() {
+            @Override public void handle(KeyEvent t) {
+                if (t.getCode() == KeyCode.ENTER) {
+                    cell.commitEdit(converter.fromString(textField.getText()));
+                } else if (t.getCode() == KeyCode.ESCAPE) {
+                    cell.cancelEdit();
+                }
+            }
+        });
+        return textField;
+    }
+    
+    private static <T> String getItemText(Cell<T> cell) {
+        return cell.getItem() == null ? "" : cell.getItem().toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/TextFieldCellFactory.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,169 @@
+/*
+ * 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.cell;
+
+import com.sun.javafx.beans.annotations.NoBuilder;
+import javafx.scene.control.ListCell;
+import javafx.scene.control.ListView;
+import javafx.scene.control.TableCell;
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.TableView;
+import javafx.scene.control.TextField;
+import javafx.scene.control.TreeCell;
+import javafx.scene.control.TreeView;
+import javafx.util.Callback;
+import javafx.util.StringConverter;
+import javafx.util.converter.DefaultStringConverter;
+
+/**
+ * A class containing cell factories that use {@link TextField TextFields}. 
+ * Be sure to read the API documentation for each static method before using it!
+ * 
+ * @see TextField
+ * @see TextFieldListCell
+ * @see TextFieldTreeCell
+ * @see TextFieldTableCell
+ */
+@NoBuilder
+public final class TextFieldCellFactory {
+    
+    private TextFieldCellFactory() { }
+    
+    /**
+     * Provides a {@link TextField} that allows editing of the cell content when
+     * the cell is double-clicked, or when {@link ListView#edit(int)} is called. 
+     * This method will only work on {@link ListView} instances which are of 
+     * type String.
+     * 
+     * @return A {@link Callback} that can be inserted into the 
+     *      {@link ListView#cellFactoryProperty() cell factory property} of a 
+     *      ListView, that enables textual editing of the content.
+     */
+    public static Callback<ListView<String>, ListCell<String>> forListView() {
+        return forListView(new DefaultStringConverter());
+    }
+    
+    /**
+     * Provides a {@link TextField} that allows editing of the cell content when 
+     * the cell is double-clicked, or when {@link ListView#edit(int)} is called. 
+     * This method will work on any ListView instance, regardless of its generic 
+     * type. However, to enable this, a {@link StringConverter} must be provided 
+     * that will convert the given String (from what the user typed in) into an 
+     * instance of type T. This item will then be passed along to the 
+     * {@link ListView#onEditCommitProperty()} callback.
+     * 
+     * @param converter A {@link StringConverter} that can convert the given String 
+     *      (from what the user typed in) into an instance of type T.
+     * @return A {@link Callback} that can be inserted into the 
+     *      {@link ListView#cellFactoryProperty() cell factory property} of a 
+     *      ListView, that enables textual editing of the content.
+     */
+    public static <T> Callback<ListView<T>, ListCell<T>> forListView(final StringConverter<T> converter) {
+        return new Callback<ListView<T>, ListCell<T>>() {
+            @Override public ListCell<T> call(ListView<T> list) {
+                return new TextFieldListCell<T>(converter);
+            }
+        };
+    }
+    
+    /**
+     * Provides a {@link TextField} that allows editing of the cell content when 
+     * the cell is double-clicked, or when {@link ListView#edit(int)} is called. 
+     * This method will only work on {@link TreeView} instances which are of 
+     * type String.
+     * 
+     * @return A {@link Callback} that can be inserted into the 
+     *      {@link TreeView#cellFactoryProperty() cell factory property} of a 
+     *      TreeView, that enables textual editing of the content.
+     */
+    public static Callback<TreeView<String>, TreeCell<String>> forTreeView() {
+        return forTreeView(new DefaultStringConverter());
+    }
+    
+    /**
+     * Provides a {@link TextField} that allows editing of the cell content when 
+     * the cell is double-clicked, or when 
+     * {@link TreeView#edit(javafx.scene.control.TreeItem)} is called. This 
+     * method will work on any {@link TreeView} instance, 
+     * regardless of its generic type. However, to enable this, a 
+     * {@link StringConverter} must be provided that will convert the given String 
+     * (from what the user typed in) into an instance of type T. This item will 
+     * then be passed along to the {@link TreeView#onEditCommitProperty()} 
+     * callback.
+     * 
+     * @param converter A {@link StringConverter} that can convert the given String 
+     *      (from what the user typed in) into an instance of type T.
+     * @return A {@link Callback} that can be inserted into the 
+     *      {@link TreeView#cellFactoryProperty() cell factory property} of a 
+     *      TreeView, that enables textual editing of the content.
+     */
+    public static <T> Callback<TreeView<T>, TreeCell<T>> forTreeView(
+            final StringConverter<T> converter) {
+        return new Callback<TreeView<T>, TreeCell<T>>() {
+            @Override public TreeCell<T> call(TreeView<T> list) {
+                return new TextFieldTreeCell<T>(converter);
+            }
+        };
+    }
+    
+    /**
+     * Provides a {@link TextField} that allows editing of the cell content when
+     * the cell is double-clicked, or when 
+     * {@link TableView#edit(int, TableColumn)} is called. This method will only 
+     * work on {@link TableColumn} instances which are of type String.
+     * 
+     * @return A {@link Callback} that can be inserted into the 
+     *      {@link TableColumn#cellFactoryProperty() cell factory property} of a 
+     *      TableColumn, that enables textual editing of the content.
+     */
+    public static <S> Callback<TableColumn<S,String>, TableCell<S,String>> forTableColumn() {
+        return forTableColumn(new DefaultStringConverter());
+    }
+    
+    /**
+     * Provides a {@link TextField} that allows editing of the cell content when
+     * the cell is double-clicked, or when 
+     * {@link TableView#edit(int, TableColumn)} is called. This method will work 
+     * on any {@link TableColumn} instance, regardless of its generic type. 
+     * However, to enable this, a {@link StringConverter} must be provided that will 
+     * convert the given String (from what the user typed in) into an instance 
+     * of type T. This item will then be passed along to the 
+     * {@link TableColumn#onEditCommitProperty()} callback.
+     * 
+     * @param converter A {@link StringConverter} that can convert the given String 
+     *      (from what the user typed in) into an instance of type T.
+     * @return A {@link Callback} that can be inserted into the 
+     *      {@link TableColumn#cellFactoryProperty() cell factory property} of a 
+     *      TableColumn, that enables textual editing of the content.
+     */
+    public static <S,T> Callback<TableColumn<S,T>, TableCell<S,T>> forTableColumn(
+            final StringConverter<T> converter) {
+        return new Callback<TableColumn<S,T>, TableCell<S,T>>() {
+            @Override public TableCell<S,T> call(TableColumn<S,T> list) {
+                return new TextFieldTableCell<S,T>(converter);
+            }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/TextFieldListCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,86 @@
+/*
+ * 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.cell;
+
+import javafx.scene.control.Label;
+import javafx.scene.control.ListCell;
+import javafx.scene.control.ListView;
+import javafx.scene.control.TextField;
+import javafx.util.Callback;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing a {@link ListCell} implementation that draws a 
+ * {@link TextField} node inside the cell.
+ * 
+ * <p>By default, the TextFieldListCell is rendered as a {@link Label} when not 
+ * being edited, and as a TextField when in editing mode. The TextField will, by 
+ * default, stretch to fill the entire list cell.
+ * 
+ * @param <T> The type of the elements contained within the ListView.
+ */
+public class TextFieldListCell<T> extends ListCell<T> {
+    private TextField textField;
+    
+    private final StringConverter<T> converter;
+    
+    /**
+     * Creates a TextFieldListCell that provides a {@link TextField} when put 
+     * into editing mode that allows editing of the cell content. This method 
+     * will work on any ListView instance, regardless of its generic type. 
+     * However, to enable this, a {@link StringConverter} must be provided that 
+     * will convert the given String (from what the user typed in) into an 
+     * instance of type T. This item will then be passed along to the 
+     * {@link ListView#onEditCommitProperty()} callback.
+     * 
+     * @param onCommit A {@link StringConverter<T> converter} that can convert 
+     *      the given String (from what the user typed in) into an instance of 
+     *      type T.
+     */
+    public TextFieldListCell(StringConverter<T> converter) {
+        this.converter = converter;
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void startEdit() {
+        if (! isEditable() || ! getListView().isEditable()) {
+            return;
+        }
+        super.startEdit();
+        TextFieldCell.startEdit(this, textField, converter);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cancelEdit() {
+        super.cancelEdit();
+        TextFieldCell.cancelEdit(this);
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(T item, boolean empty) {
+        super.updateItem(item, empty);
+        TextFieldCell.updateItem(this, textField);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/TextFieldTableCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,88 @@
+/*
+ * 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.cell;
+
+import javafx.scene.control.Label;
+import javafx.scene.control.TableCell;
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.TextField;
+import javafx.util.Callback;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing a {@link TableCell} implementation that draws a 
+ * {@link TextField} node inside the cell.
+ * 
+ * <p>By default, the TextFieldTableCell is rendered as a {@link Label} when not
+ * being edited, and as a TextField when in editing mode. The TextField will, by 
+ * default, stretch to fill the entire table cell.
+ * 
+ * @param <T> The type of the elements contained within the TableColumn.
+ */
+public class TextFieldTableCell<S,T> extends TableCell<S,T> {
+    private TextField textField;
+    
+    private final StringConverter<T> converter;
+
+    /**
+     * Creates a TextFieldTableCell that provides a {@link TextField} when put 
+     * into editing mode that allows editing of the cell content. This method 
+     * will work on any TableColumn instance, regardless of its generic type. 
+     * However, to enable this, a {@link StringConverter} must be provided that 
+     * will convert the given String (from what the user typed in) into an 
+     * instance of type T. This item will then be passed along to the 
+     * {@link TableColumn#onEditCommitProperty()} callback.
+     * 
+     * @param onCommit A {@link StringConverter<T> converter} that can convert 
+     *      the given String (from what the user typed in) into an instance of 
+     *      type T.
+     */
+    public TextFieldTableCell(StringConverter<T> converter) {
+        this.converter = converter;
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void startEdit() {
+        if (! isEditable() 
+                || ! getTableView().isEditable() 
+                || ! getTableColumn().isEditable()) {
+            return;
+        }
+        super.startEdit();
+        TextFieldCell.startEdit(this, textField, converter);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cancelEdit() {
+        super.cancelEdit();
+        TextFieldCell.cancelEdit(this);
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(T item, boolean empty) {
+        super.updateItem(item, empty);
+        TextFieldCell.updateItem(this, textField);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/cell/TextFieldTreeCell.java	Fri Apr 20 12:11:25 2012 +1200
@@ -0,0 +1,85 @@
+/*
+ * 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.cell;
+
+import javafx.scene.control.Label;
+import javafx.scene.control.TextField;
+import javafx.scene.control.TreeCell;
+import javafx.scene.control.TreeView;
+import javafx.util.StringConverter;
+
+/**
+ * A class containing a {@link TreeCell} implementation that draws a 
+ * {@link TextField} node inside the cell.
+ * 
+ * <p>By default, the TextFieldTreeCell is rendered as a {@link Label} when not 
+ * being edited, and as a TextField when in editing mode. The TextField will, by 
+ * default, stretch to fill the entire tree cell.
+ * 
+ * @param <T> The type of the elements contained within the ListView.
+ */
+public class TextFieldTreeCell<T> extends TreeCell<T> {
+    private TextField textField;
+    
+    private final StringConverter<T> converter;
+
+    /**
+     * Creates a TextFieldTreeCell that provides a {@link TextField} when put 
+     * into editing mode that allows editing of the cell content. This method 
+     * will work on any TreeView instance, regardless of its generic type. 
+     * However, to enable this, a {@link StringConverter} must be provided that 
+     * will convert the given String (from what the user typed in) into an 
+     * instance of type T. This item will then be passed along to the 
+     * {@link TreeView#onEditCommitProperty()} callback.
+     * 
+     * @param onCommit A {@link StringConverter<T> converter} that can convert 
+     *      the given String (from what the user typed in) into an instance of 
+     *      type T.
+     */
+    public TextFieldTreeCell(StringConverter<T> converter) {
+        this.converter = converter;
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void startEdit() {
+        if (! isEditable() || ! getTreeView().isEditable()) {
+            return;
+        }
+        super.startEdit();
+        TextFieldCell.startEdit(this, textField, converter);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void cancelEdit() {
+        super.cancelEdit();
+        TextFieldCell.cancelEdit(this);
+    }
+    
+    /** {@inheritDoc} */
+    @Override public void updateItem(T item, boolean empty) {
+        super.updateItem(item, empty);
+        TextFieldCell.updateItem(this, textField);
+    }
+}
\ No newline at end of file