/** * DOC bessaies Comment method "buildField". * * @param fieldPart * @param messagePart * @param configBean */ private Field<?> buildPasswordField( final LayoutContainer fieldPart, final LayoutContainer messagePart, Config config) { String key = config.labelKey; TextField<String> field = new TextField<String>(); field.setName(config.name()); field.setReadOnly( !(config.editable && userBean.getRole().getRights().contains(RightsConstants.CONFIG_MANAGMENT))); field.setPassword(true); buildField(config, I18nUtils.getString(key), field, fieldPart, messagePart); bindings.add(new FieldBinding<String>(field, config.name())); return field; }
private Field<?> buildTextField( final LayoutContainer fieldPart, final LayoutContainer messagePart, Config config) { String key = config.labelKey; if (config.editable && userBean.getRole().getRights().contains(RightsConstants.CONFIG_MANAGMENT)) { TextField<String> field = new TextField<String>(); field.setName(config.name()); buildField(config, I18nUtils.getString(key), field, fieldPart, messagePart); bindings.add(new FieldBinding<String>(field, config.name(), null)); return field; } else { LabelField field = new LabelField(); field.setName(config.name()); buildField(config, I18nUtils.getString(key), field, fieldPart, messagePart); bindings.add(new FieldBinding<Object>(field, config.name(), null)); return field; } }
public boolean hasEditRight() { return userBean.getRole().hasRight(RightsConstants.CONFIG_MANAGMENT); }