Author: musachy
Date: Mon Mar 9 22:22:02 2009
New Revision: 751880
URL: http://svn.apache.org/viewvc?rev=751880&view=rev
Log:
Add datepicker
Added:
struts/sandbox/trunk/s2-jquery-showcase/src/main/java/org/apache/struts2/jquery/actions/form/DateInputAction.java
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/date-input.jsp
- copied, changed from r751843,
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/simple-theme/Datepicker.jsp
Removed:
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/simple-theme/Datepicker.jsp
Modified:
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/index.jsp
Added:
struts/sandbox/trunk/s2-jquery-showcase/src/main/java/org/apache/struts2/jquery/actions/form/DateInputAction.java
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/s2-jquery-showcase/src/main/java/org/apache/struts2/jquery/actions/form/DateInputAction.java?rev=751880&view=auto
==============================================================================
---
struts/sandbox/trunk/s2-jquery-showcase/src/main/java/org/apache/struts2/jquery/actions/form/DateInputAction.java
(added)
+++
struts/sandbox/trunk/s2-jquery-showcase/src/main/java/org/apache/struts2/jquery/actions/form/DateInputAction.java
Mon Mar 9 22:22:02 2009
@@ -0,0 +1,62 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2.jquery.actions.form;
+
+import org.apache.struts2.convention.annotation.Namespace;
+import com.opensymphony.xwork2.ActionSupport;
+
+import java.util.Date;
+import java.util.Calendar;
+import java.text.SimpleDateFormat;
+import java.text.DateFormat;
+
+...@namespace("/form")
+public class DateInputAction extends ActionSupport {
+ private Date date;
+ private Calendar calendar;
+ private String shortFormat;
+
+ @Override
+ public String execute() throws Exception {
+ calendar = Calendar.getInstance();
+ calendar.set(Calendar.YEAR, 1999);
+ calendar.set(Calendar.MONTH, Calendar.JANUARY);
+ calendar.set(Calendar.DAY_OF_MONTH, 1);
+
+ date = calendar.getTime();
+
+ shortFormat =
SimpleDateFormat.getDateInstance(DateFormat.SHORT).format(date);
+
+ return super.execute();
+ }
+
+ public Calendar getCalendar() {
+ return calendar;
+ }
+
+ public String getShortFormat() {
+ return shortFormat;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+}
Copied:
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/date-input.jsp
(from r751843,
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/simple-theme/Datepicker.jsp)
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/date-input.jsp?p2=struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/date-input.jsp&p1=struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/simple-theme/Datepicker.jsp&r1=751843&r2=751880&rev=751880&view=diff
==============================================================================
---
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/simple-theme/Datepicker.jsp
(original)
+++
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/form/date-input.jsp
Mon Mar 9 22:22:02 2009
@@ -9,7 +9,7 @@
</head>
<body>
<s:form id="indexForm" method="post" namespace="/form" action="date"
theme="simple">
- <sjx:datepicker name="date" displayFormat="mm dd yy"
theme="jquery-simple"/>
+ <sjx:datepicker name="date" displayFormat="mm dd yy" theme="jquery-simple"
value="date"/>
<s:submit />
</s:form>
</body>
Modified:
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/index.jsp
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/index.jsp?rev=751880&r1=751879&r2=751880&view=diff
==============================================================================
---
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/index.jsp
(original)
+++
struts/sandbox/trunk/s2-jquery-showcase/src/main/webapp/WEB-INF/content/index.jsp
Mon Mar 9 22:22:02 2009
@@ -32,7 +32,7 @@
</li>
<li>
- <s:url var="url" value="/simple-theme/Datepicker"/>
+ <s:url var="url" value="/form/date-input"/>
<s:a href="%{#url}">Date Picker</s:a>
</li>