KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > facelets > compiler > XMLInstruction


1 package com.sun.facelets.compiler;
2
3 import java.io.IOException JavaDoc;
4
5 import javax.el.ELContext;
6 import javax.el.ExpressionFactory;
7 import javax.faces.context.FacesContext;
8 import javax.faces.context.ResponseWriter;
9
10 import com.sun.facelets.el.ELAdaptor;
11 import com.sun.facelets.el.ELText;
12
13 public class XMLInstruction implements Instruction {
14     
15     private final static char[] STOP = new char[0];
16     
17     private final ELText text;
18     
19     public XMLInstruction(ELText text) {
20         this.text = text;
21     }
22
23     public void write(FacesContext context) throws IOException JavaDoc {
24         ResponseWriter rw = context.getResponseWriter();
25         rw.writeText(STOP, 0, 0); // hack to get closing elements
26
this.text.write(rw, ELAdaptor.getELContext(context));
27     }
28
29     public Instruction apply(ExpressionFactory factory, ELContext ctx) {
30         return new XMLInstruction(text.apply(factory, ctx));
31     }
32
33     public boolean isLiteral() {
34         return false;
35     }
36 }
37
Popular Tags