List of usage examples for com.vaadin.ui VerticalLayout VerticalLayout
public VerticalLayout()
From source file:com.esofthead.mycollab.module.project.ui.form.ProjectFormAttachmentUploadField.java
License:Open Source License
@Override protected Component initContent() { final VerticalLayout layout = new VerticalLayout(); uploadExt = new MultiFileUploadExt(attachmentPanel); uploadExt.addComponent(attachmentPanel); layout.addComponent(uploadExt);//from w w w . ja va 2 s .c om return layout; }
From source file:com.esofthead.mycollab.module.project.view.bug.AssignBugWindow.java
License:Open Source License
AssignBugWindow(final IBugCallbackStatusComp callbackForm, final SimpleBug bug) { super("Assign bug '" + bug.getSummary() + "'"); this.setWidth("750px"); this.setResizable(false); this.setModal(true); this.bug = bug; this.callbackForm = callbackForm; VerticalLayout contentLayout = new VerticalLayout(); EditForm editForm = new EditForm(); contentLayout.addComponent(editForm); editForm.setBean(bug);// w w w . jav a 2 s . com contentLayout.setMargin(new MarginInfo(false, false, true, false)); this.setContent(contentLayout); this.center(); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugAddFormLayoutFactory.java
License:Open Source License
@Override public Layout getLayout() { final VerticalLayout layout = new VerticalLayout(); this.informationLayout = new GridFormLayoutHelper(2, 9, "100%", "167px", Alignment.TOP_LEFT); this.informationLayout.getLayout().setWidth("100%"); this.informationLayout.getLayout().setMargin(false); this.informationLayout.getLayout().addStyleName("colored-gridlayout"); layout.addComponent(this.informationLayout.getLayout()); layout.setComponentAlignment(this.informationLayout.getLayout(), Alignment.BOTTOM_CENTER); return layout; }
From source file:com.esofthead.mycollab.module.project.view.bug.BugDashboardViewImpl.java
License:Open Source License
private void initHeader() { final Label title = new ProjectViewHeader(ProjectTypeConstants.BUG, AppContext.getMessage(BugI18nEnum.VIEW_BUG_DASHBOARD_TITLE)); header.with(title).withAlign(title, Alignment.MIDDLE_LEFT).expand(title); final Button createBugBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_NEW_BUG), new Button.ClickListener() { @Override/* w ww . j a v a2 s . c o m*/ public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance().post(new BugEvent.GotoAdd(this, null)); } }); createBugBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)); createBugBtn.setIcon(FontAwesome.PLUS); final SplitButton controlsBtn = new SplitButton(createBugBtn); controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK); controlsBtn.setWidthUndefined(); final VerticalLayout btnControlsLayout = new VerticalLayout(); final Button createComponentBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_NEW_COMPONENT), new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new BugComponentEvent.GotoAdd(this, null)); } }); createComponentBtn.setStyleName("link"); createComponentBtn .setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.COMPONENTS)); btnControlsLayout.addComponent(createComponentBtn); final Button createVersionBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_NEW_VERSION), new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new BugVersionEvent.GotoAdd(this, null)); } }); createVersionBtn.setStyleName("link"); createVersionBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.VERSIONS)); btnControlsLayout.addComponent(createVersionBtn); controlsBtn.setContent(btnControlsLayout); header.addComponent(controlsBtn); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugDisplayWidget.java
License:Open Source License
public BugDisplayWidget(final String title, boolean isDisplayTotalCount, final Class<? extends RowDisplayHandler<SimpleBug>> rowDisplayHandler) { super(title, new VerticalLayout()); this.title = title; this.isDisplayTotalCount = isDisplayTotalCount; dataList = new BeanList<>(ApplicationContextUtil.getSpringBean(BugService.class), rowDisplayHandler); bodyContent.addComponent(dataList);// ww w.ja va 2 s . com bodyContent.setStyleName(UIConstants.BUG_LIST); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugListViewImpl.java
License:Open Source License
public BugListViewImpl() { this.setMargin(new MarginInfo(false, true, false, true)); this.bugSearchPanel = new BugSearchPanel(); this.bugListLayout = new VerticalLayout(); this.generateDisplayTable(); this.bugSearchPanel.addRightComponent(constructTableActionControls()); with(bugSearchPanel, bugListLayout); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugListViewImpl.java
License:Open Source License
private ComponentContainer constructTableActionControls() { final MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%"); final Label lbEmpty = new Label(""); layout.with(lbEmpty).expand(lbEmpty); MHorizontalLayout buttonControls = new MHorizontalLayout(); layout.addComponent(buttonControls); Button customizeViewBtn = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*w w w . j a v a 2 s. com*/ public void buttonClick(ClickEvent event) { UI.getCurrent().addWindow(new BugListCustomizeWindow(BugListView.VIEW_DEF_ID, tableItem)); } }); customizeViewBtn.setIcon(FontAwesome.COG); customizeViewBtn.setDescription("Layout Options"); customizeViewBtn.setStyleName(UIConstants.THEME_GRAY_LINK); buttonControls.addComponent(customizeViewBtn); PopupButton exportButtonControl = new PopupButton(); exportButtonControl.addStyleName(UIConstants.THEME_GRAY_LINK); exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK); exportButtonControl.setDescription(AppContext.getMessage(FileI18nEnum.EXPORT_FILE)); VerticalLayout popupButtonsControl = new VerticalLayout(); exportButtonControl.setContent(popupButtonsControl); Button exportPdfBtn = new Button(AppContext.getMessage(FileI18nEnum.PDF)); StreamWrapperFileDownloader fileDownloader = new StreamWrapperFileDownloader(new StreamResourceFactory() { @Override public StreamResource getStreamResource() { String title = "Bugs of Project " + ((CurrentProjectVariables.getProject() != null && CurrentProjectVariables.getProject().getName() != null) ? CurrentProjectVariables.getProject().getName() : ""); BugSearchCriteria searchCriteria = new BugSearchCriteria(); searchCriteria.setProjectId( new NumberSearchField(SearchField.AND, CurrentProjectVariables.getProject().getId())); return new StreamResource(new SimpleGridExportItemsStreamResource.AllItems<>(title, new RpParameterBuilder(tableItem.getDisplayColumns()), ReportExportType.PDF, ApplicationContextUtil.getSpringBean(BugService.class), searchCriteria, SimpleBug.class), "export.pdf"); } }); fileDownloader.extend(exportPdfBtn); exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O); exportPdfBtn.setStyleName("link"); popupButtonsControl.addComponent(exportPdfBtn); Button exportExcelBtn = new Button(AppContext.getMessage(FileI18nEnum.EXCEL)); StreamWrapperFileDownloader excelDownloader = new StreamWrapperFileDownloader(new StreamResourceFactory() { @Override public StreamResource getStreamResource() { String title = "Bugs of Project " + ((CurrentProjectVariables.getProject() != null && CurrentProjectVariables.getProject().getName() != null) ? CurrentProjectVariables.getProject().getName() : ""); BugSearchCriteria searchCriteria = new BugSearchCriteria(); searchCriteria.setProjectId( new NumberSearchField(SearchField.AND, CurrentProjectVariables.getProject().getId())); return new StreamResource(new SimpleGridExportItemsStreamResource.AllItems<>(title, new RpParameterBuilder(tableItem.getDisplayColumns()), ReportExportType.EXCEL, ApplicationContextUtil.getSpringBean(BugService.class), searchCriteria, SimpleBug.class), "export.xlsx"); } }); excelDownloader.extend(exportExcelBtn); exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O); exportExcelBtn.setStyleName("link"); popupButtonsControl.addComponent(exportExcelBtn); Button exportCsvBtn = new Button(AppContext.getMessage(FileI18nEnum.CSV)); StreamWrapperFileDownloader csvFileDownloader = new StreamWrapperFileDownloader( new StreamResourceFactory() { @Override public StreamResource getStreamResource() { String title = "Bugs of Project " + ((CurrentProjectVariables.getProject() != null && CurrentProjectVariables.getProject().getName() != null) ? CurrentProjectVariables.getProject().getName() : ""); BugSearchCriteria searchCriteria = new BugSearchCriteria(); searchCriteria.setProjectId(new NumberSearchField(SearchField.AND, CurrentProjectVariables.getProject().getId())); return new StreamResource(new SimpleGridExportItemsStreamResource.AllItems<>(title, new RpParameterBuilder(tableItem.getDisplayColumns()), ReportExportType.CSV, ApplicationContextUtil.getSpringBean(BugService.class), searchCriteria, SimpleBug.class), "export.csv"); } }); csvFileDownloader.extend(exportCsvBtn); exportCsvBtn.setIcon(FontAwesome.FILE_TEXT_O); exportCsvBtn.setStyleName("link"); popupButtonsControl.addComponent(exportCsvBtn); buttonControls.addComponent(exportButtonControl); return layout; }
From source file:com.esofthead.mycollab.module.project.view.bug.BugListWidget.java
License:Open Source License
public BugListWidget(final String title, final String backBtnLabel, final BugSearchCriteria bugSearchCriteria, final IBugReportDisplayContainer bugReportDisplayContainer) { super(title, new VerticalLayout()); final VerticalLayout contentLayout = (VerticalLayout) this.bodyContent; contentLayout.setSpacing(true);/*w w w . jav a2s .com*/ contentLayout.setWidth("100%"); final Button backToBugReportsBtn = new Button(backBtnLabel, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { bugReportDisplayContainer.displayBugReports(); } }); // contentLayout.addComponent(backToBugReportsBtn); final VerticalLayout backBtnWrapper = new VerticalLayout(); backBtnWrapper.setMargin(new MarginInfo(false, false, true, false)); backToBugReportsBtn.setStyleName(UIConstants.THEME_GREEN_LINK); backBtnWrapper.addComponent(backToBugReportsBtn); this.addComponentAsFirst(backBtnWrapper); this.tableItem = new BugTableDisplay(BugTableFieldDef.action, Arrays.asList(BugTableFieldDef.summary, BugTableFieldDef.assignUser, BugTableFieldDef.severity, BugTableFieldDef.resolution, BugTableFieldDef.duedate)); this.tableItem.addTableListener(new TableClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(final TableClickEvent event) { final SimpleBug bug = (SimpleBug) event.getData(); if ("summary".equals(event.getFieldName())) { EventBusFactory.getInstance().post(new BugEvent.GotoRead(BugListWidget.this, bug.getId())); } } }); this.tableItem.setWidth("100%"); contentLayout.addComponent(this.tableItem); this.setSearchCriteria(bugSearchCriteria); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugRelatedField.java
License:Open Source License
public void displayRelatedBugs(final SimpleBug bug) { this.bug = bug; VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setWidth("100%"); mainLayout.setMargin(true);//w w w . j av a 2s. c o m mainLayout.setSpacing(true); HorizontalLayout layoutAdd = new HorizontalLayout(); layoutAdd.setSpacing(true); Label lbBug = new Label("Bug:"); lbBug.setWidth("70px"); layoutAdd.addComponent(lbBug); layoutAdd.setComponentAlignment(lbBug, Alignment.MIDDLE_LEFT); itemField = new TextField(); itemField.setWidth("300px"); itemField.setNullRepresentation(""); itemField.setReadOnly(true); itemField.setEnabled(true); layoutAdd.addComponent(itemField); layoutAdd.setComponentAlignment(itemField, Alignment.MIDDLE_LEFT); browseBtn = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { callItemSelectionWindow(); } }); browseBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_browseItem)); browseBtn.setStyleName("link"); layoutAdd.addComponent(browseBtn); layoutAdd.setComponentAlignment(browseBtn, Alignment.MIDDLE_LEFT); clearBtn = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { setItemFieldValue(""); } }); clearBtn.setIcon(MyCollabResource.newResource("icons/16/clearItem.png")); clearBtn.setStyleName("link"); layoutAdd.addComponent(clearBtn); layoutAdd.setComponentAlignment(clearBtn, Alignment.MIDDLE_LEFT); Label lbIs = new Label("is"); layoutAdd.addComponent(lbIs); layoutAdd.setComponentAlignment(lbIs, Alignment.MIDDLE_LEFT); comboRelation = new BugRelationComboBox(); comboRelation.setWidth("200px"); layoutAdd.addComponent(comboRelation); layoutAdd.setComponentAlignment(comboRelation, Alignment.MIDDLE_LEFT); btnRelate = new Button("Relate"); btnRelate.setStyleName(UIConstants.THEME_GREEN_LINK); btnRelate.setIcon(MyCollabResource.newResource(WebResourceIds._16_addRecord)); ProjectMemberService memberService = ApplicationContextUtil.getSpringBean(ProjectMemberService.class); SimpleProjectMember member = memberService.findMemberByUsername(AppContext.getUsername(), CurrentProjectVariables.getProjectId(), AppContext.getAccountId()); if (member != null) { btnRelate.setEnabled((member.getIsadmin() || (AppContext.getUsername().equals(bug.getAssignuser())) || (AppContext.getUsername().equals(bug.getLogby()))) && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)); } btnRelate.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { if (!itemField.getValue().toString().trim().equals("") && relatedBean != null && !relatedBean.getSummary().equals(bug.getSummary())) { SimpleRelatedBug relatedBug = new SimpleRelatedBug(); relatedBug.setBugid(bug.getId()); relatedBug.setRelatedid(relatedBean.getId()); relatedBug.setRelatetype((String) comboRelation.getValue()); relatedBug.setComment(txtComment.getValue().toString()); relatedBugService.saveWithSession(relatedBug, AppContext.getUsername()); SimpleRelatedBug oppositeRelation = new SimpleRelatedBug(); oppositeRelation.setBugid(relatedBean.getId()); oppositeRelation.setRelatedid(bug.getId()); oppositeRelation.setComment(txtComment.getValue().toString()); if (comboRelation.getValue().toString().equals(BugRelationConstants.PARENT)) { oppositeRelation.setRelatetype(BugRelationConstants.CHILD); } else if (comboRelation.getValue().toString().equals(BugRelationConstants.CHILD)) { oppositeRelation.setRelatetype(BugRelationConstants.PARENT); } else if (comboRelation.getValue().toString().equals(BugRelationConstants.RELATED)) { oppositeRelation.setRelatetype(BugRelationConstants.RELATED); } else if (comboRelation.getValue().toString().equals(BugRelationConstants.BEFORE)) { oppositeRelation.setRelatetype(BugRelationConstants.AFTER); } else if (comboRelation.getValue().toString().equals(BugRelationConstants.AFTER)) { oppositeRelation.setRelatetype(BugRelationConstants.BEFORE); } else if (comboRelation.getValue().toString().equals(BugRelationConstants.DUPLICATED)) { oppositeRelation.setRelatetype(BugRelationConstants.DUPLICATED); BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); bug.setStatus(BugStatus.Resolved.name()); bug.setResolution(BugResolution.Duplicate.name()); bugService.updateWithSession(bug, AppContext.getUsername()); } relatedBugService.saveWithSession(oppositeRelation, AppContext.getUsername()); setCriteria(); setItemFieldValue(""); txtComment.setValue(""); relatedBean = null; } } }); layoutAdd.addComponent(btnRelate); layoutAdd.setComponentAlignment(btnRelate, Alignment.MIDDLE_LEFT); Label lbInstruction = new Label("<strong>Relate to an existing ticket</strong>", ContentMode.HTML); mainLayout.addComponent(lbInstruction); mainLayout.addComponent(layoutAdd); HorizontalLayout layoutComment = new HorizontalLayout(); layoutComment.setSpacing(true); Label lbComment = new Label("Comment:"); lbComment.setWidth("70px"); layoutComment.addComponent(lbComment); layoutComment.setComponentAlignment(lbComment, Alignment.TOP_LEFT); txtComment = new RichTextArea(); txtComment.setHeight("130px"); txtComment.setWidth("565px"); layoutComment.addComponent(txtComment); layoutComment.setComponentAlignment(txtComment, Alignment.MIDDLE_LEFT); mainLayout.addComponent(layoutComment); tableItem = new DefaultPagedBeanTable<RelatedBugService, BugRelatedSearchCriteria, SimpleRelatedBug>( ApplicationContextUtil.getSpringBean(RelatedBugService.class), SimpleRelatedBug.class, Arrays.asList( new TableViewField(BugI18nEnum.RELATED_BUG_NAME, "bugName", UIConstants.TABLE_EX_LABEL_WIDTH), new TableViewField(BugI18nEnum.RELATED_BUG_TYPE, "relatetype", UIConstants.TABLE_S_LABEL_WIDTH), new TableViewField(BugI18nEnum.RELATED_BUG_COMMENT, "comment", UIConstants.TABLE_EX_LABEL_WIDTH), new TableViewField(null, "id", UIConstants.TABLE_CONTROL_WIDTH))); tableItem.addGeneratedColumn("bugName", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleRelatedBug relatedItem = tableItem.getBeanByIndex(itemId); String bugname = "[%s-%s] %s"; bugname = String.format(bugname, CurrentProjectVariables.getProject().getShortname(), relatedItem.getRelatedid(), relatedItem.getBugName()); BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); final SimpleBug bug = bugService.findById(relatedItem.getRelatedid(), AppContext.getAccountId()); LabelLink b = new LabelLink(bugname, ProjectLinkBuilder.generateBugPreviewFullLink(bug.getBugkey(), bug.getProjectShortName())); if (StringUtils.isNotBlank(bug.getPriority())) { String iconPriority = ProjectResources.getIconResourceLink12ByBugPriority(bug.getPriority()); b.setIconLink(iconPriority); } if (BugStatus.Verified.name().equals(bug.getStatus())) { b.addStyleName(UIConstants.LINK_COMPLETED); } else if (bug.getDuedate() != null && (bug.getDuedate().before(new GregorianCalendar().getTime()))) { b.addStyleName(UIConstants.LINK_OVERDUE); } b.setWidth("100%"); return b; } }); tableItem.addGeneratedColumn("id", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { final SimpleRelatedBug relatedItem = tableItem.getBeanByIndex(itemId); Button deleteBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { BugRelatedSearchCriteria relateBugIdCriteria = new BugRelatedSearchCriteria(); relateBugIdCriteria.setBugId(new NumberSearchField(relatedItem.getBugid())); relateBugIdCriteria.setRelatedId(new NumberSearchField(relatedItem.getRelatedid())); relatedBugService.removeByCriteria(relateBugIdCriteria, AppContext.getAccountId()); BugRelatedSearchCriteria relateIdCriteria = new BugRelatedSearchCriteria(); relateIdCriteria.setBugId(new NumberSearchField(relatedItem.getRelatedid())); relateIdCriteria.setRelatedId(new NumberSearchField(relatedItem.getBugid())); relatedBugService.removeByCriteria(relateIdCriteria, AppContext.getAccountId()); BugRelatedField.this.setCriteria(); } }); deleteBtn.setStyleName("link"); deleteBtn.setIcon(MyCollabResource.newResource("icons/16/delete.png")); relatedItem.setExtraData(deleteBtn); ProjectMemberService memberService = ApplicationContextUtil .getSpringBean(ProjectMemberService.class); SimpleProjectMember member = memberService.findMemberByUsername(AppContext.getUsername(), CurrentProjectVariables.getProjectId(), AppContext.getAccountId()); if (member != null) { deleteBtn.setEnabled( member.getIsadmin() || (AppContext.getUsername().equals(bug.getAssignuser())) || (AppContext.getUsername().equals(bug.getLogby()))); } return deleteBtn; } }); mainLayout.addComponent(tableItem); setCriteria(); this.setCompositionRoot(mainLayout); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugSelectionWindow.java
License:Open Source License
public BugSelectionWindow(BugRelatedField fieldSelection) { super("Bug Lookup"); this.setWidth("900px"); this.setHeight("500px"); this.fieldSelection = fieldSelection; this.setModal(true); this.setResizable(false); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);//from w w w . ja v a 2s .c om layout.setMargin(true); BugSimpleSearchPanel contactSimpleSearchPanel = new BugSimpleSearchPanel(); contactSimpleSearchPanel.addSearchHandler(new SearchHandler<BugSearchCriteria>() { @Override public void onSearch(BugSearchCriteria criteria) { tableItem.setSearchCriteria(criteria); } }); layout.addComponent(contactSimpleSearchPanel); createBugList(); layout.addComponent(tableItem); this.setContent(layout); }