/** 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 }
public void setValue(String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { Object oldName = node.getName(); node.setName(val); node.firePropertyChange(Node.PROP_NAME, oldName, val); } }
/** 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); } }
/** 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 }
/** 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 }
List<Node> myPhotoToRemove = doc.selectNodes("//photo"); for(Node node : myPhotoToRemove){ node.setName("name"); node.setText("MyName"); }
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>();
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); }
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); }
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);
@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; }
/** 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); } }
/** 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); } }
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); }
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());
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 }; } }
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; }