You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Bruno Busco <br...@gmail.com> on 2010/08/31 17:57:35 UTC

default-value for display tag in form fields

Hi,
I need to show a default string (e.g. "None") in a field of a form of type
"list".
I was looking for something like...

<field name="usage" title="${uiLabelMap.WebtoolsUsage}" sort-field="true">
    <display default-value="${uiLabelMap.CommonNone}"/>
</field>

...but the display tag does not support the default-value.

Would it make sense to add it?

Thanks,
Bruno

Re: default-value for display tag in form fields

Posted by Jacques Le Roux <ja...@les7arts.com>.
As a reminder, I have created 
"Replace all other uses than Groovy (UEL and BSH) by Groovy in widgets and minilang" 
at https://issues.apache.org/jira/browse/OFBIZ-3948

Jacques

From: "Bruno Busco" <br...@gmail.com>
> Thank you guys.
> Done in trunk at  rev. 992441
> 
> -Bruno
> 
> 2010/9/1 Bruno Busco <br...@gmail.com>
> 
>> Thank you,
>> -Bruno
>>
>> 2010/9/1 Scott Gray <sc...@hotwaxmedia.com>
>>
>> I wasn't actually suggesting it my email, I was just lamenting the missing
>>> ?: operator.  But I admit I've wondered from time to time why we didn't just
>>> use groovy as our expression tool, with support for categories, operator
>>> overloading and closures, I can't really think of anything that UEL can do
>>> that groovy can't.
>>>
>>> Regards
>>> Scott
>>>
>>> On 1/09/2010, at 9:07 PM, Jacques Le Roux wrote:
>>>
>>> > From: "David E Jones" <de...@me.com>
>>> >> I agree, Groovy is not just way better than BSH, but also better than
>>> UEL too. It might be a bit of a pain to change now, but I
>>> >> don't know. While designing based on the idea of starting over I was
>>> planning on a move to "everything's Groovy" to use Groovy for
>>> >> all expressions, scriptlets, and inline scripts and scripts in separate
>>> files.
>>> >
>>> > Yes, I'd like it, more powerful, consistent and better syntax
>>> >
>>> > Jacques
>>> >
>>> >> Of course, that brings up the question... why not just use Grails where
>>> every artifact is a groovy script instead of having some
>>> >> artifacts as XML? Well, IMO for many things XML is easier and cleaner
>>> for both writing and reading/maintaining. If you don't like
>>> >> that, well, Grails isn't too bad as frameworks go... :)
>>> >>
>>> >> -David
>>> >>
>>> >>
>>> >> On Aug 31, 2010, at 6:51 PM, Scott Gray wrote:
>>> >>
>>> >>> Sounds fine to me.  As an alternative you can do something like this:
>>> >>> <display description="${empty usage ? uiLabelMap.CommonNone :
>>> usage}"/>
>>> >>> I know it's a bit verbose but it should also work.  "empty" is a UEL
>>> operator that works in a similar fashion to Groovy's "Truth"
>>> >>> boolean casting.
>>> >>>
>>> >>> Unfortunately UEL doesn't support groovy's elvis operator or it would
>>> be easier:
>>> >>> "${usage ?: uiLabelMap.CommonNone}"
>>> >>> or perhaps freemarker's default value operator:
>>> >>> "${usage!uiLabelMap.CommonNone}"
>>> >>>
>>> >>> Regards
>>> >>> Scott
>>> >>>
>>> >>> HotWax Media
>>> >>> http://www.hotwaxmedia.com
>>> >>>
>>> >>> On 1/09/2010, at 5:29 AM, Jacques Le Roux wrote:
>>> >>>
>>> >>>> Hi Bruno,
>>> >>>>
>>> >>>> In such case I handle the field with set and groovy before in the
>>> row-action. But yes, why not a default-value?
>>> >>>>
>>> >>>> Jacques
>>> >>>>
>>> >>>> From: "Bruno Busco" <br...@gmail.com>
>>> >>>>> Hi,
>>> >>>>> I need to show a default string (e.g. "None") in a field of a form
>>> of type
>>> >>>>> "list".
>>> >>>>> I was looking for something like...
>>> >>>>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}"
>>> sort-field="true">
>>> >>>>> <display default-value="${uiLabelMap.CommonNone}"/>
>>> >>>>> </field>
>>> >>>>> ...but the display tag does not support the default-value.
>>> >>>>> Would it make sense to add it?
>>> >>>>> Thanks,
>>> >>>>> Bruno
>>> >>>>>
>>> >>>>
>>> >>>
>>> >>
>>> >
>>> >
>>>
>>>
>>
>


Re: default-value for display tag in form fields

Posted by Bruno Busco <br...@gmail.com>.
Thank you guys.
Done in trunk at  rev. 992441

-Bruno

2010/9/1 Bruno Busco <br...@gmail.com>

> Thank you,
> -Bruno
>
> 2010/9/1 Scott Gray <sc...@hotwaxmedia.com>
>
> I wasn't actually suggesting it my email, I was just lamenting the missing
>> ?: operator.  But I admit I've wondered from time to time why we didn't just
>> use groovy as our expression tool, with support for categories, operator
>> overloading and closures, I can't really think of anything that UEL can do
>> that groovy can't.
>>
>> Regards
>> Scott
>>
>> On 1/09/2010, at 9:07 PM, Jacques Le Roux wrote:
>>
>> > From: "David E Jones" <de...@me.com>
>> >> I agree, Groovy is not just way better than BSH, but also better than
>> UEL too. It might be a bit of a pain to change now, but I
>> >> don't know. While designing based on the idea of starting over I was
>> planning on a move to "everything's Groovy" to use Groovy for
>> >> all expressions, scriptlets, and inline scripts and scripts in separate
>> files.
>> >
>> > Yes, I'd like it, more powerful, consistent and better syntax
>> >
>> > Jacques
>> >
>> >> Of course, that brings up the question... why not just use Grails where
>> every artifact is a groovy script instead of having some
>> >> artifacts as XML? Well, IMO for many things XML is easier and cleaner
>> for both writing and reading/maintaining. If you don't like
>> >> that, well, Grails isn't too bad as frameworks go... :)
>> >>
>> >> -David
>> >>
>> >>
>> >> On Aug 31, 2010, at 6:51 PM, Scott Gray wrote:
>> >>
>> >>> Sounds fine to me.  As an alternative you can do something like this:
>> >>> <display description="${empty usage ? uiLabelMap.CommonNone :
>> usage}"/>
>> >>> I know it's a bit verbose but it should also work.  "empty" is a UEL
>> operator that works in a similar fashion to Groovy's "Truth"
>> >>> boolean casting.
>> >>>
>> >>> Unfortunately UEL doesn't support groovy's elvis operator or it would
>> be easier:
>> >>> "${usage ?: uiLabelMap.CommonNone}"
>> >>> or perhaps freemarker's default value operator:
>> >>> "${usage!uiLabelMap.CommonNone}"
>> >>>
>> >>> Regards
>> >>> Scott
>> >>>
>> >>> HotWax Media
>> >>> http://www.hotwaxmedia.com
>> >>>
>> >>> On 1/09/2010, at 5:29 AM, Jacques Le Roux wrote:
>> >>>
>> >>>> Hi Bruno,
>> >>>>
>> >>>> In such case I handle the field with set and groovy before in the
>> row-action. But yes, why not a default-value?
>> >>>>
>> >>>> Jacques
>> >>>>
>> >>>> From: "Bruno Busco" <br...@gmail.com>
>> >>>>> Hi,
>> >>>>> I need to show a default string (e.g. "None") in a field of a form
>> of type
>> >>>>> "list".
>> >>>>> I was looking for something like...
>> >>>>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}"
>> sort-field="true">
>> >>>>> <display default-value="${uiLabelMap.CommonNone}"/>
>> >>>>> </field>
>> >>>>> ...but the display tag does not support the default-value.
>> >>>>> Would it make sense to add it?
>> >>>>> Thanks,
>> >>>>> Bruno
>> >>>>>
>> >>>>
>> >>>
>> >>
>> >
>> >
>>
>>
>

Re: default-value for display tag in form fields

Posted by Bruno Busco <br...@gmail.com>.
Thank you,
-Bruno

2010/9/1 Scott Gray <sc...@hotwaxmedia.com>

> I wasn't actually suggesting it my email, I was just lamenting the missing
> ?: operator.  But I admit I've wondered from time to time why we didn't just
> use groovy as our expression tool, with support for categories, operator
> overloading and closures, I can't really think of anything that UEL can do
> that groovy can't.
>
> Regards
> Scott
>
> On 1/09/2010, at 9:07 PM, Jacques Le Roux wrote:
>
> > From: "David E Jones" <de...@me.com>
> >> I agree, Groovy is not just way better than BSH, but also better than
> UEL too. It might be a bit of a pain to change now, but I
> >> don't know. While designing based on the idea of starting over I was
> planning on a move to "everything's Groovy" to use Groovy for
> >> all expressions, scriptlets, and inline scripts and scripts in separate
> files.
> >
> > Yes, I'd like it, more powerful, consistent and better syntax
> >
> > Jacques
> >
> >> Of course, that brings up the question... why not just use Grails where
> every artifact is a groovy script instead of having some
> >> artifacts as XML? Well, IMO for many things XML is easier and cleaner
> for both writing and reading/maintaining. If you don't like
> >> that, well, Grails isn't too bad as frameworks go... :)
> >>
> >> -David
> >>
> >>
> >> On Aug 31, 2010, at 6:51 PM, Scott Gray wrote:
> >>
> >>> Sounds fine to me.  As an alternative you can do something like this:
> >>> <display description="${empty usage ? uiLabelMap.CommonNone : usage}"/>
> >>> I know it's a bit verbose but it should also work.  "empty" is a UEL
> operator that works in a similar fashion to Groovy's "Truth"
> >>> boolean casting.
> >>>
> >>> Unfortunately UEL doesn't support groovy's elvis operator or it would
> be easier:
> >>> "${usage ?: uiLabelMap.CommonNone}"
> >>> or perhaps freemarker's default value operator:
> >>> "${usage!uiLabelMap.CommonNone}"
> >>>
> >>> Regards
> >>> Scott
> >>>
> >>> HotWax Media
> >>> http://www.hotwaxmedia.com
> >>>
> >>> On 1/09/2010, at 5:29 AM, Jacques Le Roux wrote:
> >>>
> >>>> Hi Bruno,
> >>>>
> >>>> In such case I handle the field with set and groovy before in the
> row-action. But yes, why not a default-value?
> >>>>
> >>>> Jacques
> >>>>
> >>>> From: "Bruno Busco" <br...@gmail.com>
> >>>>> Hi,
> >>>>> I need to show a default string (e.g. "None") in a field of a form of
> type
> >>>>> "list".
> >>>>> I was looking for something like...
> >>>>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}"
> sort-field="true">
> >>>>> <display default-value="${uiLabelMap.CommonNone}"/>
> >>>>> </field>
> >>>>> ...but the display tag does not support the default-value.
> >>>>> Would it make sense to add it?
> >>>>> Thanks,
> >>>>> Bruno
> >>>>>
> >>>>
> >>>
> >>
> >
> >
>
>

Re: default-value for display tag in form fields

Posted by Scott Gray <sc...@hotwaxmedia.com>.
I wasn't actually suggesting it my email, I was just lamenting the missing ?: operator.  But I admit I've wondered from time to time why we didn't just use groovy as our expression tool, with support for categories, operator overloading and closures, I can't really think of anything that UEL can do that groovy can't.

Regards
Scott

On 1/09/2010, at 9:07 PM, Jacques Le Roux wrote:

> From: "David E Jones" <de...@me.com>
>> I agree, Groovy is not just way better than BSH, but also better than UEL too. It might be a bit of a pain to change now, but I
>> don't know. While designing based on the idea of starting over I was planning on a move to "everything's Groovy" to use Groovy for
>> all expressions, scriptlets, and inline scripts and scripts in separate files.
> 
> Yes, I'd like it, more powerful, consistent and better syntax
> 
> Jacques
> 
>> Of course, that brings up the question... why not just use Grails where every artifact is a groovy script instead of having some
>> artifacts as XML? Well, IMO for many things XML is easier and cleaner for both writing and reading/maintaining. If you don't like
>> that, well, Grails isn't too bad as frameworks go... :)
>> 
>> -David
>> 
>> 
>> On Aug 31, 2010, at 6:51 PM, Scott Gray wrote:
>> 
>>> Sounds fine to me.  As an alternative you can do something like this:
>>> <display description="${empty usage ? uiLabelMap.CommonNone : usage}"/>
>>> I know it's a bit verbose but it should also work.  "empty" is a UEL operator that works in a similar fashion to Groovy's "Truth"
>>> boolean casting.
>>> 
>>> Unfortunately UEL doesn't support groovy's elvis operator or it would be easier:
>>> "${usage ?: uiLabelMap.CommonNone}"
>>> or perhaps freemarker's default value operator:
>>> "${usage!uiLabelMap.CommonNone}"
>>> 
>>> Regards
>>> Scott
>>> 
>>> HotWax Media
>>> http://www.hotwaxmedia.com
>>> 
>>> On 1/09/2010, at 5:29 AM, Jacques Le Roux wrote:
>>> 
>>>> Hi Bruno,
>>>> 
>>>> In such case I handle the field with set and groovy before in the row-action. But yes, why not a default-value?
>>>> 
>>>> Jacques
>>>> 
>>>> From: "Bruno Busco" <br...@gmail.com>
>>>>> Hi,
>>>>> I need to show a default string (e.g. "None") in a field of a form of type
>>>>> "list".
>>>>> I was looking for something like...
>>>>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}" sort-field="true">
>>>>> <display default-value="${uiLabelMap.CommonNone}"/>
>>>>> </field>
>>>>> ...but the display tag does not support the default-value.
>>>>> Would it make sense to add it?
>>>>> Thanks,
>>>>> Bruno
>>>>> 
>>>> 
>>> 
>> 
> 
> 


Re: default-value for display tag in form fields

Posted by Jacques Le Roux <ja...@les7arts.com>.
From: "David E Jones" <de...@me.com>
> I agree, Groovy is not just way better than BSH, but also better than UEL too. It might be a bit of a pain to change now, but I
> don't know. While designing based on the idea of starting over I was planning on a move to "everything's Groovy" to use Groovy for
> all expressions, scriptlets, and inline scripts and scripts in separate files.

Yes, I'd like it, more powerful, consistent and better syntax

Jacques

> Of course, that brings up the question... why not just use Grails where every artifact is a groovy script instead of having some
> artifacts as XML? Well, IMO for many things XML is easier and cleaner for both writing and reading/maintaining. If you don't like
> that, well, Grails isn't too bad as frameworks go... :)
>
> -David
>
>
> On Aug 31, 2010, at 6:51 PM, Scott Gray wrote:
>
>> Sounds fine to me.  As an alternative you can do something like this:
>> <display description="${empty usage ? uiLabelMap.CommonNone : usage}"/>
>> I know it's a bit verbose but it should also work.  "empty" is a UEL operator that works in a similar fashion to Groovy's "Truth"
>> boolean casting.
>>
>> Unfortunately UEL doesn't support groovy's elvis operator or it would be easier:
>> "${usage ?: uiLabelMap.CommonNone}"
>> or perhaps freemarker's default value operator:
>> "${usage!uiLabelMap.CommonNone}"
>>
>> Regards
>> Scott
>>
>> HotWax Media
>> http://www.hotwaxmedia.com
>>
>> On 1/09/2010, at 5:29 AM, Jacques Le Roux wrote:
>>
>>> Hi Bruno,
>>>
>>> In such case I handle the field with set and groovy before in the row-action. But yes, why not a default-value?
>>>
>>> Jacques
>>>
>>> From: "Bruno Busco" <br...@gmail.com>
>>>> Hi,
>>>> I need to show a default string (e.g. "None") in a field of a form of type
>>>> "list".
>>>> I was looking for something like...
>>>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}" sort-field="true">
>>>>  <display default-value="${uiLabelMap.CommonNone}"/>
>>>> </field>
>>>> ...but the display tag does not support the default-value.
>>>> Would it make sense to add it?
>>>> Thanks,
>>>> Bruno
>>>>
>>>
>>
>



Re: default-value for display tag in form fields

Posted by David E Jones <de...@me.com>.
I agree, Groovy is not just way better than BSH, but also better than UEL too. It might be a bit of a pain to change now, but I don't know. While designing based on the idea of starting over I was planning on a move to "everything's Groovy" to use Groovy for all expressions, scriptlets, and inline scripts and scripts in separate files.

Of course, that brings up the question... why not just use Grails where every artifact is a groovy script instead of having some artifacts as XML? Well, IMO for many things XML is easier and cleaner for both writing and reading/maintaining. If you don't like that, well, Grails isn't too bad as frameworks go... :)

-David


On Aug 31, 2010, at 6:51 PM, Scott Gray wrote:

> Sounds fine to me.  As an alternative you can do something like this:
> <display description="${empty usage ? uiLabelMap.CommonNone : usage}"/>
> I know it's a bit verbose but it should also work.  "empty" is a UEL operator that works in a similar fashion to Groovy's "Truth" boolean casting.  
> 
> Unfortunately UEL doesn't support groovy's elvis operator or it would be easier:
> "${usage ?: uiLabelMap.CommonNone}"
> or perhaps freemarker's default value operator:
> "${usage!uiLabelMap.CommonNone}"
> 
> Regards
> Scott
> 
> HotWax Media
> http://www.hotwaxmedia.com
> 
> On 1/09/2010, at 5:29 AM, Jacques Le Roux wrote:
> 
>> Hi Bruno,
>> 
>> In such case I handle the field with set and groovy before in the row-action. But yes, why not a default-value?
>> 
>> Jacques
>> 
>> From: "Bruno Busco" <br...@gmail.com>
>>> Hi,
>>> I need to show a default string (e.g. "None") in a field of a form of type
>>> "list".
>>> I was looking for something like...
>>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}" sort-field="true">
>>>  <display default-value="${uiLabelMap.CommonNone}"/>
>>> </field>
>>> ...but the display tag does not support the default-value.
>>> Would it make sense to add it?
>>> Thanks,
>>> Bruno
>>> 
>> 
> 


Re: default-value for display tag in form fields

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Sounds fine to me.  As an alternative you can do something like this:
<display description="${empty usage ? uiLabelMap.CommonNone : usage}"/>
I know it's a bit verbose but it should also work.  "empty" is a UEL operator that works in a similar fashion to Groovy's "Truth" boolean casting.  

Unfortunately UEL doesn't support groovy's elvis operator or it would be easier:
"${usage ?: uiLabelMap.CommonNone}"
or perhaps freemarker's default value operator:
"${usage!uiLabelMap.CommonNone}"

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 1/09/2010, at 5:29 AM, Jacques Le Roux wrote:

> Hi Bruno,
> 
> In such case I handle the field with set and groovy before in the row-action. But yes, why not a default-value?
> 
> Jacques
> 
> From: "Bruno Busco" <br...@gmail.com>
>> Hi,
>> I need to show a default string (e.g. "None") in a field of a form of type
>> "list".
>> I was looking for something like...
>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}" sort-field="true">
>>   <display default-value="${uiLabelMap.CommonNone}"/>
>> </field>
>> ...but the display tag does not support the default-value.
>> Would it make sense to add it?
>> Thanks,
>> Bruno
>> 
> 


Re: default-value for display tag in form fields

Posted by Nicolas Malin <ma...@librenberry.net>.
Le 31/08/2010 19:29, Jacques Le Roux a écrit :
> Hi Bruno,
>
> In such case I handle the field with set and groovy before in the 
> row-action. But yes, why not a default-value?
>
> Jacques
+1 for default-value. It's many case that possible to show a value if 
nothing is present in context.

Nicolas
>
> From: "Bruno Busco" <br...@gmail.com>
>> Hi,
>> I need to show a default string (e.g. "None") in a field of a form of 
>> type
>> "list".
>> I was looking for something like...
>>
>> <field name="usage" title="${uiLabelMap.WebtoolsUsage}" 
>> sort-field="true">
>> <display default-value="${uiLabelMap.CommonNone}"/>
>> </field>
>>
>> ...but the display tag does not support the default-value.
>>
>> Would it make sense to add it?
>>
>> Thanks,
>> Bruno
>>
>


-- 
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
-------
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/


Re: default-value for display tag in form fields

Posted by Jacques Le Roux <ja...@les7arts.com>.
Hi Bruno,

In such case I handle the field with set and groovy before in the row-action. But yes, why not a default-value?

Jacques

From: "Bruno Busco" <br...@gmail.com>
> Hi,
> I need to show a default string (e.g. "None") in a field of a form of type
> "list".
> I was looking for something like...
> 
> <field name="usage" title="${uiLabelMap.WebtoolsUsage}" sort-field="true">
>    <display default-value="${uiLabelMap.CommonNone}"/>
> </field>
> 
> ...but the display tag does not support the default-value.
> 
> Would it make sense to add it?
> 
> Thanks,
> Bruno
>