@Override public void copySettingsSpecific( TTextBoxSettingsBean srcTextBoxSettingsBean, TTextBoxSettingsBean destTextBoxSettingsBean) { destTextBoxSettingsBean.setDefaultDouble(srcTextBoxSettingsBean.getDefaultDouble()); destTextBoxSettingsBean.setMaxDecimalDigit(srcTextBoxSettingsBean.getMaxDecimalDigit()); destTextBoxSettingsBean.setMaxDouble(srcTextBoxSettingsBean.getMaxDouble()); destTextBoxSettingsBean.setMinDouble(srcTextBoxSettingsBean.getMinDouble()); destTextBoxSettingsBean.setParameterCode(srcTextBoxSettingsBean.getParameterCode()); destTextBoxSettingsBean.setRequired(srcTextBoxSettingsBean.getRequired()); }
@Override public List<ErrorData> isValidSettings(Map<Integer, Object> settings) { List<ErrorData> errorDataList = new ArrayList<ErrorData>(); TTextBoxSettingsBean textBoxSettingsBean = (TTextBoxSettingsBean) settings.get(mapParameterCode); // textBoxSettingsBean can be null when no settings was set (especially by system fields) if (textBoxSettingsBean != null) { Double defaultDouble = textBoxSettingsBean.getDefaultDouble(); Double minDouble = textBoxSettingsBean.getMinDouble(); Double maxDouble = textBoxSettingsBean.getMaxDouble(); Integer maxDecimalDigits = textBoxSettingsBean.getMaxDecimalDigit(); if (minDouble != null && maxDouble != null && minDouble.doubleValue() > maxDouble.doubleValue()) { errorDataList.add(new ErrorData("customTextBoxDouble.error.minMax")); } if (minDouble != null && defaultDouble != null && minDouble.doubleValue() > defaultDouble.doubleValue()) { errorDataList.add(new ErrorData("customTextBoxDouble.error.defaultMin")); } if (maxDouble != null && defaultDouble != null && maxDouble.doubleValue() < defaultDouble.doubleValue()) { errorDataList.add(new ErrorData("customTextBoxDouble.error.defaultMax")); } if (maxDecimalDigits != null) if (maxDecimalDigits.intValue() < 0 || maxDecimalDigits.intValue() > maximalDecimalDigits) { errorDataList.add( new ErrorData( "customTextBoxDouble.error.maxDecimalDigits", new Integer(maximalDecimalDigits))); } else { if (getNumberOfDecimalDigits(defaultDouble) > maxDecimalDigits.intValue()) { errorDataList.add( createDecimalDigitsMoreThanMaxDecimalDigitsErrorData( "customTextBoxDouble.prompt.defaultDouble", maxDecimalDigits)); } if (getNumberOfDecimalDigits(minDouble) > maxDecimalDigits.intValue()) { errorDataList.add( createDecimalDigitsMoreThanMaxDecimalDigitsErrorData( "customTextBoxDouble.prompt.minValue", maxDecimalDigits)); } if (getNumberOfDecimalDigits(maxDouble) > maxDecimalDigits.intValue()) { errorDataList.add( createDecimalDigitsMoreThanMaxDecimalDigitsErrorData( "customTextBoxDouble.prompt.maxValue", maxDecimalDigits)); } } } return errorDataList; }