View Javadoc

1   /* ==========================================================================
2    * Copyright 2002-2004 Cyclops Group Community
3    * 
4    * Licensed under the Open Software License, Version 2.1 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://opensource.org/licenses/osl-2.1.php
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   * =========================================================================
16   */
17  package com.cyclopsgroup.waterview.spi;
18  
19  import java.util.Hashtable;
20  
21  /***
22   * Page model is the model mapped to a particular URI
23   * If a page is not found for given URI, default page will be applied
24   * 
25   * @author <a href="mailto:jiaqi.guo@gmail.com">Jiaqi Guo </a>
26   */
27  public class Page
28  {
29      /*** Default page model */
30      public static final Page DEFAULT = new Page();
31  
32      /*** Name of this model */
33      public static final String NAME = Page.class.getName();
34  
35      private Layout layout;
36  
37      private Hashtable panelContents = new Hashtable();
38  
39      /***
40       * Add panel content object
41       *
42       * @param panelContent Panel content object
43       */
44      public void addPanelContent( PanelContent panelContent )
45      {
46          panelContents.put( panelContent.getName(), panelContent );
47      }
48  
49      /***
50       * Getter method for layout
51       *
52       * @return Returns the layout.
53       */
54      public Layout getLayout()
55      {
56          return layout;
57      }
58  
59      /***
60       * Get panel content with given panel name
61       *
62       * @param panelName Name of panel
63       * @return PanelContent object or null
64       */
65      public PanelContent getPanelContent( String panelName )
66      {
67          return (PanelContent) panelContents.get( panelName );
68      }
69  
70      /***
71       * Setter method for layout
72       *
73       * @param layout The layout to set.
74       */
75      public void setLayout( Layout layout )
76      {
77          this.layout = layout;
78      }
79  }