/** * {@inheritDoc} <p> * Overridden to fix focus issues with editors. * This method installs and updates the internal CellEditorRemover which * terminates ongoing edits if appropriate. Additionally, it * registers a CellEditorListener with the cell editor to grab the * focus back to tree, if appropriate. * * @see #updateEditorRemover() */ @Override public void startEditingAtPath(TreePath path) { super.startEditingAtPath(path); if (isEditing()) { updateEditorListener(); updateEditorRemover(); } }
/** * {@inheritDoc} <p> * Overridden to fix focus issues with editors. * This method installs and updates the internal CellEditorRemover which * terminates ongoing edits if appropriate. Additionally, it * registers a CellEditorListener with the cell editor to grab the * focus back to tree, if appropriate. * * @see #updateEditorRemover() */ @Override public void startEditingAtPath(TreePath path) { super.startEditingAtPath(path); if (isEditing()) { updateEditorListener(); updateEditorRemover(); } }
/** * {@inheritDoc} <p> * Overridden to fix focus issues with editors. * This method installs and updates the internal CellEditorRemover which * terminates ongoing edits if appropriate. Additionally, it * registers a CellEditorListener with the cell editor to grab the * focus back to tree, if appropriate. * * @see #updateEditorRemover() */ @Override public void startEditingAtPath(TreePath path) { super.startEditingAtPath(path); if (isEditing()) { updateEditorListener(); updateEditorRemover(); } }
/** * {@inheritDoc} <p> * Overridden to fix focus issues with editors. * This method installs and updates the internal CellEditorRemover which * terminates ongoing edits if appropriate. Additionally, it * registers a CellEditorListener with the cell editor to grab the * focus back to tree, if appropriate. * * @see #updateEditorRemover() */ @Override public void startEditingAtPath(TreePath path) { super.startEditingAtPath(path); if (isEditing()) { updateEditorListener(); updateEditorRemover(); } }
/** * {@inheritDoc} <p> * Overridden to fix focus issues with editors. * This method installs and updates the internal CellEditorRemover which * terminates ongoing edits if appropriate. Additionally, it * registers a CellEditorListener with the cell editor to grab the * focus back to tree, if appropriate. * * @see #updateEditorRemover() */ @Override public void startEditingAtPath(TreePath path) { super.startEditingAtPath(path); if (isEditing()) { updateEditorListener(); updateEditorRemover(); } }
public void propertyChange(PropertyChangeEvent ev) { if (!isEditing()) { return; } Component c = focusManager.getPermanentFocusOwner(); JXTree tree = JXTree.this; while (c != null) { if (c instanceof JPopupMenu) { c = ((JPopupMenu) c).getInvoker(); } else { if (c == tree) { // focus remains inside the table return; } else if ((c instanceof Window) || (c instanceof Applet && c.getParent() == null)) { if (c == SwingUtilities.getRoot(tree)) { if (tree.getInvokesStopCellEditing()) { tree.stopEditing(); } if (tree.isEditing()) { tree.cancelEditing(); } } break; } c = c.getParent(); } } } }
/** * Returns a boolean to indicate if the current focus owner * is descending from this table. * Returns false if not editing, otherwise walks the focusOwner * hierarchy, taking popups into account. <p> * * PENDING: copied from JXTable ... should be somewhere in a utility * class? * * @return a boolean to indicate if the current focus * owner is contained. */ private boolean isFocusOwnerDescending() { if (!isEditing()) return false; Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); // PENDING JW: special casing to not fall through ... really wanted? if (focusOwner == null) return false; if (SwingXUtilities.isDescendingFrom(focusOwner, this)) return true; // same with permanent focus owner Component permanent = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner(); return SwingXUtilities.isDescendingFrom(permanent, this); }
/** * Returns a boolean to indicate if the current focus owner * is descending from this table. * Returns false if not editing, otherwise walks the focusOwner * hierarchy, taking popups into account. <p> * * PENDING: copied from JXTable ... should be somewhere in a utility * class? * * @return a boolean to indicate if the current focus * owner is contained. */ private boolean isFocusOwnerDescending() { if (!isEditing()) return false; Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); // PENDING JW: special casing to not fall through ... really wanted? if (focusOwner == null) return false; if (SwingXUtilities.isDescendingFrom(focusOwner, this)) return true; // same with permanent focus owner Component permanent = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner(); return SwingXUtilities.isDescendingFrom(permanent, this); }
/** * Returns a boolean to indicate if the current focus owner * is descending from this table. * Returns false if not editing, otherwise walks the focusOwner * hierarchy, taking popups into account. <p> * * PENDING: copied from JXTable ... should be somewhere in a utility * class? * * @return a boolean to indicate if the current focus * owner is contained. */ private boolean isFocusOwnerDescending() { if (!isEditing()) return false; Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); // PENDING JW: special casing to not fall through ... really wanted? if (focusOwner == null) return false; if (SwingXUtilities.isDescendingFrom(focusOwner, this)) return true; // same with permanent focus owner Component permanent = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner(); return SwingXUtilities.isDescendingFrom(permanent, this); }
/** * Returns a boolean to indicate if the current focus owner * is descending from this table. * Returns false if not editing, otherwise walks the focusOwner * hierarchy, taking popups into account. <p> * * PENDING: copied from JXTable ... should be somewhere in a utility * class? * * @return a boolean to indicate if the current focus * owner is contained. */ private boolean isFocusOwnerDescending() { if (!isEditing()) return false; Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); // PENDING JW: special casing to not fall through ... really wanted? if (focusOwner == null) return false; if (SwingXUtilities.isDescendingFrom(focusOwner, this)) return true; // same with permanent focus owner Component permanent = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner(); return SwingXUtilities.isDescendingFrom(permanent, this); }
/** * Returns a boolean to indicate if the current focus owner * is descending from this table. * Returns false if not editing, otherwise walks the focusOwner * hierarchy, taking popups into account. <p> * * PENDING: copied from JXTable ... should be somewhere in a utility * class? * * @return a boolean to indicate if the current focus * owner is contained. */ private boolean isFocusOwnerDescending() { if (!isEditing()) return false; Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); // PENDING JW: special casing to not fall through ... really wanted? if (focusOwner == null) return false; if (SwingXUtilities.isDescendingFrom(focusOwner, this)) return true; // same with permanent focus owner Component permanent = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner(); return SwingXUtilities.isDescendingFrom(permanent, this); }
tree.stopEditing(); if (tree.isEditing()) { tree.cancelEditing();