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