@Override protected void init(VaadinRequest request) { final VerticalLayout rootLayout = new VerticalLayout(); rootLayout.setSizeFull(); setContent(rootLayout); final CssLayout navigationBar = new CssLayout(); navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); navigationBar.addComponent(createNavigationButton("Demo View (Default)", Constants.VIEW_DEFAULT)); navigationBar.addComponent(createNavigationButton("Stream View", Constants.VIEW_STREAM)); rootLayout.addComponent(navigationBar); springViewDisplay = new Panel(); springViewDisplay.setSizeFull(); rootLayout.addComponent(springViewDisplay); rootLayout.setExpandRatio(springViewDisplay, 1.0f); }
private void buildSubmenu(CssLayout submenu, Set<OSCViewProvider<?>> views) { for (final OSCViewProvider<?> view : views) { String viewName = view.getName(); NativeButton b = new NativeButton(viewName); // selecting default menu button if (view.getName().equals(VIEW_FRAGMENT_ALERTS)) { b.addStyleName("selected"); } b.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { clearMenuSelection(); event.getButton().addStyleName("selected"); if (!MainUI.this.nav.getState().equals(viewName)) { MainUI.this.nav.navigateTo(viewName); } } }); submenu.setSizeFull(); submenu.addComponent(b); } }
private TabSheet createTabSheet(boolean lightTheme, boolean captions, boolean icons) { TabSheet tabs = new TabSheet(); tabs.setPrimaryStyleName(lightTheme ? "md-tabsheet-light" : "md-tabsheet-dark"); tabs.addStyleName("card" + " " + Paddings.Horizontal.LARGE); if (!lightTheme) { tabs.addStyleName(MaterialColor.BLUE_500.getBackgroundColorStyle()); } if (captions && icons) { tabs.addTab(new CssLayout(), "Item One", MaterialIcons.PHONE); tabs.addTab(new CssLayout(), "Item Two", MaterialIcons.FAVORITE); tabs.addTab(new CssLayout(), "Item Three", MaterialIcons.NEAR_ME); } else if (captions) { tabs.addTab(new CssLayout(), "Item One"); tabs.addTab(new CssLayout(), "Item Two"); tabs.addTab(new CssLayout(), "Item Three"); } else if (icons) { tabs.addTab(new CssLayout(), null, MaterialIcons.PHONE); tabs.addTab(new CssLayout(), null, MaterialIcons.FAVORITE); tabs.addTab(new CssLayout(), null, MaterialIcons.NEAR_ME); } return tabs; }
private CssLayout createDateTimeFields(boolean light) { MDDateTimeField tf1 = createDateTimeField("Floating label", null, null, null, true, light); MDDateTimeField tf2 = createDateTimeField("Hint text", null, null, null, false, light); MDDateTimeField tf3 = createDateTimeField("Floating label with icon and helper", "Helper information goes here!", "Empty value not allowed", MaterialIcons.INPUT, true, light); MDDateTimeField tf4 = createDateTimeField("Hint text with icon and helper", "Helper information goes here!", "Empty value not allowed", MaterialIcons.INPUT, false, light); MDDateTimeField tf5 = createDateTimeField("Floating label", "Helper information goes here!", "Empty value not allowed", null, true, light); tf5.setEnabled(false); FlexLayout card = new FlexLayout(tf1, tf2, tf3, tf4, tf5); card.setFlexDirection(FlexLayout.FlexDirection.COLUMN); card.addStyleName("card"); card.addStyleName(Paddings.All.LARGE); card.addStyleName(Spacings.Bottom.LARGE); if (!light) card.addStyleName(MaterialColor.GREY_900.getBackgroundColorStyle()); card.setWidth(100, Unit.PERCENTAGE); return card; }
private CssLayout createDateFields(boolean light) { MDDateField tf1 = createDateField("Floating label", null, null, null, true, light); MDDateField tf2 = createDateField("Hint text", null, null, null, false, light); MDDateField tf3 = createDateField("Floating label with icon and helper", "Helper information goes here!", "Empty value not allowed", MaterialIcons.INPUT, true, light); MDDateField tf4 = createDateField("Hint text with icon and helper", "Helper information goes here!", "Empty value not allowed", MaterialIcons.INPUT, false, light); MDDateField tf5 = createDateField("Floating label", "Helper information goes here!", "Empty value not allowed", null, true, light); tf5.setEnabled(false); FlexLayout card = new FlexLayout(tf1, tf2, tf3, tf4, tf5); card.setFlexDirection(FlexLayout.FlexDirection.COLUMN); card.addStyleName("card"); card.addStyleName(Paddings.All.LARGE); card.addStyleName(Spacings.Bottom.LARGE); if (!light) card.addStyleName(MaterialColor.GREY_900.getBackgroundColorStyle()); card.setWidth(100, Unit.PERCENTAGE); return card; }
public DataTablesView() { setFlexDirection(FlexDirection.COLUMN); setAlignSelf(AlignSelf.BASELINE); addStyleName(Margins.All.LARGE); addStyleName(Spacings.Bottom.LARGE); setWidth(100, Unit.PERCENTAGE); Grid g1 = createGrid(); CssLayout c1 = createCard(g1); Grid g2 = createGrid(); DataTableHeader h2 = new DataTableHeader("Nutrition", g2); CssLayout c2 = createCard(h2, g2); addComponents(c1, c2); }
@Override protected void init(VaadinRequest vaadinRequest) { root = new CssLayout(appBar, navigationDrawer, content); root.setPrimaryStyleName("root"); root.setSizeFull(); Responsive.makeResponsive(root); setContent(root); appBar.getNaviIcon().addClickListener(event -> navigationDrawer.toggle()); content.setPrimaryStyleName("content"); content.setSizeFull(); initNavigationItems(); initDummyContent(); }
@Override public Component getTestComponent() { CssLayout cssLayout = new CssLayout(); Form form = new Form() .row(new TextFieldGroup().withCaption("Row 1, Col 1"), new TextFieldGroup().withCaption("Row 1, Col 2")).add() .row(new TextFieldGroup("Row 2, Col 1"), new TextFieldGroup("Row 2, Col 2"), new TextFieldGroup("Row 2, Col 3").withDescription("Description here")).add() .row(new TextFieldGroup("Row 3, Col 1").withFeedbackAndMode("Error", BootstrapMode.DANGER)).add(); try { cssLayout.addComponent(form.create()); } catch (IOException e) { e.printStackTrace(); } return cssLayout; }
@PostConstruct void init() { Label header = new Label("Control Panel"); header.setStyleName(ValoTheme.LABEL_H1); addComponent(header); dashboard = new CssLayout(); dashboard.setSizeFull(); widgetMap = new HashMap<>(); panelMap = new HashMap<>(); generateDashboard(); addComponent(dashboard); ui.setPollInterval(2000); ui.addPollListener(event -> { generateDashboard(); }); }
private Component buildSparklines() { CssLayout sparks = new CssLayout(); sparks.addStyleName("sparks"); sparks.setWidth("100%"); Responsive.makeResponsive(sparks); SparklineChart s = new SparklineChart("Traffic", "K", "", DummyDataGenerator.chartColors[0], 22, 20, 80); sparks.addComponent(s); s = new SparklineChart("Revenue / Day", "M", "$", DummyDataGenerator.chartColors[2], 8, 89, 150); sparks.addComponent(s); s = new SparklineChart("Checkout Time", "s", "", DummyDataGenerator.chartColors[3], 10, 30, 120); sparks.addComponent(s); s = new SparklineChart("Theater Fill Rate", "%", "", DummyDataGenerator.chartColors[5], 50, 34, 100); sparks.addComponent(s); return sparks; }
private Component buildLabels() { CssLayout labels = new CssLayout(); labels.addStyleName("labels"); Label welcome = new Label("Welcome"); welcome.setSizeUndefined(); welcome.addStyleName(ValoTheme.LABEL_H4); welcome.addStyleName(ValoTheme.LABEL_COLORED); labels.addComponent(welcome); Label title = new Label("QuickTickets Dashboard"); title.setSizeUndefined(); title.addStyleName(ValoTheme.LABEL_H3); title.addStyleName(ValoTheme.LABEL_LIGHT); labels.addComponent(title); return labels; }
private Component buildContent() { final CssLayout menuContent = new CssLayout(); menuContent.addStyleName("sidebar"); menuContent.addStyleName(ValoTheme.MENU_PART); menuContent.addStyleName("no-vertical-drag-hints"); menuContent.addStyleName("no-horizontal-drag-hints"); menuContent.setWidth(null); menuContent.setHeight("100%"); menuContent.addComponent(buildTitle()); menuContent.addComponent(buildUserMenu()); menuContent.addComponent(buildToggleButton()); menuContent.addComponent(buildMenuItems()); return menuContent; }
private void buildUI() { addStyleName(DSTheme.LOGIN_SCREEN); // login form, centered in the available part of the screen loginForm = buildLoginForm(); newUserForm = buildNewUserForm(); // layout to center login form when there is sufficient screen space // - see the theme for how this is made responsive for various screen sizes centeringLayout = new VerticalLayout(); centeringLayout.setStyleName(DSTheme.LOGIN_CENTERING_LAYOUT); centeringLayout.addComponent(loginForm); centeringLayout.setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER); centeringLayout.addComponentAttachListener(event -> { if (event.getAttachedComponent() instanceof Translatable) { ((Translatable) event.getAttachedComponent()).updateMessageStrings(); } }); // information text about logging in CssLayout loginInformation = buildLoginInformation(); addComponent(centeringLayout); addComponent(loginInformation); }
protected void initLayout() { container = new CssLayout(); container.setSizeFull(); container.setPrimaryStyleName(CURRENCYFIELD_LAYOUT_STYLENAME); container.addComponent(currencyLabel); if (useWrapper()) { ie9InputWrapper = new CssLayout(textField); ie9InputWrapper.setSizeFull(); ie9InputWrapper.setPrimaryStyleName(IE9_INPUT_WRAP_STYLENAME); container.addComponent(ie9InputWrapper); } else { container.addComponent(textField); } setFocusDelegate(textField); }
public void initComponent(CubaTree component) { componentComposition = new CssLayout(); componentComposition.setPrimaryStyleName("c-tree-composition"); componentComposition.setWidthUndefined(); componentComposition.addComponent(component); component.setSizeFull(); component.addShortcutListener(new ShortcutListener("tableEnter", com.vaadin.event.ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { if (target == WebAbstractTree.this.component) { if (enterPressAction != null) { enterPressAction.actionPerform(WebAbstractTree.this); } else { handleClickAction(); } } } }); }
@PostConstruct private void postInit() { setSpacing(false); setMargin(false); setSizeFull(); content = new CssLayout(); content.setPrimaryStyleName("valo-content"); content.addStyleName("v-scrollable"); content.setWidth(100, Unit.PERCENTAGE); addComponents(appHeader,content); expand(content); addAttachListener(new AttachListener() { @Override public void attach(AttachEvent event) { Responsive.makeResponsive(getUI()); } }); }
public LoginView() { setSizeFull(); 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); }
private void buildUI() { addStyleName("login-screen"); // login form, centered in the available part of the screen Component loginForm = buildLoginForm(); // layout to center login form when there is sufficient screen space // - see the theme for how this is made responsive for various screen // sizes VerticalLayout centeringLayout = new VerticalLayout(); centeringLayout.setStyleName("centering-layout"); centeringLayout.addComponent(loginForm); centeringLayout.setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER); // information text about logging in CssLayout loginInformation = buildLoginInformation(); addComponent(centeringLayout); addComponent(loginInformation); }
public MainScreen(MyUI ui) { setStyleName("main-screen"); CssLayout viewContainer = new CssLayout(); viewContainer.addStyleName("valo-content"); viewContainer.setSizeFull(); //final Navigator navigator = new Navigator(ui, viewContainer); final Navigator navigator = new DiscoveryNavigator(ui, viewContainer); navigator.setErrorView(ErrorView.class); menu = new Menu(navigator); menu.addView(new SampleCrudView(), SampleCrudView.VIEW_NAME, SampleCrudView.VIEW_NAME, FontAwesome.EDIT); menu.addView(new AboutView(), AboutView.VIEW_NAME, AboutView.VIEW_NAME, FontAwesome.INFO_CIRCLE); navigator.addViewChangeListener(viewChangeListener); addComponent(menu); addComponent(viewContainer); setExpandRatio(viewContainer, 1); setSizeFull(); }
protected void addMenuItemComponent(final ViewDefinition viewDefinition, String parameters) { CssLayout dashboardWrapper = new CssLayout(); dashboardWrapper.addStyleName("badgewrapper"); dashboardWrapper.addStyleName(ValoTheme.MENU_ITEM); dashboardWrapper.setWidth(100.0f, Sizeable.Unit.PERCENTAGE); Label notificationsBadge = new Label(); notificationsBadge.addStyleName(ValoTheme.MENU_BADGE); notificationsBadge.setWidthUndefined(); notificationsBadge.setVisible(false); if (viewDefinition != null) { dashboardWrapper.addComponents(new ValoMenuItemButton(viewDefinition, parameters), notificationsBadge); menuItemsLayout.addComponent(dashboardWrapper); } else if (HybridbpmUI.getDeveloperMode()) { dashboardWrapper.addComponents(new ValoMenuAddViewButton(), notificationsBadge); menuItemsLayout.addComponent(dashboardWrapper); } }
public void setSelection(String viewUrl, String parameters) { for (Component comp : menuItemsLayout) { if (comp instanceof CssLayout) { CssLayout dashboardWrapper = (CssLayout) comp; if (dashboardWrapper.getComponent(0) instanceof ValoMenuItemButton) { ValoMenuItemButton menuItemButton = (ValoMenuItemButton) dashboardWrapper.getComponent(0); menuItemButton.removeStyleName("selected"); if (menuItemButton.getView().getUrl().equals(viewUrl) && menuItemButton.getParameters() == null && (parameters == null || parameters.isEmpty())) { menuItemButton.addStyleName("selected"); } else if (menuItemButton.getView().getUrl().equals(viewUrl) && parameters != null && Objects.equals(menuItemButton.getParameters(), parameters)) { menuItemButton.addStyleName("selected"); } } } } }
private Component buildLabels() { CssLayout labels = new CssLayout(); labels.addStyleName("labels"); Label welcome = new Label("Log in"); welcome.setSizeUndefined(); welcome.addStyleName(ValoTheme.LABEL_H4); welcome.addStyleName(ValoTheme.LABEL_COLORED); labels.addComponent(welcome); Label title = new Label("JAAS Demo"); title.setSizeUndefined(); title.addStyleName(ValoTheme.LABEL_H3); title.addStyleName(ValoTheme.LABEL_LIGHT); labels.addComponent(title); return labels; }
@Override protected void init(VaadinRequest request) { final VerticalLayout mainLayout = new VerticalLayout(); HorizontalLayout horizontalLayout = new HorizontalLayout(); CssLayout viewLayout = new CssLayout(); Page.getCurrent().setTitle("Vaadin Demo"); mainLayout.setSizeFull(); viewLayout.setSizeFull(); mainLayout.setMargin(true); setContent(mainLayout); mainLayout.addComponent(horizontalLayout); mainLayout.addComponent(viewLayout); mainLayout.setExpandRatio(viewLayout, 1f); Navigator navigator = new Navigator(this, viewLayout); setNavigator(navigator); setupHeader(horizontalLayout); Map<String, Class<? extends MyView>> myViews = getViewProvider(); navigator.addView("", new HomeView(myViews.keySet())); navigator.addProvider(new CachedViewProvider(myViews)); }
public static CssLayout createRating(Customer customer) { CssLayout layout = new CssLayout(); layout.setHeight(49, Sizeable.Unit.PIXELS); layout.setWidth(100, Sizeable.Unit.PIXELS); Label overallRating = new Label(FontAwesome.STAR.getHtml(), ContentMode.HTML); overallRating.addStyleName("green"); overallRating.setDescription("Very good : " + testData.getNumberBetween(90, 100) + "% Chance"); overallRating.setWidthUndefined(); overallRating.setWidth(49, Sizeable.Unit.PIXELS); overallRating.setHeight(49, Sizeable.Unit.PIXELS); layout.addComponent(overallRating); Label carRating = new Label(FontAwesome.CAR.getHtml(), ContentMode.HTML); carRating.addStyleName("red"); carRating.setDescription("Unlikely : " + testData.getNumberBetween(1, 15) + "%"); carRating.setWidthUndefined(); carRating.setWidth(49, Sizeable.Unit.PIXELS); carRating.setHeight(49, Sizeable.Unit.PIXELS); layout.addComponent(carRating); return layout; }
protected final void createRowItem(final ResponsiveRow row, final Button button, final String description) { final CssLayout layout = new CssLayout(); layout.addStyleName("v-layout-content-overview-panel-level2"); Responsive.makeResponsive(layout); layout.setSizeUndefined(); button.addStyleName("itembox"); button.addStyleName("title"); Responsive.makeResponsive(button); button.setWidth(100, Unit.PERCENTAGE); layout.addComponent(button); final Label descriptionLabel = new Label(description); descriptionLabel.addStyleName("itembox"); Responsive.makeResponsive(descriptionLabel); descriptionLabel.setWidth(100, Unit.PERCENTAGE); layout.addComponent(descriptionLabel); row.addColumn().withDisplayRules(DISPLAY_SIZE_XS_DEVICE,DISPLAYS_SIZE_XM_DEVICE,DISPLAY_SIZE_MD_DEVICE,DISPLAY_SIZE_LG_DEVICE).withComponent(layout); }
protected final void createRowComponent(final ResponsiveRow row, final Component component, final String description) { final CssLayout layout = new CssLayout(); layout.addStyleName(".v-layout-content-pagemode-panel-level2"); Responsive.makeResponsive(layout); layout.setSizeUndefined(); final Label descriptionLabel = new Label(description); descriptionLabel.addStyleName("itembox"); Responsive.makeResponsive(descriptionLabel); descriptionLabel.setWidth(100, Unit.PERCENTAGE); layout.addComponent(descriptionLabel); component.addStyleName("itembox"); component.addStyleName("title"); Responsive.makeResponsive(component); component.setWidth(100, Unit.PERCENTAGE); layout.addComponent(component); row.addColumn().withDisplayRules(DISPLAY_SIZE_XS_DEVICE,DISPLAYS_SIZE_XM_DEVICE,DISPLAY_SIZE_MD_DEVICE,DISPLAY_SIZE_LG_DEVICE).withComponent(layout); }
public DetailPanel() { setSizeFull(); addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL); setMargin(true); CssLayout cssLayout = new CssLayout(); // Needed for rounded corners cssLayout.addStyleName(ExplorerLayout.STYLE_DETAIL_PANEL); cssLayout.setSizeFull(); super.addComponent(cssLayout); mainPanel = new Panel(); mainPanel.addStyleName(Reindeer.PANEL_LIGHT); mainPanel.setSizeFull(); cssLayout.addComponent(mainPanel); // Use default layout VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setWidth(100, UNITS_PERCENTAGE); verticalLayout.setMargin(true); mainPanel.setContent(verticalLayout); }
protected void initInputField() { // Csslayout is used to style inputtext as rounded CssLayout csslayout = new CssLayout(); csslayout.setHeight(24, UNITS_PIXELS); csslayout.setWidth(100, UNITS_PERCENTAGE); layout.addComponent(csslayout); inputField = new TextField(); inputField.setWidth(100, UNITS_PERCENTAGE); inputField.addStyleName(ExplorerLayout.STYLE_SEARCHBOX); inputField.setInputPrompt(i18nManager.getMessage(Messages.TASK_CREATE_NEW)); inputField.focus(); csslayout.addComponent(inputField); layout.setComponentAlignment(csslayout, Alignment.MIDDLE_LEFT); layout.setExpandRatio(csslayout, 1.0f); }
private void initLayout() { final VerticalLayout root = new VerticalLayout(); root.setSizeFull(); root.setMargin(true); root.setSpacing(true); setContent(root); final CssLayout navigationBar = new CssLayout(); navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); navigationBar.addComponent(createNavigationButton("Default View", DefaultView.VIEW_NAME)); navigationBar.addComponent(createNavigationButton("MongoDB View", MongoDBUIView.VIEW_NAME)); navigationBar.addComponent(createNavigationButton("Combobox Example View", CityComboboxView.VIEW_NAME)); root.addComponent(navigationBar); springViewDisplay = new Panel(); springViewDisplay.setSizeFull(); root.addComponent(springViewDisplay); root.setExpandRatio(springViewDisplay, 1.0f); }
private Component createContentWrapper(String slotStyle, Component toolBar, Component content) { CssLayout slot = new CssLayout(); slot.setWidth("100%"); slot.addStyleName(slotStyle); CssLayout card = new CssLayout(); card.setWidth("100%"); card.addStyleName(ValoTheme.LAYOUT_CARD); if(toolBar instanceof SlotToolBar) { ((SlotToolBar)toolBar).setSlot(slot); } card.addComponents(toolBar, content); slot.addComponent(card); return slot; }
private Layout getHeader() { HorizontalLayout header = new HorizontalLayout(); header.setWidth("100%"); header.setMargin(true); header.setSpacing(true); // header.setStyleName(Reindeer.LAYOUT_BLACK); CssLayout titleLayout = new CssLayout(); H2 title = new H2("Dynamic Vaadin OSGi Demo"); titleLayout.addComponent(title); SmallText description = new SmallText("Select the \"Bundle View\" tab and activate/stop OSGi bundles dynamically."); description.setSizeUndefined(); titleLayout.addComponent(description); header.addComponent(titleLayout); Component notificationArea = notificationManager.getComponent(this); header.addComponent(notificationArea); header.setComponentAlignment(notificationArea, Alignment.MIDDLE_RIGHT); return header; }
public MainScreen(MockAppUI ui) { setStyleName("main-screen"); CssLayout viewContainer = new CssLayout(); viewContainer.addStyleName("valo-content"); viewContainer.setSizeFull(); final Navigator navigator = new Navigator(ui, viewContainer); navigator.setErrorView(ErrorView.class); menu = new Menu(navigator); menu.addView(new SampleCrudView(), SampleCrudView.VIEW_NAME, SampleCrudView.VIEW_NAME, FontAwesome.EDIT); menu.addView(new AboutView(), AboutView.VIEW_NAME, AboutView.VIEW_NAME, FontAwesome.INFO_CIRCLE); navigator.addViewChangeListener(viewChangeListener); addComponent(menu); addComponent(viewContainer); setExpandRatio(viewContainer, 1); setSizeFull(); }
private Component createPersonView(Person person) { CssLayout cssLayout = new CssLayout(); cssLayout.addStyleName("person"); Label name = new Label(person.getFirstname() + " " + person.getLastname()); name.setSizeUndefined(); name.addStyleName("name"); Label city = new Label(person.getCity()); city.setSizeUndefined(); city.addStyleName("city"); Label phone = new Label(person.getPhoneNumber()); phone.setSizeUndefined(); phone.addStyleName("phone"); cssLayout.addComponent(name); cssLayout.addComponent(city); cssLayout.addComponent(phone); return cssLayout; }
@Override protected CssLayout createCompositionRoot() { CssLayout layout = new CssLayout(); layout.addStyleName(ValoTheme.MENU_PART); if (largeIcons) { layout.addStyleName(ValoTheme.MENU_PART_LARGE_ICONS); } layout.setWidth(null); layout.setHeight("100%"); if (logo != null) { layout.addComponent(logo); } if (headerLayout != null) { layout.addComponent(headerLayout); } return layout; }
@Autowired public MainScreen(final VaadinSecurity vaadinSecurity, SpringViewProvider springViewProvider, ValoSideBar sideBar) { HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); setCompositionRoot(layout); setSizeFull(); // By adding a security item filter, only views that are accessible to the user will show up in the side bar. sideBar.setItemFilter(new VaadinSecurityItemFilter(vaadinSecurity)); layout.addComponent(sideBar); CssLayout viewContainer = new CssLayout(); viewContainer.setSizeFull(); layout.addComponent(viewContainer); layout.setExpandRatio(viewContainer, 1f); Navigator navigator = new Navigator(UI.getCurrent(), viewContainer); // Without an AccessDeniedView, the view provider would act like the restricted views did not exist at all. springViewProvider.setAccessDeniedViewClass(AccessDeniedView.class); navigator.addProvider(springViewProvider); navigator.setErrorView(ErrorView.class); navigator.navigateTo(navigator.getState()); }
private Component buildLabels() { CssLayout labels = new CssLayout(); labels.addStyleName("labels"); Label welcome = new Label("Welcome"); welcome.setSizeUndefined(); welcome.addStyleName(ValoTheme.LABEL_H4); welcome.addStyleName(ValoTheme.LABEL_COLORED); labels.addComponent(welcome); Label title = new Label(applicationTitle); title.setSizeUndefined(); title.addStyleName(ValoTheme.LABEL_H3); title.addStyleName(ValoTheme.LABEL_LIGHT); labels.addComponent(title); return labels; }
public AttachmentPreviewView() { CssLayout imgWrap = new CssLayout(); imgWrap.setStyleName("image-wrap"); imgWrap.setSizeFull(); this.setStyleName("attachment-preview-view"); this.setSizeFull(); this.addComponent(imgWrap, "top: 0px left: 0px; z-index: 0;"); backBtn = new NavigationButton(UserUIContext.getMessage(GenericI18Enum.M_BUTTON_BACK)); backBtn.setStyleName("back-btn"); this.addComponent(backBtn, "top: 15px; left: 15px; z-index: 1;"); previewImage = new Image(); imgWrap.addComponent(previewImage); }
@Override protected final ComponentContainer createLegendBox() { final CssLayout mainLayout = new CssLayout(); mainLayout.setWidth("100%"); mainLayout.addStyleName("legendBoxContent"); final List series = dataSet.getSeries(); for (int i = 0; i < series.size(); i++) { final MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true)); layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); final TimeSeries key = (TimeSeries) series.get(i); int colorIndex = i % CHART_COLOR_STR.size(); final String color = "<div style = \" width:13px;height:13px;background: #" + CHART_COLOR_STR.get(colorIndex) + "\" />"; final ELabel lblCircle = ELabel.html(color); String captionBtn = UserUIContext.getMessage(StatusI18nEnum.class, (String) key.getKey()); final MButton btnLink = new MButton(StringUtils.trim(captionBtn, 30, true)).withDescription (captionBtn).withStyleName(WebThemes.BUTTON_LINK); layout.with(lblCircle, btnLink); mainLayout.addComponent(layout); } return mainLayout; }
public TicketOverdueWidget() { super(UserUIContext.getMessage(TicketI18nEnum.VAL_OVERDUE_TICKETS) + " (0)", new CssLayout()); final CheckBox myItemsOnly = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsOnly.addValueChangeListener(valueChangeEvent -> { if (searchCriteria != null) { boolean selectMyItemsOnly = myItemsOnly.getValue(); if (selectMyItemsOnly) { searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername())); } else { searchCriteria.setAssignUser(null); } ticketOverdueComponent.setSearchCriteria(searchCriteria); } }); this.addHeaderElement(myItemsOnly); ticketOverdueComponent = new TicketOverduePagedList(); bodyContent.addComponent(ticketOverdueComponent); }