you need to set the size of your popup before you show/center it. glass.setSize("300","300");
On Mon, Dec 1, 2008 at 11:54 AM, Rimimi <[EMAIL PROTECTED]> wrote: > > Hi all, > > I have a little problem with the PopupPanel. There is my class : > > public class PopupImage implements ClickListener, PopupListener { > > private static PopupImage singleton = null; > private PopupPanel popup = null; > private PopupPanel glass = null; > private Image image = null; > > private PopupImage() { > image = new Image(); > image.addStyleName("popup-image"); > image.addClickListener(this); > glass = new PopupPanel(false, false); > glass.setStylePrimaryName("popup-glass"); > popup = new PopupPanel(true, false); > popup.setWidget(image); > popup.addPopupListener(this); > popup.setAnimationEnabled(true); > } > > public void show(String imageURL) { > image.setUrl(imageURL); > glass.show(); > popup.center(); > } > > public void onClick(Widget widget) { > popup.hide(); > glass.hide(); > } > > public void onPopupClosed(PopupPanel popup, boolean autoClosed) { > if (autoClosed) { > glass.hide(); > } > } > > public static PopupImage getInstance() { > if (singleton == null) { > singleton = new PopupImage(); > } > return singleton; > } > } > > As you can see the only way to use this class is to call : > PopupImage.getInstance().show("anImageURL"); > > So when I use it, on the first call neither the animation nor the > center method works. Indeed the image appear directly and not on the > center. > But when I recall the show method then all works correctly only if I > use the same url, e.g the same image size's. > > I thought the problem was that my popup doesn't know the size of the > image before showing it, and I tried to fiw this by many ways but I > failed each time :'-( . > > Someone have an idea ? > > Thx. > > Regards, > Rimimi > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---