org.openide.nodes.Node.canRename()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中org.openide.nodes.Node.canRename()方法的一些代码示例,展示了Node.canRename()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.canRename()方法的具体详情如下:
包路径:org.openide.nodes.Node
类名称:Node
方法名:canRename

Node.canRename介绍

[英]Test whether this node can be renamed. If true, one can use #getName to obtain the current name and #setName to change it.
[中]

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-nodes

/** 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;
}

代码示例来源:origin: org.netbeans.api/org-openide-nodes

public boolean canRename() {
  return original.canRename();
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** 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;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

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();
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

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();
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** 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;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public boolean canRename () {
  return original.canRename ();
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public boolean canRename () {
  return original.canRename ();
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

@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);
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

/** 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);
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

/** 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);
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

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);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

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);
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

@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);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** 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;
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

/** 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;
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** 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;
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

org.openide.nodes.Node n = tp != null ? Visualizer.findNode(tp.getLastPathComponent()) : null;
if ((n == null) || !n.canRename()) {

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

if (lastP != null) {
  Node n = Visualizer.findNode (lastP.getLastPathComponent());
  if (n != null && n.canRename ()) {
    String newStr = (String) getCellEditorValue();
    try {

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

if (lastP != null) {
  Node n = Visualizer.findNode (lastP.getLastPathComponent());
  if (n != null && n.canRename ()) {
    String newStr = (String) getCellEditorValue();
    try {

相关文章

微信公众号

最新文章

更多