jhickman / gxt-uibinder

Automatically exported from code.google.com/p/gxt-uibinder
0 stars 0 forks source link

Need the SimpleComboBox to accept attribute values. #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The SimpleComboBox is currently able to handle this:

<form:SimpleComboBox 
     ui:field="blah" 
     width="80" triggerAction="ALL" 
     editable="false" 
     simpleValue="{constants.before}">
   <form:value>before</form:value>
   <form:value>after</form:value>
</form:SimpleComboBox>

How hard would it be to support this:
<form:SimpleComboBox 
     ui:field="blah" 
     width="80" triggerAction="ALL" 
     editable="false" 
     simpleValue="{constants.before}">
    <form:value add="{constants.before}"/>
    <form:value add="{constants.after}"/>
</form:SimpleComboBox>

?

This would allow me to use I18N constants (and messages).

thanks,
JR

Original issue reported on code.google.com by joel.re...@gmail.com on 25 Mar 2011 at 4:51

GoogleCodeExporter commented 9 years ago
I didn't think of that when writing the parser.  I'll add something like that.  
Maybe <form:value text="{msg.foo}" /> to be more consistent with Buttons, etc

Original comment by jus...@jhickman.com on 25 Mar 2011 at 7:34

GoogleCodeExporter commented 9 years ago
thanks!

Original comment by joel.re...@gmail.com on 25 Mar 2011 at 11:12

GoogleCodeExporter commented 9 years ago
After some effort, I am able to get 3 forms of this.

<form:SimpleComboBox
        width="80"
        triggerAction="ALL"
        editable="false"
        simpleValue="item 2">
    <form:value>item 1</form:value>
    <form:value>item 2</form:value>
</form:SimpleComboBox>

<form:SimpleComboBox
        width="80"
        triggerAction="ALL"
        editable="false"
        simpleValue="{issue20constants.after}">
    <form:item value="{issue20constants.before}" />
    <form:item value="{issue20constants.after}" />
</form:SimpleComboBox>

<form:SimpleComboBox
        width="80"
        triggerAction="ALL"
        editable="false"
        type="com.jhickman.web.gwt.gxtuibindertest.client.model.Music"
        simpleValue="{issue20constants.music2}">
    <form:item value="{issue20constants.music1}" />
    <form:item value="{issue20constants.music2}" />
    <form:item value="{issue20constants.music3}" />
</form:SimpleComboBox>

The first one is the one I added last week.  Only works with Strings since it's 
using an innerHTML.
The second and third are very similar.  By default, the item values will be 
parsed as Strings, but the SimpleComboBox can be applied with a "type" 
attribute.  The value should resolve to a fully qualified Class.  In this case, 
I make my issue20Constants music1(), etc return Music type. 

Original comment by jus...@jhickman.com on 26 Mar 2011 at 4:47