/** @see org.opencms.gwt.client.ui.input.I_CmsFormWidget#isEnabled() */ public boolean isEnabled() { boolean result = true; for (CmsCheckBox checkbox : m_checkboxes) { if (!checkbox.isEnabled()) { result = false; } } return result; }
/** * Returns the set of values of the selected checkboxes. * * <p> * * @return a set of strings */ public Set<String> getSelected() { Set<String> result = new HashSet<String>(); int i = 0; for (Map.Entry<String, String> entry : m_items.entrySet()) { String key = entry.getKey(); CmsCheckBox checkBox = m_checkboxes.get(i); if (checkBox.isChecked()) { result.add(key); } i += 1; } return result; }
/** * Sets the value of the widget. * * <p> * * @param value the new value */ @SuppressWarnings("unchecked") public void setFormValue(Object value) { if (value instanceof List<?>) { List<String> keys = (List<String>) value; Set<String> keySet = new HashSet<String>(keys); int i = 0; for (Map.Entry<String, String> entry : m_items.entrySet()) { String key = entry.getKey(); CmsCheckBox checkbox = m_checkboxes.get(i); checkbox.setChecked(keySet.contains(key)); i += 1; } } }
/** @see org.opencms.gwt.client.ui.input.I_CmsFormWidget#setEnabled(boolean) */ public void setEnabled(boolean enabled) { for (CmsCheckBox checkbox : m_checkboxes) { checkbox.setEnabled(enabled); } }
/** @see org.opencms.gwt.client.ui.input.I_CmsFormWidget#reset() */ public void reset() { for (CmsCheckBox checkbox : m_checkboxes) { checkbox.setChecked(false); } }