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

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

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

Node.addNodeListener介绍

[英]Add a listener to changes in the node's intrinsic properties (name, cookies, etc.).

The listener is not notified about changes in subnodes until the method getChildren().getNodes() is called.
[中]将侦听器添加到节点内在属性(名称、cookies等)的更改中。
在调用方法getChildren().getNodes()之前,不会通知侦听器子节点中的更改。

代码示例

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

/** Attach itself as a listener to the given nodes */
private void attachListeners(List<Reference<Node>> nodes) {
  if (nodes != null) {
    Iterator<Reference<Node>> it = nodes.iterator();
    while (it.hasNext()) {
      Node node = it.next().get();
      if (node != null) {
        node.addNodeListener(listener);
      }
    }
  }
}

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

/** Attach itself as a listener to the given nodes */
void attachListeners(List<Reference<Node>> nodes) {
  Iterator<Reference<Node>> it = nodes.iterator();
  while (it.hasNext()) {
    Node node = it.next().get();
    if (node != null) {
      node.addNodeListener(listener);
    }
  }
}

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

/** Getter for node listener.
*/
synchronized NodeListener getNodeListener() {
  if (nodeL == null) {
    nodeL = createNodeListener();
    getOriginal().addNodeListener(nodeL);
  }
  return nodeL;
}

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

private void addNotifyImpl() {
  // add itself to reflect to changes children of original node
  nodeL = new ChildrenAdapter(this);
  original.addNodeListener(nodeL);
  filterSupport().update();
}

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

/** Creates a node representant for given bean. Uses factory
* to get the node.
* @param subbean the bean from bean context
* @return node created by the factory
*/
protected Node[] createNodes(Object subbean) {
  try {
    if (subbean instanceof BeanContextSupport) {
      BeanContextSupport bcs = (BeanContextSupport) subbean;
      if (bean.contains(bcs.getBeanContextPeer()) && (bcs != bcs.getBeanContextPeer())) {
        // sometimes a BeanContextSupport occures in the list of
        // beans children even there is its peer. we think that
        // it is desirable to hide the context if the peer is
        // also present
        return new Node[0];
      }
    }
    Node n = factory.createNode(subbean);
    // #7925: deleting from BeanChildren has no effect
    synchronized (nodes2Beans) {
      nodes2Beans.put(n, new Reference[] { new WeakReference<BeanContext>(bean), new WeakReference<Object>(subbean) });
    }
    n.addNodeListener(contextL);
    return new Node[] { n };
  } catch (IntrospectionException ex) {
    Logger.getLogger(BeanChildren.class.getName()).log(Level.WARNING, null, ex);
    return new Node[0];
  }
}

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

/** Attach itself as a listener to the given nodes */
void attachListeners (List nodes) {            
  Iterator it = nodes.iterator();
  while (it.hasNext()) {
    Node node = (Node)((Reference)it.next()).get ();
    if (node != null) 
      node.addNodeListener(this);
  }            
}

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

/** Attach itself as a listener to the given nodes */
void attachListeners (List nodes) {            
  Iterator it = nodes.iterator();
  while (it.hasNext()) {
    Node node = (Node)((Reference)it.next()).get ();
    if (node != null) 
      node.addNodeListener(this);
  }            
}

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

/** Attach itself as a listener to the given nodes */
  private void attachListeners (List nodes) {
    if (nodes != null){
      Iterator it = nodes.iterator();
      while (it.hasNext()) {
        Node node = (Node)((Reference)it.next()).get ();
        if (node != null)
          node.addNodeListener(listener);
      }
    }
  }
} // end of CookieDelegateAction

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

/** Check whether the node has not been updated.
 */
private void updateNode (Node n) {            
  if (current != null && current.get () == n) {
    return;
  }
  
  if (current != null && current.get () != null) {
    ((Node)current.get ()).removeNodeListener (listener);
  }
  
  n.addNodeListener (listener);
  current = new WeakReference (n);
}

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

private void addNotifyImpl () {
  // add itself to reflect to changes children of original node
  nodeL = new ChildrenAdapter (this);
  original.addNodeListener (nodeL);
  updateKeys ();
}

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

private void addNotifyImpl () {
  // add itself to reflect to changes children of original node
  nodeL = new ChildrenAdapter (this);
  original.addNodeListener (nodeL);
  updateKeys ();
}

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

/** Getter for node listener.
*/
synchronized NodeListener getNodeListener () {
  if (nodeL == null) {
    nodeL = createNodeListener ();
    getOriginal().addNodeListener(nodeL);
  }
  return nodeL;
}

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

/** Create an index cookie associated with a data folder.
* @param df the data folder
* @param node node to be associated with. subnodes of this node will be returned, etc.
*/
public Index(final DataFolder df, Node node) {
  this.df = df;
  this.node = node;
  listener = new Listener ();
  node.addNodeListener (org.openide.nodes.NodeOp.weakNodeListener (listener, node));
}

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

/** Getter for node listener.
*/
synchronized NodeListener getNodeListener () {
  if (nodeL == null) {
    nodeL = createNodeListener ();
    getOriginal().addNodeListener(nodeL);
  }
  return nodeL;
}

代码示例来源:origin: eu.limetri.client/mapviewer-nb-swing

@Override
public void addNotify() {
  super.addNotify();
  for (NodeListener listener : listeners) {
    getExplorerManager().getRootContext().addNodeListener(listener);
  }
  listeners.clear();
}

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

this.original.addNodeListener(getNodeListener());

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

/** Constructor. */
  public LazyMenu(final DataFolder df, boolean icon) {
  master = df;
  this.icon = icon;
  // Listen for changes in Node's DisplayName/Icon
    Node n = master.getNodeDelegate ();
    n.addNodeListener (org.openide.nodes.NodeOp.weakNodeListener (this, n));
  updateProps();
  }

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

ProxyNode(Node... original) {
  super(Children.LEAF);
  this.original = original;
  nl = new NodeAdapterImpl(true);
  pcl = new NodeAdapterImpl(false);
  for (int i = 0; i < original.length; i++) {
    original[i].addPropertyChangeListener(org.openide.util.WeakListeners.propertyChange(pcl, original[i]));
    original[i].addNodeListener(
      org.openide.util.WeakListeners.create(NodeListener.class, nl, original[i])
    );
  }
}

代码示例来源:origin: eu.limetri.client/mapviewer-nb-swing

@Override
public void addNotify() {
  super.addNotify();
  getExplorerManager().getRootContext().addNodeListener(rootNodeListener);
  getExplorerManager().addPropertyChangeListener(selectionListener);
}

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

/** Overrides superclass method. Initializes editor component. */
protected void initializeCloneableEditor (CloneableEditor editor) {
  DataObject obj = getDataObject();
  if(obj.isValid()) {
    org.openide.nodes.Node ourNode = obj.getNodeDelegate();
    editor.setActivatedNodes(new org.openide.nodes.Node[] {ourNode});
    editor.setIcon(ourNode.getIcon (java.beans.BeanInfo.ICON_COLOR_16x16));
    NodeListener nl = new DataNodeListener(editor);
    ourNode.addNodeListener(org.openide.nodes.NodeOp.weakNodeListener (nl, ourNode));
    nodeL = nl;
  }
}

相关文章

微信公众号

最新文章

更多