本文整理汇总了Java中com.vaadin.shared.Position类的典型用法代码示例。如果您正苦于以下问题:Java Position类的具体用法?Java Position怎么用?Java Position使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Position类属于com.vaadin.shared包,在下文中一共展示了Position类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SnackbarsToastsView
import com.vaadin.shared.Position; //导入依赖的package包/类
public SnackbarsToastsView() {
setFlexDirection(FlexDirection.COLUMN);
setAlignSelf(AlignSelf.BASELINE);
addStyleName("card");
addStyleName(Paddings.All.LARGE);
addStyleName(Margins.All.LARGE);
addStyleName(Spacings.Bottom.LARGE);
ToggleButtonGroup tbg1 = new ToggleButtonGroup();
tbg1.setSelectionMode(ToggleButtonGroup.SelectionMode.SINGLE);
tbg1.addToggleButton(MaterialIcons.FORMAT_ALIGN_LEFT).addClickListener(e -> createNotification("Align left", com.vaadin.shared.Position.BOTTOM_LEFT));
tbg1.addToggleButton(MaterialIcons.FORMAT_ALIGN_CENTER).addClickListener(e -> createNotification("Align center", com.vaadin.shared.Position.BOTTOM_CENTER));
tbg1.addToggleButton(MaterialIcons.FORMAT_ALIGN_RIGHT).addClickListener(e -> createNotification("Align right", com.vaadin.shared.Position.BOTTOM_RIGHT));
tbg1.addToggleButton(MaterialIcons.FORMAT_ALIGN_JUSTIFY).addClickListener(e -> createNotification("Align justify", com.vaadin.shared.Position.MIDDLE_CENTER));
addComponent(tbg1);
ToggleButtonGroup tbg2 = new ToggleButtonGroup();
tbg2.setSelectionMode(ToggleButtonGroup.SelectionMode.MULTI);
tbg2.addToggleButton(MaterialIcons.FORMAT_BOLD).setDescription("Bold");
tbg2.addToggleButton(MaterialIcons.FORMAT_ITALIC).setDescription("Italic");
tbg2.addToggleButton(MaterialIcons.FORMAT_UNDERLINED).setDescription("Underline");
tbg2.addToggleButton(MaterialIcons.FORMAT_COLOR_FILL).setDescription("Color");
addComponent(tbg2);
}
示例2: test
import com.vaadin.shared.Position; //导入依赖的package包/类
@Test
public void test() {
FNotification notif = new FNotification("", Type.WARNING_MESSAGE).withCaption("My notif")
.withDelayMsec(3000)
.withDescription("description")
.withHtmlContentAllowed(true)
.withIcon(VaadinIcons.ARCHIVE)
.withPosition(Position.TOP_RIGHT)
.withStyleName("test");
assertEquals("My notif", notif.getCaption());
assertEquals(3000, notif.getDelayMsec());
assertEquals("description", notif.getDescription());
assertTrue(notif.isHtmlContentAllowed());
assertEquals(VaadinIcons.ARCHIVE, notif.getIcon());
assertEquals(Position.TOP_RIGHT, notif.getPosition());
assertEquals("test", notif.getStyleName());
}
示例3: LoginView
import com.vaadin.shared.Position; //导入依赖的package包/类
public LoginView() {
setSizeFull();
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());
}
示例4: enter
import com.vaadin.shared.Position; //导入依赖的package包/类
@Override
public void enter(final ViewChangeListener.ViewChangeEvent event) {
final DashboardMenuItem view = dashboardMenu.getByViewName(event.getViewName());
if (view == null) {
message.setValue(i18n.getMessage("message.error.view", new Object[] { event.getViewName() }));
return;
}
if (dashboardMenu.isAccessDenied(event.getViewName())) {
final Notification nt = new Notification("Access denied",
i18n.getMessage("message.accessdenied.view", new Object[] { event.getViewName() }),
Type.ERROR_MESSAGE, false);
nt.setStyleName(SPUILabelDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE);
nt.setPosition(Position.BOTTOM_RIGHT);
nt.show(UI.getCurrent().getPage());
message.setValue(i18n.getMessage("message.accessdenied.view", new Object[] { event.getViewName() }));
}
}
示例5: notify
import com.vaadin.shared.Position; //导入依赖的package包/类
public static void notify(String caption, String message, Throwable ex, Type type) {
Page page = Page.getCurrent();
if (page != null) {
Notification notification = new Notification(caption, contactWithLineFeed(FormatUtils.wordWrap(message, 150)),
Type.HUMANIZED_MESSAGE);
notification.setPosition(Position.MIDDLE_CENTER);
notification.setDelayMsec(-1);
String style = ValoTheme.NOTIFICATION_SUCCESS;
if (type == Type.ERROR_MESSAGE) {
style = ValoTheme.NOTIFICATION_FAILURE;
} else if (type == Type.WARNING_MESSAGE) {
style = ValoTheme.NOTIFICATION_WARNING;
}
notification.setStyleName(notification.getStyleName() + " " + ValoTheme.NOTIFICATION_CLOSABLE + " " + style);
notification.show(Page.getCurrent());
}
}
示例6: buttonClick
import com.vaadin.shared.Position; //导入依赖的package包/类
@Override
public void buttonClick(ClickEvent event) {
try {
security.login(username.getValue(), password.getValue());
getPage().setLocation("/");
} catch(AuthenticationException e) {
Notification notification = new Notification("Login Failed", Type.ERROR_MESSAGE);
notification.setHtmlContentAllowed(true);
notification.setPosition(Position.TOP_CENTER);
notification.setDescription(e.getLocalizedMessage());
notification.setDelayMsec(2000);
notification.show(Page.getCurrent());
}
}
示例7: show
import com.vaadin.shared.Position; //导入依赖的package包/类
public static void show(final String caption, final Type type)
{
getUI().access(new Runnable()
{
@Override
public void run()
{
Notification notification = new Notification(caption, type);
if (type == Type.TRAY_NOTIFICATION)
notification.setPosition(Position.BOTTOM_LEFT);
notification.show(Page.getCurrent());
}
});
}
示例8: sendMessage
import com.vaadin.shared.Position; //导入依赖的package包/类
/**
* Permet la saisie et l'envoi d'un message à tous les clients connectés
*/
public void sendMessage() {
InputWindow inputWindow = new InputWindow(applicationContext.getMessage("admin.sendMessage.message", null, UI.getCurrent().getLocale()), applicationContext.getMessage("admin.sendMessage.title", null, UI.getCurrent().getLocale()), true, 255);
inputWindow.addBtnOkListener(text -> {
if (text instanceof String && !text.isEmpty()) {
Notification notification = new Notification(applicationContext.getMessage("admin.sendMessage.notificationCaption", new Object[] {text}, UI.getCurrent().getLocale()), null, Type.TRAY_NOTIFICATION, true);
notification.setDelayMsec(-1);
notification.setDescription("\n" + applicationContext.getMessage("admin.sendMessage.notificationDescription", null, UI.getCurrent().getLocale()));
notification.setPosition(Position.TOP_CENTER);
sendNotification(notification);
}
});
UI.getCurrent().addWindow(inputWindow);
}
示例9: info
import com.vaadin.shared.Position; //导入依赖的package包/类
public static void info(String description) {
Notification notification = new Notification(I18n.t("info"), description,
Notification.Type.HUMANIZED_MESSAGE);
notification.setPosition(Position.TOP_CENTER);
notification.setDelayMsec(2000);
notification.show(Page.getCurrent());
}
示例10: error
import com.vaadin.shared.Position; //导入依赖的package包/类
public static void error(String description) {
Notification notification = new Notification(I18n.t("error"), description,
Notification.Type.ERROR_MESSAGE);
notification.setPosition(Position.TOP_CENTER);
notification.setDelayMsec(2000);
notification.show(Page.getCurrent());
}
示例11: buildFooter
import com.vaadin.shared.Position; //导入依赖的package包/类
private Component buildFooter() {
HorizontalLayout footer = new HorizontalLayout();
footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
footer.setWidth(100.0f, Unit.PERCENTAGE);
Button ok = new Button("OK");
ok.addStyleName(ValoTheme.BUTTON_PRIMARY);
ok.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
// Updated user should also be persisted to database. But
// not in this demo.
Notification success = new Notification(
"Profile updated successfully");
success.setDelayMsec(2000);
success.setStyleName("bar success small");
success.setPosition(Position.BOTTOM_CENTER);
success.show(Page.getCurrent());
DashboardEventBus.post(new DashboardEvent.ProfileUpdatedEvent());
close();
} catch (CommitException e) {
Notification.show("Error while updating profile",
Type.ERROR_MESSAGE);
}
}
});
ok.focus();
footer.addComponent(ok);
footer.setComponentAlignment(ok, Alignment.TOP_RIGHT);
return footer;
}
示例12: buildFooter
import com.vaadin.shared.Position; //导入依赖的package包/类
private Component buildFooter() {
HorizontalLayout footer = new HorizontalLayout();
footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
footer.setWidth(100.0f, Unit.PERCENTAGE);
Button ok = new Button("OK");
ok.addStyleName(ValoTheme.BUTTON_PRIMARY);
ok.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
try {
fieldGroup.commit();
// Updated user should also be persisted to database. But
// not in this demo.
Notification success = new Notification(
"Profile updated successfully");
success.setDelayMsec(2000);
success.setStyleName("bar success small");
success.setPosition(Position.BOTTOM_CENTER);
success.show(Page.getCurrent());
DashboardEventBus.post(new ProfileUpdatedEvent());
close();
} catch (CommitException e) {
Notification.show("Error while updating profile",
Type.ERROR_MESSAGE);
}
}
});
ok.focus();
footer.addComponent(ok);
footer.setComponentAlignment(ok, Alignment.TOP_RIGHT);
return footer;
}
示例13: showNotification
import com.vaadin.shared.Position; //导入依赖的package包/类
private void showNotification(Notification notification, String style) {
// keep the notification visible a little while after moving the
// mouse, or until clicked
notification.setPosition(Position.TOP_CENTER);
notification.setStyleName(ValoTheme.NOTIFICATION_BAR);
notification.setDelayMsec(2000);
notification.show(Page.getCurrent());
}
示例14: showErrorNotification
import com.vaadin.shared.Position; //导入依赖的package包/类
/**
* Displays a message box telling that the action is not allowed.
*
* @param drag
* the current drag event holding the context.
*/
private void showErrorNotification(VDragEvent drag) {
VNotification n = VNotification.createNotification(SPUILabelDefinitions.SP_DELAY,
drag.getTransferable().getDragSource().getWidget());
n.show(getDraggableTemplate().notificationMsg(SPUILabelDefinitions.ACTION_NOT_ALLOWED).asString(),
Position.BOTTOM_RIGHT, SPUILabelDefinitions.SP_NOTIFICATION_ERROR_MESSAGE_STYLE);
}
示例15: decorate
import com.vaadin.shared.Position; //导入依赖的package包/类
/**
* Decorate.
*
* @param styleName
* style name of message
* @param caption
* message caption
* @param description
* message description
* @param autoClose
* flag to indicate enable close option
*/
private void decorate(final String styleName, final String caption, final String description,
final Boolean autoClose) {
setCaption(caption);
setDescription(description);
setStyleName(styleName);
setHtmlContentAllowed(true);
setPosition(Position.BOTTOM_RIGHT);
if (autoClose) {
setDelayMsec(SPUILabelDefinitions.SP_DELAY);
} else {
setDelayMsec(-1);
}
}