Nifty Editor-Devlog #2

Hi all , here is the second devlog about nifty-editor plugin development !
The most important thing that I want to report to you all , is that the prototype is ready for testing ! . In these weeks I’ve added drag and drop of nifty-gui elements and controls . The most difficulty here was that netbeans wrapped the given Trasferable instance in a provider that hides to me what was the real problem . Now it works well but in the future could be improved a bit. Also I worked in stand alone version to add the mandatory feature of cut/copy/paste elements . It needs a whole refactor but I proved to make it work in my experimental branch , so you need to wait until next devlog to test it . The refactoring will bring do&undo feature an other must in a editor. Another thing I’ve worked on is a little editor for imagemode attribute in nifty-elements , it’s quite rudimental but It could speed up the work to make a real cool gui without a lot of effort . For those who don’t know what imagemode is , it’s an attribute that tell to nifty how the image will be render this includes sprite mode , ninepatch mode , repeat mode and subImage mode ( render only an area of an image) .

Finally I used some of my time to improve nifty-gui , maybe you are interested with this , you can look at my pull requests for the details on my github profile. I figured also that in the future I really need to touch the nifty-style system because it’s not so extensible on the final user side and this makes hard to implement a nice editor for controls / elements. That’s all what I’ve done so far .

Try the prototype by downloading it here . To install simply go to ools->PlugIns->Downloaded Tab->Add Plugins . And select the path to the downloaded file .
Some Important Notes : change from Xml view to Visual and viceversa will cause read/write operation so it could be slow ( even if I didn’t notice anything ) . Some elements are not supported by editor and if you go back to your xml file after you edit it from Desing tab they will be deleted . I know this sucks but of course in the future all the elements will be supported and this bug will fly away . You can modify the shape of the elements add them and remove . Properties editing is not supported yet but you can easy use the xml save it and then see the changes in the Visual tab . To move trough you screens you must select a layer in that screen using the combo box in the toolbar .

Well , about next two weeks I’ll be little busy with exams , even if I hate Physic exams, I must pass them -.-" . So the development could be a little slower but since the hard work it almost done I’ll put some effort to make cut/paste do&undo features work . Finally I’ll spend some time also in bug fixing if you’ll find some one ( of course you do :smiley: ).

See you in the next devblog !

Bye , Cris :smiley:

6 Likes

With the current stable version of the SDK I get this exception when trying to open a file:

[java]java.lang.IllegalStateException: Cannot create factory for com.jme3.gde.gui.NiftyGuiDataObject@51cf5e69[/Users/normenhansen/jMonkeyProjects/PowerMonkey/assets/Interface/GameUI.xml@fa47ff44:21029201]
at org.netbeans.modules.openide.loaders.SimpleES.createPane(SimpleES.java:109)
at org.openide.text.CloneableEditorSupport.createCloneableTopComponent(CloneableEditorSupport.java:1442)
at org.openide.windows.CloneableOpenSupport.openCloneableTopComponent(CloneableOpenSupport.java:200)
at org.openide.windows.CloneableOpenSupport$1.run(CloneableOpenSupport.java:101)
at org.openide.util.Mutex.doEvent(Mutex.java:1343)
at org.openide.util.Mutex.writeAccess(Mutex.java:457)
at org.openide.windows.CloneableOpenSupport.open(CloneableOpenSupport.java:98)
at org.openide.text.CloneableEditorSupport.open(CloneableEditorSupport.java:505)
at org.openide.awt.ActionDefaultPerfomer.actionPerformed(ActionDefaultPerfomer.java:70)
at org.openide.awt.ContextAction$Performer.actionPerformed(ContextAction.java:226)
at org.openide.awt.ContextManager.actionPerformed(ContextManager.java:257)
at org.openide.awt.ContextAction.actionPerformed(ContextAction.java:109)
at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:93)
at org.openide.util.actions.ActionInvoker.doPerformAction(ActionInvoker.java:116)
at org.openide.util.actions.ActionInvoker.invokeAction(ActionInvoker.java:99)
at org.openide.awt.GeneralAction$BaseDelAction.actionPerformed(GeneralAction.java:234)
at org.openide.explorer.view.TreeView$PopupSupport.mouseClicked(TreeView.java:1625)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:270)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:269)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:269)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:269)
at java.awt.Component.processMouseEvent(Component.java:6508)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
at java.awt.Component.processEvent(Component.java:6270)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4501)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:708)
at java.awt.EventQueue$4.run(EventQueue.java:706)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Caused by: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
at org.openide.loaders.MultiDOEditor.createMultiViewPane(MultiDOEditor.java:101)
at org.openide.loaders.MultiDOEditor.call(MultiDOEditor.java:108)
at org.openide.loaders.MultiDOEditor.call(MultiDOEditor.java:60)
at org.netbeans.modules.openide.loaders.SimpleES.createPane(SimpleES.java:107)
… 52 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.openide.loaders.MultiDOEditor.createMultiViewPane(MultiDOEditor.java:99)
… 55 more
Caused by: java.lang.NullPointerException: displayName attribute not specified for com.jme3.gde.gui.NiftyGuiDataObject
at org.netbeans.core.spi.multiview.MultiViewFactory$MapMVD.get(MultiViewFactory.java:379)
at org.netbeans.core.spi.multiview.MultiViewFactory$MapMVD.getDisplayName(MultiViewFactory.java:397)
at org.netbeans.core.multiview.TabsComponent.createButton(TabsComponent.java:213)
at org.netbeans.core.multiview.TabsComponent.setModel(TabsComponent.java:127)
at org.netbeans.core.multiview.MultiViewPeer.setMimeLookup(MultiViewPeer.java:166)
at org.netbeans.core.multiview.MultiViewCloneableTopComponent.setMimeLookup(MultiViewCloneableTopComponent.java:96)
at org.netbeans.core.api.multiview.MultiViews.createCloneableMultiView(MultiViews.java:119)
… 60 more[/java]

Same with the current git development version…

Somehow the build was corrupted , it didn’t fine del bundle.properties . Try again and tell me if this build works.

1 Like
@relucri said: Somehow the build was corrupted , it didn't fine del bundle.properties . Try again and tell me if this build works.

Now it works, awesome work! The palette already works, I can drag&drop stuff into the gui view :slight_smile: The properties window doesn’t show anything when I select the objects yet though.

Edit: Oh and btw, undo/redo functions are built into the NetBeans platform, maybe check how you can properly integrate your system and theirs.

Nice to hear that! :slight_smile: . About properties yes they are not still integrated because this feature depends to the refactor that I’m doing ( something about how events are generated in nifty-editor) . For undo/redo I’m bit docomented about that I think that I can simply use the platform provided UndoManger and the works will be done :slight_smile: the hard part is to rewrite my controller to use command pattern ( or maybe just wrap it in command classes ) . Thanks for your feedback ! Do you notice something while switching between xml and desing view ? or is it fast as on my system? . By the way I think that my icons are pretty bad :smiley: I notice that now :smiley: .

I didn’t see any significant slowdown when switching.

Played a bit more with the editor, its really a new era in jME GUI, I’ll integrate it in the SDK as soon as theres stable versions out ^^

@normen said: Played a bit more with the editor, its really a new era in jME GUI, I'll integrate it in the SDK as soon as theres stable versions out ^^

Thanks for your kind words! I’m honored :smiley: . Now I have some problems with nodes and property sheets , but I’ll explain this better on Soc google groups . About the integration in the SDK it should not so difficult since I’m working on your code and as far I know it should be already in the SDK ,isn’t it ? . I’ll send a pull request and then a simple merge should do the job :smiley: .Now my forked JME repo is a bit messed since I’ve tried to make it accepted in the new plug-in system , but after I’ll make some order should be ready to send the pull request .

@relucri said: Thanks for your kind words! I'm honored :D . Now I have some problems with nodes and property sheets , but I'll explain this better on Soc google groups . About the integration in the SDK it should not so difficult since I'm working on your code and as far I know it should be already in the SDK ,isn't it ? . I'll send a pull request and then a simple merge should do the job :D .Now my forked JME repo is a bit messed since I've tried to make it accepted in the new plug-in system , but after I'll make some order should be ready to send the pull request .

Yeah, thats what I intended to imply :slight_smile: We can test with .nbm releases that you upload, just remember to up the version each time you make a test release, else one has to remove the plugin before installing the new version each time. Then when everything works nicely we can merge the changes and maybe even merge it to the current stable release.

1 Like