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;
}
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;
}
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;
}
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;
}
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);
}
}
Aggregations