-
23 May 2008 10:33 AM #1
[FIXED] ContentPanel.setTopComponent() & ContentPanel.setBottomComponent() combined
[FIXED] ContentPanel.setTopComponent() & ContentPanel.setBottomComponent() combined
Hi!
There seems to be a layout problem when I use ContentPanel.setTopComponent() & ContentPanel.setBottomComponent() at the same time... Shouldn't it be possible to do it?
Example:
...
ContentPanel panel =new ContentPanel();
panel.setHeading("Tasks");
panel.setFrame(true);
panel.setSize(700, 300);
panel.setPagePosition(100, 100);
panel.setLayout(new FitLayout());
panel.setShadow(true);
panel.setTopComponent(loadTopToolBar());
panel.add(loadTable());
panel.setBottomComponent(loadBottomToolBar());
...
-
2 Jun 2008 9:53 PM #2
You should be able to use both. This code works fine with beta 4:
When posting code, it is helpful if the code sample is complete and can be executed.Code:public void onModuleLoad() { ContentPanel cp = new ContentPanel(); cp.setFrame(true); cp.setSize(500, 400); cp.setLayout(new FitLayout()); LayoutContainer c = new LayoutContainer(); c.setBorders(true); cp.add(c); cp.setTopComponent(new ToolBar()); cp.setBottomComponent(new ToolBar()); RootPanel.get().add(cp); }
-
25 Aug 2010 11:25 AM #3
Subclasses of ContentPanel must add top/bottom components prior to super.onRender()
Subclasses of ContentPanel must add top/bottom components prior to super.onRender()
I had a bit of trouble extending content panel with top and bottom components
and came to the realization that top and bottom components cannot be set after the parent class's onRender has been called. The solution was simply to add top/bottom components prior to calling the super method.
Code:public class MyPagingToolContent extends ContentPanel { ToolBar toolBar = new ToolBar(); PagingToolBar pagingToolBar = new PagingToolBar(50); @Override protected void onRender(Element parent, int pos) { setTopComponent(toolBar); setBottomComponent(pagingToolBar); super.onRender(parent, pos); setupTools(); setFrame(true); setLayout(new FillLayout()); } }


Reply With Quote