View Javadoc

1   /*
2    * $Id: DojoTagLibrary.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;
23  
24  import java.util.Arrays;
25  import java.util.List;
26  
27  import javax.servlet.http.HttpServletRequest;
28  import javax.servlet.http.HttpServletResponse;
29  
30  import org.apache.struts2.dojo.views.freemarker.tags.DojoModels;
31  import org.apache.struts2.dojo.views.velocity.components.AnchorDirective;
32  import org.apache.struts2.dojo.views.velocity.components.AutocompleterDirective;
33  import org.apache.struts2.dojo.views.velocity.components.BindDirective;
34  import org.apache.struts2.dojo.views.velocity.components.DateTimePickerDirective;
35  import org.apache.struts2.dojo.views.velocity.components.DivDirective;
36  import org.apache.struts2.dojo.views.velocity.components.HeadDirective;
37  import org.apache.struts2.dojo.views.velocity.components.SubmitDirective;
38  import org.apache.struts2.dojo.views.velocity.components.TabbedPanelDirective;
39  import org.apache.struts2.dojo.views.velocity.components.TextAreaDirective;
40  import org.apache.struts2.dojo.views.velocity.components.TreeDirective;
41  import org.apache.struts2.dojo.views.velocity.components.TreeNodeDirective;
42  import org.apache.struts2.views.TagLibrary;
43  
44  import com.opensymphony.xwork2.util.ValueStack;
45  
46  public class DojoTagLibrary implements TagLibrary {
47  
48      public Object getFreemarkerModels(ValueStack stack, HttpServletRequest req,
49              HttpServletResponse res) {
50          
51          return new DojoModels(stack, req, res);
52      }
53  
54      public List<Class> getVelocityDirectiveClasses() {
55          Class[] directives = new Class[] {
56              DateTimePickerDirective.class,
57              DivDirective.class,
58              AutocompleterDirective.class,
59              AnchorDirective.class,
60              SubmitDirective.class,
61              TabbedPanelDirective.class,
62              TreeDirective.class,
63              TreeNodeDirective.class,
64              HeadDirective.class,
65              BindDirective.class,
66              TextAreaDirective.class
67          };
68          return Arrays.asList(directives);
69      }
70  
71  }