Example usage for com.vaadin.ui AbstractField isReadOnly

List of usage examples for com.vaadin.ui AbstractField isReadOnly

Introduction

In this page you can find the example usage for com.vaadin.ui AbstractField isReadOnly.

Prototype

@Override
    public boolean isReadOnly() 

Source Link

Usage

From source file:fr.amapj.view.engine.collectioneditor.Row.java

License:Open Source License

public void setFieldValue(int columns, Object val) {
    AbstractField f = fields.get(columns);

    if (f.isReadOnly()) {
        f.setReadOnly(false);/* w  w  w.j  a  v  a  2 s .com*/
        f.setConvertedValue(val);
        f.setReadOnly(true);
    } else {
        f.setConvertedValue(val);
    }

}

From source file:org.lunifera.runtime.web.vaadin.databinding.model.internal.PropertyReadonlyProperty.java

License:Open Source License

protected Object doGetValue(Object source) {
    AbstractField<?> component = (AbstractField<?>) source;
    return component.isReadOnly();
}

From source file:org.opencms.ui.CmsVaadinUtils.java

License:Open Source License

/**
 * 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// ww w . j ava  2s .com
 * @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);
    }
}