com.vaadin.ui.CssLayout Java Examples
The following examples show how to use
com.vaadin.ui.CssLayout.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserUnresolvedTicketWidget.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
public UserUnresolvedTicketWidget() { super("", new CssLayout()); this.setWidth("100%"); final CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsSelection.addValueChangeListener(valueChangeEvent -> { boolean isMyItemsOption = myItemsSelection.getValue(); if (searchCriteria != null) { if (isMyItemsOption) { searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername())); } else { searchCriteria.setAssignUser(null); } updateSearchResult(); } }); ticketList = new DefaultBeanPagedList<ProjectTicketService, ProjectTicketSearchCriteria, ProjectTicket> (AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowDisplayHandler(true), 10) { @Override protected String stringWhenEmptyList() { return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_TICKET); } }; this.addHeaderElement(myItemsSelection); this.bodyContent.addComponent(ticketList); }
Example #2
Source File: TicketOverdueWidget.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
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); }
Example #3
Source File: CubaCurrencyField.java From cuba with Apache License 2.0 | 6 votes |
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); }
Example #4
Source File: CubaTokenList.java From cuba with Apache License 2.0 | 6 votes |
public CubaTokenList(WebTokenList<T> owner) { this.owner = owner; composition = new CssLayout(); composition.setWidthUndefined(); composition.setStyleName(TOKENLIST_COMPOSITION_STYLENAME); tokenContainerWrapper = new CssLayout(); tokenContainerWrapper.setStyleName(TOKENLIST_WRAPPER_STYLENAME); tokenContainer = new CubaScrollBoxLayout(); tokenContainer.setStyleName(TOKENLIST_SCROLLBOX_STYLENAME); tokenContainer.setWidthUndefined(); tokenContainer.setMargin(new MarginInfo(true, false, false, false)); tokenContainerWrapper.addComponent(tokenContainer); composition.addComponent(tokenContainerWrapper); setPrimaryStyleName(TOKENLIST_STYLENAME); // do not trigger overridden method super.setWidth(-1, Unit.PIXELS); }
Example #5
Source File: CubaFileUploadWrapper.java From cuba with Apache License 2.0 | 6 votes |
protected void initLayout(UploadComponent uploadComponent) { this.uploadButton = uploadComponent; container = new CssLayout(); container.addStyleName("c-fileupload-container"); fileNameButton = new CubaButton(); fileNameButton.setWidth(100, Unit.PERCENTAGE); fileNameButton.addStyleName(ValoTheme.BUTTON_LINK); fileNameButton.addStyleName("c-fileupload-filename"); setFileNameButtonCaption(null); container.addComponent(fileNameButton); container.addComponent(uploadComponent); clearButton = new CubaButton(""); clearButton.setStyleName("c-fileupload-clear"); container.addComponent(clearButton); setShowClearButton(showClearButton); setShowFileName(false); setWidthUndefined(); }
Example #6
Source File: WebFtsField.java From cuba with Apache License 2.0 | 6 votes |
public WebFtsField() { component = new CssLayout(); component.setPrimaryStyleName(FTS_FIELD_STYLENAME); searchField = new CubaTextField(); searchField.setStyleName("c-ftsfield-text"); searchField.addShortcutListener( new ShortcutListenerDelegate("fts", KeyCode.ENTER, null) .withHandler((sender, target) -> openSearchWindow() )); searchBtn = new CubaButton(); searchBtn.setStyleName("c-ftsfield-button"); searchBtn.addClickListener(event -> openSearchWindow() ); component.addComponent(searchField); component.addComponent(searchBtn); adjustHeight(); adjustWidth(); }
Example #7
Source File: GenericChartWrapper.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
final protected void displayChart() { removeAllComponents(); final JFreeChart chart = createChart(); final JFreeChartWrapper chartWrapper = new JFreeChartWrapper(chart); final CssLayout borderWrap = new CssLayout(); borderWrap.addComponent(chartWrapper); borderWrap.setStyleName("chart-wrapper"); borderWrap.setHeight(height + "px"); borderWrap.setWidth(width + "px"); chartWrapper.setHeight(height + "px"); chartWrapper.setWidth(width + "px"); chartWrapper.setGraphHeight(height); chartWrapper.setGraphWidth(width); this.addComponent(borderWrap); final Component legendBox = createLegendBox(); if (legendBox != null) { this.addComponent(legendBox); } }
Example #8
Source File: AccountModuleImpl.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
public AccountModuleImpl() { addStyleName("module"); ControllerRegistry.addController(new UserAccountController(this)); MHorizontalLayout topPanel = new MHorizontalLayout().withFullWidth().withMargin(true).withStyleName(WebThemes.BORDER_BOTTOM).withId("tab-content-header"); AccountSettingBreadcrumb breadcrumb = ViewManager.getCacheComponent(AccountSettingBreadcrumb.class); MButton helpBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_HELP)) .withIcon(VaadinIcons.ACADEMY_CAP).withStyleName(WebThemes.BUTTON_LINK); ExternalResource helpRes = new ExternalResource("https://docs.mycollab.com/user-guide/account-management/"); BrowserWindowOpener helpOpener = new BrowserWindowOpener(helpRes); helpOpener.extend(helpBtn); topPanel.with(breadcrumb, helpBtn).withAlign(helpBtn, Alignment.TOP_RIGHT); tabSheet = new VerticalTabsheet(); tabSheet.getContentWrapper().addStyleName("content-height"); tabSheet.setSizeFull(); tabSheet.addToggleNavigatorControl(); CssLayout contentWrapper = tabSheet.getContentWrapper(); contentWrapper.addComponentAsFirst(topPanel); this.buildComponents(); this.setContent(tabSheet); }
Example #9
Source File: ProjectOverdueTicketsWidget.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
public ProjectOverdueTicketsWidget() { super(String.format("%s (0)", UserUIContext.getMessage(TicketI18nEnum.VAL_OVERDUE_TICKETS)), new CssLayout()); this.setWidth("100%"); CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsSelection.addValueChangeListener(valueChangeEvent -> { boolean isMyItemsOption = myItemsSelection.getValue(); if (isMyItemsOption) { searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername())); } else { searchCriteria.setAssignUser(null); } updateSearchResult(); }); ticketList = new DefaultBeanPagedList(AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowDisplayHandler(false), 10) { @Override protected String stringWhenEmptyList() { return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_OVERDUE_TICKET); } }; this.addHeaderElement(myItemsSelection); bodyContent.addComponent(ticketList); }
Example #10
Source File: MyUI.java From framework-spring-tutorial with Apache License 2.0 | 6 votes |
@Override protected void init(VaadinRequest request) { final VerticalLayout root = new VerticalLayout(); root.setSizeFull(); setContent(root); final CssLayout navigationBar = new CssLayout(); navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP); navigationBar.addComponent(createNavigationButton("UI Scoped View", UIScopedView.VIEW_NAME)); navigationBar.addComponent(createNavigationButton("View Scoped View", ViewScopedView.VIEW_NAME)); root.addComponent(navigationBar); springViewDisplay = new Panel(); springViewDisplay.setSizeFull(); root.addComponent(springViewDisplay); root.setExpandRatio(springViewDisplay, 1.0f); }
Example #11
Source File: ProjectUnresolvedTicketsWidget.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
public ProjectUnresolvedTicketsWidget() { super("", new CssLayout()); this.setWidth("100%"); final CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsSelection.addValueChangeListener(valueChangeEvent -> { boolean isMyItemsOption = myItemsSelection.getValue(); if (isMyItemsOption) { searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername())); } else { searchCriteria.setAssignUser(null); } updateSearchResult(); }); ticketList = new DefaultBeanPagedList(AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowDisplayHandler(false), 10) { @Override protected String stringWhenEmptyList() { return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_TICKET); } }; addHeaderElement(myItemsSelection); bodyContent.addComponent(ticketList); }
Example #12
Source File: RowUtil.java From cia with Apache License 2.0 | 6 votes |
/** * Creates the row component. * * @param row the row * @param component the component * @param description the description */ public static 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); }
Example #13
Source File: RowUtil.java From cia with Apache License 2.0 | 6 votes |
/** * Creates the row item. * * @param row the row * @param button the button * @param description the description */ public static 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); }
Example #14
Source File: ProjectMembersWidget.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
ProjectMembersWidget() { super("", new CssLayout()); MButton sortBtn = new MButton().withIcon(VaadinIcons.CARET_UP).withStyleName(WebThemes.BUTTON_ICON_ONLY); sortBtn.addClickListener(clickEvent -> { sortAsc = !sortAsc; if (sortAsc) { sortBtn.setIcon(VaadinIcons.CARET_UP); searchCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("memberFullName", SearchCriteria.ASC))); } else { sortBtn.setIcon(VaadinIcons.CARET_DOWN); searchCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("memberFullName", SearchCriteria.DESC))); } memberList.setSearchCriteria(searchCriteria); setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.WIDGET_MEMBERS_TITLE, memberList.getTotalCount())); }); addHeaderElement(sortBtn); final SearchTextField searchTextField = new SearchTextField() { @Override public void doSearch(String value) { searchCriteria.setMemberFullName(StringSearchField.and(value)); showMembers(); } @Override public void emptySearch() { searchCriteria.setMemberFullName(null); showMembers(); } }; searchTextField.addStyleName(ValoTheme.TEXTFIELD_SMALL); addHeaderElement(searchTextField); memberList = new DefaultBeanPagedList<>(AppContextUtil.getSpringBean(ProjectMemberService.class), new MemberRowDisplayHandler(), 7); bodyContent.addComponent(memberList); }
Example #15
Source File: ProjectSearchItemPresenter.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void onGo(HasComponents container, ScreenData<?> data) { BoardContainer boardContainer = (BoardContainer) container; CssLayout contentWrapper = boardContainer.getContentWrapper(); contentWrapper.removeAllComponents(); contentWrapper.addComponent(view); String params = (String) data.getParams(); view.displayResults(params); }
Example #16
Source File: TimesheetDayChangeViewImplEx.java From vaadinator with Apache License 2.0 | 5 votes |
@Override public void addTimesheetDayEntryView(TimesheetDayEntryChangeView view) { // this is a little dirty, but we can't compose navigation views, so we // stack the layout components NavigationView viewCmp = (NavigationView) view.getComponent(); CssLayout viewLayout = (CssLayout) viewCmp.getContent(); layout.addComponent(viewLayout); // re-add plus at the end layout.removeComponent(plusEntry); layout.addComponent(plusEntry); }
Example #17
Source File: TimesheetChangeViewImplEx.java From vaadinator with Apache License 2.0 | 5 votes |
@Override public void addTimesheetDayView(TimesheetDayChangeView view) { // this is a little dirty, but we can't compose navigation views, so we // stack the layout components NavigationView viewCmp = (NavigationView) view.getComponent(); CssLayout viewLayout = (CssLayout) viewCmp.getContent(); layout.addComponent(viewLayout); }
Example #18
Source File: AdminViewImpl.java From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 | 5 votes |
@Override public void postConstruct() { super.postConstruct(); setSizeFull(); layout = new CssLayout(); layout.setSizeFull(); setCompositionRoot(layout); final Label label = new Label("This is admin only view"); label.addStyleName(ValoTheme.LABEL_H2); layout.addComponent(label); }
Example #19
Source File: HiddenAdminViewImpl.java From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 | 5 votes |
@Override public void postConstruct() { super.postConstruct(); setSizeFull(); layout = new CssLayout(); layout.setSizeFull(); setCompositionRoot(layout); final Label label = new Label("This is admin only view. Navbar link is was hidden."); label.addStyleName(ValoTheme.LABEL_H2); layout.addComponent(label); }
Example #20
Source File: ReadableTicketRowRenderer.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
public ReadableTicketRowRenderer(ProjectTicket ticket) { this.ticket = ticket; String avatarLink = StorageUtils.getAvatarPath(ticket.getAssignUserAvatarId(), 16); Img img = new Img(ticket.getAssignUserFullName(), avatarLink).setCSSClass(WebThemes.CIRCLE_BOX) .setTitle(ticket.getAssignUserFullName()); A ticketLink; if (ticket.isBug() || ticket.isTask()) { ticketLink = new A(ProjectLinkGenerator.generateProjectItemLink(ticket.getProjectShortName(), ticket.getProjectId(), ticket.getType(), ticket.getExtraTypeId() + "")). appendText(ticket.getName()); } else { ticketLink = new A(ProjectLinkGenerator.generateProjectItemLink(ticket.getProjectShortName(), ticket.getProjectId(), ticket.getType(), ticket.getTypeId() + "")). appendText(ticket.getName()); } this.with(ELabel.html(ProjectAssetsManager.getAsset(ticket.getType()).getHtml() + " " + img.write() + " " + ticketLink.write()) .withStyleName(WebThemes.LABEL_WORD_WRAP).withFullWidth()); this.addStyleName(WebThemes.BORDER_LIST_ROW); if (ticket.isTask()) { this.addStyleName("task"); } else if (ticket.isBug()) { this.addStyleName("bug"); } else if (ticket.isRisk()) { this.addStyleName("risk"); } CssLayout footer = new CssLayout(); footer.addComponent(buildTicketCommentComp(ticket)); footer.addComponent(buildTicketPriorityComp(ticket)); footer.addComponent(buildTicketStatusComp(ticket)); footer.addComponent(buildStartdateComp(ticket)); footer.addComponent(buildEnddateComp(ticket)); footer.addComponent(buildDuedateComp(ticket)); if (!SiteConfiguration.isCommunityEdition()) { footer.addComponent(buildBillableHoursComp(ticket)); footer.addComponent(buildNonBillableHoursComp(ticket)); } this.with(footer); }
Example #21
Source File: EditableTicketRowRenderer.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
public EditableTicketRowRenderer(ProjectTicket ticket) { this.ticket = ticket; withMargin(false).withFullWidth().addStyleName(WebThemes.BORDER_LIST_ROW); if (ticket.isTask()) { addStyleName("task"); } else if (ticket.isBug()) { addStyleName("bug"); } else if (ticket.isRisk()) { addStyleName("risk"); } toggleTicketField = new ToggleTicketSummaryField(ticket); MHorizontalLayout headerLayout = new MHorizontalLayout(ELabel.fontIcon(ProjectAssetsManager.getAsset(ticket.getType())) .withUndefinedWidth(), toggleTicketField).expand(toggleTicketField).withFullWidth() .withMargin(new MarginInfo(false, true, false, false)); TicketComponentFactory popupFieldFactory = AppContextUtil.getSpringBean(TicketComponentFactory.class); AbstractComponent assigneeField = wrapListenerComponent(popupFieldFactory.createAssigneePopupField(ticket)); assigneeField.removeStyleName(WebThemes.BLOCK_POPUP_EDIT); headerLayout.with(assigneeField, toggleTicketField).expand(toggleTicketField); CssLayout footer = new CssLayout(); footer.addComponent(popupFieldFactory.createCommentsPopupField(ticket)); footer.addComponent(wrapListenerComponent(popupFieldFactory.createPriorityPopupField(ticket))); footer.addComponent(popupFieldFactory.createFollowersPopupField(ticket)); footer.addComponent(wrapListenerComponent(popupFieldFactory.createStatusPopupField(ticket))); footer.addComponent(wrapListenerComponent(popupFieldFactory.createStartDatePopupField(ticket))); footer.addComponent(wrapListenerComponent(popupFieldFactory.createEndDatePopupField(ticket))); footer.addComponent(wrapListenerComponent(popupFieldFactory.createDueDatePopupField(ticket))); if (!SiteConfiguration.isCommunityEdition()) { footer.addComponent(popupFieldFactory.createBillableHoursPopupField(ticket)); footer.addComponent(popupFieldFactory.createNonBillableHoursPopupField(ticket)); } this.with(headerLayout, footer); }
Example #22
Source File: ProjectMembersWidget.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override public Component generateRow(IBeanList<SimpleProjectMember> host, SimpleProjectMember member, int rowIndex) { MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withStyleName("list-row"); Image userAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getMemberAvatarId(), 48); userAvatar.addStyleName(WebThemes.CIRCLE_BOX); layout.addComponent(userAvatar); MVerticalLayout content = new MVerticalLayout().withMargin(false); content.addComponent(ELabel.html(buildAssigneeValue(member)).withStyleName(WebThemes.TEXT_ELLIPSIS)); layout.with(content).expand(content); CssLayout footer = new CssLayout(); String roleVal = member.getRoleName() + " "; ELabel memberRole = ELabel.html(roleVal).withDescription(UserUIContext.getMessage(ProjectRoleI18nEnum.SINGLE)) .withStyleName(WebThemes.META_INFO); footer.addComponent(memberRole); String memberWorksInfo = ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK).getHtml() + new Span().appendText("" + member.getNumOpenTasks()).setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_TASKS)) + " " + ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG).getHtml() + new Span().appendText("" + member.getNumOpenBugs()).setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_BUGS)) + " " + VaadinIcons.MONEY.getHtml() + " " + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalBillableLogTime())).setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS)) + " " + VaadinIcons.GIFT.getHtml() + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalNonBillableLogTime())) .setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS)); ELabel memberWorkStatus = ELabel.html(memberWorksInfo).withStyleName(WebThemes.META_INFO); footer.addComponent(memberWorkStatus); content.addComponent(footer); return layout; }
Example #23
Source File: GoogleMapDemo.java From serverside-elements with Apache License 2.0 | 5 votes |
@Override protected Component getDemoView() { CssLayout wrapper = new CssLayout(); Root root = ElementIntegration.getRoot(wrapper); final Element googleMap = Elements.create("google-map"); googleMap.setAttribute("style", "height: 500px; width: 500px; display: block"); googleMap.setAttribute("latitude", "60.45235"); googleMap.setAttribute("longitude", "22.299727"); googleMap.setAttribute("zoom", "17"); root.appendChild(googleMap); HorizontalLayout buttons = new HorizontalLayout( new Button("GWT.create US", event -> { googleMap.setAttribute("latitude", "37.414274"); googleMap.setAttribute("longitude", "-122.077409"); }), new Button("GWT.create EU", event -> { googleMap.setAttribute("latitude", "48.152663"); googleMap.setAttribute("longitude", "11.598418"); })); buttons.setSpacing(true); VerticalLayout layout = new VerticalLayout(buttons, wrapper); layout.setSpacing(true); return layout; }
Example #24
Source File: AbstractMenuItemFactoryImpl.java From cia with Apache License 2.0 | 5 votes |
/** * Creates the button link. * * @param row * the panel content * @param linkText * the link text * @param icon * the icon * @param command * the command * @param description * the description */ protected final void createButtonLink(final ResponsiveRow row,final String linkText,final Resource icon, final ClickListener command, final String description) { final CssLayout layout = new CssLayout(); layout.addStyleName("v-layout-content-overview-panel-level2"); Responsive.makeResponsive(layout); layout.setSizeUndefined(); final Button button = new Button(linkText); Responsive.makeResponsive(button); button.setStyleName(LINK_STYLE_NAME); button.addStyleName("title"); button.addClickListener(command); button.setIcon(icon); 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); }
Example #25
Source File: ProjectSubscribersComp.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override protected Component initContent() { ProjectMemberService projectMemberService = AppContextUtil.getSpringBean(ProjectMemberService.class); List<SimpleUser> members = projectMemberService.getActiveUsersInProject(projectId, AppUI.getAccountId()); CssLayout container = new CssLayout(); container.setStyleName("followers-container"); final CheckBox selectAllCheckbox = new CheckBox("All", defaultSelectAll); selectAllCheckbox.addValueChangeListener(valueChangeEvent -> { boolean val = selectAllCheckbox.getValue(); for (FollowerCheckbox followerCheckbox : memberSelections) { followerCheckbox.setValue(val); } }); container.addComponent(selectAllCheckbox); for (SimpleUser user : members) { final FollowerCheckbox memberCheckbox = new FollowerCheckbox(user); memberCheckbox.addValueChangeListener(valueChangeEvent -> { if (!memberCheckbox.getValue()) { selectAllCheckbox.setValue(false); } }); if (defaultSelectAll || selectedUsers.contains(user.getUsername())) { memberCheckbox.setValue(true); } memberSelections.add(memberCheckbox); container.addComponent(memberCheckbox); } return container; }
Example #26
Source File: DashboardMenu.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
/** * Creates the wrapper which contains the menu item and the adjacent label * for displaying the occurred events * * @param menuItemButton * the menu item * @param notificationLabel * the label for displaying the occurred events * @return Component of type CssLayout */ private static Component buildLabelWrapper(final ValoMenuItemButton menuItemButton, final Component notificationLabel) { final CssLayout dashboardWrapper = new CssLayout(menuItemButton); dashboardWrapper.addStyleName("labelwrapper"); dashboardWrapper.addStyleName(ValoTheme.MENU_ITEM); notificationLabel.addStyleName(ValoTheme.MENU_BADGE); notificationLabel.setWidthUndefined(); notificationLabel.setVisible(false); notificationLabel.setId(UIComponentIdProvider.NOTIFICATION_MENU_ID + menuItemButton.getCaption().toLowerCase()); dashboardWrapper.addComponent(notificationLabel); return dashboardWrapper; }
Example #27
Source File: BlockWidget.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
public BlockWidget(String title) { titleLbl = ELabel.h2(""); super.addComponent(titleLbl); bodyLayout = new CssLayout(); bodyLayout.setWidth("100%"); super.addComponent(bodyLayout); this.setTitle(title); }
Example #28
Source File: FileDownloadWindow.java From mycollab with GNU Affero General Public License v3.0 | 4 votes |
private void constructBody() { final MVerticalLayout layout = new MVerticalLayout().withFullWidth(); CssLayout iconWrapper = new CssLayout(); final ELabel iconEmbed = ELabel.fontIcon(FileAssetsUtil.getFileIconResource(content.getName())); iconEmbed.addStyleName("icon-48px"); iconWrapper.addComponent(iconEmbed); layout.with(iconWrapper).withAlign(iconWrapper, Alignment.MIDDLE_CENTER); final GridFormLayoutHelper infoLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN); if (content.getDescription() != null) { final Label descLbl = new Label(); if (!content.getDescription().equals("")) { descLbl.setData(content.getDescription()); } else { descLbl.setValue(" "); descLbl.setContentMode(ContentMode.HTML); } infoLayout.addComponent(descLbl, UserUIContext.getMessage(GenericI18Enum.FORM_DESCRIPTION), 0, 0); } UserService userService = AppContextUtil.getSpringBean(UserService.class); SimpleUser user = userService.findUserByUserNameInAccount(content.getCreatedUser(), AppUI.getAccountId()); if (user == null) { infoLayout.addComponent(new UserLink(UserUIContext.getUsername(), UserUIContext.getUserAvatarId(), UserUIContext.getUserDisplayName()), UserUIContext.getMessage(GenericI18Enum.OPT_CREATED_BY), 0, 1); } else { infoLayout.addComponent(new UserLink(user.getUsername(), user.getAvatarid(), user.getDisplayName()), UserUIContext.getMessage(GenericI18Enum.OPT_CREATED_BY), 0, 1); } final Label size = new Label(FileUtils.getVolumeDisplay(content.getSize())); infoLayout.addComponent(size, UserUIContext.getMessage(FileI18nEnum.OPT_SIZE), 0, 2); ELabel dateCreate = new ELabel().prettyDateTime(DateTimeUtils.toLocalDateTime(content.getCreated())); infoLayout.addComponent(dateCreate, UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME), 0, 3); layout.addComponent(infoLayout.getLayout()); MButton downloadBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DOWNLOAD)) .withIcon(VaadinIcons.DOWNLOAD).withStyleName(WebThemes.BUTTON_ACTION); List<Resource> resources = new ArrayList<>(); resources.add(content); StreamResource downloadResource = StreamDownloadResourceUtil.getStreamResourceSupportExtDrive(resources); FileDownloader fileDownloader = new FileDownloader(downloadResource); fileDownloader.extend(downloadBtn); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()) .withStyleName(WebThemes.BUTTON_OPTION); MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, downloadBtn); layout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT); this.setContent(layout); }
Example #29
Source File: PieChartWrapper.java From mycollab with GNU Affero General Public License v3.0 | 4 votes |
@Override protected final ComponentContainer createLegendBox() { final CssLayout mainLayout = new CssLayout(); mainLayout.addStyleName("legend-box"); mainLayout.setSizeUndefined(); final List keys = pieDataSet.getKeys(); for (int i = 0; i < keys.size(); i++) { MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true)) .withStyleName("inline-block").withUndefinedWidth(); layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); final Comparable key = (Comparable) keys.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 btnCaption; if (enumKeyCls == null) { if (key instanceof Key) { btnCaption = String.format("%s (%d)", StringUtils.trim(((Key) key).getDisplayName(), 20, true), pieDataSet.getValue(key).intValue()); } else { btnCaption = String.format("%s (%d)", key, pieDataSet.getValue(key).intValue()); } } else { btnCaption = String.format("%s(%d)", UserUIContext.getMessage(enumKeyCls, key.toString()), pieDataSet.getValue(key).intValue()); } MButton btnLink = new MButton(StringUtils.trim(btnCaption, 25, true), clickEvent -> { if (key instanceof Key) { clickLegendItem(((Key) key).getKey()); } else { clickLegendItem(key.toString()); } }).withStyleName(WebThemes.BUTTON_LINK).withDescription(btnCaption); layout.with(lblCircle, btnLink); mainLayout.addComponent(layout); } mainLayout.setWidth("100%"); return mainLayout; }
Example #30
Source File: LoginView.java From gazpachoquest with GNU General Public License v3.0 | 4 votes |
protected CssLayout createCompositionRoot() { CssLayout root = new CssLayout(); root.setSizeFull(); root.addStyleName(Reindeer.LAYOUT_BLUE); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSizeFull(); loginLayout.addStyleName("login-layout"); root.addComponent(loginLayout); final CssLayout loginPanel = new CssLayout(); loginPanel.addStyleName("login-panel"); loginLayout.addComponent(loginPanel); HorizontalLayout labels = new HorizontalLayout(); labels.setWidth("100%"); labels.setMargin(true); labels.addStyleName("labels"); loginPanel.addComponent(labels); Label welcome = new Label("Welcome"); welcome.setSizeUndefined(); welcome.addStyleName(Reindeer.LABEL_H2); labels.addComponent(welcome); labels.setComponentAlignment(welcome, Alignment.MIDDLE_LEFT); Label title = new Label("Gazpacho Quest"); title.setSizeUndefined(); title.addStyleName(Reindeer.LABEL_H1); labels.addComponent(title); labels.setComponentAlignment(title, Alignment.MIDDLE_RIGHT); HorizontalLayout fields = new HorizontalLayout(); fields.setWidth("100%"); fields.setSpacing(true); fields.setMargin(true); fields.addStyleName("fields"); invitation = new TextField("Invitation"); invitation.setSizeUndefined(); invitation.focus(); // invitation.setValue("YAS5ICHRBE"); fields.addComponent(invitation); login = new Button("Start"); login.addClickListener(createLoginButtonListener()); fields.addComponent(login); fields.setComponentAlignment(login, Alignment.BOTTOM_LEFT); loginPanel.addComponent(fields); return root; }