[pal-cvs 3921] [1656] added search form.

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
2009年 1月 5日 (月) 23:09:03 JST


Revision: 1656
          http://svn.sourceforge.jp/view?root=pal&view=rev&rev=1656
Author:   shinsuke
Date:     2009-01-05 23:09:03 +0900 (Mon, 05 Jan 2009)

Log Message:
-----------
added search form.

Modified Paths:
--------------
    todolist/trunk/src/main/java/jp/sf/pal/todolist/ToDoListConstants.java
    todolist/trunk/src/main/java/jp/sf/pal/todolist/action/user/TodoAction.java
    todolist/trunk/src/main/java/jp/sf/pal/todolist/form/user/TodoForm.java
    todolist/trunk/src/main/java/jp/sf/pal/todolist/pager/TodoPager.java
    todolist/trunk/src/main/java/jp/sf/pal/todolist/service/TodoService.java
    todolist/trunk/src/main/resources/application.properties
    todolist/trunk/src/main/resources/application_ja.properties
    todolist/trunk/src/main/webapp/WEB-INF/view/user/todo/index.jsp


-------------- next part --------------
Modified: todolist/trunk/src/main/java/jp/sf/pal/todolist/ToDoListConstants.java
===================================================================
--- todolist/trunk/src/main/java/jp/sf/pal/todolist/ToDoListConstants.java	2009-01-03 23:08:58 UTC (rev 1655)
+++ todolist/trunk/src/main/java/jp/sf/pal/todolist/ToDoListConstants.java	2009-01-05 14:09:03 UTC (rev 1656)
@@ -8,6 +8,10 @@
 
     public static final int COMPLETED = 10;
 
+    public static final int COMPLETED_ALL = 100;
+
+    public static final int NOT_COMPLETED = -1;
+
     public static final int DELETE_MAPPING_MODE = 5;
 
     public static final String GUEST_NAME = "guest";

Modified: todolist/trunk/src/main/java/jp/sf/pal/todolist/action/user/TodoAction.java
===================================================================
--- todolist/trunk/src/main/java/jp/sf/pal/todolist/action/user/TodoAction.java	2009-01-03 23:08:58 UTC (rev 1655)
+++ todolist/trunk/src/main/java/jp/sf/pal/todolist/action/user/TodoAction.java	2009-01-05 14:09:03 UTC (rev 1656)
@@ -63,7 +63,11 @@
         todoMappingItems = todoService.getTodoMappingList(todoPager, userId);
 
         // restore from pager
-        // todoForm.todoname = todoPager.getGroupInfoname();
+        if (todoPager.getStatus() != null) {
+            todoForm.statusForSearch = todoPager.getStatus().toString();
+        } else {
+            todoForm.statusForSearch = null;
+        }
 
         return "index.jsp";
     }
@@ -84,7 +88,11 @@
 
     @Execute(validator = false, input = "error.jsp")
     public String search() {
-        // todoPager.setGroupInfoname(todoForm.todoname);
+        if (!StringUtils.isEmpty(todoForm.statusForSearch)) {
+            todoPager.setStatus(Integer.parseInt(todoForm.statusForSearch));
+        } else {
+            todoPager.setStatus(null);
+        }
 
         return displayList();
     }

Modified: todolist/trunk/src/main/java/jp/sf/pal/todolist/form/user/TodoForm.java
===================================================================
--- todolist/trunk/src/main/java/jp/sf/pal/todolist/form/user/TodoForm.java	2009-01-03 23:08:58 UTC (rev 1655)
+++ todolist/trunk/src/main/java/jp/sf/pal/todolist/form/user/TodoForm.java	2009-01-05 14:09:03 UTC (rev 1656)
@@ -119,6 +119,9 @@
     @IntegerType
     public String pageNumber;
 
+    @IntegerType
+    public String statusForSearch;
+
     public void initialize() {
         id = null;
         status = "1";
@@ -145,6 +148,7 @@
         updatedByForTodo = null;
         deletedTimeForTodo = null;
         deletedByForTodo = null;
+        statusForSearch = null;
     }
 
     public void setStartDateForTodo(String value) {

Modified: todolist/trunk/src/main/java/jp/sf/pal/todolist/pager/TodoPager.java
===================================================================
--- todolist/trunk/src/main/java/jp/sf/pal/todolist/pager/TodoPager.java	2009-01-03 23:08:58 UTC (rev 1655)
+++ todolist/trunk/src/main/java/jp/sf/pal/todolist/pager/TodoPager.java	2009-01-05 14:09:03 UTC (rev 1656)
@@ -1,5 +1,6 @@
 package jp.sf.pal.todolist.pager;
 
+import jp.sf.pal.todolist.ToDoListConstants;
 import jp.sf.pal.todolist.common.pager.DefaultPager;
 
 public class TodoPager extends DefaultPager {
@@ -8,13 +9,17 @@
 
     private Long categoryId;
 
+    private Integer status;
+
     public TodoPager() {
         categoryId = null;
+        status = ToDoListConstants.NOT_COMPLETED;
     }
 
     public void clear() {
         super.clear();
         categoryId = null;
+        status = ToDoListConstants.NOT_COMPLETED;
     }
 
     protected int getDefaultPageSize() {
@@ -29,4 +34,12 @@
         this.categoryId = categoryId;
     }
 
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
 }

Modified: todolist/trunk/src/main/java/jp/sf/pal/todolist/service/TodoService.java
===================================================================
--- todolist/trunk/src/main/java/jp/sf/pal/todolist/service/TodoService.java	2009-01-03 23:08:58 UTC (rev 1655)
+++ todolist/trunk/src/main/java/jp/sf/pal/todolist/service/TodoService.java	2009-01-05 14:09:03 UTC (rev 1656)
@@ -66,6 +66,17 @@
         cb.setupSelect_Todo().withUserInfo(); // TODO use specify*
         cb.setupSelect_UserInfo(); // TODO use specify*
 
+        if (todoPager.getStatus() != null) {
+            if (todoPager.getStatus() == ToDoListConstants.NOT_COMPLETED) {
+                cb.query().setStatus_NotEqual(ToDoListConstants.COMPLETED);
+            } else if (todoPager.getStatus() == ToDoListConstants.COMPLETED_ALL) {
+                cb.query().queryTodo().setStatus_Equal(
+                        ToDoListConstants.COMPLETED);
+            } else {
+                cb.query().setStatus_Equal(todoPager.getStatus());
+            }
+        }
+
         cb.query().setDeletedBy_IsNull();
         if (userId != null) {
             cb.query().setUserId_Equal(userId);

Modified: todolist/trunk/src/main/resources/application.properties
===================================================================
--- todolist/trunk/src/main/resources/application.properties	2009-01-03 23:08:58 UTC (rev 1655)
+++ todolist/trunk/src/main/resources/application.properties	2009-01-05 14:09:03 UTC (rev 1656)
@@ -138,4 +138,9 @@
 labels.userId=User ID
 
 labels.not_started=Not Started
+labels.not_completed=Not Completed
+labels.completed_all=All Completed
+labels.all=All
+labels.search=Search
+labels.reset=Reset
 

Modified: todolist/trunk/src/main/resources/application_ja.properties
===================================================================
--- todolist/trunk/src/main/resources/application_ja.properties	2009-01-03 23:08:58 UTC (rev 1655)
+++ todolist/trunk/src/main/resources/application_ja.properties	2009-01-05 14:09:03 UTC (rev 1656)
@@ -70,7 +70,7 @@
 labels.priority=\u512a\u5148\u5ea6
 labels.status=\u72b6\u614b
 labels.working=\u4f5c\u696d\u4e2d
-labels.completed=\u7d42\u4e86
+labels.completed=\u5b8c\u4e86
 labels.start_date=\u958b\u59cb\u65e5
 labels.end_date=\u671f\u65e5
 labels.personal=\u500b\u4eba
@@ -131,3 +131,8 @@
 labels.userId=\u30e6\u30fc\u30b6\u30fc ID
 
 labels.not_started=\u672a\u958b\u59cb
+labels.not_completed=\u672a\u5b8c\u4e86
+labels.completed_all=\u5168\u54e1\u5b8c\u4e86
+labels.all=\u3059\u3079\u3066
+labels.search=\u691c\u7d22
+labels.reset=\u30ea\u30bb\u30c3\u30c8

Modified: todolist/trunk/src/main/webapp/WEB-INF/view/user/todo/index.jsp
===================================================================
--- todolist/trunk/src/main/webapp/WEB-INF/view/user/todo/index.jsp	2009-01-03 23:08:58 UTC (rev 1655)
+++ todolist/trunk/src/main/webapp/WEB-INF/view/user/todo/index.jsp	2009-01-05 14:09:03 UTC (rev 1656)
@@ -60,10 +60,34 @@
 </table>
 </div>
 
-<div class="list-table" style="margin-top:3px;float: left;">
-<div>
+<div style="margin-top:3px;float: left;">
+<s:form>
+<div class="form-table">
+<table>
+	<tbody>
+		<th><bean:message key="labels.status"/></th>
+		<td>
+<html:select property="statusForSearch">
+	<html:option value=""><bean:message key="labels.all"/></html:option>
+	<html:option value="-1"><bean:message key="labels.not_completed"/></html:option>
+	<html:option value="0"><bean:message key="labels.not_started"/></html:option>
+	<html:option value="1"><bean:message key="labels.working"/></html:option>
+	<html:option value="10"><bean:message key="labels.completed"/></html:option>
+	<html:option value="100"><bean:message key="labels.completed_all"/></html:option>
+</html:select>
+		</td>
+		<td>
+<input type="submit" name="search" value="<bean:message key="labels.search"/>"/>
+<input type="submit" name="reset" value="<bean:message key="labels.reset"/>"/>
+		</td>
+	</tbody>
+</table>
+</s:form>
+</div>
+<div style="margin-top:3px;">
 <s:link href="createpage"><bean:message key="labels.todo.index.create_new_task"/></s:link>
 </div>
+<div class="list-table" style="margin-top:3px;">
 <table border="1">
 	<thead>
 		<tr>


pal-cvs メーリングリストの案内
Zurück zum Archiv-Index