KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > module > admininterface > dialogs > ParagraphEditDialog


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.module.admininterface.dialogs;
14
15 import info.magnolia.cms.beans.config.Paragraph;
16 import info.magnolia.cms.beans.config.ParagraphManager;
17 import info.magnolia.cms.core.Content;
18 import info.magnolia.cms.gui.dialog.Dialog;
19
20 import javax.jcr.RepositoryException;
21 import javax.servlet.http.HttpServletRequest JavaDoc;
22 import javax.servlet.http.HttpServletResponse JavaDoc;
23
24 import org.apache.commons.lang.StringUtils;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
27
28
29 /**
30  * Editing paragraph data
31  * @author philipp
32  */

33 public class ParagraphEditDialog extends ConfiguredDialog {
34
35     private static Logger log = LoggerFactory.getLogger(ParagraphEditDialog.class);
36
37     private String JavaDoc paragraph = StringUtils.EMPTY;
38
39     public ParagraphEditDialog(String JavaDoc name, HttpServletRequest JavaDoc request, HttpServletResponse JavaDoc response, Content configNode) {
40         super(name, request, response, configNode);
41         paragraph = params.getParameter("mgnlParagraph"); //$NON-NLS-1$
42
}
43
44     /*
45      * (non-Javadoc)
46      * @see info.magnolia.module.admininterface.DialogMVCHandler#createDialog(info.magnolia.cms.core.Content,
47      * info.magnolia.cms.core.Content)
48      */

49     protected Dialog createDialog(Content configNode, Content websiteNode) throws RepositoryException {
50         Dialog dialog = super.createDialog(configNode, websiteNode);
51         dialog.setConfig("paragraph", paragraph); //$NON-NLS-1$
52
return dialog;
53     }
54
55     /**
56      * Get the configuration of the dialog from the paragraph
57      */

58     public static Content getConfigNode(HttpServletRequest JavaDoc request, String JavaDoc paragraph) {
59         Paragraph para = ParagraphManager.getInstance().getInfo(paragraph);
60
61         if (para == null) {
62             // out.println(msgs.get("dialog.paragraph.paragraphNotAvailable", new String[]{paragraph}));
63
log.error("paragraph not found: " + paragraph); //$NON-NLS-1$
64
return null;
65         }
66
67         // @todo FIXME! this should return the dialog node
68
return null;
69     }
70
71     /**
72      * @return Returns the paragraph.
73      */

74     public String JavaDoc getParagraph() {
75         return paragraph;
76     }
77 }
Popular Tags