|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
Changing facelets without patchingHi all
I would like to do something like this: <e:property value="#{person.name}"> <h:inputText value="#{value}" /> </e:property> Where the inner #{value} is the same as the outer #{person.name}. I have found the following solution for this: I made a ComponentHandler which basically does this: private TagAttribute value; public PropertyHandler(ComponentConfig config) { super(config); value = getRequiredAttribute("value"); } protected void applyNextHandler(FaceletContext context, UIComponent component) throws IOException, FacesException, ELException { context.setAttribute("value", value); context.setAttribute("__inProp__", true); nextHandler.apply(context, component); context.setAttribute("__inProp__", null); } And I have patched the DynamicValueExpressionMetadata class inside of ValueHolderRule class: final static class DynamicValueExpressionMetadata extends Metadata { private final TagAttribute attr; public DynamicValueExpressionMetadata(TagAttribute attr) { this.attr = attr; } public void applyMetadata(FaceletContext ctx, Object instance) { if (ctx.getAttribute("__inProp__") != null) { Object val = attr.getObject(ctx); if (val instanceof TagAttribute) { ((UIComponent)instance).setValueExpression("value", ((TagAttribute)val).getValueExpression(ctx, Object.class)); return; } } ((UIComponent)instance).setValueExpression("value", attr.getValueExpression(ctx, Object.class)); } } This checks if the TagAttribute for the value contains another TagAttribute and if so, set the value to the expression of the wrapped TagAttribute. This works fine, but I would like to avoid patching the facelets sources. Unfortunately serveral classes in facelets are final and therefore not subclassable. Does anybody have an idea how to achieve this without patching? Thanks a lot nidi -- Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
| Free embeddable forum powered by Nabble | Forum Help |