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.ELContext;
24 import javax.el.ExpressionFactory;
25 import javax.faces.application.FacesMessage;
26 import javax.faces.context.FacesContext;
27
28 import org.apache.myfaces.view.facelets.AbstractFaceletContext;
29
30
31
32
33
34
35
36 final class AddFacesMessageInstruction implements Instruction
37 {
38 private final FacesMessage.Severity serverity;
39 private final String summary;
40 private final String detail;
41
42 public AddFacesMessageInstruction(FacesMessage.Severity serverity, String summary, String detail)
43 {
44 this.serverity = serverity;
45 this.summary = summary;
46 this.detail = detail;
47 }
48
49 public void write(FacesContext context) throws IOException
50 {
51 }
52
53 public Instruction apply(ExpressionFactory factory, ELContext ctx)
54 {
55 FacesContext facesContext = ((AbstractFaceletContext)ctx).getFacesContext();
56 facesContext.addMessage(null, new FacesMessage(this.serverity, this.summary, this.detail));
57 return this;
58 }
59
60 public boolean isLiteral()
61 {
62 return false;
63 }
64
65 }