Hello Sam, I've only got round to implemeting this today :( Too much to do ...
I couldn't find PatternTranslator. However, I used the following <bean name="alarmValueFormat" class="org.apache.tapestry.form.translator.NumberTranslator"> <set name="pattern" value="alarmNumberPattern"/> </bean> <component id="highThreshold" type="TextField"> <binding name="value" value="currentChannelSetup.meterAlarmSetup.highThresholdDouble"/> <binding name="translator" value="bean:alarmValueFormat"/> <binding name="displayName" value="literal:High Threshold"/> <binding name="disabled" value="(!currentChannelSetup.meterAlarmSetup.highFlowAlarmEnabled||channelDisabled)"/> </component> Where alarmNumberPattern is a getting (getAlarmNumberPattern) in my page class. On 21/11/06, Jabbar <[EMAIL PROTECTED]> wrote:
Thanks for that information I'll check out later. On 21/11/06, Sam Gendler <[EMAIL PROTECTED]> wrote: > Without testing it, I'm not entirely sure if you can use ognl in that > context, but you can definitely replace "value='translator:...'" with > "value='bean:...'" and then populate the bean with an OGNL expression > for the pattern property. Without referring to example code to ensure > I've got the syntax exactly correct, you can do something this: > > <bean id="numTrans" > class="org.apache.tapestry.form.translator.PatternTranslator"> > <binding name="pattern" value="ognl:numberFormat"/> > </bean> > > I think the documentation on the tap website for translators and > validators provides some examples along these lines. Either that, or > it is in in the pdf book. You can take a look at the javadocs for the > various translators in order to determine what parameters you can set. > > --sam > > On 11/20/06, Jabbar <[EMAIL PROTECTED]> wrote: > > Hello, > > > > I have a component definition for a textfield as follows > > > > <component id="highThreshold" type="TextField"> > > <binding name="value" > > value="currentChannelSetup.meterAlarmSetup.highThresholdDouble"/> > > > > <binding name="translator" > > value="translator:number,pattern=#0.0########,omitZero=false"/> > > > > </component> > > > > What I want to know is if it is possible to replace > > <binding name="translator" > > value="translator:number,pattern=#0.0########,omitZero=false"/> > > > > with <binding name="translator" > > value="translator:number,pattern=numberformat,omitZero=false"/> > > > > > > Note I have replaced pattern=#0.0######## with pattern=numberformat > > > > -- > > Thanks > > > > A Jabbar Azam > > > > --------------------------------------------------------------------- > > 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] > > -- Thanks A Jabbar Azam
-- Thanks A Jabbar Azam --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]