/** * {@inheritDoc} */ @Override public RangeEnumerationPropertyDescriptor clone() { RangeEnumerationPropertyDescriptor clonedDescriptor = (RangeEnumerationPropertyDescriptor) super .clone(); return clonedDescriptor; }
/** * Computes an enumeration key. * * @param value * the enumeration value. * @return the enumeration key. */ protected String computeEnumerationKey(Object value) { return getEnumerationName() + "." + value; }
@Override public String getI18nMessage(ITranslationProvider translationProvider, Locale locale) { return translationProvider.getTranslation( "integrity.property.outOfRange", new Object[] { getI18nValue(String.valueOf(newValue), translationProvider, locale), getI18nName(translationProvider, locale), getEnumerationValues(), component }, locale); }
setName(propertyDescriptor.getName()); setI18nNameKey(propertyDescriptor.getI18nNameKey()); setDescription(propertyDescriptor.getDescription()); selectedPropertyDescriptor.setI18nNameKey("enumValue.selected"); selectedPropertyDescriptor.setPreferredWidth(30); BasicPropertyDescriptor valuePropertyDescriptor = propertyDescriptor.clone(); valuePropertyDescriptor.setName(VALUE); if (propertyDescriptor.getI18nNameKey() != null) { valuePropertyDescriptor.setI18nNameKey(propertyDescriptor.getI18nNameKey()); } else { valuePropertyDescriptor.setI18nNameKey(propertyDescriptor.getName()); setAlternativeSortProperty(propertyDescriptor.getAlternativeSortProperty()); setComputed(propertyDescriptor.isComputed()); if (isComputed()) { if (propertyDescriptor.isFilterOnly()) { setFilterOnly(true); } else if (propertyDescriptor.isModifiable()) { setDelegateWritable(true); setSqlName(propertyDescriptor.getSqlName()); setMandatory(false);
/** * {@inheritDoc} */ @Override public String getI18nValue(String value, ITranslationProvider translationProvider, Locale locale) { if (value == null) { return IQueryComponent.NULL_VAL; } else if (isTranslated()) { return translationProvider.getTranslation(computeEnumerationKey(value), locale); } return value; }
/** * Pre-process setter. * * @param component the component * @param newValue the new value */ @SuppressWarnings("SuspiciousMethodCalls") @Override public void preprocessSetter(final Object component, final Object newValue) { if (newValue != null && !"".equals(newValue) && !getEnumerationValues().contains(newValue)) { IntegrityException ie = new IntegrityException("[" + getName() + "] value (" + newValue + ") is not allowed on [" + component + "]. Allowed values are: " + getEnumerationValues()) { private static final long serialVersionUID = 1896266926060894852L; @Override public String getI18nMessage(ITranslationProvider translationProvider, Locale locale) { return translationProvider.getTranslation( "integrity.property.outOfRange", new Object[] { getI18nValue(String.valueOf(newValue), translationProvider, locale), getI18nName(translationProvider, locale), getEnumerationValues(), component }, locale); } }; throw ie; } super.preprocessSetter(component, newValue); }
/** * Gets the maxLength. * * @return the maxLength. */ @Override public Integer getMaxLength() { if (maxLength != null) { return maxLength; } int max = 1; for (String value : getEnumerationValues()) { if (value != null && value.length() > max) { max = value.length(); } } return max; }
@Override public Object getDefaultValue() { Object defaultValue = super.getDefaultValue(); if (defaultValue == null && isMandatory()) { defaultValue = getEnumerationValues().get(0); } return defaultValue; } }
/** * {@inheritDoc} */ @Override public TimeZoneEnumerationPropertyDescriptor clone() { TimeZoneEnumerationPropertyDescriptor clonedDescriptor = (TimeZoneEnumerationPropertyDescriptor) super.clone(); return clonedDescriptor; }
/** * {@inheritDoc} */ @Override public BasicEnumerationPropertyDescriptor clone() { BasicEnumerationPropertyDescriptor clonedDescriptor = (BasicEnumerationPropertyDescriptor) super .clone(); return clonedDescriptor; }