PDA

View Full Version : New to GXT - integrating Portal with existing GWT app, having issues



johndubchak
10 Jan 2010, 2:59 AM
Hi,

I am trying to incrementally integrate GXT into an existing GWT application, specifically adding a Portal, but am having some issues.

I have a GWT VerticalPanel on a page that has a width of 100% with alignment set to center, top. I have created a GXT LayoutContainer and added it to the VerticalPanel. To the LayoutContainer I have added a class-level Portal object and am creating existing GWT widgets and putting them into the Portal by wrapping them in a Portlet object, similar to the PortalExample that is included in GXT 2.1.0.

The issue I am having is that the Portal appears at the bottom of the page, not the top, and though I am creating the portlets in 3 rows (similar to the example), they appear stacked like they are being placed directly in the VerticalPanel.

Here is the code I am using:



...
private LayoutContainer container = new LayoutContainer();
private Portal portal = new Portal(3);
...

page.setWidth("100%");
page.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
page.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

portal.setBorders(true);
portal.setStyleAttribute("backgroundColor", "white");
portal.setColumnWidth(0, .33);
portal.setColumnWidth(1, .33);
portal.setColumnWidth(2, .33);
...

container.setLayout(new BorderLayout());
container.add(portal);
container.layout();
page.add(container);
....

// Adding a Portlet in a separate method after an asynchronous call
final Portlet portlet = new Portlet();
portlet.setHeading((title != null ? title : ""));
portlet.setCollapsible(true);
portlet.setAnimCollapse(false);
portlet.getHeader().addTool(new ToolButton("x-tool-gear"));
portlet.getHeader().addTool(new ToolButton("x-tool-close", new SelectionListener<IconButtonEvent>() {
@Override
public void componentSelected(IconButtonEvent ce) {
portlet.removeFromParent();
}

}));
portlet.setLayout(new FitLayout());
portlet.add(widget);
portlet.setHeight(250);
portal.add(portlet, column);

Ideally, what I'd like to have happen is that the portal expands to fit the entire width of the VerticalPanel (and is positioned center, top) and the Portlets are positioned in 3 rows within the portal. The catch is that I am trying to introduce Ext GXT into an existing application slowly.

Any assistance is greatly appreciated.

Thanks,
John