changeset 2848:22bc48b746d4

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/8.0/scrum/controls/jfx/rt
author jgiles
date Thu, 07 Mar 2013 12:03:41 +1300
parents 709356911e3a 90ee146e03e5
children 9dd0e3c584b6 65ab9f40d9ca
files
diffstat 12 files changed, 233 insertions(+), 125 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TreeTableCellBehavior.java	Wed Mar 06 11:08:51 2013 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TreeTableCellBehavior.java	Thu Mar 07 12:03:41 2013 +1300
@@ -121,8 +121,6 @@
         TreeTableColumn column = getTableColumn();
         TableSelectionModel sm = tv.getSelectionModel();
         
-        if (! sm.isCellSelectionEnabled()) return;
-        
         boolean isAlreadySelected = sm.isSelected(index, column);
 
         sm.clearAndSelect(index, column);
@@ -139,7 +137,6 @@
                 tv.edit(index, column);
             } else if (e.getClickCount() % 2 == 0) {
                 // try to expand/collapse branch tree item
-                System.out.println("is expanded: " + treeItem.isExpanded() + " -> " + ! treeItem.isExpanded());
                 treeItem.setExpanded(! treeItem.isExpanded());
             }
         }
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TreeTableRowBehavior.java	Wed Mar 06 11:08:51 2013 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TreeTableRowBehavior.java	Thu Mar 07 12:03:41 2013 +1300
@@ -74,9 +74,6 @@
             // TreeTableCell, we should still support selection, so that
             // is what we are doing here.
             sm.select(treeItem);
-        } else if (clickCount % 2 == 0) {
-            // try to expand/collapse branch tree item
-            treeItem.setExpanded(! treeItem.isExpanded());
         }
     }
 }
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TableRowSkinBase.java	Wed Mar 06 11:08:51 2013 -0800
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TableRowSkinBase.java	Thu Mar 07 12:03:41 2013 +1300
@@ -683,23 +683,6 @@
     @Override protected double computePrefWidth(double height) {
         double prefWidth = 0.0F;
 
-        boolean isIndentationRequired = isIndentationRequired();
-        if (isIndentationRequired) {
-            // Do calculations for disclosure node and indentation.
-            // Firstly, indentation
-            int indentationLevel = getIndentationLevel(getSkinnable());
-            if (! isShowRoot()) indentationLevel--;
-            final double indentationPerLevel = getIndentationPerLevel();
-            prefWidth += indentationLevel * indentationPerLevel;
-
-            // Secondl, the disclosure node width
-            Control c = getVirtualFlowOwner();
-            final double defaultDisclosureWidth = 
-                maxDisclosureWidthMap.containsKey(c) ? maxDisclosureWidthMap.get(c) : 0;
-            Node disclosureNode = getDisclosureNode();
-            prefWidth += Math.max(defaultDisclosureWidth, disclosureNode == null ? 0 : disclosureNode.prefWidth(-1));
-        }
-
         List<? extends TableColumnBase/*<T,?>*/> visibleLeafColumns = getVisibleLeafColumns();
         for (int i = 0, max = visibleLeafColumns.size(); i < max; i++) {
             TableColumnBase<T,?> tableColumn = visibleLeafColumns.get(i);
--- a/javafx-ui-controls/src/javafx/scene/control/ListView.java	Wed Mar 06 11:08:51 2013 -0800
+++ b/javafx-ui-controls/src/javafx/scene/control/ListView.java	Thu Mar 07 12:03:41 2013 +1300
@@ -998,17 +998,32 @@
                 updateItemCount();
                 
                 while (c.next()) {
+                    final T selectedItem = getSelectedItem();
+                    final int selectedIndex = getSelectedIndex();
+                    
                     if (listView.getItems() == null || listView.getItems().isEmpty()) {
                         clearSelection();
-                    } else if (getSelectedIndex() == -1 && getSelectedItem() != null) {
-                        int newIndex = listView.getItems().indexOf(getSelectedItem());
+                    } else if (selectedIndex == -1 && selectedItem != null) {
+                        int newIndex = listView.getItems().indexOf(selectedItem);
                         if (newIndex != -1) {
                             setSelectedIndex(newIndex);
                         }
+                    } else if (c.wasRemoved() && 
+                            c.getRemovedSize() == 1 && 
+                            ! c.wasAdded() && 
+                            selectedItem != null && 
+                            selectedItem.equals(c.getRemoved().get(0))) {
+                        // Bug fix for RT-28637
+                        if (getSelectedIndex() < getItemCount()) {
+                            T newSelectedItem = getModelItem(selectedIndex);
+                            if (! selectedItem.equals(newSelectedItem)) {
+                                setSelectedItem(newSelectedItem);
+                            }
+                        }
                     }
-
-                    updateSelection(c);
                 }
+                
+                updateSelection(c);
             }
         };
         
--- a/javafx-ui-controls/src/javafx/scene/control/TableView.java	Wed Mar 06 11:08:51 2013 -0800
+++ b/javafx-ui-controls/src/javafx/scene/control/TableView.java	Thu Mar 07 12:03:41 2013 +1300
@@ -1265,6 +1265,8 @@
      */
     // package for testing
     static class TableViewArrayListSelectionModel<S> extends TableViewSelectionModel<S> {
+        
+        private int itemCount = 0;
 
         /***********************************************************************
          *                                                                     *
@@ -1276,6 +1278,8 @@
             super(tableView);
             this.tableView = tableView;
             
+            updateItemCount();
+            
             cellSelectionEnabledProperty().addListener(new InvalidationListener() {
                 @Override public void invalidated(Observable o) {
                     isCellSelectionEnabled();
@@ -1384,14 +1388,34 @@
 
         final ListChangeListener<S> itemsContentListener = new ListChangeListener<S>() {
             @Override public void onChanged(Change<? extends S> c) {
-                if (tableView.getItems() == null || tableView.getItems().isEmpty()) {
-                    clearSelection();
-                } else if (getSelectedIndex() == -1 && getSelectedItem() != null) {
-                    int newIndex = tableView.getItems().indexOf(getSelectedItem());
-                    if (newIndex != -1) {
-                        setSelectedIndex(newIndex);
+                updateItemCount();
+                
+                while (c.next()) {
+                    final S selectedItem = getSelectedItem();
+                    final int selectedIndex = getSelectedIndex();
+                    
+                    if (tableView.getItems() == null || tableView.getItems().isEmpty()) {
+                        clearSelection();
+                    } else if (getSelectedIndex() == -1 && getSelectedItem() != null) {
+                        int newIndex = tableView.getItems().indexOf(getSelectedItem());
+                        if (newIndex != -1) {
+                            setSelectedIndex(newIndex);
+                        }
+                    } else if (c.wasRemoved() && 
+                            c.getRemovedSize() == 1 && 
+                            ! c.wasAdded() && 
+                            selectedItem != null && 
+                            selectedItem.equals(c.getRemoved().get(0))) {
+                        // Bug fix for RT-28637
+                        if (getSelectedIndex() < getItemCount()) {
+                            S newSelectedItem = getModelItem(selectedIndex);
+                            if (! selectedItem.equals(newSelectedItem)) {
+                                setSelectedItem(newSelectedItem);
+                            }
+                        }
                     }
                 }
+                
                 updateSelection(c);
             }
         };
@@ -1408,6 +1432,8 @@
             if (newList != null) {
                 newList.addListener(weakItemsContentListener);
             }
+            
+            updateItemCount();
 
             // when the items list totally changes, we should clear out
             // the selection
@@ -1455,6 +1481,7 @@
         // changes we can update the selected indices list to refer to the 
         // new indices.
         private void updateSelection(ListChangeListener.Change<? extends S> c) {
+            c.reset();
             while (c.next()) {
                 if (c.wasReplaced()) {
                     if (c.getList().isEmpty()) {
@@ -1466,28 +1493,40 @@
                         if (previousModelSize == c.getRemovedSize()) {
                             // all items were removed from the model
                             clearSelection();
-                        } else if (index < getRowCount() && index >= 0) {
+                        } else if (index < getItemCount() && index >= 0) {
                             // Fix for RT-18969: the list had setAll called on it
+                            // Use of makeAtomic is a fix for RT-20945
+                            makeAtomic = true;
                             clearSelection(index);
+                            makeAtomic = false;
                             select(index);
                         } else {
                             // Fix for RT-22079
                             clearSelection();
                         }
                     }
-                    
-                    
                 } else if (c.wasAdded() || c.wasRemoved()) {
                     int position = c.getFrom();
                     int shift = c.wasAdded() ? c.getAddedSize() : -c.getRemovedSize();
                     
                     if (position < 0) return;
+                    if (shift == 0) return;
                     
                     List<TablePosition> newIndices = new ArrayList<TablePosition>(selectedCells.size());
         
                     for (int i = 0; i < selectedCells.size(); i++) {
-                        TablePosition old = selectedCells.get(i);
-                        int newRow = old.getRow() < position ? old.getRow() : old.getRow() + shift;
+                        final TablePosition old = selectedCells.get(i);
+                        final int oldRow = old.getRow();
+                        final int newRow = oldRow < position ? oldRow : oldRow + shift;
+                        
+                        // Special case for RT-28637 (See unit test in TableViewTest).
+                        // Essentially the selectedItem was correct, but selectedItems
+                        // was empty.
+                        if (oldRow == 0 && shift == -1) {
+                            newIndices.add(new TablePosition(getTableView(), 0, old.getTableColumn()));
+                            continue;
+                        }
+                        
                         if (newRow < 0) continue;
                         newIndices.add(new TablePosition(getTableView(), newRow, old.getTableColumn()));
                     }
@@ -1545,7 +1584,7 @@
                 }
             }
             
-            previousModelSize = getRowCount();
+            previousModelSize = getItemCount();
         }
 
         /***********************************************************************
@@ -1569,7 +1608,7 @@
 
         @Override
         public void select(int row, TableColumn<S,?> column) {
-            if (row < 0 || row >= getRowCount()) return;
+            if (row < 0 || row >= getItemCount()) return;
 
             // if I'm in cell selection mode but the column is null, I don't want
             // to select the whole row instead...
@@ -1598,7 +1637,7 @@
             // first occurrence of the given object. Once we find the first one, we
             // don't proceed to select any others.
             S rowObj = null;
-            for (int i = 0; i < getRowCount(); i++) {
+            for (int i = 0; i < getItemCount(); i++) {
                 rowObj = getModelItem(i);
                 if (rowObj == null) continue;
 
@@ -1634,7 +1673,7 @@
              * Performance optimisation - if multiple selection is disabled, only
              * process the end-most row index.
              */
-            int rowCount = getRowCount();
+            int rowCount = getItemCount();
 
             if (getSelectionMode() == SelectionMode.SINGLE) {
                 quietClearSelection();
@@ -1690,7 +1729,7 @@
                 TablePosition tp = null;
                 for (int col = 0; col < getTableView().getVisibleLeafColumns().size(); col++) {
                     column = getTableView().getVisibleLeafColumns().get(col);
-                    for (int row = 0; row < getRowCount(); row++) {
+                    for (int row = 0; row < getItemCount(); row++) {
                         tp = new TablePosition(getTableView(), row, column);
                         indices.add(tp);
                     }
@@ -1703,11 +1742,11 @@
                 }
             } else {
                 List<TablePosition> indices = new ArrayList<TablePosition>();
-                for (int i = 0; i < getRowCount(); i++) {
+                for (int i = 0; i < getItemCount(); i++) {
                     indices.add(new TablePosition(getTableView(), i, null));
                 }
                 selectedCells.setAll(indices);
-                select(getRowCount() - 1);
+                select(getItemCount() - 1);
                 focus(indices.get(indices.size() - 1));
             }
         }
@@ -1779,14 +1818,14 @@
                 if (pos.getColumn() - 1 >= 0) {
                     // go to previous row
                     select(pos.getRow(), getTableColumn(pos.getTableColumn(), -1));
-                } else if (pos.getRow() < getRowCount() - 1) {
+                } else if (pos.getRow() < getItemCount() - 1) {
                     // wrap to end of previous row
                     select(pos.getRow() - 1, getTableColumn(getTableView().getVisibleLeafColumns().size() - 1));
                 }
             } else {
                 int focusIndex = getFocusedIndex();
                 if (focusIndex == -1) {
-                    select(getRowCount() - 1);
+                    select(getItemCount() - 1);
                 } else if (focusIndex > 0) {
                     select(focusIndex - 1);
                 }
@@ -1801,7 +1840,7 @@
                 if (pos.getColumn() + 1 < getTableView().getVisibleLeafColumns().size()) {
                     // go to next column
                     select(pos.getRow(), getTableColumn(pos.getTableColumn(), 1));
-                } else if (pos.getRow() < getRowCount() - 1) {
+                } else if (pos.getRow() < getItemCount() - 1) {
                     // wrap to start of next row
                     select(pos.getRow() + 1, getTableColumn(0));
                 }
@@ -1809,7 +1848,7 @@
                 int focusIndex = getFocusedIndex();
                 if (focusIndex == -1) {
                     select(0);
-                } else if (focusIndex < getRowCount() -1) {
+                } else if (focusIndex < getItemCount() -1) {
                     select(focusIndex + 1);
                 }
             }
@@ -1818,7 +1857,7 @@
         @Override public void selectAboveCell() {
             TablePosition pos = getFocusedCell();
             if (pos.getRow() == -1) {
-                select(getRowCount() - 1);
+                select(getItemCount() - 1);
             } else if (pos.getRow() > 0) {
                 select(pos.getRow() - 1, pos.getTableColumn());
             }
@@ -1829,7 +1868,7 @@
 
             if (pos.getRow() == -1) {
                 select(0);
-            } else if (pos.getRow() < getRowCount() -1) {
+            } else if (pos.getRow() < getItemCount() -1) {
                 select(pos.getRow() + 1, pos.getTableColumn());
             }
         }
@@ -1841,7 +1880,7 @@
                 quietClearSelection();
             }
 
-            if (getRowCount() > 0) {
+            if (getItemCount() > 0) {
                 if (isCellSelectionEnabled()) {
                     select(0, focusedCell.getTableColumn());
                 } else {
@@ -1857,7 +1896,7 @@
                 quietClearSelection();
             }
 
-            int numItems = getRowCount();
+            int numItems = getItemCount();
             if (numItems > 0 && getSelectedIndex() < numItems - 1) {
                 if (isCellSelectionEnabled()) {
                     select(numItems - 1, focusedCell.getTableColumn());
@@ -1940,22 +1979,26 @@
             return getTableView().getFocusModel().getFocusedCell();
         }
 
-        private int getRowCount() {
-            List items = tableView.getItems();
-            return items == null ? -1 : items.size();
-        }
-        
         /** {@inheritDoc} */
         @Override protected int getItemCount() {
-            List items = tableView.getItems();
-            if (items == null) return -1;
-            return items.size();
+            return itemCount;
+//            List<S> items = tableView.getItems();
+//            return items == null ? -1 : items.size();
         }
 
         @Override protected S getModelItem(int index) {
-            if (index < 0 || index > getRowCount()) return null;
+            if (index < 0 || index > getItemCount()) return null;
             return tableView.getItems().get(index);
         }
+        
+        private void updateItemCount() {
+            if (tableView == null) {
+                itemCount = -1;
+            } else {
+                List<S> items = tableView.getItems();
+                itemCount = items == null ? -1 : items.size();
+            }
+        } 
     }
     
     
--- a/javafx-ui-controls/src/javafx/scene/control/TreeTableView.java	Wed Mar 06 11:08:51 2013 -0800
+++ b/javafx-ui-controls/src/javafx/scene/control/TreeTableView.java	Thu Mar 07 12:03:41 2013 +1300
@@ -1888,14 +1888,30 @@
                     // whilst we are here, we should check if the removed items
                     // are part of the selectedItems list - and remove them
                     // from selection if they are (as per RT-15446)
-                    List<Integer> indices = getSelectedIndices();
-                    for (int i = 0; i < indices.size() && ! getSelectedItems().isEmpty(); i++) {
-                        int index = indices.get(i);
-                        if (index > getSelectedItems().size()) break;
+                    final List<Integer> selectedIndices = getSelectedIndices();
+                    final int selectedIndex = getSelectedIndex();
+                    final List<TreeItem<S>> selectedItems = getSelectedItems();
+                    final TreeItem<S> selectedItem = getSelectedItem();
+                    final List<? extends TreeItem<S>> removedChildren = e.getRemovedChildren();
+                    
+                    for (int i = 0; i < selectedIndices.size() && ! selectedItems.isEmpty(); i++) {
+                        int index = selectedIndices.get(i);
+                        if (index > selectedItems.size()) break;
                         
-                        TreeItem<S> item = getSelectedItems().get(index);
-                        if (item == null || e.getRemovedChildren().contains(item)) {
+                        TreeItem<S> item = selectedItems.get(index);
+                        if (item == null || removedChildren.contains(item)) {
                             clearSelection(index);
+                        } else if (removedChildren.size() == 1 && 
+                                selectedItems.size() == 1 && 
+                                selectedItem != null && 
+                                selectedItem.equals(removedChildren.get(0))) {
+                            // Bug fix for RT-28637
+                            if (selectedIndex < getItemCount()) {
+                                TreeItem<S> newSelectedItem = getModelItem(selectedIndex);
+                                if (! selectedItem.equals(newSelectedItem)) {
+                                    setSelectedItem(newSelectedItem);
+                                }
+                            }
                         }
                     }
                 }
--- a/javafx-ui-controls/src/javafx/scene/control/TreeView.java	Wed Mar 06 11:08:51 2013 -0800
+++ b/javafx-ui-controls/src/javafx/scene/control/TreeView.java	Thu Mar 07 12:03:41 2013 +1300
@@ -989,14 +989,30 @@
                     // whilst we are here, we should check if the removed items
                     // are part of the selectedItems list - and remove them
                     // from selection if they are (as per RT-15446)
-                    List<Integer> indices = getSelectedIndices();
-                    for (int i = 0; i < indices.size() && ! getSelectedItems().isEmpty(); i++) {
-                        int index = indices.get(i);
-                        if (index > getSelectedItems().size()) break;
+                    final List<Integer> selectedIndices = getSelectedIndices();
+                    final int selectedIndex = getSelectedIndex();
+                    final List<TreeItem<T>> selectedItems = getSelectedItems();
+                    final TreeItem<T> selectedItem = getSelectedItem();
+                    final List<? extends TreeItem<T>> removedChildren = e.getRemovedChildren();
+                    
+                    for (int i = 0; i < selectedIndices.size() && ! selectedItems.isEmpty(); i++) {
+                        int index = selectedIndices.get(i);
+                        if (index > selectedItems.size()) break;
                         
-                        TreeItem<T> item = getSelectedItems().get(index);
-                        if (item == null || e.getRemovedChildren().contains(item)) {
+                        TreeItem<T> item = selectedItems.get(index);
+                        if (item == null || removedChildren.contains(item)) {
                             clearSelection(index);
+                        } else if (removedChildren.size() == 1 && 
+                                selectedItems.size() == 1 && 
+                                selectedItem != null && 
+                                selectedItem.equals(removedChildren.get(0))) {
+                            // Bug fix for RT-28637
+                            if (selectedIndex < getItemCount()) {
+                                TreeItem<T> newSelectedItem = getModelItem(selectedIndex);
+                                if (! selectedItem.equals(newSelectedItem)) {
+                                    setSelectedItem(newSelectedItem);
+                                }
+                            }
                         }
                     }
                 }
--- a/javafx-ui-controls/test/com/sun/javafx/scene/control/test/ControlAsserts.java	Wed Mar 06 11:08:51 2013 -0800
+++ b/javafx-ui-controls/test/com/sun/javafx/scene/control/test/ControlAsserts.java	Thu Mar 07 12:03:41 2013 +1300
@@ -51,12 +51,15 @@
     }
     
     public static void assertCellEmpty(IndexedCell cell) {
-        assertNull("Expected null, found '" + cell.getText() + "'", cell.getText());
+        final String text = cell.getText();
+//        System.out.println("assertCellEmpty: " + cell.getIndex() + " : " + text);
+        assertTrue("Expected null, found '" + text + "'", text == null || text.isEmpty());
     }
     
     public static void assertCellNotEmpty(IndexedCell cell) {
-        assertNotNull("Expected a non-null, found '" + cell.getText() + "'", cell.getText());
-        assertFalse(cell.getText().isEmpty());
+        final String text = cell.getText();
+//        System.out.println("assertCellNotEmpty: " + cell.getIndex() + " : " + text);
+        assertTrue("Expected a non-null, found '" + text + "'", text != null && ! text.isEmpty());
     }
     
     private static void assertRows(final Control control, final int startRow, final int endRow, final boolean expectEmpty) {
@@ -76,7 +79,7 @@
                         assertCellNotEmpty(childCell);
                     }
                 }
-
+                
                 if (! hasChildrenCell) {
                     if (expectEmpty) {
                         assertCellEmpty(indexedCell);
@@ -160,30 +163,42 @@
     }
     
     public static void assertCallback(final Control control, final int startRow, final int endRow, final Callback<IndexedCell<?>, Void> callback) {
-        Group group = new Group();
-        Scene scene = new Scene(group);
+        VirtualFlow<?> flow = getVirtualFlow(control);
         
-        Stage stage = new Stage();
-        stage.setScene(scene);
+//        Region clippedContainer = (Region) flow.getChildrenUnmodifiable().get(0);
+//        Group sheet = (Group) clippedContainer.getChildrenUnmodifiable().get(0);
         
-        group.getChildren().setAll(control);
-        stage.show();
-        
-        Toolkit.getToolkit().firePulse();
-        
-        VirtualFlow<?> flow = (VirtualFlow<?>)control.lookup("#virtual-flow");
-        
-        Region clippedContainer = (Region) flow.getChildrenUnmodifiable().get(0);
-        Group sheet = (Group) clippedContainer.getChildrenUnmodifiable().get(0);
-        
-        final int sheetSize = sheet.getChildren().size();
+//        final int sheetSize = sheet.getChildren().size();
+        final int sheetSize = flow.getCellCount();
         final int end = endRow == -1 ? sheetSize : Math.min(endRow, sheetSize);
         for (int row = startRow; row < end; row++) {
             // old approach:
             // callback.call((IndexedCell<?>)sheet.getChildren().get(row));
             
             // new approach:
-            callback.call(flow.getCell(row));
+            IndexedCell cell = flow.getCell(row);
+//            System.out.println("cell index: " + cell.getIndex());
+            callback.call(cell);
         }
     }
+    
+    public static void assertCellCount(final Control control, final int expected) {
+        assertEquals(getVirtualFlow(control).getCellCount(), expected);
+    }
+    
+    private static VirtualFlow<?> getVirtualFlow(final Control control) {
+        Group group = new Group();
+        Scene scene = new Scene(group);
+
+        Stage stage = new Stage();
+        stage.setScene(scene);
+
+        group.getChildren().setAll(control);
+        stage.show();
+
+        Toolkit.getToolkit().firePulse();
+
+        VirtualFlow<?> flow = (VirtualFlow<?>)control.lookup("#virtual-flow");
+        return flow;
+    }
 }
--- a/javafx-ui-controls/test/javafx/scene/control/ListViewTest.java	Wed Mar 06 11:08:51 2013 -0800
+++ b/javafx-ui-controls/test/javafx/scene/control/ListViewTest.java	Thu Mar 07 12:03:41 2013 +1300
@@ -30,7 +30,6 @@
 import com.sun.javafx.scene.control.test.ControlAsserts;
 import com.sun.javafx.scene.control.test.Person;
 import com.sun.javafx.scene.control.test.RT_22463_Person;
-import com.sun.javafx.tk.Toolkit;
 import static javafx.scene.control.ControlTestUtils.assertStyleClassContains;
 import static org.junit.Assert.*;
 import java.util.Arrays;
@@ -41,10 +40,6 @@
 import javafx.beans.value.ObservableValue;
 import javafx.collections.FXCollections;
 import javafx.collections.ObservableList;
-import javafx.scene.Group;
-import javafx.scene.Scene;
-import javafx.scene.layout.Region;
-import javafx.stage.Stage;
 
 import org.junit.Before;
 import org.junit.Ignore;
@@ -364,16 +359,16 @@
         assertEquals(2, sm.getSelectedIndices().size());
     }
     
-    private int hitCount = 0;
+    private int rt_18969_hitCount = 0;
     @Test public void test_rt18969() {
-        hitCount = 0;
+        rt_18969_hitCount = 0;
         ObservableList<String> emptyModel = FXCollections.observableArrayList();
         listView.setItems(emptyModel);
         assertTrue(listView.getItems().isEmpty());
         
         sm.selectedItemProperty().addListener(new ChangeListener<String>() {
             @Override public void changed(ObservableValue<? extends String> observable, String oldValue, final String newValue) {
-                hitCount++;
+                rt_18969_hitCount++;
             }
         });
         
@@ -383,7 +378,7 @@
         
         sm.select(0);
         assertTrue(sm.isSelected(0));
-        assertEquals(1, hitCount);
+        assertEquals(1, rt_18969_hitCount);
         
         // sleep for 100ms so that the currentTimeMillis is guaranteed to be
         // a different value than the first one
@@ -401,7 +396,7 @@
         
         // it should be two, as there is no null event in between (although there
         // used to be, so the test used to be for three hits)
-        assertEquals(2, hitCount);
+        assertEquals(2, rt_18969_hitCount);
     }
     
     @Test public void test_rt21586() {
@@ -487,7 +482,6 @@
         ControlAsserts.assertCellTextEquals(list, 1, "updated name2");
     }
     
-    @Ignore
     @Test public void test_rt28637() {
         ObservableList<String> items = FXCollections.observableArrayList("String1", "String2", "String3", "String4");
         
@@ -504,4 +498,34 @@
         assertEquals("String2", listView.getSelectionModel().getSelectedItems().get(0));
         assertEquals(0, listView.getSelectionModel().getSelectedIndex());
     }
+    
+    @Test public void test_rt28819_1() {
+        ObservableList<String> emptyModel = FXCollections.observableArrayList();
+        
+        final ListView<String> listView = new ListView<String>();
+        listView.setItems(emptyModel);
+        ControlAsserts.assertRowsEmpty(listView, 0, 5);
+        
+        ObservableList<String> mod = FXCollections.observableArrayList();
+        String value = System.currentTimeMillis()+"";
+        mod.add(value);
+        listView.setItems(mod);
+        ControlAsserts.assertCellCount(listView, 1);
+        ControlAsserts.assertCellTextEquals(listView, 0, value);
+    }
+    
+    @Test public void test_rt28819_2() {
+        ObservableList<String> emptyModel = FXCollections.observableArrayList();
+        
+        final ListView<String> listView = new ListView<String>();
+        listView.setItems(emptyModel);
+        ControlAsserts.assertRowsEmpty(listView, 0, 5);
+        
+        ObservableList<String> mod1 = FXCollections.observableArrayList();
+        String value1 = System.currentTimeMillis()+"";
+        mod1.add(value1);
+        listView.getItems().setAll(mod1);
+        ControlAsserts.assertCellCount(listView, 1);
+        ControlAsserts.assertCellTextEquals(listView, 0, value1);
+    }
 }
--- a/javafx-ui-controls/test/javafx/scene/control/TableViewTest.java	Wed Mar 06 11:08:51 2013 -0800
+++ b/javafx-ui-controls/test/javafx/scene/control/TableViewTest.java	Thu Mar 07 12:03:41 2013 +1300
@@ -542,21 +542,23 @@
         ControlAsserts.assertCellTextEquals(table, 1, "2", "updated name2");
     }
     
-    @Ignore
     @Test public void test_rt28637() {
         ObservableList<String> items = FXCollections.observableArrayList("String1", "String2", "String3", "String4");
         
         final TableView<String> tableView = new TableView<String>();
+        final MultipleSelectionModel sm = tableView.getSelectionModel();
         tableView.setItems(items);
         
         tableView.getSelectionModel().select(0);
-        assertEquals("String1", tableView.getSelectionModel().getSelectedItem());
-        assertEquals("String1", tableView.getSelectionModel().getSelectedItems().get(0));
-        assertEquals(0, tableView.getSelectionModel().getSelectedIndex());
+        assertEquals("String1", sm.getSelectedItem());
+        assertEquals(1, sm.getSelectedItems().size());
+        assertEquals("String1", sm.getSelectedItems().get(0));
+        assertEquals(0, sm.getSelectedIndex());
         
-        items.remove(tableView.getSelectionModel().getSelectedItem());
-        assertEquals("String2", tableView.getSelectionModel().getSelectedItem());
-        assertEquals("String2", tableView.getSelectionModel().getSelectedItems().get(0));
-        assertEquals(0, tableView.getSelectionModel().getSelectedIndex());
+        items.remove(sm.getSelectedItem());
+        assertEquals("String2", sm.getSelectedItem());
+        assertEquals(1, sm.getSelectedItems().size());
+        assertEquals("String2", sm.getSelectedItems().get(0));
+        assertEquals(0, sm.getSelectedIndex());
     }
 }
--- a/javafx-ui-controls/test/javafx/scene/control/TreeTableViewTest.java	Wed Mar 06 11:08:51 2013 -0800
+++ b/javafx-ui-controls/test/javafx/scene/control/TreeTableViewTest.java	Thu Mar 07 12:03:41 2013 +1300
@@ -992,7 +992,6 @@
         ControlAsserts.assertCellTextEquals(table, 2, "2", "updated name2");
     }
     
-    @Ignore
     @Test public void test_rt28637() {
         TreeItem<String> s1, s2, s3, s4;
         ObservableList<TreeItem<String>> items = FXCollections.observableArrayList(
@@ -1006,16 +1005,17 @@
         TreeItem<String> root = new TreeItem<String>("Root");
         root.setExpanded(true);
         treeTableView.setRoot(root);
+        treeTableView.setShowRoot(false);
         root.getChildren().addAll(items);
         
         treeTableView.getSelectionModel().select(0);
-        assertEquals(root, treeTableView.getSelectionModel().getSelectedItem());
-        assertEquals(root, treeTableView.getSelectionModel().getSelectedItems().get(0));
+        assertEquals((Object)s1, treeTableView.getSelectionModel().getSelectedItem());
+        assertEquals((Object)s1, treeTableView.getSelectionModel().getSelectedItems().get(0));
         assertEquals(0, treeTableView.getSelectionModel().getSelectedIndex());
         
-        items.remove(treeTableView.getSelectionModel().getSelectedItem());
-        assertEquals(s1, treeTableView.getSelectionModel().getSelectedItem());
-        assertEquals(s1, treeTableView.getSelectionModel().getSelectedItems().get(0));
+        root.getChildren().remove(treeTableView.getSelectionModel().getSelectedItem());
+        assertEquals((Object)s2, treeTableView.getSelectionModel().getSelectedItem());
+        assertEquals((Object)s2, treeTableView.getSelectionModel().getSelectedItems().get(0));
         assertEquals(0, treeTableView.getSelectionModel().getSelectedIndex());
     }
 }
--- a/javafx-ui-controls/test/javafx/scene/control/TreeViewTest.java	Wed Mar 06 11:08:51 2013 -0800
+++ b/javafx-ui-controls/test/javafx/scene/control/TreeViewTest.java	Thu Mar 07 12:03:41 2013 +1300
@@ -764,7 +764,6 @@
         ControlAsserts.assertCellTextEquals(tree, 2, "updated name2");
     }
     
-    @Ignore
     @Test public void test_rt28637() {
         TreeItem<String> s1, s2, s3, s4;
         ObservableList<TreeItem<String>> items = FXCollections.observableArrayList(
@@ -778,16 +777,17 @@
         TreeItem<String> root = new TreeItem<String>("Root");
         root.setExpanded(true);
         treeView.setRoot(root);
+        treeView.setShowRoot(false);
         root.getChildren().addAll(items);
         
         treeView.getSelectionModel().select(0);
-        assertEquals(root, treeView.getSelectionModel().getSelectedItem());
-        assertEquals(root, treeView.getSelectionModel().getSelectedItems().get(0));
+        assertEquals((Object)s1, treeView.getSelectionModel().getSelectedItem());
+        assertEquals((Object)s1, treeView.getSelectionModel().getSelectedItems().get(0));
         assertEquals(0, treeView.getSelectionModel().getSelectedIndex());
         
-        items.remove(treeView.getSelectionModel().getSelectedItem());
-        assertEquals(s1, treeView.getSelectionModel().getSelectedItem());
-        assertEquals(s1, treeView.getSelectionModel().getSelectedItems().get(0));
+        root.getChildren().remove(treeView.getSelectionModel().getSelectedItem());
+        assertEquals((Object)s2, treeView.getSelectionModel().getSelectedItem());
+        assertEquals((Object)s2, treeView.getSelectionModel().getSelectedItems().get(0));
         assertEquals(0, treeView.getSelectionModel().getSelectedIndex());
     }
 }