Hi, I have been dealing with a problem which seems to me not having a clean solution.
-- I have declared a SuggestBox in uibinder:
<g:SuggestBox ui:field="suggestBox" height="32px" width="550px"></g:SuggestBox>
Then, I can populate the already provided SuggestBox on the View:
MultiWordSuggestOracle oracle = (MultiWordSuggestOracle) suggestBox.getSuggestOracle();
oracle.add("Afghanistan");
It works correctly. However, in my case I need a server side call to fetch the suggested values. And then the problems arise.
1* On one hand the suggestBox.setOracle() method is not accessible so I cannot provide a new Oracle to the created instance
2* If I try to create a new instance before the bean is instantiated (as I read somewhere), i.e.:
suggestBox = new SuggestBox(createOracle(new MultiWordSuggestOracle()));
System.out.println("before:" + suggestBox.getSuggestOracle().toString());
initWidget(uiBinder.createAndBindUi(this));
System.out.println("after:" + suggestBox.getSuggestOracle().toString());
I see that the oracle instance after is different to oracle instance before, so the createAndBindUi method instantiates and assigns a new instance.
3* I do not think I can assign an oracle instance on declaring SuggestBox on uibinder (i.e. XML)
4* Probably I create a new class extending SuggestBox with a custom Oracle and declare this new class on uibinder but it looks unnecessarily complicated
5* And the only thing that I figure out is declaring a place holder for the SuggestBox in the uibinder (e.g. an <g:HTMLPanel ui:field="placeholder"/>) and programmatically add my SuggestBox with my custom oracle on the View class. Then I would not be using the uibinder to declare SuggestBox.
So, the question is: how to change the Oracle for a SuggestBox declared in uibinder? Any experience?
Thanks
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment