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

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