List of usage examples for com.vaadin.ui CssLayout CssLayout
public CssLayout()
From source file:com.mycollab.module.crm.view.setting.CrmSettingContainer.java
License:Open Source License
public CrmSettingContainer() { this.setWidth("100%"); final CssLayout contentWrapper = new CssLayout(); contentWrapper.setWidth("100%"); this.addComponent(contentWrapper); settingTab = new VerticalTabsheet(); settingTab.setSizeFull();//from w ww . j a v a 2s . c o m settingTab.setNavigatorWidth("250px"); settingTab.setNavigatorStyleName("sidebar-menu"); settingTab.setHeight(null); buildComponents(); contentWrapper.addComponent(settingTab); }
From source file:com.mycollab.module.file.view.components.FileDownloadWindow.java
License:Open Source License
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 inforLayout = GridFormLayoutHelper.defaultFormLayoutHelper(1, 4); if (content.getDescription() != null) { final Label descLbl = new Label(); if (!content.getDescription().equals("")) { descLbl.setData(content.getDescription()); } else {//from ww w . ja v a 2 s . co m descLbl.setValue(" "); descLbl.setContentMode(ContentMode.HTML); } inforLayout.addComponent(descLbl, "Description", 0, 0); } UserService userService = AppContextUtil.getSpringBean(UserService.class); SimpleUser user = userService.findUserByUserNameInAccount(content.getCreatedUser(), AppContext.getAccountId()); if (user == null) { inforLayout.addComponent(new UserLink(AppContext.getUsername(), AppContext.getUserAvatarId(), AppContext.getUserDisplayName()), "Created by", 0, 1); } else { inforLayout.addComponent(new UserLink(user.getUsername(), user.getAvatarid(), user.getDisplayName()), "Created by", 0, 1); } final Label size = new Label(FileUtils.getVolumeDisplay(content.getSize())); inforLayout.addComponent(size, "Size", 0, 2); ELabel dateCreate = new ELabel().prettyDateTime(content.getCreated().getTime()); inforLayout.addComponent(dateCreate, "Created date", 0, 3); layout.addComponent(inforLayout.getLayout()); final MHorizontalLayout buttonControls = new MHorizontalLayout() .withMargin(new MarginInfo(true, false, true, false)); final Button downloadBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DOWNLOAD)); List<Resource> resources = new ArrayList<>(); resources.add(content); StreamResource downloadResource = StreamDownloadResourceUtil.getStreamResourceSupportExtDrive(resources); FileDownloader fileDownloader = new FileDownloader(downloadResource); fileDownloader.extend(downloadBtn); downloadBtn.setIcon(FontAwesome.DOWNLOAD); downloadBtn.addStyleName(UIConstants.BUTTON_ACTION); final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { close(); } }); cancelBtn.addStyleName(UIConstants.BUTTON_OPTION); buttonControls.with(cancelBtn, downloadBtn).alignAll(Alignment.TOP_RIGHT); layout.with(buttonControls).withAlign(buttonControls, Alignment.TOP_RIGHT); this.setContent(layout); }
From source file:com.mycollab.module.file.view.FileDownloadWindow.java
License:Open Source License
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 inforLayout = GridFormLayoutHelper.defaultFormLayoutHelper(1, 4); if (content.getDescription() != null) { final Label descLbl = new Label(); if (!content.getDescription().equals("")) { descLbl.setData(content.getDescription()); } else {//ww w . j a v a 2 s . c o m descLbl.setValue(" "); descLbl.setContentMode(ContentMode.HTML); } inforLayout.addComponent(descLbl, UserUIContext.getMessage(GenericI18Enum.FORM_DESCRIPTION), 0, 0); } UserService userService = AppContextUtil.getSpringBean(UserService.class); SimpleUser user = userService.findUserByUserNameInAccount(content.getCreatedUser(), MyCollabUI.getAccountId()); if (user == null) { inforLayout.addComponent( new UserLink(UserUIContext.getUsername(), UserUIContext.getUserAvatarId(), UserUIContext.getUserDisplayName()), UserUIContext.getMessage(GenericI18Enum.OPT_CREATED_BY), 0, 1); } else { inforLayout.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())); inforLayout.addComponent(size, UserUIContext.getMessage(FileI18nEnum.OPT_SIZE), 0, 2); ELabel dateCreate = new ELabel().prettyDateTime(content.getCreated().getTime()); inforLayout.addComponent(dateCreate, UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME), 0, 3); layout.addComponent(inforLayout.getLayout()); MButton downloadBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DOWNLOAD)) .withIcon(FontAwesome.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); final MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, downloadBtn); layout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT); this.setContent(layout); }
From source file:com.mycollab.module.project.ui.components.AbstractPreviewItemComp.java
License:Open Source License
private void initContent() { previewForm = initPreviewForm();//from w ww .ja va2s .c o m actionControls = createButtonControls(); if (actionControls != null) { actionControls.setWidthUndefined(); header.with(actionControls).withAlign(actionControls, Alignment.TOP_RIGHT); } MCssLayout contentWrapper = new MCssLayout().withFullWidth().withStyleName(WebUIConstants.CONTENT_WRAPPER); if (previewLayout == null) previewLayout = new DefaultReadViewLayout(""); contentWrapper.addComponent(previewLayout); if (isDisplaySideBar) { RightSidebarLayout bodyContainer = new RightSidebarLayout(); bodyContainer.setSizeFull(); bodyContainer.addStyleName("readview-body-wrap"); bodyContent = new MVerticalLayout().withSpacing(false).withMargin(false).withFullWidth() .with(previewForm); bodyContainer.setContent(bodyContent); sidebarContent = new MVerticalLayout().withWidth("250px").withStyleName("readview-sidebar"); bodyContainer.setSidebar(sidebarContent); previewLayout.addBody(bodyContainer); } else { CssLayout bodyContainer = new CssLayout(); bodyContainer.setSizeFull(); bodyContainer.addStyleName("readview-body-wrap"); bodyContent = new MVerticalLayout().withSpacing(false).withFullWidth().withMargin(false) .with(previewForm); bodyContainer.addComponent(bodyContent); previewLayout.addBody(bodyContainer); } this.addComponent(contentWrapper); }
From source file:com.mycollab.module.project.ui.components.ProjectSubscribersComp.java
License:Open Source License
@Override protected Component initContent() { ProjectMemberService projectMemberService = AppContextUtil.getSpringBean(ProjectMemberService.class); List<SimpleUser> members = projectMemberService.getActiveUsersInProject(projectId, MyCollabUI.getAccountId());//from ww w .j a va2 s . c o m 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; }
From source file:com.mycollab.module.project.view.bug.BugReadViewImpl.java
License:Open Source License
@Override protected HorizontalLayout createButtonControls() { ProjectPreviewFormControlsGenerator<SimpleBug> bugPreviewFormControls = new ProjectPreviewFormControlsGenerator<>( previewForm);/*from ww w .j a v a 2 s . c o m*/ if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)) { MButton linkBtn = new MButton(UserUIContext.getMessage(BugI18nEnum.OPT_BUG_DEPENDENCIES), clickEvent -> UI.getCurrent().addWindow(new LinkIssueWindow(beanItem))) .withIcon(FontAwesome.BOLT); bugPreviewFormControls.addOptionButton(linkBtn); } HorizontalLayout topPanel = bugPreviewFormControls.createButtonControls( ProjectPreviewFormControlsGenerator.ADD_BTN_PRESENTED | ProjectPreviewFormControlsGenerator.DELETE_BTN_PRESENTED | ProjectPreviewFormControlsGenerator.EDIT_BTN_PRESENTED | ProjectPreviewFormControlsGenerator.PRINT_BTN_PRESENTED | ProjectPreviewFormControlsGenerator.CLONE_BTN_PRESENTED | ProjectPreviewFormControlsGenerator.NAVIGATOR_BTN_PRESENTED, ProjectRolePermissionCollections.BUGS); MButton assignBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ASSIGN), clickEvent -> UI.getCurrent().addWindow(new AssignBugWindow(beanItem))).withIcon(FontAwesome.SHARE) .withStyleName(WebThemes.BUTTON_ACTION); assignBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)); bugWorkflowControl = new CssLayout(); bugPreviewFormControls.insertToControlBlock(bugWorkflowControl); bugPreviewFormControls.insertToControlBlock(assignBtn); topPanel.setSizeUndefined(); return topPanel; }
From source file:com.mycollab.module.project.view.milestone.AllMilestoneTimelineWidget.java
License:Open Source License
public void display() { this.withMargin(new MarginInfo(false, false, true, false)).withStyleName("tm-container").withFullWidth(); MHorizontalLayout headerLayout = new MHorizontalLayout() .withMargin(new MarginInfo(false, true, false, true)).withStyleName(WebThemes.PANEL_HEADER); headerLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel titleLbl = ELabel.h3(UserUIContext.getMessage(MilestoneI18nEnum.OPT_TIMELINE)); final CheckBox includeNoDateSet = new CheckBox(UserUIContext.getMessage(DayI18nEnum.OPT_NO_DATE_SET)); includeNoDateSet.setValue(false);// w w w . j a v a 2 s.c om final CheckBox includeClosedMilestone = new CheckBox(UserUIContext.getMessage(MilestoneStatus.Closed)); includeClosedMilestone.setValue(false); includeNoDateSet.addValueChangeListener(valueChangeEvent -> displayTimelines(includeNoDateSet.getValue(), includeClosedMilestone.getValue())); includeClosedMilestone .addValueChangeListener(valueChangeEvent -> displayTimelines(includeNoDateSet.getValue(), includeClosedMilestone.getValue())); headerLayout.with(titleLbl, includeNoDateSet, includeClosedMilestone).expand(titleLbl) .withAlign(includeNoDateSet, Alignment.MIDDLE_RIGHT) .withAlign(includeClosedMilestone, Alignment.MIDDLE_RIGHT); MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria(); UserDashboardView userDashboardView = UIUtils.getRoot(this, UserDashboardView.class); searchCriteria.setProjectIds(new SetSearchField<>(userDashboardView.getInvolvedProjectKeys())); searchCriteria.setOrderFields( Collections.singletonList(new SearchCriteria.OrderField(Milestone.Field.enddate.name(), "ASC"))); MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class); milestones = milestoneService.findPageableListByCriteria(new BasicSearchRequest<>(searchCriteria)); this.addComponent(headerLayout); timelineContainer = new CssLayout(); timelineContainer.setWidth("100%"); this.addComponent(timelineContainer); timelineContainer.addStyleName("tm-wrapper"); displayTimelines(false, false); }
From source file:com.mycollab.module.project.view.milestone.MilestoneTimelineWidget.java
License:Open Source License
public void display() { this.setWidth("100%"); this.addStyleName("tm-container"); this.setSpacing(true); this.setMargin(new MarginInfo(false, false, true, false)); MHorizontalLayout headerLayout = new MHorizontalLayout().withStyleName(WebThemes.PANEL_HEADER); headerLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel titleLbl = ELabel.h3(UserUIContext.getMessage(MilestoneI18nEnum.OPT_TIMELINE)); final CheckBox noDateSetMilestone = new CheckBox(UserUIContext.getMessage(DayI18nEnum.OPT_NO_DATE_SET)); noDateSetMilestone.setValue(false);//from w ww . jav a2 s . c o m final CheckBox includeClosedMilestone = new CheckBox(UserUIContext.getMessage(MilestoneStatus.Closed)); includeClosedMilestone.setValue(false); noDateSetMilestone .addValueChangeListener(valueChangeEvent -> displayTimelines(noDateSetMilestone.getValue(), includeClosedMilestone.getValue())); includeClosedMilestone .addValueChangeListener(valueChangeEvent -> displayTimelines(noDateSetMilestone.getValue(), includeClosedMilestone.getValue())); headerLayout.with(titleLbl, noDateSetMilestone, includeClosedMilestone).expand(titleLbl) .withAlign(noDateSetMilestone, Alignment.MIDDLE_RIGHT) .withAlign(includeClosedMilestone, Alignment.MIDDLE_RIGHT); MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria(); searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId())); searchCriteria.setOrderFields( Collections.singletonList(new SearchCriteria.OrderField(Milestone.Field.enddate.name(), "ASC"))); MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class); milestones = milestoneService.findPageableListByCriteria(new BasicSearchRequest<>(searchCriteria)); this.addComponent(headerLayout); timelineContainer = new CssLayout(); timelineContainer.setWidth("100%"); this.addComponent(timelineContainer); timelineContainer.addStyleName("tm-wrapper"); displayTimelines(false, false); }
From source file:com.mycollab.module.project.view.settings.ComponentListViewImpl.java
License:Open Source License
private ComponentContainer constructTableActionControls() { final CssLayout layoutWrapper = new CssLayout(); layoutWrapper.setWidth("100%"); MHorizontalLayout layout = new MHorizontalLayout(); layoutWrapper.addStyleName(WebThemes.TABLE_ACTION_CONTROLS); layoutWrapper.addComponent(layout);// w ww. j a v a2 s.c om this.selectOptionButton = new SelectionOptionButton(tableItem); layout.addComponent(this.selectOptionButton); tableActionControls = new DefaultMassItemActionHandlerContainer(); if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.COMPONENTS)) { tableActionControls.addDeleteActionItem(); } tableActionControls.addMailActionItem(); tableActionControls.addDownloadPdfActionItem(); tableActionControls.addDownloadExcelActionItem(); tableActionControls.addDownloadCsvActionItem(); layout.with(tableActionControls, selectedItemsNumberLabel).withAlign(selectedItemsNumberLabel, Alignment.MIDDLE_CENTER); return layoutWrapper; }
From source file:com.mycollab.module.project.view.settings.ProjectMemberListViewImpl.java
License:Open Source License
public ProjectMemberListViewImpl() { super();/*from ww w.j ava2 s. c om*/ this.setMargin(new MarginInfo(false, true, true, true)); MHorizontalLayout viewHeader = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)) .withFullWidth(); viewHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); headerText = ComponentUtils.headerH2(ProjectTypeConstants.MEMBER, UserUIContext.getMessage(ProjectMemberI18nEnum.LIST)); viewHeader.with(headerText).expand(headerText); final MButton sortBtn = new MButton().withIcon(FontAwesome.SORT_ALPHA_ASC) .withStyleName(WebThemes.BUTTON_ICON_ONLY); sortBtn.addClickListener(clickEvent -> { sortAsc = !sortAsc; if (sortAsc) { sortBtn.setIcon(FontAwesome.SORT_ALPHA_ASC); displayMembers(); } else { sortBtn.setIcon(FontAwesome.SORT_ALPHA_DESC); displayMembers(); } }); viewHeader.addComponent(sortBtn); final SearchTextField searchTextField = new SearchTextField() { @Override public void doSearch(String value) { searchCriteria.setMemberFullName(StringSearchField.and(value)); displayMembers(); } @Override public void emptySearch() { searchCriteria.setMemberFullName(null); displayMembers(); } }; searchTextField.addStyleName(ValoTheme.TEXTFIELD_SMALL); viewHeader.addComponent(searchTextField); MButton printBtn = new MButton("", clickEvent -> { UI.getCurrent().addWindow(new ProjectMemberCustomizeReportOutputWindow(new LazyValueInjector() { @Override protected Object doEval() { return searchCriteria; } })); }).withIcon(FontAwesome.PRINT).withStyleName(WebThemes.BUTTON_OPTION) .withDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_EXPORT)); viewHeader.addComponent(printBtn); MButton createBtn = new MButton(UserUIContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEES), clickEvent -> EventBusFactory.getInstance() .post(new ProjectMemberEvent.GotoInviteMembers(this, null))) .withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.SEND); createBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)); viewHeader.addComponent(createBtn); addComponent(viewHeader); contentLayout = new CssLayout(); contentLayout.setWidth("100%"); addComponent(contentLayout); }