You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

module.xml 3.7 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?xml version="1.0"?>
  2. <document>
  3. <properties>
  4. <index value="1"/>
  5. <author email="simeon@fitch.net">Simeon H. K. Fitch</author>
  6. <author email="christoph.wilhelms@t-online.de">Christoph Wilhelms</author>
  7. <title>Module HOW-TO</title>
  8. </properties>
  9. <body>
  10. <section name="Introduction">
  11. <p>The purpose of this document is to provide an overview of the
  12. basic steps one must undertake to add a new module to
  13. Antidote. Please see <a href="./design.html">The Antidote
  14. Design Overview</a> for information on what a module is and how it
  15. fits into Antidote. If you've already got all that, then read
  16. on!
  17. </p>
  18. <p>NB: <i>Please submit updates and criticisms to this, particularly
  19. areas that were unclear, missing, or difficult to follow.</i>
  20. </p>
  21. </section>
  22. <section name="Step by step">
  23. <h2>1) Specialize <code>org.apache.tools.ant.gui.core.AntModule</code></h2>
  24. <p>All modules must inherit from the <code>AntModule</code>
  25. class. This will probably irritate some of you, but it essentially
  26. enforces inheritance from <code>javax.swing.JComponent</code> and
  27. provides encapsulated handling of the <code>AppContext</code> instance
  28. that is so important to this class.
  29. </p>
  30. <p>Your module is required to implement the
  31. <code>AntModule.contextualize(AppContext)</code> method. The first
  32. thing this method should do is call
  33. <code>AntModule.setContext(AppContext)</code>, and then it is safe for
  34. it to begin constructing its display, using whatever resources it
  35. needs from the given <code>AppContext</code> instance. Think of this
  36. in a similar manner to <code>Applet.init()</code> or
  37. <code>Servlet.init()</code>.
  38. </p>
  39. <h2>2) Update
  40. <code>org/apache/tools/ant/gui/resources/antidote.properties</code></h2>
  41. <h3>2a) Externalize All Displayable Strings</h3>
  42. <p>All displayable strings must be externalized to the
  43. <code>antidote.properties</code> file, and looked up via the
  44. <code>AppContext.getResources()</code> method after the
  45. <code>AntModule.contextualize()</code> method has been called. Follow
  46. the naming convention currently used in the properties file and
  47. you should have to problems. This task should be done
  48. <b>during</b> development of your module. Under no circumstances
  49. should your module be submitted or committed without this task
  50. being completed. Remember that Antidote has an international
  51. audience.
  52. </p>
  53. <h3>2b) Add Module to List of Auto-Loaded Modules</h3>
  54. <p>Look for the properties with the format
  55. <code>org.apache.tools.ant.gui.Antidote.xxx.modules</code> where
  56. <code>xxx</code> is one of {left | right | top | bottom}. Depending on
  57. where you want your module to appear, and the order that you want
  58. it to appear in relationship to the other modules, add the class
  59. name of your module appropriately. If multiple modules are listed
  60. for a single property (via a comma delimited list), then each
  61. module will have it's own tab in a <code>javax.swing.JTabbedPane</code>.
  62. </p>
  63. <p>NB:<i>This goofy way of constructing the main screen will probably
  64. change to something much more general (but not as general as, say
  65. <a href="http://www.alphaworks.ibm.com/tech/bml">BML</a>).</i>
  66. </p>
  67. <h2>Run it!</h2>
  68. <p>That should be all you need to do, at least to get your module
  69. plugged in. Check out the source code for
  70. <code>ProjectNavigator</code> and <code>PropertyEditor</code> for module
  71. examples that use the various facilities of the Antidote
  72. framework.
  73. </p>
  74. </section>
  75. </body>
  76. </document>