/** * Returns the field label.<p> * * @param info the info * * @return the label */ private String getLabel(CmsAccountInfo info) { if (info.isAdditionalInfo()) { String label = CmsVaadinUtils.getMessageText("GUI_USER_DATA_" + info.getAddInfoKey().toUpperCase() + "_0"); if (CmsMessages.isUnknownKey(label)) { return info.getAddInfoKey(); } else { return label; } } else { return CmsVaadinUtils.getMessageText("GUI_USER_DATA_" + info.getField().name().toUpperCase() + "_0"); } }
/** * Returns the account info value for the given user.<p> * * @param user the user * * @return the value */ public String getValue(CmsUser user) { String value = null; if (isAdditionalInfo()) { value = (String)user.getAdditionalInfo(getAddInfoKey()); } else { try { PropertyUtilsBean propUtils = new PropertyUtilsBean(); value = (String)propUtils.getProperty(user, getField().name()); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { LOG.error("Error reading account info field.", e); } } return value; }
/** * Builds the text field for the given property.<p> * * @param label the field label * @param info the property name * * @return the field */ private TextField buildField(String label, CmsAccountInfo info) { TextField field = (TextField)m_binder.buildAndBind(label, info); field.setConverter(new CmsNullToEmptyConverter()); field.setWidth("100%"); field.setEnabled(info.isEditable()); if (info.isEditable()) { field.addValidator(new FieldValidator(info.getField())); } field.setImmediate(true); return field; }
for (CmsAccountInfo info : accountInfos) { Element infoElement = infosElement.addElement(N_ACCOUNTINFO); infoElement.addAttribute(A_FIELD, info.getField().name()); if (info.isAdditionalInfo()) { infoElement.addAttribute(A_ADD_INFO_KEY, info.getAddInfoKey());
propUtils.setProperty( m_user, info.getField().name(), m_infos.getItemProperty(info).getValue());