本文整理匯總了Java中org.openide.nodes.Node.removeNodeListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.removeNodeListener方法的具體用法?Java Node.removeNodeListener怎麽用?Java Node.removeNodeListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openide.nodes.Node
的用法示例。
在下文中一共展示了Node.removeNodeListener方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: detach
import org.openide.nodes.Node; //導入方法依賴的package包/類
public Node detach() {
Node n = currNode;
if (n != null) {
if (PropUtils.isLoggable(PropertySheet.class)) {
PropUtils.log(PropertySheet.class, "Detaching listeners from " + n);
}
n.removePropertyChangeListener(inner);
n.removeNodeListener(this);
//clear the reference
currNode = null;
}
return n;
}
示例2: nodeDestroyed
import org.openide.nodes.Node; //導入方法依賴的package包/類
/** Fired when the node is deleted.
* @param ev event describing the node
*/
@Override
public void nodeDestroyed(NodeEvent ev) {
Node destroyedNode = ev.getNode();
// stop to listen to destroyed node
destroyedNode.removeNodeListener(this);
listenerSet.remove(destroyedNode);
// close top component (our outer class) if last node was destroyed
if (listenerSet.isEmpty()) {
// #68943 - stop to listen, as we are waving goodbye :-)
tc.removePropertyChangeListener(this);
Mutex.EVENT.readAccess(new Runnable() {
@Override
public void run() {
if (dialog != null) {
dialog.setVisible(false);
dialog.dispose();
dialog = null;
}
}
});
}
}
示例3: detachListeners
import org.openide.nodes.Node; //導入方法依賴的package包/類
/** Removes itself as a listener from given nodes */
void detachListeners(List<Reference<Node>> nodes) {
if (nodes == null) {
return;
}
Iterator<Reference<Node>> it = nodes.iterator();
while (it.hasNext()) {
Node node = it.next().get();
if (node != null) {
node.removeNodeListener(listener);
}
}
}
示例4: setRootContext
import org.openide.nodes.Node; //導入方法依賴的package包/類
/** Sets new root context to view. Name, icon, tooltip
* of this top component will be updated properly */
public void setRootContext (Node rc) {
Node oldRC = getExplorerManager().getRootContext();
// remove old listener, if possible
if (weakRcL != null) {
oldRC.removePropertyChangeListener(weakRcL);
}
if (weakNRcL != null) {
oldRC.removeNodeListener(weakNRcL);
}
getExplorerManager().setRootContext(rc);
}
示例5: setRootContext
import org.openide.nodes.Node; //導入方法依賴的package包/類
/** Sets new root context to view. Name, tooltip
* of this top component will be updated properly */
public void setRootContext (Node rc) {
Node oldRC = getExplorerManager().getRootContext();
// remove old listener, if possible
if (weakRcL != null) {
oldRC.removePropertyChangeListener(weakRcL);
}
if (weakNRcL != null) {
oldRC.removeNodeListener(weakNRcL);
}
getExplorerManager().setRootContext(rc);
initializeWithRootContext(rc);
}
示例6: removeChildAdditionListener
import org.openide.nodes.Node; //導入方法依賴的package包/類
private void removeChildAdditionListener(Node removedNode) {
for (Node n : removedNode.getChildren().getNodes(true)) {
removeChildAdditionListener(n);
}
removedNode.removeNodeListener(resultsNodeAdditionListener);
}
示例7: testLastModifiedOrderUpdatedAfterFileIsTouched
import org.openide.nodes.Node; //導入方法依賴的package包/類
public void testLastModifiedOrderUpdatedAfterFileIsTouched() throws Exception {
aa.setSortMode(DataFolder.SortMode.LAST_MODIFIED);
Node n = aa.getNodeDelegate().cloneNode();
Node[] nodes = n.getChildren().getNodes(true);
assertEquals ("Two nodes", 2, nodes.length);
waitEvents();
assertEquals("Sort mode not changed and children not refreshed: " + events, 2, events.size());
assertTrue(DataFolder.PROP_SORT_MODE + " change not fired", events.contains(DataFolder.PROP_SORT_MODE));
assertTrue(DataFolder.PROP_CHILDREN + " change not fired", events.contains(DataFolder.PROP_CHILDREN));
assertEquals("Y.txt", nodes[0].getName()); // Y is newer
assertEquals("X.txt", nodes[1].getName()); // X is older
events.clear();
final FileObject orig = lfs.findResource("AA/Y.txt");
final FileObject touch = lfs.findResource("AA/X.txt");
// After touching, X.txt will be newer than Y.txt.
TestFileUtils.touch(FileUtil.toFile(touch), FileUtil.toFile(orig));
// It's not enough to wait only for DataFolder event
// because of number of RP tasks run before node children are updated
// must wait for reorder fired by node itself.
final CountDownLatch barrier = new CountDownLatch(1);
NodeListener nodeList = new NodeAdapter() {
@Override
public void childrenReordered (NodeReorderEvent ev) {
barrier.countDown();
}
};
n.addNodeListener(nodeList);
try {
touch.refresh();
waitEvents();
// wait for node reorder event
barrier.await(10, TimeUnit.SECONDS);
} finally {
n.removeNodeListener(nodeList);
}
assertEquals(0, barrier.getCount());
assertTrue(DataFolder.PROP_CHILDREN + " change not fired", events.contains(DataFolder.PROP_CHILDREN));
Node[] newNodes = n.getChildren().getNodes(true);
assertEquals("Node " + nodes[1].getName() + " expected first.", newNodes[0], nodes[1]);
assertEquals("Node " + nodes[0].getName() + " expected second.", newNodes[1], nodes[0]);
}