类java.beans.VetoableChangeListenerProxy源码实例Demo

下面列出了怎么用java.beans.VetoableChangeListenerProxy的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dragonwell8_jdk   文件: TestSerialization.java
private static void check(VetoableChangeListener listener, int index, String name) {
    if (!(listener instanceof VetoableChangeListenerProxy))
        throw new Error("Unexpected listener: " + listener);

    VetoableChangeListenerProxy object = (VetoableChangeListenerProxy)listener;
    if (!name.equals(object.getPropertyName()))
        throw new Error("Unexpected name: " + name + " != " + object.getPropertyName());

    check((VetoableChangeListener)object.getListener(), index);
}
 
源代码2 项目: TencentKona-8   文件: TestSerialization.java
private static void check(VetoableChangeListener listener, int index, String name) {
    if (!(listener instanceof VetoableChangeListenerProxy))
        throw new Error("Unexpected listener: " + listener);

    VetoableChangeListenerProxy object = (VetoableChangeListenerProxy)listener;
    if (!name.equals(object.getPropertyName()))
        throw new Error("Unexpected name: " + name + " != " + object.getPropertyName());

    check((VetoableChangeListener)object.getListener(), index);
}
 
源代码3 项目: jdk8u60   文件: TestSerialization.java
private static void check(VetoableChangeListener listener, int index, String name) {
    if (!(listener instanceof VetoableChangeListenerProxy))
        throw new Error("Unexpected listener: " + listener);

    VetoableChangeListenerProxy object = (VetoableChangeListenerProxy)listener;
    if (!name.equals(object.getPropertyName()))
        throw new Error("Unexpected name: " + name + " != " + object.getPropertyName());

    check((VetoableChangeListener)object.getListener(), index);
}
 
源代码4 项目: openjdk-jdk8u   文件: TestSerialization.java
private static void check(VetoableChangeListener listener, int index, String name) {
    if (!(listener instanceof VetoableChangeListenerProxy))
        throw new Error("Unexpected listener: " + listener);

    VetoableChangeListenerProxy object = (VetoableChangeListenerProxy)listener;
    if (!name.equals(object.getPropertyName()))
        throw new Error("Unexpected name: " + name + " != " + object.getPropertyName());

    check((VetoableChangeListener)object.getListener(), index);
}
 
源代码5 项目: openjdk-jdk8u-backup   文件: TestSerialization.java
private static void check(VetoableChangeListener listener, int index, String name) {
    if (!(listener instanceof VetoableChangeListenerProxy))
        throw new Error("Unexpected listener: " + listener);

    VetoableChangeListenerProxy object = (VetoableChangeListenerProxy)listener;
    if (!name.equals(object.getPropertyName()))
        throw new Error("Unexpected name: " + name + " != " + object.getPropertyName());

    check((VetoableChangeListener)object.getListener(), index);
}
 
源代码6 项目: openjdk-jdk9   文件: TestSerialization.java
private static void check(VetoableChangeListener listener, int index, String name) {
    if (!(listener instanceof VetoableChangeListenerProxy))
        throw new Error("Unexpected listener: " + listener);

    VetoableChangeListenerProxy object = (VetoableChangeListenerProxy)listener;
    if (!name.equals(object.getPropertyName()))
        throw new Error("Unexpected name: " + name + " != " + object.getPropertyName());

    check((VetoableChangeListener)object.getListener(), index);
}
 
源代码7 项目: jdk8u-jdk   文件: TestSerialization.java
private static void check(VetoableChangeListener listener, int index, String name) {
    if (!(listener instanceof VetoableChangeListenerProxy))
        throw new Error("Unexpected listener: " + listener);

    VetoableChangeListenerProxy object = (VetoableChangeListenerProxy)listener;
    if (!name.equals(object.getPropertyName()))
        throw new Error("Unexpected name: " + name + " != " + object.getPropertyName());

    check((VetoableChangeListener)object.getListener(), index);
}
 
源代码8 项目: hottub   文件: TestSerialization.java
private static void check(VetoableChangeListener listener, int index, String name) {
    if (!(listener instanceof VetoableChangeListenerProxy))
        throw new Error("Unexpected listener: " + listener);

    VetoableChangeListenerProxy object = (VetoableChangeListenerProxy)listener;
    if (!name.equals(object.getPropertyName()))
        throw new Error("Unexpected name: " + name + " != " + object.getPropertyName());

    check((VetoableChangeListener)object.getListener(), index);
}
 
源代码9 项目: openjdk-8-source   文件: TestSerialization.java
private static void check(VetoableChangeListener listener, int index, String name) {
    if (!(listener instanceof VetoableChangeListenerProxy))
        throw new Error("Unexpected listener: " + listener);

    VetoableChangeListenerProxy object = (VetoableChangeListenerProxy)listener;
    if (!name.equals(object.getPropertyName()))
        throw new Error("Unexpected name: " + name + " != " + object.getPropertyName());

    check((VetoableChangeListener)object.getListener(), index);
}
 
源代码10 项目: openjdk-8   文件: TestSerialization.java
private static void check(VetoableChangeListener listener, int index, String name) {
    if (!(listener instanceof VetoableChangeListenerProxy))
        throw new Error("Unexpected listener: " + listener);

    VetoableChangeListenerProxy object = (VetoableChangeListenerProxy)listener;
    if (!name.equals(object.getPropertyName()))
        throw new Error("Unexpected name: " + name + " != " + object.getPropertyName());

    check((VetoableChangeListener)object.getListener(), index);
}
 
源代码11 项目: jdk8u_jdk   文件: TestSerialization.java
private static void check(VetoableChangeListener listener, int index, String name) {
    if (!(listener instanceof VetoableChangeListenerProxy))
        throw new Error("Unexpected listener: " + listener);

    VetoableChangeListenerProxy object = (VetoableChangeListenerProxy)listener;
    if (!name.equals(object.getPropertyName()))
        throw new Error("Unexpected name: " + name + " != " + object.getPropertyName());

    check((VetoableChangeListener)object.getListener(), index);
}
 
源代码12 项目: jdk8u-jdk   文件: TestSerialization.java
private static void check(VetoableChangeListener listener, int index, String name) {
    if (!(listener instanceof VetoableChangeListenerProxy))
        throw new Error("Unexpected listener: " + listener);

    VetoableChangeListenerProxy object = (VetoableChangeListenerProxy)listener;
    if (!name.equals(object.getPropertyName()))
        throw new Error("Unexpected name: " + name + " != " + object.getPropertyName());

    check((VetoableChangeListener)object.getListener(), index);
}
 
源代码13 项目: jdk8u-dev-jdk   文件: TestSerialization.java
private static void check(VetoableChangeListener listener, int index, String name) {
    if (!(listener instanceof VetoableChangeListenerProxy))
        throw new Error("Unexpected listener: " + listener);

    VetoableChangeListenerProxy object = (VetoableChangeListenerProxy)listener;
    if (!name.equals(object.getPropertyName()))
        throw new Error("Unexpected name: " + name + " != " + object.getPropertyName());

    check((VetoableChangeListener)object.getListener(), index);
}
 
源代码14 项目: dragonwell8_jdk   文件: TestListeners.java
public static void main(String[] args) throws PropertyVetoException {
    VetoableChangeSupport vcs = new VetoableChangeSupport(TestListeners.class);
    vcs.addVetoableChangeListener(new TestListeners(0));
    vcs.addVetoableChangeListener(NAME, new TestListeners(2));
    vcs.addVetoableChangeListener(new TestListeners(1));
    vcs.addVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));


    current = 0;
    vcs.fireVetoableChange(NAME, 0, 1);
    if (current != 4)
        throw new Error("Expected 4 listeners, but called " + current);

    current = 0;
    vcs.fireVetoableChange(NONE, 1, 0);
    if (current != 2)
        throw new Error("Expected 2 listeners, but called " + current);


    VetoableChangeListener[] all = vcs.getVetoableChangeListeners();
    if (all.length != 4)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    VetoableChangeListener[] named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 2)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    VetoableChangeListener[] other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);

    vcs.removeVetoableChangeListener(new TestListeners(0));
    vcs.removeVetoableChangeListener(new TestListeners(1));
    vcs.removeVetoableChangeListener(NAME, new TestListeners(2));
    vcs.removeVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));

    all = vcs.getVetoableChangeListeners();
    if (all.length != 0)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 0)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);
}
 
源代码15 项目: dragonwell8_jdk   文件: Test4994635.java
public static void main(String[] args) {
    Test4994635 test = new Test4994635();
    test.vcs.addVetoableChangeListener(
            new VetoableChangeListenerProxy("property", test));
}
 
源代码16 项目: TencentKona-8   文件: TestListeners.java
public static void main(String[] args) throws PropertyVetoException {
    VetoableChangeSupport vcs = new VetoableChangeSupport(TestListeners.class);
    vcs.addVetoableChangeListener(new TestListeners(0));
    vcs.addVetoableChangeListener(NAME, new TestListeners(2));
    vcs.addVetoableChangeListener(new TestListeners(1));
    vcs.addVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));


    current = 0;
    vcs.fireVetoableChange(NAME, 0, 1);
    if (current != 4)
        throw new Error("Expected 4 listeners, but called " + current);

    current = 0;
    vcs.fireVetoableChange(NONE, 1, 0);
    if (current != 2)
        throw new Error("Expected 2 listeners, but called " + current);


    VetoableChangeListener[] all = vcs.getVetoableChangeListeners();
    if (all.length != 4)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    VetoableChangeListener[] named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 2)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    VetoableChangeListener[] other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);

    vcs.removeVetoableChangeListener(new TestListeners(0));
    vcs.removeVetoableChangeListener(new TestListeners(1));
    vcs.removeVetoableChangeListener(NAME, new TestListeners(2));
    vcs.removeVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));

    all = vcs.getVetoableChangeListeners();
    if (all.length != 0)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 0)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);
}
 
源代码17 项目: TencentKona-8   文件: Test4994635.java
public static void main(String[] args) {
    Test4994635 test = new Test4994635();
    test.vcs.addVetoableChangeListener(
            new VetoableChangeListenerProxy("property", test));
}
 
源代码18 项目: jdk8u60   文件: TestListeners.java
public static void main(String[] args) throws PropertyVetoException {
    VetoableChangeSupport vcs = new VetoableChangeSupport(TestListeners.class);
    vcs.addVetoableChangeListener(new TestListeners(0));
    vcs.addVetoableChangeListener(NAME, new TestListeners(2));
    vcs.addVetoableChangeListener(new TestListeners(1));
    vcs.addVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));


    current = 0;
    vcs.fireVetoableChange(NAME, 0, 1);
    if (current != 4)
        throw new Error("Expected 4 listeners, but called " + current);

    current = 0;
    vcs.fireVetoableChange(NONE, 1, 0);
    if (current != 2)
        throw new Error("Expected 2 listeners, but called " + current);


    VetoableChangeListener[] all = vcs.getVetoableChangeListeners();
    if (all.length != 4)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    VetoableChangeListener[] named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 2)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    VetoableChangeListener[] other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);

    vcs.removeVetoableChangeListener(new TestListeners(0));
    vcs.removeVetoableChangeListener(new TestListeners(1));
    vcs.removeVetoableChangeListener(NAME, new TestListeners(2));
    vcs.removeVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));

    all = vcs.getVetoableChangeListeners();
    if (all.length != 0)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 0)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);
}
 
源代码19 项目: jdk8u60   文件: Test4994635.java
public static void main(String[] args) {
    Test4994635 test = new Test4994635();
    test.vcs.addVetoableChangeListener(
            new VetoableChangeListenerProxy("property", test));
}
 
源代码20 项目: openjdk-jdk8u   文件: TestListeners.java
public static void main(String[] args) throws PropertyVetoException {
    VetoableChangeSupport vcs = new VetoableChangeSupport(TestListeners.class);
    vcs.addVetoableChangeListener(new TestListeners(0));
    vcs.addVetoableChangeListener(NAME, new TestListeners(2));
    vcs.addVetoableChangeListener(new TestListeners(1));
    vcs.addVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));


    current = 0;
    vcs.fireVetoableChange(NAME, 0, 1);
    if (current != 4)
        throw new Error("Expected 4 listeners, but called " + current);

    current = 0;
    vcs.fireVetoableChange(NONE, 1, 0);
    if (current != 2)
        throw new Error("Expected 2 listeners, but called " + current);


    VetoableChangeListener[] all = vcs.getVetoableChangeListeners();
    if (all.length != 4)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    VetoableChangeListener[] named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 2)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    VetoableChangeListener[] other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);

    vcs.removeVetoableChangeListener(new TestListeners(0));
    vcs.removeVetoableChangeListener(new TestListeners(1));
    vcs.removeVetoableChangeListener(NAME, new TestListeners(2));
    vcs.removeVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));

    all = vcs.getVetoableChangeListeners();
    if (all.length != 0)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 0)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);
}
 
源代码21 项目: openjdk-jdk8u   文件: Test4994635.java
public static void main(String[] args) {
    Test4994635 test = new Test4994635();
    test.vcs.addVetoableChangeListener(
            new VetoableChangeListenerProxy("property", test));
}
 
源代码22 项目: openjdk-jdk8u-backup   文件: TestListeners.java
public static void main(String[] args) throws PropertyVetoException {
    VetoableChangeSupport vcs = new VetoableChangeSupport(TestListeners.class);
    vcs.addVetoableChangeListener(new TestListeners(0));
    vcs.addVetoableChangeListener(NAME, new TestListeners(2));
    vcs.addVetoableChangeListener(new TestListeners(1));
    vcs.addVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));


    current = 0;
    vcs.fireVetoableChange(NAME, 0, 1);
    if (current != 4)
        throw new Error("Expected 4 listeners, but called " + current);

    current = 0;
    vcs.fireVetoableChange(NONE, 1, 0);
    if (current != 2)
        throw new Error("Expected 2 listeners, but called " + current);


    VetoableChangeListener[] all = vcs.getVetoableChangeListeners();
    if (all.length != 4)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    VetoableChangeListener[] named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 2)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    VetoableChangeListener[] other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);

    vcs.removeVetoableChangeListener(new TestListeners(0));
    vcs.removeVetoableChangeListener(new TestListeners(1));
    vcs.removeVetoableChangeListener(NAME, new TestListeners(2));
    vcs.removeVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));

    all = vcs.getVetoableChangeListeners();
    if (all.length != 0)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 0)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);
}
 
源代码23 项目: openjdk-jdk8u-backup   文件: Test4994635.java
public static void main(String[] args) {
    Test4994635 test = new Test4994635();
    test.vcs.addVetoableChangeListener(
            new VetoableChangeListenerProxy("property", test));
}
 
源代码24 项目: openjdk-jdk9   文件: TestListeners.java
public static void main(String[] args) throws PropertyVetoException {
    VetoableChangeSupport vcs = new VetoableChangeSupport(TestListeners.class);
    vcs.addVetoableChangeListener(new TestListeners(0));
    vcs.addVetoableChangeListener(NAME, new TestListeners(2));
    vcs.addVetoableChangeListener(new TestListeners(1));
    vcs.addVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));


    current = 0;
    vcs.fireVetoableChange(NAME, 0, 1);
    if (current != 4)
        throw new Error("Expected 4 listeners, but called " + current);

    current = 0;
    vcs.fireVetoableChange(NONE, 1, 0);
    if (current != 2)
        throw new Error("Expected 2 listeners, but called " + current);


    VetoableChangeListener[] all = vcs.getVetoableChangeListeners();
    if (all.length != 4)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    VetoableChangeListener[] named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 2)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    VetoableChangeListener[] other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);

    vcs.removeVetoableChangeListener(new TestListeners(0));
    vcs.removeVetoableChangeListener(new TestListeners(1));
    vcs.removeVetoableChangeListener(NAME, new TestListeners(2));
    vcs.removeVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));

    all = vcs.getVetoableChangeListeners();
    if (all.length != 0)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 0)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);
}
 
源代码25 项目: openjdk-jdk9   文件: Test4994635.java
public static void main(String[] args) {
    Test4994635 test = new Test4994635();
    test.vcs.addVetoableChangeListener(
            new VetoableChangeListenerProxy("property", test));
}
 
源代码26 项目: jdk8u-jdk   文件: TestListeners.java
public static void main(String[] args) throws PropertyVetoException {
    VetoableChangeSupport vcs = new VetoableChangeSupport(TestListeners.class);
    vcs.addVetoableChangeListener(new TestListeners(0));
    vcs.addVetoableChangeListener(NAME, new TestListeners(2));
    vcs.addVetoableChangeListener(new TestListeners(1));
    vcs.addVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));


    current = 0;
    vcs.fireVetoableChange(NAME, 0, 1);
    if (current != 4)
        throw new Error("Expected 4 listeners, but called " + current);

    current = 0;
    vcs.fireVetoableChange(NONE, 1, 0);
    if (current != 2)
        throw new Error("Expected 2 listeners, but called " + current);


    VetoableChangeListener[] all = vcs.getVetoableChangeListeners();
    if (all.length != 4)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    VetoableChangeListener[] named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 2)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    VetoableChangeListener[] other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);

    vcs.removeVetoableChangeListener(new TestListeners(0));
    vcs.removeVetoableChangeListener(new TestListeners(1));
    vcs.removeVetoableChangeListener(NAME, new TestListeners(2));
    vcs.removeVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));

    all = vcs.getVetoableChangeListeners();
    if (all.length != 0)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 0)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);
}
 
源代码27 项目: jdk8u-jdk   文件: Test4994635.java
public static void main(String[] args) {
    Test4994635 test = new Test4994635();
    test.vcs.addVetoableChangeListener(
            new VetoableChangeListenerProxy("property", test));
}
 
源代码28 项目: hottub   文件: TestListeners.java
public static void main(String[] args) throws PropertyVetoException {
    VetoableChangeSupport vcs = new VetoableChangeSupport(TestListeners.class);
    vcs.addVetoableChangeListener(new TestListeners(0));
    vcs.addVetoableChangeListener(NAME, new TestListeners(2));
    vcs.addVetoableChangeListener(new TestListeners(1));
    vcs.addVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));


    current = 0;
    vcs.fireVetoableChange(NAME, 0, 1);
    if (current != 4)
        throw new Error("Expected 4 listeners, but called " + current);

    current = 0;
    vcs.fireVetoableChange(NONE, 1, 0);
    if (current != 2)
        throw new Error("Expected 2 listeners, but called " + current);


    VetoableChangeListener[] all = vcs.getVetoableChangeListeners();
    if (all.length != 4)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    VetoableChangeListener[] named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 2)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    VetoableChangeListener[] other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);

    vcs.removeVetoableChangeListener(new TestListeners(0));
    vcs.removeVetoableChangeListener(new TestListeners(1));
    vcs.removeVetoableChangeListener(NAME, new TestListeners(2));
    vcs.removeVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));

    all = vcs.getVetoableChangeListeners();
    if (all.length != 0)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 0)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);
}
 
源代码29 项目: hottub   文件: Test4994635.java
public static void main(String[] args) {
    Test4994635 test = new Test4994635();
    test.vcs.addVetoableChangeListener(
            new VetoableChangeListenerProxy("property", test));
}
 
源代码30 项目: openjdk-8-source   文件: TestListeners.java
public static void main(String[] args) throws PropertyVetoException {
    VetoableChangeSupport vcs = new VetoableChangeSupport(TestListeners.class);
    vcs.addVetoableChangeListener(new TestListeners(0));
    vcs.addVetoableChangeListener(NAME, new TestListeners(2));
    vcs.addVetoableChangeListener(new TestListeners(1));
    vcs.addVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));


    current = 0;
    vcs.fireVetoableChange(NAME, 0, 1);
    if (current != 4)
        throw new Error("Expected 4 listeners, but called " + current);

    current = 0;
    vcs.fireVetoableChange(NONE, 1, 0);
    if (current != 2)
        throw new Error("Expected 2 listeners, but called " + current);


    VetoableChangeListener[] all = vcs.getVetoableChangeListeners();
    if (all.length != 4)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    VetoableChangeListener[] named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 2)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    VetoableChangeListener[] other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);

    vcs.removeVetoableChangeListener(new TestListeners(0));
    vcs.removeVetoableChangeListener(new TestListeners(1));
    vcs.removeVetoableChangeListener(NAME, new TestListeners(2));
    vcs.removeVetoableChangeListener(NAME, new VetoableChangeListenerProxy(NAME, new TestListeners(3)));

    all = vcs.getVetoableChangeListeners();
    if (all.length != 0)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    named = vcs.getVetoableChangeListeners(NAME);
    if (named.length != 0)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    other = vcs.getVetoableChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);
}
 
 类所在包
 类方法
 同包方法