List of usage examples for com.google.gwt.user.client.ui CheckBox addValueChangeHandler
@Override
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<Boolean> handler)
From source file:ar.com.kyol.jet.client.wrappers.CheckBoxWrapper.java
License:Open Source License
public CheckBoxWrapper(ObjectSetter objSetter, CheckBox checkBox, boolean useValueAsString) { super(useValueAsString); this.objSetter = objSetter; this.checkBox = checkBox; if (useValueAsString) { if (objSetter.getValue() != null) { checkBox.setValue(new Boolean((String) objSetter.getValue())); }/* w w w . j a v a 2 s . co m*/ } else { checkBox.setValue((Boolean) objSetter.getValue()); } checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> arg0) { setProperty(arg0.getValue()); } }); initWidget(checkBox); }
From source file:burrito.client.widgets.panels.table.Table.java
License:Apache License
protected void renderTable() { // remove all previous rows for (int i = 1; i < table.getRowCount(); i++) { table.removeRow(i);/*from w w w . ja v a 2 s .c o m*/ } int leftMargin = 0; if (rowsSelectable) { leftMargin++; // add margin because of select box } table.resize(currentModel.size() + 1, this.numberOfColumns); int row = 1; for (final T obj : currentModel) { String[] names = table.getRowFormatter().getStyleName(row).split(" "); for (String style : names) { if (style.length() > 0) table.getRowFormatter().removeStyleName(row, style); } if (rowsSelectable) { final int thisRowAsFinal = row; CheckBox select = new CheckBox(); select.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getValue().booleanValue()) { table.getRowFormatter().addStyleName(thisRowAsFinal, "k5-Table-row-selected"); } else { table.getRowFormatter().removeStyleName(thisRowAsFinal, "k5-Table-row-selected"); } } }); table.setWidget(row, 0, select); } for (int column = 0; column < numberOfModelColumns; column++) { table.setWidget(row, column + leftMargin, cellRenderers.get(column).render(obj)); } table.getRowFormatter().addStyleName(row, "k5-Table-row"); if (row % 2 == 0) { table.getRowFormatter().addStyleName(row, "k5-Table-row-even"); } else { table.getRowFormatter().addStyleName(row, "k5-Table-row-odd"); } String rowStyle = rowStyle(row, obj); if (rowStyle != null) { table.getRowFormatter().addStyleName(row, rowStyle); } if (rowsOrderable && rowOrderHandler != null) { final int fRow = row; Anchor up = new Anchor(messages.up()); up.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { move(fRow - 1, -1); } }); up.addStyleName("k5-Table-order-up"); Anchor down = new Anchor(messages.down()); down.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { move(fRow - 1, 1); } }); down.addStyleName("k5-Table-order-down"); HorizontalPanel hp = new HorizontalPanel(); hp.add(up); hp.add(down); int rightMargin = 1; if (rowsEditable) { rightMargin++; } table.setWidget(row, numberOfColumns - rightMargin, hp); } if (rowsEditable && rowEditHandler != null) { Anchor edit = new Anchor(messages.edit()); String href = rowEditHandler.getHref(obj); if (href != null) { edit.setHref(href); } else { edit.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { rowEditHandler.onRowEditClicked(obj); } }); } table.setWidget(row, numberOfColumns - 1, edit); } row++; } }
From source file:com.areahomeschoolers.baconbits.client.widgets.UserAgreementDialog.java
License:Open Source License
@Override public void show() { if (vp.getWidgetCount() > 0) { super.show(); return;//from www . ja va 2 s . c om } String msg = "Hello,<br><br>Our site policies have changed. To continue using our site, please review them, then check the box below and continue on to your privacy settings."; HTML h = new HTML(msg); h.addStyleName("mediumText heavyPadding"); vp.add(h); String txt = "I agree to the site "; txt += "<a href=\"" + Constants.TOS_URL + "&noTitle=true\" target=\"_blank\">terms of service</a> "; txt += "and <a href=\"" + Constants.PRIVACY_POLICY_URL + "&noTitle=true\" target=\"_blank\">privacy policy</a> "; final CheckBox scb = new CheckBox(txt, true); scb.addStyleName("heavyPadding"); vp.add(scb); ButtonPanel bp = new ButtonPanel(); final Button settings = new Button("Continue to Privacy Settings"); settings.setEnabled(false); settings.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (!scb.getValue()) { scb.addStyleName("gwt-TextBoxError"); return; } settings.setEnabled(false); User u = Application.getCurrentUser(); u.setShowUserAgreement(false); u.setDirectoryOptOut(false); // this will ensure that the kids settings are synchronized with the parent's userService.savePrivacyPreference(u.getPrivacyPreference(PrivacyPreferenceType.FAMILY), new Callback<PrivacyPreference>() { @Override protected void doOnSuccess(PrivacyPreference result) { } }); userService.save(u, new Callback<ServerResponseData<User>>() { @Override protected void doOnSuccess(ServerResponseData<User> result) { } }); } }); bp.addCenterButton(settings); scb.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { settings.setEnabled(event.getValue()); } }); vp.add(bp); UserAgreementDialog.super.show(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { UserAgreementDialog.super.center(); } }); }
From source file:com.calclab.emite.example.pingpong.client.PingPongWidget.java
License:Open Source License
public PingPongWidget() { maxOutput = 500;//www. jav a 2s. c om hideEvents = true; header = new VerticalPanel(); add(header); currentUser = new Label("no user yet."); sessionStatus = new Label("no session status yet."); final FlowPanel status = new FlowPanel(); status.add(currentUser); status.add(sessionStatus); add(status); login = new Button("Login"); logout = new Button("Logout"); clear = new Button("Clear"); final CheckBox hideEventsCheck = new CheckBox("Hide events"); buttons = new FlowPanel(); buttons.add(login); buttons.add(logout); buttons.add(clear); buttons.add(hideEventsCheck); add(buttons); output = new VerticalPanel(); add(output); hideEventsCheck.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(final ValueChangeEvent<Boolean> event) { hideEvents = event.getValue(); final int widgetCount = output.getWidgetCount(); for (int index = 0; index < widgetCount; index++) { final Widget w = output.getWidget(index); if (isEventWidget(w)) { w.setVisible(!hideEvents); } } } }); hideEventsCheck.setValue(hideEvents); }
From source file:com.controlj.addon.gwttree.client.TreeManager.java
License:Open Source License
private TreeItem createTreeItem(final TreeEntry entry) { TreeItem item = new TreeItem(); if (!entry.hasTrendSources()) item.setText(entry.getName());//from w w w. ja v a 2 s .co m else { CheckBox checkBox = new CheckBox(entry.getName()); checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getValue()) checkedEntries.add(entry); else checkedEntries.remove(entry); listener.selectionChanged(); } }); item.setWidget(checkBox); } item.setUserObject(entry); return item; }
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());//from ww w. j a v a2 s . com isShown.addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { value.setShown(!value.isShown()); rebuildIndex(); 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.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);//www . j ava 2 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.gerrit.client.patches.ReviewedPanels.java
License:Apache License
private CheckBox createReviewedCheckbox() { final CheckBox checkBox = new CheckBox(PatchUtil.C.reviewedAnd() + " "); checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override/*from w w w . j a v a 2s . c o m*/ public void onValueChange(ValueChangeEvent<Boolean> event) { final boolean value = event.getValue(); setReviewedByCurrentUser(value); if (checkBoxTop.getValue() != value) { checkBoxTop.setValue(value); } if (checkBoxBottom.getValue() != value) { checkBoxBottom.setValue(value); } } }); return checkBox; }
From source file:com.google.gerrit.client.ui.OnEditEnabler.java
License:Apache License
@SuppressWarnings({ "unchecked", "rawtypes" }) public void listenTo(final CheckBox cb) { cb.addValueChangeHandler((ValueChangeHandler) this); }
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);// w w w. j av a 2 s. c o m } else { checkbox.setValue(true); checkbox.addValueChangeHandler(new CheckboxHandler(checkbox, h)); } }