java类java.beans.PropertyChangeSupport的实例源码

ModulePathsProblemsProvider.java 文件源码 项目:incubator-netbeans 阅读 18 收藏 0 点赞 0 评论 0
public ModulePathsProblemsProvider(@NonNull final Lookup baseLkp) {
    this.project = baseLkp.lookup(J2SEProject.class);
    if (this.project == null) {
        throw new IllegalArgumentException(String.format(
                "Unsupported project: %s of type: %s",  //NOI18N
                project,
                project.getClass()
                ));
    }
    this.moduleInfoListeners = new HashSet<>();
    this.listeners = new PropertyChangeSupport(this);
}
DefaultFoldManager.java 文件源码 项目:powertext 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Constructor.
 *
 * @param textArea The text area whose folds we are managing.
 */
public DefaultFoldManager(RSyntaxTextArea textArea) {
    this.textArea = textArea;
    support = new PropertyChangeSupport(this);
    l = new Listener();
    textArea.getDocument().addDocumentListener(l);
    textArea.addPropertyChangeListener(RSyntaxTextArea.SYNTAX_STYLE_PROPERTY, l);
    textArea.addPropertyChangeListener("document", l);
    folds = new ArrayList<Fold>();
    updateFoldParser();
}
AbstractModel.java 文件源码 项目:incubator-netbeans 阅读 27 收藏 0 点赞 0 评论 0
public AbstractModel(ModelSource source) {
    this.source = source;
    pcs = new PropertyChangeSupport(this);
    ues = new ModelUndoableEditSupport();
    componentListeners = new EventListenerList();
    status = State.VALID;
}
EditorMimeTypesImpl.java 文件源码 项目:incubator-netbeans 阅读 18 收藏 0 点赞 0 评论 0
public EditorMimeTypesImpl() {
    this.es = EditorSettings.getDefault();
    this.listeners = new PropertyChangeSupport(this);
    this.listener = new PropertyChangeListener() {
        @Override
        public void propertyChange(@NonNull final PropertyChangeEvent evt) {
            if (evt.getPropertyName() == null || EditorSettings.PROP_MIME_TYPES.equals(evt.getPropertyName())) {
                listeners.firePropertyChange(PROP_SUPPORTED_MIME_TYPES, null, null);
            }
        }
    };
    this.es.addPropertyChangeListener(WeakListeners.propertyChange(listener, this.es));
}
KeyboardFocusManager.java 文件源码 项目:openjdk-jdk10 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Fires a PropertyChangeEvent in response to a change in a bound property.
 * The event will be delivered to all registered PropertyChangeListeners.
 * No event will be delivered if oldValue and newValue are the same.
 *
 * @param propertyName the name of the property that has changed
 * @param oldValue the property's previous value
 * @param newValue the property's new value
 */
protected void firePropertyChange(String propertyName, Object oldValue,
                                  Object newValue)
{
    if (oldValue == newValue) {
        return;
    }
    PropertyChangeSupport changeSupport = this.changeSupport;
    if (changeSupport != null) {
        changeSupport.firePropertyChange(propertyName, oldValue, newValue);
    }
}
EditorContextDispatcher.java 文件源码 项目:incubator-netbeans 阅读 20 收藏 0 点赞 0 评论 0
/**
 * 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);
            }
        }
    }
}
ClassPath.java 文件源码 项目:incubator-netbeans 阅读 34 收藏 0 点赞 0 评论 0
private ClassPath (ClassPathImplementation impl) {
    if (impl == null)
        throw new IllegalArgumentException ();
    this.propSupport = new PropertyChangeSupport(this);
    this.impl = impl;
    this.pListener = new SPIListener ();
    this.impl.addPropertyChangeListener (WeakListeners.propertyChange(this.pListener, this.impl));
    caller = new IllegalArgumentException();
}
Toolkit.java 文件源码 项目:jdk8u-jdk 阅读 29 收藏 0 点赞 0 评论 0
@Override
public synchronized void removePropertyChangeListener(
        String propertyName,
        PropertyChangeListener listener)
{
    PropertyChangeSupport pcs = (PropertyChangeSupport)
            AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
    if (null != pcs) {
        pcs.removePropertyChangeListener(propertyName, listener);
    }
}
Toolkit.java 文件源码 项目:openjdk-jdk10 阅读 25 收藏 0 点赞 0 评论 0
@Override
public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
    PropertyChangeSupport pcs = (PropertyChangeSupport)
            AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
    if (null != pcs) {
        pcs.removePropertyChangeListener(listener);
    }
}
Component.java 文件源码 项目:openjdk-jdk10 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Support for reporting bound property changes for Object properties.
 * This method can be called when a bound property has changed and it will
 * send the appropriate PropertyChangeEvent to any registered
 * PropertyChangeListeners.
 *
 * @param propertyName the property whose value has changed
 * @param oldValue the property's previous value
 * @param newValue the property's new value
 */
protected void firePropertyChange(String propertyName,
                                  Object oldValue, Object newValue) {
    PropertyChangeSupport changeSupport;
    synchronized (getObjectLock()) {
        changeSupport = this.changeSupport;
    }
    if (changeSupport == null ||
        (oldValue != null && newValue != null && oldValue.equals(newValue))) {
        return;
    }
    changeSupport.firePropertyChange(propertyName, oldValue, newValue);
}


问题


面经


文章

微信
公众号

扫码关注公众号