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

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