Java 类java.beans.VetoableChangeSupport 实例源码

项目:jdk8u-jdk    文件:Test6630275.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener(false);
    CheckListener second = new CheckListener(true);
    CheckListener third = new CheckListener(false);

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test6630275.class);
    vcs.addVetoableChangeListener(first);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, true, false);
    } catch (PropertyVetoException exception) {
        first.validate();
        second.validate();
        third.validate();
        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:jdk8u-jdk    文件:Test4425885.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener();
    VetoListener second = new VetoListener();
    CheckListener third = new CheckListener();

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test4425885.class);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, 0, 1);
    } catch (PropertyVetoException exception) {
        if (first.odd)
            throw new Error("no undo for the first listener", exception);

        if (third.odd)
            throw new Error("no undo for the third listener", exception);

        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:openjdk-jdk10    文件:Test6630275.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener(false);
    CheckListener second = new CheckListener(true);
    CheckListener third = new CheckListener(false);

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test6630275.class);
    vcs.addVetoableChangeListener(first);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, true, false);
    } catch (PropertyVetoException exception) {
        first.validate();
        second.validate();
        third.validate();
        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:openjdk-jdk10    文件:Test4425885.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener();
    VetoListener second = new VetoListener();
    CheckListener third = new CheckListener();

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test4425885.class);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, 0, 1);
    } catch (PropertyVetoException exception) {
        if (first.odd)
            throw new Error("no undo for the first listener", exception);

        if (third.odd)
            throw new Error("no undo for the third listener", exception);

        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:openjdk9    文件:Test6630275.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener(false);
    CheckListener second = new CheckListener(true);
    CheckListener third = new CheckListener(false);

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test6630275.class);
    vcs.addVetoableChangeListener(first);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, true, false);
    } catch (PropertyVetoException exception) {
        first.validate();
        second.validate();
        third.validate();
        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:openjdk9    文件:Test4425885.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener();
    VetoListener second = new VetoListener();
    CheckListener third = new CheckListener();

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test4425885.class);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, 0, 1);
    } catch (PropertyVetoException exception) {
        if (first.odd)
            throw new Error("no undo for the first listener", exception);

        if (third.odd)
            throw new Error("no undo for the third listener", exception);

        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:jdk8u_jdk    文件:Test6630275.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener(false);
    CheckListener second = new CheckListener(true);
    CheckListener third = new CheckListener(false);

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test6630275.class);
    vcs.addVetoableChangeListener(first);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, true, false);
    } catch (PropertyVetoException exception) {
        first.validate();
        second.validate();
        third.validate();
        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:jdk8u_jdk    文件:Test4425885.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener();
    VetoListener second = new VetoListener();
    CheckListener third = new CheckListener();

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test4425885.class);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, 0, 1);
    } catch (PropertyVetoException exception) {
        if (first.odd)
            throw new Error("no undo for the first listener", exception);

        if (third.odd)
            throw new Error("no undo for the third listener", exception);

        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:lookaside_java-1.8.0-openjdk    文件:Test6630275.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener(false);
    CheckListener second = new CheckListener(true);
    CheckListener third = new CheckListener(false);

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test6630275.class);
    vcs.addVetoableChangeListener(first);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, true, false);
    } catch (PropertyVetoException exception) {
        first.validate();
        second.validate();
        third.validate();
        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:lookaside_java-1.8.0-openjdk    文件:Test4425885.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener();
    VetoListener second = new VetoListener();
    CheckListener third = new CheckListener();

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test4425885.class);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, 0, 1);
    } catch (PropertyVetoException exception) {
        if (first.odd)
            throw new Error("no undo for the first listener", exception);

        if (third.odd)
            throw new Error("no undo for the third listener", exception);

        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:infobip-open-jdk-8    文件:Test6630275.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener(false);
    CheckListener second = new CheckListener(true);
    CheckListener third = new CheckListener(false);

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test6630275.class);
    vcs.addVetoableChangeListener(first);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, true, false);
    } catch (PropertyVetoException exception) {
        first.validate();
        second.validate();
        third.validate();
        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:infobip-open-jdk-8    文件:Test4425885.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener();
    VetoListener second = new VetoListener();
    CheckListener third = new CheckListener();

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test4425885.class);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, 0, 1);
    } catch (PropertyVetoException exception) {
        if (first.odd)
            throw new Error("no undo for the first listener", exception);

        if (third.odd)
            throw new Error("no undo for the third listener", exception);

        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:jdk8u-dev-jdk    文件:Test6630275.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener(false);
    CheckListener second = new CheckListener(true);
    CheckListener third = new CheckListener(false);

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test6630275.class);
    vcs.addVetoableChangeListener(first);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, true, false);
    } catch (PropertyVetoException exception) {
        first.validate();
        second.validate();
        third.validate();
        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:jdk8u-dev-jdk    文件:Test4425885.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener();
    VetoListener second = new VetoListener();
    CheckListener third = new CheckListener();

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test4425885.class);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, 0, 1);
    } catch (PropertyVetoException exception) {
        if (first.odd)
            throw new Error("no undo for the first listener", exception);

        if (third.odd)
            throw new Error("no undo for the third listener", exception);

        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:jdk7-jdk    文件:Test6630275.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener(false);
    CheckListener second = new CheckListener(true);
    CheckListener third = new CheckListener(false);

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test6630275.class);
    vcs.addVetoableChangeListener(first);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, true, false);
    } catch (PropertyVetoException exception) {
        first.validate();
        second.validate();
        third.validate();
        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:jdk7-jdk    文件:Test4425885.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener();
    VetoListener second = new VetoListener();
    CheckListener third = new CheckListener();

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test4425885.class);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, 0, 1);
    } catch (PropertyVetoException exception) {
        if (first.odd)
            throw new Error("no undo for the first listener", exception);

        if (third.odd)
            throw new Error("no undo for the third listener", exception);

        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:openjdk-source-code-learn    文件:Test4425885.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener();
    VetoListener second = new VetoListener();
    CheckListener third = new CheckListener();

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test4425885.class);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, 0, 1);
    } catch (PropertyVetoException exception) {
        if (first.odd)
            throw new Error("no undo for the first listener", exception);

        if (third.odd)
            throw new Error("no undo for the third listener", exception);

        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:OLD-OpenJDK8    文件:Test6630275.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener(false);
    CheckListener second = new CheckListener(true);
    CheckListener third = new CheckListener(false);

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test6630275.class);
    vcs.addVetoableChangeListener(first);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, true, false);
    } catch (PropertyVetoException exception) {
        first.validate();
        second.validate();
        third.validate();
        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:cn1    文件:VetoableChangeSupportTest.java   
public void testRemoveVetoableChangeListenerVetoableChangeListener_all_null() {
    MockSource source = new MockSource();
    VetoableChangeSupport support = new VetoableChangeSupport(source);

    VetoableChangeListener proxy = EventHandler.create(
            VetoableChangeListener.class, source, "setText");

    String propertyName = "label";
    support.addVetoableChangeListener(null);

    assertFalse(support.hasListeners(propertyName));
    assertEquals(0, support.getVetoableChangeListeners().length);

    support.removeVetoableChangeListener(proxy);

    assertFalse(support.hasListeners(propertyName));
    assertEquals(0, support.getVetoableChangeListeners(propertyName).length);
    assertEquals(0, support.getVetoableChangeListeners().length);
}
项目:cn1    文件:VetoableChangeSupportTest.java   
public void testRemoveVetoableChangeListenerVetoableChangeListener_null() {
    MockSource source = new MockSource();
    VetoableChangeSupport support = new VetoableChangeSupport(source);

    VetoableChangeListener proxy = EventHandler.create(
            VetoableChangeListener.class, source, "setText");

    String propertyName = "label";
    support.addVetoableChangeListener(proxy);

    assertTrue(support.hasListeners(propertyName));
    assertEquals(1, support.getVetoableChangeListeners().length);

    support.removeVetoableChangeListener(null);

    assertTrue(support.hasListeners(propertyName));
    assertEquals(0, support.getVetoableChangeListeners(propertyName).length);
    assertEquals(1, support.getVetoableChangeListeners().length);
}
项目:cn1    文件:VetoableChangeSupportTest.java   
public void testAddVetoableChangeListenerStringVetoableChangeListener_property_invalid() {
    MockSource source = new MockSource();
    VetoableChangeSupport support = new VetoableChangeSupport(source);

    VetoableChangeListener proxy = EventHandler.create(
            VetoableChangeListener.class, source, "setText");
    String propertyName = "label_invalid";
    support.addVetoableChangeListener(propertyName, proxy);

    VetoableChangeListener[] listeners1 = support
            .getVetoableChangeListeners();
    VetoableChangeListener[] listeners2 = support
            .getVetoableChangeListeners("label_invalid");
    assertEquals(1, listeners1.length);
    assertEquals(1, listeners2.length);
    assertEquals("label_invalid",
            ((VetoableChangeListenerProxy) listeners1[0]).getPropertyName());
    assertSame(proxy, listeners2[0]);
    assertFalse(support.hasListeners("label"));
}
项目:cn1    文件:VetoableChangeSupportTest.java   
public void testAddVetoableChangeListenerVetoableChangeListener_null() {
    MockSource source = new MockSource();
    VetoableChangeSupport support = new VetoableChangeSupport(source);
    support.addVetoableChangeListener(null);

    assertFalse(support.hasListeners("label"));
    assertFalse(support.hasListeners("text"));

    VetoableChangeListener[] listeners1 = support
            .getVetoableChangeListeners();
    VetoableChangeListener[] listeners2 = support
            .getVetoableChangeListeners("label");
    VetoableChangeListener[] listeners3 = support
            .getVetoableChangeListeners("text");

    assertEquals(0, listeners1.length);
    assertEquals(0, listeners2.length);
    assertEquals(0, listeners3.length);
}
项目:cn1    文件:VetoableChangeSupportTest.java   
public void testFireVetoableChangePropertyChangeEvent_property()
        throws PropertyVetoException {
    MockSource source = new MockSource();
    VetoableChangeSupport support = new VetoableChangeSupport(source);

    VetoableChangeListener proxy = EventHandler.create(
            VetoableChangeListener.class, source, "setText");

    String propertyName = "label";
    support.addVetoableChangeListener(propertyName, proxy);
    PropertyChangeEvent event = new PropertyChangeEvent(source, "label",
            "Label: old", "Label: new");
    support.fireVetoableChange(event);

    assertEquals("called", source.getText());
}
项目:JAVA_UNIT    文件:Test6630275.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener(false);
    CheckListener second = new CheckListener(true);
    CheckListener third = new CheckListener(false);

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test6630275.class);
    vcs.addVetoableChangeListener(first);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, true, false);
    } catch (PropertyVetoException exception) {
        first.validate();
        second.validate();
        third.validate();
        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:cn1    文件:VetoableChangeSupportTest.java   
public void testRemoveVetoableChangeListenerVetoableChangeListener_all() {
    MockSource source = new MockSource();
    VetoableChangeSupport support = new VetoableChangeSupport(source);

    VetoableChangeListener proxy = EventHandler.create(
            VetoableChangeListener.class, source, "setText");

    String propertyName = "label";
    support.addVetoableChangeListener(proxy);
    assertTrue(support.hasListeners(propertyName));

    support.removeVetoableChangeListener(proxy);
    assertFalse(support.hasListeners(propertyName));
    assertEquals(0, support.getVetoableChangeListeners(propertyName).length);
    assertEquals(0, support.getVetoableChangeListeners().length);
}
项目:openjdk-jdk7u-jdk    文件:Test4425885.java   
public static void main(String[] args) {
    CheckListener first = new CheckListener();
    VetoListener second = new VetoListener();
    CheckListener third = new CheckListener();

    VetoableChangeSupport vcs = new VetoableChangeSupport(Test4425885.class);
    vcs.addVetoableChangeListener(PROPERTY, first);
    vcs.addVetoableChangeListener(PROPERTY, second);
    vcs.addVetoableChangeListener(PROPERTY, third);
    try {
        vcs.fireVetoableChange(PROPERTY, 0, 1);
    } catch (PropertyVetoException exception) {
        if (first.odd)
            throw new Error("no undo for the first listener", exception);

        if (third.odd)
            throw new Error("no undo for the third listener", exception);

        return; // expected exception
    }
    throw new Error("exception should be thrown");
}
项目:cn1    文件:VetoableChangeSupportTest.java   
public void testFireVetoableChangeStringbooleanboolean_listener_Property_invalid()
        throws PropertyVetoException {
    MockSource source = new MockSource();
    VetoableChangeSupport support = new VetoableChangeSupport(source);

    VetoableChangeListener proxy = EventHandler.create(
            VetoableChangeListener.class, source, "label", "source.text");
    support.addVetoableChangeListener("label", proxy);
    String newText = "new Text value";
    source.setText(newText);

    support.fireVetoableChange("text", true, false);
    assertEquals("label.default", source.getLabel());

    support.fireVetoableChange("label_invalid", true, false);
    assertEquals("label.default", source.getLabel());

    support.fireVetoableChange("label", true, false);
    assertEquals(newText, source.getLabel());
}
项目:cn1    文件:VetoableChangeSupportTest.java   
public void testRemoveVetoableChangeListenerStringVetoableChangeListener_propertyName_Invalid() {
    MockSource source = new MockSource();
    VetoableChangeSupport support = new VetoableChangeSupport(source);

    VetoableChangeListener proxy = EventHandler.create(
            VetoableChangeListener.class, source, "setText");

    String propertyName = "label";
    support.addVetoableChangeListener(propertyName, proxy);
    assertTrue(support.hasListeners(propertyName));

    support.removeVetoableChangeListener(propertyName + "_invalid", proxy);
    assertTrue(support.hasListeners(propertyName));
    assertEquals(1, support.getVetoableChangeListeners(propertyName).length);
    assertEquals(1, support.getVetoableChangeListeners().length);
}
项目:cn1    文件:VetoableChangeSupportTest.java   
public void testRemoveVetoableChangeListenerVetoableChangeListener_all_more_diff() {
    MockSource source = new MockSource();
    VetoableChangeSupport support = new VetoableChangeSupport(source);

    VetoableChangeListener proxy = EventHandler.create(
            VetoableChangeListener.class, source, "setText");
    VetoableChangeListener proxy2 = EventHandler.create(
            VetoableChangeListener.class, source, "getText");

    String propertyName = "label";
    support.addVetoableChangeListener(proxy);
    support.addVetoableChangeListener(proxy2);

    assertTrue(support.hasListeners(propertyName));
    assertEquals(2, support.getVetoableChangeListeners().length);

    support.removeVetoableChangeListener(proxy);

    assertTrue(support.hasListeners(propertyName));
    assertEquals(0, support.getVetoableChangeListeners(propertyName).length);
    assertEquals(1, support.getVetoableChangeListeners().length);
    assertEquals(proxy2, support.getVetoableChangeListeners()[0]);
}
项目:cn1    文件:VetoableChangeSupportTest.java   
public void testRemoveVetoableChangeListenerStringVetoableChangeListener_property_more() {
    MockSource source = new MockSource();
    VetoableChangeSupport support = new VetoableChangeSupport(source);

    VetoableChangeListener proxy = EventHandler.create(
            VetoableChangeListener.class, source, "setText");

    String propertyName = "label";
    support.addVetoableChangeListener(propertyName, proxy);
    support.addVetoableChangeListener(propertyName, proxy);

    assertTrue(support.hasListeners(propertyName));
    assertEquals(2, support.getVetoableChangeListeners(propertyName).length);

    support.removeVetoableChangeListener(propertyName, proxy);
    assertTrue(support.hasListeners(propertyName));
    assertEquals(1, support.getVetoableChangeListeners(propertyName).length);
    assertEquals(1, support.getVetoableChangeListeners().length);
}
项目:cn1    文件:VetoableChangeSupportTest.java   
public void testRemoveVetoableChangeListenerStringVetoableChangeListener_property_diff() {
    MockSource source = new MockSource();
    VetoableChangeSupport support = new VetoableChangeSupport(source);

    VetoableChangeListener proxy = EventHandler.create(
            VetoableChangeListener.class, source, "setText");

    VetoableChangeListener proxy2 = EventHandler.create(
            VetoableChangeListener.class, source, "getText");

    String propertyName = "label";
    support.addVetoableChangeListener(propertyName, proxy);
    support.addVetoableChangeListener(propertyName, proxy2);

    assertTrue(support.hasListeners(propertyName));
    assertEquals(2, support.getVetoableChangeListeners(propertyName).length);

    support.removeVetoableChangeListener(propertyName, proxy);
    assertTrue(support.hasListeners(propertyName));
    assertEquals(1, support.getVetoableChangeListeners(propertyName).length);
    assertEquals(1, support.getVetoableChangeListeners().length);
    assertSame(proxy2, support.getVetoableChangeListeners(propertyName)[0]);
}
项目:OpenJSharp    文件:JComponent.java   
/**
 * Adds a <code>VetoableChangeListener</code> to the listener list.
 * The listener is registered for all properties.
 *
 * @param listener  the <code>VetoableChangeListener</code> to be added
 */
public synchronized void addVetoableChangeListener(VetoableChangeListener listener) {
    if (vetoableChangeSupport == null) {
        vetoableChangeSupport = new java.beans.VetoableChangeSupport(this);
    }
    vetoableChangeSupport.addVetoableChangeListener(listener);
}
项目:jdk8u-jdk    文件:JComponent.java   
/**
 * Adds a <code>VetoableChangeListener</code> to the listener list.
 * The listener is registered for all properties.
 *
 * @param listener  the <code>VetoableChangeListener</code> to be added
 */
public synchronized void addVetoableChangeListener(VetoableChangeListener listener) {
    if (vetoableChangeSupport == null) {
        vetoableChangeSupport = new java.beans.VetoableChangeSupport(this);
    }
    vetoableChangeSupport.addVetoableChangeListener(listener);
}
项目:jdk8u-jdk    文件:TestEquals.java   
public static void main(String[] args) throws PropertyVetoException {
    TestEquals one = new TestEquals(1);
    TestEquals two = new TestEquals(2);

    Object source = TestEquals.class;
    VetoableChangeSupport vcs = new VetoableChangeSupport(source);
    vcs.addVetoableChangeListener(PROPERTY, one);
    vcs.addVetoableChangeListener(PROPERTY, two);

    PropertyChangeEvent event = new PropertyChangeEvent(source, PROPERTY, one, two);
    vcs.fireVetoableChange(event);
    test(one, two, 1); // only one check
    vcs.fireVetoableChange(PROPERTY, one, two);
    test(one, two, 2); // because it invokes fireVetoableChange(PropertyChangeEvent)
}
项目:jdk8u-jdk    文件:Test4076065.java   
public static void main(String[] args) {
    try {
        new VetoableChangeSupport(null);
    } catch (NullPointerException exception) {
        return;
    }
    throw new Error("didn't get expected NullPointerException");
}
项目:jdk8u-jdk    文件:TestSerialization.java   
private static void check(VetoableChangeSupport vcs) {
    VetoableChangeListener[] namedListeners = vcs.getVetoableChangeListeners(NAME);
    check(namedListeners, 1);
    check(namedListeners[0], 1);

    VetoableChangeListener[] allListeners = vcs.getVetoableChangeListeners();
    check(allListeners, 2);
    check(allListeners[0], 0);
    check(allListeners[1], 1, NAME);
}
项目:openjdk-jdk10    文件:TestEquals.java   
public static void main(String[] args) throws PropertyVetoException {
    TestEquals one = new TestEquals(1);
    TestEquals two = new TestEquals(2);

    Object source = TestEquals.class;
    VetoableChangeSupport vcs = new VetoableChangeSupport(source);
    vcs.addVetoableChangeListener(PROPERTY, one);
    vcs.addVetoableChangeListener(PROPERTY, two);

    PropertyChangeEvent event = new PropertyChangeEvent(source, PROPERTY, one, two);
    vcs.fireVetoableChange(event);
    test(one, two, 1); // only one check
    vcs.fireVetoableChange(PROPERTY, one, two);
    test(one, two, 2); // because it invokes fireVetoableChange(PropertyChangeEvent)
}
项目:openjdk-jdk10    文件:Test4076065.java   
public static void main(String[] args) {
    try {
        new VetoableChangeSupport(null);
    } catch (NullPointerException exception) {
        return;
    }
    throw new Error("didn't get expected NullPointerException");
}
项目:openjdk-jdk10    文件:TestSerialization.java   
private static void check(VetoableChangeSupport vcs) {
    VetoableChangeListener[] namedListeners = vcs.getVetoableChangeListeners(NAME);
    check(namedListeners, 1);
    check(namedListeners[0], 1);

    VetoableChangeListener[] allListeners = vcs.getVetoableChangeListeners();
    check(allListeners, 2);
    check(allListeners[0], 0);
    check(allListeners[1], 1, NAME);
}
项目:openjdk9    文件:TestEquals.java   
public static void main(String[] args) throws PropertyVetoException {
    TestEquals one = new TestEquals(1);
    TestEquals two = new TestEquals(2);

    Object source = TestEquals.class;
    VetoableChangeSupport vcs = new VetoableChangeSupport(source);
    vcs.addVetoableChangeListener(PROPERTY, one);
    vcs.addVetoableChangeListener(PROPERTY, two);

    PropertyChangeEvent event = new PropertyChangeEvent(source, PROPERTY, one, two);
    vcs.fireVetoableChange(event);
    test(one, two, 1); // only one check
    vcs.fireVetoableChange(PROPERTY, one, two);
    test(one, two, 2); // because it invokes fireVetoableChange(PropertyChangeEvent)
}