當前位置: 首頁>>代碼示例>>Java>>正文


Java PropertyChangeSupport.getPropertyChangeListeners方法代碼示例

本文整理匯總了Java中java.beans.PropertyChangeSupport.getPropertyChangeListeners方法的典型用法代碼示例。如果您正苦於以下問題:Java PropertyChangeSupport.getPropertyChangeListeners方法的具體用法?Java PropertyChangeSupport.getPropertyChangeListeners怎麽用?Java PropertyChangeSupport.getPropertyChangeListeners使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.beans.PropertyChangeSupport的用法示例。


在下文中一共展示了PropertyChangeSupport.getPropertyChangeListeners方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: removePropertyChangeListener

import java.beans.PropertyChangeSupport; //導入方法依賴的package包/類
/**
 * Remove a PropertyChangeListener from this context dispatcher.
 * @param l The PropertyChangeListener
 */
public void removePropertyChangeListener(PropertyChangeListener l) {
    pcs.removePropertyChangeListener(l);
    // Also remove the listener from all MIME types
    synchronized (pcsByMIMEType) {
        Set<String> MIMETypes = new HashSet(pcsByMIMEType.keySet());
        for (String MIMEType : MIMETypes) {
            PropertyChangeSupport _pcs = pcsByMIMEType.get(MIMEType);
            _pcs.removePropertyChangeListener(l);
            if (_pcs.getPropertyChangeListeners().length == 0) {
                pcsByMIMEType.remove(MIMEType);
            }
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:EditorContextDispatcher.java

示例2: listListeners

import java.beans.PropertyChangeSupport; //導入方法依賴的package包/類
public static String listListeners(PropertyChangeSupport support){
    if(support==null) return "null support";
    StringBuilder sb=new StringBuilder();
    for(PropertyChangeListener l:support.getPropertyChangeListeners()){
        sb.append(l==null?"null":l.toString()+"\n");
    }
    return sb.toString();
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:9,代碼來源:ListPropertyChangeListeners.java

示例3: getPropertyChangeListeners

import java.beans.PropertyChangeSupport; //導入方法依賴的package包/類
@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];
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:12,代碼來源:Toolkit.java

示例4: check

import java.beans.PropertyChangeSupport; //導入方法依賴的package包/類
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);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:11,代碼來源:TestSerialization.java

示例5: main

import java.beans.PropertyChangeSupport; //導入方法依賴的package包/類
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);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:49,代碼來源:TestListeners.java


注:本文中的java.beans.PropertyChangeSupport.getPropertyChangeListeners方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。