org.openide.nodes.Children类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(143)

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

Children介绍

[英]Container for array of nodes. Can be Node#Node with a node and then all children in the array have that node set as a parent, and this list will be returned as the node's children.

Probably you want to subclass Children.Keys. Subclassing Children directly is not recommended.
[中]节点数组的容器。可以是具有节点的节点#节点,然后数组中的所有子节点都将该节点设置为父节点,此列表将作为节点的子节点返回。
也许你想给孩子们分类。钥匙。不建议直接子类化Children

代码示例

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

public Node[] callGetNodes(boolean optimalResult) {
  Node[] hold = null;
  if (optimalResult) {
    hold = original.getChildren().getNodes(true);
  }
  hold = Children.this.getNodes();
  return hold;
}

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

@Override
@Deprecated
public boolean add(Node[] arr) {
  return original.getChildren().add(arr);
}

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

public Node findChild(String name) {
  Node dontGC = original.getChildren().findChild(name);
  return Children.super.findChild(name);
}

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

Children.MUTEX.postWriteRequest(new Runnable() { public void run() {
  boolean wasInited = hierarchy.isInitialized();
  boolean wasLeaf = hierarchy == Children.LEAF;
    prevSnapshot = hierarchy.snapshot();
  hierarchy.detachFrom();
    int[] idxs = Children.getSnapshotIdxs(prevSnapshot);
    fireSubNodesChangeIdx(false, idxs, null, Collections.<Node>emptyList(), prevSnapshot);
  hierarchy.attachTo(Node.this);
    hierarchy.getNodesCount();
    List<Node> snapshot = hierarchy.snapshot();
    if (snapshot.size() > 0) {
      int[] idxs = Children.getSnapshotIdxs(snapshot);
      fireSubNodesChangeIdx(true, idxs, null, snapshot, null);
    fireOwnPropertyChange(PROP_LEAF, wasLeaf, hierarchy == Children.LEAF);

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

Children ch = getParentChildren();
  Throwable t = null;
  try {
    parentNodes = Arrays.toString(parent.getNodes());
    chNodes = Arrays.toString(ch.getNodes());
  } catch (StackOverflowError e) {
    t = e;
    "Cannot initialize " + index + "th child of node " + parent.getNode() +
    "; it already belongs to node " + ch.getNode() + " (did you forgot to use cloneNode?)\nChildren of new node: " +
    parentNodes + "\nChildren of old node: " +
    chNodes

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf-testrunner-ui

public static FileObject getFileObjectFromNode(Node node) {
  FileObject fo = node.getLookup().lookup(FileObject.class);
  if(fo == null) {
    Children children = node.getChildren();
    for(Node child : children.getNodes()) {
      fo = child.getLookup().lookup(FileObject.class);
      if(fo != null) {
        return child.getDisplayName().equals("<default package>") ? fo : fo.getParent();
      }
    }
  }
  return fo;
}

代码示例来源:origin: org.codehaus.mevenide/nb-project

public void run() {
  ArchetypeNGProjectCreator customCreator = Lookup.getDefault().lookup(ArchetypeNGProjectCreator.class);
  
  Lookup.Result<ArchetypeProvider> res = Lookup.getDefault().lookup(new Lookup.Template<ArchetypeProvider>(ArchetypeProvider.class));
  List<Archetype> archetypes = new ArrayList<Archetype>();
  for (ArchetypeProvider provider : res.allInstances()) {
    for (Archetype ar : provider.getArchetypes()) {
      if (customCreator == null && ar.archetypeNg) {
        continue;
      }
      if (!archetypes.contains(ar)) {
        archetypes.add(ar);
      }
    }
  }
  archetypes.add(REMOTE_PLACEHOLDER);
  Childs childs = (Childs)manager.getRootContext().getChildren();
  childs.addArchetypes(archetypes);
  try {
    manager.setSelectedNodes(new Node[] {manager.getRootContext().getChildren().getNodes()[0]});
  } catch (PropertyVetoException e) {
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-maven-repository

@Override
public void propertyChange(PropertyChangeEvent evt) {
  if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) {
    for (Node nd : explorerManager.getSelectedNodes()) {
      DependencyNode n = nd.getLookup().lookup(DependencyNode.class);
      if (n != null) {
        Artifact a = n.getArtifact();
        recursCollapse(treeExplorerManager.getRootContext().getChildren().getNodes(), (BeanTreeView)tvTree);
        Set<Node> selectedNodes = recurse(a, treeExplorerManager.getRootContext(), (BeanTreeView)tvTree);
        try {
          treeExplorerManager.setSelectedNodes(selectedNodes.toArray(new Node[0]));
        } catch (PropertyVetoException ex) {
          Exceptions.printStackTrace(ex);
        }
      }
      
    }
  }
}

代码示例来源:origin: nl.cloudfarming.client/geoviewer-data

@Override
  public Transferable paste() {
    try {
      // adds the new node to the selected parent (current node)
      dropNode.getParentNode().getChildren().add(new Node[]{new LayerNode(selectedLayer,getLookup().lookup(MapController.class))});
    } catch (IntrospectionException ex) {
      Exceptions.printStackTrace(ex);
    }
    // remove the node from the old location
    dropNode.getParentNode().getChildren().remove(new Node[]{dropNode});
    return null;
  }
};

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

private void selectNode(String name) {
  Node node = null;
  if (name != null) {
    node = findNode(manager.getRootContext(), name);
  }
  if (node == null) {
    node = (manager.getRootContext().getChildren().getNodes()[0]);
  }
  if (node != null) {
    try {
      manager.setSelectedNodes(new Node[]{node});
    } catch (Exception e) {
    }
  }
}

代码示例来源:origin: nl.cloudfarming.client/area-plot

/**
 * get a list with shape nodes managed by this data provider
 *
 * @return list with shape nodes
 */
public List<ShapeNode> getShapeNodes(){
  List<ShapeNode> nodes = new ArrayList<ShapeNode>();
  for (Node node: getExplorerManager().getRootContext().getChildren().getNodes()){
    if (node instanceof ShapeNode){
      nodes.add((ShapeNode)node);
    }
  }
  return nodes;
}

代码示例来源:origin: nl.cloudfarming.client/area-plot

/**
 * method to indicate that the import has finished
 * A layer will be constructed based on the added shapes
 * and a node hierarchy will be created.
 */
public void finished(){
  importLayer = new ImportLayer(plotFile, this);
  ShapeNodeFactory shapeNodeFactory = new ShapeNodeFactory(importLayer);
  shapeNodeFactory.setService(this);
  getExplorerManager().setRootContext(new AbstractNode(Children.create(shapeNodeFactory, true)));
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

private static Node findProjectNode(Node root, Project p) {
  Node[] n = root.getChildren().getNodes(true);
  Template<Project> t = new Template<>(null, null, p);
  for (int cntr = 0; cntr < n.length; cntr++) {
    if (n[cntr].getLookup().lookupItem(t) != null) {
      return n[cntr];
    }
  }
  return null;
}

代码示例来源:origin: nl.cloudfarming.client/messaging

/**
 * Not used for this module
 */
@Override
protected void initExplorer() {
  Node rootNode = new AbstractNode(Children.create(new MessageNodeFactory(), true));
  ExplorerManager manager = new ExplorerManager();
  manager.setRootContext(rootNode);
  manager.getRootContext().setDisplayName("messages");
  setExplorerManager(manager, new ActionMap());
}

代码示例来源:origin: nl.cloudfarming.client/field-shape-type

public ShapeDataObjectNode(Node original, String name) {
  super(Children.create(new ShapeChildFactory(), true), new ProxyLookup(original.getLookup(), Lookups.singleton(new SimpleLayer(name))));
  this.origional = original;
  setIconBaseWithExtension("nl/cloudfarming/client/shape/file_extension_shp.png");
  setDisplayName(name);
}

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

@Override
public int callGetNodesCount(boolean optimalResult) {
  return original.getChildren().getNodesCount(optimalResult);
}

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

public void run() {
    Node root = ptLogial.getExplorerManager().getRootContext();
    // Node projNode = root.getChildren ().findChild( p.getProjectDirectory().getName () );
    Node projNode = root.getChildren().findChild( ProjectUtils.getInformation( p ).getName() );
    if ( projNode != null ) {
      try {
        ptLogial.getExplorerManager().setSelectedNodes( new Node[] { projNode } );
      } catch (Exception ignore) {
        // may ignore it
      }
    }
  }
});

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

private Node[] findDropedNodes(Node folder, Node[] dragNodes) {
  if ((folder == null) || (dragNodes.length == 0)) {
    return null;
  }
  Node[] dropNodes = new Node[dragNodes.length];
  Children children = folder.getChildren();
  for (int i = 0; i < dragNodes.length; i++) {
    dropNodes[i] = children.findChild(dragNodes[i].getName());
  }
  return dropNodes;
}

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

Children.PR.enterReadAccess();
String childPath = node.getName();
Node parentNode = node.getParentNode();
Node foundChild = parentNode.getChildren().findChild(childPath);
if (foundChild != node) {
  Logger.getLogger(DefaultHandle.class.getName()).log(Level.WARNING,

代码示例来源:origin: it.tidalwave.semantic/it-tidalwave-semantic-node

/***************************************************************************
   *
   *
   **************************************************************************/
  protected EntityNode (@Nonnull final EntityChildFactory entityChildFactory)
   {
    super(Children.create(entityChildFactory, true));
    this.entity = null;
    this.entityChildFactory = entityChildFactory;
    pasteTypeFactory = null;
//        refreshAttributes();
   }

相关文章