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

FormCustomEditor.java 文件源码 项目:incubator-netbeans 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Used by PropertyAction to mimic property sheet behavior - trying to invoke
 * PropertyEnv listener of the current property editor (we can't create our
 * own PropertyEnv instance).
 * 
 * @return current value
 * @throws java.beans.PropertyVetoException if someone vetoes this change.
 */
public Object commitChanges() throws PropertyVetoException {
    int currentIndex = editorsCombo.getSelectedIndex();
    PropertyEditor currentEditor = currentIndex > -1 ? allEditors[currentIndex] : null;
    if (currentEditor instanceof ExPropertyEditor) {
        // we can only guess - according to the typical pattern the propetry
        // editor itself or the custom editor usually implement the listener
        // registered in PropertyEnv
        PropertyChangeEvent evt = new PropertyChangeEvent(
                this, PropertyEnv.PROP_STATE, null, PropertyEnv.STATE_VALID);
        if (currentEditor instanceof VetoableChangeListener) {
            ((VetoableChangeListener)currentEditor).vetoableChange(evt);
        }
        Component currentCustEd = currentIndex > -1 ? allCustomEditors[currentIndex] : null;
        if (currentCustEd instanceof VetoableChangeListener) {
            ((VetoableChangeListener)currentCustEd).vetoableChange(evt);
        }
        if (currentEditor instanceof PropertyChangeListener) {
            ((PropertyChangeListener)currentEditor).propertyChange(evt);
        }
        if (currentCustEd instanceof PropertyChangeListener) {
            ((PropertyChangeListener)currentCustEd).propertyChange(evt);
        }
    }
    return commitChanges0();
}
EditorMimeTypes.java 文件源码 项目:incubator-netbeans 阅读 17 收藏 0 点赞 0 评论 0
private EditorMimeTypes() {
    impl = Lookup.getDefault().lookup(EditorMimeTypesImplementation.class);
    if (impl == null) {
        throw new IllegalStateException(String.format(
            "No %s instance in the default Lookup.",    //NOI18N
            EditorMimeTypesImplementation.class));
    }
    listeners = new PropertyChangeSupport(this);
    listener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (EditorMimeTypesImplementation.PROP_SUPPORTED_MIME_TYPES.equals(evt.getPropertyName())) {
                listeners.firePropertyChange(PROP_SUPPORTED_MIME_TYPES, null, null);
            }
        }
    };
    impl.addPropertyChangeListener(WeakListeners.propertyChange(listener, impl));
}
WToolkit.java 文件源码 项目:OpenJSharp 阅读 27 收藏 0 点赞 0 评论 0
@Override
public synchronized void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
    if (name == null) {
        // See JavaDoc for the Toolkit.addPropertyChangeListener() method
        return;
    }
    if ( WDesktopProperties.isWindowsProperty(name)
         || name.startsWith(awtPrefix)
         || name.startsWith(dndPrefix))
    {
        // someone is interested in Windows-specific desktop properties
        // we should initialize wprops
        lazilyInitWProps();
    }
    super.addPropertyChangeListener(name, pcl);
}
MenuFakeSupport.java 文件源码 项目:incubator-netbeans 阅读 19 收藏 0 点赞 0 评论 0
@Override
public void addComponentsToContainer(Container container,
                                     Container containerDelegate,
                                     Component[] components,
                                     int index)
{
    for (int i=0; i < components.length; i++) {
        containerDelegate.add(components[i], i + index);
        // Issue 110587 - the default background of menu depends (on some l&f)
        // on the location of the menu (if it is top-level menu or not).
        // The background is changed when "ancestor" property change event
        // is fired. This usually happens when addNotify() is called.
        // Unfortunately, addNotify() is not called if the parent doesn't
        // have peer - this happens for model instances. The following
        // code fires the property change event explicitly to force
        // update of the background.
        PropertyChangeEvent event = new PropertyChangeEvent(components[i], "ancestor", null, container); // NOI18N
        for (PropertyChangeListener listener : components[i].getPropertyChangeListeners()) {
            listener.propertyChange(event);
        }
    }
}
CompletionLayout.java 文件源码 项目:incubator-netbeans 阅读 21 收藏 0 点赞 0 评论 0
public CompletionLayout(PropertyChangeListener listener) {
    this.listener = listener;
    completionPopup = new CompletionPopup();
    completionPopup.setLayout(this);
    completionPopup.setPreferDisplayAboveCaret(false);
    docPopup = new DocPopup();
    docPopup.setLayout(this);
    docPopup.setPreferDisplayAboveCaret(false);
    visiblePopups = new LinkedList<CompletionLayoutPopup>();
}
ProjectUtilsTest.java 文件源码 项目:incubator-netbeans 阅读 18 收藏 0 点赞 0 评论 0
@Override
public ProjectInformation getProjectInformation(final Project project) {
    ProjectInformation info =  project.getLookup().lookup(ProjectInformation.class);
    if (info == null) {
        info = new ProjectInformation() {
            @Override
            public String getName() {
                return project.getProjectDirectory().getName();
            }

            @Override
            public String getDisplayName() {
                return getName();
            }

            @Override
            public Icon getIcon() {
                return null;
            }

            @Override
            public Project getProject() {
                return project;
            }

            @Override
            public void addPropertyChangeListener(PropertyChangeListener listener) {
            }

            @Override
            public void removePropertyChangeListener(PropertyChangeListener listener) {
            }
        };
    }
    return info;
}
NbModuleProject.java 文件源码 项目:incubator-netbeans 阅读 19 收藏 0 点赞 0 评论 0
private void registerListener(Object qimpl, ExtraSJQEvaluator eJSQEval) {
    try {
        // XXX #66275: ugly hack until proper API change;
        // we need ESJQI to work when project is loaded - not opened - to resolve deps on lib wrapper modules correctly
        Field listenerF = qimpl.getClass().getDeclaredField("listener"); // NOI18N
        listenerF.setAccessible(true);
        eJSQEval.addPropertyChangeListener((PropertyChangeListener) listenerF.get(qimpl));
    } catch (Exception ex) {
        Logger.getLogger(NbModuleProject.class.getName()).log(Level.FINE, "Turning off source query support for loaded project '" + ProjectUtils.getInformation(this).getDisplayName() + "'", ex);
    }
}
VersioningSystem.java 文件源码 项目:incubator-netbeans 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Backdoor for DelegatingVCS
 * 
 * @return 
 */
void moveChangeListeners(VersioningSystem system) {
    synchronized(support) {
        PropertyChangeListener[] listeners = support.getPropertyChangeListeners();
        for (PropertyChangeListener l : listeners) {
            system.addPropertyChangeListener(l);
            this.removePropertyChangeListener(l);
        }
    }
}
CodeEvaluatorUI.java 文件源码 项目:incubator-netbeans 阅读 19 收藏 0 点赞 0 评论 0
public static void addResultListener(final PropertyChangeListener listener) {
    rp.post(new Runnable() {
        @Override
        public void run() {
            CodeEvaluatorUI defaultInstance = getDefaultInstance();
            if (defaultInstance != null) {
                synchronized(defaultInstance.pcs) {
                    defaultInstance.pcs.addPropertyChangeListener(listener);
                }
            }
        }
    });
}
MavenOptionController.java 文件源码 项目:incubator-netbeans 阅读 18 收藏 0 点赞 0 评论 0
void firePropChange(String property, Object oldVal, Object newVal) {
    ArrayList<PropertyChangeListener> lst;
    synchronized (listeners) {
        lst = new ArrayList<PropertyChangeListener>(listeners);
    }
    PropertyChangeEvent evnt = new PropertyChangeEvent(this, property, oldVal, newVal);
    for (PropertyChangeListener prop : lst) {
        if (prop == null) {
            //#180218
            continue;
        }
        prop.propertyChange(evnt);
    }
}
ProxyClient.java 文件源码 项目:jdk8u-jdk 阅读 22 收藏 0 点赞 0 评论 0
public void removePropertyChangeListener(PropertyChangeListener listener) {
    if (!(listener instanceof WeakPCL)) {
        // Search for the WeakPCL holding this listener (if any)
        for (PropertyChangeListener pcl : propertyChangeSupport.getPropertyChangeListeners()) {
            if (pcl instanceof WeakPCL && ((WeakPCL)pcl).get() == listener) {
                listener = pcl;
                break;
            }
        }
    }
    propertyChangeSupport.removePropertyChangeListener(listener);
}
DelegatingVCS.java 文件源码 项目:incubator-netbeans 阅读 17 收藏 0 点赞 0 评论 0
@Override
public final void addPropertyCL(PropertyChangeListener listener) {
    synchronized(DELEGATE_LOCK) {
        if(delegate == null) {
            support.addPropertyChangeListener(listener);
        } else {
            delegate.addPropertyChangeListener(listener);
        }
    }
}
ModeToggleButton.java 文件源码 项目:jtk 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Constructs a mode toggle button for the specified mode.
 * @param mode the mode.
 */
public ModeToggleButton(Mode mode) {
  super(mode);
  setText(null); // ignore mode text (is for menus)
  setMnemonic(0); // ignore mnemonic (is for menus)
  mode.addPropertyChangeListener(new PropertyChangeListener() {
    public void propertyChange(PropertyChangeEvent e) {
      if (e.getPropertyName().equals("active"))
        setSelected((Boolean)e.getNewValue());
    }
  });
}
PaletteUtils.java 文件源码 项目:incubator-netbeans 阅读 19 收藏 0 点赞 0 评论 0
public static synchronized void removePaletteListener(PropertyChangeListener listener,
                                                      FileObject context)
{
    Project project = FileOwnerQuery.getOwner(context);
    ProjectPaletteInfo pInfo = palettes.get(project);
    if (pInfo != null && pInfo.paletteListeners != null) {
        pInfo.paletteListeners.remove(listener);
        pInfo.getPalette().removePropertyChangeListener(listener);
    }
}
FilterNode.java 文件源码 项目:incubator-netbeans 阅读 18 收藏 0 点赞 0 评论 0
/** Getter for property change listener.
*/
PropertyChangeListener getPropertyChangeListener() {
    synchronized (LISTENER_LOCK) {
        if (propL == null) {
            propL = createPropertyChangeListener();
        }

        return propL;
    }
}
Container.java 文件源码 项目:OpenJSharp 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Adds a PropertyChangeListener to the listener list.
 *
 * @param listener  the PropertyChangeListener to be added
 */
public void addPropertyChangeListener(PropertyChangeListener listener) {
    if (accessibleContainerHandler == null) {
        accessibleContainerHandler = new AccessibleContainerHandler();
    }
    if (propertyListenersCount++ == 0) {
        Container.this.addContainerListener(accessibleContainerHandler);
    }
    super.addPropertyChangeListener(listener);
}
LocalePropertyEditor.java 文件源码 项目:incubator-netbeans 阅读 18 收藏 0 点赞 0 评论 0
/** Gets custom editor. Overrides superclass method. */
public Component getCustomEditor() {
    final LocalePanel localePanel = new LocalePanel(locale);

    localePanel.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if(LocalePanel.PROP_CUSTOMIZED_LOCALE.equals(evt.getPropertyName()))
                setValue(localePanel.getLocale());
        }
    });

    return localePanel;
}
VersioningSystem.java 文件源码 项目:incubator-netbeans 阅读 16 收藏 0 点赞 0 评论 0
/**
 * Adds a listener for change events.
 * 
 * @param listener a PropertyChangeListener 
 */ 
public final void addPropertyChangeListener(PropertyChangeListener listener) {
    synchronized(support) {
        support.addPropertyChangeListener(listener);
    }
}
MuxClassPathImplementationTest.java 文件源码 项目:incubator-netbeans 阅读 19 收藏 0 点赞 0 评论 0
@Override
public void addPropertyChangeListener(PropertyChangeListener listener) {
    cs.addPropertyChangeListener(listener);
}
SourcePathImplementation.java 文件源码 项目:incubator-netbeans 阅读 19 收藏 0 点赞 0 评论 0
public void addPropertyChangeListener(PropertyChangeListener listener) {
    support.addPropertyChangeListener (listener);
}
Test4353056.java 文件源码 项目:openjdk-jdk10 阅读 17 收藏 0 点赞 0 评论 0
public void addPropertyChangeListener(PropertyChangeListener listener) {
    this.pcs.addPropertyChangeListener(listener);
}
JavaTypeProviderTest.java 文件源码 项目:incubator-netbeans 阅读 20 收藏 0 点赞 0 评论 0
public void removePropertyChangeListener(final PropertyChangeListener listener) {
    assert listener != null;
    this.support.removePropertyChangeListener(listener);
}
ScanningScopeList.java 文件源码 项目:incubator-netbeans 阅读 14 收藏 0 点赞 0 评论 0
public void removePropertyChangeListener( PropertyChangeListener pcl ) {
    propertySupport.removePropertyChangeListener( pcl );
}
SpellcheckerOptionsPanelController.java 文件源码 项目:incubator-netbeans 阅读 16 收藏 0 点赞 0 评论 0
public void removePropertyChangeListener(PropertyChangeListener l) {
    pcs.removePropertyChangeListener(l);
}
Test7192955.java 文件源码 项目:jdk8u-jdk 阅读 17 收藏 0 点赞 0 评论 0
public void removePropertyChangeListener(PropertyChangeListener listener) {
}
LogReader.java 文件源码 项目:NBANDROID-V2 阅读 24 收藏 0 点赞 0 评论 0
public void addPropertyChangeListener(PropertyChangeListener listener) {
    this.changeSupport.addPropertyChangeListener(listener);
}
SourceGroupsTest.java 文件源码 项目:incubator-netbeans 阅读 19 收藏 0 点赞 0 评论 0
public void removePropertyChangeListener(PropertyChangeListener listener) {
    throw new UnsupportedOperationException("Not supported yet.");
}
SetGlobalProperty.java 文件源码 项目:VASSAL-src 阅读 16 收藏 0 点赞 0 评论 0
public Ed(final SetGlobalProperty m) {
  keyCommandListConfig = new ListConfigurer(null, "Key Commands") {
    protected Configurer buildChildConfigurer() {
      return new DynamicKeyCommandConfigurer(m);
    }
  };
  keyCommandListConfig.setValue(
    new ArrayList<DynamicKeyCommand>(Arrays.asList(m.keyCommands)));
  PropertyChangeListener l = new PropertyChangeListener() {
    public void propertyChange(PropertyChangeEvent evt) {
      boolean isNumeric = numericConfig.booleanValue().booleanValue();
      minConfig.getControls().setVisible(isNumeric);
      maxConfig.getControls().setVisible(isNumeric);
      wrapConfig.getControls().setVisible(isNumeric);
      keyCommandListConfig.repack();
    }
  };
  controls = Box.createVerticalBox();
  descConfig = new StringConfigurer(null, "Description:  ", m.description);
  controls.add(descConfig.getControls());
  nameConfig = new PropertyNameExpressionConfigurer(null, "Global Property Name:  ", m.getKey(), (EditablePiece) m);
  controls.add(nameConfig.getControls());
  levelConfig = new StringEnumConfigurer(null, "", new String[]{CURRENT_ZONE, NAMED_ZONE, NAMED_MAP});
  levelConfig.setValue(m.propertyLevel);
  levelConfig.addPropertyChangeListener(new PropertyChangeListener() {
    public void propertyChange(PropertyChangeEvent e) {
      updateVisibility();
    }
  });
  Box box = Box.createHorizontalBox();
  box.add(new JLabel("Locate Property starting in the:   "));
  box.add(levelConfig.getControls());
  controls.add(box);
  nameBox = Box.createHorizontalBox();
  nameBox.add(new JLabel("Name of "));
  nameBox.add(mapLabel);
  nameBox.add(zoneLabel);
  nameBox.add(new JLabel(" containing property:  "));
  searchNameConfig = new FormattedExpressionConfigurer(null, "", m.searchName, (EditablePiece) m);
  nameBox.add(searchNameConfig.getControls());
  controls.add(nameBox);
  numericConfig = new BooleanConfigurer(null, "Is numeric?", m.isNumeric());
  controls.add(numericConfig.getControls());
  minConfig =
    new IntConfigurer(null, "Minimum value:  ", m.getMinimumValue());
  controls.add(minConfig.getControls());
  maxConfig =
    new IntConfigurer(null, "Maximum value:  ", m.getMaximumValue());
  controls.add(maxConfig.getControls());
  wrapConfig = new BooleanConfigurer(null, "Wrap?", m.isWrap());
  controls.add(wrapConfig.getControls());
  controls.add(keyCommandListConfig.getControls());
  numericConfig.addPropertyChangeListener(l);
  numericConfig.fireUpdate();
  updateVisibility();
}
WellKnownSchemaCatalog.java 文件源码 项目:incubator-netbeans 阅读 23 收藏 0 点赞 0 评论 0
@Override
public void addPropertyChangeListener(PropertyChangeListener l) {}
LibrariesCustomizer.java 文件源码 项目:incubator-netbeans 阅读 25 收藏 0 点赞 0 评论 0
@Override public void addPropertyChangeListener(PropertyChangeListener l) {
    getLibraryImplementation().addPropertyChangeListener(l);
}


问题


面经


文章

微信
公众号

扫码关注公众号