KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > gui > controlx > RenderKitFactory


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-2005 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.gui.controlx;
14
15 import info.magnolia.cms.gui.controlx.impl.TestRenderKit;
16
17 import java.util.HashMap JavaDoc;
18 import java.util.Map JavaDoc;
19
20
21 /**
22  * Factory to get the used RenderKit
23  * @author Philipp Bracher
24  * @version $Revision: 6341 $ ($Author: philipp $)
25  */

26 public class RenderKitFactory {
27
28     /**
29      * RenderKit used in the admin interface
30      */

31     public static String JavaDoc ADMIN_INTERFACE_RENDER_KIT = "adminInterfaceRenderKit";
32
33     /**
34      * RenderKit used in the public website.
35      */

36     public static String JavaDoc WEB_RENDER_KIT = "webRenderKit";
37
38     /**
39      * Minimal output for testing reasons
40      */

41     public static String JavaDoc TEST_RENDER_KIT = "testRenderKit";
42
43     /**
44      * The registered RenderKits
45      */

46     private static Map JavaDoc renderKits = new HashMap JavaDoc();
47
48     /**
49      * Register the test render kit as default.
50      */

51     static {
52         registerRenderKit(TEST_RENDER_KIT, new TestRenderKit());
53         registerRenderKit(ADMIN_INTERFACE_RENDER_KIT, new TestRenderKit());
54         registerRenderKit(WEB_RENDER_KIT, new TestRenderKit());
55     }
56
57     /**
58      * Register a RenderKit
59      * @param name
60      * @param renderKit
61      */

62     public static void registerRenderKit(String JavaDoc name, RenderKit renderKit) {
63         renderKits.put(name, renderKit);
64     }
65
66     /**
67      * Get a named RenderKit
68      * @param name
69      * @return
70      */

71     public static RenderKit getRenderKit(String JavaDoc name) {
72         return (RenderKit) renderKits.get(name);
73     }
74 }
75
Popular Tags