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.compiler;
20
21 import java.io.IOException;
22
23 import javax.el.ELException;
24 import javax.faces.FacesException;
25 import javax.faces.component.UIComponent;
26 import javax.faces.component.UniqueIdVendor;
27 import javax.faces.view.facelets.FaceletContext;
28 import javax.faces.view.facelets.FaceletException;
29
30 import org.apache.myfaces.view.facelets.AbstractFaceletContext;
31 import org.apache.myfaces.view.facelets.FaceletCompositionContext;
32 import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
33
34 final class UILiteralTextHandler extends AbstractUIHandler
35 {
36
37 protected final String txtString;
38
39 public UILiteralTextHandler(String txtString)
40 {
41 this.txtString = txtString;
42 }
43
44 public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
45 ELException
46 {
47 if (parent != null)
48 {
49 UIComponent c = new UILiteralText(this.txtString);
50
51
52 UniqueIdVendor uniqueIdVendor = FaceletCompositionContext.getCurrentInstance(ctx).getUniqueIdVendorFromStack();
53 if (uniqueIdVendor == null)
54 {
55 uniqueIdVendor = ComponentSupport.getViewRoot(ctx, parent);
56 }
57 if (uniqueIdVendor != null)
58 {
59
60
61 String uid = uniqueIdVendor.createUniqueId(ctx.getFacesContext(), null);
62 c.setId(uid);
63 }
64 this.addComponent(ctx, parent, c);
65 }
66 }
67
68 public String getText()
69 {
70 return this.txtString;
71 }
72
73 public String getText(FaceletContext ctx)
74 {
75 return this.txtString;
76 }
77 }