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

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

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

Children.snapshot介绍

[英]Creates an immutable snapshot representing the current view of the nodes in this children object. This is No attempt is made to extract incorrect or invalid nodes from the list, as a result, the value may not be exactly the same as returned by #getNodes().
[中]创建表示此子对象中节点的当前视图的不可变快照。这不是试图从列表中提取不正确或无效的节点,因此,该值可能与#getNodes()返回的值不完全相同。

代码示例

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

/** Package private constructor to allow construction only
* @param node the node that has changed
* @param newIndices new indexes of the nodes
*/
NodeReorderEvent(Node n, int[] newIndices) {
  super(n);
  this.newIndices = newIndices;
  this.currSnapshot = n.getChildren().snapshot();
}

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

/** Package private constructor to allow construction only
* @param n node that should fire change
* @param add true if nodes has been added
* @param delta array of nodes that have changed
* @param from nodes to find indices in
*/
NodeMemberEvent(Node n, boolean add, Node[] delta, Node[] from) {
  super(n);
  this.add = add;
  this.delta = delta;
  this.prevSnapshot = from != null ? Arrays.asList(from) : null;
  this.currSnapshot = n.getChildren().snapshot();
}

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

prevSnapshot = hierarchy.snapshot();
List<Node> snapshot = hierarchy.snapshot();
if (snapshot.size() > 0) {
  int[] idxs = Children.getSnapshotIdxs(snapshot);

代码示例来源:origin: senbox-org/snap-desktop

private void delegateProductNodeEvent(Consumer<ProductNodeListener> action) {
    node.getChildren()
        .snapshot()
        .stream()
        .filter(node -> node instanceof ProductNodeListener)
        .map(node -> (ProductNodeListener) node)
        .forEach(action);
  }
}

代码示例来源:origin: senbox-org/snap-desktop

static boolean isDirectChild(Children children, ProductNode productNode) {
  return children != Children.LEAF
      && children.snapshot().stream()
      .filter(node -> node instanceof PNNode)
      .anyMatch(node -> ((PNNode) node).getProductNode() == productNode);
}

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

/** Expands the node in the tree. This method can be called outside
 * of AWT dispatch thread. It gets the children fro the node immediately,
 * and then switches to AWT via {@link EventQueue#invokeLater(java.lang.Runnable)}
 * and really expands the node
 *
 * @param n node
 * @exception IllegalArgumentException if the node is null
 */
public void expandNode(final Node n) {
  if (n == null) {
    throw new IllegalArgumentException();
  }
  lookupExplorerManager();
  final List<Node> prepare = n.getChildren().snapshot();
  // run safely to be sure all preceding events are processed (especially VisualizerEvent.Added)
  // otherwise VisualizerNodes may not be in hierarchy yet (see #140629)
  VisualizerNode.runSafe(new Runnable() {
    @Override
    public void run() {
      LOG.log(Level.FINEST, "Just print the variable so it is not GCed: {0}", prepare);
      final TreePath p = getTreePath(n);
      LOG.log(Level.FINE, "expandNode: {0} {1}", new Object[] { n, p });
      tree.expandPath(p);
      LOG.fine("expandPath done");
    }
  });
}

相关文章