We have added new strategy to deal with above issues.
In order to keep existing approach and add new one, we ended up adding an
interface called com.icesoft.faces.component.IcePassThruAttribute under core branch.
So if any component wants to use new approach of writing passThru attributes,
the component need to be implement the IcePassThruAttribute interface and have
to override two methods in the component class.
Let say if the inputText wants to use new strategy.
------------------
public class HtmlInputText
extends UIInput
implements IcePassThruAttributes {
//Due to the fact that every component extends Sun's UIComponentBase class that
//prevent us to override the following methods in some base class.
//so we have to add these two methods in component class exclusively.
//NOTE: These methods do not need any modification, they just require copy and past
public Map getAttributes() {
Map attMap = super.getAttributes();
if (!attMap.containsKey(IcePassThruAttributes.ICE_ATTRIBUTE_MAP))
{
Map newMap = new AttributesMap(attMap);
attMap.put(IcePassThruAttributes.ICE_ATTRIBUTE_MAP,newMap);
return newMap;
}
else
{
return (Map)attMap.get(IcePassThruAttributes.ICE_ATTRIBUTE_MAP);
}
}
public void setValueBinding(String name, ValueBinding vb) {
Map iceAttributeMap =
(Map)getAttributes().get(IcePassThruAttributes.ICE_ATTRIBUTE_MAP);
if (name != null && iceAttributeMap != null) {
if (PassThruAttributeRenderer.passThruAttributeNames.contains(name))
{
((List)iceAttributeMap.get(IcePassThruAttributes.PASS_THRU_NON_BOOLEAN_ATT_LIST)).add(name);
}
else if
(PassThruAttributeRenderer.booleanPassThruAttributeNames.contains(name))
{
((List)iceAttributeMap.get(IcePassThruAttributes.PASS_THRU_BOOLEAN_ATT_LIST)).add(name);
}
}
//you can put your code here if any
//......
super.setValueBinding(name, vb);
}
}
}
-----------------
Renderer does not require any changes. TO render passThruAttributes the
following method need to be called as before.
PassThruAttributeRenderer
.renderAttributes(facesContext, uiComponent, null);
You can also exclude passthru attributes, as before.
excludes.add("style");
excludes.add("readonly");
excludes.add("disabled");
PassThruAttributeRenderer.
renderAttributes(
facesContext, uiComponent, getExcludesArray(excludes));
Initial check-in 13105