Getting Started Creating Workflow Editors on the NetBeans Platform
By Geertjan-Oracle on May 25, 2010
How to create the above from scratch:
- Create new NetBeans Platform application named "Demo Workflow".
- Create a new module within the application above, named "WorkflowUI", with code name base "org.demo.workflow.ui", together with a layer XML file.
- Create a new TopComponent via the "Window" wizard, in the "editor" position, with "Workflow" as class name prefix.
- Use the layer XML file to delete all the default menu items and toolbar buttons:
<folder name="Menu"> <file name="Edit_hidden"/> <file name="File_hidden"/> <file name="GoTo_hidden"/> <file name="Help_hidden"/> <file name="Tools_hidden"/> <file name="View_hidden"/> <file name="Window_hidden"/> </folder> <folder name="Toolbars"> <file name="Clipboard_hidden"/> <file name="File_hidden"/> <file name="Memory_hidden"/> <file name="UndoRedo_hidden"/> </folder>
- Apply these steps to remove the tab in the editor mode.
- Add Visual Library API to the application and set it as a dependency in the module.
- Copy this class into your module.
- Put this in the TopComponent constructor:
ConnectScene scene = new ConnectScene(); JScrollPane jScrollPane1 = new JScrollPane(); jScrollPane1.setViewportView(scene.createView()); add(jScrollPane1,BorderLayout.CENTER);
Run the application and you'll see the application shown at the start of this blog entry. Click in the scene to create new nodes and drag nodes to connect them.
Next steps, multiview editor and serialization (described elsewhere here, but will be added to this specific scenario in the coming days) and you're good to go.