本文整理汇总了Java中java.beans.PropertyChangeListener.propertyChange方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyChangeListener.propertyChange方法的具体用法?Java PropertyChangeListener.propertyChange怎么用?Java PropertyChangeListener.propertyChange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.PropertyChangeListener
的用法示例。
在下文中一共展示了PropertyChangeListener.propertyChange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
示例2: setValue
import java.beans.PropertyChangeListener; //导入方法依赖的package包/类
public void setValue( Object value ) {
if ( ( value != null ) && !this.type.isInstance( value ) ) {
throw new IllegalArgumentException( "Unsupported value: " + value );
}
Object oldValue;
PropertyChangeListener[] listeners;
synchronized ( this.listeners ) {
oldValue = this.value;
this.value = value;
if ( ( value == null ) ? oldValue == null : value.equals( oldValue ) ) {
return; // do not fire event if value is not changed
}
int size = this.listeners.size();
if ( size == 0 ) {
return; // do not fire event if there are no any listener
}
listeners = this.listeners.toArray( new PropertyChangeListener[size] );
}
PropertyChangeEvent event = new PropertyChangeEvent( this, null, oldValue, value );
for ( PropertyChangeListener listener : listeners ) {
listener.propertyChange( event );
}
}
示例3: propertyChange
import java.beans.PropertyChangeListener; //导入方法依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
final PropertyChangeListener listener = get();
if (listener != null) {
listener.propertyChange(evt);
}
}
示例4: firePropertyChange
import java.beans.PropertyChangeListener; //导入方法依赖的package包/类
private void firePropertyChange (String propName, Object oldValue, Object newValue) {
List<PropertyChangeListener> ls;
synchronized (this) {
if (this.listeners == null)
return;
ls = new ArrayList<PropertyChangeListener>(listeners);
}
PropertyChangeEvent event = new PropertyChangeEvent (this, propName, oldValue, newValue);
for (PropertyChangeListener l : ls) {
l.propertyChange(event);
}
}
示例5: firePropertyChange
import java.beans.PropertyChangeListener; //导入方法依赖的package包/类
private void firePropertyChange() {
List<PropertyChangeListener> listeners;
synchronized (this) {
if (propertyChangeListeners == null) {
return ;
}
listeners = new ArrayList<PropertyChangeListener>(propertyChangeListeners);
}
PropertyChangeEvent evt = new PropertyChangeEvent(this, "content", null, null);
for (PropertyChangeListener l : listeners) {
l.propertyChange(evt);
}
}
示例6: propertyChange
import java.beans.PropertyChangeListener; //导入方法依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
PropertyChangeEvent proxyEvent = new PropertyChangeEvent(JPDADVThread.this, evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
proxyEvent.setPropagationId(evt.getPropagationId());
for (PropertyChangeListener pchl : listeners) {
pchl.propertyChange(proxyEvent);
}
}
示例7: fireServiceClass
import java.beans.PropertyChangeListener; //导入方法依赖的package包/类
private static void fireServiceClass(JPDADebugger debugger) {
PropertyChangeEvent pche = new PropertyChangeEvent(RemoteServices.class, "serviceClass", null, debugger);
PropertyChangeListener[] listeners;
synchronized (serviceListeners) {
listeners = serviceListeners.toArray(new PropertyChangeListener[]{});
}
for (PropertyChangeListener l : listeners) {
l.propertyChange(pche);
}
}
示例8: notifyListeners
import java.beans.PropertyChangeListener; //导入方法依赖的package包/类
private void notifyListeners(Object object, String property, String oldValue, String newValue) {
ArrayList<PropertyChangeListener> changes = new ArrayList<PropertyChangeListener>();
synchronized (listeners) {
changes.addAll(listeners);
}
for (PropertyChangeListener listener : changes) {
listener.propertyChange(new PropertyChangeEvent(object, property, oldValue, newValue));
}
}
示例9: 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);
}
}
示例10: firePropertyChangeImpl
import java.beans.PropertyChangeListener; //导入方法依赖的package包/类
private void firePropertyChangeImpl(Object listeners, String property,
Object oldValue, Object newValue)
{
for (int i = 0; ; ++i) {
Object l = Kit.getListener(listeners, i);
if (l == null)
break;
if (l instanceof PropertyChangeListener) {
PropertyChangeListener pcl = (PropertyChangeListener)l;
pcl.propertyChange(new PropertyChangeEvent(
this, property, oldValue, newValue));
}
}
}
示例11: setStatus
import java.beans.PropertyChangeListener; //导入方法依赖的package包/类
public void setStatus(Status status){
Status old = this.status;
this.status = status;
PropertyChangeEvent evt =
new PropertyChangeEvent(this, PROP_STATE, old, status); // NOI18N
for (PropertyChangeListener listener : propertyListeners) {
listener.propertyChange(evt);
}
}
示例12: propertyChange
import java.beans.PropertyChangeListener; //导入方法依赖的package包/类
public void propertyChange(PropertyChangeEvent pce) {
PropertyChangeListener pcl = get();
if (pcl == null) {
// The referent listener was GC'ed, we're no longer
// interested in PropertyChanges, remove the listener.
dispose();
} else {
pcl.propertyChange(pce);
}
}
示例13: firePropertyChange
import java.beans.PropertyChangeListener; //导入方法依赖的package包/类
private void firePropertyChange(PropertyChangeEvent event) {
PropertyChangeListener[] _listeners;
synchronized (this) {
if (listeners == null) {
return;
}
_listeners = listeners.toArray(new PropertyChangeListener[ProxyClassPathImplementation.this.listeners.size()]);
}
for (PropertyChangeListener l : _listeners) {
l.propertyChange(event);
}
}
示例14: notifyValueChange
import java.beans.PropertyChangeListener; //导入方法依赖的package包/类
@Override
protected void notifyValueChange(ExternalContext externalContext, String name, String oldValue)
{
String newValue = getProperty(externalContext, name);
PropertyChangeEvent event = new PropertyChangeEvent(this, name, oldValue, newValue);
for (PropertyChangeListener listener: _changeListeners)
{
listener.propertyChange(event);
}
}
示例15: firePropertyChange
import java.beans.PropertyChangeListener; //导入方法依赖的package包/类
/**
* Fires PropertyChangeEvent
* @param propName name of property
* @param oldValue old property value or null
* @param newValue new property value or null
*/
protected final void firePropertyChange (String propName, Object oldValue, Object newValue) {
PropertyChangeListener[] _listeners;
synchronized (this) {
if (this.pListeners == null)
return;
_listeners = this.pListeners.toArray(new PropertyChangeListener[this.pListeners.size()]);
}
PropertyChangeEvent event = new PropertyChangeEvent (this, propName, oldValue, newValue);
for (PropertyChangeListener l : _listeners) {
l.propertyChange (event);
}
}