List of usage examples for com.vaadin.ui Alignment MIDDLE_RIGHT
Alignment MIDDLE_RIGHT
To view the source code for com.vaadin.ui Alignment MIDDLE_RIGHT.
Click Source Link
From source file:com.mycollab.module.project.view.milestone.MilestoneAddWindow.java
License:Open Source License
public MilestoneAddWindow(final SimpleMilestone milestone) { if (milestone.getId() == null) { setCaption(UserUIContext.getMessage(MilestoneI18nEnum.NEW)); } else {//from w w w. j a va2 s .co m setCaption(UserUIContext.getMessage(MilestoneI18nEnum.SINGLE) + ": " + milestone.getName()); } VerticalLayout content = new VerticalLayout(); withWidth("800px").withModal(true).withResizable(false).withContent(content).withCenter(); final AdvancedEditBeanForm<SimpleMilestone> editForm = new AdvancedEditBeanForm<>(); content.addComponent(editForm); editForm.setFormLayoutFactory(new DefaultDynaFormLayout(ProjectTypeConstants.MILESTONE, MilestoneDefaultFormLayoutFactory.getForm(), Milestone.Field.id.name())); final MilestoneEditFormFieldFactory milestoneEditFormFieldFactory = new MilestoneEditFormFieldFactory( editForm); editForm.setBeanFormFieldFactory(milestoneEditFormFieldFactory); editForm.setBean(milestone); MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> { if (editForm.validateForm()) { MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class); Integer milestoneId; if (milestone.getId() == null) { milestoneId = milestoneService.saveWithSession(milestone, UserUIContext.getUsername()); } else { milestoneService.updateWithSession(milestone, UserUIContext.getUsername()); milestoneId = milestone.getId(); } AttachmentUploadField uploadField = milestoneEditFormFieldFactory.getAttachmentUploadField(); String attachPath = AttachmentUtils.getProjectEntityAttachmentPath(MyCollabUI.getAccountId(), milestone.getProjectid(), ProjectTypeConstants.MILESTONE, "" + milestone.getId()); uploadField.saveContentsToRepo(attachPath); EventBusFactory.getInstance() .post(new MilestoneEvent.NewMilestoneAdded(MilestoneAddWindow.this, milestoneId)); EventBusFactory.getInstance().post(new TicketEvent.NewTicketAdded(MilestoneAddWindow.this, ProjectTypeConstants.MILESTONE, milestoneId)); close(); } }).withIcon(FontAwesome.SAVE).withStyleName(WebThemes.BUTTON_ACTION); saveBtn.setClickShortcut(ShortcutAction.KeyCode.ENTER); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION); MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, saveBtn).withMargin(true); content.addComponent(buttonControls); content.setComponentAlignment(buttonControls, Alignment.MIDDLE_RIGHT); }
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 . j a va2s . c om*/ 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.page.PageListViewImpl.java
License:Open Source License
private void initHeader() { HeaderWithFontAwesome headerText = ComponentUtils.headerH2(ProjectTypeConstants.PAGE, UserUIContext.getMessage(PageI18nEnum.LIST)); headerLayout.with(headerText).alignAll(Alignment.MIDDLE_LEFT).expand(headerText); Label sortLbl = new Label(UserUIContext.getMessage(PageI18nEnum.OPT_SORT_LABEL)); sortLbl.setSizeUndefined();/* ww w . ja v a 2 s . co m*/ headerLayout.with(sortLbl).withAlign(sortLbl, Alignment.MIDDLE_RIGHT); ToggleButtonGroup sortGroup = new ToggleButtonGroup(); headerLayout.with(sortGroup).withAlign(sortGroup, Alignment.MIDDLE_RIGHT); SortButton sortDateBtn = new SortButton(UserUIContext.getMessage(PageI18nEnum.OPT_SORT_BY_DATE), clickEvent -> { dateSourceAscend = !dateSourceAscend; if (dateSourceAscend) { Collections.sort(resources, Ordering.from(dateSort)); } else { Collections.sort(resources, Ordering.from(dateSort).reverse()); } displayPages(resources); }); sortGroup.addButton(sortDateBtn); SortButton sortNameBtn = new SortButton(UserUIContext.getMessage(PageI18nEnum.OPT_SORT_BY_NAME), clickEvent -> { nameSortAscend = !nameSortAscend; if (nameSortAscend) { Collections.sort(resources, Ordering.from(nameSort)); } else { Collections.sort(resources, Ordering.from(nameSort).reverse()); } displayPages(resources); }); sortGroup.addButton(sortNameBtn); SortButton sortKindBtn = new SortButton(UserUIContext.getMessage(PageI18nEnum.OPT_SORT_BY_KIND), clickEvent -> { kindSortAscend = !kindSortAscend; if (kindSortAscend) { Collections.sort(resources, Ordering.from(kindSort)); } else { Collections.sort(resources, Ordering.from(kindSort).reverse()); } displayPages(resources); }); sortGroup.addButton(sortKindBtn); sortGroup.withDefaultButton(sortDateBtn); MButton newGroupBtn = new MButton(UserUIContext.getMessage(PageI18nEnum.NEW_GROUP), clickEvent -> UI.getCurrent().addWindow(new GroupPageAddWindow())).withIcon(FontAwesome.PLUS) .withStyleName(WebThemes.BUTTON_ACTION); newGroupBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES)); headerLayout.with(newGroupBtn).withAlign(newGroupBtn, Alignment.MIDDLE_RIGHT); MButton newPageBtn = new MButton(UserUIContext.getMessage(PageI18nEnum.NEW), clickEvent -> EventBusFactory.getInstance().post(new PageEvent.GotoAdd(this, null))) .withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION); newPageBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES)); headerLayout.with(newPageBtn).withAlign(newPageBtn, Alignment.MIDDLE_RIGHT); }
From source file:com.mycollab.module.project.view.ProjectAddBaseTemplateWindow.java
License:Open Source License
public ProjectAddBaseTemplateWindow() { super(UserUIContext.getMessage(OPT_CREATE_PROJECT_FROM_TEMPLATE)); this.withModal(true).withClosable(true).withResizable(false).withWidth("550px"); MVerticalLayout content = new MVerticalLayout(); GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(1, 3); final TemplateProjectComboBox templateProjectComboBox = new TemplateProjectComboBox(); gridFormLayoutHelper.addComponent(templateProjectComboBox, UserUIContext.getMessage(FORM_TEMPLATE), UserUIContext.getMessage(OPT_MARK_TEMPLATE_HELP), 0, 0); final TextField prjNameField = new TextField(); gridFormLayoutHelper.addComponent(prjNameField, UserUIContext.getMessage(FORM_NAME), 0, 1); final TextField prjKeyField = new TextField(); gridFormLayoutHelper.addComponent(prjKeyField, UserUIContext.getMessage(FORM_SHORT_NAME), 0, 2); MButton okBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_OK), clickEvent -> { SimpleProject templatePrj = (SimpleProject) templateProjectComboBox.getValue(); if (templatePrj == null) { NotificationUtil/*from w ww . j av a 2s . co m*/ .showErrorNotification(UserUIContext.getMessage(ERROR_MUST_CHOOSE_TEMPLATE_PROJECT)); return; } String newPrjName = prjNameField.getValue(); if (newPrjName.length() == 0) { NotificationUtil.showErrorNotification(UserUIContext.getMessage(ErrorI18nEnum.FIELD_MUST_NOT_NULL, UserUIContext.getMessage(GenericI18Enum.FORM_NAME))); return; } String newPrjKey = prjKeyField.getValue(); if (newPrjKey.length() > 3 || newPrjKey.length() == 0) { NotificationUtil .showErrorNotification(UserUIContext.getMessage(ProjectI18nEnum.ERROR_PROJECT_KEY_INVALID)); return; } ProjectTemplateService projectTemplateService = AppContextUtil .getSpringBean(ProjectTemplateService.class); if (projectTemplateService != null) { Integer newProjectId = projectTemplateService.cloneProject(templatePrj.getId(), newPrjName, newPrjKey, MyCollabUI.getAccountId(), UserUIContext.getUsername()); EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, new PageActionChain(new ProjectScreenData.Goto(newProjectId)))); close(); } }).withIcon(FontAwesome.SAVE).withStyleName(WebThemes.BUTTON_ACTION); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION); MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, okBtn); content.with(gridFormLayoutHelper.getLayout(), buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT); this.setContent(content); }
From source file:com.mycollab.module.project.view.ProjectListViewImpl.java
License:Open Source License
private ComponentContainer constructTableActionControls() { MHorizontalLayout layout = new MHorizontalLayout().withFullWidth(); layout.addStyleName(WebThemes.TABLE_ACTION_CONTROLS); selectOptionButton = new SelectionOptionButton(tableItem); selectOptionButton.setWidthUndefined(); layout.addComponent(selectOptionButton); tableActionControls = new DefaultMassItemActionHandlerContainer(); tableActionControls.addDownloadPdfActionItem(); tableActionControls.addDownloadExcelActionItem(); tableActionControls.addDownloadCsvActionItem(); tableActionControls.setVisible(false); tableActionControls.setWidthUndefined(); layout.addComponent(tableActionControls); selectedItemsNumberLabel.setWidth("100%"); layout.with(selectedItemsNumberLabel).withAlign(selectedItemsNumberLabel, Alignment.MIDDLE_CENTER) .expand(selectedItemsNumberLabel); MButton customizeViewBtn = new MButton("", clickEvent -> UI.getCurrent().addWindow(new ProjectListCustomizeWindow(tableItem))) .withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.ADJUST); customizeViewBtn.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_LAYOUT_OPTIONS)); layout.with(customizeViewBtn).withAlign(customizeViewBtn, Alignment.MIDDLE_RIGHT); return layout; }
From source file:com.mycollab.module.project.view.user.ProjectInfoComponent.java
License:Open Source License
public ProjectInfoComponent(SimpleProject project) { this.withMargin(false).withFullWidth(); Component projectIcon = ProjectAssetsUtil.buildProjectLogo(project.getShortname(), project.getId(), project.getAvatarid(), 64);/*w w w.j a v a 2 s .co m*/ this.with(projectIcon).withAlign(projectIcon, Alignment.TOP_LEFT); ProjectBreadcrumb breadCrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class); breadCrumb.setProject(project); MVerticalLayout headerLayout = new MVerticalLayout().withSpacing(false) .withMargin(new MarginInfo(false, true, false, true)); MHorizontalLayout footer = new MHorizontalLayout().withStyleName(UIConstants.META_INFO, WebThemes.FLEX_DISPLAY); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel createdTimeLbl = ELabel .html(FontAwesome.CLOCK_O.getHtml() + " " + UserUIContext.formatPrettyTime(project.getCreatedtime())) .withDescription(UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME)) .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined(); footer.addComponents(createdTimeLbl); billableHoursLbl = ELabel .html(FontAwesome.MONEY.getHtml() + " " + NumberUtils.roundDouble(2, project.getTotalBillableHours())) .withDescription(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS)) .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined(); footer.addComponents(billableHoursLbl); nonBillableHoursLbl = ELabel.html(FontAwesome.GIFT.getHtml() + " " + project.getTotalNonBillableHours()) .withDescription(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS)) .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined(); footer.addComponents(nonBillableHoursLbl); if (project.getLead() != null) { Div leadAvatar = new DivLessFormatter() .appendChild(new Img("", StorageFactory.getAvatarPath(project.getLeadAvatarId(), 16)) .setCSSClass(UIConstants.CIRCLE_BOX), DivLessFormatter.EMPTY_SPACE(), new A(ProjectLinkBuilder.generateProjectMemberFullLink(project.getId(), project.getLead())) .appendText(StringUtils.trim(project.getLeadFullName(), 30, true))) .setTitle(project.getLeadFullName()); ELabel leadLbl = ELabel .html(UserUIContext.getMessage(ProjectI18nEnum.FORM_LEADER) + ": " + leadAvatar.write()) .withWidthUndefined(); footer.addComponents(leadLbl); } if (project.getHomepage() != null) { ELabel homepageLbl = ELabel .html(FontAwesome.WECHAT.getHtml() + " " + new A(project.getHomepage()) .appendText(project.getHomepage()).setTarget("_blank").write()) .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined(); homepageLbl.setDescription(UserUIContext.getMessage(ProjectI18nEnum.FORM_HOME_PAGE)); } if (project.getNumActiveMembers() > 0) { ELabel activeMembersLbl = ELabel.html(FontAwesome.USERS.getHtml() + " " + project.getNumActiveMembers()) .withDescription(UserUIContext.getMessage(ProjectMemberI18nEnum.OPT_ACTIVE_MEMBERS)) .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined(); footer.addComponents(activeMembersLbl); } if (project.getAccountid() != null && !SiteConfiguration.isCommunityEdition()) { Div clientDiv = new Div(); if (project.getClientAvatarId() == null) { clientDiv.appendText(FontAwesome.INSTITUTION.getHtml() + " "); } else { Img clientImg = new Img("", StorageFactory.getEntityLogoPath(MyCollabUI.getAccountId(), project.getClientAvatarId(), 16)).setCSSClass(UIConstants.CIRCLE_BOX); clientDiv.appendChild(clientImg).appendChild(DivLessFormatter.EMPTY_SPACE()); } clientDiv.appendChild(new A(ProjectLinkBuilder.generateClientPreviewFullLink(project.getAccountid())) .appendText(StringUtils.trim(project.getClientName(), 30, true))); ELabel accountBtn = ELabel.html(clientDiv.write()).withStyleName(WebThemes.BUTTON_LINK) .withWidthUndefined(); footer.addComponents(accountBtn); } if (!SiteConfiguration.isCommunityEdition()) { MButton tagBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_TAG), clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoTagListView(this, null))) .withIcon(FontAwesome.TAGS) .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK); footer.addComponents(tagBtn); MButton favoriteBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_FAVORITES), clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoFavoriteView(this, null))) .withIcon(FontAwesome.STAR) .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK); footer.addComponents(favoriteBtn); MButton eventBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_CALENDAR), clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoCalendarView(this))) .withIcon(FontAwesome.CALENDAR) .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK); footer.addComponents(eventBtn); MButton ganttChartBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_GANTT_CHART), clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoGanttChart(this, null))) .withIcon(FontAwesome.BAR_CHART_O) .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK); footer.addComponents(ganttChartBtn); } headerLayout.with(breadCrumb, footer); MHorizontalLayout topPanel = new MHorizontalLayout().withMargin(false); this.with(headerLayout, topPanel).expand(headerLayout).withAlign(topPanel, Alignment.TOP_RIGHT); if (project.isProjectArchived()) { MButton activeProjectBtn = new MButton( UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ACTIVE_PROJECT), clickEvent -> { ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.class); project.setProjectstatus(OptionI18nEnum.StatusI18nEnum.Open.name()); projectService.updateSelectiveWithSession(project, UserUIContext.getUsername()); PageActionChain chain = new PageActionChain( new ProjectScreenData.Goto(CurrentProjectVariables.getProjectId())); EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, chain)); }).withStyleName(WebThemes.BUTTON_ACTION); topPanel.with(activeProjectBtn).withAlign(activeProjectBtn, Alignment.MIDDLE_RIGHT); } else { SearchTextField searchField = new SearchTextField() { public void doSearch(String value) { ProjectView prjView = UIUtils.getRoot(this, ProjectView.class); if (prjView != null) { prjView.displaySearchResult(value); } } @Override public void emptySearch() { } }; final PopupButton controlsBtn = new PopupButton(); controlsBtn.addStyleName(WebThemes.BOX); controlsBtn.setIcon(FontAwesome.ELLIPSIS_H); OptionPopupContent popupButtonsControl = new OptionPopupContent(); if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)) { MButton inviteMemberBtn = new MButton( UserUIContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEES), clickEvent -> { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance() .post(new ProjectMemberEvent.GotoInviteMembers(this, null)); }).withIcon(FontAwesome.SEND); popupButtonsControl.addOption(inviteMemberBtn); } MButton settingBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_SETTINGS), clickEvent -> { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new ProjectNotificationEvent.GotoList(this, null)); }).withIcon(FontAwesome.COG); popupButtonsControl.addOption(settingBtn); popupButtonsControl.addSeparator(); if (UserUIContext.canAccess(RolePermissionCollections.CREATE_NEW_PROJECT)) { final MButton markProjectTemplateBtn = new MButton().withIcon(FontAwesome.ANCHOR); markProjectTemplateBtn.addClickListener(clickEvent -> { Boolean isTemplate = !MoreObjects.firstNonNull(project.getIstemplate(), Boolean.FALSE); project.setIstemplate(isTemplate); ProjectService prjService = AppContextUtil.getSpringBean(ProjectService.class); prjService.updateWithSession(project, UserUIContext.getUsername()); if (project.getIstemplate()) { markProjectTemplateBtn .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_UNMARK_TEMPLATE)); } else { markProjectTemplateBtn .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_MARK_TEMPLATE)); } }); Boolean isTemplate = MoreObjects.firstNonNull(project.getIstemplate(), Boolean.FALSE); if (isTemplate) { markProjectTemplateBtn .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_UNMARK_TEMPLATE)); } else { markProjectTemplateBtn .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_MARK_TEMPLATE)); } popupButtonsControl.addOption(markProjectTemplateBtn); } if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PROJECT)) { MButton editProjectBtn = new MButton(UserUIContext.getMessage(ProjectI18nEnum.EDIT), clickEvent -> { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance() .post(new ProjectEvent.GotoEdit(ProjectInfoComponent.this, project)); }).withIcon(FontAwesome.EDIT); popupButtonsControl.addOption(editProjectBtn); } if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)) { MButton archiveProjectBtn = new MButton( UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ARCHIVE_PROJECT), clickEvent -> { controlsBtn.setPopupVisible(false); ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.WINDOW_WARNING_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage( ProjectCommonI18nEnum.DIALOG_CONFIRM_PROJECT_ARCHIVE_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { ProjectService projectService = AppContextUtil .getSpringBean(ProjectService.class); project.setProjectstatus(OptionI18nEnum.StatusI18nEnum.Archived.name()); projectService.updateSelectiveWithSession(project, UserUIContext.getUsername()); PageActionChain chain = new PageActionChain(new ProjectScreenData.Goto( CurrentProjectVariables.getProjectId())); EventBusFactory.getInstance() .post(new ProjectEvent.GotoMyProject(this, chain)); } }); }).withIcon(FontAwesome.ARCHIVE); popupButtonsControl.addOption(archiveProjectBtn); } if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)) { popupButtonsControl.addSeparator(); MButton deleteProjectBtn = new MButton( UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_DELETE_PROJECT), clickEvent -> { controlsBtn.setPopupVisible(false); ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage( ProjectCommonI18nEnum.DIALOG_CONFIRM_PROJECT_DELETE_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { ProjectService projectService = AppContextUtil .getSpringBean(ProjectService.class); projectService.removeWithSession(CurrentProjectVariables.getProject(), UserUIContext.getUsername(), MyCollabUI.getAccountId()); EventBusFactory.getInstance() .post(new ShellEvent.GotoProjectModule(this, null)); } }); }).withIcon(FontAwesome.TRASH_O); popupButtonsControl.addDangerOption(deleteProjectBtn); } controlsBtn.setContent(popupButtonsControl); controlsBtn.setWidthUndefined(); topPanel.with(searchField, controlsBtn).withAlign(searchField, Alignment.TOP_RIGHT) .withAlign(controlsBtn, Alignment.TOP_RIGHT); } }
From source file:com.mycollab.module.user.accountsettings.customize.view.AccountInfoChangeWindow.java
License:Open Source License
AccountInfoChangeWindow() { super(UserUIContext.getMessage(AdminI18nEnum.OPT_CHANGE_ACCOUNT_INFO)); MVerticalLayout content = new MVerticalLayout(); this.withModal(true).withResizable(false).withWidth("700px").withContent(content).withCenter(); billingAccount = BeanUtility.deepClone(MyCollabUI.getBillingAccount()); editForm = new AdvancedEditBeanForm<>(); editForm.setFormLayoutFactory(new AbstractFormLayoutFactory() { private GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(1, 9, "200px"); @Override/*w w w . j a v a2 s.c om*/ public AbstractComponent getLayout() { return gridFormLayoutHelper.getLayout(); } @Override public Component onAttachField(Object propertyId, Field<?> field) { if (BillingAccount.Field.sitename.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, UserUIContext.getMessage(AdminI18nEnum.FORM_SITE_NAME), 0, 0); } else if (BillingAccount.Field.subdomain.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, UserUIContext.getMessage(AdminI18nEnum.FORM_SITE_ADDRESS), 0, 1); } else if (BillingAccount.Field.defaulttimezone.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_TIMEZONE), 0, 2); } else if (BillingAccount.Field.defaultcurrencyid.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_CURRENCY), 0, 3); } else if (BillingAccount.Field.defaultyymmddformat.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_YYMMDD_FORMAT), UserUIContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 4); } else if (BillingAccount.Field.defaultmmddformat.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_MMDD_FORMAT), UserUIContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 5); } else if (BillingAccount.Field.defaulthumandateformat.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_HUMAN_DATE_FORMAT), UserUIContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 6); } else if (BillingAccount.Field.defaultlanguagetag.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_LANGUAGE), 0, 7); } else if (BillingAccount.Field.displayemailpublicly.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, UserUIContext.getMessage(AdminI18nEnum.FORM_SHOW_EMAIL_PUBLICLY), UserUIContext.getMessage(AdminI18nEnum.FORM_SHOW_EMAIL_PUBLICLY_HELP), 0, 8); } return null; } }); editForm.setBeanFormFieldFactory( new AbstractBeanFieldGroupEditFieldFactory<SimpleBillingAccount>(editForm) { @Override protected Field<?> onCreateField(Object propertyId) { if (BillingAccount.Field.subdomain.equalTo(propertyId)) { return new SubDomainField(); } else if (BillingAccount.Field.defaulttimezone.equalTo(propertyId)) { return new TimeZoneSelectionField(false); } else if (BillingAccount.Field.defaultcurrencyid.equalTo(propertyId)) { return new CurrencyComboBoxField(); } else if (BillingAccount.Field.defaultyymmddformat.equalTo(propertyId)) { return new DateFormatField(billingAccount.getDateFormatInstance()); } else if (BillingAccount.Field.defaultmmddformat.equalTo(propertyId)) { return new DateFormatField(billingAccount.getShortDateFormatInstance()); } else if (BillingAccount.Field.defaulthumandateformat.equalTo(propertyId)) { return new DateFormatField(billingAccount.getLongDateFormatInstance()); } else if (BillingAccount.Field.defaultlanguagetag.equalTo(propertyId)) { return new LanguageSelectionField(); } return null; } }); editForm.setBean(billingAccount); MHorizontalLayout buttonControls = new MHorizontalLayout().withMargin(true); MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> { if (editForm.validateForm()) { BillingAccountService billingAccountService = AppContextUtil .getSpringBean(BillingAccountService.class); billingAccountService.updateSelectiveWithSession(billingAccount, UserUIContext.getUsername()); close(); String siteUrl = MyCollabUI.getSiteUrl(); String assignExec = String.format("window.location.assign(\'%s\');", siteUrl); Page.getCurrent().getJavaScript().execute(assignExec); } }).withIcon(FontAwesome.SAVE).withStyleName(WebThemes.BUTTON_ACTION) .withClickShortcut(ShortcutAction.KeyCode.ENTER); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION); buttonControls.with(cancelBtn, saveBtn); content.with(editForm, buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT); }
From source file:com.mycollab.module.user.accountsettings.profile.view.AdvancedInfoChangeWindow.java
License:Open Source License
private void initUI() { MVerticalLayout mainLayout = new MVerticalLayout().withMargin(new MarginInfo(false, false, true, false)) .withFullWidth();/* w w w. ja v a 2 s . c om*/ GridFormLayoutHelper passInfo = GridFormLayoutHelper.defaultFormLayoutHelper(1, 4); passInfo.addComponent(txtWebsite, UserUIContext.getMessage(UserI18nEnum.FORM_WEBSITE), 0, 0); passInfo.addComponent(txtCompany, UserUIContext.getMessage(UserI18nEnum.FORM_COMPANY), 0, 1); passInfo.addComponent(cboCountry, UserUIContext.getMessage(UserI18nEnum.FORM_COUNTRY), 0, 2); txtWebsite.setValue(MoreObjects.firstNonNull(user.getWebsite(), "")); txtCompany.setValue(MoreObjects.firstNonNull(user.getCompany(), "")); cboCountry.setValue(MoreObjects.firstNonNull(user.getCountry(), "")); mainLayout.with(passInfo.getLayout()).withAlign(passInfo.getLayout(), Alignment.TOP_LEFT); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION); MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> changeInfo()).withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.SAVE) .withClickShortcut(ShortcutAction.KeyCode.ENTER); MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, saveBtn) .withMargin(new MarginInfo(false, true, false, true)); mainLayout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT); this.setModal(true); this.setContent(mainLayout); }
From source file:com.mycollab.module.user.accountsettings.profile.view.BasicInfoChangeWindow.java
License:Open Source License
private void initUI() { final MVerticalLayout mainLayout = new MVerticalLayout() .withMargin(new MarginInfo(false, false, true, false)).withFullWidth(); final GridFormLayoutHelper passInfo = GridFormLayoutHelper.defaultFormLayoutHelper(1, 6); passInfo.addComponent(txtFirstName, UserUIContext.getMessage(UserI18nEnum.FORM_FIRST_NAME), 0, 0); passInfo.addComponent(txtLastName, UserUIContext.getMessage(UserI18nEnum.FORM_LAST_NAME), 0, 1); txtLastName.setRequired(true);/*from w w w .j av a 2 s.c o m*/ passInfo.addComponent(txtEmail, UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL), 0, 2); txtEmail.setRequired(true); passInfo.addComponent(birthdayField, UserUIContext.getMessage(UserI18nEnum.FORM_BIRTHDAY), 0, 3); birthdayField.setDate(user.getDateofbirth()); passInfo.addComponent(timeZoneField, UserUIContext.getMessage(UserI18nEnum.FORM_TIMEZONE), 0, 4); timeZoneField.setValue(user.getTimezone()); passInfo.addComponent(languageBox, UserUIContext.getMessage(UserI18nEnum.FORM_LANGUAGE), UserUIContext.getMessage(ShellI18nEnum.OPT_SUPPORTED_LANGUAGES_INTRO), 0, 5); languageBox.setValue(user.getLanguage()); txtFirstName.setValue(MoreObjects.firstNonNull(user.getFirstname(), "")); txtLastName.setValue(MoreObjects.firstNonNull(user.getLastname(), "")); txtEmail.setValue(MoreObjects.firstNonNull(user.getEmail(), "")); birthdayField.setValue(user.getDateofbirth()); mainLayout.addComponent(passInfo.getLayout()); mainLayout.setComponentAlignment(passInfo.getLayout(), Alignment.TOP_LEFT); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION); MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> changeUserInfo()).withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.SAVE) .withClickShortcut(ShortcutAction.KeyCode.ENTER); MHorizontalLayout hlayoutControls = new MHorizontalLayout(cancelBtn, saveBtn) .withMargin(new MarginInfo(false, true, false, true)); mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT); this.setContent(mainLayout); }
From source file:com.mycollab.module.user.accountsettings.profile.view.ContactInfoChangeWindow.java
License:Open Source License
private void initUI() { MVerticalLayout mainLayout = new MVerticalLayout().withMargin(new MarginInfo(false, false, true, false)) .withFullWidth();/*from w ww . ja v a 2 s.c om*/ GridFormLayoutHelper passInfo = GridFormLayoutHelper.defaultFormLayoutHelper(1, 6); passInfo.addComponent(txtWorkPhone, UserUIContext.getMessage(UserI18nEnum.FORM_WORK_PHONE), 0, 0); passInfo.addComponent(txtHomePhone, UserUIContext.getMessage(UserI18nEnum.FORM_HOME_PHONE), 0, 1); passInfo.addComponent(txtFaceBook, "Facebook", 0, 2); passInfo.addComponent(txtTwitter, "Twitter", 0, 3); passInfo.addComponent(txtSkype, "Skype", 0, 4); txtWorkPhone.setValue(MoreObjects.firstNonNull(user.getWorkphone(), "")); txtHomePhone.setValue(MoreObjects.firstNonNull(user.getHomephone(), "")); txtFaceBook.setValue(MoreObjects.firstNonNull(user.getFacebookaccount(), "")); txtTwitter.setValue(MoreObjects.firstNonNull(user.getTwitteraccount(), "")); txtSkype.setValue(MoreObjects.firstNonNull(user.getSkypecontact(), "")); mainLayout.addComponent(passInfo.getLayout()); mainLayout.setComponentAlignment(passInfo.getLayout(), Alignment.TOP_LEFT); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION); MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> changeUserInfo()).withIcon(FontAwesome.SAVE).withStyleName(WebThemes.BUTTON_ACTION) .withClickShortcut(ShortcutAction.KeyCode.ENTER); MHorizontalLayout hlayoutControls = new MHorizontalLayout(cancelBtn, saveBtn) .withMargin(new MarginInfo(false, true, false, true)); mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT); this.setContent(mainLayout); }