KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > gui > dialog > DialogInclude


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2006 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.gui.dialog;
14
15 import java.io.IOException JavaDoc;
16 import java.io.Writer JavaDoc;
17
18 import javax.servlet.http.HttpServletRequest JavaDoc;
19
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
22
23
24 /**
25  * @author Vinzenz Wyser
26  * @version 2.0
27  */

28 public class DialogInclude extends DialogBox {
29
30     /**
31      * Logger.
32      */

33     private static Logger log = LoggerFactory.getLogger(DialogInclude.class);
34
35     /**
36      * Empty constructor should only be used by DialogFactory.
37      */

38     protected DialogInclude() {
39     }
40
41     /**
42      * @see info.magnolia.cms.gui.dialog.DialogControl#drawHtml(Writer)
43      */

44     public void drawHtml(Writer JavaDoc out) throws IOException JavaDoc {
45         this.drawHtmlPre(out);
46         HttpServletRequest JavaDoc request = this.getRequest();
47         if (request == null) {
48             request = this.getTopParent().getRequest();
49         }
50
51         try {
52             request.setAttribute("dialogObject", this); //$NON-NLS-1$
53

54             String JavaDoc file = this.getConfigValue("file"); //$NON-NLS-1$
55

56             request.getRequestDispatcher(file).include(request, this.getResponse());
57
58             request.removeAttribute("dialogObject"); //$NON-NLS-1$
59
}
60         catch (Exception JavaDoc e) {
61             log.error(e.getMessage(), e);
62         }
63         this.drawHtmlPost(out);
64     }
65 }
66
Popular Tags