1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.view.facelets.tag.jsf.core;
20
21 import javax.el.ELException;
22 import javax.faces.FacesException;
23 import javax.faces.convert.Converter;
24 import javax.faces.view.facelets.ConverterConfig;
25 import javax.faces.view.facelets.ConverterHandler;
26 import javax.faces.view.facelets.FaceletContext;
27 import javax.faces.view.facelets.FaceletException;
28 import javax.faces.view.facelets.MetaRuleset;
29 import javax.faces.view.facelets.TagAttribute;
30
31 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
32
33
34
35
36
37
38
39
40
41 @JSFFaceletTag(
42 name = "f:converter",
43 bodyContent = "empty",
44 tagClass="org.apache.myfaces.taglib.core.ConverterImplTag")
45 public final class ConvertDelegateHandler extends ConverterHandler
46 {
47
48 private final TagAttribute converterId;
49
50
51
52
53 public ConvertDelegateHandler(ConverterConfig config)
54 {
55 super(config);
56 this.converterId = this.getAttribute("converterId");
57 }
58
59
60
61
62
63
64
65 protected Converter createConverter(FaceletContext ctx) throws FacesException, ELException, FaceletException
66 {
67 return ctx.getFacesContext().getApplication().createConverter(this.getConverterId(ctx));
68 }
69
70 protected MetaRuleset createMetaRuleset(Class type)
71 {
72 return super.createMetaRuleset(type).ignoreAll();
73 }
74
75 @Override
76 public String getConverterId(FaceletContext ctx)
77 {
78 if (converterId == null)
79 {
80 return null;
81 }
82 return converterId.getValue(ctx);
83 }
84 }