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

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