public void afterTextChanged(Editable aEditable) { Class<?> propertyType = getPropertyAccessor().getGetter().getReturnType(); if (Float.class.isAssignableFrom(propertyType) || float.class.isAssignableFrom(propertyType)) { updateModel( StringUtil.isEmpty(aEditable.toString()) ? 0.0F : Float.parseFloat(aEditable.toString())); } else if (long.class.isAssignableFrom(propertyType) || Long.class.isAssignableFrom(propertyType)) { updateModel( StringUtil.isEmpty(aEditable.toString()) ? 0L : Long.parseLong(aEditable.toString())); } else if (int.class.isAssignableFrom(propertyType) || Integer.class.isAssignableFrom(propertyType)) { updateModel( StringUtil.isEmpty(aEditable.toString()) ? 0 : Integer.parseInt(aEditable.toString())); } else if (double.class.isAssignableFrom(propertyType) || Double.class.isAssignableFrom(propertyType)) { updateModel( StringUtil.isEmpty(aEditable.toString()) ? 0.0D : Double.parseDouble(aEditable.toString())); } else if (UserExtract.class.isAssignableFrom(propertyType)) { throw new IllegalStateException("Benutzer können nicht editiert werden!"); } else { updateModel(aEditable.toString()); } }
@Override void updateComponent(Object aNewValue) { Class<?> propertyType = getPropertyAccessor().getGetter().getReturnType(); if (UserExtract.class.isAssignableFrom(propertyType)) { getComponent().setText(aNewValue == null ? null : ((UserExtract) aNewValue).getEmail()); } else if (Date.class.isAssignableFrom(propertyType)) { SimpleDateFormat sdf = new SimpleDateFormat(UBBConstants.DATE_FORMAT); getComponent().setText(aNewValue == null ? null : sdf.format((Date) aNewValue)); } else { getComponent().setText(aNewValue == null ? null : StringUtil.toString(aNewValue)); } }