diff --git a/sdk/jme3-core/nbproject/project.xml b/sdk/jme3-core/nbproject/project.xml
index 1533b70ad..d640317f2 100644
--- a/sdk/jme3-core/nbproject/project.xml
+++ b/sdk/jme3-core/nbproject/project.xml
@@ -248,8 +248,10 @@
com.jme3.gde.core.filters.actionscom.jme3.gde.core.filters.implcom.jme3.gde.core.j2seproject
+ com.jme3.gde.core.nodescom.jme3.gde.core.propertiescom.jme3.gde.core.scene
+ com.jme3.gde.core.scene.actionscom.jme3.gde.core.scene.controllercom.jme3.gde.core.scene.processorscom.jme3.gde.core.sceneexplorer
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/filters/AbstractFilterNode.java b/sdk/jme3-core/src/com/jme3/gde/core/filters/AbstractFilterNode.java
index d97901020..3094513ad 100644
--- a/sdk/jme3-core/src/com/jme3/gde/core/filters/AbstractFilterNode.java
+++ b/sdk/jme3-core/src/com/jme3/gde/core/filters/AbstractFilterNode.java
@@ -31,8 +31,8 @@
*/
package com.jme3.gde.core.filters;
-import com.jme3.gde.core.sceneexplorer.nodes.properties.SceneExplorerProperty;
-import com.jme3.gde.core.sceneexplorer.nodes.properties.ScenePropertyChangeListener;
+import com.jme3.gde.core.properties.SceneExplorerProperty;
+import com.jme3.gde.core.properties.ScenePropertyChangeListener;
import com.jme3.gde.core.util.PropertyUtils;
import com.jme3.post.Filter;
import java.beans.PropertyDescriptor;
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanel.form b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanel.form
similarity index 81%
rename from sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanel.form
rename to sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanel.form
index d6e6c4734..4f089a8f3 100644
--- a/sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanel.form
+++ b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanel.form
@@ -84,49 +84,49 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanel.java b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanel.java
similarity index 99%
rename from sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanel.java
rename to sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanel.java
index 17d2ddebe..80af4d71e 100644
--- a/sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanel.java
+++ b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanel.java
@@ -35,7 +35,7 @@
*
* Created on 25.04.2010, 00:25:08
*/
-package com.jme3.gde.core.properties;
+package com.jme3.gde.core.j2seproject;
import com.jme3.gde.core.assets.AssetsLookupProvider;
import java.awt.event.ActionEvent;
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanelProvider.java b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanelProvider.java
similarity index 98%
rename from sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanelProvider.java
rename to sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanelProvider.java
index 7fd019289..8d21b1a78 100644
--- a/sdk/jme3-core/src/com/jme3/gde/core/properties/AssetsPropertiesPanelProvider.java
+++ b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanelProvider.java
@@ -29,7 +29,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package com.jme3.gde.core.properties;
+package com.jme3.gde.core.j2seproject;
/**
*
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/Bundle.properties b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/Bundle.properties
new file mode 100644
index 000000000..66a842887
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/j2seproject/Bundle.properties
@@ -0,0 +1,38 @@
+# Copyright (c) 2009-2010 jMonkeyEngine
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+LBL_Config_assets=Assets
+AssetsPropertiesPanel.jLabel2.text=Assets JAR Excludes:
+AssetsPropertiesPanel.jTextField1.text=jTextField1
+AssetsPropertiesPanel.jLabel1.text=Assets JAR Name:
+AssetsPropertiesPanel.jTextField2.text=jTextField2
+AssetsPropertiesPanel.jCheckBox1.text=Compress Assets JAR
+AssetsPropertiesPanel.jLabel3.text=Assets Folder Location:
+AssetsPropertiesPanel.jTextField3.text=jTextField3
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/SceneExplorerLookup.java b/sdk/jme3-core/src/com/jme3/gde/core/nodes/DynamicLookup.java
similarity index 92%
rename from sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/SceneExplorerLookup.java
rename to sdk/jme3-core/src/com/jme3/gde/core/nodes/DynamicLookup.java
index 482bff9d1..b2e6bc338 100644
--- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/SceneExplorerLookup.java
+++ b/sdk/jme3-core/src/com/jme3/gde/core/nodes/DynamicLookup.java
@@ -30,7 +30,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package com.jme3.gde.core.sceneexplorer.nodes;
+package com.jme3.gde.core.nodes;
import org.openide.util.lookup.AbstractLookup;
import org.openide.util.lookup.InstanceContent;
@@ -39,11 +39,11 @@ import org.openide.util.lookup.InstanceContent;
*
* @author normenhansen
*/
-public class SceneExplorerLookup extends AbstractLookup{
+public class DynamicLookup extends AbstractLookup{
private static final long serialVersionUID = 1212314412L;
private InstanceContent instanceContent;
- public SceneExplorerLookup(InstanceContent instanceContent) {
+ public DynamicLookup(InstanceContent instanceContent) {
super(instanceContent);
this.instanceContent = instanceContent;
instanceContent.add(this);
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAssetLinkChild.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/AnimationProperty.java
similarity index 65%
rename from sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAssetLinkChild.java
rename to sdk/jme3-core/src/com/jme3/gde/core/properties/AnimationProperty.java
index 97b5323d2..b975bbed7 100644
--- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAssetLinkChild.java
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/AnimationProperty.java
@@ -29,68 +29,64 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package com.jme3.gde.core.sceneexplorer.nodes;
+package com.jme3.gde.core.properties;
-import com.jme3.asset.ModelKey;
+import com.jme3.animation.AnimControl;
import com.jme3.gde.core.scene.SceneApplication;
-import com.jme3.scene.AssetLinkNode;
-import java.io.IOException;
+import java.beans.PropertyEditor;
+import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
-import javax.swing.Action;
-import org.openide.actions.DeleteAction;
-import org.openide.nodes.AbstractNode;
-import org.openide.nodes.Children;
+import org.openide.nodes.PropertySupport;
import org.openide.util.Exceptions;
-import org.openide.util.actions.SystemAction;
/**
*
* @author normenhansen
*/
-public class JmeAssetLinkChild extends AbstractNode {
+public class AnimationProperty extends PropertySupport.ReadWrite {
- private ModelKey key;
- private AssetLinkNode linkNode;
+ private AnimControl control;
+ private String anim = "null";
- public JmeAssetLinkChild(ModelKey key, AssetLinkNode linkNode) {
- super(Children.LEAF);
- this.key = key;
- this.linkNode = linkNode;
- this.setName(key.getName());
+ public AnimationProperty(AnimControl node) {
+ super("Animation Control", String.class, "Animation Control", "");
+ this.control = node;
}
@Override
- public Action[] getActions(boolean context) {
- return new SystemAction[]{
- SystemAction.get(DeleteAction.class)
- };
+ public String getValue() throws IllegalAccessException, InvocationTargetException {
+ return anim;
}
@Override
- public boolean canDestroy() {
- return true;
- }
-
- @Override
- public void destroy() throws IOException {
- super.destroy();
+ public void setValue(final String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ if (control == null) {
+ return;
+ }
try {
SceneApplication.getApplication().enqueue(new Callable() {
public Void call() throws Exception {
- linkNode.detachLinkedChild(key);
+ if ("null".equals(val)) {
+ control.clearChannels();
+ return null;
+ }
+ anim = val;
+ control.clearChannels();
+ control.createChannel().setAnim(val);
return null;
}
}).get();
- JmeSpatial node = ((JmeSpatial) getParentNode());
- if (node != null) {
- node.refresh(false);
- }
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
} catch (ExecutionException ex) {
Exceptions.printStackTrace(ex);
}
}
+
+ @Override
+ public PropertyEditor getPropertyEditor() {
+ return new AnimationPropertyEditor(control);
+ }
}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/AnimationPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/AnimationPropertyEditor.java
new file mode 100644
index 000000000..075289e88
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/AnimationPropertyEditor.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2009-2010 jMonkeyEngine
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.jme3.gde.core.properties;
+
+import com.jme3.animation.AnimControl;
+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.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+/**
+ *
+ * @author normenhansen
+ */
+public class AnimationPropertyEditor implements PropertyEditor {
+
+ private LinkedList listeners = new LinkedList();
+ private String animName;
+ private AnimControl control;
+
+ public AnimationPropertyEditor(AnimControl control) {
+ this.control = control;
+ }
+
+ public void setValue(Object value) {
+ if (value instanceof String) {
+ animName = (String) value;
+ }
+ }
+
+ public Object getValue() {
+ return animName;
+ }
+
+ public boolean isPaintable() {
+ return false;
+ }
+
+ public void paintValue(Graphics gfx, Rectangle box) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public String getJavaInitializationString() {
+ return null;
+ }
+
+ public String getAsText() {
+ return animName.toString();
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ String old = animName;
+ if ("".equals(text)) {
+ animName = "null";
+ }
+ animName = text;
+ notifyListeners(old, animName);
+ }
+
+ public String[] getTags() {
+ if(control==null)return new String[]{"none"};
+ Collection names = control.getAnimationNames();
+ String[] strings = new String[names.size() + 1];
+ strings[0] = "null";
+ int i = 1;
+ for (Iterator it = names.iterator(); it.hasNext();) {
+ strings[i] = it.next();
+ i++;
+ }
+ return strings;
+ }
+
+ public Component getCustomEditor() {
+// return new AnimationPanel(control);
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public boolean supportsCustomEditor() {
+ return false;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ private void notifyListeners(String before, String after) {
+ for (Iterator it = listeners.iterator(); it.hasNext();) {
+ PropertyChangeListener propertyChangeListener = it.next();
+ //TODO: check what the "programmatic name" is supposed to be here.. for now its Quaternion
+ propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after));
+ }
+ }
+}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataProperty.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataProperty.java
new file mode 100644
index 000000000..f027f315a
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataProperty.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2009-2010 jMonkeyEngine
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.jme3.gde.core.properties;
+
+import com.jme3.audio.AudioData;
+import com.jme3.audio.AudioKey;
+import com.jme3.audio.AudioNode;
+import com.jme3.gde.core.scene.SceneApplication;
+import com.jme3.gde.core.scene.SceneRequest;
+import java.beans.PropertyEditor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import org.openide.nodes.PropertySupport;
+import org.openide.util.Exceptions;
+
+/**
+ *
+ * @author normenhansen
+ */
+public class AudioDataProperty extends PropertySupport.ReadWrite {
+
+ private AudioNode node;
+
+ public AudioDataProperty(AudioNode node) {
+ super("Audio Data", String.class, "Audio Data", "");
+ this.node = node;
+ }
+
+ @Override
+ public String getValue() throws IllegalAccessException, InvocationTargetException {
+ if (node.getAudioData() != null) {
+ return node.getAudioData().toString();
+ } else {
+ return "null";
+ }
+ }
+
+ @Override
+ public void setValue(final String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ if ("null".equals(val)) {
+ return;
+ }
+ if (node.getAudioData() == null) {
+// val = val.replace('[', ' ').trim();
+// val = val.replace(']', ' ').trim();
+// final String[] strings = val.split(",");
+ try {
+ SceneApplication.getApplication().enqueue(new Callable() {
+
+ public Void call() throws Exception {
+ SceneRequest request = SceneApplication.getApplication().getCurrentSceneRequest();
+ AudioKey key = new AudioKey(val, false);
+ AudioData localMaterial = request.getManager().loadAudio(key);
+ if (localMaterial != null) {
+ node.setAudioData(localMaterial, key);
+ }
+ return null;
+ }
+ }).get();
+ } catch (InterruptedException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (ExecutionException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+ }
+
+ @Override
+ public PropertyEditor getPropertyEditor() {
+ return new AudioDataPropertyEditor();
+ }
+}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataPropertyEditor.java
new file mode 100644
index 000000000..55d7c1095
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataPropertyEditor.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2009-2010 jMonkeyEngine
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.jme3.gde.core.properties;
+
+import com.jme3.audio.AudioData;
+import com.jme3.gde.core.scene.SceneApplication;
+import com.jme3.gde.core.scene.SceneRequest;
+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.Iterator;
+import java.util.LinkedList;
+
+/**
+ *
+ * @author normenhansen
+ */
+public class AudioDataPropertyEditor implements PropertyEditor {
+
+ private LinkedList listeners = new LinkedList();
+ private String material;
+
+ public void setValue(Object value) {
+ if (value instanceof String) {
+ material = (String) value;
+ }
+ }
+
+ public Object getValue() {
+ return material;
+ }
+
+ public boolean isPaintable() {
+ return false;
+ }
+
+ public void paintValue(Graphics gfx, Rectangle box) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public String getJavaInitializationString() {
+ return null;
+ }
+
+ public String getAsText() {
+ return material.toString();
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ String old=material;
+ if ("".equals(text)) {
+ material = "null";
+ }
+ material = text;
+ notifyListeners(old, material);
+ }
+
+ public String[] getTags() {
+ if ("null".equals(material)) {
+ SceneRequest request = SceneApplication.getApplication().getCurrentSceneRequest();
+ if(request==null) return new String[]{};
+ String[] mats = request.getManager().getSounds();
+ return mats;
+ }
+ return new String[]{"can set only once"};
+ }
+
+ public Component getCustomEditor() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public boolean supportsCustomEditor() {
+ return false;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ private void notifyListeners(String before, String after) {
+ for (Iterator it = listeners.iterator(); it.hasNext();) {
+ PropertyChangeListener propertyChangeListener = it.next();
+ //TODO: check what the "programmatic name" is supposed to be here.. for now its Quaternion
+ propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after));
+ }
+ }
+}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/Bundle.properties b/sdk/jme3-core/src/com/jme3/gde/core/properties/Bundle.properties
index 66a842887..bd1283d27 100644
--- a/sdk/jme3-core/src/com/jme3/gde/core/properties/Bundle.properties
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/Bundle.properties
@@ -1,38 +1,9 @@
-# Copyright (c) 2009-2010 jMonkeyEngine
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# * Neither the name of 'jMonkeyEngine' nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-LBL_Config_assets=Assets
-AssetsPropertiesPanel.jLabel2.text=Assets JAR Excludes:
-AssetsPropertiesPanel.jTextField1.text=jTextField1
-AssetsPropertiesPanel.jLabel1.text=Assets JAR Name:
-AssetsPropertiesPanel.jTextField2.text=jTextField2
-AssetsPropertiesPanel.jCheckBox1.text=Compress Assets JAR
-AssetsPropertiesPanel.jLabel3.text=Assets Folder Location:
-AssetsPropertiesPanel.jTextField3.text=jTextField3
+ColorRGBADialog.jButton1.text=OK
+ColorRGBADialog.jButton2.text=Cancel
+ColorRGBADialog.alphaLabel.text=Alpha:
+AnimationPanel.pauseButton.text=
+AnimationPanel.playButton.text=
+TextureBrowser.cancelButton.text=Cancel
+TextureBrowser.okButton.text=Ok
+TextureBrowser.imagePreviewLabel.text=
+TextureBrowser.title=Texture Browser
\ No newline at end of file
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.form b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.form
new file mode 100644
index 000000000..da884bd38
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.form
@@ -0,0 +1,97 @@
+
+
+
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.java
new file mode 100644
index 000000000..ce17af394
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2009-2010 jMonkeyEngine
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * ColorRGBADialog.java
+ *
+ * Created on 06.04.2010, 20:58:59
+ */
+package com.jme3.gde.core.properties;
+
+import com.jme3.math.ColorRGBA;
+import java.awt.Color;
+
+/**
+ *
+ * @author normenhansen
+ */
+public class ColorRGBADialog extends javax.swing.JDialog {
+
+ private ColorRGBAPropertyEditor editor;
+
+ /** Creates new form ColorRGBADialog */
+ public ColorRGBADialog(java.awt.Frame parent, boolean modal, ColorRGBAPropertyEditor editor) {
+ super(parent, modal);
+ this.editor = editor;
+ initComponents();
+ alphaSlider.setValue(Math.round(((ColorRGBA)editor.getValue()).getAlpha()*100));
+ }
+
+ public ColorRGBA setColor() {
+ Color cColor = jColorChooser1.getColor();
+ ColorRGBA color = new ColorRGBA();
+ float[] floats = new float[4];
+ cColor.getComponents(floats);
+ color.set(floats[0], floats[1], floats[2], ((float)alphaSlider.getValue())/100.0f);
+ ColorRGBA color2 = new ColorRGBA((ColorRGBA) editor.getValue());
+ editor.setValue(color);
+ editor.notifyListeners(color2, color);
+ return color;
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jColorChooser1 = new javax.swing.JColorChooser();
+ jButton1 = new javax.swing.JButton();
+ jButton2 = new javax.swing.JButton();
+ jToolBar1 = new javax.swing.JToolBar();
+ alphaLabel = new javax.swing.JLabel();
+ alphaSlider = new javax.swing.JSlider();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+
+ jButton1.setText(org.openide.util.NbBundle.getMessage(ColorRGBADialog.class, "ColorRGBADialog.jButton1.text")); // NOI18N
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton1ActionPerformed(evt);
+ }
+ });
+
+ jButton2.setText(org.openide.util.NbBundle.getMessage(ColorRGBADialog.class, "ColorRGBADialog.jButton2.text")); // NOI18N
+ jButton2.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton2ActionPerformed(evt);
+ }
+ });
+
+ jToolBar1.setFloatable(false);
+ jToolBar1.setRollover(true);
+
+ alphaLabel.setText(org.openide.util.NbBundle.getMessage(ColorRGBADialog.class, "ColorRGBADialog.alphaLabel.text")); // NOI18N
+ jToolBar1.add(alphaLabel);
+
+ alphaSlider.setValue(100);
+ jToolBar1.add(alphaSlider);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 320, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jButton2)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jButton1))
+ .addComponent(jColorChooser1, javax.swing.GroupLayout.DEFAULT_SIZE, 496, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addComponent(jColorChooser1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jButton1)
+ .addComponent(jButton2))
+ .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
+ setColor();
+ dispose();
+ }//GEN-LAST:event_jButton1ActionPerformed
+
+ private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
+ dispose();
+ }//GEN-LAST:event_jButton2ActionPerformed
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JLabel alphaLabel;
+ private javax.swing.JSlider alphaSlider;
+ private javax.swing.JButton jButton1;
+ private javax.swing.JButton jButton2;
+ private javax.swing.JColorChooser jColorChooser1;
+ private javax.swing.JToolBar jToolBar1;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBAPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBAPropertyEditor.java
new file mode 100644
index 000000000..a5e321b72
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBAPropertyEditor.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2009-2010 jMonkeyEngine
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.jme3.gde.core.properties;
+
+import com.jme3.math.ColorRGBA;
+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.Iterator;
+import java.util.LinkedList;
+
+/**
+ *
+ * @author normenhansen
+ */
+public class ColorRGBAPropertyEditor implements PropertyEditor {
+
+ private LinkedList listeners = new LinkedList();
+ private ColorRGBA color = new ColorRGBA();
+
+ public void setValue(Object value) {
+ if (value instanceof ColorRGBA) {
+ color.set((ColorRGBA) value);
+ }
+ }
+
+ public Object getValue() {
+ return color;
+ }
+
+ public boolean isPaintable() {
+ return false;
+ }
+
+ public void paintValue(Graphics gfx, Rectangle box) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public String getJavaInitializationString() {
+ return null;
+ }
+
+ public String getAsText() {
+ return "[" + color.r + ", " + color.g + ", " + color.b + ", " + color.a + "]";
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ text = text.replace('[', ' ');
+ text = text.replace(']', ' ');
+ String[] values = text.split(",");
+ ColorRGBA old=color;
+ if (values.length != 4) {
+ throw (new IllegalArgumentException("String not correct"));
+ }
+ float[] floats = new float[4];
+ for (int i = 0; i < values.length; i++) {
+ String string = values[i];
+ floats[i] = Float.parseFloat(string);
+ }
+ color.set(floats[0], floats[1], floats[2], floats[3]);
+ notifyListeners(old, color);
+ }
+
+ public String[] getTags() {
+ return null;
+ }
+
+ public Component getCustomEditor() {
+ ColorRGBADialog dialog = new ColorRGBADialog(null, true, this);
+ dialog.setLocationRelativeTo(null);
+ return dialog;
+ }
+
+ public boolean supportsCustomEditor() {
+ return true;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ public void notifyListeners(ColorRGBA before, ColorRGBA after) {
+ for (Iterator it = listeners.iterator(); it.hasNext();) {
+ PropertyChangeListener propertyChangeListener = it.next();
+ //TODO: check what the "programmatic name" is supposed to be here.. for now its ColorRGBA
+ propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after));
+ }
+ }
+}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/EmitterShapePropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/EmitterShapePropertyEditor.java
new file mode 100644
index 000000000..5ef00e771
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/EmitterShapePropertyEditor.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2009-2010 jMonkeyEngine
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.jme3.gde.core.properties;
+
+import com.jme3.effect.shapes.EmitterBoxShape;
+import com.jme3.effect.shapes.EmitterPointShape;
+import com.jme3.effect.shapes.EmitterShape;
+import com.jme3.effect.shapes.EmitterSphereShape;
+import com.jme3.math.Vector3f;
+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.Iterator;
+import java.util.LinkedList;
+import org.openide.awt.StatusDisplayer;
+
+/**
+ *
+ * @author normenhansen
+ */
+public class EmitterShapePropertyEditor implements PropertyEditor {
+
+ private LinkedList listeners = new LinkedList();
+ private EmitterShape emitter;// = new EmitterPointShape(Vector3f.ZERO);
+
+ public void setValue(Object value) {
+ if (value instanceof EmitterShape) {
+ emitter = (EmitterShape) value;
+ }
+ }
+
+ public Object getValue() {
+ return emitter;
+ }
+
+ public boolean isPaintable() {
+ return false;
+ }
+
+ public void paintValue(Graphics gfx, Rectangle box) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public String getJavaInitializationString() {
+ return null;
+ }
+
+ public String getAsText() {
+ if (emitter == null) {
+ return "null";
+ }
+ if (emitter instanceof EmitterBoxShape) {
+ EmitterBoxShape shape = (EmitterBoxShape) emitter;
+ return "[Box, "
+ + shape.getMin().x
+ + ", "
+ + shape.getMin().y
+ + ", "
+ + shape.getMin().z
+ + ", "
+ + shape.getMin().x + shape.getLen().x
+ + ", "
+ + shape.getMin().x + shape.getLen().y
+ + ", "
+ + shape.getMin().x + shape.getLen().z
+ + "]";
+ } else if (emitter instanceof EmitterPointShape) {
+ EmitterPointShape shape = (EmitterPointShape) emitter;
+ return "[Point, "
+ + shape.getPoint().x
+ + ", "
+ + shape.getPoint().y
+ + ", "
+ + shape.getPoint().z
+ + "]";
+ } else if (emitter instanceof EmitterSphereShape) {
+ EmitterSphereShape shape = (EmitterSphereShape) emitter;
+ return "[Sphere, "
+ + shape.getCenter().x
+ + ", "
+ + shape.getCenter().y
+ + ", "
+ + shape.getCenter().z
+ + ", "
+ + shape.getRadius()
+ + "]";
+ }
+ return emitter.toString();
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ text = text.replace('[', ' ').trim();
+ text = text.replace(']', ' ').trim();
+ String[] strings = text.split(",");
+ EmitterShape old=emitter;
+ if (strings.length == 0) {
+ return;
+ }
+ if ("box".equals(strings[0].trim().toLowerCase())) {
+ if (strings.length == 7) {
+ StatusDisplayer.getDefault().setStatusText("try set parameterized box shape");
+ emitter = new EmitterBoxShape(
+ new Vector3f(Float.parseFloat(strings[1]), Float.parseFloat(strings[2]), Float.parseFloat(strings[3])), new Vector3f(Float.parseFloat(strings[4]), Float.parseFloat(strings[5]), Float.parseFloat(strings[6])));
+ } else {
+ StatusDisplayer.getDefault().setStatusText("try set standard box shape");
+ emitter = new EmitterBoxShape(new Vector3f(-.5f, -.5f, -.5f), new Vector3f(.5f, .5f, .5f));
+ }
+ } else if ("point".equals(strings[0].trim().toLowerCase())) {
+ if (strings.length == 4) {
+ emitter = new EmitterPointShape(
+ new Vector3f(Float.parseFloat(strings[1]), Float.parseFloat(strings[2]), Float.parseFloat(strings[3])));
+ } else {
+ emitter = new EmitterPointShape(Vector3f.ZERO);
+ }
+ } else if ("sphere".equals(strings[0].trim().toLowerCase())) {
+ if (strings.length == 5) {
+ emitter = new EmitterSphereShape(
+ new Vector3f(Float.parseFloat(strings[1]), Float.parseFloat(strings[2]), Float.parseFloat(strings[3])), Float.parseFloat(strings[4]));
+ } else {
+ emitter = new EmitterSphereShape(Vector3f.ZERO, .5f);
+ }
+ }
+ notifyListeners(old, emitter);
+ }
+
+ public String[] getTags() {
+// String[] mats = new String[]{"[Point]", "[Sphere]", "[Box]"};
+ return null;
+ }
+
+ public Component getCustomEditor() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public boolean supportsCustomEditor() {
+ return false;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ private void notifyListeners(EmitterShape before, EmitterShape after) {
+ for (Iterator it = listeners.iterator(); it.hasNext();) {
+ PropertyChangeListener propertyChangeListener = it.next();
+ //TODO: check what the "programmatic name" is supposed to be here.. for now its Quaternion
+ propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after));
+ }
+ }
+}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/Matrix3fPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/Matrix3fPropertyEditor.java
new file mode 100644
index 000000000..909b071ba
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/Matrix3fPropertyEditor.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2009-2010 jMonkeyEngine
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.jme3.gde.core.properties;
+
+import com.jme3.math.Matrix3f;
+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.Iterator;
+import java.util.LinkedList;
+
+/**
+ *
+ * @author normenhansen
+ */
+public class Matrix3fPropertyEditor implements PropertyEditor {
+
+ private LinkedList listeners = new LinkedList();
+ private Matrix3f vector = new Matrix3f();
+
+ public void setValue(Object value) {
+ if (value instanceof Matrix3f) {
+ vector.set((Matrix3f) value);
+ }
+ }
+
+ public Object getValue() {
+ return vector;
+ }
+
+ public boolean isPaintable() {
+ return false;
+ }
+
+ public void paintValue(Graphics gfx, Rectangle box) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public String getJavaInitializationString() {
+ return null;
+ }
+
+ public String getAsText() {
+ return vector.toString();
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ text = text.replace('[', ' ');
+ text = text.replace(']', ' ');
+ String[] values = text.split(",");
+ if (values.length != 3) {
+ throw (new IllegalArgumentException("String not correct"));
+ }
+ float[] floats = new float[3];
+ for (int i = 0; i < values.length; i++) {
+ String string = values[i];
+ floats[i] = Float.parseFloat(string);
+ }
+ Matrix3f old = new Matrix3f();
+ old.set(vector);
+// vector.set(floats[0], floats[1], floats[2]);
+ notifyListeners(old, vector);
+ }
+
+ public String[] getTags() {
+ return null;
+ }
+
+ public Component getCustomEditor() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public boolean supportsCustomEditor() {
+ return false;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ private void notifyListeners(Matrix3f before, Matrix3f after) {
+ for (Iterator it = listeners.iterator(); it.hasNext();) {
+ PropertyChangeListener propertyChangeListener = it.next();
+ //TODO: check what the "programmatic name" is supposed to be here.. for now its Matrix3f
+ propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after));
+ }
+ }
+}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/QuaternionPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/QuaternionPropertyEditor.java
new file mode 100644
index 000000000..d04cf3f28
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/QuaternionPropertyEditor.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2009-2010 jMonkeyEngine
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.jme3.gde.core.properties;
+
+import com.jme3.math.Quaternion;
+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.Iterator;
+import java.util.LinkedList;
+
+/**
+ *
+ * @author normenhansen
+ */
+public class QuaternionPropertyEditor implements PropertyEditor {
+
+ private LinkedList listeners = new LinkedList();
+ private Quaternion quaternion = new Quaternion();
+
+ public void setValue(Object value) {
+ if (value instanceof Quaternion) {
+ quaternion.set((Quaternion) value);
+ }
+ }
+
+ public Object getValue() {
+ return quaternion;
+ }
+
+ public boolean isPaintable() {
+ return false;
+ }
+
+ public void paintValue(Graphics gfx, Rectangle box) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public String getJavaInitializationString() {
+ return null;
+ }
+
+ public String getAsText() {
+ float[] angles=quaternion.toAngles(new float[3]);
+ return "[" + (float)Math.toDegrees(angles[0]) + ", " + (float)Math.toDegrees(angles[1]) + ", " + (float)Math.toDegrees(angles[2]) + "]";
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ text = text.replace('[', ' ');
+ text = text.replace(']', ' ');
+ String[] values = text.split(",");
+ if (values.length != 3) {
+ throw (new IllegalArgumentException("String not correct"));
+ }
+ float[] floats = new float[3];
+ for (int i = 0; i < values.length; i++) {
+ String string = values[i];
+ floats[i] = (float)Math.toRadians(Float.parseFloat(string));
+ }
+ Quaternion old=new Quaternion();
+ old.set(quaternion);
+ quaternion.fromAngles(floats);
+ notifyListeners(old,quaternion);
+ }
+
+ public String[] getTags() {
+ return null;
+ }
+
+ public Component getCustomEditor() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public boolean supportsCustomEditor() {
+ return false;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ private void notifyListeners(Quaternion before, Quaternion after) {
+ for (Iterator it = listeners.iterator(); it.hasNext();) {
+ PropertyChangeListener propertyChangeListener = it.next();
+ //TODO: check what the "programmatic name" is supposed to be here.. for now its Quaternion
+ propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after));
+ }
+ }
+}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerProperty.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerProperty.java
new file mode 100644
index 000000000..5e52c292a
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerProperty.java
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2009-2010 jMonkeyEngine
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.jme3.gde.core.properties;
+
+import com.jme3.effect.shapes.EmitterShape;
+import com.jme3.gde.core.scene.SceneApplication;
+import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit;
+import com.jme3.gde.core.undoredo.SceneUndoRedoManager;
+import com.jme3.math.ColorRGBA;
+import com.jme3.math.Matrix3f;
+import com.jme3.math.Quaternion;
+import com.jme3.math.Vector2f;
+import com.jme3.math.Vector3f;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.openide.nodes.PropertySupport;
+import org.openide.util.Exceptions;
+import org.openide.util.Lookup;
+
+/**
+ *
+ * @author normenhansen
+ */
+@SuppressWarnings("unchecked")
+public class SceneExplorerProperty extends PropertySupport.Reflection {
+
+ protected LinkedList listeners = new LinkedList();
+
+ public SceneExplorerProperty(T instance, Class valueType, String getter, String setter) throws NoSuchMethodException {
+ this(instance, valueType, getter, setter, null);
+ }
+
+ public SceneExplorerProperty(T instance, Class valueType, String getter, String setter, ScenePropertyChangeListener listener) throws NoSuchMethodException {
+ super(instance, valueType, getter, setter);
+ addPropertyChangeListener(listener);
+ if (valueType == Vector3f.class) {
+ setPropertyEditorClass(Vector3fPropertyEditor.class);
+ } else if (valueType == Quaternion.class) {
+ setPropertyEditorClass(QuaternionPropertyEditor.class);
+ } else if (valueType == Matrix3f.class) {
+ setPropertyEditorClass(Matrix3fPropertyEditor.class);
+ } else if (valueType == ColorRGBA.class) {
+ setPropertyEditorClass(ColorRGBAPropertyEditor.class);
+ } else if (valueType == EmitterShape.class) {
+ setPropertyEditorClass(EmitterShapePropertyEditor.class);
+ } else if (valueType == Vector2f.class) {
+ setPropertyEditorClass(Vector2fPropertyEditor.class);
+ }
+
+ for (SceneExplorerPropertyEditor di : Lookup.getDefault().lookupAll(SceneExplorerPropertyEditor.class)) {
+ di.setEditor(valueType, this);
+ }
+ }
+
+ @Override
+ public T getValue() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ return super.getValue();
+// try {
+// return SceneApplication.getApplication().enqueue(new Callable() {
+//
+// public T call() throws Exception {
+// return getSuperValue();
+// }
+// }).get();
+// } catch (InterruptedException ex) {
+// Exceptions.printStackTrace(ex);
+// } catch (ExecutionException ex) {
+// Exceptions.printStackTrace(ex);
+// }
+// return null;
+ }
+
+ private T getSuperValue() {
+ try {
+ return super.getValue();
+ } catch (IllegalAccessException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (IllegalArgumentException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (InvocationTargetException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ return null;
+ }
+
+ @Override
+ public void setValue(final T val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ try {
+ notifyListeners(getSuperValue(), val);
+ SceneApplication.getApplication().enqueue(new Callable() {
+
+ public Void call() throws Exception {
+ setSuperValue(val);
+ return null;
+ }
+ }).get();
+ } catch (InterruptedException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (ExecutionException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+
+ private void setSuperValue(T val, boolean undo) {
+ try {
+ if (undo) {
+ try {
+ Object oldValue = getSuperValue();
+ if (oldValue.getClass().getMethod("clone") != null) {
+ addUndo(oldValue.getClass().getMethod("clone").invoke(oldValue), val);
+ Logger.getLogger(SceneExplorerProperty.class.getName()).log(Level.INFO, "Add cloned undo {0}", oldValue.getClass().getMethod("clone").invoke(oldValue));
+ }
+ } catch (Exception e) {
+ addUndo(getSuperValue(), val);
+ Logger.getLogger(SceneExplorerProperty.class.getName()).log(Level.INFO, "Add undo {0}", getSuperValue());
+ }
+ }
+ super.setValue(val);
+ } catch (IllegalAccessException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (IllegalArgumentException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (InvocationTargetException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+
+ private void setSuperValue(T val) {
+ setSuperValue(val, true);
+ }
+
+ protected void addUndo(final Object before, final Object after) {
+ SceneUndoRedoManager undoRedo = Lookup.getDefault().lookup(SceneUndoRedoManager.class);
+ if (undoRedo == null) {
+ Logger.getLogger(SceneExplorerProperty.class.getName()).log(Level.WARNING, "Cannot access SceneUndoRedoManager");
+ return;
+ }
+ undoRedo.addEdit(this, new AbstractUndoableSceneEdit() {
+
+ @Override
+ public void sceneUndo() {
+ Logger.getLogger(SceneExplorerProperty.class.getName()).log(Level.INFO, "Do undo {0}", before);
+ setSuperValue((T) before, false);
+ }
+
+ @Override
+ public void sceneRedo() {
+ setSuperValue((T) after, false);
+ }
+
+ @Override
+ public void awtUndo() {
+ }
+
+ @Override
+ public void awtRedo() {
+ }
+ });
+ }
+
+ public void addPropertyChangeListener(ScenePropertyChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removePropertyChangeListener(ScenePropertyChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ private void notifyListeners(Object before, Object after) {
+ for (Iterator it = listeners.iterator(); it.hasNext();) {
+ ScenePropertyChangeListener propertyChangeListener = it.next();
+ propertyChangeListener.propertyChange(getName(), before, after);
+ }
+ }
+}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerPropertyEditor.java
new file mode 100644
index 000000000..19c573db8
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerPropertyEditor.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2009-2010 jMonkeyEngine
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.jme3.gde.core.properties;
+
+/**
+ *
+ * @author normenhansen
+ */
+public interface SceneExplorerPropertyEditor {
+ public void setEditor(Class valueType, SceneExplorerProperty prop);
+}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/ScenePropertyChangeListener.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/ScenePropertyChangeListener.java
new file mode 100644
index 000000000..385ca15dd
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/ScenePropertyChangeListener.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2009-2010 jMonkeyEngine
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.jme3.gde.core.properties;
+
+/**
+ *
+ * @author normenhansen
+ */
+public interface ScenePropertyChangeListener {
+ public void propertyChange(String property, Object oldValue, Object newValue);
+}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.form b/sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.form
new file mode 100644
index 000000000..514ca29cb
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.form
@@ -0,0 +1,128 @@
+
+
+
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.java
new file mode 100644
index 000000000..0e950b0b6
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.java
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2009-2010 jMonkeyEngine
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.jme3.gde.core.properties;
+
+import Model.DDSImageFile;
+import com.jme3.gde.core.assets.ProjectAssetManager;
+import com.jme3.texture.Texture;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.util.logging.Logger;
+import javax.swing.DefaultListSelectionModel;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import jme3tools.converters.ImageToAwt;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.Exceptions;
+import org.openide.util.ImageUtilities;
+
+/**
+ * Displays all textures in the ProjectAssetManager,
+ * lets you select one, and shows a preview of it.
+ *
+ * The user can de-select the currently selected texture to specify they
+ * do not want a texture, and in that case null is returned.
+ *
+ * @author bowens
+ */
+public class TextureBrowser extends javax.swing.JDialog {
+
+ private ProjectAssetManager assetManager;
+ private TexturePropertyEditor editor;
+
+
+ public TextureBrowser(java.awt.Frame parent, boolean modal, ProjectAssetManager assetManager, TexturePropertyEditor editor) {
+ super(parent, modal);
+ this.assetManager = assetManager;
+ this.editor = editor;
+ initComponents();
+ loadAvailableTextures();
+ setSelectedTexture((Texture)editor.getValue());
+ setLocationRelativeTo(null);
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ cancelButton = new javax.swing.JButton();
+ okButton = new javax.swing.JButton();
+ jPanel1 = new javax.swing.JPanel();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ textureList = new javax.swing.JList();
+ jScrollPane2 = new javax.swing.JScrollPane();
+ imagePreviewLabel = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ setTitle(org.openide.util.NbBundle.getMessage(TextureBrowser.class, "TextureBrowser.title")); // NOI18N
+
+ cancelButton.setText(org.openide.util.NbBundle.getMessage(TextureBrowser.class, "TextureBrowser.cancelButton.text")); // NOI18N
+ cancelButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ cancelButtonActionPerformed(evt);
+ }
+ });
+
+ okButton.setText(org.openide.util.NbBundle.getMessage(TextureBrowser.class, "TextureBrowser.okButton.text")); // NOI18N
+ okButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ okButtonActionPerformed(evt);
+ }
+ });
+
+ textureList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
+ textureList.setSelectionModel(new ToggleSelectionModel());
+ textureList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
+ public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
+ textureListValueChanged(evt);
+ }
+ });
+ jScrollPane1.setViewportView(textureList);
+
+ imagePreviewLabel.setText(org.openide.util.NbBundle.getMessage(TextureBrowser.class, "TextureBrowser.imagePreviewLabel.text")); // NOI18N
+ jScrollPane2.setViewportView(imagePreviewLabel);
+
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE))
+ );
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE)
+ );
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap(357, Short.MAX_VALUE)
+ .addComponent(cancelButton)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(okButton)
+ .addGap(17, 17, 17))
+ .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(okButton)
+ .addComponent(cancelButton)))
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
+ setTexture();
+ dispose();
+ }//GEN-LAST:event_okButtonActionPerformed
+
+ private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
+ dispose();
+ }//GEN-LAST:event_cancelButtonActionPerformed
+
+ private void textureListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_textureListValueChanged
+ selectionChanged();
+ }//GEN-LAST:event_textureListValueChanged
+
+ private void setTexture() {
+ if (textureList.getSelectedIndex() > -1) {
+ textureList.getSelectedValue();
+ String selected = (String) textureList.getSelectedValue();
+ Texture tex = assetManager.loadTexture(selected);
+ editor.setValue(tex);
+ editor.setAsText(selected);
+ } else {
+ editor.setValue(null);
+ editor.setAsText(null);
+ }
+ }
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton cancelButton;
+ private javax.swing.JLabel imagePreviewLabel;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JScrollPane jScrollPane2;
+ private javax.swing.JButton okButton;
+ private javax.swing.JList textureList;
+ // End of variables declaration//GEN-END:variables
+
+ private void loadAvailableTextures() {
+ if (assetManager == null)
+ return;
+
+ textureList.setListData(assetManager.getTextures());
+
+ }
+
+ private void selectionChanged() {
+ if (textureList.getSelectedIndex() > -1) {
+ String selected = (String) textureList.getSelectedValue();
+ Texture tex = assetManager.loadTexture(selected);
+ Icon newicon = null;
+ if(selected.endsWith(".dds")||selected.endsWith(".DDS")){
+ try {
+ File file = FileUtil.toFile(assetManager.getAssetFolder().getFileObject(selected));
+ DDSImageFile ddsImageFile = new DDSImageFile(file);
+ BufferedImage bufferedImage = ddsImageFile.getData();
+ newicon = new ImageIcon(bufferedImage);
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }else{
+ newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0));
+ }
+ imagePreviewLabel.setIcon(newicon);
+ } else {
+ imagePreviewLabel.setIcon(null);
+ }
+ }
+
+ private void setSelectedTexture(Texture texture) {
+ if (texture != null) {
+ Logger.getLogger(TextureBrowser.class.getName()).finer("Looking for Texture: "+texture.getName());
+ for (int i=0; i listeners = new LinkedList();
+ private Texture texture;
+ private AssetManager manager;
+ private String assetKey;
+
+ public TexturePropertyEditor() {
+ }
+
+ public TexturePropertyEditor(Texture texture) {
+ this.texture = texture;
+ }
+
+ public TexturePropertyEditor(AssetManager manager) {
+ this.manager = manager;
+ }
+
+ public TexturePropertyEditor(Texture texture, AssetManager manager) {
+ this.texture = texture;
+ this.manager = manager;
+ }
+
+ public void setValue(Object value) {
+ if (value instanceof Texture) {
+ texture = (Texture) value;
+ } else {
+ texture = null;
+ }
+ }
+
+ public Object getValue() {
+ return texture;
+ }
+
+ public boolean isPaintable() {
+ return false;
+ }
+
+ public void paintValue(Graphics gfx, Rectangle box) {
+ }
+
+ public String getJavaInitializationString() {
+ return null;
+ }
+
+ public String getAsText() {
+// if (texture != null) {
+// return texture.getName();
+// }
+ return assetKey;
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ this.assetKey = text;
+ //TODO: load texture if not done.. maybe load here instead of panel..
+ }
+
+ public String[] getTags() {
+ return null;
+ }
+
+ public Component getCustomEditor() {
+ ProjectAssetManager currentProjectAssetManager = null;
+ if (manager instanceof ProjectAssetManager) {
+ currentProjectAssetManager = (ProjectAssetManager) manager;
+ }
+ //try {
+ if (currentProjectAssetManager == null) {
+ currentProjectAssetManager = (ProjectAssetManager) SceneApplication.getApplication().getAssetManager();
+ }
+ TextureBrowser textureBrowser = new TextureBrowser(null, true, currentProjectAssetManager, this);
+ return textureBrowser;
+ //} catch (Exception e) {
+ //Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, e.getMessage()+" Could not get project asset manager!", e);
+ //return null;
+ //}
+ }
+
+ public boolean supportsCustomEditor() {
+ return true;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ listeners.remove(listener);
+ }
+}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/UserDataProperty.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/UserDataProperty.java
new file mode 100644
index 000000000..cbc8a224e
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/UserDataProperty.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2009-2010 jMonkeyEngine
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.jme3.gde.core.properties;
+
+import com.jme3.gde.core.scene.SceneApplication;
+import com.jme3.scene.Spatial;
+import java.beans.PropertyEditor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import org.openide.nodes.PropertySupport;
+import org.openide.util.Exceptions;
+
+/**
+ *
+ * @author normenhansen
+ */
+public class UserDataProperty extends PropertySupport.ReadWrite {
+
+ private Spatial spatial;
+ private String name = "null";
+ private int type = 0;
+ private List listeners = new LinkedList();
+
+ public UserDataProperty(Spatial node, String name) {
+ super(name, String.class, name, "");
+ this.spatial = node;
+ this.name = name;
+ this.type = getObjectType(node.getUserData(name));
+ }
+
+ public static int getObjectType(Object type) {
+ if (type instanceof Integer) {
+ return 0;
+ } else if (type instanceof Float) {
+ return 1;
+ } else if (type instanceof Boolean) {
+ return 2;
+ } else if (type instanceof String) {
+ return 3;
+ } else if (type instanceof Long) {
+ return 4;
+ } else {
+ throw new IllegalArgumentException("Unsupported type: " + type);
+ }
+ }
+
+ @Override
+ public String getValue() throws IllegalAccessException, InvocationTargetException {
+ return spatial.getUserData(name) + "";
+ }
+
+ @Override
+ public void setValue(final String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ if (spatial == null) {
+ return;
+ }
+ try {
+ SceneApplication.getApplication().enqueue(new Callable() {
+
+ public Void call() throws Exception {
+ switch (type) {
+ case 0:
+ spatial.setUserData(name, Integer.parseInt(val));
+ break;
+ case 1:
+ spatial.setUserData(name, Float.parseFloat(val));
+ break;
+ case 2:
+ spatial.setUserData(name, Boolean.parseBoolean(val));
+ break;
+ case 3:
+ spatial.setUserData(name, val);
+ break;
+ case 4:
+ spatial.setUserData(name, Long.parseLong(val));
+ break;
+ default:
+ throw new UnsupportedOperationException();
+ }
+ return null;
+ }
+ }).get();
+ notifyListeners(null, val);
+ } catch (InterruptedException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (ExecutionException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+
+ @Override
+ public PropertyEditor getPropertyEditor() {
+ return null;
+// return new AnimationPropertyEditor(control);
+ }
+
+ public void addPropertyChangeListener(ScenePropertyChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removePropertyChangeListener(ScenePropertyChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ private void notifyListeners(Object before, Object after) {
+ for (Iterator it = listeners.iterator(); it.hasNext();) {
+ ScenePropertyChangeListener propertyChangeListener = it.next();
+ propertyChangeListener.propertyChange(getName(), before, after);
+ }
+ }
+}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/Vector2fPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/Vector2fPropertyEditor.java
new file mode 100644
index 000000000..8496b0081
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/Vector2fPropertyEditor.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2009-2010 jMonkeyEngine
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.jme3.gde.core.properties;
+
+import com.jme3.math.Vector2f;
+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.Iterator;
+import java.util.LinkedList;
+
+/**
+ *
+ * @author normenhansen
+ */
+public class Vector2fPropertyEditor implements PropertyEditor {
+
+ private LinkedList listeners = new LinkedList();
+ private Vector2f vector = new Vector2f();
+
+ public void setValue(Object value) {
+ if (value instanceof Vector2f) {
+ vector.set((Vector2f) value);
+ }
+ }
+
+ public Object getValue() {
+ return vector;
+ }
+
+ public boolean isPaintable() {
+ return false;
+ }
+
+ public void paintValue(Graphics gfx, Rectangle box) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public String getJavaInitializationString() {
+ return null;
+ }
+
+ public String getAsText() {
+ return "[" + vector.x + ", " + vector.y + "]";
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ text = text.replace('[', ' ');
+ text = text.replace(']', ' ');
+ String[] values = text.split(",");
+ if (values.length != 2) {
+ throw (new IllegalArgumentException("String not correct"));
+ }
+ float[] floats = new float[2];
+ for (int i = 0; i < values.length; i++) {
+ String string = values[i];
+ floats[i] = Float.parseFloat(string);
+ }
+ Vector2f old = new Vector2f();
+ old.set(vector);
+ vector.set(floats[0], floats[1]);
+ notifyListeners(old, vector);
+ }
+
+ public String[] getTags() {
+ return null;
+ }
+
+ public Component getCustomEditor() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public boolean supportsCustomEditor() {
+ return false;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ private void notifyListeners(Vector2f before, Vector2f after) {
+ for (Iterator it = listeners.iterator(); it.hasNext();) {
+ PropertyChangeListener propertyChangeListener = it.next();
+ //TODO: check what the "programmatic name" is supposed to be here.. for now its Vector2f
+ propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after));
+ }
+ }
+}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/properties/Vector3fPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/properties/Vector3fPropertyEditor.java
new file mode 100644
index 000000000..c3886f0f5
--- /dev/null
+++ b/sdk/jme3-core/src/com/jme3/gde/core/properties/Vector3fPropertyEditor.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2009-2010 jMonkeyEngine
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.jme3.gde.core.properties;
+
+import com.jme3.math.Vector3f;
+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.Iterator;
+import java.util.LinkedList;
+
+/**
+ *
+ * @author normenhansen
+ */
+public class Vector3fPropertyEditor implements PropertyEditor {
+
+ private LinkedList listeners = new LinkedList();
+ private Vector3f vector = new Vector3f();
+
+ public void setValue(Object value) {
+ if (value instanceof Vector3f) {
+ vector.set((Vector3f) value);
+ }
+ }
+
+ public Object getValue() {
+ return vector;
+ }
+
+ public boolean isPaintable() {
+ return false;
+ }
+
+ public void paintValue(Graphics gfx, Rectangle box) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public String getJavaInitializationString() {
+ return null;
+ }
+
+ public String getAsText() {
+ return "[" + vector.x + ", " + vector.y + ", " + vector.z + "]";
+ }
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ text = text.replace('[', ' ');
+ text = text.replace(']', ' ');
+ String[] values = text.split(",");
+ if (values.length != 3) {
+ throw (new IllegalArgumentException("String not correct"));
+ }
+ float[] floats = new float[3];
+ for (int i = 0; i < values.length; i++) {
+ String string = values[i];
+ floats[i] = Float.parseFloat(string);
+ }
+ Vector3f old = new Vector3f();
+ old.set(vector);
+ vector.set(floats[0], floats[1], floats[2]);
+ notifyListeners(old, vector);
+ }
+
+ public String[] getTags() {
+ return null;
+ }
+
+ public Component getCustomEditor() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public boolean supportsCustomEditor() {
+ return false;
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ private void notifyListeners(Vector3f before, Vector3f after) {
+ for (Iterator it = listeners.iterator(); it.hasNext();) {
+ PropertyChangeListener propertyChangeListener = it.next();
+ //TODO: check what the "programmatic name" is supposed to be here.. for now its Vector3f
+ propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after));
+ }
+ }
+}
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AbstractStatefulGLToolAction.java b/sdk/jme3-core/src/com/jme3/gde/core/scene/actions/AbstractStatefulGLToolAction.java
similarity index 98%
rename from sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AbstractStatefulGLToolAction.java
rename to sdk/jme3-core/src/com/jme3/gde/core/scene/actions/AbstractStatefulGLToolAction.java
index cc58497a9..694269d6d 100644
--- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/AbstractStatefulGLToolAction.java
+++ b/sdk/jme3-core/src/com/jme3/gde/core/scene/actions/AbstractStatefulGLToolAction.java
@@ -29,7 +29,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package com.jme3.gde.core.sceneexplorer.nodes.actions;
+package com.jme3.gde.core.scene.actions;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode;
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AbstractSceneExplorerNode.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AbstractSceneExplorerNode.java
index a3c1e154f..f1ce35099 100644
--- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AbstractSceneExplorerNode.java
+++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AbstractSceneExplorerNode.java
@@ -31,12 +31,17 @@
*/
package com.jme3.gde.core.sceneexplorer.nodes;
-import com.jme3.gde.core.sceneexplorer.nodes.properties.SceneExplorerProperty;
-import com.jme3.gde.core.sceneexplorer.nodes.properties.ScenePropertyChangeListener;
+import com.jme3.gde.core.nodes.DynamicLookup;
+import com.jme3.gde.core.properties.SceneExplorerProperty;
+import com.jme3.gde.core.properties.ScenePropertyChangeListener;
+import com.jme3.gde.core.util.PropertyUtils;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Field;
import org.openide.loaders.DataObject;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.Node;
+import org.openide.nodes.Sheet;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.lookup.InstanceContent;
@@ -55,33 +60,33 @@ public abstract class AbstractSceneExplorerNode extends AbstractNode implements
protected DataObject dataObject;
public AbstractSceneExplorerNode() {
- super(Children.LEAF, new SceneExplorerLookup(new InstanceContent()));
- lookupContents = ((SceneExplorerLookup) getLookup()).getInstanceContent();
+ super(Children.LEAF, new DynamicLookup(new InstanceContent()));
+ lookupContents = ((DynamicLookup) getLookup()).getInstanceContent();
}
public AbstractSceneExplorerNode(Children children, DataObject dataObject) {
- super(children, new ProxyLookup(dataObject.getLookup(), new SceneExplorerLookup(new InstanceContent())));
+ super(children, new ProxyLookup(dataObject.getLookup(), new DynamicLookup(new InstanceContent())));
this.dataObject = dataObject;
- lookupContents = getLookup().lookup(SceneExplorerLookup.class).getInstanceContent();
+ lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent();
}
public AbstractSceneExplorerNode(DataObject dataObject) {
- super(Children.LEAF, new ProxyLookup(dataObject != null ? dataObject.getLookup() : Lookup.EMPTY, new SceneExplorerLookup(new InstanceContent())));
+ super(Children.LEAF, new ProxyLookup(dataObject != null ? dataObject.getLookup() : Lookup.EMPTY, new DynamicLookup(new InstanceContent())));
this.dataObject = dataObject;
- lookupContents = getLookup().lookup(SceneExplorerLookup.class).getInstanceContent();
+ lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent();
}
public AbstractSceneExplorerNode(Children children) {
//TODO: OMG!
- super(children, children instanceof SceneExplorerChildren
- ? (((SceneExplorerChildren) children).getDataObject() != null
- ? new ProxyLookup(((SceneExplorerChildren) children).getDataObject().getLookup(), new SceneExplorerLookup(new InstanceContent()))
- : new SceneExplorerLookup(new InstanceContent()))
- : new SceneExplorerLookup(new InstanceContent()));
+ super(children, children instanceof JmeSpatialChildren
+ ? (((JmeSpatialChildren) children).getDataObject() != null
+ ? new ProxyLookup(((JmeSpatialChildren) children).getDataObject().getLookup(), new DynamicLookup(new InstanceContent()))
+ : new DynamicLookup(new InstanceContent()))
+ : new DynamicLookup(new InstanceContent()));
this.jmeChildren = children;
- lookupContents = getLookup().lookup(SceneExplorerLookup.class).getInstanceContent();
- if (children instanceof SceneExplorerChildren) {
- this.dataObject = ((SceneExplorerChildren) children).getDataObject();
+ lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent();
+ if (children instanceof JmeSpatialChildren) {
+ this.dataObject = ((JmeSpatialChildren) children).getDataObject();
}
}
@@ -125,8 +130,8 @@ public abstract class AbstractSceneExplorerNode extends AbstractNode implements
//TODO: refresh does not work
public void refresh(boolean immediate) {
- if (jmeChildren instanceof SceneExplorerChildren) {
- ((SceneExplorerChildren) jmeChildren).refreshChildren(immediate);
+ if (jmeChildren instanceof JmeSpatialChildren) {
+ ((JmeSpatialChildren) jmeChildren).refreshChildren(immediate);
}
}
@@ -161,6 +166,15 @@ public abstract class AbstractSceneExplorerNode extends AbstractNode implements
return prop;
}
+ protected void createFields(Class c, Sheet.Set set, Object obj) throws SecurityException {
+ for (Field field : c.getDeclaredFields()) {
+ PropertyDescriptor prop = PropertyUtils.getPropertyDescriptor(c, field);
+ if (prop != null) {
+ set.put(makeProperty(obj, prop.getPropertyType(), prop.getReadMethod().getName(), prop.getWriteMethod().getName(), prop.getDisplayName()));
+ }
+ }
+ }
+
public void propertyChange(final String name, final Object before, final Object after) {
fireSave(true);
firePropertyChange(name, before, after);
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AssetLinkChildren.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AssetLinkChildren.java
deleted file mode 100644
index e41eb8306..000000000
--- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AssetLinkChildren.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2009-2010 jMonkeyEngine
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.jme3.gde.core.sceneexplorer.nodes;
-
-import com.jme3.asset.ModelKey;
-import com.jme3.gde.core.scene.SceneApplication;
-import com.jme3.scene.AssetLinkNode;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import org.openide.nodes.Node;
-import org.openide.util.Exceptions;
-
-/**
- *
- * @author normenhansen
- */
-public class AssetLinkChildren extends SceneExplorerChildren {
-
- public AssetLinkChildren(AssetLinkNode spatial) {
- super(spatial);
- }
-
- public void refreshChildren(boolean immediate) {
- setKeys(createKeys());
- refresh();
- }
-
- protected List