/** Reflects the read-only status of the datasource. */ @Override public boolean isReadOnly() { return dataSource == null ? false : dataSource.isReadOnly(); }
@Override public boolean isReadOnly() { return itemProperty.isReadOnly(); }
@Override public boolean isReadOnly() { return wrappedProperty.isReadOnly(); }
/** * The abstract field is read only also if the data source is in read only * mode. */ @Override public boolean isReadOnly() { return super.isReadOnly() || dataSource != null && dataSource.isReadOnly(); }
/** * Configures a field with the settings set for this FieldBinder. * <p> * By default this updates the buffered, read only and enabled state of the * field. Also adds validators when applicable. Fields with read only data * source are always configured as read only. * <p> * Unlike the default implementation in FieldGroup, MBeanFieldGroup only * makes field read only based on the property's hint, not the opposite. * This way developer can in form code choose to make some fields read only. * * @param field The field to update */ @Override protected void configureField(Field<?> field) { boolean readOnlyStatus = isReadOnly() || field.getPropertyDataSource().isReadOnly(); super.configureField(field); // reset the badly set readOnlyStatus field.setReadOnly(readOnlyStatus); }
/** * React to read only status changes of the property by requesting a * repaint. * * @see Property.ReadOnlyStatusChangeListener */ @Override public void readOnlyStatusChange(Property.ReadOnlyStatusChangeEvent event) { boolean readOnly = event.getProperty().isReadOnly(); boolean shouldFireChange = isReadOnly() != readOnly || getState().propertyReadOnly != readOnly; getState().propertyReadOnly = readOnly; if (shouldFireChange) { fireReadOnlyStatusChange(); } }
/** * Sets the read only state to the given value for all fields with writable * data source. Fields with read only data source will always be set to read * only. * * @param fieldsReadOnly * true to set the fields with writable data source to read only, * false to set them to read write */ public void setReadOnly(boolean fieldsReadOnly) { readOnly = fieldsReadOnly; for (Field<?> field : getFields()) { if (field.getPropertyDataSource() == null || !field.getPropertyDataSource().isReadOnly()) { field.setReadOnly(fieldsReadOnly); } else { field.setReadOnly(true); } } }
/** * Configures a field with the settings set for this FieldBinder. * <p> * By default this updates the buffered, read only and enabled state of the * field. Also adds validators when applicable. Fields with read only data * source are always configured as read only. * * @param field * The field to update */ protected void configureField(Field<?> field) { field.setBuffered(isBuffered()); field.setEnabled(isEnabled()); if (field.getPropertyDataSource().isReadOnly()) { field.setReadOnly(true); } else { field.setReadOnly(isReadOnly()); } }
@Test public void simpleInitializationTest() { // GIVEN fieldFactory = new TestTextFieldFactory(definition, baseItem, null, i18NAuthoringSupport); fieldFactory.setComponentProvider(this.componentProvider); // WHEN Field<Object> field = fieldFactory.createField(); // THEN assertTrue(TextField.class.isAssignableFrom(field.getClass())); assertEquals(definition, fieldFactory.getFieldDefinition()); assertEquals(false, field.isRequired()); assertEquals("label", field.getCaption()); assertEquals(false, field.getPropertyDataSource().isReadOnly()); assertEquals(true, field.getPropertyDataSource() instanceof TransformedProperty); }
@Override public void commit() throws Buffered.SourceException, InvalidValueException { if (dataSource != null && !dataSource.isReadOnly()) { if (isInvalidCommitted() || isValid()) { try {
: dataSource.isReadOnly();