/** * Get the boolean value of the button state. * * @return True if the button is pressed down or checked. * * @deprecated As of 7.0, use {@link #getValue()} instead and, if needed, * handle null values. */ @Deprecated public boolean booleanValue() { Boolean value = getValue(); return (null == value) ? false : value.booleanValue(); }
@Override public void valueChange(Property.ValueChangeEvent event) { m_nameTextField.setEnabled(m_filterByNameCheckBox.getValue()); } });
@Override public void valueChange(Property.ValueChangeEvent event) { enableAlarmData(hasAlarmData.getValue()); } });
@Override public void writeDesign(Element design, DesignContext designContext) { super.writeDesign(design, designContext); CheckBox def = (CheckBox) designContext.getDefaultInstance(this); Attributes attr = design.attributes(); DesignAttributeHandler.writeAttribute("checked", attr, getValue(), def.getValue(), Boolean.class, designContext); }
@Override public void valueChange(Property.ValueChangeEvent event) { updateEnabledState(); if (!selectedField.getValue()) { editableField.discard(); } if (!blockListenerOrValidators) { try { blockListenerOrValidators = true; controller.fireSelectionValueChanged(getData(), getItemId(), selectedField.getValue()); } finally { blockListenerOrValidators = false; } } } });
private void updateCheckBox(CheckBox checkBox, Object rowId, boolean enabled) { checkBox.setValue(enabled); Collection<Field<?>> columns = getFieldsForItemId(rowId); columns.remove(checkBox); enableFields(columns, checkBox.getValue()); }
@Override public void buttonClick(Button.ClickEvent event) { m_dashletSpec.getParameters().put("maximizeWidth", (m_maximizeWidth.getValue() ? "true" : "false")); m_dashletSpec.getParameters().put("maximizeHeight", (m_maximizeHeight.getValue() ? "true" : "false")); m_dashletSpec.getParameters().put("chart", String.valueOf(m_chartSelect.getValue())); WallboardProvider.getInstance().save(); ((WallboardConfigUI) getUI()).notifyMessage("Data saved", "Properties"); close(); } });
private void updateCheckBoxes() { for(Object eachRowId : getItemIds()) { CheckBox checkBox = getCheckBoxForRow(eachRowId); updateCheckBox(checkBox, eachRowId, checkBox.getValue()); } }
m_dashletSpec.getParameters().put("filterByName", (m_filterByNameCheckBox.getValue() ? "true" : "false")); if (m_filterByNameCheckBox.getValue()) { m_dashletSpec.getParameters().put("nameValue", m_nameTextField.getValue()); } else { m_dashletSpec.getParameters().put("filterByAttribute", (m_filterByAttributeCheckBox.getValue() ? "true" : "false")); if (m_filterByAttributeCheckBox.getValue()) { m_dashletSpec.getParameters().put("attributeKey", m_attributeKeyTextField.getValue()); m_dashletSpec.getParameters().put("attributeValue", m_attributeValueTextField.getValue()); m_dashletSpec.getParameters().put("filterBySeverity", (m_filterBySeverityCheckBox.getValue() ? "true" : "false")); if (m_filterBySeverityCheckBox.getValue() && m_severitySelect.getValue() != null) { m_dashletSpec.getParameters().put("severityValue", m_severitySelect.getValue().toString()); } else { if (m_filterBySeverityCheckBox.getValue() && m_compareOperatorSelect.getValue() != null) { m_dashletSpec.getParameters().put("severityCompareOperator", m_compareOperatorSelect.getValue().toString()); } else {
@Override public void setChecked(boolean checked, MouseEventDetails mouseEventDetails) { if (isReadOnly()) { return; } /* * Client side updates the state before sending the event so we need * to make sure the cached state is updated to match the client. If * we do not do this, a reverting setValue() call in a listener will * not cause the new state to be sent to the client. * * See #11028, #10030. */ getUI().getConnectorTracker().getDiffState(CheckBox.this) .put("checked", checked); final Boolean oldValue = getValue(); final Boolean newValue = checked; if (!newValue.equals(oldValue)) { // The event is only sent if the switch state is changed setValue(newValue); } } };
@Test public void checkBoxValueChangePropagatesToCustomField() throws Exception { // GIVEN baseItem = new JcrNewNodeAdapter(baseNode, baseNode.getPrimaryNodeType().getName()); checkBoxField = new CheckBoxFieldFactory(definition, baseItem, uiContext, i18NAuthoringSupport); checkBoxField.setComponentProvider(componentProvider); Field<Boolean> field = checkBoxField.createField(); CheckBox checkBox = (CheckBox) ((CheckBoxField) field).iterator().next(); // WHEN checkBox.setValue(true); // THEN assertEquals(true, checkBox.getValue()); assertEquals(true, field.getValue()); assertEquals(true, baseItem.getItemProperty(definition.getName()).getValue()); }
@Test public void setReadOnlyDefaultValue() throws Exception { // GIVEN baseItem = new JcrNewNodeAdapter(baseNode, baseNode.getPrimaryNodeType().getName()); checkBoxField = new CheckBoxFieldFactory(definition, baseItem, uiContext, i18NAuthoringSupport); checkBoxField.setComponentProvider(componentProvider); definition.setDefaultValue("true"); definition.setReadOnly(true); // WHEN Field<Boolean> field = checkBoxField.createField(); // THEN assertEquals(true, field.getValue()); assertTrue(field.isReadOnly()); CheckBox checkBox = (CheckBox) ((CheckBoxField) field).iterator().next(); assertEquals(true, checkBox.getValue()); assertTrue(checkBox.isReadOnly()); }
if (hasAlarmData.getValue() != enable) { hasAlarmData.setValue(enable);