In light of the excellent discussion on this topic, here are the
proposed spec changes for 1089-passThroughAttributes.
ACTION: Please review this and give feedback by 12:00 EDT Friday. I
really hope you all find it acceptable as is, though.
SECTION: CHANGE UIComponent
Remove constant UIComponent.DATA_ATTRIBUTES_KEY. Replace it with a
read-only JavaBeans property "passThroughAttributes". Here's the spec.
public abstract Map<String, Object> getPassThroughAttributes()
This method must never return null. This Map is the data structure that
holds passThrough attributes that must be rendered when the component is
rendered. The ResponseWriter is responsible for ensuring these
attributes are rendered correctly. The returned implementation must
support all of the standard and optional Map methods, plus support the
following additional requirements.
The Map instance is backed by StateHolder and must participate in
partial state saving, if that feature is enabled.
The Map implementation must implement the java.io.Serializable
interface.
Any attempt to add a null key or value must throw a NullPointerException
Any attempt to add a key that is not a String must throw a
ClassCastException.
SECTION: DELETE f:dataAttribute
SECTION: CHANGE HTML_BASIC RenderKit overview section
Delete the section titled "General notes regarding HTML5 support." The
passThroughAttributes feature will be affected with changes on the
ResponseWriter, not the RenderKit.
SECTION: ADD f:attributes
Add a new tag in the jsf_core taglibrary for facelets (not JSP). Here's
the spec.
For each Map.Entry in the Map<String, Object> referenced by the value
attribute of this tag, take the following action. If
Map.Entry.getValue() is a ValueExpression, call
component.setValueExpression(Map.Entry.getKey(), Map.Entry.getValue()).
Otherwise, call component.getAttributes().put(Map.Entry.getKey(),
Map.Entry.getValue()).
Attributes
value an EL Expression that evaluates to a Map<String, Object>. The
values may be String literals or ValueExpressions.
SECTION: ADD f:passThroughAttribute
Add a new tag in the jsf_core taglibrary for facelets (not JSP). Here's
the spec.
Add an attribute to the passThroughAttributes map of the UIComponent
associated with the closest parent UIComponent.
Attributes
name The name of the passThrough attribute to be set.
value The value of the passThrough attribute to be set. If the value is a
ValueExpression, it must not be evaluated before storing in the map.
SECTION: add f:passThroughAttributes
Add a new tag in the jsf_core taglibrary for facelets (not JSP). Here's
the spec.
For each Map.Entry in the Map<String, Object> referenced by the value
attribute of this tag, take the following action. Call
component.getPassThroughAttributes().put(Map.Entry.getKey(),
Map.Entry.getValue()).
Attributes
value The value of the passThrough attribute to be set. If the value is
a ValueExpression, it must not be evaluated before storing in the map.
The entries in this map are rendered as pass through attributes when the
component is rendered. See ResponseWriter for how this happens.
SECTION: NON-CHANGE
While we all love how clever it feels to use namespaced attributes, I
don't think it adds enough value. I'm not going to add it to the spec.
SECTION: CHANGE ResponseWriter class javadocs.
Add new section at the end of the existing class javadocs.
Rendering Pass Through Attributes
The set of attributes written for a component is determined by its
Renderer. In addition to these "renderer specific" attributes, "pass
through" attributes are also possible. Pass through attributes are
contained in the Map returned by UIComponent.getPassThroughAttributes().
If a UIComponent instance is passed to startElement(), the
ResponseWriter must ensure that all pass through attributes on that
component are rendered on the root markup element for that component.
If there is a pass through attribute with the same name as a renderer
specific attribute, the pass through attribute takes precedence. Pass
through attributes are rendered with a call to writeURIAttribute().
SECTION: CHANGE ResponseWriter.startElement() javadocs
Add this text at the end of the existing text that describes the
"component" parameter.
This component is inspected for its pass through attributes as described
in the class javadocs.
SECTION: CHANGE VDLDocs and RenderKit docs
Strike the term "pass through attribute" from the VDLDoc and RenderKit
docs. In its place, use similar text that conveys the meaning without
using the words "pass through"
Ed
--
| edward.burns_at_oracle.com | office: +1 407 458 0017
| homepage: | http://ridingthecrest.com/
| 21 Business days til JSF 2.2 Public Review to EG