From b446c5c56d3ce710ef0f28eba212913c85e031c3 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Wed, 29 Jun 2011 00:42:59 +0000 Subject: [PATCH] SDK: - cleanup some packages, move some classes - better names for some classes git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7771 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../nodes/properties/AnimationProperty.java | 92 ------ .../properties/AnimationPropertyEditor.java | 131 --------- .../nodes/properties/AudioDataProperty.java | 102 ------- .../properties/AudioDataPropertyEditor.java | 123 -------- .../nodes/properties/Bundle.properties | 9 - .../nodes/properties/ColorRGBADialog.form | 97 ------- .../nodes/properties/ColorRGBADialog.java | 155 ---------- .../properties/ColorRGBAPropertyEditor.java | 125 --------- .../EmitterShapePropertyEditor.java | 186 ------------ .../properties/Matrix3fPropertyEditor.java | 124 -------- .../properties/QuaternionPropertyEditor.java | 125 --------- .../properties/SceneExplorerProperty.java | 209 -------------- .../SceneExplorerPropertyEditor.java | 41 --- .../ScenePropertyChangeListener.java | 41 --- .../nodes/properties/TextureBrowser.form | 128 --------- .../nodes/properties/TextureBrowser.java | 264 ------------------ .../properties/TexturePropertyEditor.java | 139 --------- .../nodes/properties/UserDataProperty.java | 144 ---------- .../properties/Vector2fPropertyEditor.java | 124 -------- .../properties/Vector3fPropertyEditor.java | 124 -------- 20 files changed, 2483 deletions(-) delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AnimationProperty.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AnimationPropertyEditor.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AudioDataProperty.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AudioDataPropertyEditor.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Bundle.properties delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ColorRGBADialog.form delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ColorRGBADialog.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ColorRGBAPropertyEditor.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/EmitterShapePropertyEditor.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Matrix3fPropertyEditor.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/QuaternionPropertyEditor.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/SceneExplorerProperty.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/SceneExplorerPropertyEditor.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ScenePropertyChangeListener.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/TextureBrowser.form delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/TextureBrowser.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/TexturePropertyEditor.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/UserDataProperty.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Vector2fPropertyEditor.java delete mode 100644 sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Vector3fPropertyEditor.java diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AnimationProperty.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AnimationProperty.java deleted file mode 100644 index 3bd324a9f..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AnimationProperty.java +++ /dev/null @@ -1,92 +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.properties; - -import com.jme3.animation.AnimControl; -import com.jme3.gde.core.scene.SceneApplication; -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 AnimationProperty extends PropertySupport.ReadWrite { - - private AnimControl control; - private String anim = "null"; - - public AnimationProperty(AnimControl node) { - super("Animation Control", String.class, "Animation Control", ""); - this.control = node; - } - - @Override - public String getValue() throws IllegalAccessException, InvocationTargetException { - return anim; - } - - @Override - public void setValue(final String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { - if (control == null) { - return; - } - try { - SceneApplication.getApplication().enqueue(new Callable() { - - public Void call() throws Exception { - if ("null".equals(val)) { - control.clearChannels(); - return null; - } - anim = val; - control.clearChannels(); - control.createChannel().setAnim(val); - return null; - } - }).get(); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (ExecutionException ex) { - Exceptions.printStackTrace(ex); - } - } - - @Override - public PropertyEditor getPropertyEditor() { - return new AnimationPropertyEditor(control); - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AnimationPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AnimationPropertyEditor.java deleted file mode 100644 index 1b35537d1..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AnimationPropertyEditor.java +++ /dev/null @@ -1,131 +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.properties; - -import com.jme3.animation.AnimControl; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Rectangle; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyEditor; -import java.util.Collection; -import java.util.Iterator; -import java.util.LinkedList; - -/** - * - * @author normenhansen - */ -public class AnimationPropertyEditor implements PropertyEditor { - - private LinkedList listeners = new LinkedList(); - private String animName; - private AnimControl control; - - public AnimationPropertyEditor(AnimControl control) { - this.control = control; - } - - public void setValue(Object value) { - if (value instanceof String) { - animName = (String) value; - } - } - - public Object getValue() { - return animName; - } - - public boolean isPaintable() { - return false; - } - - public void paintValue(Graphics gfx, Rectangle box) { - throw new UnsupportedOperationException("Not supported yet."); - } - - public String getJavaInitializationString() { - return null; - } - - public String getAsText() { - return animName.toString(); - } - - public void setAsText(String text) throws IllegalArgumentException { - String old = animName; - if ("".equals(text)) { - animName = "null"; - } - animName = text; - notifyListeners(old, animName); - } - - public String[] getTags() { - if(control==null)return new String[]{"none"}; - Collection names = control.getAnimationNames(); - String[] strings = new String[names.size() + 1]; - strings[0] = "null"; - int i = 1; - for (Iterator it = names.iterator(); it.hasNext();) { - strings[i] = it.next(); - i++; - } - return strings; - } - - public Component getCustomEditor() { -// return new AnimationPanel(control); - throw new UnsupportedOperationException("Not supported yet."); - } - - public boolean supportsCustomEditor() { - return false; - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - listeners.add(listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - listeners.remove(listener); - } - - private void notifyListeners(String before, String after) { - for (Iterator it = listeners.iterator(); it.hasNext();) { - PropertyChangeListener propertyChangeListener = it.next(); - //TODO: check what the "programmatic name" is supposed to be here.. for now its Quaternion - propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); - } - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AudioDataProperty.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AudioDataProperty.java deleted file mode 100644 index a7ac5ea19..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AudioDataProperty.java +++ /dev/null @@ -1,102 +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.properties; - -import com.jme3.audio.AudioData; -import com.jme3.audio.AudioKey; -import com.jme3.audio.AudioNode; -import com.jme3.gde.core.scene.SceneApplication; -import com.jme3.gde.core.scene.SceneRequest; -import java.beans.PropertyEditor; -import java.lang.reflect.InvocationTargetException; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import org.openide.nodes.PropertySupport; -import org.openide.util.Exceptions; - -/** - * - * @author normenhansen - */ -public class AudioDataProperty extends PropertySupport.ReadWrite { - - private AudioNode node; - - public AudioDataProperty(AudioNode node) { - super("Audio Data", String.class, "Audio Data", ""); - this.node = node; - } - - @Override - public String getValue() throws IllegalAccessException, InvocationTargetException { - if (node.getAudioData() != null) { - return node.getAudioData().toString(); - } else { - return "null"; - } - } - - @Override - public void setValue(final String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { - if ("null".equals(val)) { - return; - } - if (node.getAudioData() == null) { -// val = val.replace('[', ' ').trim(); -// val = val.replace(']', ' ').trim(); -// final String[] strings = val.split(","); - try { - SceneApplication.getApplication().enqueue(new Callable() { - - public Void call() throws Exception { - SceneRequest request = SceneApplication.getApplication().getCurrentSceneRequest(); - AudioKey key = new AudioKey(val, false); - AudioData localMaterial = request.getManager().loadAudio(key); - if (localMaterial != null) { - node.setAudioData(localMaterial, key); - } - return null; - } - }).get(); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (ExecutionException ex) { - Exceptions.printStackTrace(ex); - } - } - } - - @Override - public PropertyEditor getPropertyEditor() { - return new AudioDataPropertyEditor(); - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AudioDataPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AudioDataPropertyEditor.java deleted file mode 100644 index b671a2f01..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/AudioDataPropertyEditor.java +++ /dev/null @@ -1,123 +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.properties; - -import com.jme3.audio.AudioData; -import com.jme3.gde.core.scene.SceneApplication; -import com.jme3.gde.core.scene.SceneRequest; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Rectangle; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyEditor; -import java.util.Iterator; -import java.util.LinkedList; - -/** - * - * @author normenhansen - */ -public class AudioDataPropertyEditor implements PropertyEditor { - - private LinkedList listeners = new LinkedList(); - private String material; - - public void setValue(Object value) { - if (value instanceof String) { - material = (String) value; - } - } - - public Object getValue() { - return material; - } - - public boolean isPaintable() { - return false; - } - - public void paintValue(Graphics gfx, Rectangle box) { - throw new UnsupportedOperationException("Not supported yet."); - } - - public String getJavaInitializationString() { - return null; - } - - public String getAsText() { - return material.toString(); - } - - public void setAsText(String text) throws IllegalArgumentException { - String old=material; - if ("".equals(text)) { - material = "null"; - } - material = text; - notifyListeners(old, material); - } - - public String[] getTags() { - if ("null".equals(material)) { - SceneRequest request = SceneApplication.getApplication().getCurrentSceneRequest(); - if(request==null) return new String[]{}; - String[] mats = request.getManager().getSounds(); - return mats; - } - return new String[]{"can set only once"}; - } - - public Component getCustomEditor() { - throw new UnsupportedOperationException("Not supported yet."); - } - - public boolean supportsCustomEditor() { - return false; - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - listeners.add(listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - listeners.remove(listener); - } - - private void notifyListeners(String before, String after) { - for (Iterator it = listeners.iterator(); it.hasNext();) { - PropertyChangeListener propertyChangeListener = it.next(); - //TODO: check what the "programmatic name" is supposed to be here.. for now its Quaternion - propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); - } - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Bundle.properties b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Bundle.properties deleted file mode 100644 index bd1283d27..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Bundle.properties +++ /dev/null @@ -1,9 +0,0 @@ -ColorRGBADialog.jButton1.text=OK -ColorRGBADialog.jButton2.text=Cancel -ColorRGBADialog.alphaLabel.text=Alpha: -AnimationPanel.pauseButton.text= -AnimationPanel.playButton.text= -TextureBrowser.cancelButton.text=Cancel -TextureBrowser.okButton.text=Ok -TextureBrowser.imagePreviewLabel.text= -TextureBrowser.title=Texture Browser \ No newline at end of file diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ColorRGBADialog.form b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ColorRGBADialog.form deleted file mode 100644 index be8ab19ff..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ColorRGBADialog.form +++ /dev/null @@ -1,97 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ColorRGBADialog.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ColorRGBADialog.java deleted file mode 100644 index eee73e2f1..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ColorRGBADialog.java +++ /dev/null @@ -1,155 +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. - */ - -/* - * ColorRGBADialog.java - * - * Created on 06.04.2010, 20:58:59 - */ -package com.jme3.gde.core.sceneexplorer.nodes.properties; - -import com.jme3.math.ColorRGBA; -import java.awt.Color; - -/** - * - * @author normenhansen - */ -public class ColorRGBADialog extends javax.swing.JDialog { - - private ColorRGBAPropertyEditor editor; - - /** Creates new form ColorRGBADialog */ - public ColorRGBADialog(java.awt.Frame parent, boolean modal, ColorRGBAPropertyEditor editor) { - super(parent, modal); - this.editor = editor; - initComponents(); - alphaSlider.setValue(Math.round(((ColorRGBA)editor.getValue()).getAlpha()*100)); - } - - public ColorRGBA setColor() { - Color cColor = jColorChooser1.getColor(); - ColorRGBA color = new ColorRGBA(); - float[] floats = new float[4]; - cColor.getComponents(floats); - color.set(floats[0], floats[1], floats[2], ((float)alphaSlider.getValue())/100.0f); - ColorRGBA color2 = new ColorRGBA((ColorRGBA) editor.getValue()); - editor.setValue(color); - editor.notifyListeners(color2, color); - return color; - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - jColorChooser1 = new javax.swing.JColorChooser(); - jButton1 = new javax.swing.JButton(); - jButton2 = new javax.swing.JButton(); - jToolBar1 = new javax.swing.JToolBar(); - alphaLabel = new javax.swing.JLabel(); - alphaSlider = new javax.swing.JSlider(); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - - jButton1.setText(org.openide.util.NbBundle.getMessage(ColorRGBADialog.class, "ColorRGBADialog.jButton1.text")); // NOI18N - jButton1.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jButton1ActionPerformed(evt); - } - }); - - jButton2.setText(org.openide.util.NbBundle.getMessage(ColorRGBADialog.class, "ColorRGBADialog.jButton2.text")); // NOI18N - jButton2.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jButton2ActionPerformed(evt); - } - }); - - jToolBar1.setFloatable(false); - jToolBar1.setRollover(true); - - alphaLabel.setText(org.openide.util.NbBundle.getMessage(ColorRGBADialog.class, "ColorRGBADialog.alphaLabel.text")); // NOI18N - jToolBar1.add(alphaLabel); - - alphaSlider.setValue(100); - jToolBar1.add(alphaSlider); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 320, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jButton2) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jButton1)) - .addComponent(jColorChooser1, javax.swing.GroupLayout.DEFAULT_SIZE, 496, Short.MAX_VALUE) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(jColorChooser1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jButton1) - .addComponent(jButton2)) - .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))) - ); - - pack(); - }// //GEN-END:initComponents - - private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed - setColor(); - dispose(); - }//GEN-LAST:event_jButton1ActionPerformed - - private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed - dispose(); - }//GEN-LAST:event_jButton2ActionPerformed - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JLabel alphaLabel; - private javax.swing.JSlider alphaSlider; - private javax.swing.JButton jButton1; - private javax.swing.JButton jButton2; - private javax.swing.JColorChooser jColorChooser1; - private javax.swing.JToolBar jToolBar1; - // End of variables declaration//GEN-END:variables -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ColorRGBAPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ColorRGBAPropertyEditor.java deleted file mode 100644 index e5bba674c..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ColorRGBAPropertyEditor.java +++ /dev/null @@ -1,125 +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.properties; - -import com.jme3.math.ColorRGBA; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Rectangle; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyEditor; -import java.util.Iterator; -import java.util.LinkedList; - -/** - * - * @author normenhansen - */ -public class ColorRGBAPropertyEditor implements PropertyEditor { - - private LinkedList listeners = new LinkedList(); - private ColorRGBA color = new ColorRGBA(); - - public void setValue(Object value) { - if (value instanceof ColorRGBA) { - color.set((ColorRGBA) value); - } - } - - public Object getValue() { - return color; - } - - public boolean isPaintable() { - return false; - } - - public void paintValue(Graphics gfx, Rectangle box) { - throw new UnsupportedOperationException("Not supported yet."); - } - - public String getJavaInitializationString() { - return null; - } - - public String getAsText() { - return "[" + color.r + ", " + color.g + ", " + color.b + ", " + color.a + "]"; - } - - public void setAsText(String text) throws IllegalArgumentException { - text = text.replace('[', ' '); - text = text.replace(']', ' '); - String[] values = text.split(","); - ColorRGBA old=color; - if (values.length != 4) { - throw (new IllegalArgumentException("String not correct")); - } - float[] floats = new float[4]; - for (int i = 0; i < values.length; i++) { - String string = values[i]; - floats[i] = Float.parseFloat(string); - } - color.set(floats[0], floats[1], floats[2], floats[3]); - notifyListeners(old, color); - } - - public String[] getTags() { - return null; - } - - public Component getCustomEditor() { - ColorRGBADialog dialog = new ColorRGBADialog(null, true, this); - dialog.setLocationRelativeTo(null); - return dialog; - } - - public boolean supportsCustomEditor() { - return true; - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - listeners.add(listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - listeners.remove(listener); - } - - public void notifyListeners(ColorRGBA before, ColorRGBA after) { - for (Iterator it = listeners.iterator(); it.hasNext();) { - PropertyChangeListener propertyChangeListener = it.next(); - //TODO: check what the "programmatic name" is supposed to be here.. for now its ColorRGBA - propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); - } - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/EmitterShapePropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/EmitterShapePropertyEditor.java deleted file mode 100644 index e8eabdea6..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/EmitterShapePropertyEditor.java +++ /dev/null @@ -1,186 +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.properties; - -import com.jme3.effect.shapes.EmitterBoxShape; -import com.jme3.effect.shapes.EmitterPointShape; -import com.jme3.effect.shapes.EmitterShape; -import com.jme3.effect.shapes.EmitterSphereShape; -import com.jme3.math.Vector3f; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Rectangle; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyEditor; -import java.util.Iterator; -import java.util.LinkedList; -import org.openide.awt.StatusDisplayer; - -/** - * - * @author normenhansen - */ -public class EmitterShapePropertyEditor implements PropertyEditor { - - private LinkedList listeners = new LinkedList(); - private EmitterShape emitter;// = new EmitterPointShape(Vector3f.ZERO); - - public void setValue(Object value) { - if (value instanceof EmitterShape) { - emitter = (EmitterShape) value; - } - } - - public Object getValue() { - return emitter; - } - - public boolean isPaintable() { - return false; - } - - public void paintValue(Graphics gfx, Rectangle box) { - throw new UnsupportedOperationException("Not supported yet."); - } - - public String getJavaInitializationString() { - return null; - } - - public String getAsText() { - if (emitter == null) { - return "null"; - } - if (emitter instanceof EmitterBoxShape) { - EmitterBoxShape shape = (EmitterBoxShape) emitter; - return "[Box, " - + shape.getMin().x - + ", " - + shape.getMin().y - + ", " - + shape.getMin().z - + ", " - + shape.getMin().x + shape.getLen().x - + ", " - + shape.getMin().x + shape.getLen().y - + ", " - + shape.getMin().x + shape.getLen().z - + "]"; - } else if (emitter instanceof EmitterPointShape) { - EmitterPointShape shape = (EmitterPointShape) emitter; - return "[Point, " - + shape.getPoint().x - + ", " - + shape.getPoint().y - + ", " - + shape.getPoint().z - + "]"; - } else if (emitter instanceof EmitterSphereShape) { - EmitterSphereShape shape = (EmitterSphereShape) emitter; - return "[Sphere, " - + shape.getCenter().x - + ", " - + shape.getCenter().y - + ", " - + shape.getCenter().z - + ", " - + shape.getRadius() - + "]"; - } - return emitter.toString(); - } - - public void setAsText(String text) throws IllegalArgumentException { - text = text.replace('[', ' ').trim(); - text = text.replace(']', ' ').trim(); - String[] strings = text.split(","); - EmitterShape old=emitter; - if (strings.length == 0) { - return; - } - if ("box".equals(strings[0].trim().toLowerCase())) { - if (strings.length == 7) { - StatusDisplayer.getDefault().setStatusText("try set parameterized box shape"); - emitter = new EmitterBoxShape( - new Vector3f(Float.parseFloat(strings[1]), Float.parseFloat(strings[2]), Float.parseFloat(strings[3])), new Vector3f(Float.parseFloat(strings[4]), Float.parseFloat(strings[5]), Float.parseFloat(strings[6]))); - } else { - StatusDisplayer.getDefault().setStatusText("try set standard box shape"); - emitter = new EmitterBoxShape(new Vector3f(-.5f, -.5f, -.5f), new Vector3f(.5f, .5f, .5f)); - } - } else if ("point".equals(strings[0].trim().toLowerCase())) { - if (strings.length == 4) { - emitter = new EmitterPointShape( - new Vector3f(Float.parseFloat(strings[1]), Float.parseFloat(strings[2]), Float.parseFloat(strings[3]))); - } else { - emitter = new EmitterPointShape(Vector3f.ZERO); - } - } else if ("sphere".equals(strings[0].trim().toLowerCase())) { - if (strings.length == 5) { - emitter = new EmitterSphereShape( - new Vector3f(Float.parseFloat(strings[1]), Float.parseFloat(strings[2]), Float.parseFloat(strings[3])), Float.parseFloat(strings[4])); - } else { - emitter = new EmitterSphereShape(Vector3f.ZERO, .5f); - } - } - notifyListeners(old, emitter); - } - - public String[] getTags() { -// String[] mats = new String[]{"[Point]", "[Sphere]", "[Box]"}; - return null; - } - - public Component getCustomEditor() { - throw new UnsupportedOperationException("Not supported yet."); - } - - public boolean supportsCustomEditor() { - return false; - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - listeners.add(listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - listeners.remove(listener); - } - - private void notifyListeners(EmitterShape before, EmitterShape after) { - for (Iterator it = listeners.iterator(); it.hasNext();) { - PropertyChangeListener propertyChangeListener = it.next(); - //TODO: check what the "programmatic name" is supposed to be here.. for now its Quaternion - propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); - } - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Matrix3fPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Matrix3fPropertyEditor.java deleted file mode 100644 index 842204a7f..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Matrix3fPropertyEditor.java +++ /dev/null @@ -1,124 +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.properties; - -import com.jme3.math.Matrix3f; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Rectangle; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyEditor; -import java.util.Iterator; -import java.util.LinkedList; - -/** - * - * @author normenhansen - */ -public class Matrix3fPropertyEditor implements PropertyEditor { - - private LinkedList listeners = new LinkedList(); - private Matrix3f vector = new Matrix3f(); - - public void setValue(Object value) { - if (value instanceof Matrix3f) { - vector.set((Matrix3f) value); - } - } - - public Object getValue() { - return vector; - } - - public boolean isPaintable() { - return false; - } - - public void paintValue(Graphics gfx, Rectangle box) { - throw new UnsupportedOperationException("Not supported yet."); - } - - public String getJavaInitializationString() { - return null; - } - - public String getAsText() { - return vector.toString(); - } - - public void setAsText(String text) throws IllegalArgumentException { - text = text.replace('[', ' '); - text = text.replace(']', ' '); - String[] values = text.split(","); - if (values.length != 3) { - throw (new IllegalArgumentException("String not correct")); - } - float[] floats = new float[3]; - for (int i = 0; i < values.length; i++) { - String string = values[i]; - floats[i] = Float.parseFloat(string); - } - Matrix3f old = new Matrix3f(); - old.set(vector); -// vector.set(floats[0], floats[1], floats[2]); - notifyListeners(old, vector); - } - - public String[] getTags() { - return null; - } - - public Component getCustomEditor() { - throw new UnsupportedOperationException("Not supported yet."); - } - - public boolean supportsCustomEditor() { - return false; - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - listeners.add(listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - listeners.remove(listener); - } - - private void notifyListeners(Matrix3f before, Matrix3f after) { - for (Iterator it = listeners.iterator(); it.hasNext();) { - PropertyChangeListener propertyChangeListener = it.next(); - //TODO: check what the "programmatic name" is supposed to be here.. for now its Matrix3f - propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); - } - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/QuaternionPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/QuaternionPropertyEditor.java deleted file mode 100644 index 04f0a9dbb..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/QuaternionPropertyEditor.java +++ /dev/null @@ -1,125 +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.properties; - -import com.jme3.math.Quaternion; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Rectangle; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyEditor; -import java.util.Iterator; -import java.util.LinkedList; - -/** - * - * @author normenhansen - */ -public class QuaternionPropertyEditor implements PropertyEditor { - - private LinkedList listeners = new LinkedList(); - private Quaternion quaternion = new Quaternion(); - - public void setValue(Object value) { - if (value instanceof Quaternion) { - quaternion.set((Quaternion) value); - } - } - - public Object getValue() { - return quaternion; - } - - public boolean isPaintable() { - return false; - } - - public void paintValue(Graphics gfx, Rectangle box) { - throw new UnsupportedOperationException("Not supported yet."); - } - - public String getJavaInitializationString() { - return null; - } - - public String getAsText() { - float[] angles=quaternion.toAngles(new float[3]); - return "[" + (float)Math.toDegrees(angles[0]) + ", " + (float)Math.toDegrees(angles[1]) + ", " + (float)Math.toDegrees(angles[2]) + "]"; - } - - public void setAsText(String text) throws IllegalArgumentException { - text = text.replace('[', ' '); - text = text.replace(']', ' '); - String[] values = text.split(","); - if (values.length != 3) { - throw (new IllegalArgumentException("String not correct")); - } - float[] floats = new float[3]; - for (int i = 0; i < values.length; i++) { - String string = values[i]; - floats[i] = (float)Math.toRadians(Float.parseFloat(string)); - } - Quaternion old=new Quaternion(); - old.set(quaternion); - quaternion.fromAngles(floats); - notifyListeners(old,quaternion); - } - - public String[] getTags() { - return null; - } - - public Component getCustomEditor() { - throw new UnsupportedOperationException("Not supported yet."); - } - - public boolean supportsCustomEditor() { - return false; - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - listeners.add(listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - listeners.remove(listener); - } - - private void notifyListeners(Quaternion before, Quaternion after) { - for (Iterator it = listeners.iterator(); it.hasNext();) { - PropertyChangeListener propertyChangeListener = it.next(); - //TODO: check what the "programmatic name" is supposed to be here.. for now its Quaternion - propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); - } - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/SceneExplorerProperty.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/SceneExplorerProperty.java deleted file mode 100644 index 17167f439..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/SceneExplorerProperty.java +++ /dev/null @@ -1,209 +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.properties; - -import com.jme3.effect.shapes.EmitterShape; -import com.jme3.gde.core.scene.SceneApplication; -import com.jme3.gde.core.undoredo.AbstractUndoableSceneEdit; -import com.jme3.gde.core.undoredo.SceneUndoRedoManager; -import com.jme3.math.ColorRGBA; -import com.jme3.math.Matrix3f; -import com.jme3.math.Quaternion; -import com.jme3.math.Vector2f; -import com.jme3.math.Vector3f; -import java.lang.reflect.InvocationTargetException; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.openide.nodes.PropertySupport; -import org.openide.util.Exceptions; -import org.openide.util.Lookup; - -/** - * - * @author normenhansen - */ -@SuppressWarnings("unchecked") -public class SceneExplorerProperty extends PropertySupport.Reflection { - - protected LinkedList listeners = new LinkedList(); - - public SceneExplorerProperty(T instance, Class valueType, String getter, String setter) throws NoSuchMethodException { - this(instance, valueType, getter, setter, null); - } - - public SceneExplorerProperty(T instance, Class valueType, String getter, String setter, ScenePropertyChangeListener listener) throws NoSuchMethodException { - super(instance, valueType, getter, setter); - addPropertyChangeListener(listener); - if (valueType == Vector3f.class) { - setPropertyEditorClass(Vector3fPropertyEditor.class); - } else if (valueType == Quaternion.class) { - setPropertyEditorClass(QuaternionPropertyEditor.class); - } else if (valueType == Matrix3f.class) { - setPropertyEditorClass(Matrix3fPropertyEditor.class); - } else if (valueType == ColorRGBA.class) { - setPropertyEditorClass(ColorRGBAPropertyEditor.class); - } else if (valueType == EmitterShape.class) { - setPropertyEditorClass(EmitterShapePropertyEditor.class); - } else if (valueType == Vector2f.class) { - setPropertyEditorClass(Vector2fPropertyEditor.class); - } - - for (SceneExplorerPropertyEditor di : Lookup.getDefault().lookupAll(SceneExplorerPropertyEditor.class)) { - di.setEditor(valueType, this); - } - } - - @Override - public T getValue() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { - return super.getValue(); -// try { -// return SceneApplication.getApplication().enqueue(new Callable() { -// -// public T call() throws Exception { -// return getSuperValue(); -// } -// }).get(); -// } catch (InterruptedException ex) { -// Exceptions.printStackTrace(ex); -// } catch (ExecutionException ex) { -// Exceptions.printStackTrace(ex); -// } -// return null; - } - - private T getSuperValue() { - try { - return super.getValue(); - } catch (IllegalAccessException ex) { - Exceptions.printStackTrace(ex); - } catch (IllegalArgumentException ex) { - Exceptions.printStackTrace(ex); - } catch (InvocationTargetException ex) { - Exceptions.printStackTrace(ex); - } - return null; - } - - @Override - public void setValue(final T val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { - try { - notifyListeners(getSuperValue(), val); - SceneApplication.getApplication().enqueue(new Callable() { - - public Void call() throws Exception { - setSuperValue(val); - return null; - } - }).get(); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (ExecutionException ex) { - Exceptions.printStackTrace(ex); - } - } - - private void setSuperValue(T val, boolean undo) { - try { - if (undo) { - try { - Object oldValue = getSuperValue(); - if (oldValue.getClass().getMethod("clone") != null) { - addUndo(oldValue.getClass().getMethod("clone").invoke(oldValue), val); - Logger.getLogger(SceneExplorerProperty.class.getName()).log(Level.INFO, "Add cloned undo {0}", oldValue.getClass().getMethod("clone").invoke(oldValue)); - } - } catch (Exception e) { - addUndo(getSuperValue(), val); - Logger.getLogger(SceneExplorerProperty.class.getName()).log(Level.INFO, "Add undo {0}", getSuperValue()); - } - } - super.setValue(val); - } catch (IllegalAccessException ex) { - Exceptions.printStackTrace(ex); - } catch (IllegalArgumentException ex) { - Exceptions.printStackTrace(ex); - } catch (InvocationTargetException ex) { - Exceptions.printStackTrace(ex); - } - } - - private void setSuperValue(T val) { - setSuperValue(val, true); - } - - protected void addUndo(final Object before, final Object after) { - SceneUndoRedoManager undoRedo = Lookup.getDefault().lookup(SceneUndoRedoManager.class); - if (undoRedo == null) { - Logger.getLogger(SceneExplorerProperty.class.getName()).log(Level.WARNING, "Cannot access SceneUndoRedoManager"); - return; - } - undoRedo.addEdit(this, new AbstractUndoableSceneEdit() { - - @Override - public void sceneUndo() { - Logger.getLogger(SceneExplorerProperty.class.getName()).log(Level.INFO, "Do undo {0}", before); - setSuperValue((T) before, false); - } - - @Override - public void sceneRedo() { - setSuperValue((T) after, false); - } - - @Override - public void awtUndo() { - } - - @Override - public void awtRedo() { - } - }); - } - - public void addPropertyChangeListener(ScenePropertyChangeListener listener) { - listeners.add(listener); - } - - public void removePropertyChangeListener(ScenePropertyChangeListener listener) { - listeners.remove(listener); - } - - private void notifyListeners(Object before, Object after) { - for (Iterator it = listeners.iterator(); it.hasNext();) { - ScenePropertyChangeListener propertyChangeListener = it.next(); - propertyChangeListener.propertyChange(getName(), before, after); - } - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/SceneExplorerPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/SceneExplorerPropertyEditor.java deleted file mode 100644 index 6c0f9cf02..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/SceneExplorerPropertyEditor.java +++ /dev/null @@ -1,41 +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.properties; - -/** - * - * @author normenhansen - */ -public interface SceneExplorerPropertyEditor { - public void setEditor(Class valueType, SceneExplorerProperty prop); -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ScenePropertyChangeListener.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ScenePropertyChangeListener.java deleted file mode 100644 index 23b0c6d05..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/ScenePropertyChangeListener.java +++ /dev/null @@ -1,41 +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.properties; - -/** - * - * @author normenhansen - */ -public interface ScenePropertyChangeListener { - public void propertyChange(String property, Object oldValue, Object newValue); -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/TextureBrowser.form b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/TextureBrowser.form deleted file mode 100644 index 4e28fcd14..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/TextureBrowser.form +++ /dev/null @@ -1,128 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/TextureBrowser.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/TextureBrowser.java deleted file mode 100644 index c5b38efb4..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/TextureBrowser.java +++ /dev/null @@ -1,264 +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.properties; - -import Model.DDSImageFile; -import com.jme3.gde.core.assets.ProjectAssetManager; -import com.jme3.texture.Texture; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.util.logging.Logger; -import javax.swing.DefaultListSelectionModel; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import jme3tools.converters.ImageToAwt; -import org.openide.filesystems.FileUtil; -import org.openide.util.Exceptions; -import org.openide.util.ImageUtilities; - -/** - * Displays all textures in the ProjectAssetManager, - * lets you select one, and shows a preview of it. - * - * The user can de-select the currently selected texture to specify they - * do not want a texture, and in that case null is returned. - * - * @author bowens - */ -public class TextureBrowser extends javax.swing.JDialog { - - private ProjectAssetManager assetManager; - private TexturePropertyEditor editor; - - - public TextureBrowser(java.awt.Frame parent, boolean modal, ProjectAssetManager assetManager, TexturePropertyEditor editor) { - super(parent, modal); - this.assetManager = assetManager; - this.editor = editor; - initComponents(); - loadAvailableTextures(); - setSelectedTexture((Texture)editor.getValue()); - setLocationRelativeTo(null); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - cancelButton = new javax.swing.JButton(); - okButton = new javax.swing.JButton(); - jPanel1 = new javax.swing.JPanel(); - jScrollPane1 = new javax.swing.JScrollPane(); - textureList = new javax.swing.JList(); - jScrollPane2 = new javax.swing.JScrollPane(); - imagePreviewLabel = new javax.swing.JLabel(); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle(org.openide.util.NbBundle.getMessage(TextureBrowser.class, "TextureBrowser.title")); // NOI18N - - cancelButton.setText(org.openide.util.NbBundle.getMessage(TextureBrowser.class, "TextureBrowser.cancelButton.text")); // NOI18N - cancelButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - cancelButtonActionPerformed(evt); - } - }); - - okButton.setText(org.openide.util.NbBundle.getMessage(TextureBrowser.class, "TextureBrowser.okButton.text")); // NOI18N - okButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - okButtonActionPerformed(evt); - } - }); - - textureList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - textureList.setSelectionModel(new ToggleSelectionModel()); - textureList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - textureListValueChanged(evt); - } - }); - jScrollPane1.setViewportView(textureList); - - imagePreviewLabel.setText(org.openide.util.NbBundle.getMessage(TextureBrowser.class, "TextureBrowser.imagePreviewLabel.text")); // NOI18N - jScrollPane2.setViewportView(imagePreviewLabel); - - javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE)) - ); - jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE) - .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE) - ); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap(357, Short.MAX_VALUE) - .addComponent(cancelButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(okButton) - .addGap(17, 17, 17)) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(okButton) - .addComponent(cancelButton))) - ); - - pack(); - }// //GEN-END:initComponents - - private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed - setTexture(); - dispose(); - }//GEN-LAST:event_okButtonActionPerformed - - private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed - dispose(); - }//GEN-LAST:event_cancelButtonActionPerformed - - private void textureListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_textureListValueChanged - selectionChanged(); - }//GEN-LAST:event_textureListValueChanged - - private void setTexture() { - if (textureList.getSelectedIndex() > -1) { - textureList.getSelectedValue(); - String selected = (String) textureList.getSelectedValue(); - Texture tex = assetManager.loadTexture(selected); - editor.setValue(tex); - editor.setAsText(selected); - } else { - editor.setValue(null); - editor.setAsText(null); - } - } - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton cancelButton; - private javax.swing.JLabel imagePreviewLabel; - private javax.swing.JPanel jPanel1; - private javax.swing.JScrollPane jScrollPane1; - private javax.swing.JScrollPane jScrollPane2; - private javax.swing.JButton okButton; - private javax.swing.JList textureList; - // End of variables declaration//GEN-END:variables - - private void loadAvailableTextures() { - if (assetManager == null) - return; - - textureList.setListData(assetManager.getTextures()); - - } - - private void selectionChanged() { - if (textureList.getSelectedIndex() > -1) { - String selected = (String) textureList.getSelectedValue(); - Texture tex = assetManager.loadTexture(selected); - Icon newicon = null; - if(selected.endsWith(".dds")||selected.endsWith(".DDS")){ - try { - File file = FileUtil.toFile(assetManager.getAssetFolder().getFileObject(selected)); - DDSImageFile ddsImageFile = new DDSImageFile(file); - BufferedImage bufferedImage = ddsImageFile.getData(); - newicon = new ImageIcon(bufferedImage); - } catch (IOException ex) { - Exceptions.printStackTrace(ex); - } - }else{ - newicon = ImageUtilities.image2Icon(ImageToAwt.convert(tex.getImage(), false, true, 0)); - } - imagePreviewLabel.setIcon(newicon); - } else { - imagePreviewLabel.setIcon(null); - } - } - - private void setSelectedTexture(Texture texture) { - if (texture != null) { - Logger.getLogger(TextureBrowser.class.getName()).finer("Looking for Texture: "+texture.getName()); - for (int i=0; i listeners = new LinkedList(); - private Texture texture; - private AssetManager manager; - private String assetKey; - - public TexturePropertyEditor() { - } - - public TexturePropertyEditor(Texture texture) { - this.texture = texture; - } - - public TexturePropertyEditor(AssetManager manager) { - this.manager = manager; - } - - public TexturePropertyEditor(Texture texture, AssetManager manager) { - this.texture = texture; - this.manager = manager; - } - - public void setValue(Object value) { - if (value instanceof Texture) { - texture = (Texture) value; - } else { - texture = null; - } - } - - public Object getValue() { - return texture; - } - - public boolean isPaintable() { - return false; - } - - public void paintValue(Graphics gfx, Rectangle box) { - } - - public String getJavaInitializationString() { - return null; - } - - public String getAsText() { -// if (texture != null) { -// return texture.getName(); -// } - return assetKey; - } - - public void setAsText(String text) throws IllegalArgumentException { - this.assetKey = text; - //TODO: load texture if not done.. maybe load here instead of panel.. - } - - public String[] getTags() { - return null; - } - - public Component getCustomEditor() { - ProjectAssetManager currentProjectAssetManager = null; - if (manager instanceof ProjectAssetManager) { - currentProjectAssetManager = (ProjectAssetManager) manager; - } - //try { - if (currentProjectAssetManager == null) { - currentProjectAssetManager = (ProjectAssetManager) SceneApplication.getApplication().getAssetManager(); - } - TextureBrowser textureBrowser = new TextureBrowser(null, true, currentProjectAssetManager, this); - return textureBrowser; - //} catch (Exception e) { - //Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, e.getMessage()+" Could not get project asset manager!", e); - //return null; - //} - } - - public boolean supportsCustomEditor() { - return true; - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - listeners.add(listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - listeners.remove(listener); - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/UserDataProperty.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/UserDataProperty.java deleted file mode 100644 index 636dc1ce4..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/UserDataProperty.java +++ /dev/null @@ -1,144 +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.properties; - -import com.jme3.gde.core.scene.SceneApplication; -import com.jme3.scene.Spatial; -import java.beans.PropertyEditor; -import java.lang.reflect.InvocationTargetException; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import org.openide.nodes.PropertySupport; -import org.openide.util.Exceptions; - -/** - * - * @author normenhansen - */ -public class UserDataProperty extends PropertySupport.ReadWrite { - - private Spatial spatial; - private String name = "null"; - private int type = 0; - private List listeners = new LinkedList(); - - public UserDataProperty(Spatial node, String name) { - super(name, String.class, name, ""); - this.spatial = node; - this.name = name; - this.type = getObjectType(node.getUserData(name)); - } - - public static int getObjectType(Object type) { - if (type instanceof Integer) { - return 0; - } else if (type instanceof Float) { - return 1; - } else if (type instanceof Boolean) { - return 2; - } else if (type instanceof String) { - return 3; - } else if (type instanceof Long) { - return 4; - } else { - throw new IllegalArgumentException("Unsupported type: " + type); - } - } - - @Override - public String getValue() throws IllegalAccessException, InvocationTargetException { - return spatial.getUserData(name) + ""; - } - - @Override - public void setValue(final String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { - if (spatial == null) { - return; - } - try { - SceneApplication.getApplication().enqueue(new Callable() { - - public Void call() throws Exception { - switch (type) { - case 0: - spatial.setUserData(name, Integer.parseInt(val)); - break; - case 1: - spatial.setUserData(name, Float.parseFloat(val)); - break; - case 2: - spatial.setUserData(name, Boolean.parseBoolean(val)); - break; - case 3: - spatial.setUserData(name, val); - break; - case 4: - spatial.setUserData(name, Long.parseLong(val)); - break; - default: - throw new UnsupportedOperationException(); - } - return null; - } - }).get(); - notifyListeners(null, val); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (ExecutionException ex) { - Exceptions.printStackTrace(ex); - } - } - - @Override - public PropertyEditor getPropertyEditor() { - return null; -// return new AnimationPropertyEditor(control); - } - - public void addPropertyChangeListener(ScenePropertyChangeListener listener) { - listeners.add(listener); - } - - public void removePropertyChangeListener(ScenePropertyChangeListener listener) { - listeners.remove(listener); - } - - private void notifyListeners(Object before, Object after) { - for (Iterator it = listeners.iterator(); it.hasNext();) { - ScenePropertyChangeListener propertyChangeListener = it.next(); - propertyChangeListener.propertyChange(getName(), before, after); - } - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Vector2fPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Vector2fPropertyEditor.java deleted file mode 100644 index af8642226..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Vector2fPropertyEditor.java +++ /dev/null @@ -1,124 +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.properties; - -import com.jme3.math.Vector2f; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Rectangle; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyEditor; -import java.util.Iterator; -import java.util.LinkedList; - -/** - * - * @author normenhansen - */ -public class Vector2fPropertyEditor implements PropertyEditor { - - private LinkedList listeners = new LinkedList(); - private Vector2f vector = new Vector2f(); - - public void setValue(Object value) { - if (value instanceof Vector2f) { - vector.set((Vector2f) value); - } - } - - public Object getValue() { - return vector; - } - - public boolean isPaintable() { - return false; - } - - public void paintValue(Graphics gfx, Rectangle box) { - throw new UnsupportedOperationException("Not supported yet."); - } - - public String getJavaInitializationString() { - return null; - } - - public String getAsText() { - return "[" + vector.x + ", " + vector.y + "]"; - } - - public void setAsText(String text) throws IllegalArgumentException { - text = text.replace('[', ' '); - text = text.replace(']', ' '); - String[] values = text.split(","); - if (values.length != 2) { - throw (new IllegalArgumentException("String not correct")); - } - float[] floats = new float[2]; - for (int i = 0; i < values.length; i++) { - String string = values[i]; - floats[i] = Float.parseFloat(string); - } - Vector2f old = new Vector2f(); - old.set(vector); - vector.set(floats[0], floats[1]); - notifyListeners(old, vector); - } - - public String[] getTags() { - return null; - } - - public Component getCustomEditor() { - throw new UnsupportedOperationException("Not supported yet."); - } - - public boolean supportsCustomEditor() { - return false; - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - listeners.add(listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - listeners.remove(listener); - } - - private void notifyListeners(Vector2f before, Vector2f after) { - for (Iterator it = listeners.iterator(); it.hasNext();) { - PropertyChangeListener propertyChangeListener = it.next(); - //TODO: check what the "programmatic name" is supposed to be here.. for now its Vector2f - propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); - } - } -} diff --git a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Vector3fPropertyEditor.java b/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Vector3fPropertyEditor.java deleted file mode 100644 index 9fa83912f..000000000 --- a/sdk/jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/properties/Vector3fPropertyEditor.java +++ /dev/null @@ -1,124 +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.properties; - -import com.jme3.math.Vector3f; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Rectangle; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.beans.PropertyEditor; -import java.util.Iterator; -import java.util.LinkedList; - -/** - * - * @author normenhansen - */ -public class Vector3fPropertyEditor implements PropertyEditor { - - private LinkedList listeners = new LinkedList(); - private Vector3f vector = new Vector3f(); - - public void setValue(Object value) { - if (value instanceof Vector3f) { - vector.set((Vector3f) value); - } - } - - public Object getValue() { - return vector; - } - - public boolean isPaintable() { - return false; - } - - public void paintValue(Graphics gfx, Rectangle box) { - throw new UnsupportedOperationException("Not supported yet."); - } - - public String getJavaInitializationString() { - return null; - } - - public String getAsText() { - return "[" + vector.x + ", " + vector.y + ", " + vector.z + "]"; - } - - public void setAsText(String text) throws IllegalArgumentException { - text = text.replace('[', ' '); - text = text.replace(']', ' '); - String[] values = text.split(","); - if (values.length != 3) { - throw (new IllegalArgumentException("String not correct")); - } - float[] floats = new float[3]; - for (int i = 0; i < values.length; i++) { - String string = values[i]; - floats[i] = Float.parseFloat(string); - } - Vector3f old = new Vector3f(); - old.set(vector); - vector.set(floats[0], floats[1], floats[2]); - notifyListeners(old, vector); - } - - public String[] getTags() { - return null; - } - - public Component getCustomEditor() { - throw new UnsupportedOperationException("Not supported yet."); - } - - public boolean supportsCustomEditor() { - return false; - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - listeners.add(listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - listeners.remove(listener); - } - - private void notifyListeners(Vector3f before, Vector3f after) { - for (Iterator it = listeners.iterator(); it.hasNext();) { - PropertyChangeListener propertyChangeListener = it.next(); - //TODO: check what the "programmatic name" is supposed to be here.. for now its Vector3f - propertyChangeListener.propertyChange(new PropertyChangeEvent(this, null, before, after)); - } - } -}