@Override public void readDesign(Element design, DesignContext designContext) { super.readDesign(design, designContext); Attributes attr = design.attributes(); if (attr.hasKey("readonly")) { setReadOnly(DesignAttributeHandler.readAttribute("readonly", attr, Boolean.class)); } }
/** * * @param component * the outer component, which toggles from read to write mode * (or vice versa). * @param editAllowed * true: <code>component</code> is in edit mode, false: * <code>component</code> is in read mode */ protected void setEditAllowed(boolean editAllowed) { getOuter().setReadOnly(!editAllowed); } }
/** * Sets the value of a text field which may be set to read-only mode.<p> * * When setting a Vaadin field to read-only, you also can't set its value programmatically anymore. * So we need to temporarily disable read-only mode, set the value, and then switch back to read-only mode. * * @param field the field * @param value the value to set */ public static <T> void setReadonlyValue(AbstractField<T> field, T value) { boolean readonly = field.isReadOnly(); try { field.setReadOnly(false); field.setValue(value); } finally { field.setReadOnly(readonly); } }
@Override public B readOnly() { getInstance().setReadOnly(true); return builder(); }
@Override public B readOnly() { getInstance().setReadOnly(true); return builder(); }
@Override public B readOnly() { getInstance().setReadOnly(true); return builder(); }
@Override public B readOnly() { getInstance().setReadOnly(true); return builder(); }
@Override public Component apply(S t) { return Optional.ofNullable(componentDefinition.getEditor()).map(ColumnEditorDefinition::getField).map(fieldDefinition -> { final Component component = formFieldFactory.createField((FieldDefinition<?>) fieldDefinition, Locale.getDefault()); if (component instanceof AbstractField) { ((AbstractField) component).setReadOnly(true); } else if (component instanceof AbstractSingleSelect) { ((AbstractSingleSelect) component).setReadOnly(true); } Object value = wrapped.apply(t); if (value != null) { ((HasValue) component).setValue(value); } return component; }).orElse(null); }
abstractField.setReadOnly(parentReadOnly?true:property.isReadOnly()); abstractField.setRequired(property.isRequired()); abstractField.setVisible(property.isVisible());
fieldx.setReadOnly(property.isReadOnly()); fieldx.setRequired(property.isRequired()); fieldx.setVisible(property.isVisible());
ret.setReadOnly(property.isReadOnly()); ret.setEnabled(property.isEnabled()); ret.setVisible(property.isVisible());
ret.setReadOnly(property.isReadOnly()); ret.setEnabled(property.isEnabled()); ret.setVisible(property.isVisible());