Search in sources :

Example 51 with CssLayout

use of com.vaadin.ui.CssLayout in project Eclipse-Kuksa-Automotive-Edge-Extension by max-grzanna.

the class AppsListView method createPaginationComponent.

public Component createPaginationComponent(int total, int currentpage, int limit) {
    final Pagination pagination = createPagination(total, currentpage, limit);
    pagination.setItemsPerPageVisible(false);
    pagination.setEnabled(true);
    pagination.setResponsive(true);
    pagination.setTotalCount(total);
    pagination.setCurrentPage(currentpage);
    pagination.addPageChangeListener(new PaginationChangeListener() {

        @Override
        public void changed(PaginationResource event) {
            Page<App> appsList = findByText(serachText.getValue(), comboBox.getValue(), event.pageIndex(), event.limit());
            CssLayout appslayoutnew = new CssLayout();
            appslayoutnew = AppGridView.crateAppGridView(appsList, 3);
            mainlayout.removeAllComponents();
            mainlayout.addComponent(navHeaderLayout);
            mainlayout.addComponent(actions);
            mainlayout.addComponent(appslayoutnew);
            mainlayout.addComponent(paginationComponent);
            setCompositionRoot(mainlayout);
        }
    });
    final VerticalLayout layout = createContent(pagination);
    return layout;
}
Also used : Pagination(com.vaadin.addon.pagination.Pagination) CssLayout(com.vaadin.ui.CssLayout) PaginationChangeListener(com.vaadin.addon.pagination.PaginationChangeListener) VerticalLayout(com.vaadin.ui.VerticalLayout) Page(org.springframework.data.domain.Page) PaginationResource(com.vaadin.addon.pagination.PaginationResource)

Example 52 with CssLayout

use of com.vaadin.ui.CssLayout in project SORMAS-Project by hzi-braunschweig.

the class LoginScreen method buildLoginDetails.

private CssLayout buildLoginDetails() {
    CssLayout loginDetailsLayout = new CssLayout();
    loginDetailsLayout.setStyleName(CssStyles.LOGINDEATILS);
    loginDetailsLayout.setWidth(100, Unit.PERCENTAGE);
    Label htmlLabel = new Label();
    htmlLabel.setContentMode(ContentMode.HTML);
    htmlLabel.setWidth(100, Unit.PERCENTAGE);
    Path customHtmlDirectory = Paths.get(FacadeProvider.getConfigFacade().getCustomFilesPath());
    Path filePath = customHtmlDirectory.resolve("logindetails.html");
    try {
        byte[] encoded = Files.readAllBytes(filePath);
        htmlLabel.setValue(new String(encoded, UTF_8));
    } catch (IOException e) {
        htmlLabel.setValue("");
    }
    loginDetailsLayout.addComponent(htmlLabel);
    return loginDetailsLayout;
}
Also used : Path(java.nio.file.Path) CssLayout(com.vaadin.ui.CssLayout) Label(com.vaadin.ui.Label) IOException(java.io.IOException)

Example 53 with CssLayout

use of com.vaadin.ui.CssLayout in project SORMAS-Project by hzi-braunschweig.

the class LoginScreen method buildLogin.

private Component buildLogin() {
    // login form, centered in the available part of the screen
    VerticalLayout loginFormLayout = new VerticalLayout();
    CssStyles.style(loginFormLayout, CssStyles.LOGINFORM, CssStyles.LAYOUT_SPACIOUS);
    loginFormLayout.setMargin(true);
    loginFormLayout.setSpacing(false);
    // header of the menu
    final HorizontalLayout titleLayout = new HorizontalLayout();
    titleLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    titleLayout.setSpacing(false);
    Label title = new Label(FacadeProvider.getConfigFacade().getSormasInstanceName());
    CssStyles.style(title, CssStyles.H1, CssStyles.VSPACE_NONE, CssStyles.VSPACE_TOP_NONE, CssStyles.HSPACE_LEFT_3);
    Image image;
    if (isCustomBranding && StringUtils.isNotBlank(FacadeProvider.getConfigFacade().getCustomBrandingLogoPath())) {
        Path logoPath = Paths.get(FacadeProvider.getConfigFacade().getCustomBrandingLogoPath());
        image = new Image(null, new FileResource(logoPath.toFile()));
        image.setWidth(50, Unit.PIXELS);
    } else {
        image = new Image(null, new ThemeResource("img/sormas-logo.png"));
    }
    titleLayout.addComponent(image);
    titleLayout.addComponent(title);
    loginFormLayout.addComponent(titleLayout);
    Label header = new Label(I18nProperties.getCaption(Captions.Login_login));
    CssStyles.style(header, CssStyles.H2);
    loginFormLayout.addComponent(header);
    Component loginForm = buildLoginForm();
    loginFormLayout.addComponent(loginForm);
    loginFormLayout.addComponent(buildLoginDetails());
    // 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(CssStyles.LOGINFORM_CONTAINER);
    loginLayout.addComponent(loginFormLayout);
    return loginLayout;
}
Also used : Path(java.nio.file.Path) CssLayout(com.vaadin.ui.CssLayout) Label(com.vaadin.ui.Label) FileResource(com.vaadin.server.FileResource) VerticalLayout(com.vaadin.ui.VerticalLayout) ThemeResource(com.vaadin.server.ThemeResource) Image(com.vaadin.ui.Image) Component(com.vaadin.ui.Component) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 54 with CssLayout

use of com.vaadin.ui.CssLayout in project SORMAS-Project by hzi-braunschweig.

the class LoginScreen method buildLoginSidebarLayout.

private Layout buildLoginSidebarLayout() {
    CssLayout loginSidebarLayout = new CssLayout();
    CssStyles.style(loginSidebarLayout, CssStyles.LOGINSIDEBAR);
    VerticalLayout sidebarHeaderLayout = new VerticalLayout();
    CssStyles.style(sidebarHeaderLayout, CssStyles.LAYOUT_SPACIOUS);
    sidebarHeaderLayout.setSizeUndefined();
    sidebarHeaderLayout.setSpacing(false);
    Path customHtmlDirectory = Paths.get(FacadeProvider.getConfigFacade().getCustomFilesPath());
    if (isCustomBranding) {
        Path sidebarHeaderPath = customHtmlDirectory.resolve("loginsidebar-header.html");
        Label customSidebarHeaderLabel = new Label();
        CssStyles.style(sidebarHeaderLayout, CssStyles.LOGINSIDEBAR_CUSTOM_HEADER);
        customSidebarHeaderLabel.setContentMode(ContentMode.HTML);
        try {
            byte[] encoded = Files.readAllBytes(sidebarHeaderPath);
            customSidebarHeaderLabel.setValue(new String(encoded, StandardCharsets.UTF_8));
        } catch (IOException e) {
            customSidebarHeaderLabel.setValue("");
        }
        sidebarHeaderLayout.addComponent(customSidebarHeaderLabel);
    } else {
        Image img = new Image(null, new ThemeResource("img/sormas-logo-big-text.png"));
        img.setWidth(320, Unit.PIXELS);
        sidebarHeaderLayout.addComponent(img);
        sidebarHeaderLayout.setComponentAlignment(img, Alignment.TOP_CENTER);
        Label fullNameText = new Label("Surveillance,<br>Outbreak Response Management<br>and Analysis System<br>", ContentMode.HTML);
        fullNameText.setWidth(320, Unit.PIXELS);
        CssStyles.style(fullNameText, CssStyles.H2, CssStyles.LABEL_PRIMARY, CssStyles.VSPACE_TOP_NONE, CssStyles.ALIGN_CENTER);
        sidebarHeaderLayout.addComponent(fullNameText);
        sidebarHeaderLayout.setComponentAlignment(fullNameText, Alignment.TOP_CENTER);
        Label missionText = new Label("• " + I18nProperties.getCaption(Captions.LoginSidebar_diseasePrevention) + "<br>• " + I18nProperties.getCaption(Captions.LoginSidebar_diseaseDetection) + "<br>• " + I18nProperties.getCaption(Captions.LoginSidebar_outbreakResponse), ContentMode.HTML);
        missionText.setWidth(320, Unit.PIXELS);
        CssStyles.style(missionText, CssStyles.H2, CssStyles.VSPACE_TOP_NONE, CssStyles.ALIGN_CENTER);
        sidebarHeaderLayout.addComponent(missionText);
        sidebarHeaderLayout.setComponentAlignment(missionText, Alignment.TOP_CENTER);
    }
    loginSidebarLayout.addComponent(sidebarHeaderLayout);
    Label poweredByLabel = new Label(I18nProperties.getCaption(Captions.LoginSidebar_poweredBy));
    CssStyles.style(poweredByLabel, CssStyles.LOGIN_HEADLINELABEL, CssStyles.H2, CssStyles.VSPACE_NONE);
    loginSidebarLayout.addComponent(poweredByLabel);
    GridLayout poweredByLayout = new GridLayout(isCustomBranding ? 2 : 1, 1);
    CssStyles.style(poweredByLayout, CssStyles.LOGIN_LOGOCONTAINER);
    poweredByLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    poweredByLayout.setWidth(100, Unit.PERCENTAGE);
    poweredByLayout.setSpacing(true);
    if (isCustomBranding) {
        CssStyles.style(poweredByLayout, CssStyles.VSPACE_TOP_3);
        Image imgSormas = new Image(null, new ThemeResource("img/sormas-logo-horizontal.png"));
        imgSormas.setWidth(isCustomBranding ? CUSTOM_BRANDING_LOGO_WIDTH : LOGO_WIDTH, Unit.PIXELS);
        CssStyles.style(imgSormas, CssStyles.VSPACE_2);
        poweredByLayout.addComponent(imgSormas);
    } else {
        CssStyles.style(poweredByLayout, CssStyles.VSPACE_TOP_1);
    }
    Image imgHzi = new Image(null, new ThemeResource("img/hzi-logo.png"));
    imgHzi.setWidth(isCustomBranding ? CUSTOM_BRANDING_LOGO_WIDTH : LOGO_WIDTH, Unit.PIXELS);
    poweredByLayout.addComponent(imgHzi);
    Image imgSymeda = new Image(null, new ThemeResource("img/vitagroup-logo.png"));
    imgSymeda.setWidth(isCustomBranding ? CUSTOM_BRANDING_LOGO_WIDTH : LOGO_WIDTH, Unit.PIXELS);
    poweredByLayout.addComponent(imgSymeda);
    if (!isCustomBranding) {
        Image imgGiz = new Image(null, new ThemeResource("img/giz-logo.png"));
        imgGiz.setWidth(isCustomBranding ? CUSTOM_BRANDING_LOGO_WIDTH : LOGO_WIDTH, Unit.PIXELS);
        poweredByLayout.addComponent(imgGiz);
    }
    loginSidebarLayout.addComponent(poweredByLayout);
    Label customSidebarLabel = new Label();
    customSidebarLabel.setContentMode(ContentMode.HTML);
    Path sidebarPath = customHtmlDirectory.resolve("loginsidebar.html");
    try {
        byte[] encoded = Files.readAllBytes(sidebarPath);
        customSidebarLabel.setValue(new String(encoded, StandardCharsets.UTF_8));
    } catch (IOException e) {
        customSidebarLabel.setValue("");
    }
    loginSidebarLayout.addComponent(customSidebarLabel);
    return loginSidebarLayout;
}
Also used : Path(java.nio.file.Path) CssLayout(com.vaadin.ui.CssLayout) GridLayout(com.vaadin.ui.GridLayout) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) ThemeResource(com.vaadin.server.ThemeResource) IOException(java.io.IOException) Image(com.vaadin.ui.Image)

Example 55 with CssLayout

use of com.vaadin.ui.CssLayout in project SORMAS-Project by hzi-braunschweig.

the class LoginScreen method buildUI.

private void buildUI() {
    addStyleName(CssStyles.LOGINSCREEN_BACK);
    if (isCustomBranding && FacadeProvider.getConfigFacade().getLoginBackgroundPath() != null) {
        Page.Styles styles = Page.getCurrent().getStyles();
        styles.add(".v-app .login-screen-back { background-image: url(" + FacadeProvider.getConfigFacade().getLoginBackgroundPath() + ") !important; }");
    }
    CssLayout layout = new CssLayout();
    layout.addStyleName(CssStyles.LOGINSCREEN);
    addComponent(layout);
    layout.addComponent(buildLoginLayout());
    // custom html layout
    if (!isCustomBranding || FacadeProvider.getConfigFacade().isUseLoginSidebar()) {
        Layout loginSidebarLayout = buildLoginSidebarLayout();
        layout.addComponent(loginSidebarLayout);
    }
}
Also used : CssLayout(com.vaadin.ui.CssLayout) VerticalLayout(com.vaadin.ui.VerticalLayout) CssLayout(com.vaadin.ui.CssLayout) CustomLayout(com.vaadin.ui.CustomLayout) GridLayout(com.vaadin.ui.GridLayout) Layout(com.vaadin.ui.Layout) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Page(com.vaadin.server.Page)

Aggregations

CssLayout (com.vaadin.ui.CssLayout)69 Label (com.vaadin.ui.Label)25 Button (com.vaadin.ui.Button)12 VerticalLayout (com.vaadin.ui.VerticalLayout)12 HorizontalLayout (com.vaadin.ui.HorizontalLayout)11 Component (com.vaadin.ui.Component)7 ClickEvent (com.vaadin.ui.Button.ClickEvent)6 ClickListener (com.vaadin.ui.Button.ClickListener)6 List (java.util.List)6 CounterStatisticModel (com.github.markash.ui.component.card.CounterStatisticModel)5 CounterStatisticsCard (com.github.markash.ui.component.card.CounterStatisticsCard)5 Page (com.vaadin.server.Page)3 Layout (com.vaadin.ui.Layout)3 HorizontalFlexLayout (de.catma.ui.layout.HorizontalFlexLayout)3 Path (java.nio.file.Path)3 EventBus (com.google.common.eventbus.EventBus)2 ViewRiksdagenGovermentRoleMember (com.hack23.cia.model.internal.application.data.ministry.impl.ViewRiksdagenGovermentRoleMember)2 ViewRiksdagenMinistry (com.hack23.cia.model.internal.application.data.ministry.impl.ViewRiksdagenMinistry)2 ViewRiksdagenPartyRoleMember (com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartyRoleMember)2 ViewRiksdagenPartySummary (com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary)2