ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: Displaying the value in a Java class?
Date Fri, 10 Feb 2006 23:27:33 GMT

--- Rhino <rhino1@sympatico.ca> wrote:
[SNIP]
> Here is my task again:
> 
>  <antmenu title="Verify Employment History Format"
>   stylesheet="${resume.xml.dir}\resume.style"
>  
> image="${resume.xml.dir}\maximal.orange.129x30.jpg">
>   <label>The current value of the
> DESIRED_EMPLOYMENT_HISTORY_FORMAT constant 
> in the ResumeConstants class is: 
> ${DESIRED_EMPLOYMENT_HISTORY_FORMAT}.</label>
>   <label>If that value is satisfactory, press the
> Proceed button.</label>
>   <label>If the value is wrong, press the Abort
> button to stop the build. 
> Then, edit the value of the property in the
> ResumeConstants.java class and 
> run the build again.</label>
>   <link label="Proceed" target="jar"/>
>   <link label="Abort" target="abort"/>
>  </antmenu>
> 
> I think the answer to your question is that I am
> trying to display the 
> property via nested XML text, i.e. the label tag.
> I'm not sure how to pass 
> that same value to the AntMenu task as an attribute.
> And, if I did, how 
> would AntMenu know where to put the attribute, i.e
> where to display the 
> sentence that I want?
> 
> You can see the documentation for AntMenu at this
> page: 
> http://antforms.sourceforge.net/usageam.html
> 

Okay, having looked at this, including the source, 1)
AntForms needs to have its BaseType class extend
ProjectComponent and call
getProject().replaceProperties(text) whenever text is
added.  But that doesn't help you.  If you hate the
text box the <label> tag creates anyway, why don't you
bundle all the text you want into the title attribute
of the <antmenu>?  You can get line breaks with the
property ${line.separator}.  A handy trick is to,
early on, define a shorter property (I use "br"):

<property name="br" value="${line.separator}" />

Then you can do:

<antmenu title="Verify Employment History
Format${br}The current value of the
DESIRED_EMPLOYMENT_HISTORY_FORMAT constant 
 in the ResumeConstants class is: 
 ${DESIRED_EMPLOYMENT_HISTORY_FORMAT}.${br}If that
value is satisfactory, press the
 Proceed button.${br}If the value is wrong, press the
Abort button to stop the build.${br}
 Then, edit the value of the property in the
 ResumeConstants.java class and 
 run the build again."
 stylesheet="${resume.xml.dir}\resume.style"
 image="${resume.xml.dir}\maximal.orange.129x30.jpg">

   <link label="Proceed" target="jar"/>
   <link label="Abort" target="abort"/>
</antmenu>

something along those lines... you might put the title
in a file with a token defined where the variable part
goes, then load that file into a property filtering in
the property you've already set from your Java class,
just to make your poor task invocation look a little
more compact.

-Matt

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message