Example usage for com.vaadin.ui CssLayout CssLayout

List of usage examples for com.vaadin.ui CssLayout CssLayout

Introduction

In this page you can find the example usage for com.vaadin.ui CssLayout CssLayout.

Prototype

public CssLayout() 

Source Link

Document

Constructs an empty CssLayout.

Usage

From source file:de.fatalix.bookery.view.login.LoginView.java

License:Open Source License

private CssLayout buildLoginInformation() {
    CssLayout loginInformation = new CssLayout();
    loginInformation.setStyleName("login-information");
    Label loginInfoText = new Label("<h1>Welcome to Bookery</h1>"
            + "Please provide your login to access your library. If you have problems logging in, please contact your administrator.",
            ContentMode.HTML);//from   ww w  .  j  a va 2s  . c om
    loginInformation.addComponent(loginInfoText);
    return loginInformation;
}

From source file:de.kaiserpfalzEdv.vaadin.LoginScreen.java

License:Apache License

private Component buildLoginForm() {
    FormLayout loginForm = new FormLayout();

    loginForm.addStyleName("login-form");
    loginForm.setSizeUndefined();/*w ww  . ja va 2s.  c om*/
    loginForm.setMargin(false);

    loginForm.addComponent(username = new TextField(translate("login.name.caption")));
    username.setDescription(translate("login.name.description"));
    username.setWidth(15, Unit.EM);
    loginForm.addComponent(password = new PasswordField(translate("login.password.caption")));
    password.setWidth(15, Unit.EM);
    password.setDescription(translate("login.password.description"));
    CssLayout buttons = new CssLayout();
    buttons.setStyleName("buttons");
    loginForm.addComponent(buttons);

    login = new Button(translate("login.login-button.caption"));
    buttons.addComponent(login);
    login.setDescription(translate("login.login-button.description"));
    login.setDisableOnClick(true);
    login.addClickListener(event -> {
        try {
            login();
        } finally {
            login.setEnabled(true);
        }
    });
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addStyleName(ValoTheme.BUTTON_FRIENDLY);

    Button forgotPassword;
    buttons.addComponent(forgotPassword = new Button(translate("login.password-forgotten.caption")));
    forgotPassword.setDescription(translate("login.password-forgotten.description"));
    forgotPassword.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            NotificationPayload notification = new NotificationPayload("login.password-forgotten.text");
            bus.post(new NotificationEvent(this, notification));
        }
    });
    forgotPassword.addStyleName(ValoTheme.BUTTON_LINK);
    return loginForm;
}

From source file:de.kaiserpfalzEdv.vaadin.LoginScreen.java

License:Apache License

private CssLayout buildLoginInformation() {
    CssLayout loginInformation = new CssLayout();
    loginInformation.setStyleName("login-information");
    Label loginInfoText = new Label(translate("login.info-text"), ContentMode.HTML);
    loginInformation.addComponent(loginInfoText);
    return loginInformation;
}

From source file:de.kaiserpfalzEdv.vaadin.menu.impl.MenuImpl.java

License:Apache License

@Inject
public MenuImpl(final Authenticator accessControl, final EventBus bus, final I18NHandler i18n,
        final List<View> allViews) {
    this.accessControl = accessControl;
    this.bus = bus;
    this.i18n = i18n;
    this.allViews = allViews;

    setPrimaryStyleName(ValoTheme.MENU_ROOT);
    menuPart = new CssLayout();
    menuPart.addStyleName(ValoTheme.MENU_PART);

    // header of the menu
    final HorizontalLayout top = new HorizontalLayout();
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName(ValoTheme.MENU_TITLE);
    top.setSpacing(true);//from w  ww  . ja v  a  2 s  .c o m
    Label title = new Label(translate("application.name"));
    title.addStyleName(ValoTheme.LABEL_H3);
    title.setSizeUndefined();
    Image image = new Image(null, new ThemeResource("img/table-logo.png"));
    image.setStyleName("logo");
    top.addComponent(image);
    top.addComponent(title);
    menuPart.addComponent(top);

    // logout menu item
    MenuBar logoutMenu = new MenuBar();
    logoutMenu.addItem(translate("button.logout.caption"), FontAwesome.valueOf(translate("button.logout.icon")),
            selectedItem -> {
                VaadinSession.getCurrent().getSession().invalidate();
                Page.getCurrent().reload();
            });

    logoutMenu.addStyleName("user-menu");
    menuPart.addComponent(logoutMenu);

    // button for toggling the visibility of the menu when on a small screen
    final Button showMenu = new Button(translate("application.name"), new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) {
                menuPart.removeStyleName(VALO_MENU_VISIBLE);
            } else {
                menuPart.addStyleName(VALO_MENU_VISIBLE);
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName(VALO_MENU_TOGGLE);
    showMenu.setIcon(FontAwesome.NAVICON);
    menuPart.addComponent(showMenu);

    // container for the navigation buttons, which are added by addView()
    menuItemsLayout = new CssLayout();
    menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS);
    menuPart.addComponent(menuItemsLayout);

    addComponent(menuPart);
}

From source file:de.kaiserpfalzEdv.vaadin.PiraccUI.java

License:Apache License

protected void showMainView() {
    HorizontalLayout screen = new HorizontalLayout();

    CssLayout viewContainer = new CssLayout();
    viewContainer.addStyleName("valo-content");
    viewContainer.setSizeFull();/*from   w  w  w  .  ja  v  a 2 s  .  co m*/

    screen.setStyleName("main-screen");
    screen.addComponent(menu);
    screen.addComponent(viewContainer);
    screen.setExpandRatio(viewContainer, 1);
    screen.setSizeFull();

    Navigator navigator = new Navigator(this, viewContainer);
    navigator.addProvider(viewProvider);

    addStyleName(ValoTheme.UI_WITH_MENU);
    setContent(screen);

    if (isNotBlank(getNavigator().getState())) {
        getNavigator().navigateTo(getNavigator().getState());
    }

    menu.generate();
}

From source file:de.lmu.ifi.dbs.knowing.vaadin.MainApplication.java

License:Apache License

private Window getAboutDialog() {
    if (aboutWindow == null) {
        aboutWindow = new Window("About...");
        aboutWindow.setModal(true);//from  www  .  j a  va2s . c o  m
        aboutWindow.setWidth("400px");

        VerticalLayout layout = (VerticalLayout) aboutWindow.getContent();
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.setStyleName("grey");

        CssLayout titleLayout = new CssLayout();
        H2 title = new H2("Knowing Vaadin Application");
        titleLayout.addComponent(title);
        SmallText description = new SmallText("<br>Copyright (c) Nepomuk Seiler, LMU Database <br>"
                + "Licensed under Apache Software Foundation 2.0 license (ASF).<br><br>"
                + "This software contains modules licenced under<br>"
                + " the Apache Software Foundation 2.0 license (ASF) and EPL<br><br>"
                + "Many thanks to Kai Tdter, Chris Brind, Neil Bartlett and<br>"
                + " Petter Holmstrm for their OSGi and Vaadin<br>"
                + " related work, blogs, and bundles.<br><br>"
                + "The icons are from the Silk icon set by Mark James<br>"
                + "<a href=\"http://www.famfamfam.com/lab/icons/silk/\">http://www.famfamfam.com/lab/icons/silk/</a>");
        description.setSizeUndefined();
        description.setContentMode(Label.CONTENT_XHTML);

        titleLayout.addComponent(description);
        aboutWindow.addComponent(titleLayout);

        @SuppressWarnings("serial")
        Button close = new Button("Close", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                (aboutWindow.getParent()).removeWindow(aboutWindow);
            }

        });
        layout.addComponent(close);
        layout.setComponentAlignment(close, Alignment.TOP_RIGHT);
    }
    return aboutWindow;
}

From source file:de.metas.ui.web.vaadin.login.LoginViewImpl.java

License:Open Source License

public LoginViewImpl() {
    super();//from  w ww .  j a v a 2  s. co  m

    setSizeFull();

    mainPanel.setSizeUndefined();
    mainPanel.setSpacing(true);
    // loginPanel.addStyleName("login-panel");

    //
    // Header
    {
        final CssLayout labels = new CssLayout();
        labels.addStyleName("labels");

        final Image logo = new Image();
        logo.setSource(Theme.getProductLogoLargeResource());
        mainPanel.addComponent(logo);
    }

    //
    // Fields
    {
        currentPanel = loginPanel;
        mainPanel.addComponent(loginPanel);
        loginPanel.focus();
    }

    //
    addComponent(mainPanel);
    setComponentAlignment(mainPanel, Alignment.MIDDLE_CENTER);
}

From source file:de.metas.ui.web.vaadin.window.view.WindowRecordIndicators.java

License:Open Source License

public WindowRecordIndicators() {
    super();//  w w  w  . j  a v a 2  s  . c  o m
    addStyleName(STYLE);

    this.content = new CssLayout() {
        @Override
        protected String getCss(Component c) {
            return getIndicatorCss(c);
        }
    };
    setCompositionRoot(content);
    content.addStyleName(STYLE + "-container");

    load();
}

From source file:de.symeda.sormas.ui.dashboard.statistics.DashboardStatisticsSubComponent.java

License:Open Source License

public CssLayout createCountLayout(boolean addMarginBottom) {
    CssLayout countLayout = new CssLayout();
    countLayout.setWidthUndefined();// ww w .  j a v a  2  s.c  om
    if (addMarginBottom) {
        CssStyles.style(countLayout, CssStyles.VSPACE_3);
    }
    return countLayout;
}

From source file:de.symeda.sormas.ui.login.LoginScreen.java

License:Open Source License

private void buildUI() {
    addStyleName("login-screen");

    // login form, centered in the available part of the screen
    VerticalLayout loginFormLayout = new VerticalLayout();
    loginFormLayout.addStyleName("login-form");
    loginFormLayout.setMargin(false);//from w ww. java2s .  c o m
    Component loginForm = buildLoginForm();
    loginFormLayout.addComponent(loginForm);
    loginFormLayout.addComponent(buildLoginDetailsLayout());

    // layout to center login form when there is sufficient screen space
    // - see the theme for how this is made responsive for various screen
    // sizes
    CssLayout loginLayout = new CssLayout();
    loginLayout.setStyleName("login-form-container");
    loginLayout.addComponent(loginFormLayout);

    // information text about logging in
    CssLayout loginInformation = buildLoginInformation();

    // custom html layout
    CssLayout loginSidebarLayout = buildLoginSidebarLayout();

    addComponent(loginInformation);
    addComponent(loginLayout);
    addComponent(loginSidebarLayout);
}