List of usage examples for com.google.gwt.user.client.ui CheckBox setValue
@Override public void setValue(Boolean value)
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);/* w w w .j a va2s. c o m*/ HTML titleLabel = new HTML("<h2>" + myConstants.backgroundListeningTitle() + ": </h2>"); rootPanel.add(titleLabel); HTML html = new HTML(" <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 w ww . ja va2 s.co m HTML titleLabel = new HTML("<h2>" + myConstants.backgroundPollingTitle() + ": </h2>"); rootPanel.add(titleLabel); HTML html = new HTML(" <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.EsmPanel.java
License:Open Source License
public EsmPanel(final SignalScheduleDAO schedule) { MyConstants myConstants = GWT.create(MyConstants.class); this.schedule = schedule; VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setSpacing(2);/*from w w w . j ava 2 s. c o m*/ initWidget(verticalPanel); HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setSpacing(2); horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.setCellVerticalAlignment(horizontalPanel, HasVerticalAlignment.ALIGN_MIDDLE); horizontalPanel.setWidth(""); Label lblFrequency = new Label(myConstants.frequency() + ":"); lblFrequency.setStyleName("gwt-Label-Header"); horizontalPanel.add(lblFrequency); ValueSpinnerFixed frequencySpinner = new ValueSpinnerFixed(schedule.getEsmFrequency(), 0, 100); frequencySpinner.getTextBox().setWidth("18px"); frequencySpinner.setWidth("35px"); horizontalPanel.add(frequencySpinner); frequencySpinner.getSpinner().addSpinnerListener(new SpinnerListener() { public void onSpinning(long value) { schedule.setEsmFrequency((int) value); } }); Label lblPeriod = new Label(myConstants.period() + ": "); lblPeriod.setStyleName("gwt-Label-Header"); horizontalPanel.add(lblPeriod); final ListBox listBox = new ListBox(); for (int i = 0; i < SignalScheduleDAO.ESM_PERIODS.length; i++) { listBox.addItem(SignalScheduleDAO.ESM_PERIODS_NAMES[i]); } horizontalPanel.add(listBox); listBox.setVisibleItemCount(1); Integer period = schedule.getEsmPeriodInDays(); if (period == null) { period = SignalScheduleDAO.DEFAULT_ESM_PERIOD; schedule.setEsmPeriodInDays(SignalScheduleDAO.DEFAULT_ESM_PERIOD); } listBox.setSelectedIndex(period); listBox.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { schedule.setEsmPeriodInDays(listBox.getSelectedIndex()); } }); verticalPanel.add(horizontalPanel); HorizontalPanel weekendsPanel = new HorizontalPanel(); weekendsPanel.setSpacing(2); weekendsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.add(weekendsPanel); weekendsPanel.setWidth(""); Label lblWeekends = new Label(myConstants.includeWeekends() + ": "); lblWeekends.setStyleName("gwt-Label-Header"); weekendsPanel.add(lblWeekends); final CheckBox weekendsBox = new CheckBox(""); weekendsPanel.add(weekendsBox); weekendsBox.setValue(schedule.getEsmWeekends()); weekendsBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { schedule.setEsmWeekends(weekendsBox.getValue()); } }); HorizontalPanel horizontalPanel_1 = new HorizontalPanel(); horizontalPanel_1.setSpacing(2); horizontalPanel_1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.add(horizontalPanel_1); horizontalPanel_1.setWidth(""); Label lblStartHour = new Label(myConstants.startTime() + ":"); lblStartHour.setStyleName("gwt-Label-Header"); horizontalPanel_1.add(lblStartHour); lblStartHour.setWidth("83px"); Date setTime = null; if (schedule.getEsmStartHour() != null) { setTime = new Date(); long offset = schedule.getEsmStartHour(); int hours = (int) (offset / (60 * 60 * 1000)); int minutes = (int) (offset - (hours * 60 * 60 * 1000)) / (60 * 1000); setTime.setHours(hours); setTime.setMinutes(minutes); setTime.setSeconds(0); } else { Date now = new Date(); now.setMinutes(0); now.setSeconds(0); setTime = now; } final TimePickerFixed startTimeBox = new TimePickerFixed(setTime, DateTimeFormat.getFormat("aa"), DateTimeFormat.getFormat("hh"), DateTimeFormat.getFormat("mm"), null); horizontalPanel_1.add(startTimeBox); HorizontalPanel horizontalPanel_2 = new HorizontalPanel(); horizontalPanel_2.setSpacing(2); horizontalPanel_2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.add(horizontalPanel_2); horizontalPanel_2.setWidth(""); startTimeBox.addValueChangeHandler(new ValueChangeHandler() { public void onValueChange(ValueChangeEvent event) { Date dateTime = startTimeBox.getDateTime(); long offset = (dateTime.getHours() * 60 * 60 * 1000) + (dateTime.getMinutes() * 60 * 1000); schedule.setEsmStartHour(offset); } }); Label lblEndTime = new Label(myConstants.endTime() + ": "); lblEndTime.setStyleName("gwt-Label-Header"); horizontalPanel_2.add(lblEndTime); lblEndTime.setWidth("83px"); setTime = null; if (schedule.getEsmEndHour() != null) { setTime = new Date(); long offset = schedule.getEsmEndHour(); int hours = (int) (offset / (60 * 60 * 1000)); int minutes = (int) (offset - (hours * 60 * 60 * 1000)) / (60 * 1000); setTime.setHours(hours); setTime.setMinutes(minutes); } else { Date now = new Date(); now.setMinutes(0); now.setSeconds(0); setTime = now; } final TimePickerFixed endTimePicker = new TimePickerFixed(setTime, DateTimeFormat.getFormat("aa"), DateTimeFormat.getFormat("hh"), DateTimeFormat.getFormat("mm"), null); horizontalPanel_2.add(endTimePicker); endTimePicker.addValueChangeHandler(new ValueChangeHandler() { public void onValueChange(ValueChangeEvent event) { Date dateTime = endTimePicker.getDateTime(); long offset = (dateTime.getHours() * 60 * 60 * 1000) + (dateTime.getMinutes() * 60 * 1000); schedule.setEsmEndHour(offset); } }); TimeoutPanel timeoutPanel = new TimeoutPanel(schedule); verticalPanel.add(timeoutPanel); timeoutPanel.setWidth("286px"); MinimumBufferPanel minimumBufferPanel = new MinimumBufferPanel(schedule); verticalPanel.add(minimumBufferPanel); minimumBufferPanel.setWidth("286px"); SnoozePanel snoozePanel = new SnoozePanel(schedule); verticalPanel.add(snoozePanel); snoozePanel.setWidth("286px"); }
From source file:com.google.sampling.experiential.client.InputsPanel.java
License:Open Source License
private void createRequiredCheckBoxColumn() { VerticalPanel mp = new VerticalPanel(); upperLinePanel.add(mp);//w w w . j a va 2 s . c o m 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.ListChoicesPanel.java
License:Open Source License
/** * @param input/*from ww w . ja v a2 s. co m*/ */ public ListChoicesPanel(final InputDAO input) { this.input = input; mainPanel = new VerticalPanel(); mainPanel.setSpacing(2); initWidget(mainPanel); final CheckBox multiselect = new CheckBox("Multiple selections"); multiselect.setValue(input.getMultiselect()); multiselect.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { input.setMultiselect(multiselect.getValue()); } }); mainPanel.add(multiselect); Label lblSignalTimes = new Label("List Choice (s)"); lblSignalTimes.setStyleName("gwt-Label-Header"); mainPanel.add(lblSignalTimes); choicePanelsList = new LinkedList<ListChoicePanel>(); String[] choices = input.getListChoices(); if (choices == null || choices.length == 0) { ListChoicePanel choicePanel = new ListChoicePanel(this); String choice = choicePanel.getChoice(); choices = new String[] { choice }; mainPanel.add(choicePanel); choicePanelsList.add(choicePanel); input.setListChoices(choices); } else { for (int i = 0; i < choices.length; i++) { ListChoicePanel choicePanel = new ListChoicePanel(this); choicePanel.setChoice(choices[i]); mainPanel.add(choicePanel); choicePanelsList.add(choicePanel); } } }
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);/* ww w. j av a2s . c o m*/ HTML titleLabel = new HTML("<h2>" + myConstants.recordPhoneDetailsTitle() + ": </h2>"); rootPanel.add(titleLabel); HTML html = new HTML(" <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.sampling.experiential.client.SchedulePanel.java
License:Open Source License
private Widget createUserEditable(SignalScheduleDAO schedule2) { HorizontalPanel userEditablePanel = new HorizontalPanel(); userEditablePanel.setSpacing(2);/* w ww. j av a 2s .com*/ userEditablePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); userEditablePanel.setWidth(""); Label lblUserEditable = new Label("User Editable: "); lblUserEditable.setStyleName("gwt-Label-Header"); userEditablePanel.add(lblUserEditable); final CheckBox userEditableCheckBox = new CheckBox(""); userEditablePanel.add(userEditableCheckBox); userEditableCheckBox .setValue(schedule.getUserEditable() != null ? schedule.getUserEditable() : Boolean.TRUE); userEditableCheckBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { schedule.setUserEditable(userEditableCheckBox.getValue()); } }); return userEditablePanel; }
From source file:com.google.sampling.experiential.client.SchedulePanel.java
License:Open Source License
private Widget createUserEditableOnce(SignalScheduleDAO schedule2) { HorizontalPanel userEditablePanel = new HorizontalPanel(); userEditablePanel.setSpacing(2);/*from w ww . ja va2 s . c om*/ userEditablePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); userEditablePanel.setWidth(""); Label lblUserEditable = new Label("Only Editable on Join: "); lblUserEditable.setStyleName("gwt-Label-Header"); userEditablePanel.add(lblUserEditable); final CheckBox userEditableCheckBox = new CheckBox(""); userEditablePanel.add(userEditableCheckBox); userEditableCheckBox.setValue( schedule.getOnlyEditableOnJoin() != null ? schedule.getOnlyEditableOnJoin() : Boolean.FALSE); userEditableCheckBox.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { schedule.setOnlyEditableOnJoin(userEditableCheckBox.getValue()); } }); return userEditablePanel; }
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. ja va2 s .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.gwtm.ui.client.widgets.CheckBoxGroup.java
License:Apache License
@Override public void onClick(ClickEvent e) { final EventTarget target = e.getNativeEvent().getEventTarget(); String targetTagName = ((Element) target.cast()).getTagName().toUpperCase(); Utils.Console("onClick target " + targetTagName); if (targetTagName.equals("LABEL")) { return; // if check box label is click, another (simulated) click event with // check box INPUT as target will fire after this one. So this click event // can be safely ignored. }/*from ww w . j a v a2 s .co m*/ Element div = Element.as(target); while (!div.getNodeName().toUpperCase().equals("SPAN") || div.getParentElement() != this.getElement()) { div = div.getParentElement(); if (div == null) { Utils.Console("CheckBoxGroup onClick: span not found"); return; } } final int index = DOM.getChildIndex(this.getElement(), (com.google.gwt.user.client.Element) div); com.google.gwt.user.client.ui.CheckBox checkbox = (com.google.gwt.user.client.ui.CheckBox) getWidget(index); Utils.Console("onClick " + checkbox.getValue()); if (targetTagName.equals("INPUT")) { Utils.Console("onClick value changed"); checkbox.setValue(checkbox.getValue()); // if target is check box INPUT, check box value is // already changed when click event is fired. // just need to set its current value back to the check box // to update style. } else { checkbox.setValue(!checkbox.getValue()); } Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { // SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(index, target); // fireEvent(selectionChangedEvent); ValueChangeEvent.fire(CheckBoxGroup.this, index); } }); }