类java.beans.VetoableChangeSupport源码实例Demo

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

源代码1 项目: 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");
}
 
源代码2 项目: dragonwell8_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");
}
 
源代码3 项目: 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");
}
 
源代码4 项目: TencentKona-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");
}
 
源代码5 项目: openjdk-8-source   文件: 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");
}
 
源代码6 项目: openjdk-jdk8u   文件: 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");
}
 
源代码7 项目: openjdk-jdk8u   文件: 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");
}
 
源代码8 项目: 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");
}
 
源代码9 项目: openjdk-jdk8u-backup   文件: 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");
}
 
源代码10 项目: openjdk-jdk8u-backup   文件: 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");
}
 
源代码11 项目: openjdk-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");
}
 
源代码12 项目: openjdk-jdk9   文件: 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");
}
 
源代码13 项目: openstock   文件: Series.java
/**
 * Creates a new series with the specified key and description.
 *
 * @param key  the series key (<code>null</code> NOT permitted).
 * @param description  the series description (<code>null</code> permitted).
 */
protected Series(Comparable key, String description) {
    ParamChecks.nullNotPermitted(key, "key");
    this.key = key;
    this.description = description;
    this.listeners = new EventListenerList();
    this.propertyChangeSupport = new PropertyChangeSupport(this);
    this.vetoableChangeSupport = new VetoableChangeSupport(this);
    this.notify = true;
}
 
源代码14 项目: 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");
}
 
源代码15 项目: LGoodDatePicker   文件: Bean.java
/**
 * Support for reporting changes for constrained boolean properties. This method can be called
 * before a constrained property will be changed and it will send the appropriate
 * PropertyChangeEvent to any registered VetoableChangeListeners.
 *
 * @param propertyName the property whose value has changed
 * @param oldValue the property's previous value
 * @param newValue the property's new value
 * @throws PropertyVetoException if a constrained property change is rejected
 */
protected final void fireVetoableChange(String propertyName,
        boolean oldValue,
        boolean newValue)
        throws PropertyVetoException {
    VetoableChangeSupport aVetoSupport = this.vetoSupport;
    if (aVetoSupport == null) {
        return;
    }
    aVetoSupport.fireVetoableChange(propertyName, oldValue, newValue);
}
 
源代码16 项目: dragonwell8_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");
}
 
源代码17 项目: TencentKona-8   文件: 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)
}
 
源代码18 项目: TencentKona-8   文件: Test4076065.java
public static void main(String[] args) {
    try {
        new VetoableChangeSupport(null);
    } catch (NullPointerException exception) {
        return;
    }
    throw new Error("didn't get expected NullPointerException");
}
 
源代码19 项目: pgptool   文件: AbstractBean.java
/**
 * {@inheritDoc}
 */
@Override
public Object clone() throws CloneNotSupportedException {
	AbstractBean result = (AbstractBean) super.clone();
	result.pcs = new PropertyChangeSupport(result);
	result.vcs = new VetoableChangeSupport(result);
	return result;
}
 
源代码20 项目: ECG-Viewer   文件: Series.java
/**
 * Creates a new series with the specified key and description.
 *
 * @param key  the series key (<code>null</code> NOT permitted).
 * @param description  the series description (<code>null</code> permitted).
 */
protected Series(Comparable key, String description) {
    ParamChecks.nullNotPermitted(key, "key");
    this.key = key;
    this.description = description;
    this.listeners = new EventListenerList();
    this.propertyChangeSupport = new PropertyChangeSupport(this);
    this.vetoableChangeSupport = new VetoableChangeSupport(this);
    this.notify = true;
}
 
源代码21 项目: jdk8u60   文件: 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)
}
 
源代码22 项目: openjdk-8   文件: 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)
}
 
源代码23 项目: jdk8u-dev-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");
}
 
源代码24 项目: jdk8u-dev-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)
}
 
源代码25 项目: openjdk-jdk8u   文件: 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)
}
 
源代码26 项目: openjdk-jdk8u   文件: Test4076065.java
public static void main(String[] args) {
    try {
        new VetoableChangeSupport(null);
    } catch (NullPointerException exception) {
        return;
    }
    throw new Error("didn't get expected NullPointerException");
}
 
源代码27 项目: openjdk-jdk8u   文件: 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);
}
 
源代码28 项目: openjdk-jdk8u-backup   文件: 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)
}
 
源代码29 项目: openjdk-jdk8u-backup   文件: Test4076065.java
public static void main(String[] args) {
    try {
        new VetoableChangeSupport(null);
    } catch (NullPointerException exception) {
        return;
    }
    throw new Error("didn't get expected NullPointerException");
}
 
源代码30 项目: openjdk-jdk8u-backup   文件: 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);
}
 
 类所在包
 同包方法