PDA

View Full Version : I need a replacement for WidgetContainer


dardison
04-30-2008, 11:23 AM
Hi all,

I'm trying to refactor some code I have it working in 0.5.2 and I found that I don't have WidgetContainer class anymore in 1.0.
What I'm doing is porting a Desktop like app can manage other windows.
So I have a viewport and the viewport has a toolbar and use to have a WidgetContainer in 0.5.2. This container I have it only to determine the rectangle bounds I have left to render the windows.
So I have a DesktopView view with this code in 0.5.2:


WidgetContainer c = new WidgetContainer();
mViewport.add(c, new RowData(RowData.FILL_BOTH));

mViewport.layout();
mViewport.hideLoadingPanel("cargando");

Registry.register("viewport", mViewport);
Registry.register("desktop-container", c);

Then I have static methods in a Desktop class to get the bounds like:

public static Widget getContainer() {
return (Widget) Registry.get("desktop-container");
}

public static Rectangle getBounds() {
return MyDOM.getBounds(getContainer().getElement());
}


Then when I need to render I use:

final Rectangle desktopBounds = Desktop.getBounds();

If anyone knows how to replace this code in 1.0 I will appreciate.
Thanks.
Daniel

baluba
04-30-2008, 11:46 AM
Did you take a look at the 1.0 explorer sample code?

WidgetContainer is simply called Container in 1.0

dardison
04-30-2008, 04:49 PM
Baluba thanks for your answer.
Yes I saw what you said, but when I tried to use Container I received an unspecified error.
It looks like when the getBounds() method is called the container is not render yet and it fails. I don't know why this is working on 0.5.2 with WidgetContainer but it doesn't work with 1.0

Regards
Daniel

dardison
05-02-2008, 08:23 AM
Hi,

I resolved the issue.
The problem was that when the getBounds() was called the Component wasn't rendered.
So I add a Listener to the Render event and do the getBounds() in there and everything works ok.
Thanks Darrell for your help in resolving this issue.

Regards,
Daniel