View Javadoc

1   /*
2    * $Id: DateTimePickerTag.java 508602 2007-02-16 21:53:54Z musachy $
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.jsp.ui;
22  
23  import javax.servlet.http.HttpServletRequest;
24  import javax.servlet.http.HttpServletResponse;
25  
26  import org.apache.struts2.components.Component;
27  import org.apache.struts2.components.DateTimePicker;
28  
29  import com.opensymphony.xwork2.util.ValueStack;
30  
31  /***
32   * @see DateTimePicker
33   */
34  public class DateTimePickerTag extends AbstractUITag {
35  
36      private static final long serialVersionUID = 4054114507143447232L;
37  
38      protected String displayWeeks;
39      protected String adjustWeeks;
40      protected String startDate;
41      protected String endDate;
42      protected String weekStartsOn;
43      protected String staticDisplay;
44      protected String dayWidth;
45      protected String language;
46      
47      protected String iconPath;
48      protected String formatLength;
49      protected String displayFormat;
50      protected String toggleType;
51      protected String toggleDuration;
52      protected String type;
53      protected String templateCssPath;
54  
55      public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
56          return new DateTimePicker(stack, req, res);
57      }
58  
59      protected void populateParams() {
60          super.populateParams();
61  
62          final DateTimePicker dateTimePicker = (DateTimePicker) component;
63          dateTimePicker.setAdjustWeeks(adjustWeeks);
64          dateTimePicker.setDayWidth(dayWidth);
65          dateTimePicker.setDisplayWeeks(displayWeeks);
66          dateTimePicker.setEndDate(endDate);
67          dateTimePicker.setStartDate(startDate);
68          dateTimePicker.setStaticDisplay(staticDisplay);
69          dateTimePicker.setWeekStartsOn(weekStartsOn);
70          dateTimePicker.setLanguage(language);
71          dateTimePicker.setIconPath(iconPath);
72          dateTimePicker.setFormatLength(formatLength);
73          dateTimePicker.setDisplayFormat(displayFormat);
74          dateTimePicker.setToggleType(toggleType);
75          dateTimePicker.setToggleDuration(toggleDuration);
76          dateTimePicker.setType(type);
77          dateTimePicker.setTemplateCssPath(templateCssPath);
78      }
79  
80      public void setAdjustWeeks(String adjustWeeks) {
81          this.adjustWeeks = adjustWeeks;
82      }
83  
84      public void setDayWidth(String dayWidth) {
85          this.dayWidth = dayWidth;
86      }
87  
88      public void setDisplayWeeks(String displayWeeks) {
89          this.displayWeeks = displayWeeks;
90      }
91  
92      public void setEndDate(String endDate) {
93          this.endDate = endDate;
94      }
95  
96      public void setStartDate(String startDate) {
97          this.startDate = startDate;
98      }
99  
100     public void setStaticDisplay(String staticDisplay) {
101         this.staticDisplay = staticDisplay;
102     }
103 
104     public void setWeekStartsOn(String weekStartsOn) {
105         this.weekStartsOn = weekStartsOn;
106     }
107 
108     public void setLanguage(String language) {
109         this.language = language;
110     }
111     
112     public void setDisplayFormat(String displayFormat) {
113         this.displayFormat = displayFormat;
114     }
115 
116     public void setFormatLength(String formatLength) {
117         this.formatLength = formatLength;
118     }
119 
120     public void setIconPath(String iconPath) {
121         this.iconPath = iconPath;
122     }
123 
124     public void setToggleDuration(String toggleDuration) {
125         this.toggleDuration = toggleDuration;
126     }
127 
128     public void setToggleType(String toggleType) {
129         this.toggleType = toggleType;
130     }
131 
132     public void setType(String type) {
133         this.type = type;
134     }
135     
136     public void setTemplateCssPath(String templateCssPath) {
137         this.templateCssPath = templateCssPath;
138     }
139 }