You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Tim Colson <tc...@happysearch.com> on 2003/07/01 21:01:57 UTC

VelocityFormatter and other tools

Say folks -
  I've been around for a while, but didn't realize there is a
VelocityFormatter class in the core that has some format functionality.

The only docs seem to be javadoc right now, and one of the archive posts
seems to indicate that this class should move over into the Tools area.

Before posing anything for the velocity-developers, I'm interest in some
user feedback on this feature.

Do you use this formatter?
How did you find out about it?
Did you know it has a nifty little Alternator method?

Would it cause a lot of pain if this class was removed from the core and
placed into the tools package?

Assuming somebody (like me) were to write up documentation, what do you
think of the format Gabriel used here:
http://www.happysearch.com/velocity/tools/docs/generic/DateTool.html

Too technical? Just right?

Would you find it useful to have separate User and Developer guides for
tools?

Also just curious, would you prefer a tool that 'acts upon a data
item' or a wrapper that 'wraps the data item'?
Ex. Using a tool that acts on a data item
context.put("formatTool", new VelocityFormatter());
context.put("start_date", record.getStartDate());

Template
$formatterTool.formatShortDate($start_date)

Or using a wrapper called Formatter...
context.put("start_date", new Formatter(record.getStartDate()) );

Template
$start_date = which defaults to getShortDate(), or whatever the
Formatter.setDefaultFormat(SimpleDateFormat.SHORT) is set to
$start_date.LONG() = which calls getLONG()
$start_date.xxxx = which calls whatever additional stuff the formatter can
do



Cheers,
Timo




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


Re: VelocityFormatter and other tools

Posted by Serge Knystautas <se...@lokitech.com>.
Tim Colson wrote:
> Do you use this formatter?

Yes, well used to... some methods weren't null-safe, so I copied the 
code and made the mods and use a local version.

> How did you find out about it?

Just learning about Velocity, came across it in the JavaDoc.

> Did you know it has a nifty little Alternator method?

Yeah, it has a lot of neat stuff.

> Would it cause a lot of pain if this class was removed from the core and
> placed into the tools package?

What's the motivation to move it?  It's quietly in its own package and 
happily bundled with core.

> Assuming somebody (like me) were to write up documentation, what do you
> think of the format Gabriel used here:
> http://www.happysearch.com/velocity/tools/docs/generic/DateTool.html
> 
> Too technical? Just right?

I think with the number of methods on this util object, this page would 
be somewhat hard to read.  It's not bad though.

> Would you find it useful to have separate User and Developer guides for
> tools?

What other "tools" are you thinking, i.e., is this more than just 
addressing a documentation gap of this widget that's in core?

> Also just curious, would you prefer a tool that 'acts upon a data
> item' or a wrapper that 'wraps the data item'?
> Ex. Using a tool that acts on a data item
> context.put("formatTool", new VelocityFormatter());
> context.put("start_date", record.getStartDate());
> 
> Template
> $formatterTool.formatShortDate($start_date)

I prefer this.

> Or using a wrapper called Formatter...
> context.put("start_date", new Formatter(record.getStartDate()) );

... to this.

-- 
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com/
p. 1.301.656.5501
e. sergek@lokitech.com



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


RE: VelocityFormatter and other tools

Posted by "Dhruva B. Reddy" <sl...@yahoo.com>.
--- Tim Colson <tc...@cisco.com> wrote:
> Dhruva -
> 
> > I found this particular class in the Javadoc API guide, on 
> > the Velocity website.
> Okay, thanks.
> 
> Seems like a handy tool that could use some exposure in the
> documentation.
> 
> > http://jakarta.apache.org/velocity/api/index.html
> > It already is in the tools package.
> Actually, not quite. That is currently in the
> org.apache.velocity.app.tools package which is still the 'core'
> velocity
> tree. 
> 
> There is truly a separate "tools" sub-project for things that are
> handy,
> but not a core feature of the template engine.

I see...

> 
> They live here:
> package org.apache.velocity.tools.*;


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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


RE: VelocityFormatter and other tools

Posted by Tim Colson <tc...@cisco.com>.
Dhruva -

> I found this particular class in the Javadoc API guide, on 
> the Velocity website.
Okay, thanks.

Seems like a handy tool that could use some exposure in the
documentation.

> http://jakarta.apache.org/velocity/api/index.html
> It already is in the tools package.
Actually, not quite. That is currently in the
org.apache.velocity.app.tools package which is still the 'core' velocity
tree. 

There is truly a separate "tools" sub-project for things that are handy,
but not a core feature of the template engine.

They live here:
package org.apache.velocity.tools.*;


Thanks,
Timo


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


Re: VelocityFormatter and other tools

Posted by "Dhruva B. Reddy" <sl...@yahoo.com>.
I found this particular class in the Javadoc API guide, on the Velocity
website.

http://jakarta.apache.org/velocity/api/index.html

It already is in the tools package.

--- Tim Colson <tc...@happysearch.com> wrote:
> Say folks -
>   I've been around for a while, but didn't realize there is a
> VelocityFormatter class in the core that has some format
> functionality.
> 
> The only docs seem to be javadoc right now, and one of the archive
> posts
> seems to indicate that this class should move over into the Tools
> area.
> 
> Before posing anything for the velocity-developers, I'm interest in
> some
> user feedback on this feature.
> 
> Do you use this formatter?
> How did you find out about it?
> Did you know it has a nifty little Alternator method?
> 
> Would it cause a lot of pain if this class was removed from the core
> and
> placed into the tools package?
> 
> Assuming somebody (like me) were to write up documentation, what do
> you
> think of the format Gabriel used here:
> http://www.happysearch.com/velocity/tools/docs/generic/DateTool.html
> 
> Too technical? Just right?
> 
> Would you find it useful to have separate User and Developer guides
> for
> tools?
> 
> Also just curious, would you prefer a tool that 'acts upon a data
> item' or a wrapper that 'wraps the data item'?
> Ex. Using a tool that acts on a data item
> context.put("formatTool", new VelocityFormatter());
> context.put("start_date", record.getStartDate());
> 
> Template
> $formatterTool.formatShortDate($start_date)
> 
> Or using a wrapper called Formatter...
> context.put("start_date", new Formatter(record.getStartDate()) );
> 
> Template
> $start_date = which defaults to getShortDate(), or whatever the
> Formatter.setDefaultFormat(SimpleDateFormat.SHORT) is set to
> $start_date.LONG() = which calls getLONG()
> $start_date.xxxx = which calls whatever additional stuff the
> formatter can
> do
> 
> 
> 
> Cheers,
> Timo
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> velocity-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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