/** * Processes the component tag. * * @param tag * Tag to modify * @see org.apache.wicket.Component#onComponentTag(ComponentTag) */ @Override protected void onComponentTag(final ComponentTag tag) { checkComponentTag(tag, "input"); checkComponentTagAttribute(tag, "type", "checkbox"); final String value = getValue(); final IConverter<Boolean> converter = getConverter(Boolean.class); final Boolean checked = converter.convertToObject(value, getLocale()); if (Boolean.TRUE.equals(checked)) { tag.put("checked", "checked"); } else { // In case the attribute was added at design time tag.remove("checked"); } // remove value attribute, because it overrides the browser's submitted value, eg a [input // type="checkbox" value=""] will always submit as false tag.remove("value"); super.onComponentTag(tag); }
/** * Processes the component tag. * * @param tag * Tag to modify * @see org.apache.wicket.Component#onComponentTag(ComponentTag) */ @Override protected void onComponentTag(final ComponentTag tag) { checkComponentTag(tag, "input"); checkComponentTagAttribute(tag, "type", "checkbox"); final String value = getValue(); final IConverter<Boolean> converter = getConverter(Boolean.class); final Boolean checked = converter.convertToObject(value, getLocale()); if (Boolean.TRUE.equals(checked)) { tag.put("checked", "checked"); } else { // In case the attribute was added at design time tag.remove("checked"); } // remove value attribute, because it overrides the browser's submitted value, eg a [input // type="checkbox" value=""] will always submit as false tag.remove("value"); super.onComponentTag(tag); }
checkComponentTagAttribute(tag, "type", "checkbox"); final String value = getValue(); final IConverter converter = getConverter(Boolean.class); final Boolean checked = (Boolean)converter.convertToObject(value, getLocale());
checkComponentTagAttribute(tag, "type", "checkbox"); final String value = getValue(); if (value != null)