| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "strict.dtd"> |
| <HTML> |
| <HEAD> |
| <TITLE>Antidote New Module HOWTO</TITLE> |
| </HEAD> |
| |
| <BODY> |
| |
| <H1>Antidote New Module HOWTO</H1> |
| |
| <P>Version 0.1 (2000/12/18)</P> |
| |
| <P>Authors: |
| <A HREF="mailto:simeon@fitch.net">Simeon H.K. Fitch</A> |
| </P> |
| |
| <H2>Introduction</H2> |
| |
| <P>The purpose of this document is to provide an overview of the |
| basic steps one must undertake to add a new module to |
| Antidote. Please see <A HREF="design-overview.html">The Antidote |
| Design Overview</A> for information on what a module is and how it |
| fits into Antidote. If you've already got all that, then read |
| on!</P> |
| |
| <P>NB: <I>Please submit updates and criticisms to this, particularly |
| areas that were unclear, missing, or difficult to follow.</I></P> |
| |
| <H2>1) Specialize <TT>org.apache.tools.ant.gui.core.AntModule</TT></H2> |
| |
| <P>All modules must inherit from the <TT>AntModule</TT> |
| class. This will probably irritate some of you, but it essentially |
| enforces inheritance from <TT>javax.swing.JComponent</TT> and |
| provides encapsulated handling of the <TT>AppContext</TT> instance |
| that is so important to this class.</P> |
| |
| <P>Your module is required to implement the |
| <TT>AntModule.contextualize(AppContext)</TT> method. The first |
| thing this method should do is call |
| <TT>AntModule.setContext(AppContext)</TT>, and then it is safe for |
| it to begin constructing its display, using whatever resources it |
| needs from the given <TT>AppContext</TT> instance. Think of this |
| in a similar manner to <TT>Applet.init()</TT> or |
| <TT>Servlet.init()</TT>. |
| |
| <H2>2) Update |
| <TT>org/apache/tools/ant/gui/resources/antidote.properties</TT></H2> |
| |
| <H3>2a) Externalize All Displayable Strings</H3> |
| |
| <P>All displayable strings must be externalized to the |
| <TT>antidote.properties</TT> file, and looked up via the |
| <TT>AppContext.getResources()</TT> method after the |
| <TT>AntModule.contextualize()</TT> method has been called. Follow |
| the naming convention currently used in the properties file and |
| you should have to problems. This task should be done |
| <B>during</B> development of your module. Under no cercumstances |
| should your module be submitted or committed without this task |
| being completed. Remember that Antidote has an international |
| audience.</P> |
| |
| <H3>2b) Add Module to List of Auto-Loaded Modules</H3> |
| |
| <P>Look for the properties with the format |
| <TT>org.apache.tools.ant.gui.Antidote.xxx.modules</TT> where |
| <TT>xxx</TT> is one of {left | right | top | bottom}. Depending on |
| where you want your module to appear, and the order that you want |
| it to appear in relationship to the other modules, add the class |
| name of your module appropriately. If multiple modules are listed |
| for a single property (via a comma delimited list), then each |
| module will have it's own tab in a <TT>javax.swing.JTabbedPane</TT>. |
| |
| <P>NB:<I>This goofy way of constructing the main screen will probably |
| change to something much more general (but not as general as, say |
| <A HREF="http://www.alphaworks.ibm.com/tech/bml">BML</A>).</P> |
| |
| <H2>Run it!</H2> |
| <P>That should be all you need to do, at least to get your module |
| plugged in. Check out the source code for |
| <TT>ProjectNavigator</TT> and <TT>PropertyEditor</TT> for module |
| examples that use the various facilities of the Antidote |
| framework.</P> |
| |
| <HR> |
| <P ALIGN="center">Copyright © 2000 Apache Software Foundation. All |
| rights Reserved.</P> |
| |
| </BODY> |
| </HTML> |