List of usage examples for com.vaadin.server FontAwesome SAVE
FontAwesome SAVE
To view the source code for com.vaadin.server FontAwesome SAVE.
Click Source Link
From source file:com.ies.schoolos.ui.mobile.info.layout.PersonalLayout.java
private void spouseGroup() { spouseGroup = new VerticalComponentGroup(); spouseGroup.setSizeUndefined();// w ww . j ava 2 s.c om addTab(spouseGroup, "", FontAwesome.USER); sPeopleIdType = new OptionGroup("", new PeopleIdType()); sPeopleIdType.setItemCaptionPropertyId("name"); sPeopleIdType.setImmediate(true); sPeopleIdType.setNullSelectionAllowed(false); sPeopleIdType.setWidth("-1px"); sPeopleIdType.setHeight("-1px"); spouseGroup.addComponent(sPeopleIdType); sPeopleid = new TextField(""); sPeopleid.setInputPrompt(""); sPeopleid.setImmediate(false); sPeopleid.setWidth("-1px"); sPeopleid.setHeight("-1px"); sPeopleid.setNullRepresentation(""); //sPeopleid.addValidator(new StringLengthValidator("?", 13, 20, true)); sPeopleid.addTextChangeListener(new TextChangeListener() { private static final long serialVersionUID = 1L; @Override public void textChange(TextChangeEvent event) { if (event.getText() != null) { if (event.getText().length() >= 13) { fSqlContainer.addContainerFilter(new Equal(FamilySchema.PEOPLE_ID, event.getText())); if (fSqlContainer.size() > 0) { Item item = fSqlContainer.getItem(fSqlContainer.getIdByIndex(0)); spouseBinder.setItemDataSource(item); pkStore[2] = item.getItemProperty(FamilySchema.FAMILY_ID).getValue(); spouseBinder.setEnabled(false); isDuplicateSpouse = true; } fSqlContainer.removeAllContainerFilters(); } } } }); spouseGroup.addComponent(sPeopleid); sPrename = new NativeSelect("", new Prename()); //sPrename.setInputPrompt("??"); sPrename.setItemCaptionPropertyId("name"); sPrename.setImmediate(true); sPrename.setNullSelectionAllowed(false); sPrename.setRequired(true); sPrename.setWidth("-1px"); sPrename.setHeight("-1px"); //sPrename.setFilteringMode(FilteringMode.CONTAINS); spouseGroup.addComponent(sPrename); sFirstname = new TextField(""); sFirstname.setInputPrompt(""); sFirstname.setImmediate(false); sFirstname.setRequired(true); sFirstname.setWidth("-1px"); sFirstname.setHeight("-1px"); sFirstname.setNullRepresentation(""); spouseGroup.addComponent(sFirstname); sLastname = new TextField("?"); sLastname.setInputPrompt("?"); sLastname.setImmediate(false); sLastname.setRequired(true); sLastname.setWidth("-1px"); sLastname.setHeight("-1px"); sLastname.setNullRepresentation(""); spouseGroup.addComponent(sLastname); sFirstnameNd = new TextField("?"); sFirstnameNd.setInputPrompt("?"); sFirstnameNd.setImmediate(false); sFirstnameNd.setWidth("-1px"); sFirstnameNd.setHeight("-1px"); sFirstnameNd.setNullRepresentation(""); spouseGroup.addComponent(sFirstnameNd); sLastnameNd = new TextField("??"); sLastnameNd.setInputPrompt("??"); sLastnameNd.setImmediate(false); sLastnameNd.setWidth("-1px"); sLastnameNd.setHeight("-1px"); sLastnameNd.setNullRepresentation(""); spouseGroup.addComponent(sLastnameNd); sGender = new OptionGroup("", new Gender()); sGender.setItemCaptionPropertyId("name"); sGender.setImmediate(true); sGender.setNullSelectionAllowed(false); sGender.setRequired(true); sGender.setWidth("-1px"); sGender.setHeight("-1px"); spouseGroup.addComponent(sGender); sReligion = new NativeSelect("", new Religion()); //sReligion.setInputPrompt("??"); sReligion.setItemCaptionPropertyId("name"); sReligion.setImmediate(true); sReligion.setNullSelectionAllowed(false); sReligion.setRequired(true); sReligion.setWidth("-1px"); sReligion.setHeight("-1px"); //sReligion.setFilteringMode(FilteringMode.CONTAINS); spouseGroup.addComponent(sReligion); sRace = new NativeSelect("", new Race()); //sRace.setInputPrompt("??"); sRace.setItemCaptionPropertyId("name"); sRace.setImmediate(true); sRace.setNullSelectionAllowed(false); sRace.setRequired(true); sRace.setWidth("-1px"); sRace.setHeight("-1px"); //sRace.setFilteringMode(FilteringMode.CONTAINS); spouseGroup.addComponent(sRace); sNationality = new NativeSelect("?", new Nationality()); //sNationality.setInputPrompt("??"); sNationality.setItemCaptionPropertyId("name"); sNationality.setImmediate(true); sNationality.setNullSelectionAllowed(false); sNationality.setRequired(true); sNationality.setWidth("-1px"); sNationality.setHeight("-1px"); //sNationality.setFilteringMode(FilteringMode.CONTAINS); spouseGroup.addComponent(sNationality); sBirthDate = new PopupDateField(" ?"); sBirthDate.setInputPrompt("//"); sBirthDate.setImmediate(false); sBirthDate.setWidth("-1px"); sBirthDate.setHeight("-1px"); sBirthDate.setDateFormat("dd/MM/yyyy"); sBirthDate.setLocale(new Locale("th", "TH")); spouseGroup.addComponent(sBirthDate); sTel = new TextField(""); sTel.setInputPrompt(""); sTel.setImmediate(false); sTel.setWidth("-1px"); sTel.setHeight("-1px"); sTel.setNullRepresentation(""); spouseGroup.addComponent(sTel); sMobile = new TextField(""); sMobile.setInputPrompt(""); sMobile.setImmediate(false); sMobile.setWidth("-1px"); sMobile.setHeight("-1px"); sMobile.setNullRepresentation(""); spouseGroup.addComponent(sMobile); sEmail = new TextField(""); sEmail.setInputPrompt(""); sEmail.setImmediate(false); sEmail.setWidth("-1px"); sEmail.setHeight("-1px"); sEmail.setNullRepresentation(""); sEmail.addValidator(new EmailValidator("?")); spouseGroup.addComponent(sEmail); sSalary = new NumberField(""); sSalary.setInputPrompt(""); sSalary.setImmediate(false); sSalary.setWidth("-1px"); sSalary.setHeight("-1px"); sSalary.setNullRepresentation(""); spouseGroup.addComponent(sSalary); sAliveStatus = new NativeSelect("", new AliveStatus()); //sAliveStatus.setInputPrompt("??"); sAliveStatus.setItemCaptionPropertyId("name"); sAliveStatus.setImmediate(true); sAliveStatus.setNullSelectionAllowed(false); sAliveStatus.setRequired(true); sAliveStatus.setWidth("-1px"); sAliveStatus.setHeight("-1px"); //sAliveStatus.setFilteringMode(FilteringMode.CONTAINS); spouseGroup.addComponent(sAliveStatus); sOccupation = new NativeSelect("", new Occupation()); //sOccupation.setInputPrompt("??"); sOccupation.setItemCaptionPropertyId("name"); sOccupation.setImmediate(true); sOccupation.setNullSelectionAllowed(false); sOccupation.setRequired(true); sOccupation.setWidth("-1px"); sOccupation.setHeight("-1px"); //sOccupation.setFilteringMode(FilteringMode.CONTAINS); spouseGroup.addComponent(sOccupation); sJobAddress = new TextArea(""); sJobAddress.setInputPrompt(" "); sJobAddress.setImmediate(false); sJobAddress.setWidth("-1px"); sJobAddress.setHeight("-1px"); sJobAddress.setNullRepresentation(""); spouseGroup.addComponent(sJobAddress); sCurrentAddress = new TextArea(""); sCurrentAddress.setInputPrompt(" "); sCurrentAddress.setImmediate(false); sCurrentAddress.setWidth("-1px"); sCurrentAddress.setHeight("-1px"); sCurrentAddress.setNullRepresentation(""); spouseGroup.addComponent(sCurrentAddress); sCurrentProvinceId = new NativeSelect("", new Province()); //sCurrentProvinceId.setInputPrompt("??"); sCurrentProvinceId.setItemCaptionPropertyId("name"); sCurrentProvinceId.setImmediate(true); sCurrentProvinceId.setNullSelectionAllowed(false); sCurrentProvinceId.setWidth("-1px"); sCurrentProvinceId.setHeight("-1px"); //sCurrentProvinceId.setFilteringMode(FilteringMode.CONTAINS); sCurrentProvinceId.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { if (event.getProperty().getValue() != null) sCurrentDistrict.setContainerDataSource( new District(Integer.parseInt(event.getProperty().getValue().toString()))); } }); spouseGroup.addComponent(sCurrentProvinceId); sCurrentDistrict = new NativeSelect("", new Blood()); //sCurrentDistrict.setInputPrompt("??"); sCurrentDistrict.setItemCaptionPropertyId("name"); sCurrentDistrict.setImmediate(true); sCurrentDistrict.setNullSelectionAllowed(false); sCurrentDistrict.setWidth("-1px"); sCurrentDistrict.setHeight("-1px"); //sCurrentDistrict.setFilteringMode(FilteringMode.CONTAINS); sCurrentDistrict.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { if (event.getProperty().getValue() != null) { sCurrentCity.setContainerDataSource( new City(Integer.parseInt(event.getProperty().getValue().toString()))); sCurrentPostcode.setContainerDataSource( new Postcode(Integer.parseInt(event.getProperty().getValue().toString()))); } } }); spouseGroup.addComponent(sCurrentDistrict); sCurrentCity = new NativeSelect(""); //sCurrentCity.setInputPrompt("??"); sCurrentCity.setItemCaptionPropertyId("name"); sCurrentCity.setImmediate(true); sCurrentCity.setNullSelectionAllowed(false); sCurrentCity.setWidth("-1px"); sCurrentCity.setHeight("-1px"); //sCurrentCity.setFilteringMode(FilteringMode.CONTAINS); spouseGroup.addComponent(sCurrentCity); sCurrentPostcode = new NativeSelect(""); //sCurrentPostcode.setInputPrompt("??"); sCurrentPostcode.setItemCaptionPropertyId("name"); sCurrentPostcode.setImmediate(true); sCurrentPostcode.setNullSelectionAllowed(false); sCurrentPostcode.setWidth("-1px"); sCurrentPostcode.setHeight("-1px"); //sCurrentPostcode.setFilteringMode(FilteringMode.CONTAINS); spouseGroup.addComponent(sCurrentPostcode); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); buttonLayout.setWidth("100%"); spouseGroup.addComponent(buttonLayout); motherBack = new Button(FontAwesome.ARROW_LEFT); motherBack.setWidth("100%"); motherBack.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { setSelectedTab(motherGroup); } }); buttonLayout.addComponents(motherBack); finish = new Button("?", FontAwesome.SAVE); finish.setWidth("100%"); buttonLayout.addComponents(finish); print = new Button("", FontAwesome.PRINT); print.setVisible(false); print.setWidth("100%"); buttonLayout.addComponents(print); }
From source file:com.moscaville.ui.CsvVaadinUI.java
private void buildTemplateGridHeader() { HorizontalLayout templateGridHeaderLayout = new HorizontalLayout(); templateGridHeaderLayout.setSpacing(true); templateGridHeaderLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); Button btnNew = new Button("New", FontAwesome.FILE); btnNew.setDescription("New template file"); btnNew.addClickListener((Button.ClickEvent event) -> { templateManager.newTemplate();/*www . ja va 2s . c om*/ }); templateGridHeaderLayout.addComponent(btnNew); Button btnOpen = new Button("Open", FontAwesome.FILE_O); btnOpen.setDescription("Open template file"); btnOpen.addClickListener((Button.ClickEvent event) -> { fileChooser.setFileExtension(FileChooser.FILE_EXTENSION_TEMPLATE); addWindow(fileChooser); }); templateGridHeaderLayout.addComponent(btnOpen); Button btnSave = new Button("Save", FontAwesome.SAVE); tfTemplateFileName = new TextField(); tfTemplateFileName.setDescription("template file name"); tfTemplateFileName.setInputPrompt("template file name"); tfTemplateFileName.setImmediate(true); tfTemplateFileName.addValueChangeListener((Property.ValueChangeEvent event) -> { btnSave.setEnabled(tfTemplateFileName.getValue() != null && tfTemplateFileName.getValue().length() > 0); }); templateGridHeaderLayout.addComponent(tfTemplateFileName); FieldGroup binder = new FieldGroup(templateManager.getTemplateBeanItem()); binder.setBuffered(false); binder.bind(tfTemplateFileName, "templateFileName"); btnSave.setDescription("Save template file"); btnSave.setImmediate(true); btnSave.setEnabled(false); btnSave.addClickListener((Button.ClickEvent event) -> { templateManager.saveTemplate(); }); templateGridHeaderLayout.addComponent(btnSave); Button btnData = new Button("Data", FontAwesome.DATABASE); btnData.setDescription("Load data"); btnData.addClickListener((Button.ClickEvent event) -> { fileChooser.setFileExtension(FileChooser.FILE_EXTENSION_CSV); addWindow(fileChooser); }); templateGridHeaderLayout.addComponent(btnData); Button btnImport = new Button("Import", FontAwesome.DOWNLOAD); templateGridHeaderLayout.addComponent(btnImport); mainLayout.addComponent(templateGridHeaderLayout); }
From source file:com.mycollab.community.module.project.view.ProjectAddWindow.java
License:Open Source License
public ProjectAddWindow() { super(new Project()); MVerticalLayout contentLayout = new MVerticalLayout().withSpacing(false) .withMargin(new MarginInfo(false, false, true, false)); setContent(contentLayout);/*from w ww . ja v a 2 s.c o m*/ projectInfo = new ProjectGeneralInfoStep(project); contentLayout.addComponent(projectInfo.getContent()); MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> { boolean isValid = projectInfo.commit(); if (isValid) { ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.class); project.setSaccountid(MyCollabUI.getAccountId()); projectService.saveWithSession(project, UserUIContext.getUsername()); EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, new PageActionChain(new ProjectScreenData.Goto(project.getId())))); 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, saveBtn) .withMargin(new MarginInfo(true, true, false, false)); contentLayout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT); }
From source file:com.mycollab.module.crm.view.opportunity.ContactRoleEditViewImpl.java
License:Open Source License
private ComponentContainer createButtonControls() { MButton updateBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), clickEvent -> updateContactRoles()).withIcon(FontAwesome.SAVE) .withStyleName(WebThemes.BUTTON_ACTION); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> EventBusFactory.getInstance().post(new ContactEvent.GotoList(this, null))) .withIcon(FontAwesome.TIMES).withStyleName(WebThemes.BUTTON_OPTION); return new MHorizontalLayout(cancelBtn, updateBtn); }
From source file:com.mycollab.module.project.view.kanban.AddNewColumnWindow.java
License:Open Source License
public AddNewColumnWindow(final IKanbanView kanbanView, final String type, final String fieldGroup) { super(UserUIContext.getMessage(TaskI18nEnum.ACTION_NEW_COLUMN)); this.withModal(true).withResizable(false).withWidth("800px").withCenter(); MVerticalLayout layout = new MVerticalLayout().withMargin(new MarginInfo(false, false, true, false)); GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(1, 4); this.setContent(layout); final TextField stageField = new TextField(); final CheckBox defaultProject = new CheckBox(); defaultProject.setVisible(UserUIContext.canBeYes(RolePermissionCollections.GLOBAL_PROJECT_SETTINGS)); final ColorPicker colorPicker = new ColorPicker("", new com.vaadin.shared.ui.colorpicker.Color( DEFAULT_COLOR.getRed(), DEFAULT_COLOR.getGreen(), DEFAULT_COLOR.getBlue())); final TextArea description = new TextArea(); gridFormLayoutHelper.addComponent(stageField, UserUIContext.getMessage(GenericI18Enum.FORM_NAME), 0, 0); gridFormLayoutHelper.addComponent(defaultProject, UserUIContext.getMessage(TaskI18nEnum.FORM_COLUMN_DEFAULT_FOR_NEW_PROJECT), 0, 1); gridFormLayoutHelper.addComponent(colorPicker, UserUIContext.getMessage(TaskI18nEnum.FORM_COLUMN_COLOR), 0, 2);// w w w. ja va 2s. c o m gridFormLayoutHelper.addComponent(description, UserUIContext.getMessage(GenericI18Enum.FORM_DESCRIPTION), 0, 3); MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> { OptionVal optionVal = new OptionVal(); optionVal.setCreatedtime(new GregorianCalendar().getTime()); optionVal.setCreateduser(UserUIContext.getUsername()); optionVal.setDescription(description.getValue()); com.vaadin.shared.ui.colorpicker.Color color = colorPicker.getColor(); String cssColor = color.getCSS(); if (cssColor.startsWith("#")) { cssColor = cssColor.substring(1); } optionVal.setColor(cssColor); if (defaultProject.getValue()) { optionVal.setIsdefault(true); } else { optionVal.setIsdefault(false); optionVal.setExtraid(CurrentProjectVariables.getProjectId()); } optionVal.setSaccountid(MyCollabUI.getAccountId()); optionVal.setType(type); optionVal.setTypeval(stageField.getValue()); optionVal.setFieldgroup(fieldGroup); OptionValService optionService = AppContextUtil.getSpringBean(OptionValService.class); int optionValId = optionService.saveWithSession(optionVal, UserUIContext.getUsername()); if (optionVal.getIsdefault()) { optionVal.setId(null); optionVal.setIsdefault(false); optionVal.setRefoption(optionValId); optionVal.setExtraid(CurrentProjectVariables.getProjectId()); optionService.saveWithSession(optionVal, UserUIContext.getUsername()); } kanbanView.addColumn(optionVal); close(); }).withIcon(FontAwesome.SAVE).withStyleName(WebThemes.BUTTON_ACTION); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION); MHorizontalLayout controls = new MHorizontalLayout().with(cancelBtn, saveBtn) .withMargin(new MarginInfo(false, true, false, false)); layout.with(gridFormLayoutHelper.getLayout(), controls).withAlign(controls, Alignment.BOTTOM_RIGHT); }
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 {/* w ww .j a v a2 s. c o 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.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 a v a2 s .c o 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.settings.component.NotificationSettingWindow.java
License:Open Source License
public NotificationSettingWindow(SimpleProjectMember projectMember) { super(UserUIContext.getMessage(ProjectCommonI18nEnum.ACTION_EDIT_NOTIFICATION)); withModal(true).withResizable(false).withWidth("600px").withCenter(); ProjectNotificationSettingService prjNotificationSettingService = AppContextUtil .getSpringBean(ProjectNotificationSettingService.class); ProjectNotificationSetting notification = prjNotificationSettingService.findNotification( projectMember.getUsername(), projectMember.getProjectid(), projectMember.getSaccountid()); MVerticalLayout body = new MVerticalLayout(); final OptionGroup optionGroup = new OptionGroup(null); optionGroup.setItemCaptionMode(AbstractSelect.ItemCaptionMode.EXPLICIT); optionGroup.addItem(NotificationType.Default.name()); optionGroup.setItemCaption(NotificationType.Default.name(), UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_DEFAULT_SETTING)); optionGroup.addItem(NotificationType.None.name()); optionGroup.setItemCaption(NotificationType.None.name(), UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_NONE_SETTING)); optionGroup.addItem(NotificationType.Minimal.name()); optionGroup.setItemCaption(NotificationType.Minimal.name(), UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_MINIMUM_SETTING)); optionGroup.addItem(NotificationType.Full.name()); optionGroup.setItemCaption(NotificationType.Full.name(), UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_MAXIMUM_SETTING)); optionGroup.setWidth("100%"); body.with(optionGroup).withAlign(optionGroup, Alignment.MIDDLE_LEFT); String levelVal = notification.getLevel(); if (levelVal == null) { optionGroup.select(NotificationType.Default.name()); } else {/* w w w . j a va 2 s .com*/ optionGroup.select(levelVal); } MButton closeBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLOSE), clickEvent -> close()) .withStyleName(WebThemes.BUTTON_OPTION); MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> { try { notification.setLevel((String) optionGroup.getValue()); ProjectNotificationSettingService projectNotificationSettingService = AppContextUtil .getSpringBean(ProjectNotificationSettingService.class); if (notification.getId() == null) { projectNotificationSettingService.saveWithSession(notification, UserUIContext.getUsername()); } else { projectNotificationSettingService.updateWithSession(notification, UserUIContext.getUsername()); } NotificationUtil.showNotification(UserUIContext.getMessage(GenericI18Enum.OPT_CONGRATS), UserUIContext.getMessage(ProjectSettingI18nEnum.DIALOG_UPDATE_SUCCESS)); close(); } catch (Exception e) { throw new MyCollabException(e); } }).withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.SAVE); MHorizontalLayout btnControls = new MHorizontalLayout(closeBtn, saveBtn); body.with(btnControls).withAlign(btnControls, Alignment.TOP_RIGHT); withContent(body); }
From source file:com.mycollab.module.project.view.settings.ProjectNotificationSettingViewComponent.java
License:Open Source License
public ProjectNotificationSettingViewComponent(final ProjectNotificationSetting bean) { super(UserUIContext.getMessage(ProjectSettingI18nEnum.VIEW_TITLE)); MVerticalLayout body = new MVerticalLayout().withMargin(new MarginInfo(true, false, false, false)); body.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); final OptionGroup optionGroup = new OptionGroup(null); optionGroup.setItemCaptionMode(ItemCaptionMode.EXPLICIT); optionGroup.addItem(NotificationType.Default.name()); optionGroup.setItemCaption(NotificationType.Default.name(), UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_DEFAULT_SETTING)); optionGroup.addItem(NotificationType.None.name()); optionGroup.setItemCaption(NotificationType.None.name(), UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_NONE_SETTING)); optionGroup.addItem(NotificationType.Minimal.name()); optionGroup.setItemCaption(NotificationType.Minimal.name(), UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_MINIMUM_SETTING)); optionGroup.addItem(NotificationType.Full.name()); optionGroup.setItemCaption(NotificationType.Full.name(), UserUIContext.getMessage(ProjectSettingI18nEnum.OPT_MAXIMUM_SETTING)); optionGroup.setWidth("100%"); body.with(optionGroup);//from w w w . j a v a 2 s . co m String levelVal = bean.getLevel(); if (levelVal == null) { optionGroup.select(NotificationType.Default.name()); } else { optionGroup.select(levelVal); } MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> { try { bean.setLevel((String) optionGroup.getValue()); ProjectNotificationSettingService projectNotificationSettingService = AppContextUtil .getSpringBean(ProjectNotificationSettingService.class); if (bean.getId() == null) { projectNotificationSettingService.saveWithSession(bean, UserUIContext.getUsername()); } else { projectNotificationSettingService.updateWithSession(bean, UserUIContext.getUsername()); } NotificationUtil.showNotification(UserUIContext.getMessage(GenericI18Enum.OPT_CONGRATS), UserUIContext.getMessage(ProjectSettingI18nEnum.DIALOG_UPDATE_SUCCESS)); } catch (Exception e) { throw new MyCollabException(e); } }).withIcon(FontAwesome.SAVE).withStyleName(WebThemes.BUTTON_ACTION); body.addComponent(saveBtn); this.addComponent(body); }
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//from w ww . java 2 s .c o m 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); }