List of usage examples for com.vaadin.shared Position BOTTOM_CENTER
Position BOTTOM_CENTER
To view the source code for com.vaadin.shared Position BOTTOM_CENTER.
Click Source Link
From source file:by.bigvova.ui.LoginUI.java
License:Apache License
private void notification() { Notification notification = new Notification("Welcome to Dashboard Demo"); notification.setDescription(/* w ww .ja v a 2s. c om*/ "<span>This application is not real, it only demonstrates an application built with the <a href=\"https://vaadin.com\">Vaadin framework</a>.</span> <span>No username or password is required, just click the <b>Sign In</b> button to continue.</span>"); notification.setHtmlContentAllowed(true); notification.setStyleName("tray dark small closable login-help"); notification.setPosition(Position.BOTTOM_CENTER); notification.setDelayMsec(20000); notification.show(Page.getCurrent()); }
From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java
License:Apache License
Panel notifications() {
Panel p = new Panel("Notifications");
VerticalLayout content = new VerticalLayout() {
Notification notification = new Notification("");
TextField title = new TextField("Title");
TextArea description = new TextArea("Description");
MenuBar style = new MenuBar();
MenuBar type = new MenuBar();
String typeString = "";
String styleString = "";
TextField delay = new TextField();
{/* w w w. j ava 2 s . co m*/
setSpacing(true);
setMargin(true);
title.setInputPrompt("Title for the notification");
title.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(final ValueChangeEvent event) {
if (title.getValue() == null || title.getValue().length() == 0) {
notification.setCaption(null);
} else {
notification.setCaption(title.getValue());
}
}
});
title.setValue("Notification Title");
title.setWidth("100%");
addComponent(title);
description.setInputPrompt("Description for the notification");
description.addStyleName("small");
description.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(final ValueChangeEvent event) {
if (description.getValue() == null || description.getValue().length() == 0) {
notification.setDescription(null);
} else {
notification.setDescription(description.getValue());
}
}
});
description.setValue(
"A more informative message about what has happened. Nihil hic munitissimus habendi senatus locus, nihil horum? Inmensae subtilitatis, obscuris et malesuada fames. Hi omnes lingua, institutis, legibus inter se differunt.");
description.setWidth("100%");
addComponent(description);
Command typeCommand = new Command() {
@Override
public void menuSelected(final MenuItem selectedItem) {
if (selectedItem.getText().equals("Humanized")) {
typeString = "";
notification.setStyleName(styleString.trim());
} else {
typeString = selectedItem.getText().toLowerCase();
notification.setStyleName((typeString + " " + styleString.trim()).trim());
}
for (MenuItem item : type.getItems()) {
item.setChecked(false);
}
selectedItem.setChecked(true);
}
};
type.setCaption("Type");
MenuItem humanized = type.addItem("Humanized", typeCommand);
humanized.setCheckable(true);
humanized.setChecked(true);
type.addItem("Tray", typeCommand).setCheckable(true);
type.addItem("Warning", typeCommand).setCheckable(true);
type.addItem("Error", typeCommand).setCheckable(true);
type.addItem("System", typeCommand).setCheckable(true);
addComponent(type);
type.addStyleName("small");
Command styleCommand = new Command() {
@Override
public void menuSelected(final MenuItem selectedItem) {
styleString = "";
for (MenuItem item : style.getItems()) {
if (item.isChecked()) {
styleString += " " + item.getText().toLowerCase();
}
}
if (styleString.trim().length() > 0) {
notification.setStyleName((typeString + " " + styleString.trim()).trim());
} else if (typeString.length() > 0) {
notification.setStyleName(typeString.trim());
} else {
notification.setStyleName(null);
}
}
};
style.setCaption("Additional style");
style.addItem("Dark", styleCommand).setCheckable(true);
style.addItem("Success", styleCommand).setCheckable(true);
style.addItem("Failure", styleCommand).setCheckable(true);
style.addItem("Bar", styleCommand).setCheckable(true);
style.addItem("Small", styleCommand).setCheckable(true);
style.addItem("Closable", styleCommand).setCheckable(true);
addComponent(style);
style.addStyleName("small");
CssLayout group = new CssLayout();
group.setCaption("Fade delay");
group.addStyleName("v-component-group");
addComponent(group);
delay.setInputPrompt("Infinite");
delay.addStyleName("align-right");
delay.addStyleName("small");
delay.setWidth("7em");
delay.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(final ValueChangeEvent event) {
try {
notification.setDelayMsec(Integer.parseInt(delay.getValue()));
} catch (Exception e) {
notification.setDelayMsec(-1);
delay.setValue("");
}
}
});
delay.setValue("1000");
group.addComponent(delay);
Button clear = new Button(null, new ClickListener() {
@Override
public void buttonClick(final ClickEvent event) {
delay.setValue("");
}
});
clear.setIcon(FontAwesome.TIMES_CIRCLE);
clear.addStyleName("last");
clear.addStyleName("small");
clear.addStyleName("icon-only");
group.addComponent(clear);
group.addComponent(new Label(" msec", ContentMode.HTML));
GridLayout grid = new GridLayout(3, 3);
grid.setCaption("Show in position");
addComponent(grid);
grid.setSpacing(true);
Button pos = new Button("", new ClickListener() {
@Override
public void buttonClick(final ClickEvent event) {
notification.setPosition(Position.TOP_LEFT);
notification.show(Page.getCurrent());
}
});
pos.addStyleName("small");
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@Override
public void buttonClick(final ClickEvent event) {
notification.setPosition(Position.TOP_CENTER);
notification.show(Page.getCurrent());
}
});
pos.addStyleName("small");
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@Override
public void buttonClick(final ClickEvent event) {
notification.setPosition(Position.TOP_RIGHT);
notification.show(Page.getCurrent());
}
});
pos.addStyleName("small");
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@Override
public void buttonClick(final ClickEvent event) {
notification.setPosition(Position.MIDDLE_LEFT);
notification.show(Page.getCurrent());
}
});
pos.addStyleName("small");
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@Override
public void buttonClick(final ClickEvent event) {
notification.setPosition(Position.MIDDLE_CENTER);
notification.show(Page.getCurrent());
}
});
pos.addStyleName("small");
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@Override
public void buttonClick(final ClickEvent event) {
notification.setPosition(Position.MIDDLE_RIGHT);
notification.show(Page.getCurrent());
}
});
pos.addStyleName("small");
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@Override
public void buttonClick(final ClickEvent event) {
notification.setPosition(Position.BOTTOM_LEFT);
notification.show(Page.getCurrent());
}
});
pos.addStyleName("small");
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@Override
public void buttonClick(final ClickEvent event) {
notification.setPosition(Position.BOTTOM_CENTER);
notification.show(Page.getCurrent());
}
});
pos.addStyleName("small");
grid.addComponent(pos);
pos = new Button("", new ClickListener() {
@Override
public void buttonClick(final ClickEvent event) {
notification.setPosition(Position.BOTTOM_RIGHT);
notification.show(Page.getCurrent());
}
});
pos.addStyleName("small");
grid.addComponent(pos);
}
};
p.setContent(content);
return p;
}
From source file:com.terralcode.gestion.frontend.view.notification.PrettyNotification.java
public PrettyNotification(String caption) { super(caption); setDelayMsec(2000); setStyleName("bar success small"); setPosition(Position.BOTTOM_CENTER); }
From source file:com.toptal.ui.view.LoginView.java
License:Open Source License
/** * Error notification./*from w w w . j a v a 2 s. c o m*/ * @param message Message. */ private void error(final String message) { final int delay = 5000; final Notification notification = new Notification(message, Notification.Type.WARNING_MESSAGE); notification.setHtmlContentAllowed(true); notification.setStyleName("closable"); notification.setPosition(Position.BOTTOM_CENTER); notification.setIcon(FontAwesome.WARNING); notification.setDelayMsec(delay); notification.show(Page.getCurrent()); }
From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoginView.java
public LoginView() { System.out.println("LOAD LLOGIN"); setSizeFull();/* w w w . ja va 2 s. c o m*/ Component loginForm = buildLoginForm(); addComponent(loginForm); setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER); Notification notification = new Notification("Welcome to Dashboard Demo"); notification.setDescription( "<span>This application is not real, it only demonstrates an application built with the <a href=\"https://vaadin.com\">Vaadin framework</a>.</span> <span>No username or password is required, just click the <b>Sign In</b> button to continue.</span>"); notification.setHtmlContentAllowed(true); notification.setStyleName("tray dark small closable login-help"); notification.setPosition(Position.BOTTOM_CENTER); notification.setDelayMsec(20000); notification.show(Page.getCurrent()); }
From source file:dhbw.clippinggorilla.utilities.ui.VaadinUtils.java
public static void infoNotification(String caption, String description) { Notification not = new Notification(caption, null, Notification.Type.TRAY_NOTIFICATION, true); not.setDelayMsec(1000);// ww w. j a v a 2s.c o m not.setPosition(Position.BOTTOM_CENTER); not.show(Page.getCurrent()); }
From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageBase.java
License:Open Source License
private void doCACNotif(String title, String text) { Notification notif = new Notification(title, text, Notification.Type.HUMANIZED_MESSAGE); notif.setPosition(Position.BOTTOM_CENTER); notif.setHtmlContentAllowed(true);/*from w w w .ja va2s . co m*/ notif.setDelayMsec(2000); notif.show(Page.getCurrent()); }
From source file:org.eclipse.hawkbit.ui.login.AbstractHawkbitLoginUI.java
License:Open Source License
private void loginAuthenticationFailedNotification() { final Notification notification = new Notification(i18n.getMessage("notification.login.failed.title")); notification.setDescription(i18n.getMessage("notification.login.failed.description")); notification.setHtmlContentAllowed(true); notification.setStyleName("error closable"); notification.setPosition(Position.BOTTOM_CENTER); notification.setDelayMsec(1_000);/*w w w.j a v a 2s. c o m*/ notification.show(Page.getCurrent()); }
From source file:org.eclipse.hawkbit.ui.login.AbstractHawkbitLoginUI.java
License:Open Source License
private void loginCredentialsExpiredNotification() { final Notification notification = new Notification( i18n.getMessage("notification.login.failed.credentialsexpired.title")); notification.setDescription(i18n.getMessage("notification.login.failed.credentialsexpired.description")); notification.setDelayMsec(10_000);/*from www .j a v a 2 s.com*/ notification.setHtmlContentAllowed(true); notification.setStyleName("error closeable"); notification.setPosition(Position.BOTTOM_CENTER); notification.show(Page.getCurrent()); }
From source file:org.eclipse.hawkbit.ui.login.LoginView.java
License:Open Source License
void loginAuthenticationFailedNotification() { final Notification notification = new Notification(i18n.getMessage("notification.login.failed.title")); notification.setDescription(i18n.getMessage("notification.login.failed.description")); notification.setHtmlContentAllowed(true); notification.setStyleName("error closable"); notification.setPosition(Position.BOTTOM_CENTER); notification.setDelayMsec(1000);/*from w ww .java 2s . c om*/ notification.show(Page.getCurrent()); }