01: package com.sun.facelets.oracle.adf;
02:
03: import java.io.IOException;
04:
05: import javax.el.ELException;
06: import javax.el.ValueExpression;
07: import javax.faces.component.ActionSource;
08: import javax.faces.component.UIComponent;
09:
10: import com.sun.facelets.FaceletContext;
11: import com.sun.facelets.FaceletException;
12: import com.sun.facelets.tag.TagAttribute;
13: import com.sun.facelets.tag.TagConfig;
14: import com.sun.facelets.tag.TagHandler;
15: import com.sun.facelets.tag.jsf.ComponentSupport;
16:
17: /**
18: * @author Emmanuel Pirsch
19: */
20: public class SetActionListenerTag extends TagHandler {
21:
22: public SetActionListenerTag(TagConfig tagConfig) {
23: super (tagConfig);
24: _from = getRequiredAttribute("from");
25: _to = getRequiredAttribute("to");
26: }
27:
28: public void apply(FaceletContext faceletContext, UIComponent parent)
29: throws FaceletException, ELException {
30: if (ComponentSupport.isNew(parent)) {
31: ValueExpression fromExpression = _from.getValueExpression(
32: faceletContext, Object.class);
33: ValueExpression toExpression = _to.getValueExpression(
34: faceletContext, Object.class);
35: ActionSource actionSource = (ActionSource) parent;
36: actionSource.addActionListener(new SetActionListener(
37: fromExpression, toExpression));
38: }
39: }
40:
41: private final TagAttribute _from;
42: private final TagAttribute _to;
43: }
|