Java 类java.beans.PropertyChangeSupport 实例源码

项目:openjdk-jdk10    文件:TestEquals.java   
public static void main(String[] args) {
    TestEquals one = new TestEquals(1);
    TestEquals two = new TestEquals(2);

    Object source = TestEquals.class;
    PropertyChangeSupport pcs = new PropertyChangeSupport(source);
    pcs.addPropertyChangeListener(PROPERTY, one);
    pcs.addPropertyChangeListener(PROPERTY, two);

    PropertyChangeEvent event = new PropertyChangeEvent(source, PROPERTY, one, two);
    pcs.firePropertyChange(event);
    test(one, two, 1); // only one check
    pcs.firePropertyChange(PROPERTY, one, two);
    test(one, two, 2); // because it invokes firePropertyChange(PropertyChangeEvent)
    pcs.fireIndexedPropertyChange(PROPERTY, 1, one, two);
    test(one, two, 2); // because it invokes firePropertyChange(PropertyChangeEvent)
}
项目:incubator-netbeans    文件:ForwardingLibraryImplementation.java   
/**
 * Creates a new {@link ForwardingLibraryImplementation}.
 * @param delegate the delegate
 */
public ForwardingLibraryImplementation(@NonNull final LibraryImplementation delegate) {
    Parameters.notNull("delegate", delegate);   //NOI18N
    this.delegate = delegate;
    this.support = new PropertyChangeSupport(this);
    this.listener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            ForwardingLibraryImplementation.this.support.firePropertyChange(
                evt.getPropertyName(),
                evt.getOldValue(),
                evt.getNewValue());
        }
    };
    this.delegate.addPropertyChangeListener(WeakListeners.propertyChange(
        this.listener,
        this.delegate));
}
项目:incubator-netbeans    文件:OpenProjectList.java   
OpenProjectList() {
    LOAD = new LoadOpenProjects(0);
    openProjects = new ArrayList<Project>();
    openProjectsModuleInfos = new HashMap<ModuleInfo, List<Project>>();
    infoListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evn) {
            if (ModuleInfo.PROP_ENABLED.equals(evn.getPropertyName())) {
                checkModuleInfo((ModuleInfo)evn.getSource());
            }
        }
    };
    pchSupport = new PropertyChangeSupport( this );
    recentProjects = new RecentProjectList(10); // #47134
    recentTemplates = new ArrayList<String>();
    projectGroupSupport = new ArrayList<ProjectGroupChangeListener>();
}
项目:FxTreeMap    文件:MapDataAdapter.java   
/**
 * Creates a new MapDataAdapter from the given list of objects.
 *
 * @param dataCollectionName the name given to the objects group
 * @param dataObjects list containing data to be aggregated as children
 * @param valueFunction the function used to calculated the objects value
 * @param nameFunction the function used to get the objects name
 */
public MapDataAdapter(String dataCollectionName, List<T> dataObjects, DataValueFunction<T> valueFunction, DataNameFunction<T> nameFunction) {
    if (dataObjects == null) {
        throw new IllegalArgumentException("dataObjects should not be null");
    }
    if (valueFunction == null) {
        throw new IllegalArgumentException(VALUE_F_NULL_MESSAGE);
    }
    propertyChangeSupport = new PropertyChangeSupport(MapDataAdapter.this);
    dataType = DataType.NODE;
    name = dataCollectionName;
    dataValueFunction = valueFunction;
    dataNameFunction = nameFunction;
    dataObject = null;
    dataAdapters = new LinkedList<>();
    dataObjectList = new LinkedList<>(dataObjects);
    dataObjectList.forEach(o -> dataAdapters.add(new MapDataAdapter<>(o, valueFunction, nameFunction)));
    recalculate();
    lastNotifiedValue = value;
}
项目:incubator-netbeans    文件:ProgressFrame.java   
/** Creates new form ProgressFrame */
public ProgressFrame() {
    propertySupport = new PropertyChangeSupport(this);

    initComponents ();
    this.getAccessibleContext().setAccessibleDescription(bundle.getString("ACS_ProgressFrameTabA11yDesc"));  // NOI18N
    okButton.getAccessibleContext().setAccessibleDescription(bundle.getString("ACS_CancelButtonA11yDesc"));  // NOI18N

    progressHandle = ProgressHandleFactory.createHandle(null);
    progressComponent = ProgressHandleFactory.createProgressComponent(progressHandle);
    progressPanel.add(progressComponent);
    progressHandle.start();

    javax.swing.ImageIcon ideIcon = new javax.swing.ImageIcon("/org/netbeans/core/resources/frames/ide.gif"); //NOI18N
    setIconImage(ideIcon.getImage());

    java.awt.Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    setSize(380, 150);
    setLocation(dim.width/2 - 190, dim.height/2 - 80);
}
项目:incubator-netbeans    文件:JPDADebuggerImpl.java   
public JPDADebuggerImpl (ContextProvider lookupProvider) {
    this.lookupProvider = lookupProvider;

    Properties p = Properties.getDefault().getProperties("debugger.options.JPDA");
    int stepResume = p.getInt("StepResume", (SINGLE_THREAD_STEPPING) ? 1 : 0);
    suspend = (stepResume == 1) ? SUSPEND_EVENT_THREAD : SUSPEND_ALL;

    pcs = new PropertyChangeSupport (this);
    List l = lookupProvider.lookup (null, DebuggerEngineProvider.class);
    int i, k = l.size ();
    for (i = 0; i < k; i++) {
        if (l.get (i) instanceof JavaEngineProvider) {
            javaEngineProvider = (JavaEngineProvider) l.get (i);
        }
    }
    if (javaEngineProvider == null) {
        throw new IllegalArgumentException
            ("JavaEngineProvider have to be used to start JPDADebugger!");
    }
    languages = new HashSet<String>();
    languages.add ("Java");
    threadsTranslation = ObjectTranslation.createThreadTranslation(this);
    localsTranslation = ObjectTranslation.createLocalsTranslation(this);
    this.expressionPool = new ExpressionPool();
    io = new DebuggerConsoleIO(this, lookupProvider);
}
项目:incubator-netbeans    文件:MainProjectManager.java   
@java.lang.SuppressWarnings("LeakingThisInConstructor")
private MainProjectManager () {
    pcs = new PropertyChangeSupport (this);
    a = ProjectSensitiveActions.projectSensitiveAction (
        this, "x", null
    );
    OpenProjects.getDefault().addPropertyChangeListener(this);
    currentProject = new WeakReference<Project>(OpenProjects.getDefault().getMainProject());
    isMainProject = currentProject.get() != null;
    a.addPropertyChangeListener(this); // I'm listening on it so that I get enable() called.
    SwingUtilities.invokeLater(new Runnable() {
        public @Override void run() {
            a.isEnabled();
        }
    });
}
项目:incubator-netbeans    文件:AbstractNbTaskWrapper.java   
/** PRIVATE TASK ATTRIBUTES **/

    public AbstractNbTaskWrapper (NbTask task) {
        this.task = task;
        this.repositoryDataRef = new SoftReference<TaskData>(null);
        support = new PropertyChangeSupport(this);
        repositoryTaskDataLoaderTask = RP.create(new Runnable() {
            @Override
            public void run () {
                loadRepositoryTaskData();
            }
        });
        MylynSupport mylynSupp = MylynSupport.getInstance();
        taskDataListener = new TaskDataListenerImpl();
        mylynSupp.addTaskDataListener(WeakListeners.create(TaskDataListener.class, taskDataListener, mylynSupp));
        taskListener = new TaskListenerImpl();
        task.addNbTaskListener(WeakListeners.create(NbTaskListener.class, taskListener, mylynSupp));
    }
项目:jdk8u-jdk    文件:TestEquals.java   
public static void main(String[] args) {
    TestEquals one = new TestEquals(1);
    TestEquals two = new TestEquals(2);

    Object source = TestEquals.class;
    PropertyChangeSupport pcs = new PropertyChangeSupport(source);
    pcs.addPropertyChangeListener(PROPERTY, one);
    pcs.addPropertyChangeListener(PROPERTY, two);

    PropertyChangeEvent event = new PropertyChangeEvent(source, PROPERTY, one, two);
    pcs.firePropertyChange(event);
    test(one, two, 1); // only one check
    pcs.firePropertyChange(PROPERTY, one, two);
    test(one, two, 2); // because it invokes firePropertyChange(PropertyChangeEvent)
    pcs.fireIndexedPropertyChange(PROPERTY, 1, one, two);
    test(one, two, 2); // because it invokes firePropertyChange(PropertyChangeEvent)
}
项目:VISNode    文件:OutputNode.java   
/**
 * Creates a new output node
 */
public OutputNode() {
    this.connector = new NodeConnector(this);
    propertyChangeSupport = new PropertyChangeSupport(this);
    listenerList = new EventListenerList();
    img = null;
}
项目:FxTreeMap    文件:FxMapModel.java   
public FxMapModel(FxTreeMap treeMap, MapData mapData, double width, double height) {
    modelData = mapData;
    mapItems = new LinkedList<>();
    propertyChangeSupport = new PropertyChangeSupport(FxMapModel.this);
    propertyChangeSupport.addPropertyChangeListener(treeMap);
    style = new TreeMapStyle();
    style.removePropertyChangeListener(FxMapModel.this);
    totalArea = width * height;
    modelData.getChildrenData().forEach(d -> {
        FxMapItem mapItem = new FxMapItem(FxMapModel.this, d);
        mapItems.add(mapItem);
    });
    modelData.addPropertyChangeListener(this::handleModelChange);
}
项目:incubator-netbeans    文件:MockPropertyChangeListenerTest.java   
@Override
protected void setUp() throws Exception {
    super.setUp();
    source = new Object();
    pcs = new PropertyChangeSupport(source);
    l = new MockPropertyChangeListener();
    pcs.addPropertyChangeListener(l);
}
项目:jdk8u-jdk    文件:KeyboardFocusManager.java   
/**
 * 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);
    }
}
项目:OpenJSharp    文件:Component.java   
/**
 * 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);
}
项目:OpenJSharp    文件:KeyboardFocusManager.java   
/**
 * 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);
    }
}
项目:incubator-netbeans    文件:SharedClassObject.java   
/** Adds the specified property change listener to receive property
 * change events from this object.
 * @param         l the property change listener
 */
public final void addPropertyChangeListener(PropertyChangeListener l) {
    boolean noListener;

    synchronized (getLock()) {
        //      System.out.println ("added listener: " + l + " to: " + getClass ()); // NOI18N
        PropertyChangeSupport supp = (PropertyChangeSupport) getProperty(PROP_SUPPORT);

        if (supp == null) {
            //        System.out.println ("Creating support"); // NOI18N
            putProperty(PROP_SUPPORT, supp = new PropertyChangeSupport(this));
        }

        noListener = !supp.hasListeners(null);
        supp.addPropertyChangeListener(l);
    }

    if (noListener) {
        addNotifySuper = false;
        addNotify();

        if (!addNotifySuper) {
            // [PENDING] theoretical race condition for this warning if listeners are added
            // and removed very quickly from two threads, I guess, and addNotify() impl is slow
            String msg = "You must call super.addNotify() from " + getClass().getName() + ".addNotify()"; // NOI18N
            err.warning(msg);
        }
    }
}
项目:incubator-netbeans    文件:SharedClassObject.java   
/**
 * Removes the specified property change listener so that it
 * no longer receives property change events from this object.
 * @param         l     the property change listener
 */
public final void removePropertyChangeListener(PropertyChangeListener l) {
    boolean callRemoved;

    synchronized (getLock()) {
        PropertyChangeSupport supp = (PropertyChangeSupport) getProperty(PROP_SUPPORT);

        if (supp == null) {
            return;
        }

        boolean hasListener = supp.hasListeners(null);
        supp.removePropertyChangeListener(l);
        callRemoved = hasListener && !supp.hasListeners(null);
    }

    if (callRemoved) {
        putProperty(PROP_SUPPORT, null); // clean the PCS, see #25417
        removeNotifySuper = false;
        removeNotify();

        if (!removeNotifySuper) {
            String msg = "You must call super.removeNotify() from " + getClass().getName() + ".removeNotify()"; // NOI18N
            err.warning(msg);
        }
    }
}
项目:jdk8u-jdk    文件:Toolkit.java   
@Override
public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
    PropertyChangeSupport pcs = (PropertyChangeSupport)
            AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
    if (null != pcs) {
        pcs.removePropertyChangeListener(listener);
    }
}
项目:gw4e.project    文件:GWNode.java   
public GWNode(UUID uuid,String name,String id) {
    this.uuid = uuid;
    this.id = id;
    this.setName(name);
    this.in = new ArrayList<GWLink>();
    this.out = new ArrayList<GWLink>();
    this.listeners = new PropertyChangeSupport(this);
}
项目:incubator-netbeans    文件:RecentProjects.java   
/**
 * Creates a new instance of RecentProjects
 */
private RecentProjects() {
    pch = new PropertyChangeSupport(this);
    OpenProjectList.getDefault().addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals(OpenProjectList.PROPERTY_RECENT_PROJECTS)) {
                pch.firePropertyChange(new PropertyChangeEvent(RecentProjects.class,
                        PROP_RECENT_PROJECT_INFO, null, null));
            }
        }
    });
}
项目:incubator-netbeans    文件:PaletteController.java   
/** Create new instance of PaletteController */
PaletteController( Model model, Settings settings ) {
    this.model = model;
    this.settings = settings;

    support = new PropertyChangeSupport( this );
    this.model.addModelListener( new ModelListener() {
        public void propertyChange(java.beans.PropertyChangeEvent evt) {
            if( Model.PROP_SELECTED_ITEM.equals( evt.getPropertyName() ) ) {
                Lookup oldValue = null == evt.getOldValue() ? Lookup.EMPTY : ((Item)evt.getOldValue()).getLookup();
                Lookup newValue = null == evt.getNewValue() ? Lookup.EMPTY : ((Item)evt.getNewValue()).getLookup();
                support.firePropertyChange( PROP_SELECTED_ITEM, oldValue, newValue );
            }
        }

        public void categoriesRemoved(Category[] removedCategories) {
            //not interested
        }

        public void categoriesAdded(Category[] addedCategories) {
            //not interested
        }

        public void categoriesReordered() {
            //not interested
        }
    });
}
项目:jaer    文件:ParameterControlPanel.java   
/** Builds a new panel around the Object f. Any properties of the Object (defined by matching <code>setX/getX</code> methods)
     * are added to the panel. If the object implements {@link HasPropertyTooltips} then a tooltip is added for the property if the 
     * {@link HasPropertyTooltips#getPropertyTooltip(java.lang.String) } returns a non-null String property.
     * 
     * @param obj the object
     */
    public ParameterControlPanel(Object obj) {
        setClazz(obj);
        initComponents();
        String cn = getClazz().getClass().getName();
        int lastdot = cn.lastIndexOf('.');
        String name = cn.substring(lastdot + 1);
        setName(name);
        titledBorder = new TitledBorder(name);
        titledBorder.getBorderInsets(this).set(1, 1, 1, 1);
        setBorder(titledBorder);
        normalBorder = titledBorder.getBorder();
        redLineBorder = BorderFactory.createLineBorder(Color.red);
        addIntrospectedControls();
//            add(new JPanel()); // to fill vertical space in GridLayout
            add(Box.createVerticalGlue()); // to fill space at bottom - not needed
        try {
            // when clazz fires a property change event, propertyChangeEvent is called here and we refresh all our controls
            Method m=obj.getClass().getMethod("getPropertyChangeSupport", (Class[])null);
            support=(PropertyChangeSupport)m.invoke(obj, (Object[]) null);
            support.addPropertyChangeListener(this);
        } catch (Exception ex) {

        } 
//            if(f instanceof PropertyChangeListener){
//        ((PropertyChangeListener)f).getPropertyChangeSupport().addPropertyChangeListener(this);
//                }
        ToolTipManager.sharedInstance().setDismissDelay(10000); // to show tips
        revalidate();
    }
项目:incubator-netbeans    文件:RevisionInfoPanelController.java   
public RevisionInfoPanelController (File repository) {
    this.repository = repository;
    this.loadInfoTask = Git.getInstance().getRequestProcessor(null).create(loadInfoWorker);
    this.panel = new RevisionInfoPanel();
    this.support = new PropertyChangeSupport(this);
    resetInfoFields();
}
项目:incubator-netbeans    文件:RepositoryRevision.java   
RepositoryRevision (GitRevisionInfo message, File repositoryRoot, File[] selectionRoots,
        Set<GitTag> tags, Set<GitBranch> branches, File dummyFile, String dummyFileRelativePath,
        SearchExecutor.Mode mode) {
    this.message = message;
    this.repositoryRoot = repositoryRoot;
    this.selectionRoots = selectionRoots;
    this.tags = tags;
    this.branches = branches;
    support = new PropertyChangeSupport(this);
    dummyEvents = new ArrayList<Event>(1);
    if (dummyFile != null && dummyFileRelativePath != null) {
        dummyEvents.add(new Event(dummyFile, dummyFileRelativePath));
    }
    this.mode = mode;
}
项目:powertext    文件:SearchContext.java   
@Override
public SearchContext clone() {
    try {
        SearchContext context = null;
        context = (SearchContext)super.clone();
        // Don't copy over listeners
        context.support = new PropertyChangeSupport(context);
        return context;
    } catch (CloneNotSupportedException cnse) { // Never happens
        throw new RuntimeException("Should never happen", cnse);
    }
}
项目:incubator-netbeans    文件:RepositoryRevision.java   
public RepositoryRevision(ISVNLogMessage message, SVNUrl rootUrl, File[] selectionRoots,
        Map<String,File> pathToRoot, Map<String, SVNRevision> pegRevisions) {
    this.message = message;
    this.repositoryRootUrl = rootUrl;
    this.selectionRoots = selectionRoots;
    support = new PropertyChangeSupport(this);
    this.pathToRoot = pathToRoot;
    this.pegRevisions = pegRevisions;
    initFakeRootEvent();
}
项目:incubator-netbeans    文件:DefaultProjectConvertorServices.java   
ProjectInfo(
        @NonNull final Project project,
        @NonNull final ProjectConvertor.Result result) {
    Parameters.notNull("project", project); //NOI18N
    Parameters.notNull("result", result);   //NOI18N
    this.project = project;
    this.result = result;
    this.pcs = new PropertyChangeSupport(this);
    this.eventSource = project.getLookup().lookupResult(ProjectInformation.class);
    this.eventSource.addLookupListener(WeakListeners.create(LookupListener.class, this, eventSource));
}
项目:incubator-netbeans    文件:CreatorBasedLazyFixList.java   
/** Creates a new instance of CreatorBasedLazyFixList */
public CreatorBasedLazyFixList(FileObject file, String diagnosticKey, int offset, Collection<ErrorRule> c, Map<Class, Data> class2Data) {
    this.pcs = new PropertyChangeSupport(this);
    this.file = file;
    this.diagnosticKey = diagnosticKey;
    this.offset = offset;
    this.c = c;
    this.class2Data = class2Data;
    this.fixes = Collections.<Fix>emptyList();
}
项目:openjdk-jdk10    文件:Toolkit.java   
private static PropertyChangeSupport createPropertyChangeSupport(Toolkit toolkit) {
    if (toolkit instanceof SunToolkit || toolkit instanceof HeadlessToolkit) {
        return new DesktopPropertyChangeSupport(toolkit);
    } else {
        return new PropertyChangeSupport(toolkit);
    }
}
项目:jdk8u-jdk    文件:Toolkit.java   
@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];
    }
}
项目:incubator-netbeans    文件:ModulePathsProblemsProvider.java   
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);
}
项目:powertext    文件:DefaultFoldManager.java   
/**
 * 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();
}
项目:incubator-netbeans    文件:AbstractModel.java   
public AbstractModel(ModelSource source) {
    this.source = source;
    pcs = new PropertyChangeSupport(this);
    ues = new ModelUndoableEditSupport();
    componentListeners = new EventListenerList();
    status = State.VALID;
}
项目:incubator-netbeans    文件:EditorMimeTypesImpl.java   
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));
}
项目:openjdk-jdk10    文件:KeyboardFocusManager.java   
/**
 * 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);
    }
}
项目:incubator-netbeans    文件:EditorContextDispatcher.java   
/**
 * 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);
            }
        }
    }
}
项目:incubator-netbeans    文件:ClassPath.java   
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();
}
项目:jdk8u-jdk    文件:Toolkit.java   
@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);
    }
}
项目:openjdk-jdk10    文件:Toolkit.java   
@Override
public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
    PropertyChangeSupport pcs = (PropertyChangeSupport)
            AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
    if (null != pcs) {
        pcs.removePropertyChangeListener(listener);
    }
}
项目:openjdk-jdk10    文件:Component.java   
/**
 * 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);
}