changeset 2220:cd08af7a4726

RT-27585: [TreeTableView] Changes in editable cell are not commited.
author jgiles
date Fri, 11 Jan 2013 10:30:20 +1300
parents 98a7bfe0f231
children 4782520f95c7
files javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TreeTableRowBehavior.java
diffstat 1 files changed, 5 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TreeTableRowBehavior.java	Fri Jan 11 09:21:46 2013 +1300
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TreeTableRowBehavior.java	Fri Jan 11 10:30:20 2013 +1300
@@ -44,15 +44,12 @@
     @Override public void mouseReleased(MouseEvent e) {
         super.mouseReleased(e);
         
+        if (e.getButton() != MouseButton.PRIMARY) return;
+        
         TreeTableRow<T> treeTableRow = getControl();
-        TreeTableView<T> tv = treeTableRow.getTreeTableView();
         TreeItem treeItem = treeTableRow.getTreeItem();
         if (treeItem == null) return;
         
-        int index = treeTableRow.getIndex();
-        MultipleSelectionModel sm = tv.getSelectionModel();
-        boolean isAlreadySelected = sm.isSelected(index);
-
         // if the user has clicked on the disclosure node, we do nothing other
         // than expand/collapse the tree item (if applicable). We do not do editing!
         Node disclosureNode = treeTableRow.getDisclosureNode();
@@ -63,24 +60,10 @@
             }
         }
         
-        tv.getSelectionModel().clearAndSelect(index);
-
         // handle editing, which only occurs with the primary mouse button
-        if (e.getButton() == MouseButton.PRIMARY) {
-            if (e.getClickCount() == 1 && isAlreadySelected) {
-                tv.edit(treeItem);
-            } else if (e.getClickCount() == 1) {
-                // cancel editing
-                tv.edit(null);
-            } else if (e.getClickCount() == 2/* && ! getControl().isEditable()*/) {
-                if (treeItem.isLeaf()) {
-                    // attempt to edit
-                    tv.edit(treeItem);
-                } else {
-                    // try to expand/collapse branch tree item
-                    treeItem.setExpanded(! treeItem.isExpanded());
-                }
-            }
+        if (e.getClickCount() == 2) {
+            // try to expand/collapse branch tree item
+            treeItem.setExpanded(! treeItem.isExpanded());
         }
     }
 }