com.vaadin.v7.data.Property.isReadOnly()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中com.vaadin.v7.data.Property.isReadOnly()方法的一些代码示例,展示了Property.isReadOnly()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.isReadOnly()方法的具体详情如下:
包路径:com.vaadin.v7.data.Property
类名称:Property
方法名:isReadOnly

Property.isReadOnly介绍

[英]Tests if the Property is in read-only mode. In read-only mode calls to the method setValue will throw ReadOnlyException and will not modify the value of the Property.
[中]测试属性是否处于只读模式。在只读模式下,对方法setValue的调用将抛出ReadOnlyException,并且不会修改属性的值。

代码示例

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

/** Reflects the read-only status of the datasource. */
@Override
public boolean isReadOnly() {
  return dataSource == null ? false : dataSource.isReadOnly();
}

代码示例来源:origin: com.haulmont.cuba/cuba-web

@Override
public boolean isReadOnly() {
  return itemProperty.isReadOnly();
}

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

@Override
public boolean isReadOnly() {
  return wrappedProperty.isReadOnly();
}

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

/**
 * 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();
}

代码示例来源:origin: viritin/viritin

/**
 * 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);
}

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

/**
 * 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();
  }
}

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

/**
 * 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);
    }
  }
}

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

/**
 * 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());
  }
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework-compatibility

@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);
}

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

@Override
public void commit()
    throws Buffered.SourceException, InvalidValueException {
  if (dataSource != null && !dataSource.isReadOnly()) {
    if (isInvalidCommitted() || isValid()) {
      try {

代码示例来源:origin: com.vaadin/vaadin-compatibility-server

: dataSource.isReadOnly();

相关文章

微信公众号

最新文章

更多