PDA

View Full Version : BorderLayout UiBinder completely ignores LayoutData



rohdef
26 Jan 2012, 11:55 PM
I've been trying to get the BorderLayoutContainer to work following the examples. It seems that it simply ignores the layoutData I pass. I've even tried copy pasting the code from the examples, to confirm that I didn't miss any details.

I've even tried accessing the layoutData with @UiField(provided=true), with various results, although mostly fails.

When I run the non-UiBinder example it works.

From the behaviour I would assume that it simple doesn't pass argument when adding the child in UiBinder.

nbuesing
27 Jan 2012, 5:10 AM
I had reported margins not working with verticalLayoutContainer, but I think this is the same issue.

http://www.sencha.com/forum/showthread.php?175179-Margins-within-UiBinder-is-not-working-verified-with-VerticalLayout-(UiBinder) (http://www.sencha.com/forum/showthread.php?175179-Margins-within-UiBinder-is-not-working-verified-with-VerticalLayout-(UiBinder))

sven
27 Jan 2012, 5:51 AM
I had reported margins not working with verticalLayoutContainer, but I think this is the same issue.

(http://www.sencha.com/forum/showthread.php?175179-Margins-within-UiBinder-is-not-working-verified-with-VerticalLayout-(UiBinder))http://www.sencha.com/forum/showthread.php?175179-Margins-within-UiBinder-is-not-working-verified-with-VerticalLayout-(UiBinder)



No it is probably not.


Have you inherited the GXT UiBinder module?

rohdef
27 Jan 2012, 8:05 AM
As I wrote I copy pasted the entire code from the example page, so unless it inherits wrongly, it should be the right one. That said, I'd gladly test once more.

sven
27 Jan 2012, 8:12 AM
So you just copied the code?

How does your module file look like? Could you upload the required code somewhere?

rohdef
30 Jan 2012, 12:34 AM
So you just copied the code? How does your module file look like?

Module file? If you're refering to the gwt.xml-file I'll gladly copy paste it :)

I've tried building it with a fresh project (just in case I did something weird and forgot it), using the jar files from your homepage (I use Maven normally) and can confirm it behaves the same way.

If the mediafire upload works there should be a zip file with the entire source at this page:
http://www.mediafire.com/?wpd6msk0m8kunyr

The changes done is:
package changed to the one I use
commented this import: import com.sencha.gxt.explorer.client.model.Example.Detail;
since it's unused and not in my classpath I didn't bother to find it.

And a screenshot of the example. It behaves the same way in Firefox.

31142

rohdef
30 Jan 2012, 3:21 AM
I found part of the solution to my problems, but not all. Now I found what I was wrong with the non-dynamic version. Simply there's a difference in if my panel is an IsWidget or a ContentPanel. I still cannot configure any layoutData through the UiBinder, but at least now I can configure the other parts.

In my current tests it appears that the child has to be a SimpleContainer for the layout to apply (probably some inheritance of Container, but I didn't test that much), otherwise the layout seems to be ignored, for instance if I have some UiBinder widget that has a ContentPanel as its first child that's a no go.

May I suggest that add{North|West|...}(widget, layout) is changed so it only accepts children where the layout actually works. Or even better: if the widget is an IsWidget, make it work if the first widget will work, and for all other cases wrap the content in SimpleContainer.

Also (logically) collapsible don't work if it's not a ContentPanel, maybe you should have some kind of error/warning message if you try to set collapse to true, but use an incompatible panel.

aduchate
1 Oct 2012, 4:54 AM
I had exactly the same problem but as soon as I added

uibinder-bridge-2.4.0.jar to my project

and

added the following line to my get.xml

<inherits name='com.sencha.gwt.uibinder.UiBinder'/>,

it started working.

Cheers,
A.

sven
1 Oct 2012, 6:47 AM
Yes this is mostly the problem when the layoutdata in the ui.xml file is not working. You need to use our custom UiBinder module.

Once GWT 2.5 is out, this will change.

CHEM_Eugene
21 Mar 2013, 5:33 AM
This is how really looks example of BorderLayout UiBinder (http://www.sencha.com/examples/#ExamplePlace:borderlayout%28uibinderdynamicattribute%29)! Any ideas?
42585

Colin Alworth
21 Mar 2013, 4:39 PM
CHEM_Eugene, that is a problem with sizing the example. BorderLayoutContainer requires a size to work correctly. When that example runs in the explorer app, it is given a size, but there is a bug in the onModuleLoad method. In that method you should either wrap it up in a Viewport, or give it a size. This same issue would occur with the *non* uibinder version, so it isn't a uibinder bug, but that the non-uibinder version is correctly using a viewport in its onModuleLoad.

Here is an onModuleLoad that fixes that sample:


public void onModuleLoad() {
Viewport vp = new Viewport();
vp.add(this);
RootPanel.get().add(vp);
}