org.vaadin.viritin.fields.MTextField Java Examples
The following examples show how to use
org.vaadin.viritin.fields.MTextField.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProjectSearchPanel.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
@Override public ComponentContainer constructBody() { MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true); nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT)) .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH); basicSearchBody.with(nameField).withAlign(nameField, Alignment.MIDDLE_CENTER); MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction()).withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION) .withClickShortcut(ShortcutAction.KeyCode.ENTER); basicSearchBody.with(searchBtn).withAlign(searchBtn, Alignment.MIDDLE_LEFT); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR), clickEvent -> nameField.setValue("")).withStyleName(WebThemes.BUTTON_OPTION); basicSearchBody.with(cancelBtn).withAlign(cancelBtn, Alignment.MIDDLE_CENTER); MButton advancedSearchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADVANCED_SEARCH), clickEvent -> moveToAdvancedSearchLayout()).withStyleName(WebThemes.BUTTON_LINK); basicSearchBody.with(advancedSearchBtn).withAlign(advancedSearchBtn, Alignment.MIDDLE_CENTER); return basicSearchBody; }
Example #2
Source File: MessageListViewImpl.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
@Override protected SearchLayout<MessageSearchCriteria> createBasicSearchLayout() { return new BasicSearchLayout<MessageSearchCriteria>(MessageSearchPanel.this) { @Override public ComponentContainer constructBody() { nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT)) .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH); MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction()) .withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.SEARCH) .withClickShortcut(KeyCode.ENTER); return new MHorizontalLayout(nameField, searchBtn).withMargin(true).withAlign(nameField, Alignment.MIDDLE_LEFT); } @Override protected MessageSearchCriteria fillUpSearchCriteria() { MessageSearchCriteria criteria = new MessageSearchCriteria(); criteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId())); criteria.setMessage(StringSearchField.and(nameField.getValue())); return criteria; } }; }
Example #3
Source File: RoleSearchPanel.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
@Override public ComponentContainer constructBody() { MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true) .with(new Label(UserUIContext.getMessage(GenericI18Enum.FORM_NAME) + ":")); nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT)) .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH); basicSearchBody.addComponent(nameField); MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction()) .withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION) .withClickShortcut(ShortcutAction.KeyCode.ENTER); basicSearchBody.addComponent(searchBtn); MButton clearBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR), clickEvent -> nameField.setValue("")) .withStyleName(WebThemes.BUTTON_OPTION); basicSearchBody.addComponent(clearBtn); basicSearchBody.setComponentAlignment(clearBtn, Alignment.MIDDLE_LEFT); return basicSearchBody; }
Example #4
Source File: MilestoneEditFormFieldFactory.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
@Override protected HasValue<?> onCreateField(Object propertyId) { if (Milestone.Field.assignuser.equalTo(propertyId)) { return new ProjectMemberSelectionField(); } else if (propertyId.equals("status")) { return new ProgressStatusComboBox(); } else if (propertyId.equals("name")) { return new MTextField().withRequiredIndicatorVisible(true); } else if (propertyId.equals("description")) { return new RichTextArea(); } else if ("section-attachments".equals(propertyId)) { Milestone beanItem = attachForm.getBean(); if (beanItem.getId() != null) { String attachmentPath = AttachmentUtils.getProjectEntityAttachmentPath(AppUI.getAccountId(), beanItem.getProjectid(), ProjectTypeConstants.MILESTONE, "" + beanItem.getId()); attachmentUploadField = new AttachmentUploadField(attachmentPath); } else { attachmentUploadField = new AttachmentUploadField(); } return attachmentUploadField; } else if (Milestone.Field.startdate.equalTo(propertyId) || Milestone.Field.enddate.equalTo(propertyId)) { return new DateField(); } return null; }
Example #5
Source File: ProjectGeneralInfoStep.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
@Override protected HasValue<?> onCreateField(final Object propertyId) { if (Project.Field.description.equalTo(propertyId)) { return new RichTextArea(); } else if (Project.Field.status.equalTo(propertyId)) { ProjectStatusComboBox statusField = new ProjectStatusComboBox(); statusField.setRequiredIndicatorVisible(true); if (project.getStatus() == null) { project.setStatus(StatusI18nEnum.Open.name()); } return statusField; } else if (Project.Field.shortname.equalTo(propertyId)) { return new MTextField().withRequiredIndicatorVisible(true).withWidth(WebThemes.FORM_CONTROL_WIDTH); } else if (Project.Field.name.equalTo(propertyId)) { return new MTextField().withRequiredIndicatorVisible(true).withWidth(WebThemes.FORM_CONTROL_WIDTH); } else if (Project.Field.memlead.equalTo(propertyId)) { return new ActiveUserComboBox(); } else if (Project.Field.planstartdate.equalTo(propertyId) || Project.Field.planenddate.equalTo(propertyId)) { return new DateField(); } return null; }
Example #6
Source File: ProjectRoleAddViewImpl.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
@Override protected AbstractBeanFieldGroupEditFieldFactory<ProjectRole> initBeanFormFieldFactory() { return new AbstractBeanFieldGroupEditFieldFactory<ProjectRole>(editForm) { private static final long serialVersionUID = 1L; @Override protected HasValue<?> onCreateField(Object propertyId) { if (propertyId.equals("description")) { return new TextArea(); } else if (propertyId.equals("rolename")) { return new MTextField().withRequiredIndicatorVisible(true); } return null; } }; }
Example #7
Source File: VersionSearchPanel.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
@Override public ComponentContainer constructBody() { MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true); basicSearchBody.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label nameLbl = new Label("Name:"); basicSearchBody.with(nameLbl); nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT)) .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH); basicSearchBody.with(nameField); MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction()) .withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION) .withClickShortcut(ShortcutAction.KeyCode.ENTER); basicSearchBody.with(searchBtn); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR), clickEvent -> nameField.setValue("")) .withStyleName(WebThemes.BUTTON_OPTION); basicSearchBody.with(cancelBtn); return basicSearchBody; }
Example #8
Source File: ProjectRoleSearchPanel.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
@Override public ComponentContainer constructBody() { MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true); basicSearchBody.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); basicSearchBody.addComponent(new Label(UserUIContext.getMessage(GenericI18Enum.FORM_NAME) + ":")); nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT)) .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH); basicSearchBody.addComponent(nameField); MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction()) .withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION) .withClickShortcut(ShortcutAction.KeyCode.ENTER); basicSearchBody.addComponent(searchBtn); MButton clearBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR), clickEvent -> nameField.setValue("")) .withStyleName(WebThemes.BUTTON_OPTION); basicSearchBody.addComponent(clearBtn); return basicSearchBody; }
Example #9
Source File: ComponentSearchPanel.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
@Override public ComponentContainer constructBody() { MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true); basicSearchBody.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label nameLbl = new Label(UserUIContext.getMessage(GenericI18Enum.FORM_NAME) + ":"); basicSearchBody.with(nameLbl); nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT)) .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH); basicSearchBody.with(nameField); myItemCheckbox = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); basicSearchBody.with(myItemCheckbox); MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction()) .withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION) .withClickShortcut(ShortcutAction.KeyCode.ENTER); basicSearchBody.with(searchBtn); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR), clickEvent -> nameField.setValue("")) .withStyleName(WebThemes.BUTTON_OPTION); basicSearchBody.with(cancelBtn); return basicSearchBody; }
Example #10
Source File: UserAddViewImpl.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override protected HasValue<?> onCreateField(Object propertyId) { if (SimpleUser.Field.roleId.equalTo(propertyId)) { return new RoleSelectionField(); } else if (User.Field.username.equalTo(propertyId) || User.Field.firstname.equalTo(propertyId) || User.Field.lastname.equalTo(propertyId)) { return new MTextField().withWidth(WebThemes.FORM_CONTROL_WIDTH).withRequiredIndicatorVisible(true); } else if (User.Field.password.equalTo(propertyId)) { PasswordField field = new PasswordField(); field.setWidth(WebThemes.FORM_CONTROL_WIDTH); return field; } return null; }
Example #11
Source File: TaskSearchPanel.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override public ComponentContainer constructBody() { MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true); Label nameLbl = new Label(UserUIContext.getMessage(GenericI18Enum.FORM_NAME) + ":"); basicSearchBody.with(nameLbl).withAlign(nameLbl, Alignment.MIDDLE_LEFT); nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT)) .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH); basicSearchBody.with(nameField).withAlign(nameField, Alignment.MIDDLE_CENTER); myItemCheckbox = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); basicSearchBody.with(myItemCheckbox).withAlign(myItemCheckbox, Alignment.MIDDLE_CENTER); MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction()) .withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION) .withClickShortcut(ShortcutAction.KeyCode.ENTER); basicSearchBody.with(searchBtn).withAlign(searchBtn, Alignment.MIDDLE_LEFT); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR), clickEvent -> nameField.setValue("")) .withStyleName(WebThemes.BUTTON_OPTION); basicSearchBody.with(cancelBtn).withAlign(cancelBtn, Alignment.MIDDLE_CENTER); if (canSwitchToAdvanceLayout) { MButton advancedSearchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADVANCED_SEARCH), clickEvent -> moveToAdvancedSearchLayout()).withStyleName(WebThemes.BUTTON_LINK); basicSearchBody.with(advancedSearchBtn).withAlign(advancedSearchBtn, Alignment.MIDDLE_CENTER); } return basicSearchBody; }
Example #12
Source File: PageEditFormFieldFactory.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override protected HasValue<?> onCreateField(Object propertyId) { Page page = attachForm.getBean(); if (propertyId.equals("content")) { CKEditorConfig config = new CKEditorConfig(); config.useCompactTags(); config.setResizeDir(CKEditorConfig.RESIZE_DIR.HORIZONTAL); config.disableSpellChecker(); config.disableResizeEditor(); config.disableElementsPath(); config.setToolbarCanCollapse(true); config.setWidth("100%"); String appUrl = AppUI.getSiteUrl(); String params = String.format("path=%s&createdUser=%s&sAccountId=%d", page.getPath(), UserUIContext.getUsername(), AppUI.getAccountId()); if (appUrl.endsWith("/")) { config.setFilebrowserUploadUrl(String.format("%spage/upload?%s", appUrl, params)); } else { config.setFilebrowserUploadUrl(String.format("%s/page/upload?%s", appUrl, params)); } CKEditorTextField ckEditorTextField = new CKEditorTextField(config); ckEditorTextField.setHeight("450px"); ckEditorTextField.setRequiredIndicatorVisible(true); return ckEditorTextField; } else if (propertyId.equals("status")) { page.setStatus(WikiI18nEnum.status_public.name()); return new I18nValueComboBox<>(WikiI18nEnum.class, WikiI18nEnum.status_public, WikiI18nEnum.status_private, WikiI18nEnum.status_archieved).withWidth(WebThemes.FORM_CONTROL_WIDTH); } else if (propertyId.equals("subject")) { return new MTextField().withRequiredIndicatorVisible(true); } return null; }
Example #13
Source File: GroupPageAddWindow.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override protected HasValue<?> onCreateField(final Object propertyId) { if (propertyId.equals("description")) { return new RichTextArea(); } else if (propertyId.equals("name")) { return new MTextField().withRequiredIndicatorVisible(true); } return null; }
Example #14
Source File: MultiSelectComp.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
public MultiSelectComp(final String displayName, boolean canAddNew) { this.canAddNew = canAddNew; propertyDisplayField = displayName; componentsText = new MTextField().withReadOnly(true) .withStyleName("noBorderRight").withFullWidth(); componentPopupSelection = new PopupButton(); componentPopupSelection.addClickListener(clickEvent -> initContentPopup()); popupContent = new MVerticalLayout(); componentPopupSelection.setContent(popupContent); }
Example #15
Source File: UserAddViewImpl.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override protected HasValue<?> onCreateField(Object propertyId) { if (SimpleUser.Field.roleId.equalTo(propertyId)) { return new RoleSelectionField(); } else if (User.Field.username.equalTo(propertyId) || User.Field.firstname.equalTo(propertyId) || User.Field.lastname.equalTo(propertyId)) { return new MTextField().withWidth(WebThemes.FORM_CONTROL_WIDTH).withRequiredIndicatorVisible(true); } else if (User.Field.nickname.equalTo(propertyId) || User.Field.website.equalTo(propertyId) || User.Field.homephone.equalTo(propertyId) || User.Field.workphone.equalTo(propertyId) || User.Field.facebookaccount.equalTo(propertyId) || User.Field.twitteraccount.equalTo(propertyId) || User.Field.skypecontact.equalTo(propertyId) || User.Field.company.equalTo(propertyId)) { return new MTextField().withWidth(WebThemes.FORM_CONTROL_WIDTH); } else if (User.Field.birthday.equalTo(propertyId)) { return new DateField(); } else if (propertyId.equals("timezone")) { return new TimeZoneSelectionField(false); } else if (propertyId.equals("country")) { CountryComboBox cboCountry = new CountryComboBox(); cboCountry.addValueChangeListener(valueChangeEvent -> user.setCountry((String) cboCountry.getValue())); return cboCountry; } else if (User.Field.password.equalTo(propertyId)) { PasswordField field = new PasswordField(); field.setWidth(WebThemes.FORM_CONTROL_WIDTH); return field; } return null; }
Example #16
Source File: RoleAddViewImpl.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override protected HasValue<?> onCreateField(final Object propertyId) { if (Role.Field.description.equalTo(propertyId)) { return new RichTextArea(); } else if (Role.Field.rolename.equalTo(propertyId)) { return new MTextField().withRequiredIndicatorVisible(true); } else if (Role.Field.isdefault.equalTo(propertyId)) { return new CheckBox(); } return null; }
Example #17
Source File: TicketSearchPanel.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override public ComponentContainer constructBody() { MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true); Label nameLbl = new Label(UserUIContext.getMessage(GenericI18Enum.FORM_NAME) + ":"); basicSearchBody.with(nameLbl).withAlign(nameLbl, Alignment.MIDDLE_LEFT); nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT)) .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH); basicSearchBody.with(nameField).withAlign(nameField, Alignment.MIDDLE_CENTER); myItemCheckbox = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); basicSearchBody.with(myItemCheckbox).withAlign(myItemCheckbox, Alignment.MIDDLE_CENTER); MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction()) .withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION) .withClickShortcut(ShortcutAction.KeyCode.ENTER); basicSearchBody.with(searchBtn).withAlign(searchBtn, Alignment.MIDDLE_LEFT); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR), clickEvent -> nameField.setValue("")) .withStyleName(WebThemes.BUTTON_OPTION); basicSearchBody.with(cancelBtn).withAlign(cancelBtn, Alignment.MIDDLE_CENTER); if (canSwitchToAdvanceLayout) { MButton advancedSearchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADVANCED_SEARCH), clickEvent -> moveToAdvancedSearchLayout()).withStyleName(WebThemes.BUTTON_LINK); basicSearchBody.with(advancedSearchBtn).withAlign(advancedSearchBtn, Alignment.MIDDLE_CENTER); } return basicSearchBody; }
Example #18
Source File: VersionEditFormFieldFactory.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override protected HasValue<?> onCreateField(final Object propertyId) { if (Version.Field.name.equalTo(propertyId)) { return new MTextField().withRequiredIndicatorVisible(true); } else if (Version.Field.description.equalTo(propertyId)) { return new RichTextArea(); } else if (Version.Field.duedate.equalTo(propertyId)) { return new DateField(); } return null; }
Example #19
Source File: ComponentEditFormFieldFactory.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override protected HasValue<?> onCreateField(final Object propertyId) { if (Component.Field.name.equalTo(propertyId)) { final MTextField tf = new MTextField().withRequiredIndicatorVisible(true); // tf.setRequiredError(UserUIContext.getMessage(ErrorI18nEnum.FIELD_MUST_NOT_NULL, // UserUIContext.getMessage(GenericI18Enum.FORM_NAME))); return tf; } else if (Component.Field.description.equalTo(propertyId)) { return new RichTextArea(); } else if (Component.Field.userlead.equalTo(propertyId)) { return new ProjectMemberSelectionField(); } return null; }
Example #20
Source File: TicketCrossProjectsSearchPanel.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override public ComponentContainer constructBody() { MHorizontalLayout basicSearchBody = new MHorizontalLayout().withMargin(true); Label nameLbl = new Label(UserUIContext.getMessage(GenericI18Enum.FORM_NAME) + ":"); basicSearchBody.with(nameLbl).withAlign(nameLbl, Alignment.MIDDLE_LEFT); nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT)) .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH); basicSearchBody.with(nameField).withAlign(nameField, Alignment.MIDDLE_CENTER); myItemCheckbox = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); basicSearchBody.with(myItemCheckbox).withAlign(myItemCheckbox, Alignment.MIDDLE_CENTER); MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction()) .withIcon(VaadinIcons.SEARCH).withStyleName(WebThemes.BUTTON_ACTION) .withClickShortcut(ShortcutAction.KeyCode.ENTER); basicSearchBody.with(searchBtn).withAlign(searchBtn, Alignment.MIDDLE_LEFT); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR), clickEvent -> nameField.setValue("")) .withStyleName(WebThemes.BUTTON_OPTION); basicSearchBody.with(cancelBtn).withAlign(cancelBtn, Alignment.MIDDLE_CENTER); if (canSwitchToAdvanceLayout) { MButton advancedSearchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADVANCED_SEARCH), clickEvent -> moveToAdvancedSearchLayout()).withStyleName(WebThemes.BUTTON_LINK); basicSearchBody.with(advancedSearchBtn).withAlign(advancedSearchBtn, Alignment.MIDDLE_CENTER); } return basicSearchBody; }
Example #21
Source File: ProjectAddViewImpl.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override protected HasValue<?> onCreateField(final Object propertyId) { Project project = attachForm.getBean(); if (Project.Field.description.equalTo(propertyId)) { RichTextArea field = new RichTextArea(); field.setHeight("350px"); return field; } else if (Project.Field.status.equalTo(propertyId)) { final ProjectStatusComboBox statusSelection = new ProjectStatusComboBox(); statusSelection.setRequiredIndicatorVisible(true); statusSelection.setWidth(WebThemes.FORM_CONTROL_WIDTH); if (project.getStatus() == null) { project.setStatus(StatusI18nEnum.Open.name()); } return statusSelection; } else if (Project.Field.shortname.equalTo(propertyId)) { return new MTextField().withWidth(WebThemes.FORM_CONTROL_WIDTH).withRequiredIndicatorVisible(true); } else if (Project.Field.currencyid.equalTo(propertyId)) { return new CurrencyComboBoxField(); } else if (Project.Field.name.equalTo(propertyId)) { return new MTextField().withRequiredIndicatorVisible(true); } else if (Project.Field.clientid.equalTo(propertyId)) { return UIUtils.INSTANCE.getComponent("com.mycollab.pro.module.project.view.client.ClientSelectionField"); } else if (Project.Field.memlead.equalTo(propertyId)) { return new ProjectMemberSelectionField(); } else if (Project.Field.defaultbillingrate.equalTo(propertyId) || Project.Field.defaultovertimebillingrate.equalTo(propertyId) || Project.Field.targetbudget.equalTo(propertyId) || Project.Field.actualbudget.equalTo(propertyId)) { return new DoubleField().withWidth(WebThemes.FORM_CONTROL_WIDTH); } else if (Project.Field.planstartdate.equalTo(propertyId) || Project.Field.planenddate.equalTo(propertyId)) { return new DateField(); } return null; }
Example #22
Source File: TicketRelationSelectField.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override protected Component initContent() { ticketField = new MTextField().withReadOnly(true).withWidth(WebThemes.FORM_CONTROL_WIDTH); MHorizontalLayout layout = new MHorizontalLayout(); MButton browseBtn = new MButton(VaadinIcons.ELLIPSIS_H) .withListener(clickEvent -> UI.getCurrent().addWindow(new TicketSelectionWindow(TicketRelationSelectField.this))) .withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING); layout.with(ticketField, browseBtn); return layout; }
Example #23
Source File: BugEditFormFieldFactory.java From mycollab with GNU Affero General Public License v3.0 | 4 votes |
@Override protected HasValue<?> onCreateField(final Object propertyId) { final SimpleBug beanItem = attachForm.getBean(); if (BugWithBLOBs.Field.environment.equalTo(propertyId) || BugWithBLOBs.Field.description.equalTo(propertyId)) { return new RichTextArea(); } else if (propertyId.equals("priority")) { return new PriorityComboBox(); } else if (propertyId.equals("assignuser")) { ProjectMemberSelectionField field = new ProjectMemberSelectionField(); field.addValueChangeListener(valueChangeEvent -> { String username = valueChangeEvent.getValue(); if (username != null) { subscribersComp.addFollower(username); } }); return field; } else if ("section-attachments".equals(propertyId)) { if (beanItem.getId() != null) { String attachmentPath = AttachmentUtils.getProjectEntityAttachmentPath(AppUI.getAccountId(), beanItem.getProjectid(), ProjectTypeConstants.BUG, "" + beanItem.getId()); attachmentUploadField = new AttachmentUploadField(attachmentPath); } else { attachmentUploadField = new AttachmentUploadField(); } return attachmentUploadField; } else if (propertyId.equals("severity")) { return new BugSeverityComboBox(); } else if (propertyId.equals("components")) { componentSelect = new ComponentMultiSelectField(); return componentSelect; } else if (propertyId.equals("affectedVersions")) { affectedVersionSelect = new VersionMultiSelectField(); return affectedVersionSelect; } else if (propertyId.equals("fixedVersions")) { fixedVersionSelect = new VersionMultiSelectField(); return fixedVersionSelect; } else if (propertyId.equals("name")) { return new MTextField().withRequiredIndicatorVisible(true); } else if (propertyId.equals("milestoneid")) { return new MilestoneComboBox(); } else if (BugWithBLOBs.Field.originalestimate.equalTo(propertyId) || (BugWithBLOBs.Field.remainestimate.equalTo(propertyId))) { return new DoubleField().withWidth(WebThemes.FORM_CONTROL_WIDTH); } else if ("section-followers".equals(propertyId)) { return subscribersComp; } else if (BugWithBLOBs.Field.startdate.equalTo(propertyId) || BugWithBLOBs.Field.enddate.equalTo(propertyId) || BugWithBLOBs.Field.duedate.equalTo(propertyId)) { return new DateField(); } return null; }
Example #24
Source File: ToggleMilestoneSummaryField.java From mycollab with GNU Affero General Public License v3.0 | 4 votes |
ToggleMilestoneSummaryField(final SimpleMilestone milestone, int maxLength, boolean toggleStatusSupport, boolean isDeleteSupport) { this.milestone = milestone; this.maxLength = maxLength; this.setWidth("100%"); this.addStyleName("editable-field"); if (toggleStatusSupport && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) { toggleStatusSelect = new CheckBox(); toggleStatusSelect.setValue(milestone.isCompleted()); this.addComponent(toggleStatusSelect); this.addComponent(ELabel.EMPTY_SPACE()); displayTooltip(); toggleStatusSelect.addValueChangeListener(valueChangeEvent -> { if (milestone.isCompleted()) { milestone.setStatus(MilestoneStatus.InProgress.name()); titleLinkLbl.removeStyleName(WebThemes.LINK_COMPLETED); } else { milestone.setStatus(MilestoneStatus.Closed.name()); titleLinkLbl.addStyleName(WebThemes.LINK_COMPLETED); } displayTooltip(); MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class); milestoneService.updateSelectiveWithSession(milestone, UserUIContext.getUsername()); ProjectTicketSearchCriteria searchCriteria = new ProjectTicketSearchCriteria(); searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId())); searchCriteria.setTypes(new SetSearchField<>(ProjectTypeConstants.BUG, ProjectTypeConstants.RISK, ProjectTypeConstants.TASK)); searchCriteria.setMilestoneId(NumberSearchField.equal(milestone.getId())); searchCriteria.setOpen(new SearchField()); ProjectTicketService genericTaskService = AppContextUtil.getSpringBean(ProjectTicketService.class); int openAssignmentsCount = genericTaskService.getTotalCount(searchCriteria); if (openAssignmentsCount > 0) { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.OPT_QUESTION, AppUI.getSiteName()), UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_CLOSE_SUB_ASSIGNMENTS), UserUIContext.getMessage(GenericI18Enum.ACTION_YES), UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { genericTaskService.closeSubAssignmentOfMilestone(milestone.getId()); } }); } }); } titleLinkLbl = ELabel.h3(buildMilestoneLink()).withStyleName(WebThemes.LABEL_WORD_WRAP).withUndefinedWidth(); this.addComponent(titleLinkLbl); buttonControls = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true)).withStyleName("toggle"); if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) { MButton instantEditBtn = new MButton("", clickEvent -> { if (isRead) { ToggleMilestoneSummaryField.this.removeComponent(titleLinkLbl); ToggleMilestoneSummaryField.this.removeComponent(buttonControls); final MTextField editField = new MTextField(milestone.getName()).withFullWidth(); editField.focus(); ToggleMilestoneSummaryField.this.addComponent(editField); ToggleMilestoneSummaryField.this.removeStyleName("editable-field"); editField.addShortcutListener(new ShortcutListener("enter", ShortcutAction.KeyCode.ENTER, (int[]) null) { @Override public void handleAction(Object sender, Object target) { updateFieldValue(editField); } }); editField.addBlurListener(blurEvent -> updateFieldValue(editField)); isRead = !isRead; } }).withDescription(UserUIContext.getMessage(MilestoneI18nEnum.OPT_EDIT_PHASE_NAME)) .withIcon(VaadinIcons.EDIT).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); buttonControls.with(instantEditBtn); } if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.MILESTONES)) { MButton removeBtn = new MButton("", clickEvent -> { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, AppUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.ACTION_YES), UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { AppContextUtil.getSpringBean(MilestoneService.class).removeWithSession(milestone, UserUIContext.getUsername(), AppUI.getAccountId()); TicketRowRender rowRenderer = UIUtils.getRoot(ToggleMilestoneSummaryField.this, TicketRowRender.class); if (rowRenderer != null) { rowRenderer.selfRemoved(); } EventBusFactory.getInstance().post(new MilestoneEvent.MilestoneDeleted(this, milestone.getId())); } }); }).withIcon(VaadinIcons.TRASH).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); buttonControls.with(removeBtn); } if (buttonControls.getComponentCount() > 0) { this.addComponent(buttonControls); } }
Example #25
Source File: MessageListViewImpl.java From mycollab with GNU Affero General Public License v3.0 | 4 votes |
private void createAddMessageLayout() { isAddingMessage = true; MVerticalLayout newMessageLayout = new MVerticalLayout().withWidth("800px"); GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN); TextField titleField = new MTextField().withFullWidth().withRequiredIndicatorVisible(true); gridFormLayoutHelper.addComponent(titleField, UserUIContext.getMessage(MessageI18nEnum.FORM_TITLE), 0, 0); RichTextArea descField = new RichTextArea(); descField.setWidth("100%"); descField.setHeight("200px"); gridFormLayoutHelper.addComponent(descField, UserUIContext.getMessage(GenericI18Enum.FORM_DESCRIPTION), 0, 1); newMessageLayout.with(gridFormLayoutHelper.getLayout()); AttachmentPanel attachmentPanel = new AttachmentPanel(); CheckBox chkIsStick = new CheckBox(UserUIContext.getMessage(MessageI18nEnum.FORM_IS_STICK)); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> { bodyLayout.removeComponent(newMessageLayout); isAddingMessage = false; }) .withStyleName(WebThemes.BUTTON_OPTION); MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_POST), clickEvent -> { Message message = new Message(); message.setProjectid(CurrentProjectVariables.getProjectId()); if (!titleField.getValue().trim().equals("")) { message.setTitle(titleField.getValue()); message.setMessage(descField.getValue()); message.setCreateduser(UserUIContext.getUsername()); message.setSaccountid(AppUI.getAccountId()); message.setIsstick(chkIsStick.getValue()); MessageService messageService = AppContextUtil.getSpringBean(MessageService.class); messageService.saveWithSession(message, UserUIContext.getUsername()); bodyLayout.removeComponent(newMessageLayout); isAddingMessage = false; searchPanel.notifySearchHandler(searchCriteria); String attachmentPath = AttachmentUtils.getProjectEntityAttachmentPath( AppUI.getAccountId(), message.getProjectid(), ProjectTypeConstants.MESSAGE, "" + message.getId()); attachmentPanel.saveContentsToRepo(attachmentPath); } else { titleField.addStyleName("errorField"); NotificationUtil.showErrorNotification(UserUIContext.getMessage(ErrorI18nEnum.FIELD_MUST_NOT_NULL, UserUIContext.getMessage(MessageI18nEnum.FORM_TITLE))); } }).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION) .withClickShortcut(KeyCode.ENTER); MHorizontalLayout controlLayout = new MHorizontalLayout(chkIsStick, cancelBtn, saveBtn).alignAll(Alignment.MIDDLE_CENTER); newMessageLayout.with(attachmentPanel, controlLayout).withAlign(controlLayout, Alignment.MIDDLE_RIGHT); bodyLayout.addComponent(newMessageLayout, 0); }
Example #26
Source File: MailFormWindow.java From mycollab with GNU Affero General Public License v3.0 | 4 votes |
private void initUI() { MVerticalLayout mainLayout = new MVerticalLayout().withFullWidth(); inputLayout = new GridLayout(3, 4); inputLayout.setSpacing(true); inputLayout.setWidth("100%"); inputLayout.setColumnExpandRatio(0, 1.0f); mainLayout.addComponent(inputLayout); tokenFieldMailTo = new EmailTokenField(); inputLayout.addComponent(createTextFieldMailWithHelp("To:", tokenFieldMailTo), 0, 0); if (mails != null) { mails.stream().filter(mail -> mail.indexOf("<") > 0).map(mail -> { String strMail = mail.substring(mail.indexOf("<") + 1, mail.lastIndexOf(">")); if (strMail != null && !strMail.equalsIgnoreCase("null")) { return strMail; } else { return ""; } }); } final MTextField subject = new MTextField().withRequiredIndicatorVisible(true).withFullWidth(); subjectField = createTextFieldMail("Subject:", subject); inputLayout.addComponent(subjectField, 0, 1); initButtonLinkCcBcc(); ccField = createTextFieldMailWithHelp("Cc:", tokenFieldMailCc); bccField = createTextFieldMailWithHelp("Bcc:", tokenFieldMailBcc); final RichTextArea noteArea = new RichTextArea(); noteArea.setWidth("100%"); noteArea.setHeight("200px"); mainLayout.addComponent(noteArea); mainLayout.setComponentAlignment(noteArea, Alignment.MIDDLE_CENTER); final AttachmentPanel attachments = new AttachmentPanel(); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()) .withStyleName(WebThemes.BUTTON_OPTION); MButton sendBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_SEND_EMAIL), clickEvent -> { if (tokenFieldMailTo.getListRecipients().size() <= 0 || subject.getValue().equals("")) { NotificationUtil.showErrorNotification("To Email field and Subject field must be not empty! Please fulfil them before sending email."); return; } if (UserUIContext.getUser().getEmail() != null && UserUIContext.getUser().getEmail().length() > 0) { ExtMailService systemMailService = AppContextUtil.getSpringBean(ExtMailService.class); List<File> files = attachments.files(); List<AttachmentSource> attachmentSource = new ArrayList<>(); if (CollectionUtils.isNotEmpty(files)) { files.forEach(file -> attachmentSource.add(new FileAttachmentSource(file))); } if (reportTemplateExecutor != null) { attachmentSource.add(new FileAttachmentSource(reportTemplateExecutor.getDefaultExportFileName(), reportTemplateExecutor.exportStream())); } systemMailService.sendHTMLMail(UserUIContext.getUser().getEmail(), UserUIContext.getUser().getDisplayName(), tokenFieldMailTo.getListRecipients(), tokenFieldMailCc.getListRecipients(), tokenFieldMailBcc.getListRecipients(), subject.getValue(), noteArea.getValue(), attachmentSource, true); close(); } else { NotificationUtil.showErrorNotification("Your email is empty value, please fulfil it before sending email!"); } }).withIcon(VaadinIcons.PAPERPLANE).withStyleName(WebThemes.BUTTON_ACTION); MHorizontalLayout controlsLayout = new MHorizontalLayout(cancelBtn, sendBtn) .withMargin(new MarginInfo(false, true, true, false)); mainLayout.with(attachments); mainLayout.addStyleName(WebThemes.SCROLLABLE_CONTAINER); this.setContent(new MVerticalLayout(mainLayout, controlsLayout).withMargin(false) .withSpacing(false).withAlign(controlsLayout, Alignment.TOP_RIGHT)); }