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 | 0 | { |
40 | 0 | this.txtString = txtString; |
41 | 0 | } |
42 | |
|
43 | |
public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException, |
44 | |
ELException |
45 | |
{ |
46 | 0 | if (parent != null) |
47 | |
{ |
48 | 0 | UIComponent c = new UILiteralText(this.txtString); |
49 | 0 | UniqueIdVendor uniqueIdVendor |
50 | |
= FaceletCompositionContext.getCurrentInstance(ctx).getUniqueIdVendorFromStack(); |
51 | 0 | if (uniqueIdVendor == null) |
52 | |
{ |
53 | 0 | uniqueIdVendor = ComponentSupport.getViewRoot(ctx, parent); |
54 | |
} |
55 | 0 | if (uniqueIdVendor != null) |
56 | |
{ |
57 | |
|
58 | |
|
59 | 0 | String uid = uniqueIdVendor.createUniqueId(ctx.getFacesContext(), null); |
60 | 0 | c.setId(uid); |
61 | |
} |
62 | 0 | this.addComponent(ctx, parent, c); |
63 | |
} |
64 | 0 | } |
65 | |
|
66 | |
public String getText() |
67 | |
{ |
68 | 0 | return this.txtString; |
69 | |
} |
70 | |
|
71 | |
public String getText(FaceletContext ctx) |
72 | |
{ |
73 | 0 | return this.txtString; |
74 | |
} |
75 | |
} |