this could help:
http://www.nabble.com/Dynamic-translators-tf1229928.html#a3255867
define your formatter as a bean and define the pattern using
message:date_pattern
greetings,
kris
Shing Hing Man
<[EMAIL PROTECTED]
> An
Tapestry users
17.07.2006 15:59 <[email protected]>
Kopie
Bitte antworten Thema
an Re: Generic application wide
"Tapestry users" formats
<[EMAIL PROTECTED]
pache.org>
It is not very pretty. You could try the following.
<component id="dateField" type="Insert">
<binding name="value" value="myclass.mydate"/>
<binding name="format">
ognl:new
java.text.SimpleDateFormat(getMessages().getMessage('format_date'))
</binding>
</component>
Shing
--- Murray Collingwood <[EMAIL PROTECTED]>
wrote:
> Hi all
>
> I'm a little new to Tapestry so I may be missing
> something, happy for anybody to point me in
> the right direction. I'm currently running Tapestry
> 4.0.2
>
> I want to standardise my date format for the entire
> application to dd/MM/yyyy. I decided that
> the best place to do this while allowing for
> internationalisation is to add it to my
> app.properties
> file. I added a few other formats while I was
> there, so I had something like the following:
>
> # Generic formats
> format_date=dd/MM/yyyy
> format_time=HH:mm
> format_pct0=##0%
> format_pct2=##0.##%
> format_currency=$#,###,##0.00
>
> Then I found that in order to display a date in this
> format I was writing 7 lines of java code for
> each page where a date was displayed (most of
> them)...along with 1 more line in the .page
> file for each date to be displayed.
>
> When I wanted to edit a date again using this format
> I had 4 lines per page and 1 line per
> field.
>
> This only provides the most basic of editing (I
> haven't allowed for any error processing yet)
> and while the number of lines is not large it did
> seem to me that there were different methods
> being employed to format the date for display and
> others for edit and validation.
>
> As I began, I may have missed something but it does
> seem a little messy at the moment.
> Does anybody have a better method of achieving this
> generic formating?
>
> Wouldn't it be nice if....I could specify formats in
> my message catalogue and then simply
> apply them to my components with a single line of
> code? eg
>
> a) displaying a date value:
>
> <component id="dateField" type="Insert">
> <binding name="value" value="myclass.mydate"/>
> <binding name="format"
> value="message:format_date"/>
> </component>
>
> b) editing a date value:
>
> <component id="dateField" type="DatePicker">
> <binding name="displayName"
> value="message:mydate_label"/>
> <binding name="value"
> value="myclass.mydate"/>
> <binding name="format"
> value="message:format_date"/>
> <binding name="validators"
> value="validators:required"/>
> </component>
>
>
> Is this possible?
>
>
> FOCUS Computing - web design
> Mob: 0415 24 26 24
> [EMAIL PROTECTED]
> http://www.focus-computing.com.au
>
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.10.1/389 -
> Release Date: 14/07/2006
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
Home page :
http://uk.geocities.com/matmsh/index.html
___________________________________________________________
All new Yahoo! Mail "The new Interface is stunning in its simplicity and
ease of use." - PC Magazine
http://uk.docs.yahoo.com/nowyoucan.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]