From a6b24c91ea0bf93588cba0f308e6c93527a33aa5 Mon Sep 17 00:00:00 2001 From: Normen Hansen Date: Tue, 3 Jun 2014 14:47:57 +0200 Subject: [PATCH 1/7] SDK: - fix recognition of boolean properties is/set pattern --- sdk/jme3-core/src/com/jme3/gde/core/util/PropertyUtils.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sdk/jme3-core/src/com/jme3/gde/core/util/PropertyUtils.java b/sdk/jme3-core/src/com/jme3/gde/core/util/PropertyUtils.java index 99df5767d..2683be589 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/util/PropertyUtils.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/util/PropertyUtils.java @@ -64,6 +64,11 @@ public class PropertyUtils { if (name.length() > 0) { name = Character.toLowerCase(name.charAt(0)) + name.substring(1); } + } else if (name.startsWith("is")) { + name = name.substring(2); + if (name.length() > 0) { + name = Character.toLowerCase(name.charAt(0)) + name.substring(1); + } } else { return null; } From 0e5e58a1f87dd6f2feea6cc1366c681129b55358 Mon Sep 17 00:00:00 2001 From: David Bernard Date: Tue, 3 Jun 2014 17:30:33 +0200 Subject: [PATCH 2/7] .gitignore : simplify + ignore private --- .gitignore | 64 +++++------------------------------------------------- 1 file changed, 5 insertions(+), 59 deletions(-) diff --git a/.gitignore b/.gitignore index 782b60710..e567b5de3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,74 +1,20 @@ -/.gradle/ -/.nb-gradle/private/ -/jme3-core/build/ -/jme3-plugins/build/ -/jme3-desktop/build/ -/jme3-android-native/build/ -/jme3-android/build/ -/jme3-blender/build/ -/jme3-effects/build/ -/jme3-bullet/build/ -/jme3-terrain/build/ -/jme3-bullet-native/build/ -/jme3-jogg/build/ -/jme3-jbullet/build/ -/jme3-lwjgl/build/ -/jme3-networking/build/ -/jme3-niftygui/build/ -/jme3-testdata/build/ -/jme3-examples/build/ -/jme3-jogl/build/ -/dist/ +.gradle/ +build/ +gradle-app.setting +dist/ +private/ /jme3-bullet-native/bullet.zip /jme3-bullet-native/bullet-2.82-r2704/ -/sdk/build/ /sdk/jme3-core-baselibs/release/ /sdk/jme3-core-libraries/release/ /sdk/jme3-project-baselibs/release/ /sdk/jme3-project-libraries/release/ -/sdk/jme3-codepalette/build/ -/sdk/jme3-core-libraries/build/ -/sdk/jme3-code-check/build/ -/sdk/jme3-core-baselibs/build/ -/sdk/jme3-core-baselibs/nbproject/private/ -/sdk/jme3-documentation/build/ -/sdk/jme3-core-updatecenters/build/ -/sdk/jme3-project-testdata/build/ -/sdk/jme3-project-libraries/build/ -/sdk/jme3-project-baselibs/build/ -/sdk/jme3-templates/build/ -/sdk/jme3-texture-editor/build/ -/sdk/jme3-tests-template/build/ -/sdk/jme3-upgrader/build/ -/sdk/jme3-core/build/ -/sdk/jme3-obfuscate/build/ -/sdk/jme3-gui/build/ -/sdk/jme3-cinematics/build/ -/sdk/jme3-terrain-editor/build/ -/sdk/jme3-lwjgl-applet/build/ -/sdk/jme3-blender/build/ -/sdk/jme3-navmesh-gen/build/ -/sdk/jme3-angelfont/build/ -/sdk/jme3-materialeditor/build/ -/sdk/jme3-android/build/ -/sdk/jme3-desktop-executables/build/ -/sdk/jme3-ogrexml/build/ -/sdk/jme3-ogretools/build/ -/sdk/jme3-scenecomposer/build/ -/sdk/jme3-assetpack-support/build/ -/sdk/jme3-model-importer/build/ -/sdk/jme3-wavefront/build/ -/sdk/jme3-vehicle-creator/build/ -/sdk/jme3-welcome-screen/build/ -/sdk/jme3-glsl-support/build/ /netbeans/ /sdk/jme3-tests-template/src/com/jme3/gde/templates/tests/JmeTestsProject.zip /sdk/jme3-tests-template/src/com/jme3/gde/templates/tests/JME3TestsAndroidProject.zip /sdk/jme3-project-testdata/release/ /sdk/JME3TestsTemplateAndroid/src/jme3test/ /sdk/JME3TestsTemplate/src/jme3test/ -/jme3-ios/build/ /jme3-android-native/openal-soft/ /jme3-android-native/OpenALSoft.zip /jme3-android-native/stb_image/ -/jme3-bullet-native-android/build/ \ No newline at end of file From 36314932843cb19227b83df1c5ebb071414e31fb Mon Sep 17 00:00:00 2001 From: David Bernard Date: Tue, 3 Jun 2014 18:14:40 +0200 Subject: [PATCH 3/7] Revert ".gitignore : simplify + ignore private" This reverts commit 0e5e58a1f87dd6f2feea6cc1366c681129b55358. --- .gitignore | 64 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index e567b5de3..782b60710 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,74 @@ -.gradle/ -build/ -gradle-app.setting -dist/ -private/ +/.gradle/ +/.nb-gradle/private/ +/jme3-core/build/ +/jme3-plugins/build/ +/jme3-desktop/build/ +/jme3-android-native/build/ +/jme3-android/build/ +/jme3-blender/build/ +/jme3-effects/build/ +/jme3-bullet/build/ +/jme3-terrain/build/ +/jme3-bullet-native/build/ +/jme3-jogg/build/ +/jme3-jbullet/build/ +/jme3-lwjgl/build/ +/jme3-networking/build/ +/jme3-niftygui/build/ +/jme3-testdata/build/ +/jme3-examples/build/ +/jme3-jogl/build/ +/dist/ /jme3-bullet-native/bullet.zip /jme3-bullet-native/bullet-2.82-r2704/ +/sdk/build/ /sdk/jme3-core-baselibs/release/ /sdk/jme3-core-libraries/release/ /sdk/jme3-project-baselibs/release/ /sdk/jme3-project-libraries/release/ +/sdk/jme3-codepalette/build/ +/sdk/jme3-core-libraries/build/ +/sdk/jme3-code-check/build/ +/sdk/jme3-core-baselibs/build/ +/sdk/jme3-core-baselibs/nbproject/private/ +/sdk/jme3-documentation/build/ +/sdk/jme3-core-updatecenters/build/ +/sdk/jme3-project-testdata/build/ +/sdk/jme3-project-libraries/build/ +/sdk/jme3-project-baselibs/build/ +/sdk/jme3-templates/build/ +/sdk/jme3-texture-editor/build/ +/sdk/jme3-tests-template/build/ +/sdk/jme3-upgrader/build/ +/sdk/jme3-core/build/ +/sdk/jme3-obfuscate/build/ +/sdk/jme3-gui/build/ +/sdk/jme3-cinematics/build/ +/sdk/jme3-terrain-editor/build/ +/sdk/jme3-lwjgl-applet/build/ +/sdk/jme3-blender/build/ +/sdk/jme3-navmesh-gen/build/ +/sdk/jme3-angelfont/build/ +/sdk/jme3-materialeditor/build/ +/sdk/jme3-android/build/ +/sdk/jme3-desktop-executables/build/ +/sdk/jme3-ogrexml/build/ +/sdk/jme3-ogretools/build/ +/sdk/jme3-scenecomposer/build/ +/sdk/jme3-assetpack-support/build/ +/sdk/jme3-model-importer/build/ +/sdk/jme3-wavefront/build/ +/sdk/jme3-vehicle-creator/build/ +/sdk/jme3-welcome-screen/build/ +/sdk/jme3-glsl-support/build/ /netbeans/ /sdk/jme3-tests-template/src/com/jme3/gde/templates/tests/JmeTestsProject.zip /sdk/jme3-tests-template/src/com/jme3/gde/templates/tests/JME3TestsAndroidProject.zip /sdk/jme3-project-testdata/release/ /sdk/JME3TestsTemplateAndroid/src/jme3test/ /sdk/JME3TestsTemplate/src/jme3test/ +/jme3-ios/build/ /jme3-android-native/openal-soft/ /jme3-android-native/OpenALSoft.zip /jme3-android-native/stb_image/ +/jme3-bullet-native-android/build/ \ No newline at end of file From aa7718f33a2649d61891cfb99a050277ce0d35af Mon Sep 17 00:00:00 2001 From: David Bernard Date: Tue, 3 Jun 2014 18:50:35 +0200 Subject: [PATCH 4/7] gitignore: add explicit list of private files to ignore --- .gitignore | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 782b60710..527b984c4 100644 --- a/.gitignore +++ b/.gitignore @@ -71,4 +71,10 @@ /jme3-android-native/openal-soft/ /jme3-android-native/OpenALSoft.zip /jme3-android-native/stb_image/ -/jme3-bullet-native-android/build/ \ No newline at end of file +/jme3-bullet-native-android/build/ +/sdk/nbproject/private/private.xml +/sdk/nbproject/private/platform-private.properties +/sdk/jme3-scenecomposer/nbproject/private/private.xml +/sdk/jme3-core/nbproject/private/private.xml +/.nb-gradle/profiles/private/aux-config +/build/tmp/mergedJavadoc/javadoc.options From 76088011a7cc30608ff170d487d8aea4422340e6 Mon Sep 17 00:00:00 2001 From: David Bernard Date: Tue, 3 Jun 2014 18:57:56 +0200 Subject: [PATCH 5/7] gitignore: ignore directory instead of files --- .gitignore | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 527b984c4..4ff78eb50 100644 --- a/.gitignore +++ b/.gitignore @@ -72,9 +72,9 @@ /jme3-android-native/OpenALSoft.zip /jme3-android-native/stb_image/ /jme3-bullet-native-android/build/ -/sdk/nbproject/private/private.xml -/sdk/nbproject/private/platform-private.properties -/sdk/jme3-scenecomposer/nbproject/private/private.xml -/sdk/jme3-core/nbproject/private/private.xml -/.nb-gradle/profiles/private/aux-config -/build/tmp/mergedJavadoc/javadoc.options +/sdk/nbproject/private/ +/sdk/nbproject/private/ +/sdk/jme3-scenecomposer/nbproject/private/ +/sdk/jme3-core/nbproject/private/ +/.nb-gradle/profiles/private/ +/build/tmp/mergedJavadoc/ From 95bbbefb6fcd9f69fcefa4e3ac5f4752a298e70b Mon Sep 17 00:00:00 2001 From: David Bernard Date: Tue, 3 Jun 2014 20:45:01 +0200 Subject: [PATCH 6/7] SDK: fix JmeGenericControl to display initial value of Property and inherited Property (grouped by class) --- .../nodes/JmeGenericControl.java | 101 ++++++------------ 1 file changed, 33 insertions(+), 68 deletions(-) diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java index 6a125ef43..2fb19443d 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGenericControl.java @@ -32,50 +32,37 @@ package com.jme3.gde.core.sceneexplorer.nodes; import com.jme3.gde.core.icons.IconList; -import com.jme3.gde.core.properties.SceneExplorerProperty; import com.jme3.gde.core.properties.ScenePropertyChangeListener; import com.jme3.gde.core.scene.SceneApplication; -import com.jme3.gde.core.util.DynamicLookup; -import com.jme3.gde.core.util.PropertyUtils; import com.jme3.scene.Spatial; import com.jme3.scene.control.Control; import java.awt.Image; -import java.beans.PropertyDescriptor; import java.io.IOException; -import java.lang.reflect.Field; 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.Sheet; import org.openide.util.Exceptions; import org.openide.util.actions.SystemAction; -import org.openide.util.lookup.InstanceContent; -import org.openide.util.lookup.ProxyLookup; /** * * @author normenhansen */ -public class JmeGenericControl extends AbstractNode implements ScenePropertyChangeListener { +public class JmeGenericControl extends AbstractSceneExplorerNode { - private Control control; - private static Image smallImage = IconList.wheel.getImage(); - private DataObject dobject; - private InstanceContent lookupContents; + private final Control control; + private static final Image smallImage = IconList.wheel.getImage(); public JmeGenericControl(Control control, DataObject dataObject) { //TODO: lookup content! (control etc) - super(Children.LEAF, new ProxyLookup(dataObject.getLookup(), new DynamicLookup(new InstanceContent()))); - lookupContents = getLookup().lookup(DynamicLookup.class).getInstanceContent(); + super(dataObject); this.control = control; - this.dobject = dataObject; - lookupContents.add(this); - lookupContents.add(control); - setName(control.getClass().getName()); + addToLookup(this); + addToLookup(control); + setName(control.getClass().getSimpleName()); } @Override @@ -92,18 +79,35 @@ public class JmeGenericControl extends AbstractNode implements ScenePropertyChan protected Sheet createSheet() { //TODO: multithreading.. Sheet sheet = Sheet.createDefault(); - Sheet.Set set = Sheet.createPropertiesSet(); - set.setDisplayName("Control"); - set.setName(Control.class.getName()); + if (control == null) { return sheet; } + putSheetSets(sheet, control.getClass(), false); + return sheet; - createFields(control.getClass(), set, control); + } + /** + * Append one Sheet.Set of fields per class, + * recursively to the root class of the hierarchie. + * + * @param sheet Sheet where to put. + * @param c current class to start add. + * @param hidden sheet for c is hidden (parent are hidden = true) + */ + protected void putSheetSets(Sheet sheet, Class c, boolean hidden) { + Sheet.Set set = Sheet.createPropertiesSet(); + set.setDisplayName(String.format("%s - %s", c.getSimpleName(), c.getPackage().getName())); + set.setName(c.getName()); + set.setHidden(hidden); + createFields(c, set, control); + + Class parent = c.getSuperclass(); + if (parent != null && !parent.equals(Object.class)) { + putSheetSets(sheet, parent, true); + } sheet.put(set); - return sheet; - } @Override @@ -139,47 +143,8 @@ public class JmeGenericControl extends AbstractNode implements ScenePropertyChan Exceptions.printStackTrace(ex); } } - - protected Property makeProperty(Object obj, Class returntype, String method, String name) { - Property prop = null; - try { - prop = new SceneExplorerProperty(control.getClass().cast(obj), returntype, method, null); - prop.setName(name); - } catch (NoSuchMethodException ex) { - Exceptions.printStackTrace(ex); - } - return prop; - } - - protected Property makeProperty(Object obj, Class returntype, String method, String setter, String name) { - Property prop = null; - try { -// if (readOnly) { -// prop = new SceneExplorerProperty(control.getClass().cast(obj), returntype, method, null); -// } else { - prop = new SceneExplorerProperty(control.getClass().cast(obj), returntype, method, setter, this); -// } - prop.setName(name); - - } catch (NoSuchMethodException ex) { - Exceptions.printStackTrace(ex); - } - 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(String type, String name, Object oldValue, Object newValue) { - if (type.equals("PROP_USER_CHANGE")) { - dobject.setModified(true); - } -// throw new UnsupportedOperationException("Not supported yet."); + + public Class getExplorerObjectClass() { + return control.getClass(); } } From 2f248d15df7de96bff0cb0dd80e823b53b027304 Mon Sep 17 00:00:00 2001 From: David Bernard Date: Tue, 3 Jun 2014 22:45:48 +0200 Subject: [PATCH 7/7] SDK: fix NPE in JmeGeometry.propertyChange --- .../com/jme3/gde/core/sceneexplorer/nodes/JmeGeometry.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGeometry.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGeometry.java index e55a84e5a..e2388e622 100644 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGeometry.java +++ b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeGeometry.java @@ -155,7 +155,9 @@ public class JmeGeometry extends JmeSpatial implements MaterialChangeListener { public void run() { try { - SceneExplorerTopComponent.findInstance().swapMaterialChangeListener(JmeGeometry.this, ((Material) before).getAssetName(), ((Material) after).getAssetName()); + String beforeName = (before == null)? null : ((Material) before).getAssetName(); + String afterName = (after == null)? null : ((Material) after).getAssetName(); + SceneExplorerTopComponent.findInstance().swapMaterialChangeListener(JmeGeometry.this, beforeName, afterName); } catch (Exception e) { Exceptions.printStackTrace(e); }