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
3.0
rem..om 12 years ago
parent 1091069059
commit 929504dae1
  1. 15
      sdk/jme3-core/src/com/jme3/gde/core/properties/TexturePropertyEditor.java

@ -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…
Cancel
Save