diff --git a/sdk/jme3-gui/build.xml b/sdk/jme3-gui/build.xml
index f7d03ec94..a5c92cb19 100644
--- a/sdk/jme3-gui/build.xml
+++ b/sdk/jme3-gui/build.xml
@@ -1,8 +1,8 @@
-
-
-
-
-
- Builds, tests, and runs the project com.jme3.gde.gui.
-
-
+
+
+
+
+
+ Builds, tests, and runs the project com.jme3.gde.gui.
+
+
diff --git a/sdk/jme3-gui/manifest.mf b/sdk/jme3-gui/manifest.mf
index 27ba6cf5c..9070e170d 100644
--- a/sdk/jme3-gui/manifest.mf
+++ b/sdk/jme3-gui/manifest.mf
@@ -1,6 +1,5 @@
-Manifest-Version: 1.0
-OpenIDE-Module: com.jme3.gde.gui/1
-OpenIDE-Module-Implementation-Version: 0
-OpenIDE-Module-Layer: com/jme3/gde/gui/layer.xml
-OpenIDE-Module-Localizing-Bundle: com/jme3/gde/gui/Bundle.properties
-
+Manifest-Version: 1.0
+OpenIDE-Module: com.jme3.gde.gui/1
+OpenIDE-Module-Implementation-Version: 0
+OpenIDE-Module-Localizing-Bundle: com/jme3/gde/gui/Bundle.properties
+
diff --git a/sdk/jme3-gui/nbproject/build-impl.xml b/sdk/jme3-gui/nbproject/build-impl.xml
index 307e07b68..e5b9c7898 100644
--- a/sdk/jme3-gui/nbproject/build-impl.xml
+++ b/sdk/jme3-gui/nbproject/build-impl.xml
@@ -1,45 +1,45 @@
-
-
-
-
-
-
-
-
-
-
-
-
- You must set 'suite.dir' to point to your containing module suite
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ You must set 'suite.dir' to point to your containing module suite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sdk/jme3-gui/nbproject/genfiles.properties b/sdk/jme3-gui/nbproject/genfiles.properties
index efd49fecd..22871f064 100644
--- a/sdk/jme3-gui/nbproject/genfiles.properties
+++ b/sdk/jme3-gui/nbproject/genfiles.properties
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=f5775f9d
-build.xml.script.CRC32=a0136781
-build.xml.stylesheet.CRC32=a56c6a5b@2.56.1
-# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=f5775f9d
-nbproject/build-impl.xml.script.CRC32=55a34aaf
-nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.56.1
+build.xml.data.CRC32=7857ced2
+build.xml.script.CRC32=a0136781
+build.xml.stylesheet.CRC32=a56c6a5b@2.56.1
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=7857ced2
+nbproject/build-impl.xml.script.CRC32=55a34aaf
+nbproject/build-impl.xml.stylesheet.CRC32=238281d1@2.56.1
diff --git a/sdk/jme3-gui/nbproject/project.properties b/sdk/jme3-gui/nbproject/project.properties
index 50bdbe1fd..ef4ce81f9 100644
--- a/sdk/jme3-gui/nbproject/project.properties
+++ b/sdk/jme3-gui/nbproject/project.properties
@@ -1,8 +1,9 @@
-#Thu, 25 Aug 2011 20:26:49 +0200
-javac.source=1.5
-javac.compilerargs=-Xlint -Xlint\:-serial
-license.file=../license-jme.txt
-nbm.homepage=http\://www.jmonkeyengine.com
-nbm.module.author=Normen Hansen
-nbm.needs.restart=true
-spec.version.base=3.0.0
+file.reference.swingtonifty.jar=release/modules/ext/swingtonifty.jar
+#Thu, 25 Aug 2011 20:26:49 +0200
+javac.source=1.5
+javac.compilerargs=-Xlint -Xlint\:-serial
+license.file=../license-jme.txt
+nbm.homepage=http\://www.jmonkeyengine.com
+nbm.module.author=Normen Hansen
+nbm.needs.restart=true
+spec.version.base=3.0.0
diff --git a/sdk/jme3-gui/nbproject/project.xml b/sdk/jme3-gui/nbproject/project.xml
index b88d63550..8dfafbc80 100644
--- a/sdk/jme3-gui/nbproject/project.xml
+++ b/sdk/jme3-gui/nbproject/project.xml
@@ -1,180 +1,175 @@
-
-
- org.netbeans.modules.apisupport.project
-
-
- com.jme3.gde.gui
-
-
-
- com.jme3.gde.core
-
-
-
- 1
- 3.0.0
-
-
-
- com.jme3.gde.core.baselibs
-
-
-
- 1
- 3.0.0
-
-
-
- com.jme3.gde.core.libraries
-
-
-
- 1
- 3.0.0
-
-
-
- org.netbeans.api.java.classpath
-
-
-
- 1
- 1.36.1
-
-
-
- org.netbeans.core.multiview
-
-
-
- 1
- 1.32.1
-
-
-
- org.netbeans.modules.java.project
-
-
-
- 1
- 1.50.2
-
-
-
- org.netbeans.modules.projectapi
-
-
-
- 1
- 1.50.1
-
-
-
- org.netbeans.modules.xml.multiview
-
-
-
- 1
-
-
-
-
- org.netbeans.spi.palette
-
-
-
- 1
- 1.35.1
-
-
-
- org.openide.awt
-
-
-
- 7.55.1
-
-
-
- org.openide.dialogs
-
-
-
- 7.28.1
-
-
-
- org.openide.explorer
-
-
-
- 6.50.3
-
-
-
- org.openide.filesystems
-
-
-
- 8.5.1
-
-
-
- org.openide.loaders
-
-
-
- 7.44.3
-
-
-
- org.openide.nodes
-
-
-
- 7.33.2
-
-
-
- org.openide.text
-
-
-
- 6.54.2
-
-
-
- org.openide.util
-
-
-
- 8.29.3
-
-
-
- org.openide.util.lookup
-
-
-
- 8.19.1
-
-
-
- org.openide.windows
-
-
-
- 6.60.1
-
-
-
-
- com.jme3.gde.gui
-
-
- ext/swingtonifty.jar
- release/modules/ext/swingtonifty.jar
-
-
-
-
+
+
+ org.netbeans.modules.apisupport.project
+
+
+ com.jme3.gde.gui
+
+
+
+ com.jme3.gde.core
+
+
+
+ 1
+ 3.0.0
+
+
+
+ com.jme3.gde.core.baselibs
+
+
+
+ 1
+ 3.0.0
+
+
+
+ org.netbeans.api.java.classpath
+
+
+
+ 1
+ 1.36.1
+
+
+
+ org.netbeans.core.multiview
+
+
+
+ 1
+ 1.32.1
+
+
+
+ org.netbeans.modules.java.project
+
+
+
+ 1
+ 1.50.2
+
+
+
+ org.netbeans.modules.projectapi
+
+
+
+ 1
+ 1.50.1
+
+
+
+ org.netbeans.modules.xml.multiview
+
+
+
+ 1
+
+
+
+
+ org.netbeans.spi.palette
+
+
+
+ 1
+ 1.35.1
+
+
+
+ org.openide.awt
+
+
+
+ 7.55.1
+
+
+
+ org.openide.dialogs
+
+
+
+ 7.28.1
+
+
+
+ org.openide.explorer
+
+
+
+ 6.50.3
+
+
+
+ org.openide.filesystems
+
+
+
+ 8.5.1
+
+
+
+ org.openide.loaders
+
+
+
+ 7.44.3
+
+
+
+ org.openide.nodes
+
+
+
+ 7.33.2
+
+
+
+ org.openide.text
+
+
+
+ 6.54.2
+
+
+
+ org.openide.util
+
+
+
+ 8.29.3
+
+
+
+ org.openide.util.lookup
+
+
+
+ 8.19.1
+
+
+
+ org.openide.windows
+
+
+
+ 6.60.1
+
+
+
+
+ com.jme3.gde.gui
+
+
+ ext/swingtonifty.jar
+ release/modules/ext/swingtonifty.jar
+
+
+ ext/Nifty-Editor0.5.7.jar
+ release/modules/ext/Nifty-Editor0.5.7.jar
+
+
+
+
diff --git a/sdk/jme3-gui/release/modules/ext/Nifty-Editor0.5.7.jar b/sdk/jme3-gui/release/modules/ext/Nifty-Editor0.5.7.jar
new file mode 100644
index 000000000..c22e77625
Binary files /dev/null and b/sdk/jme3-gui/release/modules/ext/Nifty-Editor0.5.7.jar differ
diff --git a/sdk/jme3-gui/src/com/jme3/gde/gui/EmptyNiftyGui.xml b/sdk/jme3-gui/src/com/jme3/gde/gui/EmptyNiftyGui.xml
new file mode 100644
index 000000000..c608723c0
--- /dev/null
+++ b/sdk/jme3-gui/src/com/jme3/gde/gui/EmptyNiftyGui.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sdk/jme3-gui/src/com/jme3/gde/gui/NiftyGuiDataObject.java b/sdk/jme3-gui/src/com/jme3/gde/gui/NiftyGuiDataObject.java
index 98c57c631..1b733c83b 100644
--- a/sdk/jme3-gui/src/com/jme3/gde/gui/NiftyGuiDataObject.java
+++ b/sdk/jme3-gui/src/com/jme3/gde/gui/NiftyGuiDataObject.java
@@ -5,36 +5,99 @@
package com.jme3.gde.gui;
import com.jme3.gde.core.assets.ProjectAssetManager;
-import com.jme3.gde.gui.multiview.PreviewView;
import java.io.IOException;
import org.netbeans.api.project.Project;
import org.netbeans.api.project.ProjectManager;
-import org.netbeans.modules.xml.multiview.DesignMultiViewDesc;
-import org.netbeans.modules.xml.multiview.XmlMultiViewDataObject;
+import org.netbeans.core.spi.multiview.MultiViewElement;
+import org.netbeans.core.spi.multiview.text.MultiViewEditorElement;
+import org.openide.awt.ActionID;
+import org.openide.awt.ActionReference;
+import org.openide.awt.ActionReferences;
import org.openide.filesystems.FileObject;
+import org.openide.filesystems.MIMEResolver;
import org.openide.loaders.DataNode;
+import org.openide.loaders.DataObject;
import org.openide.loaders.DataObjectExistsException;
+import org.openide.loaders.MultiDataObject;
import org.openide.loaders.MultiFileLoader;
-import org.openide.nodes.Node;
import org.openide.nodes.Children;
+import org.openide.nodes.Node;
import org.openide.util.Lookup;
-import org.openide.util.lookup.AbstractLookup;
-import org.openide.util.lookup.InstanceContent;
-import org.openide.util.lookup.ProxyLookup;
-
-public class NiftyGuiDataObject extends XmlMultiViewDataObject {
+import org.openide.util.NbBundle.Messages;
+import org.openide.windows.TopComponent;
- private static final int TYPE_TOOLBAR = 0;
- protected final Lookup lookup;
- protected final InstanceContent lookupContents = new InstanceContent();
+@Messages({
+ "LBL_NiftyGui_LOADER=Files of NiftyGui"
+})
+@MIMEResolver.Registration(
+ displayName = "#LBL_NiftyGui_LOADER",
+ resource = "NiftyGuiResolver.xml")
+@DataObject.Registration(
+ mimeType = "text/x-niftygui+xml",
+ iconBase = "com/jme3/gde/gui/Computer_File_043.gif",
+ displayName = "#LBL_NiftyGui_LOADER",
+ position = 300)
+@ActionReferences({
+ @ActionReference(
+ path = "Loaders/text/x-niftygui+xml/Actions",
+ id =
+ @ActionID(category = "System", id = "org.openide.actions.OpenAction"),
+ position = 100,
+ separatorAfter = 200),
+ @ActionReference(
+ path = "Loaders/text/x-niftygui+xml/Actions",
+ id =
+ @ActionID(category = "Edit", id = "org.openide.actions.CutAction"),
+ position = 300),
+ @ActionReference(
+ path = "Loaders/text/x-niftygui+xml/Actions",
+ id =
+ @ActionID(category = "Edit", id = "org.openide.actions.CopyAction"),
+ position = 400,
+ separatorAfter = 500),
+ @ActionReference(
+ path = "Loaders/text/x-niftygui+xml/Actions",
+ id =
+ @ActionID(category = "Edit", id = "org.openide.actions.DeleteAction"),
+ position = 600),
+ @ActionReference(
+ path = "Loaders/text/x-niftygui+xml/Actions",
+ id =
+ @ActionID(category = "System", id = "org.openide.actions.RenameAction"),
+ position = 700,
+ separatorAfter = 800),
+ @ActionReference(
+ path = "Loaders/text/x-niftygui+xml/Actions",
+ id =
+ @ActionID(category = "System", id = "org.openide.actions.SaveAsTemplateAction"),
+ position = 900,
+ separatorAfter = 1000),
+ @ActionReference(
+ path = "Loaders/text/x-niftygui+xml/Actions",
+ id =
+ @ActionID(category = "System", id = "org.openide.actions.FileSystemAction"),
+ position = 1100,
+ separatorAfter = 1200),
+ @ActionReference(
+ path = "Loaders/text/x-niftygui+xml/Actions",
+ id =
+ @ActionID(category = "System", id = "org.openide.actions.ToolsAction"),
+ position = 1300),
+ @ActionReference(
+ path = "Loaders/text/x-niftygui+xml/Actions",
+ id =
+ @ActionID(category = "System", id = "org.openide.actions.PropertiesAction"),
+ position = 1400)
+})
+public class NiftyGuiDataObject extends MultiDataObject {
public NiftyGuiDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
super(pf, loader);
- lookup = new ProxyLookup(getCookieSet().getLookup(), new AbstractLookup(getLookupContents()));
+ registerEditor("text/x-niftygui+xml", true);
findAssetManager();
}
- protected void findAssetManager() {
+ protected final void findAssetManager() {
FileObject file = getPrimaryFile();
ProjectManager pm = ProjectManager.getDefault();
while (file != null) {
@@ -44,7 +107,7 @@ public class NiftyGuiDataObject extends XmlMultiViewDataObject {
if (project != null) {
ProjectAssetManager mgr = project.getLookup().lookup(ProjectAssetManager.class);
if (mgr != null) {
- getLookupContents().add(mgr);
+ this.getCookieSet().assign(mgr.getClass(),mgr);
return;
}
}
@@ -56,34 +119,27 @@ public class NiftyGuiDataObject extends XmlMultiViewDataObject {
}
}
- @Override
- public Lookup getLookup() {
- return lookup;
- }
-
- public InstanceContent getLookupContents() {
- return lookupContents;
- }
-
@Override
protected Node createNodeDelegate() {
DataNode node = new DataNode(this, Children.LEAF, getLookup());
node.setIconBaseWithExtension("com/jme3/gde/gui/Computer_File_043.gif");
return node;
}
-
+
@Override
- protected DesignMultiViewDesc[] getMultiViewDesc() {
- if (getLookup().lookup(ProjectAssetManager.class) == null) {
- return new DesignMultiViewDesc[]{};
- } else {
-
- return new DesignMultiViewDesc[]{new PreviewView(this, TYPE_TOOLBAR)};
- }
+ protected int associateLookup() {
+ return 1;
}
- @Override
- protected String getPrefixMark() {
- return "Nifty";
+ @MultiViewElement.Registration(
+ displayName = "#LBL_NiftyGui_EDITOR",
+ iconBase = "com/jme3/gde/gui/Computer_File_043.gif",
+ mimeType = "text/x-niftygui+xml",
+ persistenceType = TopComponent.PERSISTENCE_ONLY_OPENED,
+ preferredID = "NiftyGui",
+ position = 1000)
+ @Messages("LBL_NiftyGui_EDITOR=XML")
+ public static MultiViewEditorElement createEditor(Lookup lkp) {
+ return new MultiViewEditorElement(lkp);
}
}
diff --git a/sdk/jme3-gui/src/com/jme3/gde/gui/NiftyGuiVisualElement.form b/sdk/jme3-gui/src/com/jme3/gde/gui/NiftyGuiVisualElement.form
new file mode 100644
index 000000000..add7a2637
--- /dev/null
+++ b/sdk/jme3-gui/src/com/jme3/gde/gui/NiftyGuiVisualElement.form
@@ -0,0 +1,29 @@
+
+
+
diff --git a/sdk/jme3-gui/src/com/jme3/gde/gui/NiftyGuiVisualElement.java b/sdk/jme3-gui/src/com/jme3/gde/gui/NiftyGuiVisualElement.java
new file mode 100644
index 000000000..e779b8ee7
--- /dev/null
+++ b/sdk/jme3-gui/src/com/jme3/gde/gui/NiftyGuiVisualElement.java
@@ -0,0 +1,263 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.jme3.gde.gui;
+
+import com.jme3.gde.core.assets.ProjectAssetManager;
+import com.jme3.gde.core.scene.SceneApplication;
+import de.lessvoid.nifty.Nifty;
+import jada.ngeditor.controller.GUIEditor;
+import jada.ngeditor.guiviews.DND.PaletteDropTarget;
+import jada.ngeditor.guiviews.DND.TrasferHandling;
+import jada.ngeditor.guiviews.J2DNiftyView;
+import jada.ngeditor.model.elements.GLayer;
+import jada.ngeditor.model.exception.NoProductException;
+import java.awt.Dimension;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.concurrent.Callable;
+import javax.swing.Action;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JToolBar;
+import javax.xml.bind.JAXBException;
+import javax.xml.parsers.ParserConfigurationException;
+import org.netbeans.core.spi.multiview.CloseOperationState;
+import org.netbeans.core.spi.multiview.MultiViewElement;
+import org.netbeans.core.spi.multiview.MultiViewElementCallback;
+import org.openide.awt.UndoRedo;
+import org.openide.util.Exceptions;
+import org.openide.util.Lookup;
+import org.openide.util.NbBundle.Messages;
+import org.openide.windows.TopComponent;
+import org.xml.sax.SAXException;
+
+@MultiViewElement.Registration(
+ displayName = "#LBL_NiftyGui_VISUAL",
+ iconBase = "com/jme3/gde/gui/Computer_File_043.gif",
+ mimeType = "text/x-niftygui+xml",
+ persistenceType = TopComponent.PERSISTENCE_NEVER,
+ preferredID = "NiftyGuiVisual",
+ position = 2000)
+@Messages("LBL_NiftyGui_VISUAL=Visual")
+public final class NiftyGuiVisualElement extends JPanel implements MultiViewElement {
+
+ private NiftyGuiDataObject obj;
+ private JToolBar toolbar = new JToolBar();
+ private transient MultiViewElementCallback callback;
+ private GUIEditor editor;
+ private final Nifty nifty;
+ private final J2DNiftyView view;
+ private final JComboBox layers = new JComboBox();
+
+ public NiftyGuiVisualElement(Lookup lkp) {
+ obj = lkp.lookup(NiftyGuiDataObject.class);
+ assert obj != null;
+ initComponents();
+ view = new J2DNiftyView(800, 600);
+ view.init();
+ this.scrollArea.getViewport().addChangeListener(view);
+ this.scrollArea.setViewportView(view);
+ TrasferHandling tranf = new TrasferHandling();
+ PaletteDropTarget tmp = new PaletteDropTarget();
+ editor = new GUIEditor();
+ nifty = view.getNifty();
+ view.setTransferHandler(tranf);
+ view.setDropTarget(tmp);
+ editor.addObserver(view);
+ editor.addObserver(tranf);
+ editor.addObserver(tmp);
+ this.createToolbar();
+ }
+ /**
+ * Old code
+ * @author normenhansen
+ */
+ private void createToolbar() {
+ toolbar.setPreferredSize(new Dimension(10000, 24));
+ toolbar.setMaximumSize(new Dimension(10000, 24));
+ toolbar.setFloatable(false);
+ JComboBox comboBox = new JComboBox(new String[]{"640x480", "480x800", "800x480", "800x600", "1024x768", "1280x720"});
+ comboBox.addItemListener(new ItemListener() {
+
+ public void itemStateChanged(ItemEvent e) {
+ String string = (String) e.getItem();
+ if ("640x480".equals(string)) {
+ view.setResoltion(640, 480);
+ } else if ("1024x768".equals(string)) {
+ view.setResoltion(1024, 768);
+ } else if ("1280x720".equals(string)) {
+ view.setResoltion(1280, 720);
+ } else if ("800x600".equals(string)) {
+ view.setResoltion(800, 600);
+ } else if ("800x480".equals(string)) {
+ view.setResoltion(800, 480);
+ } else if ("480x800".equals(string)) {
+ view.setResoltion(480, 800);
+ } else {
+ view.setResoltion(800, 600);
+ }
+ }
+ });
+ toolbar.add(comboBox);
+ comboBox.setSelectedItem("800x600");
+ layers.addItemListener(new ItemListener() {
+
+ public void itemStateChanged(ItemEvent e) {
+ GLayer item = (GLayer) e.getItem();
+ editor.selectElement(item);
+ }
+ });
+ toolbar.add(layers);
+ }
+ @Override
+ public String getName() {
+ return "NiftyGuiVisualElement";
+ }
+
+ /**
+ * 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.
+ */
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ scrollArea = new javax.swing.JScrollPane();
+
+ setLayout(new java.awt.BorderLayout());
+ add(scrollArea, java.awt.BorderLayout.CENTER);
+ }// //GEN-END:initComponents
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JScrollPane scrollArea;
+ // End of variables declaration//GEN-END:variables
+ @Override
+ public JComponent getVisualRepresentation() {
+ return this;
+ }
+
+ @Override
+ public JComponent getToolbarRepresentation() {
+ return toolbar;
+ }
+
+ @Override
+ public Action[] getActions() {
+ return new Action[0];
+ }
+
+ @Override
+ public Lookup getLookup() {
+ return obj.getLookup();
+ }
+ /**
+ * Raw implementation , just to prototype the editor
+ */
+ @Override
+ public void componentOpened() {
+ try {
+ String path = this.obj.getPrimaryFile().getPath();
+ ProjectAssetManager mgr = this.getLookup().lookup(ProjectAssetManager.class);
+ String assetPath = mgr.getAssetFolder().getPath();
+ this.editor.createNewGui(nifty,new File(path),new File(assetPath));
+ Collection layers1 = this.editor.getGui().getLayers();
+ DefaultComboBoxModel model = new DefaultComboBoxModel(layers1.toArray(new GLayer[0]));
+ layers.setModel(model);
+ layers.setSelectedItem(this.editor.getCurrentLayer());
+ } catch (ParserConfigurationException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (JAXBException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (ClassNotFoundException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (NoProductException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (SAXException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (Exception ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+
+ @Override
+ public void componentClosed() {
+ }
+ /**
+ * Raw implementation , just to prototype the editor
+ */
+ @Override
+ public void componentShowing() {
+ try {
+ String path = this.obj.getPrimaryFile().getPath();
+ ProjectAssetManager mgr = this.getLookup().lookup(ProjectAssetManager.class);
+ String assetPath = mgr.getAssetFolder().getPath();
+ this.editor.createNewGui(nifty,new File(path),new File(assetPath));
+ Collection layers1 = this.editor.getGui().getLayers();
+ DefaultComboBoxModel model = new DefaultComboBoxModel(layers1.toArray(new GLayer[0]));
+ layers.setModel(model);
+ layers.setSelectedItem(this.editor.getCurrentLayer());
+ } catch (ParserConfigurationException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (JAXBException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (ClassNotFoundException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (IOException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (NoProductException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (SAXException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (Exception ex) {
+ Exceptions.printStackTrace(ex);
+ }
+
+ }
+ /**
+ * Raw implementation , just to prototype the editor
+ */
+ @Override
+ public void componentHidden() {
+ String path = this.obj.getPrimaryFile().getPath();
+ try {
+ this.editor.saveGui(path);
+ } catch (FileNotFoundException ex) {
+ Exceptions.printStackTrace(ex);
+ } catch (JAXBException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ }
+
+ @Override
+ public void componentActivated() {
+ }
+
+ @Override
+ public void componentDeactivated() {
+ }
+
+ @Override
+ public UndoRedo getUndoRedo() {
+ return UndoRedo.NONE;
+ }
+
+ @Override
+ public void setMultiViewCallback(MultiViewElementCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public CloseOperationState canCloseElement() {
+ return CloseOperationState.STATE_OK;
+ }
+}
diff --git a/sdk/jme3-gui/src/com/jme3/gde/gui/OldNiftyGuiDataObject.java b/sdk/jme3-gui/src/com/jme3/gde/gui/OldNiftyGuiDataObject.java
new file mode 100644
index 000000000..7b06694e9
--- /dev/null
+++ b/sdk/jme3-gui/src/com/jme3/gde/gui/OldNiftyGuiDataObject.java
@@ -0,0 +1,89 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.jme3.gde.gui;
+
+import com.jme3.gde.core.assets.ProjectAssetManager;
+import com.jme3.gde.gui.multiview.PreviewView;
+import java.io.IOException;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectManager;
+import org.netbeans.modules.xml.multiview.DesignMultiViewDesc;
+import org.netbeans.modules.xml.multiview.XmlMultiViewDataObject;
+import org.openide.filesystems.FileObject;
+import org.openide.loaders.DataNode;
+import org.openide.loaders.DataObjectExistsException;
+import org.openide.loaders.MultiFileLoader;
+import org.openide.nodes.Node;
+import org.openide.nodes.Children;
+import org.openide.util.Lookup;
+import org.openide.util.lookup.AbstractLookup;
+import org.openide.util.lookup.InstanceContent;
+import org.openide.util.lookup.ProxyLookup;
+
+public class OldNiftyGuiDataObject extends XmlMultiViewDataObject {
+
+ private static final int TYPE_TOOLBAR = 0;
+ protected final Lookup lookup;
+ protected final InstanceContent lookupContents = new InstanceContent();
+
+ public OldNiftyGuiDataObject(FileObject pf, MultiFileLoader loader) throws DataObjectExistsException, IOException {
+ super(pf, loader);
+ lookup = new ProxyLookup(getCookieSet().getLookup(), new AbstractLookup(getLookupContents()));
+ findAssetManager();
+ }
+
+ protected void findAssetManager() {
+ FileObject file = getPrimaryFile();
+ ProjectManager pm = ProjectManager.getDefault();
+ while (file != null) {
+ if (file.isFolder() && pm.isProject(file)) {
+ try {
+ Project project = ProjectManager.getDefault().findProject(file);
+ if (project != null) {
+ ProjectAssetManager mgr = project.getLookup().lookup(ProjectAssetManager.class);
+ if (mgr != null) {
+ getLookupContents().add(mgr);
+ return;
+ }
+ }
+ } catch (IOException ex) {
+ } catch (IllegalArgumentException ex) {
+ }
+ }
+ file = file.getParent();
+ }
+ }
+
+ @Override
+ public Lookup getLookup() {
+ return lookup;
+ }
+
+ public InstanceContent getLookupContents() {
+ return lookupContents;
+ }
+
+ @Override
+ protected Node createNodeDelegate() {
+ DataNode node = new DataNode(this, Children.LEAF, getLookup());
+ node.setIconBaseWithExtension("com/jme3/gde/gui/Computer_File_043.gif");
+ return node;
+ }
+
+ @Override
+ protected DesignMultiViewDesc[] getMultiViewDesc() {
+ if (getLookup().lookup(ProjectAssetManager.class) == null) {
+ return new DesignMultiViewDesc[]{};
+ } else {
+
+ return new DesignMultiViewDesc[]{new PreviewView(this, TYPE_TOOLBAR)};
+ }
+ }
+
+ @Override
+ protected String getPrefixMark() {
+ return "Nifty";
+ }
+}
diff --git a/sdk/jme3-gui/src/com/jme3/gde/gui/layer.xml b/sdk/jme3-gui/src/com/jme3/gde/gui/layer.xml
deleted file mode 100644
index d83cea77c..000000000
--- a/sdk/jme3-gui/src/com/jme3/gde/gui/layer.xml
+++ /dev/null
@@ -1,154 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sdk/jme3-gui/src/com/jme3/gde/gui/multiview/NiftyPreviewPanel.java b/sdk/jme3-gui/src/com/jme3/gde/gui/multiview/NiftyPreviewPanel.java
index 36c721976..5f887b400 100644
--- a/sdk/jme3-gui/src/com/jme3/gde/gui/multiview/NiftyPreviewPanel.java
+++ b/sdk/jme3-gui/src/com/jme3/gde/gui/multiview/NiftyPreviewPanel.java
@@ -8,7 +8,7 @@ import com.jme3.audio.AudioRenderer;
import com.jme3.gde.core.assets.ProjectAssetManager;
import com.jme3.gde.core.scene.OffScenePanel;
import com.jme3.gde.core.scene.SceneApplication;
-import com.jme3.gde.gui.NiftyGuiDataObject;
+import com.jme3.gde.gui.OldNiftyGuiDataObject;
import com.jme3.renderer.ViewPort;
import de.lessvoid.nifty.Nifty;
import java.awt.Dimension;
@@ -50,7 +50,7 @@ import org.xml.sax.SAXParseException;
*/
public class NiftyPreviewPanel extends PanelView implements ErrorHandler {
- private NiftyGuiDataObject niftyObject;
+ private OldNiftyGuiDataObject niftyObject;
private OffScenePanel offPanel;
private Nifty nifty;
private Document doc;
@@ -62,7 +62,7 @@ public class NiftyPreviewPanel extends PanelView implements ErrorHandler {
private int width = 640, height = 480;
private ErrorPanel errors;
- public NiftyPreviewPanel(NiftyGuiDataObject niftyObject, ToolBarDesignEditor comp) {
+ public NiftyPreviewPanel(OldNiftyGuiDataObject niftyObject, ToolBarDesignEditor comp) {
super();
setRoot(Node.EMPTY);
this.niftyObject = niftyObject;
diff --git a/sdk/jme3-gui/src/com/jme3/gde/gui/multiview/PreviewToolbarElement.java b/sdk/jme3-gui/src/com/jme3/gde/gui/multiview/PreviewToolbarElement.java
index 80e9416e7..54ebf7999 100644
--- a/sdk/jme3-gui/src/com/jme3/gde/gui/multiview/PreviewToolbarElement.java
+++ b/sdk/jme3-gui/src/com/jme3/gde/gui/multiview/PreviewToolbarElement.java
@@ -5,7 +5,7 @@
package com.jme3.gde.gui.multiview;
-import com.jme3.gde.gui.NiftyGuiDataObject;
+import com.jme3.gde.gui.OldNiftyGuiDataObject;
import org.netbeans.modules.xml.multiview.ToolBarMultiViewElement;
import org.netbeans.modules.xml.multiview.ui.SectionView;
import org.netbeans.modules.xml.multiview.ui.ToolBarDesignEditor;
@@ -20,7 +20,7 @@ public class PreviewToolbarElement extends ToolBarMultiViewElement {
private ToolBarDesignEditor comp;
private NiftyPreviewPanel viewPanel;
- public PreviewToolbarElement(NiftyGuiDataObject dObj) {
+ public PreviewToolbarElement(OldNiftyGuiDataObject dObj) {
super(dObj);
// this.dObj = dObj;
comp = new ToolBarDesignEditor();
diff --git a/sdk/jme3-gui/src/com/jme3/gde/gui/multiview/PreviewView.java b/sdk/jme3-gui/src/com/jme3/gde/gui/multiview/PreviewView.java
index 989f14e42..db63baa03 100644
--- a/sdk/jme3-gui/src/com/jme3/gde/gui/multiview/PreviewView.java
+++ b/sdk/jme3-gui/src/com/jme3/gde/gui/multiview/PreviewView.java
@@ -4,7 +4,7 @@
*/
package com.jme3.gde.gui.multiview;
-import com.jme3.gde.gui.NiftyGuiDataObject;
+import com.jme3.gde.gui.OldNiftyGuiDataObject;
import org.netbeans.modules.xml.multiview.DesignMultiViewDesc;
/**
@@ -15,13 +15,13 @@ public class PreviewView extends DesignMultiViewDesc {
private int type;
- public PreviewView(NiftyGuiDataObject dObj, int type) {
+ public PreviewView(OldNiftyGuiDataObject dObj, int type) {
super(dObj, "Design");
this.type = type;
}
public org.netbeans.core.spi.multiview.MultiViewElement createElement() {
- NiftyGuiDataObject dObj = (NiftyGuiDataObject) getDataObject();
+ OldNiftyGuiDataObject dObj = (OldNiftyGuiDataObject) getDataObject();
return new PreviewToolbarElement(dObj);
}
diff --git a/sdk/jme3-gui/src/com/jme3/gde/gui/package-info.java b/sdk/jme3-gui/src/com/jme3/gde/gui/package-info.java
new file mode 100644
index 000000000..dc6ffbc7a
--- /dev/null
+++ b/sdk/jme3-gui/src/com/jme3/gde/gui/package-info.java
@@ -0,0 +1,10 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+@TemplateRegistrations(value = {@TemplateRegistration(folder = "GUI", displayName = "Empty Gui",content = "EmptyNiftyGui.xml"),
+@TemplateRegistration(folder = "GUI", displayName = "HelloJme",content = "NiftyGui.xml")})
+package com.jme3.gde.gui;
+
+import org.netbeans.api.templates.TemplateRegistration;
+import org.netbeans.api.templates.TemplateRegistrations;