Can I use enum values as field values inside UiBinder template ? I'm using GWT 2.4
Something like this
<ui:with field="en" type="com.mine.courierApp.shared.PayerType" />
looks promising, where
public enum PayerType
{
Sender,
Recipient
}
but I can't refer to values of the enum by en.Sender
.
Is it even possible ?
<ui:import field='com.mine.courierApp.shared.PayerType.Sender' />
or
<ui:import field='com.mine.courierApp.shared.PayerType.*' />
And then you can use it as payerType='{Sender}'
.
But UiBinder should automatically try to translate enum constant names into values, so the following should work without any need for a ui:with
:
<my:MyWidget payerType='Sender' />
If the MyWidget
widget has a public void setPayerType(PayerType type)
method, UiBinder should look for an enum value named Sender
(from the *.ui.xml
file) in the PayerType
enum (from the method's argument type).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With