-
23 Sep 2011 12:07 AM #1
GXT 2.2.5 and Border Layout Collapse problem - simple code included
GXT 2.2.5 and Border Layout Collapse problem - simple code included
Hey.
With GXT 2.2.5 I have annoying problem. Best to show the simple code:
The point is in the last line where I collapse south region so that when the application is started that region is collapsed. Well, with 2.2.5 GXT the region is also invisible, not only collapsed. Not sure what exactly the problem could be but with old release, the above code worked OK.Code:public class AATestWindow extends Window { public AATestWindow() { setSize(400, 200); BorderLayout layout = new BorderLayout(); setLayout(layout); ContentPanel cntntpnlCenter = new ContentPanel(); cntntpnlCenter.setHeading("Center"); add(cntntpnlCenter, new BorderLayoutData(LayoutRegion.CENTER)); ContentPanel cntntpnlSouth = new ContentPanel(); cntntpnlSouth.setHeading("South"); cntntpnlSouth.setCollapsible(true); add(cntntpnlSouth, new BorderLayoutData(LayoutRegion.SOUTH, 50.0f)); layout.collapse(LayoutRegion.SOUTH); } }
Is there a new way to implement this? Calling collapse() on south panel does not do what I need to be done.
Thanks.
-
23 Sep 2011 12:43 AM #2
Code:Index: user/src/com/extjs/gxt/ui/client/widget/layout/BorderLayout.java=================================================================== --- user/src/com/extjs/gxt/ui/client/widget/layout/BorderLayout.java (revision 2463) +++ user/src/com/extjs/gxt/ui/client/widget/layout/BorderLayout.java (working copy) @@ -537,6 +537,10 @@ } } + private native boolean isComponentHidden(Component c) /*-{ + return c.@com.extjs.gxt.ui.client.widget.Component::hidden; + }-*/; + private void onCollapse(ContentPanel panel) { if (panel.getParent() == layoutContainer && fireEvent(Events.BeforeCollapse, createBorderLaoutEvent(panel))) { @@ -545,7 +549,7 @@ boolean layoutOnChange = layoutContainer.isLayoutOnChange(); setLayoutOnChange(layoutContainer, false); - boolean isVisible = panel.isVisible(); + boolean isVisible = !isComponentHidden(panel); layoutContainer.remove(panel); Map<String, Object> st = panel.getState(); @@ -579,7 +583,7 @@ setLayoutOnChange(layoutContainer, false); cp.setExpanded(false); setCollapsed(panel, false); - boolean isVisible = cp.isVisible(); + boolean isVisible = !isComponentHidden(cp); Map<String, Object> st = panel.getState(); st.remove("collapsed");
This patch should fix it. One note to you code, you should set the BorderLayoutData to be collapsible, not the contentpanel.
-
23 Sep 2011 1:01 AM #3
Hey Sven.
Thanks for fast heads up. So, where do I paste this code? Directly to the BorderLayour java file?
Thanks again.


Reply With Quote