-
22 Oct 2011 2:28 PM #1
Does TreeStore leaks @UiConstructor?
Does TreeStore leaks @UiConstructor?
I'm playing with the code borrowed from http://www.sencha.com/examples-dev/#...tree(uibinder) and I cannot resolve the following issue:
It looks like the generator ignores "provided = true" for "store" annotation. I tried to create @UiFactory method but it didn't help.Code:ERROR: com.sencha.gxt.data.shared.TreeStore has no default (zero args) constructor. To fix this, you can define a @UiFactory method on the UiBinder's owner, or annotate a constructor of TreeStore with @UiConstructor..
Is this a TreeStore code bug or did I forget to make some specific configuration actions?
(GWT 2.4, GXT 3.0d5, uibinder-bridge 2.4.0-SNAPSHOT)
-
22 Oct 2011 5:00 PM #2
The code in that example is the actual code that compiles to produce the uibinder tree sample.
Code:@UiField(provided = true) TreeStore<BaseDto> store = new TreeStore<BaseDto>(new KeyProvider());
Are the two relevant pieces of code. If provided=true is set for that field (make sure the fields have the same name!), UiBinder should not attempt to look for an alternate way of building the TreeStore. This is how this example and several others are working. This works with standard GWT 2.4.0 behavior, the uibinder-bridge jar is not required.Code:<ui:with type="com.sencha.gxt.data.shared.TreeStore" field="store" />
There is no plan to provide a @UiConstructor for TreeStore, as there is no good way to allow for a ModelKeyProvider instance that wouldn't make it just as easy to expose the store via a field. If you have suggestions in this area, we are open to them.
-
22 Oct 2011 5:04 PM #3
Also a Store is not really UI related and so should more be provided from the java code than getting create through the XML file.
-
23 Oct 2011 1:37 PM #4
Thank you for the quick answer. The code was copied to a blank GWTP view with provided=true. I think the cause of this issue is somewhere outside the pasted code fragments. But I don't know where...
-
28 Oct 2011 9:58 AM #5
I've found the what was caused the mistake:
should beCode:public interface Binder extends UiBinder<Widget, MainView> {}
and uibinder-bridge dependency is required.Code:public interface Binder extends UiBinder<Widget, MainViewImpl> {}
Thanks guys for your attention.
-
28 Oct 2011 10:16 AM #6
Yes, uibinder-bridge will be required until the next version of GWT, which the changes in http://gwt-code-reviews.appspot.com/1524803/ should be included in.
-
30 May 2012 9:00 AM #7
I'm still having this problem. I have everything right, but I still get the
I'm also trying to use the BoarderLayout UiBinder example with the BasicTree example. I'm using the @UiTemplate annotation, but that shouldn't effect anything right?Code:ERROR: com.sencha.gxt.data.shared.TreeStore has no default (zero args) constructor. To fix this, you can define a @UiFactory method on the UiBinder's owner, or annotate a constructor of TreeStore with @UiConstructor..
-
30 May 2012 9:45 AM #8
TreeStore shouldn't have a @UiConstructor, as it requires a ModelKeyProvider instance. Create it in your java code before the createAndBind call, and set up the @UiField annotation on the TreeStore as provided = true as I mentioned in this post: http://www.sencha.com/forum/showthre...l=1#post663265
-
30 May 2012 10:57 AM #9
I did that. I copied it straight from the example:
Code:classKeyProvider implementsModelKeyProvider<BaseDto> {@Override public String getKey(BaseDto item) { return (item instanceof FolderDto ? "f-" : "m-") + item.getId().toString(); }}
-
30 May 2012 11:38 AM #10
This isn't an issue of how you define the model key provider, it is how you _create_ the treestore. The @UiField needs to look like this so UiBinder doesnt need to look for a @UiConstructor:
Bolded parts are important, both creating the TreeStore instance in code and marking the TreeStore as being created in Java, not xml.Code:@UiField(provided = true) TreeStore<BaseDto> store = new TreeStore<BaseDto>(new KeyProvider());
TreeStore should not be created in UiBinder XML, because it isn't a UI component.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote