KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: ViewWithParams.java,v 1.2 2003/02/19 22:50:49 lhoriman Exp $
3  * $Source: /cvsroot/mav/maverick/src/java/org/infohazard/maverick/flow/ViewWithParams.java,v $
4  */

5
6 package org.infohazard.maverick.flow;
7
8 import java.util.*;
9 import java.io.IOException JavaDoc;
10 import javax.servlet.ServletException JavaDoc;
11
12 /**
13  * ViewWithTransforms is a decorator that sets params when
14  * rendering a view.
15  */

16 class ViewWithParams implements View
17 {
18     /**
19      */

20     protected View decorated;
21     protected Map params;
22     
23     /**
24      */

25     public ViewWithParams(View decorate, Map params)
26     {
27         if (params == null)
28             throw new IllegalArgumentException JavaDoc("Don't use this decorator without params");
29             
30         this.decorated = decorate;
31         this.params = params;
32     }
33     
34     /**
35      */

36     public void go(ViewContext vctx) throws IOException JavaDoc, ServletException JavaDoc
37     {
38         ((MaverickContext)vctx).putAllViewParams(this.params);
39         
40         this.decorated.go(vctx);
41     }
42 }
Popular Tags