Working Example:
package example.gwt.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.*;
/**
* User: wmathews
* Date: Feb 13, 2008
* Time: 7:33:11 AM
*/
public class FooEntry implements EntryPoint {
Grid myGrid;
Image myImage;
ListBox myListBox;
CheckBox myCheckBox;
public void onModuleLoad() {
myGrid = new Grid(1, 2);
myImage = new Image("Progressbar.gif");
myListBox = new ListBox();
myListBox.addItem("one");
myListBox.addItem("two");
myListBox.addItem("three");
myCheckBox = new CheckBox("loading");
myCheckBox.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
if (myCheckBox.isChecked()) {
myGrid.setWidget(0, 0, myImage);
} else {
myGrid.setWidget(0, 0, myListBox);
}
}
});
myGrid.setWidget(0, 0, myListBox);
myGrid.setWidget(0, 1, myCheckBox);
RootPanel.get().add(myGrid);
}
}
On Feb 12, 6:34 pm, "Miguel Ping" <
miguel.p...@gmail.com> wrote:
> But how do I swap the widgets without disrupting the container of the main
> widget?
> Can you post a working example? I'm afraid i'll always disrupt the container
> of the widget...
>
> On Feb 12, 2008 10:12 PM, walden <
wmath...@aladdincapital.com> wrote:
>
>
>
>
>
> > You can overlay it using a PopupPanel (is it still called that?).
>
> > You could also swap the Image and the ListBox at the widget level (not
> > the element level) and do no harm to the doco.
>
> > Walden
>
> > On Feb 12, 2:19 pm, Ping <
miguel.p...@gmail.com> wrote:
> > > Hi all,
>
> > > I was wondering if is it possible to implement a loading icon by
> > > replacing an arbitrary widget by a 'loading' spinner image. I want to
> > > replace, lets say a listbox that's populating its entries through rpc,
> > > wiht a spinner image while the data is still arriving.
>
> > > I'm betting that I cannot just call a DOM.setElement() because that
> > > would probably mess up the listbox's inner state, but if I could
> > > overlay an image with the exact same size of the widget's size, it
> > > would be nice enough.
>
> > > Thanks,
> > > miguel ping- Hide quoted text -
>
> - Show quoted text -