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

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

Introduction

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

Prototype

public void setEnabled(boolean enabled) 

Source Link

Document

Sets whether this widget is enabled.

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 w w  w. j  av  a  2 s  .c  om
    } 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));
    }
}