当前位置: 首页>>代码示例>>Java>>正文


Java NodeChangeEvent类代码示例

本文整理汇总了Java中java.util.prefs.NodeChangeEvent的典型用法代码示例。如果您正苦于以下问题:Java NodeChangeEvent类的具体用法?Java NodeChangeEvent怎么用?Java NodeChangeEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NodeChangeEvent类属于java.util.prefs包,在下文中一共展示了NodeChangeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的java.util.prefs.NodeChangeEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。