View Javadoc

1   /*
2    * $Id: DojoModels.java 651946 2008-04-27 13:41:38Z apetrelli $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  package org.apache.struts2.dojo.views.freemarker.tags;
23  
24  import javax.servlet.http.HttpServletRequest;
25  import javax.servlet.http.HttpServletResponse;
26  
27  import com.opensymphony.xwork2.util.ValueStack;
28  
29  public class DojoModels {
30      protected DateTimePickerModel dateTimePicker;
31      protected TabbedPanelModel tabbedPanel;
32      protected TreeModel treeModel;
33      protected TreeNodeModel treenodeModel;
34      protected AutocompleterModel autocompleter;
35      protected DivModel div;
36      protected AnchorModel a;
37      protected SubmitModel submit;
38      protected BindModel bind;
39      protected HeadModel head;
40      protected TextAreaModel textarea;
41      
42      private ValueStack stack;
43      private HttpServletRequest req;
44      private HttpServletResponse res;
45      
46      public DojoModels(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
47          this.stack = stack;
48          this.req = req;
49          this.res = res;
50      }
51      
52      public BindModel getBind() {
53          if (bind == null) {
54              bind = new BindModel(stack, req, res);
55          }
56  
57          return bind;
58      }
59      
60      public TextAreaModel getTextarea() {
61          if (textarea == null) {
62              textarea = new TextAreaModel(stack, req, res);
63          }
64  
65          return textarea;
66      }
67      
68      public HeadModel getHead() {
69          if (head == null) {
70              head = new HeadModel(stack, req, res);
71          }
72  
73          return head;
74      }
75      
76      public DateTimePickerModel getDatetimepicker() {
77          if (dateTimePicker == null) {
78              dateTimePicker = new DateTimePickerModel(stack, req, res);
79          }
80  
81          return dateTimePicker;
82      }
83      
84      public AutocompleterModel getAutocompleter() {
85          if (autocompleter == null) {
86              autocompleter = new AutocompleterModel(stack, req, res);
87          }
88  
89          return autocompleter;
90      }
91      
92      public TabbedPanelModel getTabbedpanel() {
93          if (tabbedPanel == null) {
94              tabbedPanel = new TabbedPanelModel(stack, req, res);
95          }
96  
97          return tabbedPanel;
98      }
99      
100     public TreeModel getTree() {
101         if (treeModel == null) {
102             treeModel = new TreeModel(stack,req, res);
103         }
104         return treeModel;
105     }
106 
107     public TreeNodeModel getTreenode() {
108         if (treenodeModel == null) {
109             treenodeModel = new TreeNodeModel(stack, req, res);
110         }
111         return treenodeModel;
112     }
113     
114     public DivModel getDiv() {
115         if (div == null) {
116             div = new DivModel(stack, req, res);
117         }
118 
119         return div;
120     }
121     
122     public AnchorModel getA() {
123         if (a == null) {
124             a = new AnchorModel(stack, req, res);
125         }
126 
127         return a;
128     }
129     
130     public SubmitModel getSubmit() {
131         if (submit == null) {
132             submit = new SubmitModel(stack, req, res);
133         }
134 
135         return submit;
136     }
137 }