本文整理汇总了Java中java.util.prefs.NodeChangeEvent类的典型用法代码示例。如果您正苦于以下问题:Java NodeChangeEvent类的具体用法?Java NodeChangeEvent怎么用?Java NodeChangeEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NodeChangeEvent类属于java.util.prefs包,在下文中一共展示了NodeChangeEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: fireNodeEvents
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
private void fireNodeEvents(List<EventBag<NodeChangeListener, NodeChangeEvent>> events) {
if (noEvents) {
return;
}
for(EventBag<NodeChangeListener, NodeChangeEvent> bag : events) {
for(NodeChangeEvent event : bag.getEvents()) {
for(NodeChangeListener l : bag.getListeners()) {
try {
if ((event instanceof NodeChangeEventExt) && ((NodeChangeEventExt) event).isRemovalEvent()) {
l.childRemoved(event);
} else {
l.childAdded(event);
}
} catch (Throwable t) {
LOG.log(Level.WARNING, null, t);
}
}
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:ProxyPreferencesImpl.java
示例2: testNodeAdded
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
protected ScheduledFuture<?> testNodeAdded(final NodeChangeListener listener,
final Preferences parent, final String childName, final int count) {
final ArgumentCaptor<NodeChangeEvent> captor = ArgumentCaptor.forClass(NodeChangeEvent.class);
final Runnable task = new Runnable() {
@Override public void run() {
verify(listener, times(count)).childAdded(captor.capture());
final NodeChangeEvent event = captor.getValue();
assertEquals(event.getParent(), parent);
assertEquals(event.getChild().name(), childName);
}
};
return schedule(task);
}
开发者ID:adobe-research,项目名称:cross-preferences,代码行数:17,代码来源:PreferencesTestSupport.java
示例3: testNodeRemoved
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
protected ScheduledFuture<?> testNodeRemoved(final NodeChangeListener listener,
final Preferences parent, final String childName, final int count) {
final ArgumentCaptor<NodeChangeEvent> captor = ArgumentCaptor.forClass(NodeChangeEvent.class);
final Runnable task = new Runnable() {
@Override public void run() {
verify(listener, times(count)).childRemoved(captor.capture());
final NodeChangeEvent event = captor.getValue();
assertEquals(event.getParent(), parent);
assertEquals(event.getChild().name(), childName);
}
};
return schedule(task);
}
开发者ID:adobe-research,项目名称:cross-preferences,代码行数:18,代码来源:PreferencesTestSupport.java
示例4: testSerialization
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Verifies serialization",
method = "!Serialization",
args = {}
)
public void testSerialization() throws Exception {
event = new NodeChangeEvent(Preferences.systemRoot(), null);
try {
SerializationTest.copySerializable(event);
fail("No expected NotSerializableException");
} catch (NotSerializableException e) {
}
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:17,代码来源:NodeChangeEventTest.java
示例5: sync
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
@Override
public void sync() throws BackingStoreException {
ArrayList<EventBag<PreferenceChangeListener, PreferenceChangeEvent>> prefEvents = new ArrayList<EventBag<PreferenceChangeListener, PreferenceChangeEvent>>();
ArrayList<EventBag<NodeChangeListener, NodeChangeEvent>> nodeEvents = new ArrayList<EventBag<NodeChangeListener, NodeChangeEvent>>();
synchronized (tree.treeLock()) {
_sync(prefEvents, nodeEvents);
}
fireNodeEvents(nodeEvents);
firePrefEvents(prefEvents);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:ProxyPreferencesImpl.java
示例6: testConstructor
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "NodeChangeEvent",
args = {java.util.prefs.Preferences.class, java.util.prefs.Preferences.class}
)
public void testConstructor() {
event = new NodeChangeEvent(Preferences.systemRoot(), Preferences
.userRoot());
assertSame(Preferences.systemRoot(), event.getParent());
assertSame(Preferences.userRoot(), event.getChild());
assertSame(Preferences.systemRoot(), event.getSource());
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:14,代码来源:NodeChangeEventTest.java
示例7: testChildAdded
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Testing Interface",
method = "childAdded",
args = {java.util.prefs.NodeChangeEvent.class}
)
public void testChildAdded() {
l.childAdded(new NodeChangeEvent(Preferences.userRoot(), Preferences
.userRoot()));
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:11,代码来源:NodeChangeListenerTest.java
示例8: testChildRemoved
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "Testing Interface",
method = "childRemoved",
args = {java.util.prefs.NodeChangeEvent.class}
)
public void testChildRemoved() {
l.childRemoved(new NodeChangeEvent(Preferences.userRoot(), Preferences
.userRoot()));
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:11,代码来源:NodeChangeListenerTest.java
示例9: childAdded
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
public void childAdded(NodeChangeEvent e) {
synchronized (addLock) {
switch (testNum) {
case TEST_GET_CHILD:
Preferences child = e.getChild();
if (child == null) {
addResult = false;
} else {
if (child.name() == "mock1") {
addResult = true;
}
}
break;
case TEST_GET_PARENT:
Preferences parent = e.getParent();
if (parent == null) {
addResult = false;
} else {
if (parent.name() == "mock") {
addResult = true;
}
}
break;
}
++added;
addLock.notifyAll();
}
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:31,代码来源:MockNodeChangeListener.java
示例10: childRemoved
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
public void childRemoved(NodeChangeEvent e) {
synchronized (removeLock) {
switch (testNum) {
case TEST_GET_CHILD:
Preferences child = e.getChild();
if (child == null) {
removeResult = false;
} else {
if (child.name() == "mock1") {
removeResult = true;
}
}
break;
case TEST_GET_PARENT:
Preferences parent = e.getParent();
if (parent == null) {
addResult = false;
} else {
if (parent.name() == "mock") {
addResult = true;
}
}
break;
}
removed++;
removeLock.notifyAll();
}
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:30,代码来源:MockNodeChangeListener.java
示例11: testConstructor
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
public void testConstructor() {
event = new NodeChangeEvent(Preferences.systemRoot(), Preferences
.userRoot());
assertSame(Preferences.systemRoot(), event.getParent());
assertSame(Preferences.userRoot(), event.getChild());
assertSame(Preferences.systemRoot(), event.getSource());
}
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:NodeChangeEventTest.java
示例12: testSerialization
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
public void testSerialization() throws Exception {
event = new NodeChangeEvent(Preferences.systemRoot(), null);
try {
SerializationTest.copySerializable(event);
fail("No expected NotSerializableException");
} catch (NotSerializableException e) {
}
}
开发者ID:shannah,项目名称:cn1,代码行数:11,代码来源:NodeChangeEventTest.java
示例13: childAdded
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
public void childAdded(NodeChangeEvent e) {
synchronized (addLock) {
++added;
addDispatched = true;
addLock.notifyAll();
}
}
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:AbstractPreferencesTest.java
示例14: childRemoved
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
public void childRemoved(NodeChangeEvent e) {
synchronized (removeLock) {
removed++;
removeDispatched = true;
removeLock.notifyAll();
}
}
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:AbstractPreferencesTest.java
示例15: childAdded
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
public void childAdded(NodeChangeEvent e) {
synchronized (addLock) {
++added;
addDispatched = true;
addLock.notifyAll();
}
}
开发者ID:freeVM,项目名称:freeVM,代码行数:8,代码来源:AbstractPreferencesTest.java
示例16: childRemoved
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
public void childRemoved(NodeChangeEvent e) {
synchronized (removeLock) {
removed++;
removeDispatched = true;
removeLock.notifyAll();
}
}
开发者ID:freeVM,项目名称:freeVM,代码行数:8,代码来源:AbstractPreferencesTest.java
示例17: node
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
private ProxyPreferencesImpl node(String pathName, boolean create, List<EventBag<NodeChangeListener, NodeChangeEvent>> events) {
if (pathName.length() > 0 && pathName.charAt(0) == '/') { //NOI18N
// absolute path, if this is not the root then find the root
// and pass the call to it
if (parent != null) {
Preferences root = this;
while (root.parent() != null) {
root = root.parent();
}
return ((ProxyPreferencesImpl) root).node(pathName, create, events);
} else {
// this is the root, change the pathName to a relative path and proceed
pathName = pathName.substring(1);
}
}
if (pathName.length() > 0) {
String childName;
String pathFromChild;
int idx = pathName.indexOf('/'); //NOI18N
if (idx != -1) {
childName = pathName.substring(0, idx);
pathFromChild = pathName.substring(idx + 1);
} else {
childName = pathName;
pathFromChild = null;
}
ProxyPreferencesImpl child = children.get(childName);
if (child == null) {
if (removedChildren.contains(childName) && !create) {
// this child has been removed
return null;
}
Preferences childDelegate = null;
try {
if (delegate != null && delegate.nodeExists(childName)) {
childDelegate = delegate.node(childName);
}
} catch (BackingStoreException bse) {
// ignore
}
if (childDelegate != null || create) {
child = tree.get(this, childName, childDelegate);
children.put(childName, child);
removedChildren.remove(childName);
// fire event if we really created the new child node
if (childDelegate == null) {
EventBag<NodeChangeListener, NodeChangeEvent> bag = new EventBag<NodeChangeListener, NodeChangeEvent>();
bag.addListeners(nodeListeners);
bag.addEvent(new NodeChangeEventExt(this, child, false));
events.add(bag);
}
} else {
// childDelegate == null && !create
return null;
}
} else {
assert !child.removed;
}
return pathFromChild != null ? child.node(pathFromChild, create, events) : child;
} else {
return this;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:71,代码来源:ProxyPreferencesImpl.java
示例18: childAdded
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
public void childAdded(NodeChangeEvent evt) {
try { callback.call(); } catch (Exception e) { /* ignore */ }
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:FormattingPanelController.java
示例19: childRemoved
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
public void childRemoved(NodeChangeEvent evt) {
try { callback.call(); } catch (Exception e) { /* ignore */ }
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:FormattingPanelController.java
示例20: childAdded
import java.util.prefs.NodeChangeEvent; //导入依赖的package包/类
public void childAdded(NodeChangeEvent e) {
}
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:3,代码来源:NodeChangeListenerTest.java
注:本文中的java.util.prefs.NodeChangeEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论