View Javadoc

1   /*
2    * $Id: DateTimePickerTag.java 493867 2007-01-07 22:26:23Z mrdon $
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  
54      public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
55          return new DateTimePicker(stack, req, res);
56      }
57  
58      protected void populateParams() {
59          super.populateParams();
60  
61          final DateTimePicker dateTimePicker = (DateTimePicker) component;
62          dateTimePicker.setAdjustWeeks(adjustWeeks);
63          dateTimePicker.setDayWidth(dayWidth);
64          dateTimePicker.setDisplayWeeks(displayWeeks);
65          dateTimePicker.setEndDate(endDate);
66          dateTimePicker.setStartDate(startDate);
67          dateTimePicker.setStaticDisplay(staticDisplay);
68          dateTimePicker.setWeekStartsOn(weekStartsOn);
69          dateTimePicker.setLanguage(language);
70          dateTimePicker.setIconPath(iconPath);
71          dateTimePicker.setFormatLength(formatLength);
72          dateTimePicker.setDisplayFormat(displayFormat);
73          dateTimePicker.setToggleType(toggleType);
74          dateTimePicker.setToggleDuration(toggleDuration);
75          dateTimePicker.setType(type);
76      }
77  
78      public void setAdjustWeeks(String adjustWeeks) {
79          this.adjustWeeks = adjustWeeks;
80      }
81  
82      public void setDayWidth(String dayWidth) {
83          this.dayWidth = dayWidth;
84      }
85  
86      public void setDisplayWeeks(String displayWeeks) {
87          this.displayWeeks = displayWeeks;
88      }
89  
90      public void setEndDate(String endDate) {
91          this.endDate = endDate;
92      }
93  
94      public void setStartDate(String startDate) {
95          this.startDate = startDate;
96      }
97  
98      public void setStaticDisplay(String staticDisplay) {
99          this.staticDisplay = staticDisplay;
100     }
101 
102     public void setWeekStartsOn(String weekStartsOn) {
103         this.weekStartsOn = weekStartsOn;
104     }
105 
106     public void setLanguage(String language) {
107         this.language = language;
108     }
109     
110     public void setDisplayFormat(String displayFormat) {
111         this.displayFormat = displayFormat;
112     }
113 
114     public void setFormatLength(String formatLength) {
115         this.formatLength = formatLength;
116     }
117 
118     public void setIconPath(String iconPath) {
119         this.iconPath = iconPath;
120     }
121 
122     public void setToggleDuration(String toggleDuration) {
123         this.toggleDuration = toggleDuration;
124     }
125 
126     public void setToggleType(String toggleType) {
127         this.toggleType = toggleType;
128     }
129 
130     public void setType(String type) {
131         this.type = type;
132     }
133 }