Package java.beans

Examples of java.beans.VetoableChangeSupport.addVetoableChangeListener()


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

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

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

        support.removeVetoableChangeListener(proxy);
View Full Code Here


        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);
View Full Code Here


        //VetoableChangeSupport.addVetoableChangeListener(null, listener)
        System.out.println("VetoableChangeSupport.addVetoableChangeListener(null, listener)");
        try {
            vcs.addVetoableChangeListener(null, listener);
            vcs.fireVetoableChange(NAME, null, null);
        }
        catch (Throwable error) {
            print(error);
        }
View Full Code Here

        }

        //VetoableChangeSupport.hasListeners(null): with a generic listener
        System.out.println("VetoableChangeSupport.hasListeners(null) with a generic listener");
        try {
            vcs.addVetoableChangeListener(listener);
            if (!vcs.hasListeners(null)) {
                throw new Error("hasListeners(null) returned false, but there was a generic listener");
            }
        }
        catch (Throwable error) {
View Full Code Here

        vcs = new VetoableChangeSupport(args); // reset

        //VetoableChangeSupport.hasListeners(null): with a specific listener
        System.out.println("VetoableChangeSupport.hasListeners(null) with a specific listener");
        try {
            vcs.addVetoableChangeListener(NAME, listener);
            if (vcs.hasListeners(null)) {
                throw new Error("hasListeners(null) returned true, but there were no generic listeners - only a specific listener");
            }
        }
        catch (Throwable error) {
View Full Code Here

        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
View Full Code Here

        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);
View Full Code Here

public class TestSynchronization {
    private static boolean isCalled;

    public static void main(String[] args) throws PropertyVetoException {
        final VetoableChangeSupport vcs = new VetoableChangeSupport(TestSynchronization.class);
        vcs.addVetoableChangeListener("name", new VetoableChangeListener() {
            public void vetoableChange(PropertyChangeEvent event) {
                isCalled = true;
            }
        });
        vcs.addVetoableChangeListener(new VetoableChangeListener() {
View Full Code Here

        vcs.addVetoableChangeListener("name", new VetoableChangeListener() {
            public void vetoableChange(PropertyChangeEvent event) {
                isCalled = true;
            }
        });
        vcs.addVetoableChangeListener(new VetoableChangeListener() {
            public void vetoableChange(PropertyChangeEvent event) {
                for (VetoableChangeListener listener : vcs.getVetoableChangeListeners())
                    vcs.removeVetoableChangeListener(listener);
            }
        });
View Full Code Here

    private static int current;

    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)));

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.