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

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

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

Node.setName介绍

[英]Set the system name. Fires a property change event.
[中]设置系统名称。激发属性更改事件。

代码示例

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

/** Create a new abstract node with a given child set and associated
* lookup. If you use this constructor, please do not call methods
* {@link #getCookieSet} and {@link #setCookieSet} they will throw an
* exception.
* <p>
* More info on the correct usage of constructor with Lookup can be found
* in the {@link Node#Node(org.openide.nodes.Children, org.openide.util.Lookup)}
* javadoc.
*
* @param children the children to use for this node
* @param lookup the lookup to provide content of {@link #getLookup}
*   and also {@link #getCookie}
* @since 3.11
*/
public AbstractNode(Children children, Lookup lookup) {
  super(children, lookup);
  // Setting the name to non-null value for the node
  // to return "reasonable" name and displayName
  // not using this.setName since the descendants
  // can override it and might assume that it is
  // not called from constructor (see e.g. DataNode)
  super.setName(""); // NOI18N
}

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

@Override
public void setName(String s) {
  if (delegating(DELEGATE_SET_NAME)) {
    original.setName(s);
  } else {
    super.setName(s);
  }
}

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

public void setValue(String val)
  throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
    Object oldName = node.getName();
    node.setName(val);
    node.firePropertyChange(Node.PROP_NAME, oldName, val);
  }
}

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

/** Set the system name. Fires a property change event.
* Also may change the display name according to {@link #displayFormat}.
*
* @param s the new name
*/
public void setName(String s) {
  super.setName(s);
  MessageFormat mf = displayFormat;
  if (mf != null) {
    setDisplayName(mf.format(new Object[] { s }));
  } else {
    // additional hack, because if no display name is set, then it
    // is taken from the getName, that means calling setName can
    // also change display name
    // fix of 10665
    fireDisplayNameChange(null, null);
  }
}

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

/** Create a new abstract node with a given child set and associated
* lookup. If you use this constructor, please do not call methods
* <link>getCookieSet</link> and <link>setCookieSet</link> they will
* throw an exception.
* <p>
* More info on the correct usage of constructor with Lookup can be found
* in the {@link Node#Node(org.openide.nodes.Children, org.openide.util.Lookup)} 
* javadoc.
*
* @param children the children to use for this node
* @param lookup the lookup to provide content of {@link #getLookup}
*   and also {@link #getCookie}
* @since 3.11
*/
public AbstractNode (Children children, Lookup lookup) {
  super (children, lookup);
  // Setting the name to non-null value for the node
  // to return "reasonable" name and displayName
  // not using this.setName since the descendants
  // can override it and might assume that it is
  // not called from constructor (see e.g. DataNode)
  super.setName(""); // NOI18N
}

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

/** Create a new abstract node with a given child set and associated
* lookup. If you use this constructor, please do not call methods
* <link>getCookieSet</link> and <link>setCookieSet</link> they will
* throw an exception.
* <p>
* More info on the correct usage of constructor with Lookup can be found
* in the {@link Node#Node(org.openide.nodes.Children, org.openide.util.Lookup)} 
* javadoc.
*
* @param children the children to use for this node
* @param lookup the lookup to provide content of {@link #getLookup}
*   and also {@link #getCookie}
* @since 3.11
*/
public AbstractNode (Children children, Lookup lookup) {
  super (children, lookup);
  // Setting the name to non-null value for the node
  // to return "reasonable" name and displayName
  // not using this.setName since the descendants
  // can override it and might assume that it is
  // not called from constructor (see e.g. DataNode)
  super.setName(""); // NOI18N
}

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

public void setName (String s) {
  if (delegating (DELEGATE_SET_NAME)) {
    original.setName (s);
  } else {
    super.setName (s);
  }
}

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

public void setName (String s) {
  if (delegating (DELEGATE_SET_NAME)) {
    original.setName (s);
  } else {
    super.setName (s);
  }
}

代码示例来源:origin: stackoverflow.com

List<Node> myPhotoToRemove = doc.selectNodes("//photo");
for(Node node : myPhotoToRemove){
  node.setName("name");
  node.setText("MyName"); 
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf-navigation

public Page createPage(String pageName) {
  Page node = null;
  if (pageName == null) {
    throw new NullPointerException("Page name string is null");
  }
  assert pageName.length() != 0;
  Node tmpNode = new AbstractNode(Children.LEAF);
  tmpNode.setName(pageName);
  node = createPage(tmpNode);
  return node;
}
public java.util.Stack<String> PageFlowDestroyStack = new java.util.Stack<String>();

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

public void setValue (Object val)
throws IllegalAccessException, IllegalArgumentException,
  InvocationTargetException {
  if (!(val instanceof String)) throw new IllegalAccessException ();
  Object oldName = node.getName();
  node.setName((String)val);
  node.firePropertyChange(Node.PROP_NAME, oldName, val);
}

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

public void setValue (Object val)
throws IllegalAccessException, IllegalArgumentException,
  InvocationTargetException {
  if (!(val instanceof String)) throw new IllegalAccessException ();
  Object oldName = node.getName();
  node.setName((String)val);
  node.firePropertyChange(Node.PROP_NAME, oldName, val);
}

代码示例来源:origin: stackoverflow.com

Node child  = new Node();       
 child.setName("Employee");
 List<Node> list = new ArrayList<Node>();
 Node subChild  = new Node();        
 subChild.setName("Subho");
 list.add(subChild);
 subChild  = new Node();     
 subChild.setName("jeet");
 List<Node> sublist = new ArrayList<Node>();
 Node subsubChild  = new Node();     
 subsubChild.setName("Subho");
 sublist.add(subsubChild);
 subsubChild  = new Node();      
 subsubChild.setName("Subho");
 sublist.add(subsubChild);
 subChild.setChildren(sublist);
 list.add(subChild);
 child.setChildren(list);
 Gson gson = new Gson();
 String output = gson.toJson(child);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-sun-ddui

@Override
public Node findChild(String name) {
  Node result = null;
  Node[] list = getNodes();
  if (list.length > 0 && name != null) {
    Node key = new AbstractNode(Children.LEAF);
    key.setName(name);
    int index = Arrays.binarySearch(list, key, this);
    if(index >= 0) {
      result = list[index];
    }
  }
  
  return result;
}

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

/** Set the system name. Fires a property change event.
* Also may change the display name according to {@link #displayFormat}.
*
* @param s the new name
*/
public void setName (String s) {
  super.setName (s);
  MessageFormat mf = displayFormat;
  if (mf != null) {
    setDisplayName (mf.format (new Object[] { s }));
  } else {
    // additional hack, because if no display name is set, then it
    // is taken from the getName, that means calling setName can
    // also change display name
    // fix of 10665
    fireDisplayNameChange (null, null);
  }
}

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

/** Set the system name. Fires a property change event.
* Also may change the display name according to {@link #displayFormat}.
*
* @param s the new name
*/
public void setName (String s) {
  super.setName (s);
  MessageFormat mf = displayFormat;
  if (mf != null) {
    setDisplayName (mf.format (new Object[] { s }));
  } else {
    // additional hack, because if no display name is set, then it
    // is taken from the getName, that means calling setName can
    // also change display name
    // fix of 10665
    fireDisplayNameChange (null, null);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf-navigation

public void changeToAbstractNode(Page oldNode, String displayName) {
  //1. Make Old Node an abstract node
  Node tmpNode = new AbstractNode(Children.LEAF);
  tmpNode.setName(displayName);
  oldNode.replaceWrappedNode(tmpNode); //Does this take care of pageName2Node?
  view.resetNodeWidget(oldNode, true);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf-navigation

private void createFacesConfigPages(Collection<String> pagesInConfig) {
  Collection<String> pages = new HashSet<String>(pagesInConfig);
  for (String pageName : pages) {
    if (pageName != null) {
      FileObject file = getFileObject(pageName);
      Node wrapNode = null;
      if (file == null) {
        wrapNode = new AbstractNode(Children.LEAF);
        wrapNode.setName(pageName);
      } else {
        try {
          wrapNode = (DataObject.find(file)).getNodeDelegate();
        } catch (DataObjectNotFoundException donfe) {
          Exceptions.printStackTrace(donfe);
        }
      }
      Page node = createPage(wrapNode);
      view.createNode(node, null, null);
    }
  }
}
private static final Logger LOGGER = Logger.getLogger(PageFlowController.class.getName());

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-deployment-wm

protected Node[] createNodes(Object object) {
  if (object instanceof RemoteFile){
    try {
      RemoteFile file = (RemoteFile) object;
      if (foldersOnly){
        if (!file.isDirectory()){
          return new AbstractNode[]{};
        }
      }
      return new AbstractNode[] {
        file.isDirectory() ? 
        new RemoteFileSystemNode(file, new RemoteFileSystemChildren(file)) : 
        new RemoteFileSystemNode(file, Children.LEAF)};
    } catch (Exception ex) {
      return new AbstractNode[]{}; //error here
    }
  } else {
    Node waitNode = new AbstractNode(Children.LEAF);//todo SourceNodes.getExplorerFactory().createWaitNode(); 
    waitNode.setName(NbBundle.getMessage(RemoteFilesystemChooser.class, "NodeWait")); //NOI18N
    return new Node[]{ waitNode };
  }
}

代码示例来源:origin: stackoverflow.com

public Node update(Node node, Long nodeId) throws EntityNotFoundException {
  Node updated = findById(nodeId, 0);
  updated.setDescription(node.getDescription());
  updated.setType(node.getType());
  updated.setName(node.getName());
  updated.setCode(node.getCode());
  //added param depth=0 here
  nodeRepository.save(updated, 0);
  return updated;
}

相关文章

微信公众号

最新文章

更多