html.append(details);
html.append("</I></p>");
- VNotification n = new VNotification(1000 * 60 * 45);
+ VNotification n = VNotification.createNotification(1000 * 60 * 45);
n.addEventListener(new NotificationRedirect(url));
n.show(html.toString(), VNotification.CENTERED_TOP,
VNotification.STYLE_SYSTEM);
if (html.length() != 0) {
/* 45 min */
- VNotification n = new VNotification(1000 * 60 * 45);
+ VNotification n = VNotification
+ .createNotification(1000 * 60 * 45);
n.addEventListener(new NotificationRedirect(url));
n.show(html, VNotification.CENTERED_TOP,
VNotification.STYLE_SYSTEM);
import java.util.EventObject;\r
import java.util.Iterator;\r
\r
+import com.google.gwt.core.client.GWT;\r
import com.google.gwt.event.dom.client.KeyCodes;\r
import com.google.gwt.user.client.DOM;\r
import com.google.gwt.user.client.Element;\r
private ArrayList<EventListener> listeners;\r
private static final int TOUCH_DEVICE_IDLE_DELAY = 1000;\r
\r
+ /**\r
+ * @deprecated Use GWT.create instead\r
+ */\r
+ @Deprecated\r
public VNotification() {\r
setStyleName(STYLENAME);\r
sinkEvents(Event.ONCLICK);\r
DOM.setStyleAttribute(getElement(), "zIndex", "" + Z_INDEX_BASE);\r
}\r
\r
+ /**\r
+ * @deprecated Use static {@link #createNotification(int)} instead to enable\r
+ * GWT deferred binding.\r
+ * \r
+ * @param delayMsec\r
+ */\r
+ @Deprecated\r
public VNotification(int delayMsec) {\r
this();\r
this.delayMsec = delayMsec;\r
}\r
}\r
\r
+ /**\r
+ * @deprecated Use static {@link #createNotification(int, int, int)} instead\r
+ * to enable GWT deferred binding.\r
+ * \r
+ * @param delayMsec\r
+ * @param fadeMsec\r
+ * @param startOpacity\r
+ */\r
+ @Deprecated\r
public VNotification(int delayMsec, int fadeMsec, int startOpacity) {\r
this(delayMsec);\r
this.fadeMsec = fadeMsec;\r
.getStringAttribute("style") : null;\r
final int position = notification.getIntAttribute("position");\r
final int delay = notification.getIntAttribute("delay");\r
- new VNotification(delay).show(html, position, style);\r
+ createNotification(delay).show(html, position, style);\r
+ }\r
+\r
+ public static VNotification createNotification(int delayMsec) {\r
+ final VNotification notification = GWT.create(VNotification.class);\r
+ notification.delayMsec = delayMsec;\r
+ if (BrowserInfo.get().isTouchDevice()) {\r
+ new Timer() {\r
+ @Override\r
+ public void run() {\r
+ if (notification.isAttached()) {\r
+ notification.fade();\r
+ }\r
+ }\r
+ }.schedule(notification.delayMsec + TOUCH_DEVICE_IDLE_DELAY);\r
+ }\r
+ return notification;\r
+ }\r
+\r
+ public static VNotification createNotification(int delayMsec, int fadeMsec,\r
+ int startOpacity) {\r
+ VNotification notification = createNotification(delayMsec);\r
+ notification.fadeMsec = fadeMsec;\r
+ notification.startOpacity = startOpacity;\r
+ return notification;\r
}\r
\r
public class HideEvent extends EventObject {\r