@Override protected Boolean convertInputToValue() throws ConversionException { String stringValue = input.getConvertedInput(); if ("yes".equals(stringValue)) return true; else if ("no".equals(stringValue)) return false; else return null; }
private boolean checkOnlyStatusChange(final DropDownChoice<VacationStatus> statusChoice) { if (statusChoice != null && statusChoice.getConvertedInput() != null && data.getStatus() != null) { if ( //Changes from IN_PROGRESS to APPROVED or REJECTED (VacationStatus.IN_PROGRESS.equals(data.getStatus()) && (VacationStatus.APPROVED.equals(statusChoice.getConvertedInput()) || VacationStatus.REJECTED .equals(statusChoice.getConvertedInput()))) || //Changes from REJECTED to APPROVED or IN_PROGRESS (VacationStatus.REJECTED.equals(data.getStatus()) && (VacationStatus.APPROVED.equals(statusChoice.getConvertedInput()) || VacationStatus.IN_PROGRESS.equals(statusChoice.getConvertedInput()))) ) { return true; } } return false; }
@Override public void convertInput() { boolean supportAmOrPm = isSupportAmPm(); int hours = Optional.ofNullable(hoursField.getConvertedInput()).orElse(0); int minutes = Optional.ofNullable(minutesField.getConvertedInput()).orElse(0); Date date = picker.getConvertedInput(); if (date != null) { LocalDate localDate = date.toInstant().atZone(clientZone).toLocalDate(); LocalTime localTime = LocalTime.of(hours, minutes); ZonedDateTime dateTime = ZonedDateTime.of(localDate, localTime, clientZone); if (supportAmOrPm) { int amPm = amOrPmChoice.getConvertedInput().equals(AM) ? 0 : 1; dateTime = dateTime.with(ChronoField.AMPM_OF_DAY, amPm); } setConvertedInput(Date.from(dateTime.toInstant())); } else setConvertedInput(null); }
@Override protected void onUpdate(AjaxRequestTarget target) { styles.validate(); copyLink.setEnabled(styles.getConvertedInput() != null); target.addComponent(copyLink); } });
@Override protected void onUpdate(AjaxRequestTarget target) { layerChoice.setChoices(new Model<ArrayList<String>>( getLayerNames(workspaceChoice.getConvertedInput()))); layerChoice.modelChanged(); target.addComponent(layerChoice); } });
@Override protected void onUpdate(AjaxRequestTarget target) { styles.validate(); copyLink.setEnabled(styles.getConvertedInput() != null); target.add(copyLink); } });
@Override protected void onUpdate(AjaxRequestTarget target) { templates.validate(); generateLink.setEnabled(templates.getConvertedInput() != null); target.add(generateLink); } });
@Override protected void onUpdate(AjaxRequestTarget target) { layerChoice.setChoices(new Model<ArrayList<String>>( getLayerNames(workspaceChoice.getConvertedInput()))); layerChoice.modelChanged(); target.addComponent(layerChoice); } });
@Override public void convertInput() { choice.processInput(); String branch = choice.getConvertedInput(); setModelObject(branch); setConvertedInput(branch); }
@Override protected void onUpdate(AjaxRequestTarget target) { layerChoice.setChoices( new Model<ArrayList<String>>( getLayerNames(rootChoice.getConvertedInput()))); layerChoice.modelChanged(); target.add(layerChoice); } });
@Override protected void onUpdate(AjaxRequestTarget target) { boolean isLimit = grantTypeChoice.getConvertedInput().equals(GrantType.LIMIT); allowedAreaLabel.setVisible(isLimit); allowedArea.setVisible(isLimit); catalogModeChoice.setVisible(isLimit); catalogModeChoiceLabel.setVisible(isLimit); target.add(allowedAreaLabel); target.add(allowedArea); target.add(catalogModeChoice); target.add(catalogModeChoiceLabel); ruleFormModel.getObject().layerDetailsCheck = ruleFormModel.getObject().layerDetailsCheck && (grantTypeChoice.getConvertedInput() != null && grantTypeChoice .getConvertedInput() .equals(GrantType.ALLOW)) && (layerChoice.getConvertedInput() != null && !layerChoice.getConvertedInput().isEmpty()); } });
@Override public void validate(Form<?> form) { if (image.getConvertedInput() == null && (upload.getConvertedInput() == null || upload.getConvertedInput().isEmpty())) { form.error( new ParamResourceModel("missingImage", getPage()) .getString()); } } });
@SuppressWarnings("unchecked") @Override protected List<OProperty> load() { IOClassIntrospector oClassIntrospector = OrienteerWebApplication.get().getOClassIntrospector(); OClass classFormToShow = embeddedClassChoice.getConvertedInput(); if(classFormToShow==null) classFormToShow = embeddedClassChoice.getModelObject(); return oClassIntrospector.listProperties(classFormToShow, new Predicate<OProperty>() { @Override public boolean apply(OProperty input) { return !((Boolean)CustomAttribute.HIDDEN.getValue(input)); } }); } };
@SuppressWarnings("unchecked") @Override public void validate(final Form<?> form) { final SkillSelectPanel skillSelectPanel = (SkillSelectPanel) dependentFormComponents[0]; final DropDownChoice<SkillRating> skillRatingDropDown = (DropDownChoice<SkillRating>) dependentFormComponents[1]; if (skillSelectPanel.getConvertedInput().isRateable() == true && skillRatingDropDown.getConvertedInput() == null) { error(getString(I18N_KEY_ERROR_RATEABLE_SKILL_WITH_NULL_RATING)); } else if (skillSelectPanel.getConvertedInput().isRateable() == false && skillRatingDropDown.getConvertedInput() != null) { error(getString(I18N_KEY_ERROR_UNRATEABLE_SKILL_WITH_RATING)); } }
@Override protected void onUpdate(AjaxRequestTarget target) { userChoice.setChoices(getUserNames(roleChoice.getConvertedInput())); form.getModelObject().rule.setUserName(null); userChoice.modelChanged(); target.add(userChoice); } });
@Override protected void onUpdate(AjaxRequestTarget target) { userChoice.setChoices(getUserNames(roleChoice.getConvertedInput())); form.getModelObject().setUserName(null); userChoice.modelChanged(); target.add(userChoice); } });
@Override protected void onUpdate(AjaxRequestTarget target) { layerChoice.setChoices( getLayerNames(workspaceChoice.getConvertedInput())); form.getModelObject().rule.setLayer(null); layerChoice.modelChanged(); target.add(layerChoice); } });
@Override protected void onUpdate(AjaxRequestTarget target) { requestChoice.setChoices( getOperationNames(serviceChoice.getConvertedInput())); form.getModelObject().rule.setRequest(null); requestChoice.modelChanged(); target.add(requestChoice); } });
@Override public void validate(final Form<?> form) { for (int i = 0; i < getDependentFormComponents().length - 1; i += 2) { @SuppressWarnings("unchecked") final DropDownChoice<HRPlanningEntryStatus> statusChoice = (DropDownChoice<HRPlanningEntryStatus>) dependentEntryFormComponentsArray[i]; final HRPlanningEntryStatus status = statusChoice.getConvertedInput(); final NewProjektSelectPanel projektSelectPanel = (NewProjektSelectPanel) dependentEntryFormComponentsArray[i + 1]; final ProjektDO projekt = projektSelectPanel.getModelObject(); if (projekt == null && status == null) { projektSelectPanel.error(getString("hr.planning.entry.error.statusOrProjektRequired")); } else if (projekt != null && status != null) { projektSelectPanel.error(getString("hr.planning.entry.error.statusAndProjektNotAllowed")); } } } });
@Override protected void onSubmit(AjaxRequestTarget target, Form form) { // we need to force validation or the value won't be converted styles.processInput(); StyleInfo style = (StyleInfo) styles.getConvertedInput(); if (style != null) { try { // same here, force validation or the field won't be udpated editor.reset(); setRawSLD(readFile(style)); } catch (Exception e) { error("Errors occurred loading the '" + style.getName() + "' style"); } target.addComponent(styleForm); } }