/** * Returns '{@code true}' if the bound value requires the * resultant '{@code select}' tag to be multi-select. */ private boolean forceMultiple() throws JspException { BindStatus bindStatus = getBindStatus(); Class<?> valueType = bindStatus.getValueType(); if (valueType != null && typeRequiresMultiple(valueType)) { return true; } else if (bindStatus.getEditor() != null) { Object editorValue = bindStatus.getEditor().getValue(); if (editorValue != null && typeRequiresMultiple(editorValue.getClass())) { return true; } } return false; }
(itemLabel != null ? ObjectUtils.getDisplayString(evaluate("itemLabel", itemLabel)) : null); Class<?> boundType = getBindStatus().getValueType(); if (itemsObject == null && boundType != null && boundType.isEnum()) { itemsObject = boundType.getEnumConstants();
@Override protected void writeTagDetails(TagWriter tagWriter) throws JspException { tagWriter.writeAttribute("type", getInputType()); Object boundValue = getBoundValue(); Class<?> valueType = getBindStatus().getValueType(); if (Boolean.class == valueType || boolean.class == valueType) { // the concrete type may not be a Boolean - can be String if (boundValue instanceof String) { boundValue = Boolean.valueOf((String) boundValue); } Boolean booleanValue = (boundValue != null ? (Boolean) boundValue : Boolean.FALSE); renderFromBoolean(booleanValue, tagWriter); } else { Object value = getValue(); if (value == null) { throw new IllegalArgumentException("Attribute 'value' is required when binding to non-boolean values"); } Object resolvedValue = (value instanceof String ? evaluate("value", value) : value); renderFromValue(resolvedValue, tagWriter); } }
/** * Returns '{@code true}' if the bound value requires the * resultant '{@code select}' tag to be multi-select. */ private boolean forceMultiple() throws JspException { BindStatus bindStatus = getBindStatus(); Class<?> valueType = bindStatus.getValueType(); if (valueType != null && typeRequiresMultiple(valueType)) { return true; } else if (bindStatus.getEditor() != null) { Object editorValue = bindStatus.getEditor().getValue(); if (editorValue != null && typeRequiresMultiple(editorValue.getClass())) { return true; } } return false; }
(itemLabel != null ? ObjectUtils.getDisplayString(evaluate("itemLabel", itemLabel)) : null); Class<?> boundType = getBindStatus().getValueType(); if (itemsObject == null && boundType != null && boundType.isEnum()) { itemsObject = boundType.getEnumConstants();
@Override protected int writeTagContent(TagWriter tagWriter) throws JspException { SelectTag selectTag = getSelectTag(); Object items = getItems(); Object itemsObject = null; if (items != null) { itemsObject = (items instanceof String ? evaluate("items", items) : items); } else { Class<?> selectTagBoundType = selectTag.getBindStatus().getValueType(); if (selectTagBoundType != null && selectTagBoundType.isEnum()) { itemsObject = selectTagBoundType.getEnumConstants(); } } if (itemsObject != null) { String selectName = selectTag.getName(); String itemValue = getItemValue(); String itemLabel = getItemLabel(); String valueProperty = (itemValue != null ? ObjectUtils.getDisplayString(evaluate("itemValue", itemValue)) : null); String labelProperty = (itemLabel != null ? ObjectUtils.getDisplayString(evaluate("itemLabel", itemLabel)) : null); OptionsWriter optionWriter = new OptionsWriter(selectName, itemsObject, valueProperty, labelProperty); optionWriter.writeOptions(tagWriter); } return SKIP_BODY; }
@Override protected void writeTagDetails(TagWriter tagWriter) throws JspException { tagWriter.writeAttribute("type", getInputType()); Object boundValue = getBoundValue(); Class<?> valueType = getBindStatus().getValueType(); if (Boolean.class == valueType || boolean.class == valueType) { // the concrete type may not be a Boolean - can be String if (boundValue instanceof String) { boundValue = Boolean.valueOf((String) boundValue); } Boolean booleanValue = (boundValue != null ? (Boolean) boundValue : Boolean.FALSE); renderFromBoolean(booleanValue, tagWriter); } else { Object value = getValue(); if (value == null) { throw new IllegalArgumentException("Attribute 'value' is required when binding to non-boolean values"); } Object resolvedValue = (value instanceof String ? evaluate("value", value) : value); renderFromValue(resolvedValue, tagWriter); } }
@Override protected int writeTagContent(TagWriter tagWriter) throws JspException { SelectTag selectTag = getSelectTag(); Object items = getItems(); Object itemsObject = null; if (items != null) { itemsObject = (items instanceof String ? evaluate("items", items) : items); } else { Class<?> selectTagBoundType = selectTag.getBindStatus().getValueType(); if (selectTagBoundType != null && selectTagBoundType.isEnum()) { itemsObject = selectTagBoundType.getEnumConstants(); } } if (itemsObject != null) { String selectName = selectTag.getName(); String itemValue = getItemValue(); String itemLabel = getItemLabel(); String valueProperty = (itemValue != null ? ObjectUtils.getDisplayString(evaluate("itemValue", itemValue)) : null); String labelProperty = (itemLabel != null ? ObjectUtils.getDisplayString(evaluate("itemLabel", itemLabel)) : null); OptionsWriter optionWriter = new OptionsWriter(selectName, itemsObject, valueProperty, labelProperty); optionWriter.writeOptions(tagWriter); } return SKIP_BODY; }
@Override public Class<?> getValueType() { return this.bindStatus.getValueType(); }
/** * Returns '{@code true}' if the bound value requires the * resultant '{@code select}' tag to be multi-select. */ private boolean forceMultiple() throws JspException { BindStatus bindStatus = getBindStatus(); Class<?> valueType = bindStatus.getValueType(); if (valueType != null && typeRequiresMultiple(valueType)) { return true; } else if (bindStatus.getEditor() != null) { Object editorValue = bindStatus.getEditor().getValue(); if (editorValue != null && typeRequiresMultiple(editorValue.getClass())) { return true; } } return false; }
(itemLabel != null ? ObjectUtils.getDisplayString(evaluate("itemLabel", itemLabel)) : null); Class<?> boundType = getBindStatus().getValueType(); if (itemsObject == null && boundType != null && boundType.isEnum()) { itemsObject = boundType.getEnumConstants();
@Override protected void writeTagDetails(TagWriter tagWriter) throws JspException { tagWriter.writeAttribute("type", getInputType()); Object boundValue = getBoundValue(); Class<?> valueType = getBindStatus().getValueType(); if (Boolean.class == valueType || boolean.class == valueType) { // the concrete type may not be a Boolean - can be String if (boundValue instanceof String) { boundValue = Boolean.valueOf((String) boundValue); } Boolean booleanValue = (boundValue != null ? (Boolean) boundValue : Boolean.FALSE); renderFromBoolean(booleanValue, tagWriter); } else { Object value = getValue(); if (value == null) { throw new IllegalArgumentException("Attribute 'value' is required when binding to non-boolean values"); } Object resolvedValue = (value instanceof String ? evaluate("value", value) : value); renderFromValue(resolvedValue, tagWriter); } }
@Override protected int writeTagContent(TagWriter tagWriter) throws JspException { SelectTag selectTag = getSelectTag(); Object items = getItems(); Object itemsObject = null; if (items != null) { itemsObject = (items instanceof String ? evaluate("items", items) : items); } else { Class<?> selectTagBoundType = selectTag.getBindStatus().getValueType(); if (selectTagBoundType != null && selectTagBoundType.isEnum()) { itemsObject = selectTagBoundType.getEnumConstants(); } } if (itemsObject != null) { String selectName = selectTag.getName(); String itemValue = getItemValue(); String itemLabel = getItemLabel(); String valueProperty = (itemValue != null ? ObjectUtils.getDisplayString(evaluate("itemValue", itemValue)) : null); String labelProperty = (itemLabel != null ? ObjectUtils.getDisplayString(evaluate("itemLabel", itemLabel)) : null); OptionsWriter optionWriter = new OptionsWriter(selectName, itemsObject, valueProperty, labelProperty); optionWriter.writeOptions(tagWriter); } return SKIP_BODY; }
final Class<?> valueType = bindStatus.getValueType();
final Class<?> valueType = bindStatus.getValueType();
final Class<?> valueType = bindStatus.getValueType();
final Class<?> valueType = bindStatus.getValueType();