View Javadoc

1   /*
2    * $Id: DefaultTagLibrary.java 502296 2007-02-01 17:33:39Z niallp $
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  package org.apache.struts2.views;
22  
23  import java.util.Arrays;
24  import java.util.List;
25  
26  import javax.servlet.http.HttpServletRequest;
27  import javax.servlet.http.HttpServletResponse;
28  
29  import org.apache.struts2.views.freemarker.tags.StrutsModels;
30  import org.apache.struts2.views.velocity.components.ActionDirective;
31  import org.apache.struts2.views.velocity.components.ActionErrorDirective;
32  import org.apache.struts2.views.velocity.components.ActionMessageDirective;
33  import org.apache.struts2.views.velocity.components.AnchorDirective;
34  import org.apache.struts2.views.velocity.components.AutocompleterDirective;
35  import org.apache.struts2.views.velocity.components.BeanDirective;
36  import org.apache.struts2.views.velocity.components.CheckBoxDirective;
37  import org.apache.struts2.views.velocity.components.CheckBoxListDirective;
38  import org.apache.struts2.views.velocity.components.ComboBoxDirective;
39  import org.apache.struts2.views.velocity.components.ComponentDirective;
40  import org.apache.struts2.views.velocity.components.DateDirective;
41  import org.apache.struts2.views.velocity.components.DivDirective;
42  import org.apache.struts2.views.velocity.components.DoubleSelectDirective;
43  import org.apache.struts2.views.velocity.components.DateTimePickerDirective;
44  import org.apache.struts2.views.velocity.components.FieldErrorDirective;
45  import org.apache.struts2.views.velocity.components.FileDirective;
46  import org.apache.struts2.views.velocity.components.FormDirective;
47  import org.apache.struts2.views.velocity.components.HeadDirective;
48  import org.apache.struts2.views.velocity.components.HiddenDirective;
49  import org.apache.struts2.views.velocity.components.I18nDirective;
50  import org.apache.struts2.views.velocity.components.IncludeDirective;
51  import org.apache.struts2.views.velocity.components.LabelDirective;
52  import org.apache.struts2.views.velocity.components.OptionTransferSelectDirective;
53  import org.apache.struts2.views.velocity.components.ParamDirective;
54  import org.apache.struts2.views.velocity.components.PasswordDirective;
55  import org.apache.struts2.views.velocity.components.PropertyDirective;
56  import org.apache.struts2.views.velocity.components.PushDirective;
57  import org.apache.struts2.views.velocity.components.RadioDirective;
58  import org.apache.struts2.views.velocity.components.ResetDirective;
59  import org.apache.struts2.views.velocity.components.SelectDirective;
60  import org.apache.struts2.views.velocity.components.SetDirective;
61  import org.apache.struts2.views.velocity.components.SubmitDirective;
62  import org.apache.struts2.views.velocity.components.TabbedPanelDirective;
63  import org.apache.struts2.views.velocity.components.TextAreaDirective;
64  import org.apache.struts2.views.velocity.components.TextDirective;
65  import org.apache.struts2.views.velocity.components.TextFieldDirective;
66  import org.apache.struts2.views.velocity.components.TokenDirective;
67  import org.apache.struts2.views.velocity.components.TreeDirective;
68  import org.apache.struts2.views.velocity.components.TreeNodeDirective;
69  import org.apache.struts2.views.velocity.components.URLDirective;
70  import org.apache.struts2.views.velocity.components.UpDownSelectDirective;
71  import org.apache.struts2.views.velocity.components.WebTableDirective;
72  
73  import com.opensymphony.xwork2.util.ValueStack;
74  
75  /***
76   * The default Struts tag library
77   */
78  public class DefaultTagLibrary implements TagLibrary {
79  
80      public Object getFreemarkerModels(ValueStack stack, HttpServletRequest req,
81              HttpServletResponse res) {
82          
83          return new StrutsModels(stack, req, res);
84      }
85  
86      public List<Class> getVelocityDirectiveClasses() {
87          Class[] directives = new Class[] {
88              ActionDirective.class,
89              BeanDirective.class,
90              CheckBoxDirective.class,
91              CheckBoxListDirective.class,
92              ComboBoxDirective.class,
93              ComponentDirective.class,
94              DateDirective.class,
95              DateTimePickerDirective.class,
96              DivDirective.class,
97              AutocompleterDirective.class,
98              DoubleSelectDirective.class,
99              FileDirective.class,
100             FormDirective.class,
101             HeadDirective.class,
102             HiddenDirective.class,
103             AnchorDirective.class,
104             I18nDirective.class,
105             IncludeDirective.class,
106             LabelDirective.class,
107             ParamDirective.class,
108             PasswordDirective.class,
109             PushDirective.class,
110             PropertyDirective.class,
111             RadioDirective.class,
112             SelectDirective.class,
113             SetDirective.class,
114             SubmitDirective.class,
115             ResetDirective.class,
116             TabbedPanelDirective.class,
117             TextAreaDirective.class,
118             TextDirective.class,
119             TextFieldDirective.class,
120             TokenDirective.class,
121             TreeDirective.class,
122             TreeNodeDirective.class,
123             URLDirective.class,
124             WebTableDirective.class,
125             ActionErrorDirective.class,
126             ActionMessageDirective.class,
127             FieldErrorDirective.class,
128             OptionTransferSelectDirective.class,
129             UpDownSelectDirective.class
130         };
131         return Arrays.asList(directives);
132     }
133 
134 }