Re: Boolean formatting

Daniel Dekany <[email protected]> Sat, 27 Apr 2013 17:17:37 +0200
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Just like in the case of numbers, the whole ApplicationDomainType
business works only if your data-model supports it. At least if those
values aren't all top-level values (in which case you can "cheat"),
you had to extend BeansWrapper (or DefaultObjectWrapper) so that it
will know which methods return what application-domain-type value.
That's why it will be seldom used if the template authors are, or
working with the application developers; you rather tell the template
authors to call this and that formatter methods for this and that kind
of values. But there are applications where the template authors are
end-users. So the application developers make an extra effort to add
this meta-information to the data-model one, and all the end-user will
automatically get the proper formatting. At least that's my idea
behind ApplicationDomainType.

As of the matter with booleans... ApplicationDomainType will
inevitably work for them, but ApplicationDomainType is not for
everyone (see above), while this boolean thing bugs everybody. So,
yes, I think I will add a setting to 2.3.20 which makes using ?string
optional after a boolean, as far as there was a default boolean format
specified. Until that, you have to write ${myBoolean?string}.

If all goes as planned (no natural disasters etc), 2.3.20 will be
released at the end of May.

-- 
Thanks,
 Daniel Dekany


Thursday, April 25, 2013, 2:25:25 PM, Smerek, Martin wrote:

> Hi Daniel,
>
> One thing slipped my mind. If you use
> ApplicationDomainTypeFormatter, you will lose boolean format when
> you use the model in expressions, e.g. ${!transaction.isBillable} or
> ${transaction. isBillable && customer.isActive}. In these cases,
> having global Boolean format seems to be really beneficial.
>
> Thanks,
> Martin
>
> -----Original Message-----
> From: Smerek, Martin 
> Sent: Thursday, April 25, 2013 2:13 PM
> To: FreeMarker-user
> Subject: RE: [FreeMarker-user] Boolean formatting
>
> Hi Daniel,
>
> Sorry for late response.
>
> Our standard format is Yes/No (for English). You are right that we
> could solve this using ApplicationDomainTypeFormatter, however, we
> think that introducing such a setting might be beneficial for other FreeMarker users too.
>
> Thank you very much,
> Martin
>
> -----Original Message-----
> From: Daniel Dekany [mailto:[email protected]]
> Sent: Wednesday, April 17, 2013 10:31 PM
> To: FreeMarker-user
> Subject: Re: [FreeMarker-user] Boolean formatting
>
> Tuesday, April 16, 2013, 3:35:58 PM, Smerek, Martin wrote:
>
>> Hi all,
>>
>> Even though FAQ
>> http://freemarker.sourceforge.net/docs/app_faq.html#faq_number_boolean 
>> _formatting says "Unlike numbers, booleans has no commonly accepted 
>> format, not even a common format within the same page.", there is 
>> commonly accepted format for Boolean in our app universe.
>
> For the common format, there's the "boolean_format" setting,
> however, AFAIR, it still demands a ?string after the boolean, only
> you don't have to add the format as parameter if the
> "boolean_format" was set. I suppose that's your problem here. And I
> guess FM is overly strict here, so maybe I should just allow this
> conversion without ?string, if the "boolean_format" was set. I
> wonder if it's backward-compatible though... probably it had to be
> yet another setting whose default only changes with 2.4 or so.
>
> OTOH... what the commonly accepted format is in your app? Because,
> just like with numbers, there's the problem that the proper format
> depends on the app-domain meaning of the boolean. Like for something
> maybe it's yes/no, for something else it's on/off. Then it's just
> another case that can be solved with ApplicationDomainTypeFormatter.
>
>> Would it be
>> possible to add configuration flag (in Configurable class) which would 
>> override current behavior (ending with an error) and allowed printing 
>> out Boolean directly according to specified boolean format?
>> Would anyone else find this helpful? 
>
>
>> Thanks,
>> Martin
>>
>>
>> NOTICE: This email and any attachments may contain confidential and 
>> proprietary information of NetSuite Inc. and is for the sole use of 
>> the intended recipient for the stated purpose. Any improper use or 
>> distribution is prohibited. If you are not the intended recipient, 
>> please notify the sender; do not review, copy or distribute; and 
>> promptly delete or destroy all transmitted information. Please note 
>> that all communications and information transmitted through this email 
>> system may be monitored by NetSuite or its agents and that all 
>> incoming email is automatically scanned by a third party spam and filtering service.
>
> --
> Thanks,
> Daniel Dekany
>
>
> ------------------------------------------------------------------------------
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for
> building apps and a phenomenal toolset for data science. Developers
> can use our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter 
> _______________________________________________
> FreeMarker-user mailing list
> [email protected] 
> https://lists.sourceforge.net/lists/listinfo/freemarker-user 
>
>
> NOTICE: This email and any attachments may contain confidential and
> proprietary information of NetSuite Inc. and is for the sole use of
> the intended recipient for the stated purpose. Any improper use or
> distribution is prohibited. If you are not the intended recipient,
> please notify the sender; do not review, copy or distribute; and
> promptly delete or destroy all transmitted information. Please note
> that all communications and information transmitted through this
> email system may be monitored by NetSuite or its agents and that all
> incoming email is automatically scanned by a third party spam and filtering service.


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr