/** * Get the {@link PropertyEditor}, if any, in use for value bound to this tag. */ @Nullable protected PropertyEditor getPropertyEditor() throws JspException { return getBindStatus().getEditor(); }
@Override @Nullable public final PropertyEditor getEditor() { return getStatus().getEditor(); }
/** * Get the {@link PropertyEditor}, if any, in use for value bound to this tag. */ @Nullable protected PropertyEditor getPropertyEditor() throws JspException { return getBindStatus().getEditor(); }
@Override @Nullable public final PropertyEditor getEditor() { return getStatus().getEditor(); }
/** * 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; }
@Override protected void exposeAttributes() throws JspException { Object value = resolveValue(); this.oldValue = this.pageContext.getAttribute(VALUE_VARIABLE_NAME); this.pageContext.setAttribute(VALUE_VARIABLE_NAME, value); this.oldDisplayValue = this.pageContext.getAttribute(DISPLAY_VALUE_VARIABLE_NAME); this.pageContext.setAttribute(DISPLAY_VALUE_VARIABLE_NAME, getDisplayString(value, getBindStatus().getEditor())); }
/** * Return the value of the label for this '{@code option}' element. * <p>If the {@link #setLabel label} property is set then the resolved value * of that property is used, otherwise the value of the {@code resolvedValue} * argument is used. */ private String getLabelValue(Object resolvedValue) throws JspException { String label = getLabel(); Object labelObj = (label == null ? resolvedValue : evaluate("label", label)); return getDisplayString(labelObj, getBindStatus().getEditor()); }
/** * 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; }
selected = exhaustiveCompare(boundValue, candidateValue, bindStatus.getEditor(), null);
@Override protected void exposeAttributes() throws JspException { Object value = resolveValue(); this.oldValue = this.pageContext.getAttribute(VALUE_VARIABLE_NAME); this.pageContext.setAttribute(VALUE_VARIABLE_NAME, value); this.oldDisplayValue = this.pageContext.getAttribute(DISPLAY_VALUE_VARIABLE_NAME); this.pageContext.setAttribute(DISPLAY_VALUE_VARIABLE_NAME, getDisplayString(value, getBindStatus().getEditor())); }
/** * Return the value of the label for this '{@code option}' element. * <p>If the {@link #setLabel label} property is set then the resolved value * of that property is used, otherwise the value of the {@code resolvedValue} * argument is used. */ private String getLabelValue(Object resolvedValue) throws JspException { String label = getLabel(); Object labelObj = (label == null ? resolvedValue : evaluate("label", label)); return getDisplayString(labelObj, getBindStatus().getEditor()); }
selected = exhaustiveCompare(boundValue, candidateValue, bindStatus.getEditor(), null);
private void renderOption(Object value, String label, TagWriter tagWriter) throws JspException { tagWriter.startTag("option"); writeOptionalAttribute(tagWriter, "id", resolveId()); writeOptionalAttributes(tagWriter); String renderedValue = getDisplayString(value, getBindStatus().getEditor()); renderedValue = processFieldValue(getSelectTag().getName(), renderedValue, "option"); tagWriter.writeAttribute(VALUE_ATTRIBUTE, renderedValue); if (isSelected(value)) { tagWriter.writeAttribute(SELECTED_ATTRIBUTE, SELECTED_ATTRIBUTE); } if (isDisabled()) { tagWriter.writeAttribute(DISABLED_ATTRIBUTE, "disabled"); } tagWriter.appendValue(label); tagWriter.endTag(); }
private void renderOption(Object value, String label, TagWriter tagWriter) throws JspException { tagWriter.startTag("option"); writeOptionalAttribute(tagWriter, "id", resolveId()); writeOptionalAttributes(tagWriter); String renderedValue = getDisplayString(value, getBindStatus().getEditor()); renderedValue = processFieldValue(getSelectTag().getName(), renderedValue, "option"); tagWriter.writeAttribute(VALUE_ATTRIBUTE, renderedValue); if (isSelected(value)) { tagWriter.writeAttribute(SELECTED_ATTRIBUTE, SELECTED_ATTRIBUTE); } if (isDisabled()) { tagWriter.writeAttribute(DISABLED_ATTRIBUTE, "disabled"); } tagWriter.appendValue(label); tagWriter.endTag(); }
@Override public PropertyEditor getEditor() { return this.bindStatus.getEditor(); }
@Override public final PropertyEditor getEditor() { return this.status.getEditor(); }
/** * Get the {@link PropertyEditor}, if any, in use for value bound to this tag. */ protected PropertyEditor getPropertyEditor() throws JspException { return getBindStatus().getEditor(); }
@Override protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final BindStatus bindStatus, final IElementTagStructureHandler structureHandler) { String name = bindStatus.getExpression(); name = (name == null? "" : name); final String id = computeId(context, tag, name, false); // Thanks to precedence, this should have already been computed final String type = tag.getAttributeValue(this.typeAttributeDefinition.getAttributeName()); // Apply the conversions (editor), depending on type (no conversion for "number" and "range" // Also, no escaping needed as attribute values are always escaped by default final String value = applyConversion(type)? ValueFormatterWrapper.getDisplayString(bindStatus.getValue(), bindStatus.getEditor(), true) : ValueFormatterWrapper.getDisplayString(bindStatus.getActualValue(), true); StandardProcessorUtils.setAttribute(structureHandler, this.idAttributeDefinition, ID_ATTR_NAME, id); // No need to escape: this comes from an existing 'id' or from a token StandardProcessorUtils.setAttribute(structureHandler, this.nameAttributeDefinition, NAME_ATTR_NAME, name); // No need to escape: this is a java-valid token StandardProcessorUtils.setAttribute( structureHandler, this.valueAttributeDefinition, VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, type)); }
@Override protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final BindStatus bindStatus, final IElementTagStructureHandler structureHandler) { String name = bindStatus.getExpression(); name = (name == null? "" : name); final String id = computeId(context, tag, name, false); // Thanks to precedence, this should have already been computed final String type = tag.getAttributeValue(this.typeAttributeDefinition.getAttributeName()); // Apply the conversions (editor), depending on type (no conversion for "number" and "range" // Also, no escaping needed as attribute values are always escaped by default final String value = applyConversion(type)? ValueFormatterWrapper.getDisplayString(bindStatus.getValue(), bindStatus.getEditor(), true) : ValueFormatterWrapper.getDisplayString(bindStatus.getActualValue(), true); StandardProcessorUtils.setAttribute(structureHandler, this.idAttributeDefinition, ID_ATTR_NAME, id); // No need to escape: this comes from an existing 'id' or from a token StandardProcessorUtils.setAttribute(structureHandler, this.nameAttributeDefinition, NAME_ATTR_NAME, name); // No need to escape: this is a java-valid token StandardProcessorUtils.setAttribute( structureHandler, this.valueAttributeDefinition, VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, type)); }
@Override protected void doProcess(final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue, final BindStatus bindStatus, final IElementTagStructureHandler structureHandler) { String name = bindStatus.getExpression(); name = (name == null? "" : name); final String id = computeId(context, tag, name, false); // Thanks to precedence, this should have already been computed final String type = tag.getAttributeValue(this.typeAttributeDefinition.getAttributeName()); // Apply the conversions (editor), depending on type (no conversion for "number" and "range" // Also, no escaping needed as attribute values are always escaped by default final String value = applyConversion(type)? ValueFormatterWrapper.getDisplayString(bindStatus.getValue(), bindStatus.getEditor(), true) : ValueFormatterWrapper.getDisplayString(bindStatus.getActualValue(), true); StandardProcessorUtils.setAttribute(structureHandler, this.idAttributeDefinition, ID_ATTR_NAME, id); // No need to escape: this comes from an existing 'id' or from a token StandardProcessorUtils.setAttribute(structureHandler, this.nameAttributeDefinition, NAME_ATTR_NAME, name); // No need to escape: this is a java-valid token StandardProcessorUtils.setAttribute( structureHandler, this.valueAttributeDefinition, VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, type)); }