Package java.beans

Examples of java.beans.VetoableChangeSupport.fireVetoableChange()


        //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.removeVetoableChangeListener(null, listener)
        System.out.println("VetoableChangeSupport.removeVetoableChangeListener(null, listener)");
        try {
            vcs.removeVetoableChangeListener(null, listener);
            vcs.fireVetoableChange(NAME, null, null);
        }
        catch (Throwable error) {
            print(error);
        }
View Full Code Here

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

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

    private static void test(TestEquals v1, TestEquals v2, int amount) {
        int count = v1.count + v2.count;
View Full Code Here

            public void vetoableChange(PropertyChangeEvent event) {
                for (VetoableChangeListener listener : vcs.getVetoableChangeListeners())
                    vcs.removeVetoableChangeListener(listener);
            }
        });
        vcs.fireVetoableChange("name", null, null);
        if (!isCalled)
            throw new Error("test failed");
    }
}
View Full Code Here

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

            vcs.addVetoableChangeListener(test);
            vcs.addVetoableChangeListener(NAME, test);
        }
        long time2 = System.currentTimeMillis();
        for (int i = 0; i < attempts; i++) {
            vcs.fireVetoableChange(eventNull);
            vcs.fireVetoableChange(eventName);
        }
        long time3 = System.currentTimeMillis();
        time1 = time2 - time1; // time of adding the listeners
        time2 = time3 - time2; // time of firing the events
View Full Code Here

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

            vcs.addVetoableChangeListener(NAME, test);
        }
        long time2 = System.currentTimeMillis();
        for (int i = 0; i < attempts; i++) {
            vcs.fireVetoableChange(eventNull);
            vcs.fireVetoableChange(eventName);
        }
        long time3 = System.currentTimeMillis();
        time1 = time2 - time1; // time of adding the listeners
        time2 = time3 - time2; // time of firing the events
        System.out.println("Step: " + step
View Full Code Here

            return;
        }
        VetoableChangeSupport vetoableSupport =
            this.vetoableSupport;
        if (vetoableSupport != null) {
            vetoableSupport.fireVetoableChange(propertyName, oldValue,
                                               newValue);
        }
    }

    /**
 
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.