-
9 Nov 2011 9:03 AM #1
AccordionLayoutContainer
AccordionLayoutContainer
I'm not sure if the AccordionLayout is still under development - errors included, or if I'm using it totally wrong:
--------------------------------
When I create an AccordionLayout like in
gxt-3.0.0-dp5\examples-src\com\sencha\gxt\explorer\client\layout\AccordionLayoutExample.java
and add it to the west panel of a BorderLayoutContainer, I see the Accordion but I get the following error:
----------------------------------Code:00:16:20,256 [ERROR] Uncaught exception escaped java.lang.NullPointerException: null at com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.onInsert(BorderLayoutContainer.java:693) at com.sencha.gxt.widget.core.client.container.Container.insert(Container.java:380) at com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.setWestWidget(BorderLayoutContainer.java:370)
When I later add any other ContentPanel to the Accordion with: [..] con.add(cp5);
-----------------------------Code:Caused by: java.lang.AssertionError: Method must be called before the widget is rendered at com.sencha.gxt.widget.core.client.Component.assertPreRender(Component.java:1175) at com.sencha.gxt.widget.core.client.ContentPanel.setCollapsible(ContentPanel.java:348) at com.sencha.gxt.widget.core.client.container.AccordionLayoutContainer.onInsert(AccordionLayoutContainer.java:206) at com.sencha.gxt.widget.core.client.container.Container.insert(Container.java:380) at com.sencha.gxt.widget.core.client.container.InsertResizeContainer.insert(InsertResizeContainer.java:22) at com.sencha.gxt.widget.core.client.container.Container.add(Container.java:86)
Furthermore I couldn't figure out how to get the ChildWidgetIndex of the current expanded child.
-
9 Nov 2011 9:05 AM #2
I think your BorderLayoutContainer problem is related to this one which is already fixed: http://www.sencha.com/forum/showthre...dget(Widget-w)
-
9 Nov 2011 9:31 AM #3
Adding layout data to my uibinder definition as in http://www.sencha.com/learn/ext-gwt-...with-uibinder/
Did not fix the problem. But hopefully the next release will. What's about the other 2 questions?
-
9 Nov 2011 9:33 AM #4
In that case can you please provide a fully working testcase implementing EntryPoint that shows your problem?Did not fix the problem. But hopefully the next release will.
-
9 Nov 2011 9:36 AM #5
There is a getter to get the currently active widget. That one you can pass to the getWidgetIndex methodFurthermore I couldn't figure out how to get the ChildWidgetIndex of the current expanded child.
-
9 Nov 2011 9:56 AM #6
When I create a simple example, the problem is fixed with adding BorderLayoutData as suggested in the other bug report:
Code:BorderLayoutContainer container = new BorderLayoutContainer(); AccordionLayoutContainer con = new AccordionLayoutContainer(); con.setFill(true); ContentPanel cp = new ContentPanel(); cp.setAnimCollapse(false); cp.setHeadingText("Online Users"); con.add(cp); con.setWidget(cp); BorderLayoutData northLayoutData = new BorderLayoutData(100); container.setNorthWidget(con, northLayoutData); RootLayoutPanel.get().clear(); RootLayoutPanel.get().add(container);
So it seems that adding BorderLayoutData is not fixing this issue when working with uibinder. My code:
andCode:<ui:with type="com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData" field="westLayoutData" /> <gxtContainer:BorderLayoutContainer> [..] <gxtContainer:west layoutData="{westLayoutData}"> </gxtContainer:west> [..] </gxtContainer:BorderLayoutContainer>
----------------------Code:@UiField(provided = true) BorderLayoutData westLayoutData = new BorderLayoutData(100);
Regarding the other issue, can you tell me how the getter is called. I see nothing like .getActiveWidget()
BTW: Thank for the very fast and nice support!
-
9 Nov 2011 10:02 AM #7
Regarding the other issue, can you tell me how the getter is called. I see nothing like .getActiveWidget()
Its called getWidget
-
9 Nov 2011 10:21 AM #8
Thanks for the getWidget() hint - works!

The other issue is now gone as well. I didn't realized that even with uibinder the BorderLayoutData has to be passed with the container.setNorthWidget() call and not just in the XML.
The last remaining issue, from my initial questions was: java.lang.AssertionError: Method must be called before the widget is rendered
The error happens when I add new Content Panels to the accordion after the according was already created. This is my code:
Code:ContentPanel cp1 = new ContentPanel(appearance); cp1.setAnimCollapse(false); cp1.setHeadingText("Test"); accordionContainer.add(cp1); accordionContainer.setWidget(cp1);
-
10 Nov 2011 4:19 AM #9
To test the last issue, please use the following code: (Error occures with click on button)
Code:public class Designer implements EntryPoint { public void onModuleLoad() { BorderLayoutContainer container = new BorderLayoutContainer(); container.setWidth(500); container.setHeight(500); final AccordionLayoutContainer con = new AccordionLayoutContainer(); con.setFill(true); ContentPanel cp = new ContentPanel(); cp.setHeadingText("Test 1"); con.add(cp); con.setWidget(cp); Button b = new Button("Press here to add a new item to the accordion"); b.addClickHandler(new ClickHandler () { @Override public void onClick(ClickEvent event) { ContentPanel cp1 = new ContentPanel(); cp1.setHeadingText("Test " + (con.getWidgetCount() + 1)); con.add(cp1); con.setWidget(cp1); } }); BorderLayoutData northLayoutData = new BorderLayoutData(100); container.setWestWidget(con, northLayoutData); container.setCenterWidget(b, northLayoutData); RootLayoutPanel.get().clear(); RootLayoutPanel.get().add(container); } }
-
16 Aug 2012 3:52 AM #10
Same problem in 3.0.1!
Is there a fix or workaround?
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote