Example usage for com.vaadin.ui.themes ValoTheme BUTTON_SMALL

List of usage examples for com.vaadin.ui.themes ValoTheme BUTTON_SMALL

Introduction

In this page you can find the example usage for com.vaadin.ui.themes ValoTheme BUTTON_SMALL.

Prototype

String BUTTON_SMALL

To view the source code for com.vaadin.ui.themes ValoTheme BUTTON_SMALL.

Click Source Link

Document

Small size button.

Usage

From source file:nl.kpmg.lcm.ui.Application.java

License:Apache License

private Button createNotImplementedButton(String caption) {
    Button button = new Button(caption);
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addClickListener(new ClickListener() {
        @Override//from  w w w .jav a  2 s .  co  m
        public void buttonClick(ClickEvent event) {
            Notification.show("This functionality is not yet implemented.");
        }
    });
    return button;
}

From source file:org.bubblecloud.ilves.site.view.valo.DefaultValoView.java

License:Apache License

private CssLayout buildMenu() {

    final HorizontalLayout topLayout = new HorizontalLayout();
    topLayout.setWidth("100%");
    topLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    topLayout.addStyleName("valo-menu-title");
    menu.addComponent(topLayout);/*from w  ww. j  a va  2  s  .  c  om*/

    final Button showMenu = new Button("Menu", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (menu.getStyleName().contains("valo-menu-visible")) {
                menu.removeStyleName("valo-menu-visible");
            } else {
                menu.addStyleName("valo-menu-visible");
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName("valo-menu-toggle");
    showMenu.setIcon(FontAwesome.LIST);
    menu.addComponent(showMenu);

    final Label title = new Label("<h3>" + Site.getCurrent().localize(getViewVersion().getTitle()) + "</h3>",
            ContentMode.HTML);
    title.setSizeUndefined();
    topLayout.addComponent(title);
    topLayout.setExpandRatio(title, 1);

    final MenuBar settings = new MenuBar();
    settings.addStyleName("user-menu");

    final String user = Site.getCurrent().getSecurityProvider().getUser();
    final String userMenuCaption;
    final Resource userMenuIcon;
    if (user == null) {
        userMenuCaption = Site.getCurrent().localize("page-link-login");
        userMenuIcon = new ThemeResource("ilves_logo.png");
    } else {
        final URL gravatarUrl = GravatarUtil.getGravatarUrl(user, 64);
        userMenuIcon = new ExternalResource(gravatarUrl);
        userMenuCaption = ((SecurityProviderSessionImpl) Site.getCurrent().getSecurityProvider())
                .getUserFromSession().getFirstName();
    }

    final MenuBar.MenuItem settingsItem = settings.addItem(userMenuCaption, userMenuIcon, null);
    if (user != null) {
        settingsItem.addItem(Site.getCurrent().localize("page-link-account"), new MenuBar.Command() {
            @Override
            public void menuSelected(MenuBar.MenuItem selectedItem) {
                UI.getCurrent().getNavigator().navigateTo("account");
            }
        });
        settingsItem.addSeparator();
        settingsItem.addItem(Site.getCurrent().localize("button-logout"), new MenuBar.Command() {
            @Override
            public void menuSelected(MenuBar.MenuItem selectedItem) {
                LoginService.logout(Site.getCurrent().getSiteContext());
                final Company company = Site.getCurrent().getSiteContext().getObject(Company.class);
                getUI().getPage().setLocation(company.getUrl());
                getSession().getSession().invalidate();
                getSession().close();
            }
        });
    } else {
        settingsItem.addItem(Site.getCurrent().localize("page-link-login"), new MenuBar.Command() {
            @Override
            public void menuSelected(MenuBar.MenuItem selectedItem) {
                UI.getCurrent().getNavigator().navigateTo("login");
            }
        });
    }
    menu.addComponent(settings);

    menuItemsLayout.setPrimaryStyleName("valo-menuitems");
    menu.addComponent(menuItemsLayout);

    final Site site = Site.getCurrent();
    final NavigationVersion navigationVersion = site.getCurrentNavigationVersion();

    for (final String pageName : navigationVersion.getRootPages()) {
        final ViewVersion pageVersion = site.getCurrentViewVersion(pageName);
        if (pageVersion == null) {
            throw new SiteException("Unknown page: " + pageName);
        }
        if (pageVersion.getViewerRoles().length > 0) {
            boolean roleMatch = false;
            for (final String role : pageVersion.getViewerRoles()) {
                if (site.getSecurityProvider().getRoles().contains(role)) {
                    roleMatch = true;
                    break;
                }
            }
            if (!roleMatch) {
                continue;
            }
        }

        if (navigationVersion.hasChildPages(pageName)) {

            final String localizedPageName = pageVersion.isDynamic() ? pageName
                    : site.localize("page-link-" + pageName);

            final Label label = new Label(localizedPageName, ContentMode.HTML);
            label.setPrimaryStyleName("valo-menu-subtitle");
            label.addStyleName("h4");
            label.setSizeUndefined();
            menuItemsLayout.addComponent(label);

            final List<String> childPages = navigationVersion.getChildPages(pageName);
            for (final String childPage : childPages) {
                addMenuLink(navigationVersion, childPage);
            }

            label.setValue(
                    label.getValue() + " <span class=\"valo-menu-badge\">" + childPages.size() + "</span>");
        } else {
            addMenuLink(navigationVersion, pageName);
        }
    }

    return menu;
}

From source file:org.eclipse.hawkbit.ui.components.NotificationUnreadButton.java

License:Open Source License

/**
 * Constructor./* ww w.j a v  a2s.c  o  m*/
 * 
 * @param i18n
 *            i18n
 */
@Autowired
NotificationUnreadButton(final VaadinMessageSource i18n) {
    this.i18n = i18n;
    this.unreadNotifications = new ConcurrentHashMap<>();
    setIcon(FontAwesome.BELL);
    setId(UIComponentIdProvider.NOTIFICATION_UNREAD_ID);
    addStyleName(ValoTheme.BUTTON_SMALL);
    addStyleName(STYLE);
    setHtmlContentAllowed(true);
    setEnabled(false);
    createNotificationWindow();
    addClickListener(this::toggleWindow);
}

From source file:org.eclipse.hawkbit.ui.components.SPUIComponentProvider.java

License:Open Source License

/**
 * Get the style required./*www .j  ava 2s  .  c o  m*/
 *
 * @return String
 */
public static String getPinButtonStyle() {
    final StringBuilder pinStyle = new StringBuilder(ValoTheme.BUTTON_BORDERLESS_COLORED);
    pinStyle.append(' ');
    pinStyle.append(ValoTheme.BUTTON_SMALL);
    pinStyle.append(' ');
    pinStyle.append(ValoTheme.BUTTON_ICON_ONLY);
    pinStyle.append(' ');
    pinStyle.append("pin-icon");
    return pinStyle.toString();
}

From source file:org.eclipse.hawkbit.ui.decorators.SPUIButtonStylePrimarySmall.java

License:Open Source License

@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    button.addStyleName(ValoTheme.BUTTON_PRIMARY + " " + ValoTheme.BUTTON_SMALL);
    // Set Style//from   w w  w . j  a  v  a2s  .  c  o  m
    if (null != style) {
        if (setStyle) {
            button.setStyleName(style);
        } else {
            button.addStyleName(style);
        }

    }
    // Set icon
    if (null != icon) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.setIcon(icon);
    }
    return button;
}

From source file:org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmall.java

License:Open Source License

@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    if (style != null) {
        if (setStyle) {
            button.setStyleName(style);/*from   ww  w .  ja  va 2  s.c  om*/
        } else {
            button.addStyleName(style);
        }
    }
    if (icon != null) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.setIcon(icon);
    }
    return button;
}

From source file:org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorderUH.java

License:Open Source License

@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    button.setHeightUndefined();/*  w w  w .j a  v  a 2 s  .  c  om*/
    // Set Style
    if (null != style) {
        if (setStyle) {
            button.setStyleName(style);
        } else {
            button.addStyleName(style);
        }
    }
    // Set icon
    if (null != icon) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.setIcon(icon);
    }
    return button;
}

From source file:org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorderUHS.java

License:Open Source License

@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    button.setHeightUndefined();/* w w w  .java 2  s  .  c om*/
    button.setSizeUndefined();
    // Set Style
    if (null != style) {
        if (setStyle) {
            button.setStyleName(style);
        } else {
            button.addStyleName(style);
        }
    }
    // Set icon
    if (null != icon) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.setIcon(icon);
    }
    return button;
}

From source file:org.eclipse.hawkbit.ui.login.AbstractHawkbitLoginUI.java

License:Open Source License

private void buildSignInButton() {
    final String caption = isDemo ? i18n.getMessage("button.login.agreeandsignin")
            : i18n.getMessage("button.login.signin");

    signIn = new Button(caption);
    signIn.addStyleName(ValoTheme.BUTTON_PRIMARY + " " + ValoTheme.BUTTON_SMALL + " " + "login-button");
    signIn.setClickShortcut(KeyCode.ENTER);
    signIn.focus();/*w w  w  .ja va2s . co  m*/
    signIn.setId("login-signin");
}

From source file:org.eclipse.hawkbit.ui.login.LoginView.java

License:Open Source License

private void buildSignInButton() {
    signin = new Button(i18n.getMessage("button.login.signin"));
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY + " " + ValoTheme.BUTTON_SMALL + " " + "login-button");
    signin.setClickShortcut(KeyCode.ENTER);
    signin.focus();/*from w  ww.  j a v a  2  s.  co  m*/
    signin.setId("login-signin");
}