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

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

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

  1. /** Attach itself as a listener to the given nodes */
  2. private void attachListeners(List<Reference<Node>> nodes) {
  3. if (nodes != null) {
  4. Iterator<Reference<Node>> it = nodes.iterator();
  5. while (it.hasNext()) {
  6. Node node = it.next().get();
  7. if (node != null) {
  8. node.addNodeListener(listener);
  9. }
  10. }
  11. }
  12. }

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

  1. /** Attach itself as a listener to the given nodes */
  2. void attachListeners(List<Reference<Node>> nodes) {
  3. Iterator<Reference<Node>> it = nodes.iterator();
  4. while (it.hasNext()) {
  5. Node node = it.next().get();
  6. if (node != null) {
  7. node.addNodeListener(listener);
  8. }
  9. }
  10. }

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

  1. /** Getter for node listener.
  2. */
  3. synchronized NodeListener getNodeListener() {
  4. if (nodeL == null) {
  5. nodeL = createNodeListener();
  6. getOriginal().addNodeListener(nodeL);
  7. }
  8. return nodeL;
  9. }

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

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

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

  1. /** Creates a node representant for given bean. Uses factory
  2. * to get the node.
  3. * @param subbean the bean from bean context
  4. * @return node created by the factory
  5. */
  6. protected Node[] createNodes(Object subbean) {
  7. try {
  8. if (subbean instanceof BeanContextSupport) {
  9. BeanContextSupport bcs = (BeanContextSupport) subbean;
  10. if (bean.contains(bcs.getBeanContextPeer()) && (bcs != bcs.getBeanContextPeer())) {
  11. // sometimes a BeanContextSupport occures in the list of
  12. // beans children even there is its peer. we think that
  13. // it is desirable to hide the context if the peer is
  14. // also present
  15. return new Node[0];
  16. }
  17. }
  18. Node n = factory.createNode(subbean);
  19. // #7925: deleting from BeanChildren has no effect
  20. synchronized (nodes2Beans) {
  21. nodes2Beans.put(n, new Reference[] { new WeakReference<BeanContext>(bean), new WeakReference<Object>(subbean) });
  22. }
  23. n.addNodeListener(contextL);
  24. return new Node[] { n };
  25. } catch (IntrospectionException ex) {
  26. Logger.getLogger(BeanChildren.class.getName()).log(Level.WARNING, null, ex);
  27. return new Node[0];
  28. }
  29. }

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

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

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

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

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

  1. /** Attach itself as a listener to the given nodes */
  2. private void attachListeners (List nodes) {
  3. if (nodes != null){
  4. Iterator it = nodes.iterator();
  5. while (it.hasNext()) {
  6. Node node = (Node)((Reference)it.next()).get ();
  7. if (node != null)
  8. node.addNodeListener(listener);
  9. }
  10. }
  11. }
  12. } // end of CookieDelegateAction

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

  1. /** Check whether the node has not been updated.
  2. */
  3. private void updateNode (Node n) {
  4. if (current != null && current.get () == n) {
  5. return;
  6. }
  7. if (current != null && current.get () != null) {
  8. ((Node)current.get ()).removeNodeListener (listener);
  9. }
  10. n.addNodeListener (listener);
  11. current = new WeakReference (n);
  12. }

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

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

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

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

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

  1. /** Getter for node listener.
  2. */
  3. synchronized NodeListener getNodeListener () {
  4. if (nodeL == null) {
  5. nodeL = createNodeListener ();
  6. getOriginal().addNodeListener(nodeL);
  7. }
  8. return nodeL;
  9. }

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

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

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

  1. /** Getter for node listener.
  2. */
  3. synchronized NodeListener getNodeListener () {
  4. if (nodeL == null) {
  5. nodeL = createNodeListener ();
  6. getOriginal().addNodeListener(nodeL);
  7. }
  8. return nodeL;
  9. }

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

  1. @Override
  2. public void addNotify() {
  3. super.addNotify();
  4. for (NodeListener listener : listeners) {
  5. getExplorerManager().getRootContext().addNodeListener(listener);
  6. }
  7. listeners.clear();
  8. }

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

  1. this.original.addNodeListener(getNodeListener());

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

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

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

  1. ProxyNode(Node... original) {
  2. super(Children.LEAF);
  3. this.original = original;
  4. nl = new NodeAdapterImpl(true);
  5. pcl = new NodeAdapterImpl(false);
  6. for (int i = 0; i < original.length; i++) {
  7. original[i].addPropertyChangeListener(org.openide.util.WeakListeners.propertyChange(pcl, original[i]));
  8. original[i].addNodeListener(
  9. org.openide.util.WeakListeners.create(NodeListener.class, nl, original[i])
  10. );
  11. }
  12. }

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

  1. @Override
  2. public void addNotify() {
  3. super.addNotify();
  4. getExplorerManager().getRootContext().addNodeListener(rootNodeListener);
  5. getExplorerManager().addPropertyChangeListener(selectionListener);
  6. }

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

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

相关文章