Search code examples
gwtgwt2gwt-editors

How can I disable ValueBoxEditorDecorator<String>?


I'd like to have read-only editor so I disable every control in it. But I can't do that with ValueBoxEditorDecorator. Do you guys have any ideas how I can disable it ?

There is ValueBoxBase<T> peer inside the class but it's obviously private.


Solution

  • I figured I can add ID to inner widget like this

    <e:ValueBoxEditorDecorator ui:field="cellPhoneNumber" stylePrimaryName="{style.forform}">
        <e:valuebox>
            <g:TextBox ui:field="cellPhoneNumberText" width="100%" stylePrimaryName="{style.forform}"/>
        </e:valuebox>
    </e:ValueBoxEditorDecorator>
    

    and then call cellPhoneNumberText.setEnable().

    The only downside to it is extra definition of field in my class whihc also has to be marked with @Ignore annotation like this

    @UiField
    ValueBoxEditorDecorator<String> cellPhoneNumber;
    
    @Ignore
    @UiField
    TextBox cellPhoneNumberText;