John McNally wrote:
>
> It was said at the summit that Collab.net had developed some helper classes
> to compensate for the limited functionality in WebMacro templates. Are
> these available in Joist or elsewhere? I took a look, but did not find the
> type of thing I was envisioning.
>
> For example:
>
> class Util
> {
> public boolean greaterThan(int i, int j)
> {
> return i > j;
> }
> public boolean greaterEqual(int i, int j)
> {
> return i >= j;
> }
>
> ...
>
> }
>
> These could then be used in a template:
>
> #if ( $util.greaterThan($list.length(), 5) )
> {
> <br>
> }
>
> Or something like the above (I am not sure if it is valid WM). I am hoping
> to find some number formatting functions, etc. already written.
>
> Can anyone point me to a location?
Sure thing John. The class that contains the functionality demonstrated
by your above example is defined in
joist/java/org/joist/util/Compare.java. I don't remember off hand what
other helpers classes are available.
Also of note in your WebMacro example is the fact that the second
parameter passed to your greaterThan function will be passed as a
String, rather than an int. I don't believe that WebMacro currently
handles primitives (only Objects). Anything that it does not recognize
as an Object in the WebContext will be considered to be of type String.
The methods in the Compare class take this into consideration, using
Strings as parameters and Integer.parseInt() to decipher the int value
of those Strings. :)
--
Daniel Rall <[EMAIL PROTECTED]>
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]