/plugins/ProjectViewer/tags/pv_2_0_2/projectviewer/vpt/package.html

# · HTML · 37 lines · 28 code · 9 blank · 0 comment · 0 complexity · b9d33dc3612ea202b5d8abd14c51675f MD5 · raw file

  1. <body><h3>Creating custom nodes.</h3>
  2. <p>It's possible to create new kinds of nodes to be inserted into a project.
  3. Although not tested, all the necessary functionality is available. To create
  4. a new kind of node, the following steps need to be taken:</p>
  5. <ul>
  6. <li>Create a new class that extends {@link projectviewer.vpt.VPTNode VPTNode}.
  7. It's highly recommended that the NodeType for your node is not one of the four
  8. constants defined in this class.</li>
  9. <li>Create a {@link projectviewer.persist.NodeHandler NodeHandler} to handle
  10. loading and saving of your node type. Don't forget to register the node handler
  11. in the <code>start()</code> method of your EditPlugin implementation.</li>
  12. <li>Create an {@link projectviewer.action.Action Action} that provides a way to
  13. import new nodes into a project. Optionally, you may use the code available in
  14. {@link projectviewer.importer.Importer Importer} to ease the importing of new
  15. nodes.</li>
  16. </ul>
  17. <p>These steps should be enough to create a new kind of node and make it be
  18. automatically persisted by the ProjectViewer plugin with the corresponding
  19. project. You may want to provide other actions to be executed on the given
  20. node (by creating more Action subclasses), or implement the
  21. {@link projectviewer.vpt.VPTNode#open() open()} method of the node to specify
  22. an action to be executed when the node receives a double click on the tree.
  23. When implementing <code>open()</code>, make sure to make the <code>close()</code>,
  24. <code>canOpen()</code> and <code>isOpened()</code> methods consistent with
  25. your implementation.</p>
  26. <p>Implementing new nodes should be considered highly experimental, so bear
  27. that in mind when going through this path.</p>
  28. </body>