SDK : TexturePropertyEditor now properly triggers a change event when the property is changed
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10436 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
1091069059
commit
929504dae1
@ -38,6 +38,7 @@ import com.jme3.texture.Texture;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Rectangle;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyEditor;
|
||||
import java.util.LinkedList;
|
||||
@ -69,12 +70,14 @@ public class TexturePropertyEditor implements PropertyEditor {
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
public void setValue(Object value) {
|
||||
public void setValue(Object value) {
|
||||
if (value instanceof Texture) {
|
||||
texture = (Texture) value;
|
||||
triggerListeners(null,texture);
|
||||
} else {
|
||||
texture = null;
|
||||
}
|
||||
triggerListeners(texture,null);
|
||||
texture = null;
|
||||
}
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
@ -136,4 +139,10 @@ public class TexturePropertyEditor implements PropertyEditor {
|
||||
public void removePropertyChangeListener(PropertyChangeListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
private void triggerListeners(Object oldValue,Object value) {
|
||||
for (PropertyChangeListener propertyChangeListener : listeners) {
|
||||
propertyChangeListener.propertyChange(new PropertyChangeEvent(this, "texture", oldValue, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user