- cleanup some packages, move some classes
- better names for some classes

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7772 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 14 years ago
parent b446c5c56d
commit 6144a86e41
  1. 2
      sdk/jme3-core/nbproject/project.xml
  2. 4
      sdk/jme3-core/src/com/jme3/gde/core/filters/AbstractFilterNode.java
  3. 14
      sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanel.form
  4. 2
      sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanel.java
  5. 2
      sdk/jme3-core/src/com/jme3/gde/core/j2seproject/AssetsPropertiesPanelProvider.java
  6. 38
      sdk/jme3-core/src/com/jme3/gde/core/j2seproject/Bundle.properties
  7. 6
      sdk/jme3-core/src/com/jme3/gde/core/nodes/DynamicLookup.java
  8. 62
      sdk/jme3-core/src/com/jme3/gde/core/properties/AnimationProperty.java
  9. 131
      sdk/jme3-core/src/com/jme3/gde/core/properties/AnimationPropertyEditor.java
  10. 102
      sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataProperty.java
  11. 123
      sdk/jme3-core/src/com/jme3/gde/core/properties/AudioDataPropertyEditor.java
  12. 47
      sdk/jme3-core/src/com/jme3/gde/core/properties/Bundle.properties
  13. 97
      sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.form
  14. 155
      sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBADialog.java
  15. 125
      sdk/jme3-core/src/com/jme3/gde/core/properties/ColorRGBAPropertyEditor.java
  16. 186
      sdk/jme3-core/src/com/jme3/gde/core/properties/EmitterShapePropertyEditor.java
  17. 124
      sdk/jme3-core/src/com/jme3/gde/core/properties/Matrix3fPropertyEditor.java
  18. 125
      sdk/jme3-core/src/com/jme3/gde/core/properties/QuaternionPropertyEditor.java
  19. 209
      sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerProperty.java
  20. 41
      sdk/jme3-core/src/com/jme3/gde/core/properties/SceneExplorerPropertyEditor.java
  21. 41
      sdk/jme3-core/src/com/jme3/gde/core/properties/ScenePropertyChangeListener.java
  22. 128
      sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.form
  23. 264
      sdk/jme3-core/src/com/jme3/gde/core/properties/TextureBrowser.java
  24. 139
      sdk/jme3-core/src/com/jme3/gde/core/properties/TexturePropertyEditor.java
  25. 144
      sdk/jme3-core/src/com/jme3/gde/core/properties/UserDataProperty.java
  26. 124
      sdk/jme3-core/src/com/jme3/gde/core/properties/Vector2fPropertyEditor.java
  27. 124
      sdk/jme3-core/src/com/jme3/gde/core/properties/Vector3fPropertyEditor.java
  28. 2
      sdk/jme3-core/src/com/jme3/gde/core/scene/actions/AbstractStatefulGLToolAction.java
  29. 50
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AbstractSceneExplorerNode.java
  30. 98
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/AssetLinkChildren.java
  31. 1
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAmbientLight.java
  32. 4
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAnimControl.java
  33. 120
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAssetLinkNode.java
  34. 7
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeAudioNode.java
  35. 5
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeBitmapText.java
  36. 2
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeCharacterControl.java
  37. 1
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeDirectionalLight.java
  38. 9
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java
  39. 5
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGeometry.java
  40. 2
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGhostControl.java
  41. 2
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeLight.java
  42. 2
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeMesh.java
  43. 24
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeNode.java
  44. 48
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeParticleEmitter.java
  45. 5
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmePicture.java
  46. 1
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmePointLight.java
  47. 2
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeRigidBodyControl.java
  48. 31
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSpatial.java
  49. 8
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeSpatialChildren.java
  50. 5
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeTerrainQuad.java
  51. 65
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleControl.java
  52. 2
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeVehicleWheel.java
  53. 8
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/NodeUtility.java
  54. 99
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/PhysicsVehicleChildren.java
  55. 4
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewControlPopup.java
  56. 4
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewLightPopup.java
  57. 4
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/NewSpatialPopup.java
  58. 4
      sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/actions/ToolPopup.java
  59. 4
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/MaterialPropertyEditor.java
  60. 2
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/TexturePanel.java
  61. 2
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainEditorTopComponent.java
  62. 2
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/sky/SkyboxVisualPanel2.java
  63. 2
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/tools/AbstractTerrainToolAction.java

@ -248,8 +248,10 @@
<package>com.jme3.gde.core.filters.actions</package>
<package>com.jme3.gde.core.filters.impl</package>
<package>com.jme3.gde.core.j2seproject</package>
<package>com.jme3.gde.core.nodes</package>
<package>com.jme3.gde.core.properties</package>
<package>com.jme3.gde.core.scene</package>
<package>com.jme3.gde.core.scene.actions</package>
<package>com.jme3.gde.core.scene.controller</package>
<package>com.jme3.gde.core.scene.processors</package>
<package>com.jme3.gde.core.sceneexplorer</package>

@ -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;

@ -84,49 +84,49 @@
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/properties/Bundle.properties" key="AssetsPropertiesPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="com/jme3/gde/core/j2seproject/Bundle.properties" key="AssetsPropertiesPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/properties/Bundle.properties" key="AssetsPropertiesPanel.jTextField1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="com/jme3/gde/core/j2seproject/Bundle.properties" key="AssetsPropertiesPanel.jTextField1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/properties/Bundle.properties" key="AssetsPropertiesPanel.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="com/jme3/gde/core/j2seproject/Bundle.properties" key="AssetsPropertiesPanel.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/properties/Bundle.properties" key="AssetsPropertiesPanel.jTextField2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="com/jme3/gde/core/j2seproject/Bundle.properties" key="AssetsPropertiesPanel.jTextField2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/properties/Bundle.properties" key="AssetsPropertiesPanel.jCheckBox1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="com/jme3/gde/core/j2seproject/Bundle.properties" key="AssetsPropertiesPanel.jCheckBox1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/properties/Bundle.properties" key="AssetsPropertiesPanel.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="com/jme3/gde/core/j2seproject/Bundle.properties" key="AssetsPropertiesPanel.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField3">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/properties/Bundle.properties" key="AssetsPropertiesPanel.jTextField3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="com/jme3/gde/core/j2seproject/Bundle.properties" key="AssetsPropertiesPanel.jTextField3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>

@ -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;

@ -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;
/**
*

@ -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

@ -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);

@ -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<String> {
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<Void>() {
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);
}
}

@ -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<PropertyChangeListener> listeners = new LinkedList<PropertyChangeListener>();
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<String> names = control.getAnimationNames();
String[] strings = new String[names.size() + 1];
strings[0] = "null";
int i = 1;
for (Iterator<String> 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<PropertyChangeListener> 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));
}
}
}

@ -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<String> {
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<Void>() {
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();
}
}

@ -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<PropertyChangeListener> listeners = new LinkedList<PropertyChangeListener>();
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<PropertyChangeListener> 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));
}
}
}

@ -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

@ -0,0 +1,97 @@
<?xml version="1.1" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jToolBar1" pref="320" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jColorChooser1" alignment="0" pref="496" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jColorChooser1" pref="380" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jToolBar1" min="-2" pref="25" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JColorChooser" name="jColorChooser1">
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/properties/Bundle.properties" key="ColorRGBADialog.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/properties/Bundle.properties" key="ColorRGBADialog.jButton2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JToolBar" name="jToolBar1">
<Properties>
<Property name="floatable" type="boolean" value="false"/>
<Property name="rollover" type="boolean" value="true"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
<SubComponents>
<Component class="javax.swing.JLabel" name="alphaLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/properties/Bundle.properties" key="ColorRGBADialog.alphaLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSlider" name="alphaSlider">
<Properties>
<Property name="value" type="int" value="100"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

@ -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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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();
}// </editor-fold>//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
}

@ -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<PropertyChangeListener> listeners = new LinkedList<PropertyChangeListener>();
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<PropertyChangeListener> 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));
}
}
}

@ -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<PropertyChangeListener> listeners = new LinkedList<PropertyChangeListener>();
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<PropertyChangeListener> 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));
}
}
}

@ -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<PropertyChangeListener> listeners = new LinkedList<PropertyChangeListener>();
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<PropertyChangeListener> 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));
}
}
}

@ -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<PropertyChangeListener> listeners = new LinkedList<PropertyChangeListener>();
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<PropertyChangeListener> 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));
}
}
}

@ -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<T> extends PropertySupport.Reflection<T> {
protected LinkedList<ScenePropertyChangeListener> listeners = new LinkedList<ScenePropertyChangeListener>();
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<T>() {
//
// 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<Void>() {
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<ScenePropertyChangeListener> it = listeners.iterator(); it.hasNext();) {
ScenePropertyChangeListener propertyChangeListener = it.next();
propertyChangeListener.propertyChange(getName(), before, after);
}
}
}

@ -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);
}

@ -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);
}

@ -0,0 +1,128 @@
<?xml version="1.1" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/assets/Bundle.properties" key="TextureBrowser.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="357" max="32767" attributes="0"/>
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="okButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="17" max="-2" attributes="0"/>
</Group>
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jPanel1" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="okButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="cancelButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/properties/Bundle.properties" key="TextureBrowser.cancelButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="okButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/properties/Bundle.properties" key="TextureBrowser.okButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="okButtonActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jScrollPane1" pref="264" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane2" pref="267" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane2" alignment="0" pref="299" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="1" pref="299" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="textureList">
<Properties>
<Property name="selectionMode" type="int" value="0"/>
<Property name="selectionModel" type="javax.swing.ListSelectionModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new ToggleSelectionModel()" type="code"/>
</Property>
</Properties>
<Events>
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="textureListValueChanged"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JLabel" name="imagePreviewLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/properties/Bundle.properties" key="TextureBrowser.imagePreviewLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

@ -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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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();
}// </editor-fold>//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<textureList.getModel().getSize(); i++) {
Logger.getLogger(TextureBrowser.class.getName()).finer("Texture name: "+textureList.getModel().getElementAt(i));
if (textureList.getModel().getElementAt(i).equals(texture.getName()) ) {
textureList.setSelectedIndex(i);
break;
}
}
}
}
class ToggleSelectionModel extends DefaultListSelectionModel {
boolean gestureStarted = false;
@Override
public void setSelectionInterval(int index0, int index1) {
if (isSelectedIndex(index0) && !gestureStarted) {
super.removeSelectionInterval(index0, index1);
}
else {
super.setSelectionInterval(index0, index1);
}
gestureStarted = true;
}
@Override
public void setValueIsAdjusting(boolean isAdjusting) {
if (isAdjusting == false) {
gestureStarted = false;
}
}
}
}

@ -0,0 +1,139 @@
/*
* 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.asset.AssetManager;
import com.jme3.gde.core.assets.ProjectAssetManager;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.texture.Texture;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.beans.PropertyChangeListener;
import java.beans.PropertyEditor;
import java.util.LinkedList;
/**
*
* @author bowens
*/
public class TexturePropertyEditor implements PropertyEditor {
private LinkedList<PropertyChangeListener> listeners = new LinkedList<PropertyChangeListener>();
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);
}
}

@ -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<String> {
private Spatial spatial;
private String name = "null";
private int type = 0;
private List<ScenePropertyChangeListener> listeners = new LinkedList<ScenePropertyChangeListener>();
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<Void>() {
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<ScenePropertyChangeListener> it = listeners.iterator(); it.hasNext();) {
ScenePropertyChangeListener propertyChangeListener = it.next();
propertyChangeListener.propertyChange(getName(), before, after);
}
}
}

@ -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<PropertyChangeListener> listeners = new LinkedList<PropertyChangeListener>();
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<PropertyChangeListener> 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));
}
}
}

@ -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<PropertyChangeListener> listeners = new LinkedList<PropertyChangeListener>();
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<PropertyChangeListener> 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));
}
}
}

@ -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;

@ -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);

@ -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<Object> createKeys() {
try {
return SceneApplication.getApplication().enqueue(new Callable<List<Object>>() {
public List<Object> call() throws Exception {
List<Object> keys = new LinkedList<Object>();
if (spatial instanceof AssetLinkNode) {
keys.addAll(((AssetLinkNode)spatial).getAssetLoaderKeys());
return keys;
}
return keys;
}
}).get();
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
} catch (ExecutionException ex) {
Exceptions.printStackTrace(ex);
}
return null;
}
public void setReadOnly(boolean cookie) {
this.readOnly = cookie;
}
@Override
protected void addNotify() {
super.addNotify();
setKeys(createKeys());
}
@Override
protected Node[] createNodes(Object key) {
if (key instanceof ModelKey) {
ModelKey assetKey = (ModelKey)key;
return new Node[]{new JmeAssetLinkChild(assetKey, (AssetLinkNode)spatial)};
}
return null;
}
}

@ -32,6 +32,7 @@
package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.light.AmbientLight;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;

@ -33,7 +33,9 @@ package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.animation.AnimControl;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneexplorer.nodes.properties.AnimationProperty;
import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.gde.core.properties.AnimationProperty;
import com.jme3.scene.Spatial;
import java.awt.Image;
import java.io.IOException;

@ -31,17 +31,32 @@
*/
package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.asset.ModelKey;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.scene.AssetLinkNode;
import java.awt.Image;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import javax.swing.Action;
import org.openide.actions.DeleteAction;
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.ImageUtilities;
import org.openide.util.actions.SystemAction;
/**
*
* @author normenhansen
*/
@org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class)
@org.openide.util.lookup.ServiceProvider(service = SceneExplorerNode.class)
public class JmeAssetLinkNode extends JmeNode {
private static Image smallImage =
@ -51,7 +66,7 @@ public class JmeAssetLinkNode extends JmeNode {
public JmeAssetLinkNode() {
}
public JmeAssetLinkNode(AssetLinkNode spatial, SceneExplorerChildren children) {
public JmeAssetLinkNode(AssetLinkNode spatial, JmeSpatialChildren children) {
super(spatial, new AssetLinkChildren(spatial));
getLookupContents().add(spatial);
this.geom = spatial;
@ -93,9 +108,108 @@ public class JmeAssetLinkNode extends JmeNode {
}
public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) {
SceneExplorerChildren children=new SceneExplorerChildren((com.jme3.scene.Spatial)key);
JmeSpatialChildren children = new JmeSpatialChildren((com.jme3.scene.Spatial) key);
children.setReadOnly(cookie);
children.setDataObject(key2);
return new org.openide.nodes.Node[]{new JmeAssetLinkNode((AssetLinkNode) key, children).setReadOnly(cookie)};
}
public static class AssetLinkChildren extends JmeSpatialChildren {
public AssetLinkChildren(AssetLinkNode spatial) {
super(spatial);
}
public void refreshChildren(boolean immediate) {
setKeys(createKeys());
refresh();
}
protected List<Object> createKeys() {
try {
return SceneApplication.getApplication().enqueue(new Callable<List<Object>>() {
public List<Object> call() throws Exception {
List<Object> keys = new LinkedList<Object>();
if (spatial instanceof AssetLinkNode) {
keys.addAll(((AssetLinkNode) spatial).getAssetLoaderKeys());
return keys;
}
return keys;
}
}).get();
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
} catch (ExecutionException ex) {
Exceptions.printStackTrace(ex);
}
return null;
}
public void setReadOnly(boolean cookie) {
this.readOnly = cookie;
}
@Override
protected void addNotify() {
super.addNotify();
setKeys(createKeys());
}
@Override
protected Node[] createNodes(Object key) {
if (key instanceof ModelKey) {
ModelKey assetKey = (ModelKey) key;
return new Node[]{new JmeAssetLinkChild(assetKey, (AssetLinkNode) spatial)};
}
return null;
}
}
public static class JmeAssetLinkChild extends AbstractNode {
private ModelKey key;
private AssetLinkNode linkNode;
public JmeAssetLinkChild(ModelKey key, AssetLinkNode linkNode) {
super(Children.LEAF);
this.key = key;
this.linkNode = linkNode;
this.setName(key.getName());
}
@Override
public Action[] getActions(boolean context) {
return new SystemAction[]{
SystemAction.get(DeleteAction.class)
};
}
@Override
public boolean canDestroy() {
return true;
}
@Override
public void destroy() throws IOException {
super.destroy();
try {
SceneApplication.getApplication().enqueue(new Callable<Void>() {
public Void call() throws Exception {
linkNode.detachLinkedChild(key);
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);
}
}
}
}

@ -34,7 +34,8 @@ package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.audio.AudioNode;
import com.jme3.audio.AudioNode.Status;
import com.jme3.audio.Filter;
import com.jme3.gde.core.sceneexplorer.nodes.properties.AudioDataProperty;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.gde.core.properties.AudioDataProperty;
import com.jme3.math.Vector3f;
import java.awt.Image;
import org.openide.loaders.DataObject;
@ -55,7 +56,7 @@ public class JmeAudioNode extends JmeNode {
public JmeAudioNode() {
}
public JmeAudioNode(AudioNode spatial, SceneExplorerChildren children) {
public JmeAudioNode(AudioNode spatial, JmeSpatialChildren children) {
super(spatial, children);
getLookupContents().add(spatial);
this.node = spatial;
@ -119,7 +120,7 @@ public class JmeAudioNode extends JmeNode {
}
public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) {
SceneExplorerChildren children=new SceneExplorerChildren((com.jme3.scene.Spatial)key);
JmeSpatialChildren children=new JmeSpatialChildren((com.jme3.scene.Spatial)key);
children.setReadOnly(cookie);
children.setDataObject(key2);
return new org.openide.nodes.Node[]{new JmeAudioNode((AudioNode) key, children).setReadOnly(cookie)};

@ -33,6 +33,7 @@ package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.math.ColorRGBA;
import java.awt.Image;
import org.openide.loaders.DataObject;
@ -53,7 +54,7 @@ public class JmeBitmapText extends JmeNode {
public JmeBitmapText() {
}
public JmeBitmapText(BitmapText spatial, SceneExplorerChildren children) {
public JmeBitmapText(BitmapText spatial, JmeSpatialChildren children) {
super(spatial, children);
getLookupContents().add(spatial);
this.geom = spatial;
@ -100,7 +101,7 @@ public class JmeBitmapText extends JmeNode {
}
public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) {
SceneExplorerChildren children=new SceneExplorerChildren((com.jme3.scene.Spatial)key);
JmeSpatialChildren children=new JmeSpatialChildren((com.jme3.scene.Spatial)key);
children.setReadOnly(cookie);
children.setDataObject(key2);
return new org.openide.nodes.Node[]{new JmeBitmapText((BitmapText) key, children).setReadOnly(cookie)};

@ -34,6 +34,8 @@ package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.control.CharacterControl;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;
import java.awt.Image;

@ -32,6 +32,7 @@
package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.light.DirectionalLight;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;

@ -31,9 +31,10 @@
*/
package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.gde.core.nodes.DynamicLookup;
import com.jme3.gde.core.scene.SceneApplication;
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.scene.Spatial;
import com.jme3.scene.control.Control;
@ -69,8 +70,8 @@ public class JmeGenericControl extends AbstractNode implements ScenePropertyChan
public JmeGenericControl(Control control, DataObject dataObject) {
//TODO: lookup content! (control etc)
super(Children.LEAF, new ProxyLookup(dataObject.getLookup(), new SceneExplorerLookup(new InstanceContent())));
lookupContents = getLookup().lookup(SceneExplorerLookup.class).getInstanceContent();
super(Children.LEAF, new ProxyLookup(dataObject.getLookup(), new DynamicLookup(new InstanceContent())));
lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent();
this.control = control;
this.dobject = dataObject;
lookupContents.add(this);

@ -31,6 +31,7 @@
*/
package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.material.Material;
import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh;
@ -53,7 +54,7 @@ public class JmeGeometry extends JmeSpatial {
public JmeGeometry() {
}
public JmeGeometry(Geometry spatial, SceneExplorerChildren children) {
public JmeGeometry(Geometry spatial, JmeSpatialChildren children) {
super(spatial, children);
getLookupContents().add(spatial);
this.geom = spatial;
@ -100,7 +101,7 @@ public class JmeGeometry extends JmeSpatial {
}
public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) {
SceneExplorerChildren children=new SceneExplorerChildren((com.jme3.scene.Spatial)key);
JmeSpatialChildren children=new JmeSpatialChildren((com.jme3.scene.Spatial)key);
children.setReadOnly(cookie);
children.setDataObject(key2);
return new org.openide.nodes.Node[]{new JmeGeometry((Geometry) key, children).setReadOnly(cookie)};

@ -34,6 +34,8 @@ package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.control.GhostControl;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;

@ -32,6 +32,8 @@
package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.light.Light;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Spatial;

@ -32,6 +32,8 @@
package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.light.Light;
import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh;

@ -32,11 +32,13 @@
package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneexplorer.nodes.actions.AddControlAction;
import com.jme3.gde.core.sceneexplorer.nodes.actions.AddLightAction;
import com.jme3.gde.core.sceneexplorer.nodes.actions.AddSpatialAction;
import com.jme3.gde.core.sceneexplorer.nodes.ClipboardSpatial;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.gde.core.sceneexplorer.nodes.actions.NewControlPopup;
import com.jme3.gde.core.sceneexplorer.nodes.actions.NewLightPopup;
import com.jme3.gde.core.sceneexplorer.nodes.actions.NewSpatialPopup;
import com.jme3.gde.core.sceneexplorer.nodes.actions.AddUserDataAction;
import com.jme3.gde.core.sceneexplorer.nodes.actions.UseToolAction;
import com.jme3.gde.core.sceneexplorer.nodes.actions.ToolPopup;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import java.awt.Image;
@ -74,7 +76,7 @@ public class JmeNode extends JmeSpatial {
public JmeNode() {
}
public JmeNode(Node spatial, SceneExplorerChildren children) {
public JmeNode(Node spatial, JmeSpatialChildren children) {
super(spatial, children);
getLookupContents().add(spatial);
this.node = spatial;
@ -158,16 +160,16 @@ public class JmeNode extends JmeSpatial {
@Override
public Action[] getActions(boolean context) {
// return super.getActions(context);
if (((SceneExplorerChildren) jmeChildren).readOnly) {
if (((JmeSpatialChildren) jmeChildren).readOnly) {
return new Action[]{
SystemAction.get(CopyAction.class),};
} else {
return new Action[]{
new AddSpatialAction(this),
new AddControlAction(this),
new AddLightAction(this),
new NewSpatialPopup(this),
new NewControlPopup(this),
new NewLightPopup(this),
Actions.alwaysEnabled(new AddUserDataAction(this), "Add User Data", "", false),
new UseToolAction(this),
new ToolPopup(this),
SystemAction.get(RenameAction.class),
SystemAction.get(CopyAction.class),
SystemAction.get(CutAction.class),
@ -186,7 +188,7 @@ public class JmeNode extends JmeSpatial {
}
public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) {
SceneExplorerChildren children = new SceneExplorerChildren((com.jme3.scene.Spatial) key);
JmeSpatialChildren children = new JmeSpatialChildren((com.jme3.scene.Spatial) key);
children.setReadOnly(cookie);
children.setDataObject(key2);
return new org.openide.nodes.Node[]{new JmeNode((Node) key, children).setReadOnly(cookie)};

@ -33,6 +33,7 @@ package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.effect.shapes.EmitterShape;
import com.jme3.effect.ParticleEmitter;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import java.awt.Image;
@ -55,7 +56,7 @@ public class JmeParticleEmitter extends JmeGeometry{
ImageUtilities.loadImage("com/jme3/gde/core/sceneexplorer/nodes/icons/particleemitter.gif");
private ParticleEmitter geom;
public JmeParticleEmitter(ParticleEmitter spatial, SceneExplorerChildren children) {
public JmeParticleEmitter(ParticleEmitter spatial, JmeSpatialChildren children) {
super(spatial, children);
getLookupContents().add(spatial);
this.geom = spatial;
@ -83,27 +84,28 @@ public class JmeParticleEmitter extends JmeGeometry{
return sheet;
}
set.put(makeProperty(obj, boolean.class, "isEnabled", "setEnabled", "Enabled"));
set.put(makeProperty(obj, EmitterShape.class, "getShape", "setShape", "Emitter Shape"));
set.put(makeProperty(obj, int.class, "getNumVisibleParticles", "setNumParticles", "Num Particles"));
set.put(makeProperty(obj, float.class, "getParticlesPerSec", "setParticlesPerSec", "Particles Per Sec"));
set.put(makeProperty(obj, ColorRGBA.class, "getStartColor", "setStartColor", "Start Color"));
set.put(makeProperty(obj, ColorRGBA.class, "getEndColor", "setEndColor", "End Color"));
set.put(makeProperty(obj, float.class, "getStartSize", "setStartSize", "Start Size"));
set.put(makeProperty(obj, float.class, "getEndSize", "setEndSize", "End Size"));
set.put(makeProperty(obj, float.class, "getHighLife", "setHighLife", "High Life"));
set.put(makeProperty(obj, float.class, "getLowLife", "setLowLife", "Low Life"));
set.put(makeProperty(obj, float.class, "getGravity", "setGravity", "Gravity"));
set.put(makeProperty(obj, Vector3f.class, "getInitialVelocity", "setInitialVelocity", "Initial Velocity"));
set.put(makeProperty(obj, Vector3f.class, "getFaceNormal", "setFaceNormal", "Face Normal"));
set.put(makeProperty(obj, float.class, "getVelocityVariation", "setVelocityVariation", "Velocity Variation"));
set.put(makeProperty(obj, boolean.class, "isFacingVelocity", "setFacingVelocity", "Facing Velocity"));
set.put(makeProperty(obj, boolean.class, "isRandomAngle", "setRandomAngle", "Random Angle"));
set.put(makeProperty(obj, boolean.class, "isInWorldSpace", "setInWorldSpace", "World Space"));
set.put(makeProperty(obj, float.class, "getRotateSpeed", "setRotateSpeed", "Rotate Speed"));
set.put(makeProperty(obj, boolean.class, "isSelectRandomImage", "setSelectRandomImage", "Select Random Image"));
set.put(makeProperty(obj, int.class, "getImagesX", "setImagesX", "Images X"));
set.put(makeProperty(obj, int.class, "getImagesY", "setImagesY", "Images Y"));
createFields(geom.getClass(), set, obj);
// set.put(makeProperty(obj, boolean.class, "isEnabled", "setEnabled", "Enabled"));
// set.put(makeProperty(obj, EmitterShape.class, "getShape", "setShape", "Emitter Shape"));
// set.put(makeProperty(obj, int.class, "getNumVisibleParticles", "setNumParticles", "Num Particles"));
// set.put(makeProperty(obj, float.class, "getParticlesPerSec", "setParticlesPerSec", "Particles Per Sec"));
// set.put(makeProperty(obj, ColorRGBA.class, "getStartColor", "setStartColor", "Start Color"));
// set.put(makeProperty(obj, ColorRGBA.class, "getEndColor", "setEndColor", "End Color"));
// set.put(makeProperty(obj, float.class, "getStartSize", "setStartSize", "Start Size"));
// set.put(makeProperty(obj, float.class, "getEndSize", "setEndSize", "End Size"));
// set.put(makeProperty(obj, float.class, "getHighLife", "setHighLife", "High Life"));
// set.put(makeProperty(obj, float.class, "getLowLife", "setLowLife", "Low Life"));
// set.put(makeProperty(obj, float.class, "getGravity", "setGravity", "Gravity"));
// set.put(makeProperty(obj, Vector3f.class, "getInitialVelocity", "setInitialVelocity", "Initial Velocity"));
// set.put(makeProperty(obj, Vector3f.class, "getFaceNormal", "setFaceNormal", "Face Normal"));
// set.put(makeProperty(obj, float.class, "getVelocityVariation", "setVelocityVariation", "Velocity Variation"));
// set.put(makeProperty(obj, boolean.class, "isFacingVelocity", "setFacingVelocity", "Facing Velocity"));
// set.put(makeProperty(obj, boolean.class, "isRandomAngle", "setRandomAngle", "Random Angle"));
// set.put(makeProperty(obj, boolean.class, "isInWorldSpace", "setInWorldSpace", "World Space"));
// set.put(makeProperty(obj, float.class, "getRotateSpeed", "setRotateSpeed", "Rotate Speed"));
// set.put(makeProperty(obj, boolean.class, "isSelectRandomImage", "setSelectRandomImage", "Select Random Image"));
// set.put(makeProperty(obj, int.class, "getImagesX", "setImagesX", "Images X"));
// set.put(makeProperty(obj, int.class, "getImagesY", "setImagesY", "Images Y"));
// set.put(makeProperty(obj, EmitterShape.class, "getShape", "setShape", "shape"));
@ -123,7 +125,7 @@ public class JmeParticleEmitter extends JmeGeometry{
}
public Node[] createNodes(Object key, DataObject key2, boolean cookie) {
SceneExplorerChildren children=new SceneExplorerChildren((com.jme3.scene.Spatial)key);
JmeSpatialChildren children=new JmeSpatialChildren((com.jme3.scene.Spatial)key);
children.setReadOnly(cookie);
children.setDataObject(key2);
return new Node[]{new JmeParticleEmitter((ParticleEmitter) key, children).setReadOnly(cookie)};

@ -31,6 +31,7 @@
*/
package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.ui.Picture;
import java.awt.Image;
import org.openide.loaders.DataObject;
@ -51,7 +52,7 @@ public class JmePicture extends JmeGeometry {
public JmePicture() {
}
public JmePicture(Picture spatial, SceneExplorerChildren children) {
public JmePicture(Picture spatial, JmeSpatialChildren children) {
super(spatial, children);
getLookupContents().add(spatial);
this.geom = spatial;
@ -95,7 +96,7 @@ public class JmePicture extends JmeGeometry {
}
public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) {
SceneExplorerChildren children=new SceneExplorerChildren((com.jme3.scene.Spatial)key);
JmeSpatialChildren children=new JmeSpatialChildren((com.jme3.scene.Spatial)key);
children.setReadOnly(cookie);
children.setDataObject(key2);
return new org.openide.nodes.Node[]{new JmePicture((Picture) key, children).setReadOnly(cookie)};

@ -32,6 +32,7 @@
package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.light.PointLight;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;

@ -34,6 +34,8 @@ package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;

@ -34,11 +34,14 @@ package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.bounding.BoundingVolume;
import com.jme3.export.binary.BinaryExporter;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneexplorer.nodes.actions.AddControlAction;
import com.jme3.gde.core.sceneexplorer.nodes.actions.AddLightAction;
import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode;
import com.jme3.gde.core.sceneexplorer.nodes.ClipboardSpatial;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.gde.core.sceneexplorer.nodes.actions.NewControlPopup;
import com.jme3.gde.core.sceneexplorer.nodes.actions.NewLightPopup;
import com.jme3.gde.core.sceneexplorer.nodes.actions.AddUserDataAction;
import com.jme3.gde.core.sceneexplorer.nodes.actions.UseToolAction;
import com.jme3.gde.core.sceneexplorer.nodes.properties.UserDataProperty;
import com.jme3.gde.core.sceneexplorer.nodes.actions.ToolPopup;
import com.jme3.gde.core.properties.UserDataProperty;
import com.jme3.light.LightList;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
@ -81,7 +84,7 @@ public class JmeSpatial extends AbstractSceneExplorerNode {
public JmeSpatial() {
}
public JmeSpatial(Spatial spatial, SceneExplorerChildren factory) {
public JmeSpatial(Spatial spatial, JmeSpatialChildren factory) {
super(factory);
this.jmeChildren = factory;
this.spatial = spatial;
@ -125,15 +128,15 @@ public class JmeSpatial extends AbstractSceneExplorerNode {
@Override
public Action[] getActions(boolean context) {
// return super.getActions(context);
if (((SceneExplorerChildren) jmeChildren).readOnly) {
if (((JmeSpatialChildren) jmeChildren).readOnly) {
return new Action[]{
SystemAction.get(CopyAction.class),};
} else {
return new Action[]{
new AddControlAction(this),
new AddLightAction(this),
new NewControlPopup(this),
new NewLightPopup(this),
Actions.alwaysEnabled(new AddUserDataAction(this), "Add User Data", "", false),
new UseToolAction(this),
new ToolPopup(this),
SystemAction.get(RenameAction.class),
SystemAction.get(CopyAction.class),
SystemAction.get(CutAction.class),
@ -145,22 +148,22 @@ public class JmeSpatial extends AbstractSceneExplorerNode {
@Override
public boolean canCopy() {
return !((SceneExplorerChildren) jmeChildren).readOnly;
return !((JmeSpatialChildren) jmeChildren).readOnly;
}
@Override
public boolean canCut() {
return !((SceneExplorerChildren) jmeChildren).readOnly;
return !((JmeSpatialChildren) jmeChildren).readOnly;
}
@Override
public boolean canDestroy() {
return !((SceneExplorerChildren) jmeChildren).readOnly;
return !((JmeSpatialChildren) jmeChildren).readOnly;
}
@Override
public boolean canRename() {
return !((SceneExplorerChildren) jmeChildren).readOnly;
return !((JmeSpatialChildren) jmeChildren).readOnly;
}
@Override
@ -347,7 +350,7 @@ public class JmeSpatial extends AbstractSceneExplorerNode {
}
public Node[] createNodes(Object key, DataObject key2, boolean cookie) {
SceneExplorerChildren children = new SceneExplorerChildren((com.jme3.scene.Spatial) key);
JmeSpatialChildren children = new JmeSpatialChildren((com.jme3.scene.Spatial) key);
children.setReadOnly(cookie);
children.setDataObject(key2);
return new Node[]{new JmeSpatial((Spatial) key, children).setReadOnly(cookie)};

@ -61,17 +61,17 @@ import org.openide.util.Lookup;
*
* @author normenhansen
*/
public class SceneExplorerChildren extends Children.Keys<Object> {
public class JmeSpatialChildren extends Children.Keys<Object> {
protected Spatial spatial;
protected boolean readOnly = true;
protected HashMap<Object, Node> map = new HashMap<Object, Node>();
private DataObject dataObject;
public SceneExplorerChildren() {
public JmeSpatialChildren() {
}
public SceneExplorerChildren(Spatial spatial) {
public JmeSpatialChildren(Spatial spatial) {
this.spatial = spatial;
}
@ -143,7 +143,7 @@ public class SceneExplorerChildren extends Children.Keys<Object> {
//TODO: go down in class hierarchy if class was not found, for now old checks are fallback
if (key instanceof Spatial) {
SceneExplorerChildren children = new SceneExplorerChildren((Spatial) key);
JmeSpatialChildren children = new JmeSpatialChildren((Spatial) key);
children.setReadOnly(readOnly);
children.setDataObject(dataObject);
if (key instanceof com.jme3.audio.AudioNode) {

@ -31,6 +31,7 @@
*/
package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.terrain.geomipmap.TerrainQuad;
import java.awt.Image;
import org.openide.loaders.DataObject;
@ -51,7 +52,7 @@ public class JmeTerrainQuad extends JmeNode {
public JmeTerrainQuad() {
}
public JmeTerrainQuad(TerrainQuad spatial, SceneExplorerChildren children) {
public JmeTerrainQuad(TerrainQuad spatial, JmeSpatialChildren children) {
super(spatial, children);
getLookupContents().add(spatial);
this.geom = spatial;
@ -96,7 +97,7 @@ public class JmeTerrainQuad extends JmeNode {
}
public org.openide.nodes.Node[] createNodes(Object key, DataObject key2, boolean cookie) {
SceneExplorerChildren children=new SceneExplorerChildren((com.jme3.scene.Spatial)key);
JmeSpatialChildren children=new JmeSpatialChildren((com.jme3.scene.Spatial)key);
children.setReadOnly(cookie);
children.setDataObject(key2);
return new org.openide.nodes.Node[]{new JmeTerrainQuad((TerrainQuad) key, children).setReadOnly(cookie)};

@ -33,18 +33,24 @@ package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.control.VehicleControl;
import com.jme3.bullet.objects.VehicleWheel;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;
import java.awt.Image;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import javax.swing.Action;
import org.openide.actions.DeleteAction;
import org.openide.loaders.DataObject;
import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.openide.nodes.Sheet;
import org.openide.util.Exceptions;
import org.openide.util.ImageUtilities;
@ -54,7 +60,7 @@ import org.openide.util.actions.SystemAction;
*
* @author normenhansen
*/
@org.openide.util.lookup.ServiceProvider(service=SceneExplorerNode.class)
@org.openide.util.lookup.ServiceProvider(service = SceneExplorerNode.class)
public class JmeVehicleControl extends AbstractSceneExplorerNode {
private static Image smallImage =
@ -100,7 +106,7 @@ public class JmeVehicleControl extends AbstractSceneExplorerNode {
@Override
public void destroy() throws IOException {
super.destroy();
final Spatial spat=getParentNode().getLookup().lookup(Spatial.class);
final Spatial spat = getParentNode().getLookup().lookup(Spatial.class);
try {
SceneApplication.getApplication().enqueue(new Callable<Void>() {
@ -109,7 +115,7 @@ public class JmeVehicleControl extends AbstractSceneExplorerNode {
return null;
}
}).get();
((AbstractSceneExplorerNode)getParentNode()).refresh(true);
((AbstractSceneExplorerNode) getParentNode()).refresh(true);
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
} catch (ExecutionException ex) {
@ -172,4 +178,57 @@ public class JmeVehicleControl extends AbstractSceneExplorerNode {
children.setDataObject(key2);
return new org.openide.nodes.Node[]{new JmeVehicleControl((VehicleControl) key, children).setReadOnly(cookie)};
}
public static class PhysicsVehicleChildren extends JmeSpatialChildren {
VehicleControl control;
public PhysicsVehicleChildren(VehicleControl control) {
this.control = control;
}
public void refreshChildren(boolean immediate) {
setKeys(createKeys());
refresh();
}
protected List<Object> createKeys() {
try {
return SceneApplication.getApplication().enqueue(new Callable<List<Object>>() {
public List<Object> call() throws Exception {
List<Object> keys = new LinkedList<Object>();
for (int i = 0; i < control.getNumWheels(); i++) {
keys.add(control.getWheel(i));
}
return keys;
}
}).get();
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
} catch (ExecutionException ex) {
Exceptions.printStackTrace(ex);
}
return null;
}
public void setReadOnly(boolean cookie) {
this.readOnly = cookie;
}
@Override
protected void addNotify() {
super.addNotify();
setKeys(createKeys());
}
@Override
protected Node[] createNodes(Object key) {
if (key instanceof VehicleWheel) {
VehicleWheel assetKey = (VehicleWheel) key;
return new Node[]{new JmeVehicleWheel(control, assetKey)};
}
return null;
}
}
}

@ -34,6 +34,8 @@ package com.jme3.gde.core.sceneexplorer.nodes;
import com.jme3.bullet.control.VehicleControl;
import com.jme3.bullet.objects.VehicleWheel;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode;
import com.jme3.gde.core.sceneexplorer.nodes.SceneExplorerNode;
import com.jme3.light.Light;
import com.jme3.math.Vector3f;
import java.awt.Image;

@ -41,21 +41,21 @@ import org.openide.loaders.DataObject;
public class NodeUtility {
public static JmeNode createNode(Node node) {
SceneExplorerChildren factory = new SceneExplorerChildren(node);
JmeSpatialChildren factory = new JmeSpatialChildren(node);
factory.setReadOnly(true);
JmeNode jmeNode = new JmeNode(node, factory);
return jmeNode;
}
public static JmeNode createNode(Node node, boolean readOnly) {
SceneExplorerChildren factory = new SceneExplorerChildren(node);
JmeSpatialChildren factory = new JmeSpatialChildren(node);
factory.setReadOnly(readOnly);
JmeNode jmeNode = new JmeNode(node, factory);
return jmeNode;
}
public static JmeNode createNode(Node node, DataObject dataObject) {
SceneExplorerChildren factory = new SceneExplorerChildren(node);
JmeSpatialChildren factory = new JmeSpatialChildren(node);
factory.setDataObject(dataObject);
factory.setReadOnly(true);
JmeNode jmeNode = new JmeNode(node, factory);
@ -63,7 +63,7 @@ public class NodeUtility {
}
public static JmeNode createNode(Node node, DataObject dataObject, boolean readOnly) {
SceneExplorerChildren factory = new SceneExplorerChildren(node);
JmeSpatialChildren factory = new JmeSpatialChildren(node);
factory.setDataObject(dataObject);
factory.setReadOnly(readOnly);
JmeNode jmeNode = new JmeNode(node, factory);

@ -1,99 +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.bullet.control.VehicleControl;
import com.jme3.bullet.objects.VehicleWheel;
import com.jme3.gde.core.scene.SceneApplication;
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 PhysicsVehicleChildren extends SceneExplorerChildren {
VehicleControl control;
public PhysicsVehicleChildren(VehicleControl control) {
this.control = control;
}
public void refreshChildren(boolean immediate) {
setKeys(createKeys());
refresh();
}
protected List<Object> createKeys() {
try {
return SceneApplication.getApplication().enqueue(new Callable<List<Object>>() {
public List<Object> call() throws Exception {
List<Object> keys = new LinkedList<Object>();
for (int i = 0; i < control.getNumWheels(); i++) {
keys.add(control.getWheel(i));
}
return keys;
}
}).get();
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
} catch (ExecutionException ex) {
Exceptions.printStackTrace(ex);
}
return null;
}
public void setReadOnly(boolean cookie) {
this.readOnly = cookie;
}
@Override
protected void addNotify() {
super.addNotify();
setKeys(createKeys());
}
@Override
protected Node[] createNodes(Object key) {
if (key instanceof VehicleWheel) {
VehicleWheel assetKey = (VehicleWheel) key;
return new Node[]{new JmeVehicleWheel(control, assetKey)};
}
return null;
}
}

@ -45,13 +45,13 @@ import org.openide.util.actions.Presenter;
*
* @author normenhansen
*/
public class AddControlAction extends AbstractAction implements Presenter.Popup {
public class NewControlPopup extends AbstractAction implements Presenter.Popup {
protected JmeSpatial jmeSpatial;
protected Node node;
protected DataObject dataObject;
public AddControlAction(JmeSpatial node) {
public NewControlPopup(JmeSpatial node) {
this.jmeSpatial = node;
this.node = node.getLookup().lookup(Node.class);
this.dataObject = node.getLookup().lookup(DataObject.class);

@ -57,13 +57,13 @@ import org.openide.util.actions.Presenter;
*
* @author normenhansen
*/
public class AddLightAction extends AbstractAction implements Presenter.Popup {
public class NewLightPopup extends AbstractAction implements Presenter.Popup {
protected JmeSpatial jmeNode;
protected Spatial node;
protected DataObject dataObject;
public AddLightAction(JmeSpatial node) {
public NewLightPopup(JmeSpatial node) {
this.jmeNode = node;
this.node = node.getLookup().lookup(Spatial.class);
this.dataObject = node.getLookup().lookup(DataObject.class);

@ -58,13 +58,13 @@ import org.openide.util.actions.Presenter;
*
* @author normenhansen
*/
public class AddSpatialAction extends AbstractAction implements Presenter.Popup {
public class NewSpatialPopup extends AbstractAction implements Presenter.Popup {
protected JmeNode jmeNode;
protected Node node;
protected DataObject dataObject;
public AddSpatialAction(JmeNode node) {
public NewSpatialPopup(JmeNode node) {
this.jmeNode = node;
this.node = node.getLookup().lookup(Node.class);
this.dataObject = node.getLookup().lookup(DataObject.class);

@ -45,12 +45,12 @@ import org.openide.util.actions.Presenter;
*
* @author normenhansen
*/
public class UseToolAction extends AbstractAction implements Presenter.Popup {
public class ToolPopup extends AbstractAction implements Presenter.Popup {
protected AbstractSceneExplorerNode exNode;
protected DataObject dataObject;
public UseToolAction(AbstractSceneExplorerNode node) {
public ToolPopup(AbstractSceneExplorerNode node) {
this.exNode = node;
this.dataObject = node.getLookup().lookup(DataObject.class);
}

@ -38,8 +38,8 @@ import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.scene.SceneRequest;
import com.jme3.gde.core.sceneexplorer.SceneExplorerTopComponent;
import com.jme3.gde.core.sceneexplorer.nodes.AbstractSceneExplorerNode;
import com.jme3.gde.core.sceneexplorer.nodes.properties.SceneExplorerProperty;
import com.jme3.gde.core.sceneexplorer.nodes.properties.SceneExplorerPropertyEditor;
import com.jme3.gde.core.properties.SceneExplorerProperty;
import com.jme3.gde.core.properties.SceneExplorerPropertyEditor;
import com.jme3.material.Material;
import java.awt.Component;
import java.awt.Graphics;

@ -11,7 +11,7 @@
package com.jme3.gde.materials.multiview.widgets;
import com.jme3.gde.core.assets.ProjectAssetManager;
import com.jme3.gde.core.sceneexplorer.nodes.properties.TexturePropertyEditor;
import com.jme3.gde.core.properties.TexturePropertyEditor;
import com.jme3.gde.materials.MaterialProperty;
import java.awt.Component;

@ -41,7 +41,7 @@ import com.jme3.gde.core.sceneexplorer.nodes.JmeNode;
import com.jme3.gde.core.sceneexplorer.nodes.JmeSpatial;
import com.jme3.gde.core.sceneexplorer.nodes.JmeTerrainQuad;
import com.jme3.gde.core.sceneexplorer.nodes.NodeUtility;
import com.jme3.gde.core.sceneexplorer.nodes.properties.TexturePropertyEditor;
import com.jme3.gde.core.properties.TexturePropertyEditor;
import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit;
import com.jme3.gde.core.undoredo.SceneUndoRedoManager;
import com.jme3.gde.core.util.DataObjectSaveNode;

@ -31,7 +31,7 @@
*/
package com.jme3.gde.terraineditor.sky;
import com.jme3.gde.core.sceneexplorer.nodes.properties.TexturePropertyEditor;
import com.jme3.gde.core.properties.TexturePropertyEditor;
import com.jme3.texture.Texture;
import java.awt.Component;
import javax.swing.Icon;

@ -32,7 +32,7 @@
package com.jme3.gde.terraineditor.tools;
import com.jme3.gde.core.sceneexplorer.nodes.actions.AbstractStatefulGLToolAction;
import com.jme3.gde.core.scene.actions.AbstractStatefulGLToolAction;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.terrain.Terrain;

Loading…
Cancel
Save