Example usage for com.google.gwt.user.client.ui CheckBox addValueChangeHandler

List of usage examples for com.google.gwt.user.client.ui CheckBox addValueChangeHandler

Introduction

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

Prototype

@Override
    public HandlerRegistration addValueChangeHandler(ValueChangeHandler<Boolean> handler) 

Source Link

Usage

From source file:com.google.sampling.experiential.client.BackgroundListeningPanel.java

License:Open Source License

public BackgroundListeningPanel(ExperimentDAO experiment) {
    this.experiment = experiment;
    myConstants = GWT.create(MyConstants.class);

    rootPanel = new VerticalPanel();
    rootPanel.setStyleName("bordered");
    initWidget(rootPanel);/*  ww w .  j av  a  2 s  .  com*/

    HTML titleLabel = new HTML("<h2>" + myConstants.backgroundListeningTitle() + ": </h2>");
    rootPanel.add(titleLabel);

    HTML html = new HTML("&nbsp;&nbsp;&nbsp;<font color=\"red\" size=\"smaller\"><i>("
            + myConstants.iOSIncompatible() + ")</i></font>");
    rootPanel.add(html);

    // set up the checkbox
    listeningCheckboxPanel = new HorizontalPanel();
    rootPanel.add(listeningCheckboxPanel);
    CheckBox shouldListenCheckbox = new CheckBox();
    listeningCheckboxPanel.add(shouldListenCheckbox);
    Label checkBoxLabel = new Label(myConstants.shouldBackgroundListen());
    checkBoxLabel.setStyleName("gwt-Label-Header");
    listeningCheckboxPanel.add(checkBoxLabel);
    shouldListenCheckbox.setValue(experiment.isBackgroundListen() != null && experiment.isBackgroundListen());
    shouldListenCheckbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            BackgroundListeningPanel.this.experiment.setBackgroundListen(event.getValue());
        }
    });

    // set up the sourceIdentifier textbox
    sourceIdentifierPanel = new HorizontalPanel();
    rootPanel.add(sourceIdentifierPanel);
    Label textBoxLabel = new Label(myConstants.backgroundListenSourceIdentifier());
    textBoxLabel.setStyleName("gwt-Label-Header");
    sourceIdentifierPanel.add(textBoxLabel);
    final TextBox sourceIdentifierTextBox = new TextBox();
    sourceIdentifierPanel.add(sourceIdentifierTextBox);
    sourceIdentifierTextBox.setValue(experiment.getBackgroundListenSourceIdentifier());
    sourceIdentifierTextBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            BackgroundListeningPanel.this.experiment
                    .setBackgroundListenSourceIdentifier(sourceIdentifierTextBox.getText());
        }
    });

}

From source file:com.google.sampling.experiential.client.BackgroundPollingPanel.java

License:Open Source License

public BackgroundPollingPanel(ExperimentDAO experiment) {
    this.experiment = experiment;
    myConstants = GWT.create(MyConstants.class);

    rootPanel = new VerticalPanel();
    rootPanel.setStyleName("bordered");
    initWidget(rootPanel);//from ww w .j  av a 2s. co m

    HTML titleLabel = new HTML("<h2>" + myConstants.backgroundPollingTitle() + ": </h2>");
    rootPanel.add(titleLabel);

    HTML html = new HTML("&nbsp;&nbsp;&nbsp;<font color=\"red\" size=\"smaller\"><i>("
            + myConstants.iOSIncompatible() + ")</i></font>");
    rootPanel.add(html);

    pollingCheckboxPanel = new HorizontalPanel();
    rootPanel.add(pollingCheckboxPanel);

    CheckBox shouldLogCheckbox = new CheckBox();
    pollingCheckboxPanel.add(shouldLogCheckbox);

    Label checkBoxLabel = new Label(myConstants.shouldBackgroundPoll());
    checkBoxLabel.setStyleName("gwt-Label-Header");
    pollingCheckboxPanel.add(checkBoxLabel);

    shouldLogCheckbox.setValue(experiment.isLogActions() != null && experiment.isLogActions());

    shouldLogCheckbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            BackgroundPollingPanel.this.experiment.setLogActions(event.getValue());

        }
    });
}

From source file:com.google.sampling.experiential.client.InputsPanel.java

License:Open Source License

private void createRequiredCheckBoxColumn() {
    VerticalPanel mp = new VerticalPanel();
    upperLinePanel.add(mp);//ww  w  .  j  a v a 2  s .c  om
    Label mandatoryLabel = new Label(myConstants.required() + ":");
    mandatoryLabel.setStyleName("keyLabel");
    mp.add(mandatoryLabel);
    final CheckBox valueBox = new CheckBox();
    valueBox.setValue(input.getMandatory());
    mp.add(valueBox);
    valueBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent arg0) {
            input.setMandatory(valueBox.getValue());
        }
    });
}

From source file:com.google.sampling.experiential.client.RecordPhoneDetailsPanel.java

License:Open Source License

public RecordPhoneDetailsPanel(ExperimentDAO experiment) {
    this.experiment = experiment;
    myConstants = GWT.create(MyConstants.class);

    rootPanel = new VerticalPanel();
    rootPanel.setStyleName("bordered");
    initWidget(rootPanel);/*from   w  w w .  ja va2s .  c  o m*/

    HTML titleLabel = new HTML("<h2>" + myConstants.recordPhoneDetailsTitle() + ": </h2>");
    rootPanel.add(titleLabel);

    HTML html = new HTML("&nbsp;&nbsp;&nbsp;<font color=\"red\" size=\"smaller\"><i>("
            + myConstants.iOSIncompatible() + ")</i></font>");
    rootPanel.add(html);

    recordPhoneDetailsCheckboxPanel = new HorizontalPanel();
    rootPanel.add(recordPhoneDetailsCheckboxPanel);

    CheckBox shouldRecordCheckbox = new CheckBox();
    recordPhoneDetailsCheckboxPanel.add(shouldRecordCheckbox);

    Label checkBoxLabel = new Label(myConstants.shouldRecordPhoneDetailsOnJoin());
    checkBoxLabel.setStyleName("gwt-Label-Header");
    recordPhoneDetailsCheckboxPanel.add(checkBoxLabel);

    shouldRecordCheckbox
            .setValue(experiment.isRecordPhoneDetails() != null && experiment.isRecordPhoneDetails());

    shouldRecordCheckbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            RecordPhoneDetailsPanel.this.experiment.setRecordPhoneDetails(event.getValue());

        }
    });
}

From source file:com.google.testing.testify.risk.frontend.client.view.impl.KnownRiskViewImpl.java

License:Apache License

/**
 * Returns a CheckBox to control the RiskProvider (changing the check state regenerates the risk
 * grid's colors.)/*from w  w w. j av  a 2s. c o  m*/
 */
private CheckBox getRiskProviderCheckBox(RiskProvider provider) {
    CheckBox providerCheckBox = new CheckBox(provider.getName());
    providerCheckBox.setValue(true);
    providerCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            refreshRiskCalculation();
        }
    });
    return providerCheckBox;
}

From source file:com.googlesource.gerrit.plugins.emoticons.client.OnEditEnabler.java

License:Apache License

@SuppressWarnings({ "unchecked", "rawtypes" })
public void listenTo(CheckBox cb) {
    cb.addValueChangeHandler((ValueChangeHandler) this);
}

From source file:com.gwtm.ui.client.widgets.CheckBoxGroup.java

License:Apache License

@Override
public void add(Widget w) {
    assert w instanceof CheckBox : "Can only contain CheckBox widgets in CheckBoxGroup";
    CheckBox checkbox = (CheckBox) w;
    super.add(checkbox);
    checkbox.addValueChangeHandler(this);
}

From source file:com.mcherm.zithiacharsheet.client.SettableBooleanField.java

License:Apache License

public SettableBooleanField(String text, final SettableBooleanValue value) {
    final CheckBox checkBox = new CheckBox(text);
    checkBox.setValue(value.getValue());
    disposer.observe(value, new Observer() {
        public void onChange() {
            checkBox.setValue(value.getValue());
        }//from w ww  .  j a v a 2 s.c om
    });
    checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            value.setValue(event.getValue());
        }
    });
    this.add(checkBox);
}

From source file:com.phideltcmu.recruiter.client.ui.CategoriesPanel.java

License:Creative Commons License

@Override
public void onCategoriesFetched(CategoriesFetchedEvent event) {
    this.remove(loading);
    VerticalPanel vp = new VerticalPanel();
    vp.add(header);//from  ww w  . j  av a2 s  .  c om
    vp.add(new InlineHTML("<br><hr><br>"));
    for (final Category c : event.getCategoryList()) {
        final String categoryName = c.getValue();
        CheckBox checkBox = new CheckBox(categoryName);
        checkBox.setEnabled(true);
        checkBox.setValue(defaultCheck);
        checkBooleanMap.put(categoryName, defaultCheck);
        checkMap.put(c.getValue(), checkBox);

        checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
            @Override
            public void onValueChange(ValueChangeEvent<Boolean> booleanValueChangeEvent) {
                checkBooleanMap.put(categoryName, !checkBooleanMap.get(categoryName));
            }
        });
        vp.add(checkBox);
    }
    vp.add(new InlineHTML("<br><hr><br>"));
    this.add(vp);
    postFetchFireBus.fireEvent(new CategoriesPanelLoadedEvent(event.getCategoryList()));
}

From source file:com.risevision.ui.client.common.widgets.RiseMultiSelectWidget.java

License:Open Source License

public void addItem(String name, String value) {
    CheckBox itemCheckBox = new CheckBox();
    itemCheckBox.addValueChangeHandler(this);
    //      itemCheckBox.setStyleName("rdn-CheckBox");

    Label nameLabel = new Label(name);
    nameLabel.setStyleName("rva-ShortText");
    nameLabel.getElement().getStyle().setProperty("whiteSpace", "nowrap");

    HorizontalPanel checkBoxPanel = new HorizontalPanel();
    checkBoxPanel.add(itemCheckBox);//from www . j  a  v a 2s. c  o m
    checkBoxPanel.add(new SpacerWidget());
    checkBoxPanel.add(nameLabel);

    listPanel.add(checkBoxPanel);

    checkBoxList.add(itemCheckBox);
    valuesList.add(value);
}