/** * Creates a new checkbox with a caption and a set initial state. * * @param caption * the caption of the checkbox * @param initialState * the initial state of the checkbox */ public CheckBox(String caption, boolean initialState) { this(caption); setValue(initialState); }
/** * Creates a new checkbox. */ public CheckBox() { registerRpc(rpc); registerRpc(new FocusAndBlurServerRpcDecorator(this, this::fireEvent)); setValue(Boolean.FALSE); }
@Override public void readDesign(Element design, DesignContext designContext) { super.readDesign(design, designContext); if (design.hasAttr("checked")) { this.setValue(DesignAttributeHandler.readAttribute("checked", design.attributes(), Boolean.class), false); } }
@SuppressWarnings("synthetic-access") protected void updateCheckboxesWithSelectedIds(Set<Object> selectedIds) { for (Map.Entry<Object, CheckBox> entry : m_checkBoxes.entrySet()) { if (!(selectedIds.contains(entry.getKey()))) { entry.getValue().setValue(Boolean.FALSE); } } for (Object id : selectedIds) { getCheckBox(id).setValue(Boolean.TRUE); } } });
public void clearSelectedIds(Table source) { m_selectAll = false; // Uncheck all of the checkboxes for (CheckBox button : m_checkboxes) { button.setValue(false); } m_selectedCheckboxes.clear(); m_notSelectedCheckboxes.clear(); }
public void selectAll(Table source) { m_selectAll = true; m_selectedCheckboxes.clear(); m_notSelectedCheckboxes.clear(); // Check all of the checkboxes for (CheckBox button : m_checkboxes) { button.setValue(true); m_selectedCheckboxes.add((Integer)button.getData()); } }
@Override public void undo() { certificateAuthenticationConfigurationItem.undo(); targetSecurityTokenAuthenticationConfigurationItem.undo(); gatewaySecurityTokenAuthenticationConfigurationItem.undo(); anonymousDownloadAuthenticationConfigurationItem.undo(); certificateAuthCheckbox.setValue(certificateAuthenticationConfigurationItem.isConfigEnabled()); targetSecTokenCheckBox.setValue(targetSecurityTokenAuthenticationConfigurationItem.isConfigEnabled()); gatewaySecTokenCheckBox.setValue(gatewaySecurityTokenAuthenticationConfigurationItem.isConfigEnabled()); downloadAnonymousCheckBox.setValue(anonymousDownloadAuthenticationConfigurationItem.isConfigEnabled()); }
@Override protected void setInternalValue(Object newValue) { maxRangeCheckBox.setValue(newValue == null); toggleDateField(newValue); super.setInternalValue(newValue); }
@Override public void undo() { certificateAuthenticationConfigurationItem.undo(); targetSecurityTokenAuthenticationConfigurationItem.undo(); gatewaySecurityTokenAuthenticationConfigurationItem.undo(); anonymousDownloadAuthenticationConfigurationItem.undo(); certificateAuthCheckbox.setValue(certificateAuthenticationConfigurationItem.isConfigEnabled()); targetSecTokenCheckBox.setValue(targetSecurityTokenAuthenticationConfigurationItem.isConfigEnabled()); gatewaySecTokenCheckBox.setValue(gatewaySecurityTokenAuthenticationConfigurationItem.isConfigEnabled()); downloadAnonymousCheckBox.setValue(anonymousDownloadAuthenticationConfigurationItem.isConfigEnabled()); }
private void updateCheckBox(CheckBox checkBox, Object rowId, boolean enabled) { checkBox.setValue(enabled); Collection<Field<?>> columns = getFieldsForItemId(rowId); columns.remove(checkBox); enableFields(columns, checkBox.getValue()); }
private void setValue(final Long distSet) { checkBox.setValue(distSet != null); dsTable.setValue(distSet); dsTable.setCurrentPageFirstItemId(distSet); dsTable.setNullSelectionAllowed(false); }
@Override public void selectionValueChanged(SelectionValueChangedEvent selectionValueChangedEvent) { if (selectionValueChangedEvent.getBean() == getData()) { selectedField.setValue(selectionValueChangedEvent.getNewValue()); } }
public static CheckBox checkBox(String caption) { CheckBox cb = new CheckBox(); if (caption != null) { cb.setCaption(caption); } cb.setValue(false); cb.setImmediate(true); cb.setWidth(100, Sizeable.UNITS_PERCENTAGE); return cb; }
@Override public Field getPropertyField(FormProperty formProperty) { CheckBox checkBox = new CheckBox(getPropertyLabel(formProperty)); checkBox.setRequired(formProperty.isRequired()); checkBox.setEnabled(formProperty.isWritable()); if (formProperty.getValue() != null) { Boolean value = new Boolean(Boolean.parseBoolean(formProperty.getValue())); checkBox.setValue(value); } return checkBox; }
@Override protected Item popualateKeyValue(final Object metadataCompositeKey) { final Item item = super.popualateKeyValue(metadataCompositeKey); if (item != null) { targetVisibleField.setValue((Boolean) item.getItemProperty(TARGET_VISIBLE).getValue()); if (hasUpdatePermission()) { targetVisibleField.setEnabled(true); } } return item; }
@Override protected Item popualateKeyValue(final Object metadataCompositeKey) { final Item item = super.popualateKeyValue(metadataCompositeKey); if (item != null) { targetVisibleField.setValue((Boolean) item.getItemProperty(TARGET_VISIBLE).getValue()); if (hasUpdatePermission()) { targetVisibleField.setEnabled(true); } } return item; }