View Javadoc

1   /***
2    *  The contents of this file are subject to the Mozilla Public
3    *  License Version 1.1 (the "License"); you may not use this file
4    *  except in compliance with the License. You may obtain a copy of
5    *  the License at http://www.mozilla.org/MPL/
6    *
7    *  Software distributed under the License is distributed on an "AS
8    *  IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9    *  implied. See the License for the specific language governing
10   *  rights and limitations under the License.
11   *
12   *  The Original Code is pow2WebGui library.
13   *
14   *  The Initial Owner of the Original Code is Power Of Two S.R.L.
15   *  Portions created by Power Of Two S.R.L. are Copyright (C) Power Of Two S.R.L.
16   *  All Rights Reserved.
17   *
18   * Contributor(s):
19   */
20  package com.pow2.webgui.taglib;
21  
22  
23  import java.util.*;
24  import javax.servlet.jsp.PageContext;
25  
26  import com.pow2.webgui.contentprovider.*;
27  
28  
29  /***
30   *  Utility class for tags
31   *
32   * @author  Luca Fossato
33   * @created  29 July 2002
34   */
35  public class TagUtil
36  {
37    /***
38     * Set the contentProvider data using the parameter stored into the pageContext object.
39     *
40     * @param cp           the contentProvider object
41     * @param pageContext  the pageContext object
42     */
43    public static void  setContentProviderData(BaseContentProvider cp, PageContext pageContext)
44    {
45      cp.setTemplate      ((String)     pageContext.getAttribute(ContentProviderTag.KEY_TEMPLATE));
46      cp.setCollection    ((Collection) pageContext.getAttribute(ContentProviderTag.KEY_COLLECTION));
47      cp.setPropertiesMap ((HashMap)    pageContext.getAttribute(ContentProviderTag.KEY_PROPERTIESMAP));
48    }
49  }