From 929504dae10638c6bc5af7660bea6d3a9eb1b518 Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Tue, 26 Feb 2013 19:48:10 +0000 Subject: [PATCH] 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 --- .../core/properties/TexturePropertyEditor.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/TexturePropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/TexturePropertyEditor.java index be332bc1d..9f4658e02 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/properties/TexturePropertyEditor.java +++ b/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)); + } + } }