public void mouseDragged (MouseEvent e) { Point p = e.getPoint (); boolean b = checkContinueTimer (p); if (!b) abortTimer (); }
/** Implements <code>FocusListener</code> interface method. */ public void focusLost(FocusEvent evt) { if (evt.getSource() == tree) { // stop timer if tree lost focus (#153009) abortTimer(); return; } if (stopped || cancelled) { return; } if (!stopCellEditing()) { cancelCellEditing(); } }
/** Implements <code>FocusListener</code> interface method. */ public void focusLost (java.awt.event.FocusEvent evt) { if (stopped || cancelled) return; if (!stopCellEditing()) cancelCellEditing(); }
public void dragGestureRecognized (DragGestureEvent dge) { super.dragGestureRecognized (dge); // notify tree cell editor that DnD operationm is active if (exDnD.isDnDActive ()) { TreeCellEditor tce = ((JTree)tree).getCellEditor (); if (tce instanceof TreeViewCellEditor) ((TreeViewCellEditor)tce).setDnDActive (true); } }
@Override protected void prepareForEditing() { abortTimer(); tree.removeMouseMotionListener(this); super.prepareForEditing(); }
/** Overrides superclass method. If the source is a <code>JTextField</code>, * i.e. cell editor, it cancels editing, otherwise it calls superclass method. */ public void actionPerformed(ActionEvent evt) { if(evt.getSource() instanceof JTextField) { cancelled = true; cancelCellEditing(); } else { super.actionPerformed(evt); } }
/** Construct a cell editor. * @param tree the tree */ public TreeViewCellEditor(JTree tree) { //Use a dummy DefaultTreeCellEditor - we'll set up the correct //icon when we fetch the editor component (see EOF). Not sure //it's wildly vaulable to subclass DefaultTreeCellEditor here - //we override most everything super(tree, new DefaultTreeCellRenderer()); // deal with selection if already exists if (tree.getSelectionCount() == 1) { lastPath = tree.getSelectionPath(); } addCellEditorListener(this); }
/** Implements <code>CellEditorListener</code> interface method. */ public void editingStopped(ChangeEvent e) { //CellEditor sometimes(probably after stopCellEditing() call) gains one focus but loses two if (stopped) { return; } stopped = true; TreePath lastP = lastPath; if (lastP != null) { Node n = Visualizer.findNode(lastP.getLastPathComponent()); if ((n != null) && n.canRename()) { String newStr = (String) getCellEditorValue(); ViewUtil.nodeRename(n, newStr); } } }
tree.setCellEditor(new TreeViewCellEditor(tree)); tree.setEditable(true); tree.setInvokesStopCellEditing(true);
@Override public void dragGestureRecognized(DragGestureEvent dge) { super.dragGestureRecognized(dge); // notify tree cell editor that DnD operationm is active if (exDnD.isDnDActive()) { TreeCellEditor tce = tree.getCellEditor(); if (tce instanceof TreeViewCellEditor) { ((TreeViewCellEditor) tce).setDnDActive(true); } } }
/** Implements <code>FocusListener</code> interface method. */ public void focusLost (java.awt.event.FocusEvent evt) { if (stopped || cancelled) return; if (!stopCellEditing()) cancelCellEditing(); }
protected void prepareForEditing () { abortTimer(); tree.removeMouseMotionListener (this); super.prepareForEditing (); }
/** Overrides superclass method. If the source is a <code>JTextField</code>, * i.e. cell editor, it cancels editing, otherwise it calls superclass method. */ @Override public void actionPerformed(ActionEvent evt) { if (evt.getSource() instanceof JTextField) { cancelled = true; cancelCellEditing(); } else { super.actionPerformed(evt); } }
/** Construct a cell editor. * @param tree the tree */ public TreeViewCellEditor(JTree tree) { //Use a dummy DefaultTreeCellEditor - we'll set up the correct //icon when we fetch the editor component (see EOF). Not sure //it's wildly vaulable to subclass DefaultTreeCellEditor here - //we override most everything super(tree, new DefaultTreeCellRenderer()); // deal with selection if already exists if (tree.getSelectionCount() == 1) { lastPath = tree.getSelectionPath(); } addCellEditorListener(this); }
Node n = Visualizer.findNode (lastP.getLastPathComponent()); if (n != null && n.canRename ()) { String newStr = (String) getCellEditorValue(); try {
tree.setCellEditor(new TreeViewCellEditor(tree)); tree.setEditable(true);
public void mouseMoved(MouseEvent e) { Point p = e.getPoint(); boolean b = checkContinueTimer(p); if (!b) { abortTimer(); } }
public void dragGestureRecognized (DragGestureEvent dge) { super.dragGestureRecognized (dge); // notify tree cell editor that DnD operationm is active if (exDnD.isDnDActive ()) { TreeCellEditor tce = ((JTree)tree).getCellEditor (); if (tce instanceof TreeViewCellEditor) ((TreeViewCellEditor)tce).setDnDActive (true); } }
protected void prepareForEditing () { abortTimer(); tree.removeMouseMotionListener (this); super.prepareForEditing (); }
/** Overrides superclass method. If the source is a <code>JTextField</code>, * i.e. cell editor, it cancels editing, otherwise it calls superclass method. */ public void actionPerformed(ActionEvent evt) { if(evt.getSource() instanceof JTextField) { cancelled = true; cancelCellEditing(); } else { super.actionPerformed(evt); } }