0

I have extended PopupPanel and am trying to get the glass/see through effect to work Here is my class

import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.*;

public class MyPopup extends PopupPanel
{
private static Label label = new Label();

public MyPopup()
{
    super(true);
    setWidget(label);
}

public static void showToast(String message, int time)
{
    final MyPopup popup = new MyPopup();
    label.getElement().setId("mypopupID");
    popup.setGlassEnabled(true);
    label.setText(message);
    popup.show();

    Timer timer = new Timer()
    {
        @Override
        public void run()
        {
            popup.hide();
        }
    };

    timer.schedule(time);
}
}

I just call showToast and this works as expected but looks like a plain old panel with what ever colour back ground I have declared in my CSS. Here is my CSS

#mypopupID
{
background-color: yellow;
position:absolute;
left:130px;
top:50px;
width: 300px;
}

Any ideas how to get this to work? The dream is to get a fade in/out animation working but little steps first.

MayoMan
  • 4,757
  • 10
  • 53
  • 85

1 Answers1

2

The "glass" effect of setGlassEnabled(true) does not apply to the popup itself, but to whathever is behind it. If you want the popup itself to be transparent, maybe you can try playing with the "opacity" css property.

David Levesque
  • 22,181
  • 8
  • 67
  • 82
  • Looking at the documentation when I set glass effect to true on the panel, BEFORE the pane becomes visible, then a glass pane should cover all panels/widgets that existed on your UI at that stage. I don't see from the documentation where I have to tweek the popups child widget. As it is at the moment with just my label showing when the popup displays I may as well just forget about the popup and attach the label to my root panel and show/hide it instead. Don't see what the point is in putting it on a popup panel. – MayoMan Mar 13 '13 at 08:53