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.mobile.module.project.ui.TimeLogEditView.java
License:Open Source License
private void initUI() { headerPanel = new HorizontalLayout(); headerPanel.setWidth("100%"); headerPanel.setStyleName("summary-info-panel"); headerPanel.setMargin(new MarginInfo(true, false, true, false)); headerPanel.setHeightUndefined();// w w w . jav a 2 s . c o m content.addComponent(headerPanel); constructSpentTimeEntryPanel(); constructRemainTimeEntryPanel(); this.tableItem = new DefaultPagedBeanList<ItemTimeLoggingService, ItemTimeLoggingSearchCriteria, SimpleItemTimeLogging>( ApplicationContextUtil.getSpringBean(ItemTimeLoggingService.class), new TimeLogRowHandler()) { private static final long serialVersionUID = -4549910960891655297L; @Override protected void renderRows() { int i = 0; Date currentDate = new GregorianCalendar(2100, 1, 1).getTime(); for (final SimpleItemTimeLogging item : currentListData) { if (!DateUtils.isSameDay(item.getLogforday(), currentDate)) { Label dateLbl = new Label(AppContext.formatDate(item.getLogforday())); dateLbl.setStyleName("log-day"); listContainer.addComponent(dateLbl); currentDate = item.getLogforday(); } final Component row = getRowDisplayHandler().generateRow(item, i); listContainer.addComponent(row); i++; } } }; this.tableItem.setWidth("100%"); content.addComponent(tableItem); content.setExpandRatio(tableItem, 1.0f); VerticalLayout controlBtns = new VerticalLayout(); controlBtns.setSpacing(true); controlBtns.setWidth("100%"); controlBtns.setMargin(true); controlBtns.addStyleName("edit-btn-layout"); controlBtns.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); Button addNewEntryBtn = new Button(AppContext.getMessage(TimeTrackingI18nEnum.M_DIALOG_ADD_TIME_LOG_ENTRY), new Button.ClickListener() { private static final long serialVersionUID = -2540265040691537699L; @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new NewTimeLogEntryWindow()); } }); addNewEntryBtn.setWidth("100%"); controlBtns.addComponent(addNewEntryBtn); Button updateRemainTimeBtn = new Button( AppContext.getMessage(TimeTrackingI18nEnum.M_DIALOG_UPDATE_REMAIN_HOURS), new Button.ClickListener() { private static final long serialVersionUID = 9215577509351959739L; @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new UpdateRemainTimeWindow()); } }); updateRemainTimeBtn.setWidth("100%"); controlBtns.addComponent(updateRemainTimeBtn); NavigationBarQuickMenu editBtn = new NavigationBarQuickMenu(); editBtn.setButtonCaption(null); editBtn.setStyleName("edit-btn"); editBtn.setContent(controlBtns); this.setRightComponent(editBtn); }
From source file:com.esofthead.mycollab.mobile.mvp.view.NotPresenterView.java
License:Open Source License
void display() { setContent(new MVerticalLayout().withFullWidth() .with(new MVerticalLayout(new ELabel(FontAwesome.WARNING.getHtml(), ContentMode.HTML), new ELabel("This feature is currently not available in your MyCollab instance", ContentMode.HTML).withStyleName(UIConstants.LABEL_H3)) .alignAll(Alignment.MIDDLE_CENTER))); }
From source file:com.esofthead.mycollab.mobile.ui.ConfirmDialog.java
License:Open Source License
private void constructUI(final String message, final String okCaption, final String cancelCaption) { VerticalLayout layout = new VerticalLayout(); layout.setWidth("100%"); layout.setHeightUndefined();//w w w . j ava2 s . co m layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); VerticalLayout messageWrapper = new VerticalLayout(); messageWrapper.setStyleName("message-wrapper"); messageWrapper.setWidth("100%"); messageWrapper.setMargin(true); final Label messageDisplay = new Label(message); messageDisplay.setWidth("100%"); messageWrapper.addComponent(messageDisplay); layout.addComponent(messageWrapper); HorizontalLayout controlBtn = new HorizontalLayout(); controlBtn.setWidth("100%"); final Button okBtn = new Button(okCaption); okBtn.setWidth("100%"); okBtn.setHeight("35px"); final Button cancelBtn = new Button(cancelCaption); cancelBtn.setWidth("100%"); cancelBtn.setHeight("35px"); Button.ClickListener listener = new Button.ClickListener() { private static final long serialVersionUID = -8306231710367659086L; @Override public void buttonClick(ClickEvent event) { ConfirmDialog.this.setConfirmed(event.getButton() == okBtn); if (ConfirmDialog.this.getListener() != null) { ConfirmDialog.this.getListener().onClose(ConfirmDialog.this); } ConfirmDialog.this.close(); } }; okBtn.addClickListener(listener); cancelBtn.addClickListener(listener); controlBtn.addComponent(cancelBtn); controlBtn.addComponent(okBtn); layout.addComponent(controlBtn); this.setContent(layout); }
From source file:com.esofthead.mycollab.module.crm.view.account.AccountSimpleSearchPanel.java
License:Open Source License
private void createBasicSearchLayout() { layoutSearchPane = new GridLayout(3, 3); layoutSearchPane.setSpacing(true);//from www . j ava 2 s . c o m final ValueComboBox group = new ValueComboBox(false, "Name", "Email", "Website", "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("Website")) { 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.setDescription("Search"); searchBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { searchCriteria = new AccountSearchCriteria(); 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.setAccountname(new StringSearchField(SearchField.AND, strSearch)); } else if (searchType.equals("Email")) { searchCriteria.setAnyMail(new StringSearchField(SearchField.AND, strSearch)); } else if (searchType.equals("Website")) { searchCriteria.setWebsite(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<>(SearchField.AND, new String[] { user })); } } } AccountSimpleSearchPanel.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.account.AccountSimpleSearchPanel.java
License:Open Source License
private void addTextFieldSearch() { textValueField = new TextField(); layoutSearchPane.addComponent(textValueField, 0, 0); layoutSearchPane.setComponentAlignment(textValueField, Alignment.MIDDLE_CENTER); }
From source file:com.esofthead.mycollab.module.crm.view.account.AccountSimpleSearchPanel.java
License:Open Source License
private void addUserListSelectField() { userBox = new ActiveUserComboBox(); userBox.setImmediate(true);//from w ww .ja v a2s.c o m layoutSearchPane.addComponent(userBox, 0, 0); layoutSearchPane.setComponentAlignment(userBox, Alignment.MIDDLE_CENTER); }
From source file:com.esofthead.mycollab.module.crm.view.activity.ActivityCalendarViewImpl.java
License:Open Source License
private void initContent() { MHorizontalLayout contentWrapper = new MHorizontalLayout().withSpacing(false).withWidth("100%"); this.addComponent(contentWrapper); /* Content cheat */ MVerticalLayout mainContent = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, true)) .withWidth("100%").withStyleName("readview-layout"); contentWrapper.with(mainContent).expand(mainContent); MVerticalLayout rightColumn = new MVerticalLayout().withMargin(new MarginInfo(true, false, true, false)) .withWidth("250px"); rightColumn.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); contentWrapper.addComponent(rightColumn); MHorizontalLayout actionPanel = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)) .withWidth("100%").withStyleName(UIConstants.HEADER_VIEW); actionPanel.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label headerText = new CrmViewHeader(CrmTypeConstants.ACTIVITY, "Calendar"); headerText.setStyleName(UIConstants.HEADER_TEXT); actionPanel.with(headerText).expand(headerText); mainContent.addComponent(actionPanel); this.dateHdr = new Label(); this.dateHdr.setSizeUndefined(); this.dateHdr.setStyleName("h2"); mainContent.addComponent(this.dateHdr); mainContent.setComponentAlignment(this.dateHdr, Alignment.MIDDLE_CENTER); toggleViewBtn = new PopupButton("Monthly"); toggleViewBtn.setWidth("200px"); toggleViewBtn.addStyleName("calendar-view-switcher"); MVerticalLayout popupLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, true)) .withWidth("190px"); monthViewBtn = new Button("Monthly", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*w w w .j a v a 2 s. c o m*/ public void buttonClick(ClickEvent event) { toggleViewBtn.setPopupVisible(false); toggleViewBtn.setCaption(monthViewBtn.getCaption()); calendarComponent.switchToMonthView(new Date(), true); datePicker.selectDate(new Date()); monthViewBtn.addStyleName("selected-style"); initLabelCaption(); } }); monthViewBtn.setStyleName("link"); popupLayout.addComponent(monthViewBtn); weekViewBtn = new Button("Weekly", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { toggleViewBtn.setPopupVisible(false); toggleViewBtn.setCaption(weekViewBtn.getCaption()); calendarComponent.switchToWeekView(new Date()); datePicker.selectWeek(new Date()); } }); weekViewBtn.setStyleName("link"); popupLayout.addComponent(weekViewBtn); dailyViewBtn = new Button("Daily", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { toggleViewBtn.setPopupVisible(false); toggleViewBtn.setCaption(dailyViewBtn.getCaption()); Date currentDate = new Date(); datePicker.selectDate(currentDate); calendarComponent.switchToDateView(currentDate); } }); dailyViewBtn.setStyleName("link"); popupLayout.addComponent(dailyViewBtn); toggleViewBtn.setContent(popupLayout); CssLayout toggleBtnWrap = new CssLayout(); toggleBtnWrap.setStyleName("switcher-wrap"); toggleBtnWrap.addComponent(toggleViewBtn); rightColumn.addComponent(toggleBtnWrap); rightColumn.setComponentAlignment(toggleBtnWrap, Alignment.MIDDLE_CENTER); rightColumn.addComponent(this.datePicker); initLabelCaption(); addCalendarEvent(); actionPanel.addComponent(calendarActionBtn); actionPanel.setComponentAlignment(calendarActionBtn, Alignment.MIDDLE_RIGHT); VerticalLayout actionBtnLayout = new VerticalLayout(); actionBtnLayout.setMargin(true); actionBtnLayout.setSpacing(true); actionBtnLayout.setWidth("150px"); Button.ClickListener listener = new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { calendarActionBtn.setPopupVisible(false); String caption = event.getButton().getCaption(); if (caption.equals("New Task")) { EventBusFactory.getInstance().post(new ActivityEvent.TaskAdd(this, null)); } else if (caption.equals("New Call")) { EventBusFactory.getInstance().post(new ActivityEvent.CallAdd(this, null)); } else if (caption.equals("New Event")) { EventBusFactory.getInstance().post(new ActivityEvent.MeetingAdd(this, null)); } } }; ButtonLink todoBtn = new ButtonLink("New Task", listener); actionBtnLayout.addComponent(todoBtn); todoBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.TASK)); todoBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_TASK)); Button callBtn = new ButtonLink("New Call", listener); actionBtnLayout.addComponent(callBtn); callBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CALL)); callBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CALL)); ButtonLink meetingBtn = new ButtonLink("New Meeting", listener); actionBtnLayout.addComponent(meetingBtn); meetingBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.MEETING)); meetingBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_MEETING)); calendarActionBtn.setContent(actionBtnLayout); ButtonGroup viewSwitcher = new ButtonGroup(); Button calendarViewBtn = new Button("Calendar"); calendarViewBtn.setStyleName("selected"); calendarViewBtn.addStyleName(UIConstants.THEME_GREEN_LINK); viewSwitcher.addButton(calendarViewBtn); Button activityListBtn = new Button("Activities", new Button.ClickListener() { private static final long serialVersionUID = 2156576556541398934L; @Override public void buttonClick(ClickEvent evt) { ActivitySearchCriteria criteria = new ActivitySearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); EventBusFactory.getInstance().post(new ActivityEvent.GotoTodoList(this, null)); } }); activityListBtn.addStyleName(UIConstants.THEME_GREEN_LINK); viewSwitcher.addButton(activityListBtn); actionPanel.addComponent(viewSwitcher); actionPanel.setComponentAlignment(viewSwitcher, Alignment.MIDDLE_RIGHT); calendarComponent = new CalendarDisplay(); mainContent.addComponent(calendarComponent); mainContent.setExpandRatio(calendarComponent, 1); mainContent.setComponentAlignment(calendarComponent, Alignment.MIDDLE_CENTER); HorizontalLayout spacing = new HorizontalLayout(); spacing.setHeight("30px"); mainContent.addComponent(spacing); HorizontalLayout noteInfoLayout = new HorizontalLayout(); noteInfoLayout.setSpacing(true); HorizontalLayout noteWapper = new HorizontalLayout(); noteWapper.setHeight("30px"); Label noteLbl = new Label("Note:"); noteWapper.addComponent(noteLbl); noteWapper.setComponentAlignment(noteLbl, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(noteWapper); HorizontalLayout completeWapper = new HorizontalLayout(); completeWapper.setWidth("100px"); completeWapper.setHeight("30px"); completeWapper.addStyleName("eventLblcompleted"); Label completeLabel = new Label("Completed"); completeWapper.addComponent(completeLabel); completeWapper.setComponentAlignment(completeLabel, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(completeWapper); HorizontalLayout overdueWapper = new HorizontalLayout(); overdueWapper.setWidth("100px"); overdueWapper.setHeight("30px"); overdueWapper.addStyleName("eventLbloverdue"); Label overdueLabel = new Label("Overdue"); overdueWapper.addComponent(overdueLabel); overdueWapper.setComponentAlignment(overdueLabel, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(overdueWapper); HorizontalLayout futureWapper = new HorizontalLayout(); futureWapper.setWidth("100px"); futureWapper.setHeight("30px"); futureWapper.addStyleName("eventLblfuture"); Label futureLabel = new Label("Future"); futureWapper.addComponent(futureLabel); futureWapper.setComponentAlignment(futureLabel, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(futureWapper); mainContent.addComponent(noteInfoLayout); mainContent.setComponentAlignment(noteInfoLayout, Alignment.MIDDLE_CENTER); }
From source file:com.esofthead.mycollab.module.crm.view.campaign.CampaignSimpleSearchPanel.java
License:Open Source License
private void createBasicSearchLayout() { layoutSearchPane = new GridLayout(3, 2); layoutSearchPane.setSpacing(true);/*from w ww .j av a 2 s . co m*/ final ValueComboBox group = new ValueComboBox(false, "Campaign Name", "Start Date", "End Date"); group.select("Campaign Name"); group.setImmediate(true); group.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { removeComponents(); String searchType = (String) group.getValue(); if (searchType.equals("Campaign Name")) { addTextFieldSearch(); } else if (searchType.equals("Start Date")) { addDateFieldSearch(); } else if (searchType.equals("End Date")) { addDateFieldSearch(); } } }); 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 CampaignSearchCriteria(); 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("Campaign Name")) { searchCriteria.setCampaignName(new StringSearchField(SearchField.AND, strSearch)); } else if (searchType.equals("Email")) { } else if (searchType.equals("Phone")) { } } } } CampaignSimpleSearchPanel.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.campaign.CampaignSimpleSearchPanel.java
License:Open Source License
private void addDateFieldSearch() { dateSearchField = new DateSelectionField(); dateSearchField.setDateFormat(AppContext.getUserDateFormat()); layoutSearchPane.addComponent(dateSearchField, 0, 0); layoutSearchPane.setComponentAlignment(dateSearchField, Alignment.MIDDLE_CENTER); }
From source file:com.esofthead.mycollab.module.crm.view.cases.CaseSimpleSearchPanel.java
License:Open Source License
private void createBasicSearchLayout() { layoutSearchPane = new GridLayout(3, 3); layoutSearchPane.setSpacing(true);//from w w w . j a va 2 s .c o m final ValueComboBox group = new ValueComboBox(false, "Subject", "Account Name", "Status", 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("Subject")) { addTextFieldSearch(); } else if (searchType.equals("Account Name")) { addTextFieldSearch(); } else if (searchType.equals("Status")) { 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 CaseSearchCriteria(); 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("Subject")) { searchCriteria.setSubject(new StringSearchField(SearchField.AND, strSearch)); } else if (searchType.equals("Status")) { searchCriteria.setStatuses( new SetSearchField<String>(SearchField.AND, new String[] { strSearch })); } } } if (userBox != null) { String user = (String) userBox.getValue(); if (StringUtils.isNotBlank(user)) { searchCriteria.setAssignUsers( new SetSearchField<String>(SearchField.AND, new String[] { user })); } } } CaseSimpleSearchPanel.this.notifySearchHandler(searchCriteria); } }); layoutSearchPane.addComponent(searchBtn, 2, 0); layoutSearchPane.setComponentAlignment(searchBtn, Alignment.MIDDLE_CENTER); this.setCompositionRoot(layoutSearchPane); }