Package org.gwtoolbox.widget.client.form.editor

Source Code of org.gwtoolbox.widget.client.form.editor.BooleanEditor

package org.gwtoolbox.widget.client.form.editor;

import com.google.gwt.user.client.ui.CheckBox;

/**
* @author Uri Boness
*/
public class BooleanEditor extends AbstractFocusWidgetEditor<Boolean, CheckBox> {

    public BooleanEditor() {
        this(false);
    }

    public BooleanEditor(CheckBox checkBox) {
        this(checkBox, false, true);
    }

    public BooleanEditor(boolean defaultValue) {
        this(defaultValue, true);
    }

    public BooleanEditor(boolean defaultValue, boolean enabled) {
        this(new CheckBox(), defaultValue, enabled);
    }

    protected BooleanEditor(CheckBox checkBox, boolean defaultValue, boolean enabled) {
        super(checkBox, defaultValue, enabled);
        getWidget().setStylePrimaryName("BooleanEditor");
    }

    public Boolean doGetValue() {
        return getWidget().getValue();
    }

    public void doSetValue(Boolean value) {
        getWidget().setValue(value);
    }

    protected Boolean getNullValue() {
        return Boolean.TRUE;
    }

    @Override
    public boolean isHorizontallySizable() {
        return false;
    }

    @Override
    public boolean isVerticallySizable() {
        return false;
    }
}
TOP

Related Classes of org.gwtoolbox.widget.client.form.editor.BooleanEditor

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.