Java Code Examples for java.beans.PropertyChangeSupport#getPropertyChangeListeners()

The following examples show how to use java.beans.PropertyChangeSupport#getPropertyChangeListeners() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestSerialization.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void check(PropertyChangeSupport pcs) {
    PropertyChangeListener[] namedListeners = pcs.getPropertyChangeListeners(NAME);
    check(namedListeners, 1);
    check(namedListeners[0], 1);

    PropertyChangeListener[] allListeners = pcs.getPropertyChangeListeners();
    check(allListeners, 2);
    check(allListeners[0], 0);
    check(allListeners[1], 1, NAME);
}
 
Example 2
Source File: TestSerialization.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void check(PropertyChangeSupport pcs) {
    PropertyChangeListener[] namedListeners = pcs.getPropertyChangeListeners(NAME);
    check(namedListeners, 1);
    check(namedListeners[0], 1);

    PropertyChangeListener[] allListeners = pcs.getPropertyChangeListeners();
    check(allListeners, 2);
    check(allListeners[0], 0);
    check(allListeners[1], 1, NAME);
}
 
Example 3
Source File: Toolkit.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public synchronized PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
{
    PropertyChangeSupport pcs = (PropertyChangeSupport)
            AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
    if (null != pcs) {
        return pcs.getPropertyChangeListeners(propertyName);
    } else {
        return new PropertyChangeListener[0];
    }
}
 
Example 4
Source File: Toolkit.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized PropertyChangeListener[] getPropertyChangeListeners()
{
    PropertyChangeSupport pcs = (PropertyChangeSupport)
            AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
    if (null != pcs) {
        return pcs.getPropertyChangeListeners();
    } else {
        return new PropertyChangeListener[0];
    }
}
 
Example 5
Source File: Toolkit.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public synchronized PropertyChangeListener[] getPropertyChangeListeners()
{
    PropertyChangeSupport pcs = (PropertyChangeSupport)
            AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
    if (null != pcs) {
        return pcs.getPropertyChangeListeners();
    } else {
        return new PropertyChangeListener[0];
    }
}
 
Example 6
Source File: Toolkit.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public synchronized PropertyChangeListener[] getPropertyChangeListeners()
{
    PropertyChangeSupport pcs = (PropertyChangeSupport)
            AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
    if (null != pcs) {
        return pcs.getPropertyChangeListeners();
    } else {
        return new PropertyChangeListener[0];
    }
}
 
Example 7
Source File: TestSerialization.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void check(PropertyChangeSupport pcs) {
    PropertyChangeListener[] namedListeners = pcs.getPropertyChangeListeners(NAME);
    check(namedListeners, 1);
    check(namedListeners[0], 1);

    PropertyChangeListener[] allListeners = pcs.getPropertyChangeListeners();
    check(allListeners, 2);
    check(allListeners[0], 0);
    check(allListeners[1], 1, NAME);
}
 
Example 8
Source File: TestSerialization.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void check(PropertyChangeSupport pcs) {
    PropertyChangeListener[] namedListeners = pcs.getPropertyChangeListeners(NAME);
    check(namedListeners, 1);
    check(namedListeners[0], 1);

    PropertyChangeListener[] allListeners = pcs.getPropertyChangeListeners();
    check(allListeners, 2);
    check(allListeners[0], 0);
    check(allListeners[1], 1, NAME);
}
 
Example 9
Source File: Toolkit.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public synchronized PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
{
    PropertyChangeSupport pcs = (PropertyChangeSupport)
            AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
    if (null != pcs) {
        return pcs.getPropertyChangeListeners(propertyName);
    } else {
        return new PropertyChangeListener[0];
    }
}
 
Example 10
Source File: Toolkit.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized PropertyChangeListener[] getPropertyChangeListeners()
{
    PropertyChangeSupport pcs = (PropertyChangeSupport)
            AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
    if (null != pcs) {
        return pcs.getPropertyChangeListeners();
    } else {
        return new PropertyChangeListener[0];
    }
}
 
Example 11
Source File: TestSerialization.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void check(PropertyChangeSupport pcs) {
    PropertyChangeListener[] namedListeners = pcs.getPropertyChangeListeners(NAME);
    check(namedListeners, 1);
    check(namedListeners[0], 1);

    PropertyChangeListener[] allListeners = pcs.getPropertyChangeListeners();
    check(allListeners, 2);
    check(allListeners[0], 0);
    check(allListeners[1], 1, NAME);
}
 
Example 12
Source File: Toolkit.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized PropertyChangeListener[] getPropertyChangeListeners()
{
    PropertyChangeSupport pcs = (PropertyChangeSupport)
            AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
    if (null != pcs) {
        return pcs.getPropertyChangeListeners();
    } else {
        return new PropertyChangeListener[0];
    }
}
 
Example 13
Source File: TestSerialization.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void check(PropertyChangeSupport pcs) {
    PropertyChangeListener[] namedListeners = pcs.getPropertyChangeListeners(NAME);
    check(namedListeners, 1);
    check(namedListeners[0], 1);

    PropertyChangeListener[] allListeners = pcs.getPropertyChangeListeners();
    check(allListeners, 2);
    check(allListeners[0], 0);
    check(allListeners[1], 1, NAME);
}
 
Example 14
Source File: Toolkit.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public synchronized PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
{
    PropertyChangeSupport pcs = (PropertyChangeSupport)
            AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
    if (null != pcs) {
        return pcs.getPropertyChangeListeners(propertyName);
    } else {
        return new PropertyChangeListener[0];
    }
}
 
Example 15
Source File: TestSerialization.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void check(PropertyChangeSupport pcs) {
    PropertyChangeListener[] namedListeners = pcs.getPropertyChangeListeners(NAME);
    check(namedListeners, 1);
    check(namedListeners[0], 1);

    PropertyChangeListener[] allListeners = pcs.getPropertyChangeListeners();
    check(allListeners, 2);
    check(allListeners[0], 0);
    check(allListeners[1], 1, NAME);
}
 
Example 16
Source File: Toolkit.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public synchronized PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
{
    PropertyChangeSupport pcs = (PropertyChangeSupport)
            AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
    if (null != pcs) {
        return pcs.getPropertyChangeListeners(propertyName);
    } else {
        return new PropertyChangeListener[0];
    }
}
 
Example 17
Source File: Toolkit.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public synchronized PropertyChangeListener[] getPropertyChangeListeners()
{
    PropertyChangeSupport pcs = (PropertyChangeSupport)
            AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
    if (null != pcs) {
        return pcs.getPropertyChangeListeners();
    } else {
        return new PropertyChangeListener[0];
    }
}
 
Example 18
Source File: TestListeners.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    PropertyChangeSupport pcs = new PropertyChangeSupport(TestListeners.class);
    pcs.addPropertyChangeListener(new TestListeners(0));
    pcs.addPropertyChangeListener(NAME, new TestListeners(2));
    pcs.addPropertyChangeListener(new TestListeners(1));
    pcs.addPropertyChangeListener(NAME, new PropertyChangeListenerProxy(NAME, new TestListeners(3)));


    current = 0;
    pcs.firePropertyChange(NAME, 0, 1);
    if (current != 4)
        throw new Error("Expected 4 listeners, but called " + current);

    current = 0;
    pcs.firePropertyChange(NONE, 1, 0);
    if (current != 2)
        throw new Error("Expected 2 listeners, but called " + current);


    PropertyChangeListener[] all = pcs.getPropertyChangeListeners();
    if (all.length != 4)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    PropertyChangeListener[] named = pcs.getPropertyChangeListeners(NAME);
    if (named.length != 2)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    PropertyChangeListener[] other = pcs.getPropertyChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);

    pcs.removePropertyChangeListener(new TestListeners(0));
    pcs.removePropertyChangeListener(new TestListeners(1));
    pcs.removePropertyChangeListener(NAME, new TestListeners(2));
    pcs.removePropertyChangeListener(NAME, new PropertyChangeListenerProxy(NAME, new TestListeners(3)));

    all = pcs.getPropertyChangeListeners();
    if (all.length != 0)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    named = pcs.getPropertyChangeListeners(NAME);
    if (named.length != 0)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    other = pcs.getPropertyChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);
}
 
Example 19
Source File: TestListeners.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    PropertyChangeSupport pcs = new PropertyChangeSupport(TestListeners.class);
    pcs.addPropertyChangeListener(new TestListeners(0));
    pcs.addPropertyChangeListener(NAME, new TestListeners(2));
    pcs.addPropertyChangeListener(new TestListeners(1));
    pcs.addPropertyChangeListener(NAME, new PropertyChangeListenerProxy(NAME, new TestListeners(3)));


    current = 0;
    pcs.firePropertyChange(NAME, 0, 1);
    if (current != 4)
        throw new Error("Expected 4 listeners, but called " + current);

    current = 0;
    pcs.firePropertyChange(NONE, 1, 0);
    if (current != 2)
        throw new Error("Expected 2 listeners, but called " + current);


    PropertyChangeListener[] all = pcs.getPropertyChangeListeners();
    if (all.length != 4)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    PropertyChangeListener[] named = pcs.getPropertyChangeListeners(NAME);
    if (named.length != 2)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    PropertyChangeListener[] other = pcs.getPropertyChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);

    pcs.removePropertyChangeListener(new TestListeners(0));
    pcs.removePropertyChangeListener(new TestListeners(1));
    pcs.removePropertyChangeListener(NAME, new TestListeners(2));
    pcs.removePropertyChangeListener(NAME, new PropertyChangeListenerProxy(NAME, new TestListeners(3)));

    all = pcs.getPropertyChangeListeners();
    if (all.length != 0)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    named = pcs.getPropertyChangeListeners(NAME);
    if (named.length != 0)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    other = pcs.getPropertyChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);
}
 
Example 20
Source File: TestListeners.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    PropertyChangeSupport pcs = new PropertyChangeSupport(TestListeners.class);
    pcs.addPropertyChangeListener(new TestListeners(0));
    pcs.addPropertyChangeListener(NAME, new TestListeners(2));
    pcs.addPropertyChangeListener(new TestListeners(1));
    pcs.addPropertyChangeListener(NAME, new PropertyChangeListenerProxy(NAME, new TestListeners(3)));


    current = 0;
    pcs.firePropertyChange(NAME, 0, 1);
    if (current != 4)
        throw new Error("Expected 4 listeners, but called " + current);

    current = 0;
    pcs.firePropertyChange(NONE, 1, 0);
    if (current != 2)
        throw new Error("Expected 2 listeners, but called " + current);


    PropertyChangeListener[] all = pcs.getPropertyChangeListeners();
    if (all.length != 4)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    PropertyChangeListener[] named = pcs.getPropertyChangeListeners(NAME);
    if (named.length != 2)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    PropertyChangeListener[] other = pcs.getPropertyChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);

    pcs.removePropertyChangeListener(new TestListeners(0));
    pcs.removePropertyChangeListener(new TestListeners(1));
    pcs.removePropertyChangeListener(NAME, new TestListeners(2));
    pcs.removePropertyChangeListener(NAME, new PropertyChangeListenerProxy(NAME, new TestListeners(3)));

    all = pcs.getPropertyChangeListeners();
    if (all.length != 0)
        throw new Error("Expected 4 listeners, but contained " + all.length);

    named = pcs.getPropertyChangeListeners(NAME);
    if (named.length != 0)
        throw new Error("Expected 2 named listeners, but contained " + named.length);

    other = pcs.getPropertyChangeListeners(NONE);
    if (other.length != 0)
        throw new Error("Expected 0 other listeners, but contained " + other.length);
}