@Override public InputBuilder checked() { assertCanAddAttribute().setChecked(true); return this; }
/** * Checks or unchecks the check box, firing {@link ValueChangeEvent} if * appropriate. * <p> * Note that this <em>does not</em> set the value property of the checkbox * input element wrapped by this widget. For access to that property, see * {@link #setFormValue(String)} * * @param value true to check, false to uncheck; null value implies false * @param fireEvents If true, and value has changed, fire a * {@link ValueChangeEvent} */ @Override public void setValue(Boolean value, boolean fireEvents) { if (value == null) { value = Boolean.FALSE; } Boolean oldValue = getValue(); inputElem.setChecked(value); inputElem.setDefaultChecked(value); if (value.equals(oldValue)) { return; } if (fireEvents) { ValueChangeEvent.fire(this, value); } }
public SelectAction translateSelectionEvent(CellPreviewEvent<T> event) { // Handle the event. NativeEvent nativeEvent = event.getNativeEvent(); if (BrowserEvents.CLICK.equals(nativeEvent.getType())) { // Ignore if the event didn't occur in the correct column. if (column > -1 && column != event.getColumn()) { return SelectAction.IGNORE; } // Determine if we clicked on a checkbox. Element target = nativeEvent.getEventTarget().cast(); if ("input".equals(target.getTagName().toLowerCase(Locale.ROOT))) { final InputElement input = target.cast(); if ("checkbox".equals(input.getType().toLowerCase(Locale.ROOT))) { // Synchronize the checkbox with the current selection state. input.setChecked(event.getDisplay().getSelectionModel().isSelected( event.getValue())); return SelectAction.TOGGLE; } } return SelectAction.IGNORE; } // For keyboard events, do the default action. return SelectAction.DEFAULT; } }
/** * Checks or unchecks the check box, firing {@link ValueChangeEvent} if * appropriate. * <p> * Note that this <em>does not</em> set the value property of the checkbox * input element wrapped by this widget. For access to that property, see * {@link #setFormValue(String)} * * @param value true to check, false to uncheck; null value implies false * @param fireEvents If true, and value has changed, fire a * {@link ValueChangeEvent} */ @Override public void setValue(Boolean value, boolean fireEvents) { if (value == null) { value = Boolean.FALSE; } Boolean oldValue = fireEvents ? getValue() : null; getInputElement().setChecked(value); getInputElement().setDefaultChecked(value); if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, oldValue, value); } }
@Override public void set(Boolean value) { element.setChecked(value); }
private void setInputValue(boolean value) { this.checkbocElement.setChecked(value); }
private void setInputValue(boolean value) { this.checkbocElement.setChecked(value); }
input.setChecked(isChecked);
@Override public InputBuilder checked() { assertCanAddAttribute().setChecked(true); return this; }
/** * Select the native input element in the given cell. This method should * correspond with the HTML returned from {@link #getInputHtml}. * * @param selectionPolicy the associated {@link SelectionPolicy} * @param td the cell containing the element * @param selected true to select, false to deselect */ protected void setInputSelected(SelectionPolicy selectionPolicy, Element td, boolean selected) { ((InputElement) td.getFirstChild()).setChecked(selected); } }
@Override public InputBuilder checked() { assertCanAddAttribute().setChecked(true); return this; }
@Override public void setRawValue(String value) { boolean b = Boolean.valueOf(value).booleanValue(); ((InputElement) getInputEl().dom.cast()).setChecked(b); }
/** * set a CheckBox value without firing any {@link ValueChangeEvent}. * * @param checkBox the targeted checkBox * @param newValue the new value, which could be retrieve through {@link CheckBox#getValue()} */ public static void setCheckBoxValueSilent(CheckBox checkBox, boolean newValue) { InputElement inputElem = GwtReflectionUtils.getPrivateFieldValue(checkBox, "inputElem"); inputElem.setChecked(newValue); inputElem.setDefaultChecked(newValue); }
/** * set a CheckBox value without firing any {@link ValueChangeEvent}. * * @param checkBox the targeted checkBox * @param newValue the new value, which could be retrieve through {@link CheckBox#getValue()} */ public static void setCheckBoxValueSilent(CheckBox checkBox, boolean newValue) { InputElement inputElem = GwtReflectionUtils.getPrivateFieldValue(checkBox, "inputElem"); inputElem.setChecked(newValue); inputElem.setDefaultChecked(newValue); }
@Override public void setValue(Boolean value, boolean fireEvents) { if (value == null) { value = false; } if (!fireEvents && value) { ignoreChangeEvent = true; } inputRadio.setChecked(value); inputRadio.setDefaultChecked(value); if (fireEvents) { ValueChangeEvent.fire(this, value); } }
public void setChecked(boolean b){ ((InputElement)(getElement().cast())).setChecked(b); }
private void setCheckBoxState(Path nodePath, InputElement checkBoxInputElement) { if (indeterminate.contains(nodePath)) { checkBoxInputElement.setId(checkBoxInputElement.getId() + "-indeterminate"); setIndeterminate(checkBoxInputElement); } else if (!unselected.contains(nodePath)) { checkBoxInputElement.setChecked(true); checkBoxInputElement.setId(checkBoxInputElement.getId() + "-checked"); } else { checkBoxInputElement.setId(checkBoxInputElement.getId() + "-unchecked"); } }
@Override public void setValue(final Boolean value, final boolean fireEvents) { Boolean oldValue = getValue(); if (isAttached()) { switchState(getElement(), value, true); } else { element.setChecked(value); } if (fireEvents) { ValueChangeEvent.fireIfNotEqual(ToggleSwitchBase.this, oldValue, value); } }
@Override public void setValue(final Boolean value, final boolean fireEvents) { Boolean oldValue = getValue(); if (isAttached()) { switchState(getElement(), value, true); } else { element.setChecked(value); } if (fireEvents) { ValueChangeEvent.fireIfNotEqual(ToggleSwitchBase.this, oldValue, value); } }
protected void onClick(ComponentEvent ce) { if (checkboxToggle && ce.getTarget() == (Element) checkbox.cast()) { setExpanded(!isExpanded()); boolean isExpanded = isExpanded(); checkbox.setChecked(isExpanded); checkbox.setDefaultChecked(isExpanded); } }