Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using NotificationMole in GWT

Tags:

toast

gwt

I was looking for component similar to Android's Toast notification for GWT (I Googled long enough and I know that there is a Ext-GWT which has something similar, but I want to avoid external libraries). It appears that NotificationMole is the component that I am looking for, and that this component is available in the GWT 2.1. However, when I try to show it in my app, it never appears. Has anyone used this component? Here is an example how I use it:

NotificationMole nm = new NotificationMole();
nm.setAnimationDuration(2000);
nm.setTitle("Title");
nm.setHeight("100px");
nm.setWidth("200px");
nm.setMessage("Test message to be shown in mole");
nm.show();
like image 323
dstefanox Avatar asked Feb 08 '11 12:02

dstefanox


1 Answers

The NotificationMole has to be attached to the DOM before it can be shown:

HasWidgets panel; // This can be any panel that accepts children.
NotificationMole nm = new NotificatioMole();
panel.add(nm);
// Setup the NotificationMole...
nm.show();
like image 111
Jason Terk Avatar answered Oct 20 '22 22:10

Jason Terk