13 Replies Latest reply on Nov 27, 2008 8:45 AM by kukeltje

    Create a custom Node in Graphical Designer

    pgros

      Hi i'm trying to add a custom node to the palette of the Designer.
      i changed the plugin.xml, created classes in
      org.jbpm.gd.jpdl.xml and org.jbpm.gd.jpdl.model

      the new node just extends "tasknode" without adding anything.. just for test

      now the new nodetype shows up in the palette but i can't drop it to the design field, and in the logfile of eclipse i get this error:


      java.lang.NullPointerException
      at org.jbpm.gd.common.notation.NotationMapping.getNotationElementId(Unknown Source)
      at org.jbpm.gd.common.editor.CreationFactory.getNewObject(Unknown Source)
      at org.eclipse.gef.requests.CreateRequest.getNewObject(CreateRequest.java:73)
      at org.jbpm.gd.common.policy.XYLayoutEditPolicy.initCreateCommand(Unknown Source)
      at org.jbpm.gd.common.policy.XYLayoutEditPolicy.getCreateCommand(Unknown Source)
      at org.eclipse.gef.editpolicies.LayoutEditPolicy.getCommand(LayoutEditPolicy.java:199)
      at org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy.getCommand(ConstrainedLayoutEditPolicy.java:154)
      at org.eclipse.gef.editparts.AbstractEditPart.getCommand(AbstractEditPart.java:473)
      at org.eclipse.gef.tools.TargetingTool.getCommand(TargetingTool.java:122)
      at org.eclipse.gef.tools.CreationTool.handleMove(CreationTool.java:239)
      at org.eclipse.gef.tools.AbstractTool.mouseMove(AbstractTool.java:1049)
      at org.eclipse.gef.EditDomain.mouseMove(EditDomain.java:252)
      at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouseMoved(DomainEventDispatcher.java:359)
      at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseMove(LightweightSystem.java:533)
      at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:199)
      at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
      at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
      at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
      at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
      at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
      at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
      at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
      at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
      at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
      at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
      at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
      at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
      at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
      at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
      at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
      at org.eclipse.equinox.launcher.Main.run(Main.java:1236)

        • 1. Re: Create a custom Node in Graphical Designer
          pgros

          is there any tutorial or documentation how to do this?

          • 2. Re: Create a custom Node in Graphical Designer
            kukeltje

            no...easiest for the current gpd is to look how the esb node is implemented.

            • 3. Re: Create a custom Node in Graphical Designer
              pgros

              hm thanks, coud you give me a clue if i have forgotten anything?

              -Edit plugin.xml

              -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\xml\EsbNodeMapper.java" for my node

              -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\model\EsbNode.java" for my node

              -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\properties\EsbGeneralConfigurationComposite.java"

              -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\properties\EsbConfigurationComposite.java

              -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\properties\EsbInputOutputConfigurationComposite.java

              -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\properties\EsbNodeSection.java

              • 4. Re: Create a custom Node in Graphical Designer
                pgros

                ok have done this and it works, thanks for the tip with esb node

                • 5. Re: Create a custom Node in Graphical Designer
                  pgros

                  found out this steps are needed, too

                  in "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\xml\ProcessDefinitionDomAdapter.java"

                  add lines in 2 functions

                  NODE_TYPES.put("textoutput", "node-element");

                  and
                  } else if ("textoutput".equals(type)) {
                  processDefinition.addNodeElement((AbstractNode)jpdlElement);


                  Delete
                  C:\eclipse\configuration\org.eclipse.core.runtime\.mainData.1
                  because it contains a copy of "plugin.xml" so the edited one is not loaded


                  ... now everything works fine

                  • 6. Re: Create a custom Node in Graphical Designer
                    kukeltje

                    Hahaha... you know what the funny thing is... I don't know anything about extending the GPD... The only and really the only answer I can give in these cases is: "Look at how the ESB node is done"..... any subsequent question is over my head.... lol

                    • 7. Re: Create a custom Node in Graphical Designer
                      kukeltje

                      ahhh... now I forgot something... would you like to make a small wiki pages of what you did? Would be neat... Or a blog entry somewhere that we can reference

                      • 8. Re: Create a custom Node in Graphical Designer
                        pgros

                        I made a small readme for myselfe, maybe it is useful for anybody:
                        the created node is " "

                        Install the Plugin

                        Modify plugin.xml

                        add


                        add




                        add





                        add



                        add

                        <!-- The property xmlElement="textoutput" stands for the node in the generated xml-processdefinition file -->



                        add




                        create the following classes and add them to "ui.jar" in the pluginfolder (extract the jar, add the .class files in the right directory, zip it back into a jar file)

                        -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\xml\EsbNodeMapper.java" for my node

                        -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\model\EsbNode.java" for my node <-- the fuction "createAction()" is called when the node is inserted, here custom actions can be added for example

                        -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\properties\EsbGeneralConfigurationComposite.java"

                        -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\properties\EsbConfigurationComposite.java

                        -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\properties\EsbInputOutputConfigurationComposite.java

                        -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\properties\EsbNodeSection.java




                        to "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\xml\ProcessDefinitionDomAdapter.java" add line as

                        NODE_TYPES.put("textoutput", "node-element");

                        and

                        } else if ("textoutput".equals(type)) {
                        processDefinition.addNodeElement((AbstractNode)jpdlElement);








                        Delete
                        C:\eclipse\configuration\org.eclipse.core.runtime\.mainData.1
                        because it contains a copy of "plugin.xml"

                        • 9. Re: Create a custom Node in Graphical Designer
                          pgros

                          damn html parser =)

                          I made a small readme for myselfe, maybe it is useful for anybody:
                          the created node is

                          Install the Plugin

                          Modify plugin.xml

                          add


                          add




                          add





                          add



                          add

                          <!-- The property xmlElement="textoutput" stands for the node in the generated xml-processdefinition file -->



                          add




                          create the following classes and add them to "ui.jar" in the pluginfolder (extract the jar, add the .class files in the right directory, zip it back into a jar file)

                          -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\xml\EsbNodeMapper.java" for my node

                          -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\model\EsbNode.java" for my node <-- the fuction "createAction()" is called when the node is inserted, here custom actions can be added for example

                          -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\properties\EsbGeneralConfigurationComposite.java"

                          -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\properties\EsbConfigurationComposite.java

                          -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\properties\EsbInputOutputConfigurationComposite.java

                          -make a adapted version of "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\properties\EsbNodeSection.java




                          to "designer\jpdl\org.jbpm.gd.jpdl\src\org\jbpm\gd\jpdl\xml\ProcessDefinitionDomAdapter.java" add line as

                          NODE_TYPES.put("textoutput", "node-element");
                          and
                          } else if ("textoutput".equals(type)) {
                          processDefinition.addNodeElement((AbstractNode)jpdlElement);








                          Delete
                          C:\eclipse\configuration\org.eclipse.core.runtime\.mainData.*
                          because it contains a copy of "plugin.xml"

                          • 10. Re: Create a custom Node in Graphical Designer
                            pgros

                            mh, disable html doesn't work, where can i post it for example?

                            • 11. Re: Create a custom Node in Graphical Designer
                              pgros

                              mh disable html doesnt wokr, whre could i post it instead?

                              • 12. Re: Create a custom Node in Graphical Designer
                                pgros

                                and sorry for spamming.. didn't see the 2nd page

                                • 13. Re: Create a custom Node in Graphical Designer
                                  kukeltje

                                  put it in 'code' tags... see preview