List of usage examples for com.vaadin.ui Alignment MIDDLE_CENTER
Alignment MIDDLE_CENTER
To view the source code for com.vaadin.ui Alignment MIDDLE_CENTER.
Click Source Link
From source file:com.esofthead.mycollab.module.crm.view.contact.ContactSimpleSearchPanel.java
License:Open Source License
private void createBasicSearchLayout() { layoutSearchPane = new GridLayout(3, 3); layoutSearchPane.setSpacing(true);/*w w w . j a v a 2 s. c om*/ final ValueComboBox group = new ValueComboBox(false, "Name", "Email", "Phone", AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE)); group.select("Name"); group.setImmediate(true); group.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { removeComponents(); String searchType = (String) group.getValue(); if (searchType.equals("Name")) { addTextFieldSearch(); } else if (searchType.equals("Email")) { addTextFieldSearch(); } else if (searchType.equals("Phone")) { addTextFieldSearch(); } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) { addUserListSelectField(); } } }); layoutSearchPane.addComponent(group, 1, 0); layoutSearchPane.setComponentAlignment(group, Alignment.MIDDLE_CENTER); addTextFieldSearch(); Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH)); searchBtn.setStyleName(UIConstants.THEME_GREEN_LINK); searchBtn.setIcon(FontAwesome.SEARCH); searchBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { searchCriteria = new ContactSearchCriteria(); searchCriteria.setSaccountid(new NumberSearchField(SearchField.AND, AppContext.getAccountId())); String searchType = (String) group.getValue(); if (StringUtils.isNotBlank(searchType)) { if (textValueField != null) { String strSearch = textValueField.getValue(); if (StringUtils.isNotBlank(strSearch)) { if (searchType.equals("Name")) { searchCriteria.setContactName(new StringSearchField(SearchField.AND, strSearch)); } else if (searchType.equals("Email")) { searchCriteria.setAnyEmail(new StringSearchField(SearchField.AND, strSearch)); } else if (searchType.equals("Phone")) { searchCriteria.setAnyPhone(new StringSearchField(SearchField.AND, strSearch)); } } } if (userBox != null) { String user = (String) userBox.getValue(); if (StringUtils.isNotBlank(user)) { searchCriteria.setAssignUsers( new SetSearchField<String>(SearchField.AND, new String[] { user })); } } } ContactSimpleSearchPanel.this.notifySearchHandler(searchCriteria); } }); layoutSearchPane.addComponent(searchBtn, 2, 0); layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER); this.setCompositionRoot(layoutSearchPane); }
From source file:com.esofthead.mycollab.module.crm.view.CrmModule.java
License:Open Source License
public CrmModule() { this.setStyleName("crm-module"); ControllerRegistry.addController(new CrmController(this)); container = new MVerticalLayout().withWidth("100%").withSpacing(false).withMargin(false) .withStyleName("crmContainer"); CrmToolbar toolbar = ViewManager.getCacheComponent(CrmToolbar.class); container.addComponent(toolbar);/* www .ja v a 2s . c om*/ this.addComponent(container); this.setComponentAlignment(container, Alignment.MIDDLE_CENTER); }
From source file:com.esofthead.mycollab.module.crm.view.lead.LeadConvertInfoWindow.java
License:Open Source License
public Layout initContent() { CssLayout contentLayout = new CssLayout(); contentLayout.setWidth("100%"); contentLayout.setStyleName("lead-convert-window"); contentLayout.addComponent(createBody()); ComponentContainer buttonControls = createButtonControls(); if (buttonControls != null) { final HorizontalLayout controlPanel = new HorizontalLayout(); buttonControls.setSizeUndefined(); controlPanel.addComponent(buttonControls); controlPanel.setWidth("100%"); controlPanel.setMargin(true);/*from w ww . j a va 2s. c om*/ controlPanel.setComponentAlignment(buttonControls, Alignment.MIDDLE_CENTER); contentLayout.addComponent(controlPanel); } return contentLayout; }
From source file:com.esofthead.mycollab.module.crm.view.lead.LeadConvertInfoWindow.java
License:Open Source License
private ComponentContainer createButtonControls() { final HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);/*from w ww .ja va 2s. c o m*/ layout.setStyleName("addNewControl"); Button convertButton = new Button(AppContext.getMessage(LeadI18nEnum.BUTTON_CONVERT_LEAD), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { LeadService leadService = ApplicationContextUtil.getSpringBean(LeadService.class); lead.setStatus("Converted"); leadService.updateWithSession(lead, AppContext.getUsername()); Opportunity opportunity = null; if (opportunityForm != null && opportunityForm.isVisible()) { if (opportunityForm.validateForm()) { opportunity = opportunityForm.getBean(); } } leadService.convertLead(lead, opportunity, AppContext.getUsername()); LeadConvertInfoWindow.this.close(); EventBusFactory.getInstance() .post(new LeadEvent.GotoRead(LeadConvertInfoWindow.this, lead.getId())); } }); convertButton.setStyleName(UIConstants.THEME_GREEN_LINK); layout.addComponent(convertButton); layout.setComponentAlignment(convertButton, Alignment.MIDDLE_CENTER); Button cancelButton = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { LeadConvertInfoWindow.this.close(); } }); cancelButton.setStyleName(UIConstants.THEME_GRAY_LINK); layout.addComponent(cancelButton); layout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER); return layout; }
From source file:com.esofthead.mycollab.module.crm.view.lead.LeadSimpleSearchPanel.java
License:Open Source License
private void createBasicSearchLayout() { layoutSearchPane = new GridLayout(3, 3); layoutSearchPane.setSpacing(true);/* w w w.j a va2 s.c o m*/ final ValueComboBox group = new ValueComboBox(false, "Name", "Email", "Phone", AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE)); group.select("Name"); group.setImmediate(true); group.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { removeComponents(); String searchType = (String) group.getValue(); if (searchType.equals("Name")) { addTextFieldSearch(); } else if (searchType.equals("Email")) { addTextFieldSearch(); } else if (searchType.equals("Phone")) { addTextFieldSearch(); } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) { addUserListSelectField(); } } }); layoutSearchPane.addComponent(group, 1, 0); layoutSearchPane.setComponentAlignment(group, Alignment.MIDDLE_CENTER); addTextFieldSearch(); Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH)); searchBtn.setStyleName(UIConstants.THEME_GREEN_LINK); searchBtn.setIcon(FontAwesome.SEARCH); searchBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { searchCriteria = new LeadSearchCriteria(); searchCriteria.setSaccountid(new NumberSearchField(SearchField.AND, AppContext.getAccountId())); String searchType = (String) group.getValue(); if (StringUtils.isNotBlank(searchType)) { if (textValueField != null) { String strSearch = textValueField.getValue(); if (StringUtils.isNotBlank(strSearch)) { if (searchType.equals("Name")) { searchCriteria.setLeadName(new StringSearchField(SearchField.AND, strSearch)); } } } if (userBox != null) { String user = (String) userBox.getValue(); if (StringUtils.isNotBlank(user)) { searchCriteria .setAssignUsers(new SetSearchField<>(SearchField.AND, new String[] { user })); } } } LeadSimpleSearchPanel.this.notifySearchHandler(searchCriteria); } }); layoutSearchPane.addComponent(searchBtn, 2, 0); layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER); this.setCompositionRoot(layoutSearchPane); }
From source file:com.esofthead.mycollab.module.crm.view.opportunity.ContactRoleEditViewImpl.java
License:Open Source License
private ComponentContainer createButtonControls() { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);//from w w w . j ava2 s .c o m layout.setMargin(true); HorizontalLayout buttonWrapper = new HorizontalLayout(); buttonWrapper.setWidthUndefined(); buttonWrapper.setSpacing(true); Button updateBtn = new Button("Update", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { updateContactRoles(); } }); updateBtn.setIcon(FontAwesome.SAVE); updateBtn.setStyleName(UIConstants.THEME_GREEN_LINK); buttonWrapper.addComponent(updateBtn); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ViewState viewState = HistoryViewManager.back(); if (viewState instanceof NullViewState) { EventBusFactory.getInstance().post(new ContactEvent.GotoList(this, null)); } } }); cancelBtn.setIcon(FontAwesome.TIMES); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); buttonWrapper.addComponent(cancelBtn); layout.addComponent(buttonWrapper); layout.setComponentAlignment(buttonWrapper, Alignment.MIDDLE_CENTER); return layout; }
From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunitySimpleSearchPanel.java
License:Open Source License
private void createBasicSearchLayout() { layoutSearchPane = new GridLayout(3, 3); layoutSearchPane.setSpacing(true);/*w ww.j a v a 2 s. c o m*/ final ValueComboBox group = new ValueComboBox(false, "Name", "Account Name", "Sales Stage", AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE)); group.select("Name"); group.setImmediate(true); group.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { removeComponents(); String searchType = (String) group.getValue(); if (searchType.equals("Name")) { addTextFieldSearch(); } else if (searchType.equals("Account Name")) { addTextFieldSearch(); } else if (searchType.equals("Sales Stage")) { addTextFieldSearch(); } else if (searchType.equals(AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE))) { addUserListSelectField(); } } }); layoutSearchPane.addComponent(group, 1, 0); layoutSearchPane.setComponentAlignment(group, Alignment.MIDDLE_CENTER); addTextFieldSearch(); Button searchBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SEARCH)); searchBtn.setStyleName(UIConstants.THEME_GREEN_LINK); searchBtn.setIcon(FontAwesome.SEARCH); searchBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { searchCriteria = new OpportunitySearchCriteria(); searchCriteria.setSaccountid(new NumberSearchField(SearchField.AND, AppContext.getAccountId())); String searchType = (String) group.getValue(); if (StringUtils.isNotBlank(searchType)) { if (textValueField != null) { String strSearch = textValueField.getValue(); if (StringUtils.isNotBlank(strSearch)) { if (searchType.equals("Name")) { searchCriteria .setOpportunityName(new StringSearchField(SearchField.AND, strSearch)); } } } if (userBox != null) { String user = (String) userBox.getValue(); if (StringUtils.isNotBlank(user)) { searchCriteria.setAssignUsers( new SetSearchField<String>(SearchField.AND, new String[] { user })); } } } OpportunitySimpleSearchPanel.this.notifySearchHandler(searchCriteria); } }); layoutSearchPane.addComponent(searchBtn, 2, 0); layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER); this.setCompositionRoot(layoutSearchPane); }
From source file:com.esofthead.mycollab.module.crm.view.SalesDashboardView.java
License:Open Source License
public void displayReport() { final String reportName = this.reportDashboard[this.currentReportIndex]; final VerticalLayout bodyContent = (VerticalLayout) this.bodyContent; bodyContent.removeAllComponents();/*from w w w. j ava 2 s .c om*/ bodyContent.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); if ("OpportunitySalesStage".equals(reportName)) { this.setTitle("Opportunity Sales Stage"); final IOpportunitySalesStageDashboard salesStageDashboard = ViewManager .getCacheComponent(IOpportunitySalesStageDashboard.class); bodyContent.addComponent(salesStageDashboard); final OpportunitySearchCriteria criteria = new OpportunitySearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); salesStageDashboard.setSearchCriteria(criteria); } else if ("OpportunityLeadSource".equals(reportName)) { this.setTitle("Opportunity Lead Source"); final IOpportunityLeadSourceDashboard leadSourceDashboard = ViewManager .getCacheComponent(IOpportunityLeadSourceDashboard.class); bodyContent.addComponent(leadSourceDashboard); final OpportunitySearchCriteria criteria = new OpportunitySearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); leadSourceDashboard.setSearchCriteria(criteria); } }
From source file:com.esofthead.mycollab.module.file.view.components.AbstractResourceMovingWindow.java
License:Open Source License
private void constructBody() { MVerticalLayout contentLayout = new MVerticalLayout().withSpacing(true).withMargin(true); this.setContent(contentLayout); final HorizontalLayout resourceContainer = new HorizontalLayout(); resourceContainer.setSizeFull();/*from ww w.ja v a2 s . c o m*/ this.folderTree = new TreeTable(); this.folderTree.setMultiSelect(false); this.folderTree.setSelectable(true); this.folderTree.setImmediate(true); this.folderTree.addContainerProperty("Name", String.class, ""); this.folderTree.addContainerProperty("Date Modified", String.class, ""); this.folderTree.setColumnWidth("Date Modified", UIConstants.TABLE_DATE_TIME_WIDTH); this.folderTree.setColumnExpandRatio("Name", 1.0f); this.folderTree.setWidth("100%"); resourceContainer.addComponent(this.folderTree); this.folderTree.addExpandListener(new Tree.ExpandListener() { private static final long serialVersionUID = 1L; @Override public void nodeExpand(final ExpandEvent event) { final Folder expandFolder = (Folder) event.getItemId(); // load externalResource if currentExpandFolder is // rootFolder if (rootPath.equals(expandFolder.getPath())) { List<ExternalDrive> externalDrives = externalDriveService .getExternalDrivesOfUser(AppContext.getUsername()); for (ExternalDrive externalDrive : externalDrives) { ExternalFolder externalMapFolder = new ExternalFolder("/"); externalMapFolder.setStorageName(externalDrive.getStoragename()); externalMapFolder.setExternalDrive(externalDrive); externalMapFolder.setName(externalDrive.getFoldername()); Calendar cal = GregorianCalendar.getInstance(); cal.setTime(externalDrive.getCreatedtime()); externalMapFolder.setCreated(cal); expandFolder.addChild(externalMapFolder); AbstractResourceMovingWindow.this.folderTree .addItem( new Object[] { externalMapFolder.getName(), AppContext .formatDateTime(externalMapFolder.getCreated().getTime()) }, externalMapFolder); AbstractResourceMovingWindow.this.folderTree.setItemIcon(externalMapFolder, MyCollabResource.newResource("icons/16/ecm/dropbox.png")); AbstractResourceMovingWindow.this.folderTree.setItemCaption(externalMapFolder, externalMapFolder.getName()); AbstractResourceMovingWindow.this.folderTree.setParent(externalMapFolder, expandFolder); } } if (expandFolder instanceof ExternalFolder) { List<ExternalFolder> subFolders = externalResourceService.getSubFolders( ((ExternalFolder) expandFolder).getExternalDrive(), expandFolder.getPath()); for (final Folder subFolder : subFolders) { expandFolder.addChild(subFolder); Date dateTime = ((ExternalFolder) subFolder).getExternalDrive().getCreatedtime(); AbstractResourceMovingWindow.this.folderTree.addItem( new Object[] { subFolder.getName(), AppContext.formatDateTime(dateTime) }, subFolder); AbstractResourceMovingWindow.this.folderTree.setItemIcon(subFolder, MyCollabResource.newResource("icons/16/ecm/dropbox_subfolder.png")); AbstractResourceMovingWindow.this.folderTree.setItemCaption(subFolder, subFolder.getName()); AbstractResourceMovingWindow.this.folderTree.setParent(subFolder, expandFolder); } } else { final List<Folder> subFolders = AbstractResourceMovingWindow.this.resourceService .getSubFolders(expandFolder.getPath()); AbstractResourceMovingWindow.this.folderTree.setItemIcon(expandFolder, MyCollabResource.newResource("icons/16/ecm/folder_open.png")); if (subFolders != null) { for (final Folder subFolder : subFolders) { expandFolder.addChild(subFolder); AbstractResourceMovingWindow.this.folderTree.addItem( new Object[] { subFolder.getName(), AppContext.formatDateTime(subFolder.getCreated().getTime()) }, subFolder); AbstractResourceMovingWindow.this.folderTree.setItemIcon(subFolder, MyCollabResource.newResource("icons/16/ecm/folder_close.png")); AbstractResourceMovingWindow.this.folderTree.setItemCaption(subFolder, subFolder.getName()); AbstractResourceMovingWindow.this.folderTree.setParent(subFolder, expandFolder); } } } } }); this.folderTree.addCollapseListener(new Tree.CollapseListener() { private static final long serialVersionUID = 1L; @Override public void nodeCollapse(final CollapseEvent event) { final Folder collapseFolder = (Folder) event.getItemId(); if (collapseFolder instanceof ExternalFolder) { if (collapseFolder.getPath().equals("/")) AbstractResourceMovingWindow.this.folderTree.setItemIcon(collapseFolder, MyCollabResource.newResource("icons/16/ecm/dropbox.png")); else AbstractResourceMovingWindow.this.folderTree.setItemIcon(collapseFolder, MyCollabResource.newResource("icons/16/ecm/dropbox_subfolder.png")); } else { AbstractResourceMovingWindow.this.folderTree.setItemIcon(collapseFolder, MyCollabResource.newResource("icons/16/ecm/folder_close.png")); } for (Folder folder : collapseFolder.getChilds()) { recursiveRemoveSubItem(folder); } } private void recursiveRemoveSubItem(Folder collapseFolder) { List<Folder> childs = collapseFolder.getChilds(); if (childs.size() > 0) { for (final Folder subFolder : childs) { recursiveRemoveSubItem(subFolder); } AbstractResourceMovingWindow.this.folderTree.removeItem(collapseFolder); } else { AbstractResourceMovingWindow.this.folderTree.removeItem(collapseFolder); } } }); this.folderTree.addItemClickListener(new ItemClickEvent.ItemClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(final ItemClickEvent event) { AbstractResourceMovingWindow.this.baseFolder = (Folder) event.getItemId(); } }); contentLayout.addComponent(resourceContainer); displayFiles(); HorizontalLayout controlGroupBtnLayout = new HorizontalLayout(); controlGroupBtnLayout.setSpacing(true); Button moveBtn = new Button("Move", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (resourceEditting != null) { try { resourceMover.moveResource(resourceEditting, baseFolder, AppContext.getUsername(), AppContext.getAccountId()); displayAfterMoveSuccess(AbstractResourceMovingWindow.this.baseFolder, false); } finally { AbstractResourceMovingWindow.this.close(); } } else if (!CollectionUtils.isEmpty(lstResEditting)) { boolean checkingFail = false; for (Resource res : lstResEditting) { try { resourceMover.moveResource(res, baseFolder, AppContext.getUsername(), AppContext.getAccountId()); } catch (Exception e) { checkingFail = true; } } AbstractResourceMovingWindow.this.close(); displayAfterMoveSuccess(AbstractResourceMovingWindow.this.baseFolder, checkingFail); } } }); moveBtn.addStyleName(UIConstants.THEME_GREEN_LINK); controlGroupBtnLayout.addComponent(moveBtn); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { AbstractResourceMovingWindow.this.close(); } }); cancelBtn.addStyleName(UIConstants.THEME_GRAY_LINK); controlGroupBtnLayout.addComponent(cancelBtn); contentLayout.with(controlGroupBtnLayout).withAlign(controlGroupBtnLayout, Alignment.MIDDLE_CENTER); }
From source file:com.esofthead.mycollab.module.file.view.components.FileDownloadWindow.java
License:Open Source License
private void constructBody() { final MVerticalLayout layout = new MVerticalLayout(); final Embedded iconEmbed = new Embedded(); iconEmbed.setSource(MyCollabResource.newResource("icons/page_white.png")); layout.with(iconEmbed).withAlign(iconEmbed, Alignment.MIDDLE_CENTER); final GridFormLayoutHelper info = new GridFormLayoutHelper(1, 4, "100%", "80px", Alignment.TOP_LEFT); info.getLayout().setWidth("100%"); info.getLayout().setMargin(new MarginInfo(false, true, false, true)); info.getLayout().setSpacing(false);// w w w.j a v a 2 s. c o m if (this.content.getDescription() != null) { final Label desvalue = new Label(); if (!this.content.getDescription().equals("")) { desvalue.setData(this.content.getDescription()); } else { desvalue.setValue(" "); desvalue.setContentMode(ContentMode.HTML); } info.addComponent(desvalue, "Description", 0, 0); } final Label author = new Label(this.content.getCreatedBy()); info.addComponent(author, "Created by", 0, 1); final Label size = new Label(ResourceUtils.getVolumeDisplay(this.content.getSize())); info.addComponent(size, "Size", 0, 2); final Label dateCreate = new Label(AppContext.formatDate(this.content.getCreated().getTime())); info.addComponent(dateCreate, "Date created", 0, 3); layout.addComponent(info.getLayout()); final MHorizontalLayout buttonControls = new MHorizontalLayout(); buttonControls.setSpacing(true); buttonControls.setMargin(new MarginInfo(true, false, true, false)); final Button downloadBtn = new Button("Download"); List<Resource> resources = new ArrayList<Resource>(); resources.add(content); StreamResource downloadResource = StreamDownloadResourceUtil.getStreamResourceSupportExtDrive(resources); FileDownloader fileDownloader = new FileDownloader(downloadResource); fileDownloader.extend(downloadBtn); downloadBtn.addStyleName(UIConstants.THEME_GREEN_LINK); buttonControls.with(downloadBtn).withAlign(downloadBtn, Alignment.MIDDLE_CENTER); final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { FileDownloadWindow.this.close(); } }); cancelBtn.addStyleName(UIConstants.THEME_GRAY_LINK); buttonControls.with(cancelBtn).withAlign(cancelBtn, Alignment.MIDDLE_CENTER); layout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_CENTER); this.setContent(layout); }