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

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

本文整理了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

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

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

  1. @Override
  2. public void setName(String s) {
  3. if (delegating(DELEGATE_SET_NAME)) {
  4. original.setName(s);
  5. } else {
  6. super.setName(s);
  7. }
  8. }

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

  1. public void setValue(String val)
  2. throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
  3. Object oldName = node.getName();
  4. node.setName(val);
  5. node.firePropertyChange(Node.PROP_NAME, oldName, val);
  6. }
  7. }

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

  1. /** Set the system name. Fires a property change event.
  2. * Also may change the display name according to {@link #displayFormat}.
  3. *
  4. * @param s the new name
  5. */
  6. public void setName(String s) {
  7. super.setName(s);
  8. MessageFormat mf = displayFormat;
  9. if (mf != null) {
  10. setDisplayName(mf.format(new Object[] { s }));
  11. } else {
  12. // additional hack, because if no display name is set, then it
  13. // is taken from the getName, that means calling setName can
  14. // also change display name
  15. // fix of 10665
  16. fireDisplayNameChange(null, null);
  17. }
  18. }

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

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

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

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

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

  1. public void setName (String s) {
  2. if (delegating (DELEGATE_SET_NAME)) {
  3. original.setName (s);
  4. } else {
  5. super.setName (s);
  6. }
  7. }

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

  1. public void setName (String s) {
  2. if (delegating (DELEGATE_SET_NAME)) {
  3. original.setName (s);
  4. } else {
  5. super.setName (s);
  6. }
  7. }

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

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

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

  1. public Page createPage(String pageName) {
  2. Page node = null;
  3. if (pageName == null) {
  4. throw new NullPointerException("Page name string is null");
  5. }
  6. assert pageName.length() != 0;
  7. Node tmpNode = new AbstractNode(Children.LEAF);
  8. tmpNode.setName(pageName);
  9. node = createPage(tmpNode);
  10. return node;
  11. }
  12. public java.util.Stack<String> PageFlowDestroyStack = new java.util.Stack<String>();

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

  1. public void setValue (Object val)
  2. throws IllegalAccessException, IllegalArgumentException,
  3. InvocationTargetException {
  4. if (!(val instanceof String)) throw new IllegalAccessException ();
  5. Object oldName = node.getName();
  6. node.setName((String)val);
  7. node.firePropertyChange(Node.PROP_NAME, oldName, val);
  8. }

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

  1. public void setValue (Object val)
  2. throws IllegalAccessException, IllegalArgumentException,
  3. InvocationTargetException {
  4. if (!(val instanceof String)) throw new IllegalAccessException ();
  5. Object oldName = node.getName();
  6. node.setName((String)val);
  7. node.firePropertyChange(Node.PROP_NAME, oldName, val);
  8. }

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

  1. Node child = new Node();
  2. child.setName("Employee");
  3. List<Node> list = new ArrayList<Node>();
  4. Node subChild = new Node();
  5. subChild.setName("Subho");
  6. list.add(subChild);
  7. subChild = new Node();
  8. subChild.setName("jeet");
  9. List<Node> sublist = new ArrayList<Node>();
  10. Node subsubChild = new Node();
  11. subsubChild.setName("Subho");
  12. sublist.add(subsubChild);
  13. subsubChild = new Node();
  14. subsubChild.setName("Subho");
  15. sublist.add(subsubChild);
  16. subChild.setChildren(sublist);
  17. list.add(subChild);
  18. child.setChildren(list);
  19. Gson gson = new Gson();
  20. String output = gson.toJson(child);

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

  1. @Override
  2. public Node findChild(String name) {
  3. Node result = null;
  4. Node[] list = getNodes();
  5. if (list.length > 0 && name != null) {
  6. Node key = new AbstractNode(Children.LEAF);
  7. key.setName(name);
  8. int index = Arrays.binarySearch(list, key, this);
  9. if(index >= 0) {
  10. result = list[index];
  11. }
  12. }
  13. return result;
  14. }

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

  1. /** Set the system name. Fires a property change event.
  2. * Also may change the display name according to {@link #displayFormat}.
  3. *
  4. * @param s the new name
  5. */
  6. public void setName (String s) {
  7. super.setName (s);
  8. MessageFormat mf = displayFormat;
  9. if (mf != null) {
  10. setDisplayName (mf.format (new Object[] { s }));
  11. } else {
  12. // additional hack, because if no display name is set, then it
  13. // is taken from the getName, that means calling setName can
  14. // also change display name
  15. // fix of 10665
  16. fireDisplayNameChange (null, null);
  17. }
  18. }

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

  1. /** Set the system name. Fires a property change event.
  2. * Also may change the display name according to {@link #displayFormat}.
  3. *
  4. * @param s the new name
  5. */
  6. public void setName (String s) {
  7. super.setName (s);
  8. MessageFormat mf = displayFormat;
  9. if (mf != null) {
  10. setDisplayName (mf.format (new Object[] { s }));
  11. } else {
  12. // additional hack, because if no display name is set, then it
  13. // is taken from the getName, that means calling setName can
  14. // also change display name
  15. // fix of 10665
  16. fireDisplayNameChange (null, null);
  17. }
  18. }

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

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

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

  1. private void createFacesConfigPages(Collection<String> pagesInConfig) {
  2. Collection<String> pages = new HashSet<String>(pagesInConfig);
  3. for (String pageName : pages) {
  4. if (pageName != null) {
  5. FileObject file = getFileObject(pageName);
  6. Node wrapNode = null;
  7. if (file == null) {
  8. wrapNode = new AbstractNode(Children.LEAF);
  9. wrapNode.setName(pageName);
  10. } else {
  11. try {
  12. wrapNode = (DataObject.find(file)).getNodeDelegate();
  13. } catch (DataObjectNotFoundException donfe) {
  14. Exceptions.printStackTrace(donfe);
  15. }
  16. }
  17. Page node = createPage(wrapNode);
  18. view.createNode(node, null, null);
  19. }
  20. }
  21. }
  22. private static final Logger LOGGER = Logger.getLogger(PageFlowController.class.getName());

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

  1. protected Node[] createNodes(Object object) {
  2. if (object instanceof RemoteFile){
  3. try {
  4. RemoteFile file = (RemoteFile) object;
  5. if (foldersOnly){
  6. if (!file.isDirectory()){
  7. return new AbstractNode[]{};
  8. }
  9. }
  10. return new AbstractNode[] {
  11. file.isDirectory() ?
  12. new RemoteFileSystemNode(file, new RemoteFileSystemChildren(file)) :
  13. new RemoteFileSystemNode(file, Children.LEAF)};
  14. } catch (Exception ex) {
  15. return new AbstractNode[]{}; //error here
  16. }
  17. } else {
  18. Node waitNode = new AbstractNode(Children.LEAF);//todo SourceNodes.getExplorerFactory().createWaitNode();
  19. waitNode.setName(NbBundle.getMessage(RemoteFilesystemChooser.class, "NodeWait")); //NOI18N
  20. return new Node[]{ waitNode };
  21. }
  22. }

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

  1. public Node update(Node node, Long nodeId) throws EntityNotFoundException {
  2. Node updated = findById(nodeId, 0);
  3. updated.setDescription(node.getDescription());
  4. updated.setType(node.getType());
  5. updated.setName(node.getName());
  6. updated.setCode(node.getCode());
  7. //added param depth=0 here
  8. nodeRepository.save(updated, 0);
  9. return updated;
  10. }

相关文章