本文整理汇总了Java中java.beans.PropertyChangeListener类的典型用法代码示例。如果您正苦于以下问题:Java PropertyChangeListener类的具体用法?Java PropertyChangeListener怎么用?Java PropertyChangeListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyChangeListener类属于java.beans包,在下文中一共展示了PropertyChangeListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: commitChanges
import java.beans.PropertyChangeListener; //导入依赖的package包/类
/**
* 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();
}
示例2: EditorMimeTypes
import java.beans.PropertyChangeListener; //导入依赖的package包/类
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));
}
示例3: addPropertyChangeListener
import java.beans.PropertyChangeListener; //导入依赖的package包/类
@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);
}
示例4: addComponentsToContainer
import java.beans.PropertyChangeListener; //导入依赖的package包/类
@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);
}
}
}
示例5: CompletionLayout
import java.beans.PropertyChangeListener; //导入依赖的package包/类
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>();
}
示例6: getProjectInformation
import java.beans.PropertyChangeListener; //导入依赖的package包/类
@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;
}
示例7: registerListener
import java.beans.PropertyChangeListener; //导入依赖的package包/类
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);
}
}
示例8: moveChangeListeners
import java.beans.PropertyChangeListener; //导入依赖的package包/类
/**
* Backdoor for DelegatingVCS
*
* @return
*/
void moveChangeListeners(VersioningSystem system) {
synchronized(support) {
PropertyChangeListener[] listeners = support.getPropertyChangeListeners();
for (PropertyChangeListener l : listeners) {
system.addPropertyChangeListener(l);
this.removePropertyChangeListener(l);
}
}
}
示例9: addResultListener
import java.beans.PropertyChangeListener; //导入依赖的package包/类
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);
}
}
}
});
}
示例10: firePropChange
import java.beans.PropertyChangeListener; //导入依赖的package包/类
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);
}
}
示例11: removePropertyChangeListener
import java.beans.PropertyChangeListener; //导入依赖的package包/类
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);
}
示例12: addPropertyCL
import java.beans.PropertyChangeListener; //导入依赖的package包/类
@Override
public final void addPropertyCL(PropertyChangeListener listener) {
synchronized(DELEGATE_LOCK) {
if(delegate == null) {
support.addPropertyChangeListener(listener);
} else {
delegate.addPropertyChangeListener(listener);
}
}
}
示例13: ModeToggleButton
import java.beans.PropertyChangeListener; //导入依赖的package包/类
/**
* 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());
}
});
}
示例14: removePaletteListener
import java.beans.PropertyChangeListener; //导入依赖的package包/类
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);
}
}
示例15: getPropertyChangeListener
import java.beans.PropertyChangeListener; //导入依赖的package包/类
/** Getter for property change listener.
*/
PropertyChangeListener getPropertyChangeListener() {
synchronized (LISTENER_LOCK) {
if (propL == null) {
propL = createPropertyChangeListener();
}
return propL;
}
}