KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infohazard > maverick > flow > ViewRegistrySimple


1 /*
2  * $Id: ViewRegistrySimple.java,v 1.3 2003/10/27 11:00:46 thusted Exp $
3  * $Source: /cvsroot/mav/maverick/src/java/org/infohazard/maverick/flow/ViewRegistrySimple.java,v $
4  */

5
6 package org.infohazard.maverick.flow;
7
8 import java.util.Map JavaDoc;
9 import java.util.HashMap JavaDoc;
10
11 /**
12  * Only creates simple, non-shunted renderers.
13  */

14 class ViewRegistrySimple extends ViewRegistry
15 {
16     /**
17      * Maps String id to Renderer
18      */

19     protected Map JavaDoc globalViews = new HashMap JavaDoc();
20
21     /**
22      */

23     public ViewRegistrySimple(MasterFactory masterFact)
24     {
25         super(masterFact);
26     }
27
28     /**
29      */

30     protected void defineGlobalView(String JavaDoc id, String JavaDoc mode, View v) throws ConfigException
31     {
32         this.globalViews.put(id, v);
33     }
34
35     /**
36      */

37     protected void addView(Map JavaDoc target, String JavaDoc viewName, String JavaDoc ref) throws ConfigException
38     {
39         View v = (View)this.globalViews.get(ref);
40         if (v == null)
41             throw new ConfigException("Reference to unknown global view \"" + ref + "\".");
42
43         target.put(viewName, v);
44     }
45
46     /**
47      */

48     protected void addView(Map JavaDoc target, String JavaDoc viewName, String JavaDoc mode, View v) throws ConfigException
49     {
50         target.put(viewName, v);
51     }
52 }
Popular Tags