< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTreeUI.java

Print this page




2346         if(tree.getInvokesStopCellEditing() &&
2347            stopEditingInCompleteEditing && editingComponent != null) {
2348             cellEditor.stopCellEditing();
2349         }
2350         /* Invoke cancelCellEditing, this will do nothing if stopCellEditing
2351            was successful. */
2352         completeEditing(false, true, false);
2353     }
2354 
2355     /**
2356      * Stops the editing session. If {@code messageStop} is {@code true} the editor
2357      * is messaged with {@code stopEditing}, if {@code messageCancel}
2358      * is {@code true} the editor is messaged with {@code cancelEditing}.
2359      * If {@code messageTree} is {@code true} the {@code treeModel} is messaged
2360      * with {@code valueForPathChanged}.
2361      *
2362      * @param messageStop message to stop editing
2363      * @param messageCancel message to cancel editing
2364      * @param messageTree message to tree
2365      */

2366     protected void completeEditing(boolean messageStop,
2367                                    boolean messageCancel,
2368                                    boolean messageTree) {
2369         if(stopEditingInCompleteEditing && editingComponent != null) {
2370             Component             oldComponent = editingComponent;
2371             TreePath              oldPath = editingPath;
2372             TreeCellEditor        oldEditor = cellEditor;
2373             Object                newValue = oldEditor.getCellEditorValue();
2374             Rectangle             editingBounds = getPathBounds(tree,
2375                                                                 editingPath);
2376             boolean               requestFocus = (tree != null &&
2377                                    (tree.hasFocus() || SwingUtilities.
2378                                     findFocusOwner(editingComponent) != null));
2379 
2380             editingComponent = null;
2381             editingPath = null;
2382             if(messageStop)
2383                 oldEditor.stopCellEditing();
2384             else if(messageCancel)
2385                 oldEditor.cancelCellEditing();




2346         if(tree.getInvokesStopCellEditing() &&
2347            stopEditingInCompleteEditing && editingComponent != null) {
2348             cellEditor.stopCellEditing();
2349         }
2350         /* Invoke cancelCellEditing, this will do nothing if stopCellEditing
2351            was successful. */
2352         completeEditing(false, true, false);
2353     }
2354 
2355     /**
2356      * Stops the editing session. If {@code messageStop} is {@code true} the editor
2357      * is messaged with {@code stopEditing}, if {@code messageCancel}
2358      * is {@code true} the editor is messaged with {@code cancelEditing}.
2359      * If {@code messageTree} is {@code true} the {@code treeModel} is messaged
2360      * with {@code valueForPathChanged}.
2361      *
2362      * @param messageStop message to stop editing
2363      * @param messageCancel message to cancel editing
2364      * @param messageTree message to tree
2365      */
2366     @SuppressWarnings("deprecation")
2367     protected void completeEditing(boolean messageStop,
2368                                    boolean messageCancel,
2369                                    boolean messageTree) {
2370         if(stopEditingInCompleteEditing && editingComponent != null) {
2371             Component             oldComponent = editingComponent;
2372             TreePath              oldPath = editingPath;
2373             TreeCellEditor        oldEditor = cellEditor;
2374             Object                newValue = oldEditor.getCellEditorValue();
2375             Rectangle             editingBounds = getPathBounds(tree,
2376                                                                 editingPath);
2377             boolean               requestFocus = (tree != null &&
2378                                    (tree.hasFocus() || SwingUtilities.
2379                                     findFocusOwner(editingComponent) != null));
2380 
2381             editingComponent = null;
2382             editingPath = null;
2383             if(messageStop)
2384                 oldEditor.stopCellEditing();
2385             else if(messageCancel)
2386                 oldEditor.cancelCellEditing();


< prev index next >