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.html 14 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html lang="en">
  3. <!-- GENERATED FILE, DO NOT EDIT, EDIT THE XML FILE IN xdocs INSTEAD! -->
  4. <head>
  5. <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  6. <title>Apache Ant - Module HOW-TO</title>
  7. <link type="text/css" href="../../page.css" rel="stylesheet">
  8. <meta name="author" content="Simeon H. K. Fitch">
  9. <meta name="email" content="simeon@fitch.net">
  10. <meta name="author" content="Christoph Wilhelms">
  11. <meta name="email" content="christoph.wilhelms@t-online.de">
  12. </head>
  13. <body>
  14. <p class="navpath">
  15. <script src="../../breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
  16. </p>
  17. <table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0">
  18. <tr>
  19. <td bgcolor="#294563"><a href="http://ant.apache.org/"><img border="0" alt="Apache Ant site" src="../../images/group-logo.gif"></a></td><td width="100%" align="center" bgcolor="#294563"><a href="http://ant.apache.org/"><img alt="Apache Ant logo" border="0" src="../../images/project-logo.gif"></a></td><td valign="top" rowspan="2" bgcolor="#294563">
  20. <form target="_blank" onsubmit="q.value = query.value + ' site:ant.apache.org'" action="http://www.google.com/search" method="get">
  21. <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F">
  22. <tr>
  23. <td colspan="3"><img height="10" width="1" alt="" src="../../images/spacer.gif"></td>
  24. </tr>
  25. <tr>
  26. <td><img height="1" width="1" alt="" src="../../images/spacer.gif"></td><td nowrap="nowrap"><input name="q" type="hidden"><input size="15" id="query" type="text"><img height="1" width="5" alt="" src="../../images/spacer.gif"><input name="Search" value="Search" type="submit">
  27. <br>
  28. <font face="Arial, Helvetica, Sans-serif" size="2" color="white">
  29. the Apache Ant site
  30. </font></td><td><img height="1" width="1" alt="" src="../../images/spacer.gif"></td>
  31. </tr>
  32. <tr>
  33. <td><img alt="" border="0" height="10" width="9" src="../../images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../images/spacer.gif"></td><td><img alt="" border="0" height="10" width="9" src="../../images/search-right.gif"></td>
  34. </tr>
  35. </table>
  36. </form>
  37. </td><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../images/spacer.gif"></td>
  38. </tr>
  39. <tr>
  40. <td valign="bottom" bgcolor="#294563" colspan="2">
  41. <div class="tab">
  42. <table summary="tab bar" border="0" cellpadding="0" cellspacing="0">
  43. <tr>
  44. <td width="5"><img alt="" height="8" width="8" src="../../images/spacer.gif"></td><td valign="bottom">
  45. <table summary="non selected tab" style="height: 1.4em" border="0" cellpadding="0" cellspacing="0">
  46. <tr>
  47. <td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../../images/tab-left.gif"></td><td valign="middle" bgcolor="#B2C4E0"><a href="../../index.html"><font size="2" face="Arial, Helvetica, Sans-serif">Home</font></a></td><td valign="top" width="5" bgcolor="#B2C4E0"><img height="5" width="5" alt="" src="../../images/tab-right.gif"></td>
  48. </tr>
  49. </table>
  50. </td>
  51. <td width="8"><img alt="" height="5" width="8" src="images/spacer.gif"></td><td valign="bottom">
  52. <table summary="selected tab" style="height: 1.5em" border="0" cellpadding="0" cellspacing="0">
  53. <tr>
  54. <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b>Projects</b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../images/tabSel-right.gif"></td>
  55. </tr>
  56. </table>
  57. </td>
  58. </tr>
  59. </table>
  60. </div>
  61. </td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../images/spacer.gif"></td>
  62. </tr>
  63. <tr>
  64. <td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../images/spacer.gif"></td>
  65. </tr>
  66. </table>
  67. <table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0">
  68. <tr>
  69. <td valign="top">
  70. <table summary="menu" border="0" cellspacing="0" cellpadding="0">
  71. <tr>
  72. <td rowspan="3" valign="top">
  73. <table summary="blue line" border="0" cellpadding="0" cellspacing="0">
  74. <tr>
  75. <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../images/spacer.gif"></td>
  76. </tr>
  77. <tr>
  78. <td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif">&nbsp;</font></td>
  79. </tr>
  80. <tr>
  81. <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../images/spacer.gif"></td>
  82. </tr>
  83. </table>
  84. </td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../images/spacer.gif"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../images/spacer.gif"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F">
  85. <div class="menu"><ul>
  86. <li><font color="#CFDCED">Projects</font>
  87. <ul>
  88. <li>
  89. <a href="../../projects/index.html">Welcome</a>
  90. </li>
  91. </ul>
  92. </li>
  93. <li><font color="#CFDCED">Antidote</font>
  94. <ul>
  95. <li>
  96. <a href="../../projects/antidote/index.html">About Antidote</a>
  97. </li>
  98. <li>
  99. <a href="../../projects/antidote/design.html">Design Overview</a>
  100. </li>
  101. <li>
  102. <span class="sel"><font color="#ffcc00">Module HOW-TO</font></span>
  103. </li>
  104. </ul>
  105. </li>
  106. </ul></div>
  107. </td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../images/spacer.gif"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../images/spacer.gif"></td>
  108. </tr>
  109. <tr>
  110. <td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../images/spacer.gif"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../images/menu-right.gif"></td>
  111. </tr>
  112. <tr>
  113. <td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../images/spacer.gif"></td>
  114. </tr>
  115. </table>
  116. </td><td valign="top" width="100%">
  117. <table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0">
  118. <tr>
  119. <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../images/spacer.gif"></td>
  120. </tr>
  121. <tr>
  122. <td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../images/spacer.gif"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
  123. &nbsp;
  124. </font><img width="10" height="8" alt="" src="../../images/spacer.gif"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif">
  125. &nbsp;
  126. </font><img width="10" height="8" alt="" src="../../images/spacer.gif"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../images/spacer.gif"></td>
  127. </tr>
  128. <tr>
  129. <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../images/spacer.gif"></td>
  130. </tr>
  131. <tr>
  132. <td align="left" width="10"><img width="10" height="1" alt="" src="../../images/spacer.gif"></td><td align="left" width="100%">
  133. <div class="content">
  134. <table class="title">
  135. <tr>
  136. <td valign="middle">
  137. <h1>Module HOW-TO</h1>
  138. </td>
  139. </tr>
  140. </table>
  141. <h3 class="section">
  142. <a name="Introduction"></a>
  143. Introduction
  144. </h3>
  145. <p>The purpose of this document is to provide an overview of the
  146. basic steps one must undertake to add a new module to
  147. Antidote. Please see <a href="./design.html">The Antidote
  148. Design Overview</a> for information on what a module is and how it
  149. fits into Antidote. If you've already got all that, then read
  150. on!
  151. </p>
  152. <p>NB: <i>Please submit updates and criticisms to this, particularly
  153. areas that were unclear, missing, or difficult to follow.</i>
  154. </p>
  155. <h3 class="section">
  156. <a name="Step by step"></a>
  157. Step by step
  158. </h3>
  159. <h2>1) Specialize <code>org.apache.tools.ant.gui.core.AntModule</code></h2>
  160. <p>All modules must inherit from the <code>AntModule</code>
  161. class. This will probably irritate some of you, but it essentially
  162. enforces inheritance from <code>javax.swing.JComponent</code> and
  163. provides encapsulated handling of the <code>AppContext</code> instance
  164. that is so important to this class.
  165. </p>
  166. <p>Your module is required to implement the
  167. <code>AntModule.contextualize(AppContext)</code> method. The first
  168. thing this method should do is call
  169. <code>AntModule.setContext(AppContext)</code>, and then it is safe for
  170. it to begin constructing its display, using whatever resources it
  171. needs from the given <code>AppContext</code> instance. Think of this
  172. in a similar manner to <code>Applet.init()</code> or
  173. <code>Servlet.init()</code>.
  174. </p>
  175. <h2>2) Update
  176. <code>org/apache/tools/ant/gui/resources/antidote.properties</code></h2>
  177. <h3>2a) Externalize All Displayable Strings</h3>
  178. <p>All displayable strings must be externalized to the
  179. <code>antidote.properties</code> file, and looked up via the
  180. <code>AppContext.getResources()</code> method after the
  181. <code>AntModule.contextualize()</code> method has been called. Follow
  182. the naming convention currently used in the properties file and
  183. you should have to problems. This task should be done
  184. <b>during</b> development of your module. Under no circumstances
  185. should your module be submitted or committed without this task
  186. being completed. Remember that Antidote has an international
  187. audience.
  188. </p>
  189. <h3>2b) Add Module to List of Auto-Loaded Modules</h3>
  190. <p>Look for the properties with the format
  191. <code>org.apache.tools.ant.gui.Antidote.xxx.modules</code> where
  192. <code>xxx</code> is one of {left | right | top | bottom}. Depending on
  193. where you want your module to appear, and the order that you want
  194. it to appear in relationship to the other modules, add the class
  195. name of your module appropriately. If multiple modules are listed
  196. for a single property (via a comma delimited list), then each
  197. module will have it's own tab in a <code>javax.swing.JTabbedPane</code>.
  198. </p>
  199. <p>NB:<i>This goofy way of constructing the main screen will probably
  200. change to something much more general (but not as general as, say
  201. <a href="http://www.alphaworks.ibm.com/tech/bml">BML</a>).</i>
  202. </p>
  203. <h2>Run it!</h2>
  204. <p>That should be all you need to do, at least to get your module
  205. plugged in. Check out the source code for
  206. <code>ProjectNavigator</code> and <code>PropertyEditor</code> for module
  207. examples that use the various facilities of the Antidote
  208. framework.
  209. </p>
  210. </div>
  211. </td><td width="10"><img width="10" height="4" alt="" src="../../images/spacer.gif"></td>
  212. </tr>
  213. </table>
  214. </td>
  215. </tr>
  216. </table>
  217. <table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0">
  218. <tr>
  219. <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../images/spacer.gif"><a href="../../images/label.gif"></a><a href="../../images/page.gif"></a><a href="../../images/chapter.gif"></a><a href="../../images/chapter_open.gif"></a><a href="../../images/current.gif"></a><a href="/favicon.ico"></a></td>
  220. </tr>
  221. <tr>
  222. <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright &copy; 2000-2003&nbsp;The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!--
  223. document.write(" - "+"Last Published: " + document.lastModified);
  224. // --></script></font></td>
  225. </tr>
  226. </table>
  227. </body>
  228. </html>