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

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

Introduction

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

Prototype

@Override
public void setValue(Boolean value) 

Source Link

Document

Checks or unchecks the check box.

Usage

From source file:com.google.caliper.cloud.client.BenchmarkDataViewer.java

License:Apache License

private CheckBox newShownCheckbox(final Value value) {
    CheckBox isShown = new CheckBox(value.getLabel());
    isShown.setValue(value.isShown());

    isShown.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            value.setShown(!value.isShown());
            rebuildIndex();/*from www  . j  av  a 2  s.c  om*/
            rebuildValueIndices();
            rebuildCValues();
            rebuildResultsTable();
            if (editable) {
                Map<String, Map<String, Boolean>> variableValuesShown = variableValuesShown();
                BenchmarkServiceAsync benchmarkService = GWT.create(BenchmarkService.class);
                benchmarkService.setVariableValuesShown(benchmarkOwner, benchmarkName, variableValuesShown,
                        NO_OP_CALLBACK);
            }
        }
    });

    return isShown;
}

From source file:com.google.gerrit.client.account.MyWatchesTable.java

License:Apache License

protected void addNotifyButton(final AccountProjectWatch.NotifyType type, final AccountProjectWatchInfo info,
        final int row, final int col) {
    final CheckBox cbox = new CheckBox();

    cbox.addClickHandler(new ClickHandler() {
        @Override//  w ww  . jav  a 2  s.  c o m
        public void onClick(final ClickEvent event) {
            final boolean oldVal = info.getWatch().isNotify(type);
            info.getWatch().setNotify(type, cbox.getValue());
            cbox.setEnabled(false);
            Util.ACCOUNT_SVC.updateProjectWatch(info.getWatch(), new GerritCallback<VoidResult>() {
                public void onSuccess(final VoidResult result) {
                    cbox.setEnabled(true);
                }

                @Override
                public void onFailure(final Throwable caught) {
                    cbox.setEnabled(true);
                    info.getWatch().setNotify(type, oldVal);
                    cbox.setValue(oldVal);
                    super.onFailure(caught);
                }
            });
        }
    });

    cbox.setValue(info.getWatch().isNotify(type));
    table.setWidget(row, col, cbox);
}

From source file:com.google.gerrit.client.change.ReplyBox.java

License:Apache License

private void renderCheckBox(int row, LabelAndValues lv) {
    ApprovalInfo self = Gerrit.isSignedIn() ? lv.info.forUser(Gerrit.getUserAccount().getId().get()) : null;

    final String id = lv.info.name();
    final CheckBox b = new CheckBox();
    b.setText(id);/*from  w  ww. j  a  v a2  s.co  m*/
    b.setEnabled(lv.permitted.contains((short) 1));
    if (self != null && self.value() == 1) {
        b.setValue(true);
    }
    b.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            in.label(id, event.getValue() ? (short) 1 : (short) 0);
        }
    });
    b.setStyleName(style.label_name());
    labelsTable.setWidget(row, 0, b);

    CellFormatter fmt = labelsTable.getCellFormatter();
    fmt.setStyleName(row, labelHelpColumn, style.label_help());
    labelsTable.setText(row, labelHelpColumn, lv.info.valueText("+1"));
}

From source file:com.google.gwt.gen2.demo.picker.client.PickerDemoPanel.java

License:Apache License

public PickerDemoPanel() {
    FlexTable table = new FlexTable();

    // A TimePicker using AM/PM 12h format
    final TimePicker timePicker = new TimePicker(false);
    table.setHTML(3, 0, "Time picker:");
    table.setWidget(3, 1, timePicker);/*  ww  w.ja va  2 s.c o m*/
    final CheckBox enableTimePicker = new CheckBox("Enable/disable");
    enableTimePicker.setValue(timePicker.isEnabled());
    enableTimePicker.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent source) {
            timePicker.setEnabled(enableTimePicker.getValue());
        }
    });
    table.setWidget(3, 2, enableTimePicker);

    // Creating a date time picker with AM/PM 12h TimePicker
    final DateTimePicker dateTimePicker = new DateTimePicker(false);
    dateTimePicker.setWidth("200px");
    // Create a label to display the selected date
    final Label dateLabel = new Label();
    Button getDate = new Button("Show date");
    getDate.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent source) {
            // Display the selected date/time using DateTimeFormat
            dateLabel.setText(DateTimeFormat.getMediumDateTimeFormat().format(dateTimePicker.getDate()));
        }
    });
    dateLabel.setStyleName("sandbox-Date");
    table.setHTML(4, 0, "Date time picker:");

    table.setWidget(4, 1, dateTimePicker);
    table.setWidget(5, 0, getDate);
    table.setWidget(5, 1, dateLabel);
    final CheckBox enableDateTimePicker = new CheckBox("Enable/disable");
    enableDateTimePicker.setValue(dateTimePicker.isEnabled());
    enableDateTimePicker.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            dateTimePicker.setEnabled(enableDateTimePicker.getValue());
        }
    });
    table.setWidget(4, 2, enableDateTimePicker);

    final TimePicker customTimePicker = new TimePicker(new Date(), null, DateTimeFormat.getFormat("HH"),
            DateTimeFormat.getFormat("mm"), null);
    table.setHTML(8, 0, "Another time picker (24h):");
    table.setWidget(8, 1, customTimePicker);
    final CheckBox enable = new CheckBox("Enable/disable");
    enable.setValue(customTimePicker.isEnabled());
    enable.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            customTimePicker.setEnabled(enable.getValue());
        }

    });
    table.setWidget(8, 2, enable);

    initWidget(table);
}

From source file:com.google.gwt.sample.logexample.client.HandlerController.java

License:Apache License

void setupHandler(Class clazz, CheckBox checkbox) {
    Handler h = handlers.get(clazz.getName());
    if (h == null) {
        checkbox.setEnabled(false);//from  w  w w.  ja v  a2s.  c o m
    } else {
        checkbox.setValue(true);
        checkbox.addValueChangeHandler(new CheckboxHandler(checkbox, h));
    }
}

From source file:com.google.gwt.sample.stockwatcher.client.SchedulePage.java

private void refreshScheduleMenuWidgets() {
    scheduleNameTB.setText("");
    actuatorLB.clear();/* www  .  ja  v  a 2 s  .co m*/
    scheduleActuatorLB.clear();

    for (String aName : Data.actuatorAttributeList.keySet()) {
        actuatorLB.addItem(aName);
        scheduleActuatorLB.addItem(aName);
    }

    for (CheckBox chk : chkbx) {
        chk.setValue(false);
    }

    int selectedSchedule = scheduleType.getSelectedIndex();

    scheduleType.clear();
    scheduleType.addItem("Regular Schedule");
    scheduleType.addItem("Special Schedule");
    scheduleType.addItem("Ongoing Schedule");
    scheduleType.setSelectedIndex(selectedSchedule);

    createScheduleType.clear();
    createScheduleType.addItem("Regular Schedule");
    createScheduleType.addItem("Special Schedule");

    actuatorOnStartLB.clear();
    actuatorOnStartLB.addItem("ON");
    actuatorOnStartLB.addItem("OFF");

    actuatorOnEndLB.clear();
    actuatorOnEndLB.addItem("ON");
    actuatorOnEndLB.addItem("OFF");

    ruleLB.clear();
    for (String ruleName : Data.dayScheduleRuleAttributeList.keySet()) {
        ruleLB.addItem(ruleName);
    }

    priorityLB.clear();
    for (int i = 1; i <= 10; i++) {
        priorityLB.addItem("" + i);
    }

    lockEnabledLB.clear();
    lockEnabledLB.addItem("true");
    lockEnabledLB.addItem("false");

    scheduleEnabledLB.clear();
    scheduleEnabledLB.addItem("true");
    scheduleEnabledLB.addItem("false");
}

From source file:com.google.javascript.jscomp.debugger.DebuggerGwtMain.java

License:Apache License

private void createCheckboxes(CellPanel checkboxPanel) {
    for (final CompilationParam param : CompilationParam.getSortedValues()) {
        CheckBox cb = new CheckBox(param.toString());
        cb.setValue(param.getDefaultValue());
        param.apply(options, param.getDefaultValue());
        cb.addClickHandler(new ClickHandler() {
            @Override//from ww w.j ava  2  s.co m
            public void onClick(ClickEvent event) {
                boolean checked = ((CheckBox) event.getSource()).getValue();
                param.apply(options, checked);
                doCompile();
            }
        });
        checkboxPanel.add(cb);
    }
}

From source file:com.google.javascript.jscomp.debugger.gwt.DebuggerGwtMain.java

License:Apache License

private void createCheckboxes(CellPanel checkboxPanel) {
    for (CompilationParam.ParamGroup group : CompilationParam.ParamGroup.values()) {
        SafeHtmlBuilder builder = new SafeHtmlBuilder();
        builder.appendHtmlConstant("<b>");
        builder.appendEscaped(group.name);
        builder.appendHtmlConstant("</b>");

        checkboxPanel.add(new HTML(builder.toSafeHtml()));
        for (final CompilationParam param : CompilationParam.getGroupedSortedValues().get(group)) {
            CheckBox cb = new CheckBox(param.toString());
            if (param.getJavaInfo() != null) {
                cb.setTitle("Java API equivalent: " + param.getJavaInfo());
            }/*from   w  w w.  j  av a 2 s . c  o  m*/
            cb.setValue(param.getDefaultValue());
            param.apply(options, param.getDefaultValue());
            cb.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    boolean checked = ((CheckBox) event.getSource()).getValue();
                    param.apply(options, checked);
                    doCompile();
                }
            });
            checkboxPanel.add(cb);
        }
    }
}

From source file:com.google.mobile.trippy.web.client.view.AddItemPopUpView.java

License:Apache License

/**
 * Sets the content of Pop up Panel.//www . j  a v  a 2s.com
 * 
 */
@Override
public void createPopUp(final int daysCount) {
    if (daysPanel == null) {
        daysPanel = new ArrayList<CheckBox>();
    } else {
        daysPanel.clear();
    }
    content.clear();

    selectDaysLabel.setText("Select Day(s)");
    selectDaysLabel.addStyleName(dayStyle.style.titleBaseModified());

    daysMenu.clear();
    daysMenu.setStyleName(dayStyle.style.daysMenu());
    addSelectOptions(daysMenu);

    for (int i = 0; i <= daysCount; i++) {
        final CheckBox dayPanel = new CheckBox(" Day " + i);
        dayPanel.setStyleName(dayStyle.style.dayPanel());
        if (i == 0) {
            final Message messages = GWT.create(Message.class);
            dayPanel.setText(" " + messages.unscheduled());
            dayPanel.setValue(true);
        } else {
            // if any day is selected, make sure we uncheck "unscheduled"
            dayPanel.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    boolean checked = ((CheckBox) event.getSource()).getValue();
                    if (checked) {
                        ((CheckBox) (daysMenu.getWidget(0))).setValue(false);
                    } else {
                        ((CheckBox) (daysMenu.getWidget(0))).setValue(true);
                        for (int i = 1; i < daysMenu.getWidgetCount(); i++) {
                            CheckBox cb = (CheckBox) daysMenu.getWidget(i);
                            if (cb.getValue()) {
                                ((CheckBox) (daysMenu.getWidget(0))).setValue(false);
                            }
                        }
                    }
                }
            });
        }
        daysMenu.add(dayPanel);
        daysPanel.add(dayPanel);
    }
    content.add(daysMenu);
    dayPopUp.hide();
}

From source file:com.google.mobile.trippy.web.client.view.AddItemPopUpView.java

License:Apache License

public void resetCheckMarks(boolean checkAll) {
    for (int i = 1; i < daysMenu.getWidgetCount(); i++) {
        CheckBox cb = (CheckBox) daysMenu.getWidget(i);
        cb.setValue(checkAll);
    }//from w  ww .j a v  a2 s  .  co  m
    ((CheckBox) daysMenu.getWidget(0)).setValue(!checkAll);
}