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 4.3 kB

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