Example usage for com.google.gwt.user.client.ui ValueBoxBase setReadOnly

List of usage examples for com.google.gwt.user.client.ui ValueBoxBase setReadOnly

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui ValueBoxBase setReadOnly.

Prototype

public void setReadOnly(boolean readOnly) 

Source Link

Document

Turns read-only mode on or off.

Usage

From source file:ar.com.kyol.jet.client.JetWrapper.java

License:Open Source License

private static void recursiveEnabler(Widget widget, ReadOnlyCondition readonly) {
    if (widget instanceof HasEnabled) {
        ((HasEnabled) widget).setEnabled(!readonly.isReadOnly(widget));
    } else if (widget instanceof ComplexPanel) {
        for (int i = 0; i < ((ComplexPanel) widget).getWidgetCount(); i++) {
            recursiveEnabler(((ComplexPanel) widget).getWidget(i), readonly);
        }//from   ww  w. j  a v  a 2  s .  co  m
    } else if (widget instanceof ValueBoxBase<?>) { //why not using HasEnabled instead?
        ValueBoxBase<?> wrappedWidget = (ValueBoxBase<?>) widget;
        wrappedWidget.setReadOnly(readonly.isReadOnly(widget));
    } else if (widget instanceof DateBox) { //DateBox does not implement HasEnabled in GWT 2.2
        DateBox wrappedWidget = (DateBox) widget;
        wrappedWidget.setEnabled(!readonly.isReadOnly(widget));
    }
}