List of usage examples for com.vaadin.ui TextField getValue
@Override
public String getValue()
From source file:com.lizardtech.expresszip.vaadin.ExportOptionsViewComponent.java
License:Apache License
private void constrainTileDimension(TextField f, int constraint) { int v = -1;/* ww w. j a v a 2s .co m*/ if (f.getValue() != null) { try { v = Integer.parseInt((String) f.getValue()); } catch (NumberFormatException e) { } } if (f.getValue() == null || v > constraint || v < 1) f.setValue(Integer.toString(constraint)); }
From source file:com.logviewer.ui.dialog.FilterLog.java
License:Open Source License
private com.vaadin.ui.Component buildContetDialog() { final TextField txtFilter = new TextField() { {/*from w w w . ja va 2 s . c o m*/ setWidth(100, Unit.PERCENTAGE); } }; table = new Table(""); table.addStyleName("small compact"); table.setSizeFull(); table.setImmediate(true); table.setSelectable(true); table.setEditable(false); table.addContainerProperty("Filter", String.class, null); loadTable(); VerticalLayout panelContent = new VerticalLayout(); panelContent.setSpacing(true); panelContent.setMargin(true); panelContent.setSizeFull(); panelContent.setId("panel-content"); panelContent.addComponent(new HorizontalLayout() { { addComponent(txtFilter); addComponent(new Button("Add", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { filters.add(txtFilter.getValue()); loadTable(); } })); setExpandRatio(txtFilter, 1f); setWidth(100, Unit.PERCENTAGE); } }); panelContent.addComponent(table); panelContent.setExpandRatio(table, 1.0f); return panelContent; }
From source file:com.mycollab.module.project.view.bug.ToggleBugSummaryField.java
License:Open Source License
private void updateFieldValue(TextField editField) { removeComponent(editField);//from w w w . ja v a 2s . c om addComponent(titleLinkLbl); addComponent(buttonControls); addStyleName("editable-field"); String newValue = editField.getValue(); if (StringUtils.isNotBlank(newValue) && !newValue.equals(bug.getName())) { bug.setName(newValue); titleLinkLbl.setValue(buildBugLink()); BugService bugService = AppContextUtil.getSpringBean(BugService.class); bugService.updateSelectiveWithSession(BeanUtility.deepClone(bug), UserUIContext.getUsername()); } isRead = !isRead; }
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);// www. j ava2 s. 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.ToggleMilestoneSummaryField.java
License:Open Source License
private void updateFieldValue(TextField editField) { removeComponent(editField);//from w w w. ja va 2s .c o m addComponent(titleLinkLbl); addComponent(buttonControls); addStyleName("editable-field"); String newValue = editField.getValue(); if (StringUtils.isNotBlank(newValue) && !newValue.equals(milestone.getName())) { milestone.setName(newValue); titleLinkLbl.setValue(buildMilestoneLink()); MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class); milestoneService.updateSelectiveWithSession(BeanUtility.deepClone(milestone), UserUIContext.getUsername()); } isRead = !isRead; }
From source file:com.mycollab.module.project.view.milestone.ToggleTicketSummaryField.java
License:Open Source License
private void updateFieldValue(TextField editField) { removeComponent(editField);//www.j av a2 s .co m addComponent(titleLinkLbl); addComponent(buttonControls); addStyleName("editable-field"); String newValue = editField.getValue(); if (StringUtils.isNotBlank(newValue) && !newValue.equals(ticket.getName())) { ticket.setName(newValue); titleLinkLbl.setValue(buildTicketLink()); if (ticket.isBug()) { BugWithBLOBs bug = new BugWithBLOBs(); bug.setId(ticket.getTypeId()); bug.setName(ticket.getName()); bug.setSaccountid(MyCollabUI.getAccountId()); BugService bugService = AppContextUtil.getSpringBean(BugService.class); bugService.updateSelectiveWithSession(bug, UserUIContext.getUsername()); } else if (ticket.isTask()) { Task task = new Task(); task.setId(ticket.getTypeId()); task.setName(ticket.getName()); task.setSaccountid(MyCollabUI.getAccountId()); ProjectTaskService taskService = AppContextUtil.getSpringBean(ProjectTaskService.class); taskService.updateSelectiveWithSession(task, UserUIContext.getUsername()); } else if (ticket.isRisk()) { Risk risk = new Risk(); risk.setId(ticket.getTypeId()); risk.setName(ticket.getName()); risk.setSaccountid(MyCollabUI.getAccountId()); RiskService riskService = AppContextUtil.getSpringBean(RiskService.class); riskService.updateSelectiveWithSession(risk, UserUIContext.getUsername()); } } isRead = !isRead; }
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/* www .ja va2 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.task.ToggleTaskSummaryField.java
License:Open Source License
private void updateFieldValue(TextField editField) { removeComponent(editField);//w w w.ja va 2 s . c o m addComponent(titleLinkLbl); addComponent(buttonControls); addStyleName("editable-field"); String newValue = editField.getValue(); if (StringUtils.isNotBlank(newValue) && !newValue.equals(task.getName())) { task.setName(newValue); titleLinkLbl.setValue(buildTaskLink()); ProjectTaskService taskService = AppContextUtil.getSpringBean(ProjectTaskService.class); taskService.updateSelectiveWithSession(BeanUtility.deepClone(task), UserUIContext.getUsername()); } isRead = !isRead; }
From source file:com.mycollab.shell.view.SetupNewInstanceView.java
License:Open Source License
SetupNewInstanceView() { this.setDefaultComponentAlignment(Alignment.TOP_CENTER); MHorizontalLayout content = new MHorizontalLayout().withFullHeight(); this.with(content); content.with(new MHorizontalLayout( ELabel.html(UserUIContext.getMessage(ShellI18nEnum.OPT_SUPPORTED_LANGUAGES_INTRO)) .withStyleName(WebThemes.META_COLOR)).withMargin(true).withWidth("400px") .withStyleName("separator")); MVerticalLayout formLayout = new MVerticalLayout().withWidth("600px"); content.with(formLayout).withAlign(formLayout, Alignment.TOP_LEFT); formLayout.with(ELabel.h2("Last step, you are almost there!").withWidthUndefined()); formLayout.with(ELabel.h3("All fields are required *").withStyleName("overdue").withWidthUndefined()); GridFormLayoutHelper formLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(2, 8, "200px"); formLayoutHelper.getLayout().setWidth("600px"); final TextField adminField = formLayoutHelper.addComponent(new TextField(), "Admin email", 0, 0); final PasswordField passwordField = formLayoutHelper.addComponent(new PasswordField(), "Admin password", 0, 1);/*from w w w . ja va2s . c o m*/ final PasswordField retypePasswordField = formLayoutHelper.addComponent(new PasswordField(), "Retype Admin password", 0, 2); final DateFormatField dateFormatField = formLayoutHelper.addComponent( new DateFormatField(SimpleBillingAccount.DEFAULT_DATE_FORMAT), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_YYMMDD_FORMAT), UserUIContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 3); final DateFormatField shortDateFormatField = formLayoutHelper.addComponent( new DateFormatField(SimpleBillingAccount.DEFAULT_SHORT_DATE_FORMAT), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_MMDD_FORMAT), UserUIContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 4); final DateFormatField longDateFormatField = formLayoutHelper.addComponent( new DateFormatField(SimpleBillingAccount.DEFAULT_LONG_DATE_FORMAT), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_HUMAN_DATE_FORMAT), UserUIContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 0, 5); final TimeZoneSelectionField timeZoneSelectionField = formLayoutHelper.addComponent( new TimeZoneSelectionField(false), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_TIMEZONE), 0, 6); timeZoneSelectionField.setValue(TimeZone.getDefault().getID()); final LanguageSelectionField languageBox = formLayoutHelper.addComponent(new LanguageSelectionField(), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_LANGUAGE), 0, 7); languageBox.setValue(Locale.US.toLanguageTag()); formLayout.with(formLayoutHelper.getLayout()); CheckBox createSampleDataSelection = new CheckBox("Create sample data", true); MButton installBtn = new MButton("Setup", clickEvent -> { String adminName = adminField.getValue(); String password = passwordField.getValue(); String retypePassword = retypePasswordField.getValue(); if (!StringUtils.isValidEmail(adminName)) { NotificationUtil.showErrorNotification("Invalid email value"); return; } if (!password.equals(retypePassword)) { NotificationUtil.showErrorNotification("Password is not match"); return; } String dateFormat = dateFormatField.getValue(); String shortDateFormat = shortDateFormatField.getValue(); String longDateFormat = longDateFormatField.getValue(); if (!isValidDayPattern(dateFormat) || !isValidDayPattern(shortDateFormat) || !isValidDayPattern(longDateFormat)) { NotificationUtil.showErrorNotification("Invalid date format"); return; } String language = languageBox.getValue(); String timezoneDbId = timeZoneSelectionField.getValue(); BillingAccountMapper billingAccountMapper = AppContextUtil.getSpringBean(BillingAccountMapper.class); BillingAccountExample ex = new BillingAccountExample(); ex.createCriteria().andIdEqualTo(MyCollabUI.getAccountId()); List<BillingAccount> billingAccounts = billingAccountMapper.selectByExample(ex); BillingAccount billingAccount = billingAccounts.get(0); billingAccount.setDefaultlanguagetag(language); billingAccount.setDefaultyymmddformat(dateFormat); billingAccount.setDefaultmmddformat(shortDateFormat); billingAccount.setDefaulthumandateformat(longDateFormat); billingAccount.setDefaulttimezone(timezoneDbId); billingAccountMapper.updateByPrimaryKey(billingAccount); BillingAccountService billingAccountService = AppContextUtil.getSpringBean(BillingAccountService.class); billingAccountService.createDefaultAccountData(adminName, password, timezoneDbId, language, true, createSampleDataSelection.getValue(), MyCollabUI.getAccountId()); ((DesktopApplication) UI.getCurrent()).doLogin(adminName, password, false); }).withStyleName(WebThemes.BUTTON_ACTION); MHorizontalLayout buttonControls = new MHorizontalLayout(createSampleDataSelection, installBtn) .alignAll(Alignment.MIDDLE_RIGHT); formLayout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT); }
From source file:com.mycollab.vaadin.web.ui.BuildCriterionComponent.java
License:Open Source License
private void buildSaveFilterBox() { filterBox.removeAllComponents();//from w ww . j a v a 2 s . c om final TextField queryTextField = new TextField(); filterBox.addComponent(queryTextField); MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> { String queryText = queryTextField.getValue(); saveSearchCriteria(queryText); }).withIcon(FontAwesome.SAVE).withStyleName(WebThemes.BUTTON_ACTION); filterBox.addComponent(saveBtn); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> buildFilterBox(null)).withStyleName(WebThemes.BUTTON_OPTION); filterBox.addComponent(cancelBtn); }