当前位置: 首页>>代码示例>>Java>>正文


Java Position类代码示例

本文整理汇总了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);
}
 
开发者ID:vaadin,项目名称:material-theme-fw8,代码行数:27,代码来源:SnackbarsToastsView.java

示例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());
}
 
开发者ID:viydaag,项目名称:vaadin-fluent-api,代码行数:19,代码来源:FNotificationTest.java

示例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());
}
 
开发者ID:mcollovati,项目名称:vaadin-vertx-samples,代码行数:18,代码来源:LoginView.java

示例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() }));
    }
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:18,代码来源:ErrorView.java

示例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());
    }
}
 
开发者ID:JumpMind,项目名称:sqlexplorer-vaadin,代码行数:19,代码来源:CommonUiUtils.java

示例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());
		
	}
	
}
 
开发者ID:GJRTimmer,项目名称:vaadin-security-template,代码行数:21,代码来源:LoginUI.java

示例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());
		}
	});

}
 
开发者ID:rlsutton1,项目名称:VaadinUtils,代码行数:17,代码来源:VUNotification.java

示例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);
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:17,代码来源:UiController.java

示例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());
}
 
开发者ID:Horuss,项目名称:bbplay,代码行数:8,代码来源:BBPlay.java

示例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());
}
 
开发者ID:Horuss,项目名称:bbplay,代码行数:8,代码来源:BBPlay.java

示例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;
}
 
开发者ID:imotSpot,项目名称:imotSpot,代码行数:37,代码来源:ProfilePreferencesWindow.java

示例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;
}
 
开发者ID:mcollovati,项目名称:vaadin-vertx-samples,代码行数:37,代码来源:ProfilePreferencesWindow.java

示例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());
}
 
开发者ID:felixhusse,项目名称:bookery,代码行数:9,代码来源:LoginView.java

示例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);
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:13,代码来源:ViewClientCriterion.java

示例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);
    }
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:26,代码来源:NotificationMessage.java


注:本文中的com.vaadin.shared.Position类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。