List of usage examples for com.vaadin.ui CssLayout addStyleName
@Override public void addStyleName(String style)
From source file:com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu.java
private Component buildMenuItems() { CssLayout menuItemsLayout = new CssLayout(); menuItemsLayout.addStyleName("valo-menuitems"); for (final DashboardViewType view : DashboardViewType.values()) { Component menuItemComponent = new ValoMenuItemButton(view); /*// w ww .ja v a 2 s. c o m if (view == DashboardViewType.REPORTS) { // Add drop target to reports button DragAndDropWrapper reports = new DragAndDropWrapper( menuItemComponent); reports.setSizeUndefined(); reports.setDragStartMode(DragStartMode.NONE); reports.setDropHandler(new DropHandler() { @Override public void drop(final DragAndDropEvent event) { UI.getCurrent() .getNavigator() .navigateTo( DashboardViewType.REPORTS.getViewName()); Table table = (Table) event.getTransferable() .getSourceComponent(); DashboardEventBus.post(new TransactionReportEvent( (Collection<Transaction>) table.getValue())); } @Override public AcceptCriterion getAcceptCriterion() { return AcceptItem.ALL; } }); menuItemComponent = reports; }*/ if (view == DashboardViewType.DASHBOARD) { notificationsBadge = new Label(); notificationsBadge.setId(NOTIFICATIONS_BADGE_ID); menuItemComponent = buildBadgeWrapper(menuItemComponent, notificationsBadge); } if (view == DashboardViewType.REPORTS) { reportsBadge = new Label(); reportsBadge.setId(REPORTS_BADGE_ID); menuItemComponent = buildBadgeWrapper(menuItemComponent, reportsBadge); } menuItemsLayout.addComponent(menuItemComponent); } return menuItemsLayout; }
From source file:com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu.java
private Component buildBadgeWrapper(final Component menuItemButton, final Component badgeLabel) { CssLayout dashboardWrapper = new CssLayout(menuItemButton); dashboardWrapper.addStyleName("badgewrapper"); dashboardWrapper.addStyleName(ValoTheme.MENU_ITEM); badgeLabel.addStyleName(ValoTheme.MENU_BADGE); badgeLabel.setWidthUndefined();// w w w .j av a2s .c o m badgeLabel.setVisible(false); dashboardWrapper.addComponent(badgeLabel); return dashboardWrapper; }
From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoginView.java
private Component buildLabels() { CssLayout labels = new CssLayout(); labels.addStyleName("labels"); Label welcome = new Label("Welcome"); welcome.setSizeUndefined();// ww w . j a v a2 s . co m welcome.addStyleName(ValoTheme.LABEL_H4); welcome.addStyleName(ValoTheme.LABEL_COLORED); labels.addComponent(welcome); Label title = new Label("PFServer Dashboard"); title.setSizeUndefined(); title.addStyleName(ValoTheme.LABEL_H3); title.addStyleName(ValoTheme.LABEL_LIGHT); labels.addComponent(title); return labels; }
From source file:de.fatalix.app.view.login.LoginView.java
public LoginView() { CssLayout rootLayout = new CssLayout(); rootLayout.addStyleName("login-screen"); Component loginForm = buildLoginForm(); VerticalLayout centeringLayout = new VerticalLayout(); centeringLayout.setStyleName("centering-layout"); centeringLayout.addComponent(loginForm); centeringLayout.setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER); CssLayout loginInformation = buildLoginInformation(); rootLayout.addComponent(centeringLayout); rootLayout.addComponent(loginInformation); setCompositionRoot(rootLayout);//from w w w.j ava2 s. c om }
From source file:de.fatalix.bookery.App.java
License:Open Source License
@Override protected void init(VaadinRequest request) { Navigator navigator = new Navigator(this, appLayout.getMainContent()); navigator.addProvider(viewProvider); CssLayout contentWrapper = new CssLayout(); contentWrapper.addStyleName("crud-view"); contentWrapper.setSizeFull();/*from w ww. j av a 2 s .c o m*/ contentWrapper.addComponents(appLayout, bookMenuLayout, bookDetailLayout); setContent(contentWrapper); getNavigator().addViewChangeListener(new ViewChangeListener() { @Override public boolean beforeViewChange(ViewChangeListener.ViewChangeEvent event) { if (!isLoggedIn()) { appLayout.getAppHeader().setVisible(false); if (!event.getViewName().equals(LoginView.id)) { getNavigator().navigateTo(LoginView.id); return false; } return true; } else { appLayout.getAppHeader().setVisible(isLoggedIn()); appLayout.getAppHeader().setLoginName(SecurityUtils.getSubject().getPrincipal().toString()); if (event.getViewName().equals("")) { getNavigator().navigateTo(HomeView.id); return false; } return true; } } @Override public void afterViewChange(ViewChangeListener.ViewChangeEvent event) { } }); if (!isLoggedIn()) { appLayout.getAppHeader().setVisible(false); getNavigator().navigateTo(LoginView.id); } else { appLayout.getAppHeader().setVisible(isLoggedIn()); appLayout.getAppHeader().setLoginName(SecurityUtils.getSubject().getPrincipal().toString()); if (getNavigator().getState().isEmpty()) { getNavigator().navigateTo(HomeView.id); } } }
From source file:de.fatalix.bookery.view.login.LoginView.java
License:Open Source License
public LoginView() { setSizeFull();/* www . ja va2 s.c o m*/ CssLayout rootLayout = new CssLayout(); rootLayout.addStyleName("login-screen"); Component loginForm = buildLoginForm(); VerticalLayout centeringLayout = new VerticalLayout(); centeringLayout.setStyleName("centering-layout"); centeringLayout.addComponent(loginForm); centeringLayout.setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER); CssLayout loginInformation = buildLoginInformation(); rootLayout.addComponent(centeringLayout); rootLayout.addComponent(loginInformation); setCompositionRoot(rootLayout); }
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();/* w w w . j a va 2 s . c o 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.metas.procurement.webui.ui.view.LoginView.java
License:Open Source License
public LoginView() { super();/* w w w.j ava2 s . co m*/ Application.autowire(this); addStyleName(STYLE); // // Content { final VerticalComponentGroup content = new VerticalComponentGroup(); final Resource logoResource = getLogoResource(); final Image logo = new Image(null, logoResource); logo.addStyleName(STYLE_Logo); content.addComponent(logo); this.email = new EmailField(i18n.get("LoginView.fields.email")); email.addStyleName(STYLE_LoginEmail); email.setIcon(FontAwesome.USER); content.addComponent(email); this.password = new PasswordField(i18n.get("LoginView.fields.password")); password.addStyleName(STYLE_LoginPassword); password.setIcon(FontAwesome.LOCK); content.addComponent(password); final Button loginButton = new Button(i18n.get("LoginView.fields.loginButton")); loginButton.addStyleName(STYLE_LoginButton); loginButton.setClickShortcut(KeyCode.ENTER); loginButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { onUserLogin(email.getValue(), password.getValue()); } }); final Button forgotPasswordButton = new Button(i18n.get("LoginView.fields.forgotPasswordButton")); forgotPasswordButton.setStyleName(STYLE_ForgotPasswordButton); forgotPasswordButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { onForgotPassword(email.getValue()); } }); final CssLayout contentWrapper = new CssLayout(content, loginButton, forgotPasswordButton); contentWrapper.addStyleName(STYLE_LoginFormWrapper); setContent(contentWrapper); } // // Bottom: { // // Powered-by logo resource // Use the configured one if any; fallback to default embedded powered-by logo final Resource poweredByLogoResource; if (poweredByLogoUrl != null && !poweredByLogoUrl.trim().isEmpty()) { poweredByLogoResource = new ExternalResource(poweredByLogoUrl.trim()); } else { poweredByLogoResource = Constants.RESOURCE_PoweredBy; } // // Powered-by component: final Component poweredByComponent; if (poweredByLinkUrl != null && !poweredByLinkUrl.trim().isEmpty()) { final Link link = new Link(); link.setIcon(poweredByLogoResource); link.setResource(new ExternalResource(poweredByLinkUrl.trim())); link.setTargetName("_blank"); poweredByComponent = link; } else { final Image image = new Image(null, poweredByLogoResource); poweredByComponent = image; } // poweredByComponent.addStyleName(STYLE_PoweredBy); setToolbar(poweredByComponent); } }
From source file:de.metas.ui.web.vaadin.login.LoginViewImpl.java
License:Open Source License
public LoginViewImpl() { super();//from w w w . j a v a2 s. c o 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.symeda.sormas.ui.MainScreen.java
License:Open Source License
public MainScreen(SormasUI ui) { CssLayout viewContainer = new CssLayout(); viewContainer.setSizeFull();/*from www .ja v a 2 s. c om*/ viewContainer.addStyleName("sormas-content"); final Navigator navigator = new Navigator(ui, viewContainer); navigator.setErrorProvider(new ViewProvider() { @Override public String getViewName(String viewAndParameters) { return viewAndParameters; } @Override public View getView(String viewName) { try { // Add new views to this clause to make sure that the right error page is shown if (viewName.equals(SurveillanceDashboardView.VIEW_NAME) || viewName.equals(ContactsDashboardView.VIEW_NAME) || viewName.equals(TasksView.VIEW_NAME) || viewName.equals(CasesView.VIEW_NAME) || viewName.equals(ContactsView.VIEW_NAME) || viewName.equals(EventsView.VIEW_NAME) || viewName.equals(SamplesView.VIEW_NAME) || viewName.equals(ReportsView.VIEW_NAME) || viewName.equals(StatisticsView.VIEW_NAME) || viewName.equals(UsersView.VIEW_NAME) || viewName.equals(OutbreaksView.VIEW_NAME) || viewName.equals(RegionsView.VIEW_NAME) || viewName.equals(DistrictsView.VIEW_NAME) || viewName.equals(CommunitiesView.VIEW_NAME) || viewName.equals(HealthFacilitiesView.VIEW_NAME) || viewName.equals(LaboratoriesView.VIEW_NAME) || viewName.equals(PointsOfEntryView.VIEW_NAME) || viewName.equals(UserRightsView.VIEW_NAME)) { return AccessDeniedView.class.newInstance(); } else { return ErrorView.class.newInstance(); } } catch (Exception e) { throw new RuntimeException(e); } } }); menu = new Menu(navigator); if (UserProvider.getCurrent().hasUserRight(UserRight.DASHBOARD_VIEW)) { ControllerProvider.getDashboardController().registerViews(navigator); } if (UserProvider.getCurrent().hasUserRight(UserRight.DASHBOARD_SURVEILLANCE_ACCESS)) { menu.addView(SurveillanceDashboardView.class, AbstractDashboardView.ROOT_VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuDashboard), VaadinIcons.DASHBOARD); } else if (UserProvider.getCurrent().hasUserRight(UserRight.DASHBOARD_CONTACT_ACCESS)) { menu.addView(ContactsDashboardView.class, AbstractDashboardView.ROOT_VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuDashboard), VaadinIcons.DASHBOARD); } if (UserProvider.getCurrent().hasUserRight(UserRight.TASK_VIEW)) { menu.addView(TasksView.class, TasksView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuTasks), VaadinIcons.TASKS); } if (UserProvider.getCurrent().hasUserRight(UserRight.CASE_VIEW)) { ControllerProvider.getCaseController().registerViews(navigator); menu.addView(CasesView.class, CasesView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuCases), VaadinIcons.EDIT); } if (UserProvider.getCurrent().hasUserRight(UserRight.CONTACT_VIEW)) { ControllerProvider.getContactController().registerViews(navigator); menu.addView(ContactsView.class, ContactsView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuContacts), VaadinIcons.HAND); } if (UserProvider.getCurrent().hasUserRight(UserRight.EVENT_VIEW)) { ControllerProvider.getEventController().registerViews(navigator); menu.addView(EventsView.class, EventsView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuEvents), VaadinIcons.PHONE); } if (UserProvider.getCurrent().hasUserRight(UserRight.SAMPLE_VIEW)) { ControllerProvider.getSampleController().registerViews(navigator); menu.addView(SamplesView.class, SamplesView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuSamples), VaadinIcons.DATABASE); } if (UserProvider.getCurrent().hasUserRight(UserRight.WEEKLYREPORT_VIEW)) { menu.addView(ReportsView.class, ReportsView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuReports), VaadinIcons.FILE_TEXT); } if (UserProvider.getCurrent().hasUserRight(UserRight.STATISTICS_ACCESS)) { ControllerProvider.getStatisticsController().registerViews(navigator); menu.addView(StatisticsView.class, AbstractStatisticsView.ROOT_VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuStatistics), VaadinIcons.BAR_CHART); } if (UserProvider.getCurrent().hasUserRight(UserRight.USER_VIEW)) { menu.addView(UsersView.class, UsersView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuUsers), VaadinIcons.USERS); } if (UserProvider.getCurrent().hasUserRight(UserRight.CONFIGURATION_ACCESS)) { AbstractConfigurationView.registerViews(navigator); menu.addView(OutbreaksView.class, AbstractConfigurationView.ROOT_VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuConfiguration), VaadinIcons.COGS); } menu.addView(AboutView.class, AboutView.VIEW_NAME, I18nProperties.getCaption(Captions.mainMenuAbout), VaadinIcons.INFO_CIRCLE); navigator.addViewChangeListener(viewChangeListener); ui.setNavigator(navigator); addComponent(menu); addComponent(viewContainer); setExpandRatio(viewContainer, 1); setSpacing(false); setMargin(false); setSizeFull(); }