I have an enumeration that looks like the following
public enum MyEnum {
A,
B;
}
And then I have a UiBinder file with a custom component that has a setter and getter expecting the enum above. (I've stripped the extra code for
<ui:UiBinder ....>
<g:HTMLPanel>
....
<myNamespace:myComponent myAttribute="" />
....
</g:HTMLPanel>
</ui:UiBinder>
Can I reference my enum and put that value into myAttribute in any way? What I want to accomplish is something like this
<ui:UiBinder ....>
<ui:with field="myEnumField" type="com.example.MyEnum" />
<g:HTMLPanel>
....
<myNamespace:myComponent myAttribute="{myEnumField.A}" />
....
</g:HTMLPanel>
</ui:UiBinder>
However it would seem that I cannot do this with ui:with. Can I do this in any way at all?
After searching a bit more I realized that you could actually do the following:
<ui:import field="com.example.MyEnum.*" />
<g:HTMLPanel>
...
<myNamespace:myComponent myAttribute="{A}" />
...
</g:HTMLPanel>
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