/** Create the name property for a node. * @param node the node * @param propName name of the "name" property * @param hint hint message for the "name" property */ public Name(final Node node, final String propName, final String hint) { super(Node.PROP_NAME, String.class, propName, hint, true, node.canRename()); this.node = node; }
public boolean canRename() { return original.canRename(); }
/** Create the name property for a node. * @param node the node * @param propName name of the "name" property * @param hint hint message for the "name" property */ public Name (final Node node, final String propName, final String hint) { super(Node.PROP_NAME, String.class, propName, hint, true, node.canRename()); this.node = node; }
protected boolean enable (Node[] activatedNodes) { // exactly one node should be selected if ((activatedNodes == null) || (activatedNodes.length != 1)) return false; // and must support renaming return activatedNodes[0].canRename(); }
protected boolean enable (Node[] activatedNodes) { // exactly one node should be selected if ((activatedNodes == null) || (activatedNodes.length != 1)) return false; // and must support renaming return activatedNodes[0].canRename(); }
/** Create the name property for a node. * @param node the node * @param propName name of the "name" property * @param hint hint message for the "name" property */ public Name (final Node node, final String propName, final String hint) { super(Node.PROP_NAME, String.class, propName, hint, true, node.canRename()); this.node = node; }
public boolean canRename () { return original.canRename (); }
public boolean canRename () { return original.canRename (); }
@Override public boolean isCellEditable(int rowIndex, int columnIndex) { if (columnIndex == 0) { Node treeNode = getNodeAt(rowIndex); return null != treeNode && treeNode.canRename(); } return super.isCellEditable(rowIndex, columnIndex); }
/** 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); } } }
/** Implements <code>CellEditorListener</code> interface method. */ public void editingStopped(ChangeEvent e) { TreePath lastP = tree.getPathForRow(lastRow); if (lastP != null) { Node n = Visualizer.findNode(lastP.getLastPathComponent()); if ((n != null) && n.canRename()) { String newStr = (String) getCellEditorValue(); ViewUtil.nodeRename(n, newStr); } } }
public boolean isCellEditable(EventObject event) { if ((event != null) && (event instanceof MouseEvent)) { if (!SwingUtilities.isLeftMouseButton((MouseEvent)event) || ((MouseEvent)event).isPopupTrigger()) { return false; } } if (lastPath != null) { Node n = Visualizer.findNode (lastPath.getLastPathComponent()); if (n == null || !n.canRename ()) { return false; } } else { // Disallow rename when multiple nodes are selected return false; } // disallow editing if we are in DnD operation if (dndActive) { return false; } return super.isCellEditable(event); }
public boolean isCellEditable(EventObject event) { if ((event != null) && (event instanceof MouseEvent)) { if (!SwingUtilities.isLeftMouseButton((MouseEvent)event) || ((MouseEvent)event).isPopupTrigger()) { return false; } } if (lastPath != null) { Node n = Visualizer.findNode (lastPath.getLastPathComponent()); if (n == null || !n.canRename ()) { return false; } } else { // Disallow rename when multiple nodes are selected return false; } // disallow editing if we are in DnD operation if (dndActive) { return false; } return super.isCellEditable(event); }
@Override public boolean isCellEditable(EventObject event) { if ((event != null) && (event instanceof MouseEvent)) { if (!SwingUtilities.isLeftMouseButton((MouseEvent) event) || ((MouseEvent) event).isPopupTrigger()) { abortTimer(); return false; } if (!wasFocusOwner) { wasFocusOwner = true; return false; } } if (lastPath != null) { Node n = Visualizer.findNode(lastPath.getLastPathComponent()); if ((n == null) || !n.canRename()) { return false; } } else { // Disallow rename when multiple nodes are selected return false; } // disallow editing if we are in DnD operation if (dndActive) { return false; } return super.isCellEditable(event); }
/** Main method of the editor. * @return component of editor */ public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) { Node ren = Visualizer.findNode (value); if ((ren != null) && (ren.canRename ())) delegate.setValue(ren.getName()); else delegate.setValue(""); // NOI18N editingIcon = ((VisualizerNode) value).getIcon(expanded, false); ((JTextField) editorComponent).selectAll(); return editorComponent; } }
/** Main method of the editor. * @return component of editor */ @Override public Component getTreeCellEditorComponent( JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row ) { Node ren = Visualizer.findNode(value); if ((ren != null) && (ren.canRename())) { delegate.setValue(ren.getName()); } else { delegate.setValue(""); // NOI18N } editingIcon = ((VisualizerNode) value).getIcon(expanded, false); ((JTextField) editorComponent).selectAll(); return editorComponent; } }
/** Main method of the editor. * @return component of editor */ public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) { Node ren = Visualizer.findNode (value); if ((ren != null) && (ren.canRename ())) delegate.setValue(ren.getName()); else delegate.setValue(""); // NOI18N editingIcon = ((VisualizerNode) value).getIcon(expanded, false); ((JTextField) editorComponent).selectAll(); return editorComponent; } }
org.openide.nodes.Node n = tp != null ? Visualizer.findNode(tp.getLastPathComponent()) : null; if ((n == null) || !n.canRename()) {
if (lastP != null) { Node n = Visualizer.findNode (lastP.getLastPathComponent()); if (n != null && n.canRename ()) { String newStr = (String) getCellEditorValue(); try {
if (lastP != null) { Node n = Visualizer.findNode (lastP.getLastPathComponent()); if (n != null && n.canRename ()) { String newStr = (String) getCellEditorValue(); try {