HorizontalPanel buttons = new HorizontalPanel();
buttons.setSpacing(4);
main.add(buttons);
SimpleButton button = new SimpleButton("Show Message", WidgetImages.Instance.get().notification_Message().createImage());
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
Notifiers.tray().notify(Notification.builder().title("Short Message").body("This is the content of the message").autoCloseDelay(3500).build());
}
});
buttons.add(button);
button = new SimpleButton("Show Long Message", WidgetImages.Instance.get().notification_Message().createImage());
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
Notifiers.tray().notify(Notification.builder().title("Long Message").body("This is the content of a very very very very very long message, so " + "long it seems it has no end, but it does... it's coming soon... very soon... wait... wait... " + "here it comes... no.. just kiding it's not coming... yes it is... now!").autoCloseDelay(8000).build());
}
});
buttons.add(button);
button = new SimpleButton("Show Sticky Message", WidgetImages.Instance.get().notification_Message().createImage());
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
Notifiers.tray().notify(Notification.builder().title("Sticky Message").body("This is the content of the message, it's not a long as the logest " + "message, but still it has its length").sticky(true).build());
}
});
buttons.add(button);
button = new SimpleButton("Show Info", WidgetImages.Instance.get().notification_Message().createImage());
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
Notifiers.tray().notify(Notifications.info()
.title("Sticky Message")
.body("This is the content of the message, it's not a long as the logest " + "message, but still it has its length")
.sticky(true)
.build());
}
});
buttons.add(button);
button = new SimpleButton("Show Warn", WidgetImages.Instance.get().notification_Message().createImage());
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
Notifiers.tray().notify(Notifications.warn()
.title("Sticky Message")
.body("This is the content of the message, it's not a long as the logest " + "message, but still it has its length")
.sticky(true)
.build());
}
});
buttons.add(button);
button = new SimpleButton("Show Error", WidgetImages.Instance.get().notification_Message().createImage());
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
Notifiers.tray().notify(Notifications.error().title("Sticky Message").body("This is the content of the message, it's not a long as the logest " + "message, but still it has its length").sticky(true).build());
}
});
buttons.add(button);
buttons = new HorizontalPanel();
buttons.setSpacing(4);
main.add(buttons);
button = new SimpleButton("Set TOP_LEFT", WidgetImages.Instance.get().notification_Message().createImage());
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
TrayNotifier.get().setOrientation(Orientation.TOP_LEFT);
}
});
buttons.add(button);
button = new SimpleButton("Set TOP_RIGHT", WidgetImages.Instance.get().notification_Message().createImage());
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
TrayNotifier.get().setOrientation(Orientation.TOP_RIGHT);
}
});
buttons.add(button);
button = new SimpleButton("Set BOTTOM_RIGHT", WidgetImages.Instance.get().notification_Message().createImage());
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
TrayNotifier.get().setOrientation(Orientation.BOTTOM_RIGHT);
}
});
buttons.add(button);
button = new SimpleButton("Set BOTTOM_LEFT", WidgetImages.Instance.get().notification_Message().createImage());
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
TrayNotifier.get().setOrientation(Orientation.BOTTOM_LEFT);
}
});
buttons.add(button);