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.esofthead.mycollab.module.project.view.user.ProjectInfoComponent.java
License:Open Source License
public ProjectInfoComponent(final SimpleProject project) { this.withMargin(true).withStyleName("project-info").withFullWidth(); Component projectIcon = ProjectAssetsUtil.buildProjectLogo(project.getShortname(), project.getId(), project.getAvatarid(), 64);/*from w ww. j av a 2 s .co m*/ this.with(projectIcon).withAlign(projectIcon, Alignment.TOP_LEFT); ELabel headerLbl = ELabel.h2(project.getName()); headerLbl.setDescription(ProjectTooltipGenerator.generateToolTipProject(AppContext.getUserLocale(), AppContext.getDateFormat(), project, AppContext.getSiteUrl(), AppContext.getUserTimeZone())); headerLbl.addStyleName(UIConstants.TEXT_ELLIPSIS); MVerticalLayout headerLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, true)); MHorizontalLayout footer = new MHorizontalLayout(); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); footer.addStyleName(UIConstants.META_INFO); footer.addStyleName(UIConstants.FLEX_DISPLAY); ELabel createdTimeLbl = new ELabel( FontAwesome.CLOCK_O.getHtml() + " " + AppContext.formatPrettyTime(project.getCreatedtime()), ContentMode.HTML).withDescription(AppContext.getMessage(GenericI18Enum.FORM_CREATED_TIME)) .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined(); footer.addComponents(createdTimeLbl); billableHoursLbl = new ELabel( FontAwesome.MONEY.getHtml() + " " + NumberUtils.roundDouble(2, project.getTotalBillableHours()), ContentMode.HTML).withDescription(AppContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS)) .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined(); footer.addComponents(billableHoursLbl); nonBillableHoursLbl = new ELabel(FontAwesome.GIFT.getHtml() + " " + project.getTotalNonBillableHours(), ContentMode.HTML) .withDescription(AppContext.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.getInstance().getAvatarPath(project.getLeadAvatarId(), 16)), DivLessFormatter.EMPTY_SPACE(), new A(ProjectLinkBuilder.generateProjectMemberFullLink(project.getId(), project.getLead())) .appendText(StringUtils.trim(project.getLeadFullName(), 30, true))) .setTitle(project.getLeadFullName()); ELabel leadLbl = new ELabel("Lead: " + leadAvatar.write(), ContentMode.HTML).withWidthUndefined(); footer.addComponents(leadLbl); } if (project.getHomepage() != null) { ELabel homepageLbl = new ELabel(FontAwesome.WECHAT.getHtml() + " " + new A(project.getHomepage()).appendText(project.getHomepage()).setTarget("_blank").write(), ContentMode.HTML).withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined(); homepageLbl.setDescription(AppContext.getMessage(ProjectI18nEnum.FORM_HOME_PAGE)); } if (project.getNumActiveMembers() > 0) { ELabel activeMembersLbl = new ELabel(FontAwesome.USERS.getHtml() + " " + project.getNumActiveMembers(), ContentMode.HTML).withDescription("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.getInstance() .getEntityLogoPath(AppContext.getAccountId(), project.getClientAvatarId(), 16)); clientDiv.appendChild(clientImg).appendChild(DivLessFormatter.EMPTY_SPACE()); } clientDiv.appendChild(new A(ProjectLinkBuilder.generateClientPreviewFullLink(project.getAccountid())) .appendText(project.getClientName())); ELabel accountBtn = new ELabel(clientDiv.write(), ContentMode.HTML) .withStyleName(UIConstants.BUTTON_BLOCK).withWidthUndefined(); footer.addComponents(accountBtn); } if (!SiteConfiguration.isCommunityEdition()) { Button tagBtn = new Button(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_TAG), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { EventBusFactory.getInstance().post(new ProjectEvent.GotoTagListView(this, null)); } }); tagBtn.addStyleName(UIConstants.BUTTON_SMALL_PADDING); tagBtn.addStyleName(UIConstants.BUTTON_ACTION); tagBtn.setDescription("Tag management"); tagBtn.setIcon(FontAwesome.TAGS); footer.addComponents(tagBtn); Button favoriteBtn = new Button(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_FAVORITES), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { EventBusFactory.getInstance().post(new ProjectEvent.GotoFavoriteView(this, null)); } }); favoriteBtn.setCaptionAsHtml(true); favoriteBtn.addStyleName(UIConstants.BUTTON_SMALL_PADDING); favoriteBtn.addStyleName(UIConstants.BUTTON_ACTION); favoriteBtn.setIcon(FontAwesome.STAR); favoriteBtn.setDescription("Your favorite list"); footer.addComponents(favoriteBtn); Button eventBtn = new Button(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_CALENDAR), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { EventBusFactory.getInstance().post(new ProjectEvent.GotoCalendarView(this)); } }); eventBtn.addStyleName(UIConstants.BUTTON_SMALL_PADDING); eventBtn.addStyleName(UIConstants.BUTTON_ACTION); eventBtn.setIcon(FontAwesome.CALENDAR); eventBtn.setDescription("Calendar"); footer.addComponents(eventBtn); Button ganttChartBtn = new Button(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_GANTT_CHART), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { EventBusFactory.getInstance().post(new ProjectEvent.GotoGanttChart(this, null)); } }); ganttChartBtn.addStyleName(UIConstants.BUTTON_SMALL_PADDING); ganttChartBtn.addStyleName(UIConstants.BUTTON_ACTION); ganttChartBtn.setIcon(FontAwesome.BAR_CHART_O); ganttChartBtn.setDescription("Gantt chart"); footer.addComponents(ganttChartBtn); } headerLayout.with(headerLbl, footer); MHorizontalLayout topPanel = new MHorizontalLayout().withMargin(false); this.with(headerLayout, topPanel).expand(headerLayout).withAlign(topPanel, Alignment.TOP_RIGHT); if (project.isProjectArchived()) { Button activeProjectBtn = new Button(AppContext.getMessage(ProjectCommonI18nEnum.BUTTON_ACTIVE_PROJECT), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.class); project.setProjectstatus(OptionI18nEnum.StatusI18nEnum.Open.name()); projectService.updateSelectiveWithSession(project, AppContext.getUsername()); PageActionChain chain = new PageActionChain( new ProjectScreenData.Goto(CurrentProjectVariables.getProjectId())); EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, chain)); } }); activeProjectBtn.setStyleName(UIConstants.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(UIConstants.BOX); controlsBtn.setIcon(FontAwesome.ELLIPSIS_H); OptionPopupContent popupButtonsControl = new OptionPopupContent(); Button createPhaseBtn = new Button(AppContext.getMessage(MilestoneI18nEnum.NEW), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance() .post(new MilestoneEvent.GotoAdd(ProjectInfoComponent.this, null)); } }); createPhaseBtn .setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)); createPhaseBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.MILESTONE)); popupButtonsControl.addOption(createPhaseBtn); Button createTaskBtn = new Button(AppContext.getMessage(TaskI18nEnum.NEW), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new TaskEvent.GotoAdd(ProjectInfoComponent.this, null)); } }); createTaskBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); createTaskBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK)); popupButtonsControl.addOption(createTaskBtn); Button createBugBtn = new Button(AppContext.getMessage(BugI18nEnum.NEW), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new BugEvent.GotoAdd(this, null)); } }); createBugBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)); createBugBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG)); popupButtonsControl.addOption(createBugBtn); Button createComponentBtn = new Button(AppContext.getMessage(ComponentI18nEnum.NEW), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new BugComponentEvent.GotoAdd(this, null)); } }); createComponentBtn .setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.COMPONENTS)); createComponentBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG_COMPONENT)); popupButtonsControl.addOption(createComponentBtn); Button createVersionBtn = new Button(AppContext.getMessage(VersionI18nEnum.NEW), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new BugVersionEvent.GotoAdd(this, null)); } }); createVersionBtn .setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.VERSIONS)); createVersionBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG_VERSION)); popupButtonsControl.addOption(createVersionBtn); if (!SiteConfiguration.isCommunityEdition()) { Button createRiskBtn = new Button(AppContext.getMessage(RiskI18nEnum.NEW), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new RiskEvent.GotoAdd(this, null)); } }); createRiskBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.RISKS)); createRiskBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.RISK)); popupButtonsControl.addOption(createRiskBtn); } popupButtonsControl.addSeparator(); Button inviteMemberBtn = new Button(AppContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEES), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance() .post(new ProjectMemberEvent.GotoInviteMembers(this, null)); } }); inviteMemberBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)); inviteMemberBtn.setIcon(FontAwesome.SEND); popupButtonsControl.addOption(inviteMemberBtn); Button settingBtn = new Button(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_SETTINGS), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new ProjectNotificationEvent.GotoList(this, null)); } }); settingBtn.setIcon(FontAwesome.COG); popupButtonsControl.addOption(settingBtn); popupButtonsControl.addSeparator(); final Button markProjectTemplateBtn = new Button(); markProjectTemplateBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { Boolean isTemplate = !MoreObjects.firstNonNull(project.getIstemplate(), Boolean.FALSE); project.setIstemplate(isTemplate); ProjectService prjService = AppContextUtil.getSpringBean(ProjectService.class); prjService.updateWithSession(project, AppContext.getUsername()); if (project.getIstemplate()) { markProjectTemplateBtn .setCaption(AppContext.getMessage(ProjectI18nEnum.ACTION_UNMARK_TEMPLATE)); } else { markProjectTemplateBtn .setCaption(AppContext.getMessage(ProjectI18nEnum.ACTION_MARK_TEMPLATE)); } } }); markProjectTemplateBtn.setIcon(FontAwesome.STICKY_NOTE); Boolean isTemplate = MoreObjects.firstNonNull(project.getIstemplate(), Boolean.FALSE); if (isTemplate) { markProjectTemplateBtn.setCaption(AppContext.getMessage(ProjectI18nEnum.ACTION_UNMARK_TEMPLATE)); } else { markProjectTemplateBtn.setCaption(AppContext.getMessage(ProjectI18nEnum.ACTION_MARK_TEMPLATE)); } markProjectTemplateBtn.setEnabled(AppContext.canAccess(RolePermissionCollections.CREATE_NEW_PROJECT)); popupButtonsControl.addOption(markProjectTemplateBtn); Button editProjectBtn = new Button(AppContext.getMessage(ProjectI18nEnum.EDIT), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance() .post(new ProjectEvent.GotoEdit(ProjectInfoComponent.this, project)); } }); editProjectBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PROJECT)); editProjectBtn.setIcon(FontAwesome.EDIT); popupButtonsControl.addOption(editProjectBtn); Button archiveProjectBtn = new Button( AppContext.getMessage(ProjectCommonI18nEnum.BUTTON_ARCHIVE_PROJECT), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { controlsBtn.setPopupVisible(false); ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.WINDOW_WARNING_TITLE, AppContext.getSiteName()), AppContext.getMessage( ProjectCommonI18nEnum.DIALOG_CONFIRM_PROJECT_ARCHIVE_MESSAGE), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { ProjectService projectService = AppContextUtil .getSpringBean(ProjectService.class); project.setProjectstatus( OptionI18nEnum.StatusI18nEnum.Archived.name()); projectService.updateSelectiveWithSession(project, AppContext.getUsername()); PageActionChain chain = new PageActionChain( new ProjectScreenData.Goto( CurrentProjectVariables.getProjectId())); EventBusFactory.getInstance() .post(new ProjectEvent.GotoMyProject(this, chain)); } } }); } }); archiveProjectBtn .setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)); archiveProjectBtn.setIcon(FontAwesome.ARCHIVE); popupButtonsControl.addOption(archiveProjectBtn); if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)) { popupButtonsControl.addSeparator(); Button deleteProjectBtn = new Button( AppContext.getMessage(ProjectCommonI18nEnum.BUTTON_DELETE_PROJECT), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { controlsBtn.setPopupVisible(false); ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, AppContext.getSiteName()), AppContext.getMessage( ProjectCommonI18nEnum.DIALOG_CONFIRM_PROJECT_DELETE_MESSAGE), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { ProjectService projectService = AppContextUtil .getSpringBean(ProjectService.class); projectService.removeWithSession( CurrentProjectVariables.getProject(), AppContext.getUsername(), AppContext.getAccountId()); EventBusFactory.getInstance() .post(new ShellEvent.GotoProjectModule(this, null)); } } }); } }); deleteProjectBtn .setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)); deleteProjectBtn.setIcon(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.esofthead.mycollab.module.project.view.user.ProjectListComponent.java
License:Open Source License
public ProjectListComponent() { super();//from w w w . j av a 2s .c o m withSpacing(true).withMargin(false).withWidth("100%").withStyleName("project-list-comp"); MHorizontalLayout headerBar = new MHorizontalLayout(); headerPopupButton = new PopupButton(); headerPopupButton.setStyleName("project-list-comp-hdr"); headerPopupButton.setWidth("100%"); Label componentHeader = new Label(); componentHeader.setStyleName("h2"); headerPopupButton.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.PROJECT)); headerBar.with(headerPopupButton); if (AppContext.canBeYes(RolePermissionCollections.CREATE_NEW_PROJECT)) { final Button createProjectBtn = new Button("+", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { final ProjectAddWindow projectNewWindow = new ProjectAddWindow(); UI.getCurrent().addWindow(projectNewWindow); } }); createProjectBtn.setStyleName("add-project-btn"); createProjectBtn.setDescription("New Project"); createProjectBtn.setWidth("20px"); createProjectBtn.setHeight("20px"); headerBar.with(createProjectBtn).withAlign(createProjectBtn, Alignment.MIDDLE_RIGHT); } headerBar.withWidth("100%").withSpacing(true).expand(headerPopupButton); this.addComponent(headerBar); contentLayout = new MVerticalLayout().withStyleName("project-list-comp-content").withWidth("205px"); projectList = new ProjectPagedList(); headerPopupButton.setContent(projectList); projectDesc = new Label("", ContentMode.HTML); projectDesc.setStyleName("project-description"); addComponent(projectDesc); }
From source file:com.esofthead.mycollab.module.project.view.user.TaskStatusComponent.java
License:Open Source License
public TaskStatusComponent() { withSpacing(false).withMargin(false); this.addStyleName("myprojectlist"); MHorizontalLayout header = new MHorizontalLayout().withSpacing(false) .withMargin(new MarginInfo(false, true, false, true)).withHeight("34px"); header.addStyleName("panel-header"); titleLbl = new Label(AppContext.getMessage(ProjectCommonI18nEnum.WIDGET_OPEN_ASSIGNMENTS_TITLE, 0)); final CheckBox overdueSelection = new CheckBox("Overdue"); overdueSelection.addValueChangeListener(new Property.ValueChangeListener() { @Override//from w w w. ja v a 2 s . co m public void valueChange(Property.ValueChangeEvent valueChangeEvent) { boolean isOverdueOption = overdueSelection.getValue(); if (isOverdueOption) { searchCriteria.setDueDate( new DateSearchField(DateSearchField.AND, DateTimeUtils.getCurrentDateWithoutMS())); } else { searchCriteria.setDueDate(null); } updateSearchResult(); } }); final CheckBox myItemsOnly = new CheckBox("My Items"); myItemsOnly.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { boolean selectMyItemsOnly = myItemsOnly.getValue(); if (selectMyItemsOnly) { searchCriteria.setAssignUser(new StringSearchField(AppContext.getUsername())); } else { searchCriteria.setAssignUser(null); } taskComponents.setSearchCriteria(searchCriteria); } }); header.with(titleLbl, overdueSelection, myItemsOnly).withAlign(titleLbl, Alignment.MIDDLE_LEFT) .withAlign(overdueSelection, Alignment.MIDDLE_RIGHT).withAlign(myItemsOnly, Alignment.MIDDLE_RIGHT) .expand(titleLbl); taskComponents = new TaskStatusPagedList(); this.with(header, taskComponents); }
From source file:com.esofthead.mycollab.module.user.accountsettings.customize.view.AccountInfoChangeWindow.java
License:Open Source License
AccountInfoChangeWindow() { super(AppContext.getMessage(AdminI18nEnum.OPT_CHANGE_ACCOUNT_INFO)); this.setModal(true); this.setResizable(false); this.setWidth("700px"); billingAccount = BeanUtility.deepClone(AppContext.getBillingAccount()); MVerticalLayout content = new MVerticalLayout(); this.setContent(content); editForm = new AdvancedEditBeanForm<>(); editForm.setFormLayoutFactory(new AbstractFormLayoutFactory() { private GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(1, 9, "200px"); @Override/*from w w w.ja v a2 s . c o m*/ public ComponentContainer getLayout() { return gridFormLayoutHelper.getLayout(); } @Override public Component onAttachField(Object propertyId, Field<?> field) { if (BillingAccount.Field.sitename.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, AppContext.getMessage(AdminI18nEnum.FORM_SITE_NAME), 0, 0); } else if (BillingAccount.Field.subdomain.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, AppContext.getMessage(AdminI18nEnum.FORM_SITE_ADDRESS), 0, 1); } else if (BillingAccount.Field.defaulttimezone.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_TIMEZONE), 0, 2); } else if (BillingAccount.Field.defaultcurrencyid.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_CURRENCY), 0, 3); } else if (BillingAccount.Field.defaultyymmddformat.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_YYMMDD_FORMAT), AppContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 4); } else if (BillingAccount.Field.defaultmmddformat.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_MMDD_FORMAT), AppContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 5); } else if (BillingAccount.Field.defaulthumandateformat.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_HUMAN_DATE_FORMAT), AppContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 6); } else if (BillingAccount.Field.defaultlanguagetag.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, AppContext.getMessage(AdminI18nEnum.FORM_DEFAULT_LANGUAGE), 0, 7); } else if (BillingAccount.Field.displayemailpublicly.equalTo(propertyId)) { return gridFormLayoutHelper.addComponent(field, AppContext.getMessage(AdminI18nEnum.FORM_SHOW_EMAIL_PUBLICLY), AppContext.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); Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { if (editForm.validateForm()) { BillingAccountService billingAccountService = AppContextUtil .getSpringBean(BillingAccountService.class); billingAccountService.updateSelectiveWithSession(billingAccount, AppContext.getUsername()); close(); String siteUrl = SiteConfiguration.getSiteUrl(billingAccount.getSubdomain()); String assignExec = String.format("window.location.assign(\'%s\');", siteUrl); Page.getCurrent().getJavaScript().execute(assignExec); } } }); saveBtn.setIcon(FontAwesome.SAVE); saveBtn.setStyleName(UIConstants.BUTTON_ACTION); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { close(); } }); cancelBtn.setStyleName(UIConstants.BUTTON_OPTION); buttonControls.with(cancelBtn, saveBtn); content.with(editForm, buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT); }
From source file:com.esofthead.mycollab.module.user.accountsettings.profile.view.AdvancedInfoChangeWindow.java
License:Open Source License
private void initUI() { final MVerticalLayout mainLayout = new MVerticalLayout() .withMargin(new MarginInfo(false, false, true, false)).withWidth("100%"); final GridFormLayoutHelper passInfo = new GridFormLayoutHelper(1, 4, "100%", "150px", Alignment.TOP_LEFT); passInfo.addComponent(txtWebsite, AppContext.getMessage(UserI18nEnum.FORM_WEBSITE), 0, 0); passInfo.addComponent(txtCompany, AppContext.getMessage(UserI18nEnum.FORM_COMPANY), 0, 1); passInfo.addComponent(cboCountry, AppContext.getMessage(UserI18nEnum.FORM_COUNTRY), 0, 2); this.txtWebsite.setValue(this.user.getWebsite() == null ? "" : this.user.getWebsite()); this.txtCompany.setValue(this.user.getCompany() == null ? "" : this.user.getCompany()); this.cboCountry.setValue(this.user.getCountry() == null ? "" : this.user.getCountry()); passInfo.getLayout().setMargin(false); passInfo.getLayout().setWidth("100%"); passInfo.getLayout().addStyleName("colored-gridlayout"); mainLayout.addComponent(passInfo.getLayout()); mainLayout.setComponentAlignment(passInfo.getLayout(), Alignment.TOP_LEFT); final MHorizontalLayout hlayoutControls = new MHorizontalLayout() .withMargin(new MarginInfo(false, true, false, true)); final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w w w .j av a2 s. c om*/ public void buttonClick(final ClickEvent event) { AdvancedInfoChangeWindow.this.close(); } }); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { changeInfo(); } }); saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK); saveBtn.setIcon(FontAwesome.SAVE); hlayoutControls.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER); mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT); this.setModal(true); this.setContent(mainLayout); }
From source file:com.esofthead.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)).withWidth("100%"); final GridFormLayoutHelper passInfo = new GridFormLayoutHelper(1, 6, "100%", "150px", Alignment.TOP_LEFT); passInfo.addComponent(txtFirstName, AppContext.getMessage(UserI18nEnum.FORM_FIRST_NAME), 0, 0); passInfo.addComponent(txtLastName, AppContext.getMessage(UserI18nEnum.FORM_LAST_NAME), 0, 1); this.txtLastName.setRequired(true); passInfo.addComponent(txtEmail, AppContext.getMessage(UserI18nEnum.FORM_EMAIL), 0, 2); this.txtEmail.setRequired(true); passInfo.addComponent(birthdayField, AppContext.getMessage(UserI18nEnum.FORM_BIRTHDAY), 0, 3); this.birthdayField.setDate(this.user.getDateofbirth()); passInfo.addComponent(timeZoneField, AppContext.getMessage(UserI18nEnum.FORM_TIMEZONE), 0, 4); this.timeZoneField.setTimeZone(TimezoneMapper.getTimezoneExt(this.user.getTimezone())); passInfo.addComponent(languageBox, AppContext.getMessage(UserI18nEnum.FORM_LANGUAGE), 0, 5); this.languageBox.setValue(this.user.getLanguage()); this.txtFirstName.setValue(this.user.getFirstname() == null ? "" : this.user.getFirstname()); this.txtLastName.setValue(this.user.getLastname() == null ? "" : this.user.getLastname()); this.txtEmail.setValue(this.user.getEmail() == null ? "" : this.user.getEmail()); this.birthdayField.setValue(this.user.getDateofbirth()); passInfo.getLayout().setMargin(false); passInfo.getLayout().setWidth("100%"); passInfo.getLayout().addStyleName("colored-gridlayout"); mainLayout.addComponent(passInfo.getLayout()); mainLayout.setComponentAlignment(passInfo.getLayout(), Alignment.TOP_LEFT); final MHorizontalLayout hlayoutControls = new MHorizontalLayout() .withMargin(new MarginInfo(false, true, false, true)); final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//w w w . j av a2 s .c om public void buttonClick(final ClickEvent event) { BasicInfoChangeWindow.this.close(); } }); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { changeUserInfo(); } }); saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK); saveBtn.setIcon(FontAwesome.SAVE); hlayoutControls.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER); mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT); this.setModal(true); this.setContent(mainLayout); }
From source file:com.esofthead.mycollab.module.user.accountsettings.profile.view.ContactInfoChangeWindow.java
License:Open Source License
private void initUI() { final MVerticalLayout mainLayout = new MVerticalLayout() .withMargin(new MarginInfo(false, false, true, false)).withWidth("100%"); final GridFormLayoutHelper passInfo = new GridFormLayoutHelper(1, 6, "100%", "150px", Alignment.TOP_LEFT); passInfo.addComponent(txtWorkPhone, AppContext.getMessage(UserI18nEnum.FORM_WORK_PHONE), 0, 0); passInfo.addComponent(txtHomePhone, AppContext.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); this.txtWorkPhone.setValue(this.user.getWorkphone() == null ? "" : this.user.getWorkphone()); this.txtHomePhone.setValue(this.user.getHomephone() == null ? "" : this.user.getHomephone()); this.txtFaceBook.setValue(this.user.getFacebookaccount() == null ? "" : this.user.getFacebookaccount()); this.txtTwitter.setValue(this.user.getTwitteraccount() == null ? "" : this.user.getTwitteraccount()); this.txtSkype.setValue(this.user.getSkypecontact() == null ? "" : this.user.getSkypecontact()); passInfo.getLayout().setMargin(false); passInfo.getLayout().setWidth("100%"); passInfo.getLayout().addStyleName("colored-gridlayout"); mainLayout.addComponent(passInfo.getLayout()); mainLayout.setComponentAlignment(passInfo.getLayout(), Alignment.TOP_LEFT); final MHorizontalLayout hlayoutControls = new MHorizontalLayout() .withMargin(new MarginInfo(false, true, false, true)); final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from w w w. ja va 2 s . c o m public void buttonClick(final ClickEvent event) { ContactInfoChangeWindow.this.close(); } }); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { changeUserInfo(); } }); saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK); saveBtn.setIcon(FontAwesome.SAVE); hlayoutControls.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER); mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT); this.setModal(true); this.setContent(mainLayout); }
From source file:com.esofthead.mycollab.module.user.accountsettings.profile.view.PasswordChangeWindow.java
License:Open Source License
private void initUI() { final MVerticalLayout mainLayout = new MVerticalLayout().withWidth("100%"); final Label lbInstruct1 = new Label(AppContext.getMessage(UserI18nEnum.MSG_PASSWORD_INSTRUCT_LABEL_1)); mainLayout.addComponent(lbInstruct1); mainLayout.setComponentAlignment(lbInstruct1, Alignment.MIDDLE_LEFT); final Label lbInstruct2 = new Label(AppContext.getMessage(UserI18nEnum.MSG_PASSWORD_INSTRUCT_LABEL_2)); mainLayout.addComponent(lbInstruct2); mainLayout.setComponentAlignment(lbInstruct2, Alignment.MIDDLE_LEFT); final GridFormLayoutHelper passInfo = new GridFormLayoutHelper(1, 3, "300px", "180px"); txtNewPassword = new PasswordField(); passInfo.addComponent(txtNewPassword, "New Password", 0, 0); txtConfirmPassword = new PasswordField(); passInfo.addComponent(txtConfirmPassword, "Confirmed New Password", 0, 1); passInfo.getLayout().setSpacing(true); mainLayout.addComponent(passInfo.getLayout()); mainLayout.setComponentAlignment(passInfo.getLayout(), Alignment.MIDDLE_CENTER); final MHorizontalLayout hlayoutControls = new MHorizontalLayout().withMargin(true); final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from w w w .j av a2 s . c o m public void buttonClick(final ClickEvent event) { PasswordChangeWindow.this.close(); } }); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { PasswordChangeWindow.this.changePassword(); } }); saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK); saveBtn.setIcon(FontAwesome.SAVE); hlayoutControls.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER); mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT); this.setModal(true); this.setContent(mainLayout); }
From source file:com.esofthead.mycollab.module.user.accountsettings.profile.view.ProfileReadViewImpl.java
License:Open Source License
private void displayUserAvatar() { this.userAvatar.removeAllComponents(); final Image cropField = UserAvatarControlFactory .createUserAvatarEmbeddedComponent(AppContext.getUserAvatarId(), 100); userAvatar.addComponent(cropField);//from w ww .ja v a2 s .c o m this.avatarAndPass.removeAllComponents(); avatarAndPass.addComponent(userAvatar); User user = formItem.getUser(); final VerticalLayout basicLayout = new VerticalLayout(); basicLayout.setSpacing(true); final HorizontalLayout userWrapper = new HorizontalLayout(); final Label userName = new Label(AppContext.getSession().getDisplayName()); userName.setStyleName("h1"); userWrapper.addComponent(userName); final Button btnChangeBasicInfo = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { UI.getCurrent().addWindow(new BasicInfoChangeWindow(formItem.getUser())); } }); btnChangeBasicInfo.setStyleName("link"); HorizontalLayout btnChangeBasicInfoWrapper = new HorizontalLayout(); btnChangeBasicInfoWrapper.setWidth("40px"); btnChangeBasicInfoWrapper.addComponent(btnChangeBasicInfo); btnChangeBasicInfoWrapper.setComponentAlignment(btnChangeBasicInfo, Alignment.MIDDLE_RIGHT); userWrapper.addComponent(btnChangeBasicInfoWrapper); basicLayout.addComponent(userWrapper); basicLayout.setComponentAlignment(userWrapper, Alignment.MIDDLE_LEFT); basicLayout.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_BIRTHDAY) + ": " + AppContext.formatDate(user.getDateofbirth()))); basicLayout.addComponent( new MHorizontalLayout(new Label(AppContext.getMessage(UserI18nEnum.FORM_EMAIL) + ": "), new LabelLink(user.getEmail(), "mailto:" + user.getEmail()))); basicLayout.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_TIMEZONE) + ": " + TimezoneMapper.getTimezone(user.getTimezone()).getDisplayName())); basicLayout.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_LANGUAGE) + ": " + AppContext.getMessage(LangI18Enum.class, user.getLanguage()))); HorizontalLayout passwordWrapper = new HorizontalLayout(); passwordWrapper .addComponent(new Label(AppContext.getMessage(ShellI18nEnum.FORM_PASSWORD) + ": ***********")); final Button btnChangePassword = new Button("Change", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { UI.getCurrent().addWindow(new PasswordChangeWindow(formItem.user)); } }); btnChangePassword.setStyleName("link"); HorizontalLayout btnChangePasswordWrapper = new HorizontalLayout(); btnChangePasswordWrapper.setWidth("50px"); btnChangePasswordWrapper.addComponent(btnChangePassword); btnChangePasswordWrapper.setComponentAlignment(btnChangePassword, Alignment.MIDDLE_RIGHT); passwordWrapper.addComponent(btnChangePasswordWrapper); basicLayout.addComponent(passwordWrapper); basicLayout.setComponentAlignment(passwordWrapper, Alignment.MIDDLE_LEFT); avatarAndPass.addComponent(basicLayout); avatarAndPass.setComponentAlignment(basicLayout, Alignment.TOP_LEFT); avatarAndPass.setExpandRatio(basicLayout, 1.0f); final UploadField avatarUploadField = new UploadField() { private static final long serialVersionUID = 1L; @Override protected void updateDisplay() { byte[] imageData = (byte[]) this.getValue(); String mimeType = this.getLastMimeType(); if (mimeType.equals("image/jpeg")) { imageData = ImageUtil.convertJpgToPngFormat(imageData); if (imageData == null) { throw new UserInvalidInputException("Do not support image format for avatar"); } else { mimeType = "image/png"; } } if (mimeType.equals("image/png")) { EventBusFactory.getInstance() .post(new ProfileEvent.GotoUploadPhoto(ProfileReadViewImpl.this, imageData)); } else { throw new UserInvalidInputException( "Upload file does not have valid image format. The supported formats are jpg/png"); } } }; avatarUploadField.addStyleName("upload-field"); avatarUploadField.setButtonCaption(AppContext.getMessage(UserI18nEnum.BUTTON_CHANGE_AVATAR)); avatarUploadField.setSizeUndefined(); avatarUploadField.setFieldType(FieldType.BYTE_ARRAY); this.userAvatar.addComponent(avatarUploadField); }
From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.GetStartedInstructionWindow.java
License:Open Source License
private void displayInfo(SimpleUser user) { Div infoDiv = new Div().appendText( "You have not setup SMTP account properly. So we can not send the invitation by email automatically. Please copy/paste below paragraph and inform to the user by yourself") .setStyle("font-weight:bold;color:red"); Label infoLbl = new Label(infoDiv.write(), ContentMode.HTML); Div userInfoDiv = new Div().appendText("Your username is ") .appendChild(new B().appendText(user.getEmail())); Label userInfoLbl = new Label(userInfoDiv.write(), ContentMode.HTML); if (Boolean.TRUE.equals(user.getIsAccountOwner())) { user.setRoleName(AppContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER)); }//from w ww.j a va 2 s . co m Div roleInfoDiv = new Div().appendText("Your role is ").appendChild(new B().appendText(user.getRoleName())); Label roleInfoLbl = new Label(roleInfoDiv.write(), ContentMode.HTML); contentLayout.with(infoLbl, userInfoLbl, roleInfoLbl); final MHorizontalLayout controlsBtn = new MHorizontalLayout() .withMargin(new MarginInfo(true, true, true, false)); final Button addNewBtn = new Button("Create another user", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { EventBusFactory.getInstance().post(new UserEvent.GotoAdd(GetStartedInstructionWindow.this, null)); close(); } }); addNewBtn.setStyleName(UIConstants.BUTTON_ACTION); Button doneBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_DONE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { close(); } }); doneBtn.setStyleName(UIConstants.BUTTON_ACTION); controlsBtn.with(addNewBtn, doneBtn); contentLayout.with(controlsBtn).withAlign(controlsBtn, Alignment.MIDDLE_RIGHT); }