List of usage examples for com.vaadin.ui VerticalLayout VerticalLayout
public VerticalLayout()
From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunityLeadListComp.java
License:Open Source License
@Override protected Component generateTopControls() { VerticalLayout controlsBtnWrap = new VerticalLayout(); controlsBtnWrap.setWidth("100%"); final SplitButton controlsBtn = new SplitButton(); controlsBtn.setSizeUndefined();/*from w w w.ja v a2 s .co m*/ controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_LEAD)); controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK); controlsBtn.setCaption(AppContext.getMessage(LeadI18nEnum.BUTTON_NEW_LEAD)); controlsBtn.setIcon(FontAwesome.PLUS); controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() { private static final long serialVersionUID = 1L; @Override public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) { fireNewRelatedItem(""); } }); final Button selectBtn = new Button("Select from existing leads", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final OpportunityLeadSelectionWindow leadsWindow = new OpportunityLeadSelectionWindow( OpportunityLeadListComp.this); final LeadSearchCriteria criteria = new LeadSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); UI.getCurrent().addWindow(leadsWindow); leadsWindow.setSearchCriteria(criteria); controlsBtn.setPopupVisible(false); } }); selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select)); selectBtn.setStyleName("link"); VerticalLayout buttonControlLayout = new VerticalLayout(); buttonControlLayout.addComponent(selectBtn); controlsBtn.setContent(buttonControlLayout); controlsBtnWrap.addComponent(controlsBtn); controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT); return controlsBtnWrap; }
From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunityListNoItemView.java
License:Open Source License
public OpportunityListNoItemView() { VerticalLayout layout = new VerticalLayout(); layout.addStyleName("case-noitem"); layout.setWidth("800px"); layout.setSpacing(true);//from ww w . jav a 2 s.c om layout.setDefaultComponentAlignment(Alignment.TOP_CENTER); layout.setMargin(true); Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/opportunity.png")); layout.addComponent(image); Label title = new Label(AppContext.getMessage(OpportunityI18nEnum.VIEW_NO_ITEM_TITLE)); title.addStyleName("h2"); title.setWidthUndefined(); layout.addComponent(title); Label body = new Label(AppContext.getMessage(OpportunityI18nEnum.VIEW_NO_ITEM_HINT)); body.setWidthUndefined(); layout.addComponent(body); Button btCreateContact = new Button(AppContext.getMessage(OpportunityI18nEnum.BUTTON_NEW_OPPORTUNITY), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance().post(new OpportunityEvent.GotoAdd(this, null)); } }); HorizontalLayout links = new HorizontalLayout(); links.addComponent(btCreateContact); btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK); /* * Label or = new Label("Or"); or.setStyleName("h2"); * links.addComponent(or); * * Button btImportContact = new Button("Import Leads", new * Button.ClickListener() { private static final long serialVersionUID = * 1L; * * @Override public void buttonClick(ClickEvent arg0) { * UI.getCurrent().addWindow(new CaseImportWindow()); } }); * * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK); * * * links.addComponent(btImportContact); */ links.setSpacing(true); layout.addComponent(links); this.addComponent(layout); this.setComponentAlignment(layout, Alignment.TOP_CENTER); }
From source file:com.esofthead.mycollab.module.crm.view.SalesDashboardView.java
License:Open Source License
public SalesDashboardView() { super("Sales Dashboard", null, new VerticalLayout(), "100%", "200px"); this.bodyContent.setSizeFull(); this.initUI(); this.setHeaderColor(true); this.setContentBorder(true); }
From source file:com.esofthead.mycollab.module.crm.view.SalesDashboardView.java
License:Open Source License
private void initUI() { final PopupButton saleChartPopup = new PopupButton(""); saleChartPopup.addStyleName("popuplistindicator"); final VerticalLayout filterBtnLayout = new VerticalLayout(); filterBtnLayout.setMargin(true);// ww w . j a va 2 s. c o m filterBtnLayout.setSpacing(true); filterBtnLayout.setWidth("200px"); final Button btnOpportunitySales = new Button("Opportunity Sales Stage", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { saleChartPopup.setPopupVisible(false); SalesDashboardView.this.currentReportIndex = 0; SalesDashboardView.this.displayReport(); } }); btnOpportunitySales.setStyleName("link"); filterBtnLayout.addComponent(btnOpportunitySales); final Button btnOpportunityLead = new Button("Opportunity Lead Source", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { saleChartPopup.setPopupVisible(false); SalesDashboardView.this.currentReportIndex = 1; SalesDashboardView.this.displayReport(); } }); btnOpportunityLead.setStyleName("link"); filterBtnLayout.addComponent(btnOpportunityLead); this.displayReport(); saleChartPopup.setContent(filterBtnLayout); this.addHeaderElement(saleChartPopup); }
From source file:com.esofthead.mycollab.module.file.view.components.ResourcesDisplayComponent.java
License:Open Source License
public ResourcesDisplayComponent(final String rootPath, final Folder rootFolder) { this.setSpacing(true); this.baseFolder = rootFolder; this.rootPath = rootPath; externalResourceService = ApplicationContextUtil.getSpringBean(ExternalResourceService.class); externalDriveService = ApplicationContextUtil.getSpringBean(ExternalDriveService.class); resourceService = ApplicationContextUtil.getSpringBean(ResourceService.class); VerticalLayout mainBodyLayout = new VerticalLayout(); mainBodyLayout.setSpacing(true);/*from w w w. j ava 2 s. co m*/ mainBodyLayout.addStyleName("box-no-border-left"); // file breadcrum --------------------- HorizontalLayout breadcrumbContainer = new HorizontalLayout(); breadcrumbContainer.setMargin(false); fileBreadCrumb = new FileBreadcrumb(rootPath); breadcrumbContainer.addComponent(fileBreadCrumb); mainBodyLayout.addComponent(breadcrumbContainer); // Construct controllGroupBtn controllGroupBtn = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true)); final Button selectAllBtn = new Button(); selectAllBtn.addStyleName(UIConstants.THEME_BROWN_LINK); selectAllBtn.setIcon(FontAwesome.SQUARE_O); selectAllBtn.setData(false); selectAllBtn.setImmediate(true); selectAllBtn.setDescription("Select all"); selectAllBtn.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (!(Boolean) selectAllBtn.getData()) { selectAllBtn.setIcon(FontAwesome.CHECK_SQUARE_O); selectAllBtn.setData(true); resourcesContainer.setAllValues(true); } else { selectAllBtn.setData(false); selectAllBtn.setIcon(FontAwesome.SQUARE_O); resourcesContainer.setAllValues(false); } } }); controllGroupBtn.with(selectAllBtn).withAlign(selectAllBtn, Alignment.MIDDLE_LEFT); Button goUpBtn = new Button("Up"); goUpBtn.setIcon(FontAwesome.ARROW_UP); goUpBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { Folder parentFolder; if (baseFolder instanceof ExternalFolder) { if (baseFolder.getPath().equals("/")) { parentFolder = baseFolder; } else { parentFolder = externalResourceService.getParentResourceFolder( ((ExternalFolder) baseFolder).getExternalDrive(), baseFolder.getPath()); } } else if (!baseFolder.getPath().equals(rootPath)) { parentFolder = resourceService.getParentFolder(baseFolder.getPath()); } else { parentFolder = baseFolder; } resourcesContainer.constructBody(parentFolder); baseFolder = parentFolder; fileBreadCrumb.gotoFolder(baseFolder); } }); goUpBtn.setDescription("Back to parent folder"); goUpBtn.setStyleName(UIConstants.THEME_BROWN_LINK); goUpBtn.setDescription("Go up"); controllGroupBtn.with(goUpBtn).withAlign(goUpBtn, Alignment.MIDDLE_LEFT); ButtonGroup navButton = new ButtonGroup(); navButton.addStyleName(UIConstants.THEME_BROWN_LINK); Button createBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CREATE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { AddNewFolderWindow addnewFolderWindow = new AddNewFolderWindow(); UI.getCurrent().addWindow(addnewFolderWindow); } }); createBtn.setIcon(FontAwesome.PLUS); createBtn.addStyleName(UIConstants.THEME_BROWN_LINK); createBtn.setDescription("Create new folder"); createBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.PUBLIC_DOCUMENT_ACCESS)); navButton.addButton(createBtn); Button uploadBtn = new Button("Upload", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { MultiUploadContentWindow multiUploadWindow = new MultiUploadContentWindow(); UI.getCurrent().addWindow(multiUploadWindow); } }); uploadBtn.setIcon(FontAwesome.UPLOAD); uploadBtn.addStyleName(UIConstants.THEME_BROWN_LINK); uploadBtn.setDescription("Upload"); uploadBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.PUBLIC_DOCUMENT_ACCESS)); navButton.addButton(uploadBtn); Button downloadBtn = new Button("Download"); LazyStreamSource streamSource = new LazyStreamSource() { private static final long serialVersionUID = 1L; @Override protected StreamSource buildStreamSource() { Collection<Resource> selectedResources = getSelectedResources(); return StreamDownloadResourceUtil.getStreamSourceSupportExtDrive(selectedResources); } @Override public String getFilename() { Collection<Resource> selectedResources = getSelectedResources(); return StreamDownloadResourceUtil.getDownloadFileName(selectedResources); } }; OnDemandFileDownloader downloaderExt = new OnDemandFileDownloader(streamSource); downloaderExt.extend(downloadBtn); downloadBtn.setIcon(FontAwesome.DOWNLOAD); downloadBtn.addStyleName(UIConstants.THEME_BROWN_LINK); downloadBtn.setDescription("Download"); downloadBtn.setEnabled(AppContext.canRead(RolePermissionCollections.PUBLIC_DOCUMENT_ACCESS)); navButton.addButton(downloadBtn); Button moveToBtn = new Button("Move", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { Collection<Resource> selectedResources = getSelectedResources(); if (CollectionUtils.isNotEmpty(selectedResources)) { MoveResourceWindow moveResourceWindow = new MoveResourceWindow(selectedResources); UI.getCurrent().addWindow(moveResourceWindow); } else { NotificationUtil.showWarningNotification("Please select at least one item to move"); } } }); moveToBtn.setIcon(FontAwesome.ARROWS); moveToBtn.addStyleName(UIConstants.THEME_BROWN_LINK); moveToBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.PUBLIC_DOCUMENT_ACCESS)); moveToBtn.setDescription("Move to"); navButton.addButton(moveToBtn); Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { Collection<Resource> selectedResources = getSelectedResources(); if (CollectionUtils.isEmpty(selectedResources)) { NotificationUtil.showWarningNotification("Please select at least one item to delete"); } else { deleteResourceAction(); } } }); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.addStyleName(UIConstants.THEME_RED_LINK); deleteBtn.setDescription("Delete resource"); deleteBtn.setEnabled(AppContext.canAccess(RolePermissionCollections.PUBLIC_DOCUMENT_ACCESS)); navButton.addButton(deleteBtn); controllGroupBtn.addComponent(navButton); mainBodyLayout.addComponent(controllGroupBtn); resourcesContainer = new ResourcesContainer(baseFolder); mainBodyLayout.addComponent(resourcesContainer); this.addComponent(mainBodyLayout); }
From source file:com.esofthead.mycollab.module.project.ui.components.AbstractPreviewItemComp2.java
License:Open Source License
public AbstractPreviewItemComp2(String headerText, Resource iconResource) { if (iconResource != null) this.titleIcon = new Image(null, iconResource); this.addComponent(constructHeader(headerText)); previewForm = initPreviewForm();//from w w w . j ava 2 s. c o m ComponentContainer actionControls = createButtonControls(); if (actionControls != null) { actionControls.addStyleName("control-buttons"); addHeaderRightContent(actionControls); } CssLayout contentWrapper = new CssLayout(); contentWrapper.setStyleName("content-wrapper"); previewLayout = new ReadViewLayout(""); contentWrapper.addComponent(previewLayout); bodyContainer = new HorizontalLayout(); bodyContainer.setSizeFull(); bodyContainer.setStyleName("readview-body-wrap"); bodyContent = new VerticalLayout(); bodyContent.addComponent(previewForm); bodyContainer.addComponent(bodyContent); bodyContainer.setExpandRatio(bodyContent, 1); sidebarContent = new VerticalLayout(); sidebarContent.setWidth("250px"); sidebarContent.setSpacing(true); sidebarContent.setStyleName("readview-sidebar"); bodyContainer.addComponent(sidebarContent); FloatingComponent floatSidebar = FloatingComponent.floatThis(sidebarContent); floatSidebar.setContainerId("main-body"); previewLayout.addBody(bodyContainer); this.addComponent(contentWrapper); }
From source file:com.esofthead.mycollab.module.project.ui.components.DynaFormLayout.java
License:Open Source License
@Override public ComponentContainer getLayout() { VerticalLayout layout = new VerticalLayout(); int sectionCount = dynaForm.getSectionCount(); sectionMappings = new HashMap<>(); for (int i = 0; i < sectionCount; i++) { DynaSection section = dynaForm.getSection(i); if (section.isDeletedSection()) { continue; }/*from w ww . j av a2 s . c o m*/ GridFormLayoutHelper gridLayout; if (section.isDeletedSection() || section.getFieldCount() == 0) { continue; } if (section.getLayoutType() == LayoutType.ONE_COLUMN) { gridLayout = new GridFormLayoutHelper(2, 1, "100%", "167px", Alignment.TOP_LEFT); for (int j = 0; j < section.getFieldCount(); j++) { AbstractDynaField dynaField = section.getField(j); if (!excludeFields.contains(dynaField.getFieldName())) { gridLayout.buildCell(dynaField.getDisplayName(), 0, gridLayout.getRows() - 1, 2, "100%", Alignment.TOP_LEFT); if (j < section.getFieldCount() - 1) { gridLayout.appendRow(); } } } } else if (section.getLayoutType() == LayoutType.TWO_COLUMN) { gridLayout = new GridFormLayoutHelper(2, 1, "100%", "167px", Alignment.TOP_LEFT); int columnIndex = 0; for (int j = 0; j < section.getFieldCount(); j++) { AbstractDynaField dynaField = section.getField(j); if (!excludeFields.contains(dynaField.getFieldName())) { if (dynaField.isColSpan()) { if (columnIndex > 0) { gridLayout.appendRow(); } LOG.debug("Build cell {}", new Object[] { dynaField.getDisplayName() }); gridLayout.buildCell(dynaField.getDisplayName(), 0, gridLayout.getRows() - 1, 2, "100%", Alignment.TOP_LEFT); columnIndex = 0; if (j < section.getFieldCount() - 1) { gridLayout.appendRow(); } } else { LOG.debug("Build cell {}", new Object[] { dynaField.getDisplayName() }); gridLayout.buildCell(dynaField.getDisplayName(), columnIndex, gridLayout.getRows() - 1); columnIndex++; if (columnIndex == 2) { columnIndex = 0; if (j < section.getFieldCount() - 1) { gridLayout.appendRow(); } } } } } } else { throw new MyCollabException("Does not support attachForm layout except 1 or 2 columns"); } gridLayout.getLayout().setWidth("100%"); gridLayout.getLayout().setMargin(false); gridLayout.getLayout().setSpacing(false); gridLayout.getLayout().addStyleName("colored-gridlayout"); layout.addComponent(gridLayout.getLayout()); sectionMappings.put(section, gridLayout); } return layout; }
From source file:com.esofthead.mycollab.module.project.ui.components.ProjectAttachmentDisplayComponentFactory.java
License:Open Source License
public static Component getAttachmentDisplayComponent(int projectid, AttachmentType type, int typeid) { ResourceService resourceService = ApplicationContextUtil.getSpringBean(ResourceService.class); List<Content> attachments = resourceService.getContents( AttachmentUtils.getProjectEntityAttachmentPath(AppContext.getAccountId(), projectid, type, typeid)); if (CollectionUtils.isNotEmpty(attachments)) { return new AttachmentDisplayComponent(attachments); } else {//from ww w .ja va2 s .c om return new VerticalLayout(); } }
From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogEditWindow.java
License:Open Source License
private void constructSpentTimeEntryPanel() { VerticalLayout spentTimePanel = new VerticalLayout(); spentTimePanel.setSpacing(true);//from w ww . jav a2 s. c o m headerPanel.addComponent(spentTimePanel); final VerticalLayout totalLayout = new VerticalLayout(); totalLayout.setMargin(true); totalLayout.addStyleName("boxTotal"); totalLayout.setWidth("100%"); spentTimePanel.addComponent(totalLayout); final Label lbTimeInstructTotal = new Label( AppContext.getMessage(TimeTrackingI18nEnum.OPT_TOTAL_SPENT_HOURS)); totalLayout.addComponent(lbTimeInstructTotal); this.totalSpentTimeLbl = new Label("_"); this.totalSpentTimeLbl.addStyleName("numberTotal"); totalLayout.addComponent(this.totalSpentTimeLbl); final MHorizontalLayout addLayout = new MHorizontalLayout(); addLayout.setSizeUndefined(); addLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); spentTimePanel.addComponent(addLayout); this.newTimeInputField = new NumericTextField(); this.newTimeInputField.setWidth("80px"); this.forDateField = new DateFieldExt(); this.forDateField.setValue(new GregorianCalendar().getTime()); this.isBillableField = new CheckBox(AppContext.getMessage(TimeTrackingI18nEnum.FORM_IS_BILLABLE), true); btnAdd = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { double d = 0; try { d = Double.parseDouble(newTimeInputField.getValue()); } catch (NumberFormatException e) { NotificationUtil.showWarningNotification("You must enter a positive number value"); } if (d > 0) { saveTimeInvest(); loadTimeValue(); newTimeInputField.setValue("0.0"); } } }); btnAdd.setEnabled(TimeLogEditWindow.this.isEnableAdd()); btnAdd.setStyleName(UIConstants.THEME_GREEN_LINK); btnAdd.setIcon(FontAwesome.PLUS); addLayout.with(this.newTimeInputField, this.forDateField, this.isBillableField, btnAdd); }
From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogEditWindow.java
License:Open Source License
private void constructRemainTimeEntryPanel() { VerticalLayout remainTimePanel = new VerticalLayout(); remainTimePanel.setSpacing(true);// ww w .j ava 2 s.c o m this.headerPanel.addComponent(remainTimePanel); final VerticalLayout updateLayout = new VerticalLayout(); updateLayout.setMargin(true); updateLayout.addStyleName("boxTotal"); updateLayout.setWidth("100%"); remainTimePanel.addComponent(updateLayout); final Label lbTimeInstructTotal = new Label( AppContext.getMessage(TimeTrackingI18nEnum.OPT_REMAINING_WORK_HOURS)); updateLayout.addComponent(lbTimeInstructTotal); this.remainTimeLbl = new Label("_"); this.remainTimeLbl.addStyleName("numberTotal"); updateLayout.addComponent(this.remainTimeLbl); final MHorizontalLayout addLayout = new MHorizontalLayout(); addLayout.setSizeUndefined(); remainTimePanel.addComponent(addLayout); this.remainTimeInputField = new NumericTextField(); this.remainTimeInputField.setWidth("80px"); addLayout.addComponent(this.remainTimeInputField); addLayout.setComponentAlignment(this.remainTimeInputField, Alignment.MIDDLE_LEFT); btnAdd = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { try { double d = 0; try { d = Double.parseDouble(remainTimeInputField.getValue()); } catch (Exception e) { NotificationUtil.showWarningNotification("You must enter a positive number value"); } if (d >= 0) { updateTimeRemain(); remainTimeLbl.setValue(remainTimeInputField.getValue()); remainTimeInputField.setValue("0.0"); } } catch (final Exception e) { remainTimeInputField.setValue("0.0"); } } }); btnAdd.setEnabled(TimeLogEditWindow.this.isEnableAdd()); btnAdd.setStyleName(UIConstants.THEME_GREEN_LINK); addLayout.addComponent(btnAdd); addLayout.setComponentAlignment(btnAdd, Alignment.MIDDLE_LEFT); }