Package java.beans

Examples of java.beans.PropertyChangeSupport.removePropertyChangeListener()


        PropertyChangeSupport sup = new PropertyChangeSupport(src);
        PropertyChangeListener l1 = new MockPropertyChangeListener();
        sup.addPropertyChangeListener("myProp", l1);
        assertEquals(1, sup.getPropertyChangeListeners().length);

        sup.removePropertyChangeListener("myProp", l1);
        assertEquals(0, sup.getPropertyChangeListeners().length);
        assertEquals(0, sup.getPropertyChangeListeners("myProp").length);

        PropertyChangeListener l2 = new MockPropertyChangeListener();
        PropertyChangeListener l3 = new PropertyChangeListenerProxy("myProp",
View Full Code Here


        PropertyChangeListener l2 = new MockPropertyChangeListener();
        PropertyChangeListener l3 = new PropertyChangeListenerProxy("myProp",
                l2);
        sup.addPropertyChangeListener(l3);
        assertEquals(1, sup.getPropertyChangeListeners().length);
        sup.removePropertyChangeListener("myProp", l2);
        assertEquals(0, sup.getPropertyChangeListeners().length);
        assertEquals(0, sup.getPropertyChangeListeners("myProp").length);
    }

    /*
 
View Full Code Here

     * String) with a non-registered listener parameter.
     */
    public void testRemovePropertyChangeListener_PropertyChangeListener_String_NonRegistered() {
        Object src = new Object();
        PropertyChangeSupport sup = new PropertyChangeSupport(src);
        sup.removePropertyChangeListener("myProp",
                new MockPropertyChangeListener());
        assertEquals(0, sup.getPropertyChangeListeners().length);
    }

    /*
 
View Full Code Here

     */
    public void testRemovePropertyChangeListener_PropertyChangeListener_String_NullListener() {
        Object src = new Object();
        PropertyChangeSupport sup = new PropertyChangeSupport(src);

        sup.removePropertyChangeListener("myProp", null);
        assertEquals(0, sup.getPropertyChangeListeners().length);
        sup.addPropertyChangeListener("myProp", null);
        assertEquals(0, sup.getPropertyChangeListeners().length);
        sup.removePropertyChangeListener("myProp", null);
        assertEquals(0, sup.getPropertyChangeListeners().length);
View Full Code Here

        sup.removePropertyChangeListener("myProp", null);
        assertEquals(0, sup.getPropertyChangeListeners().length);
        sup.addPropertyChangeListener("myProp", null);
        assertEquals(0, sup.getPropertyChangeListeners().length);
        sup.removePropertyChangeListener("myProp", null);
        assertEquals(0, sup.getPropertyChangeListeners().length);
    }

    /*
     * Test the method removePropertyChangeListener(PropertyChangeListener,
View Full Code Here

     */
    public void testRemovePropertyChangeListener_PropertyChangeListener_String_NullProperty() {
        Object src = new Object();
        PropertyChangeSupport sup = new PropertyChangeSupport(src);

        sup.removePropertyChangeListener(null,
                new MockPropertyChangeListener());
        sup.addPropertyChangeListener("myProp",
                new MockPropertyChangeListener());
        sup.removePropertyChangeListener(null,
                new MockPropertyChangeListener());
View Full Code Here

        sup.removePropertyChangeListener(null,
                new MockPropertyChangeListener());
        sup.addPropertyChangeListener("myProp",
                new MockPropertyChangeListener());
        sup.removePropertyChangeListener(null,
                new MockPropertyChangeListener());
    }

    /*
     * Test the method getPropertyChangeListeners() when there is one listener
View Full Code Here

                l2);

        assertFalse(sup.hasListeners("myProp"));
        sup.addPropertyChangeListener(l1);
        assertTrue(sup.hasListeners("myProp"));
        sup.removePropertyChangeListener(l1);
        assertFalse(sup.hasListeners("myProp"));
        sup.addPropertyChangeListener(l3);
        assertTrue(sup.hasListeners("myProp"));
    }
View Full Code Here

        assertFalse(sup.hasListeners("myProp"));
        sup.addPropertyChangeListener("myProP", l1);
        assertFalse(sup.hasListeners("myProp"));
        sup.addPropertyChangeListener("myProp", l2);
        assertTrue(sup.hasListeners("myProp"));
        sup.removePropertyChangeListener("myProp", l2);
        assertFalse(sup.hasListeners("myProp"));
        // The following assertion fails on RI. See HARMONY-2526
        sup.addPropertyChangeListener("myProp", l3);
        assertTrue(sup.hasListeners("myProp"));
    }
View Full Code Here

                PropertyChangeListener listener)
        {
            PropertyChangeSupport pcs = (PropertyChangeSupport)
                    AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
            if (null != pcs) {
                pcs.removePropertyChangeListener(propertyName, listener);
            }
        }

        @Override
        public synchronized PropertyChangeListener[] getPropertyChangeListeners()
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.