Thanks for your thoughts, Ramsey. 

I ended up taking a similar approach, but in the context of a subclass of 
ERDisplayNumber.

I just used a normal assignment:

100 : (pageConfiguration like 'InspectSurvey*' and propertyKey like 
'*_int_Frequency') => customFormatter = "session.frequencyFormatter" 
[com.webobjects.directtoweb.Assignment]
100 : (pageConfiguration like 'InspectSurvey*' and propertyKey like 
'*_int_Frequency') => componentName = "ERD2WDisplayNumberWithCustomFormatter" 
[com.webobjects.directtoweb.Assignment]

I created a customFormat binding which is populated in these method:

  public Format customFormatter() {
    return (Format) 
valueForKeyPath((String)d2wContext().valueForKey("customFormatter"));
  }

and displayed like so:

String1: WOString {
        value = objectPropertyValue;
        valueWhenEmpty = " ";
        formatter = customFormatter;
}

David

On 2011-09-23, at 10:22 AM, Ramsey Gurley wrote:

> I don't think there's anything like this in ERD2W unless someone added it.  
> 
> In R2D2W, I use a 'formatObject' RHS key binding with an 
> ERDDelayedObjectCreationAssignment. I use it for everything from joda to 
> crypto strings... but I've never used it for number formatting... although I 
> probably could.. pretty easily... and get rid of my edit/display number 
> component and just use edit/display string instead...
> 
> Hmmm (^_^)
> 
> Ramsey
> 
> On Sep 23, 2011, at 10:06 AM, David Holt wrote:
> 
>> Hi all,
>> 
>> I would like to use a custom number formatter object with D2W. 
>> 
>> The formatter binding in D2W accepts a String such as 
>> "###,###.##;0;-###,###.##"
>> 
>> What do I need to do to allow the formatter binding such as 
>> "session.customFormat" to be interpreted correctly by the D2WDisplayNumber 
>> component as a Format object rather than a String?
>> 
>> Thanks,
>> 
>> David _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/rgurley%40smarthealth.com
>> 
>> This email sent to [email protected]
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to