// Path: 7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/util/SessionData.java
// public class SessionData implements Serializable {
// 
// 	public SessionData() {
// 		super();
// 	}
// 
// 	private User user;
// 
// 	private Locale locale;
// 
// 	public User getUser() {
// 		return user;
// 	}
// 
// 	public void setUser(User user) {
// 		this.user = user;
// 	}
// 
// 	public Locale getLocale() {
// 		return locale;
// 	}
// 
// 	public void setLocale(Locale locale) {
// 		this.locale = locale;
// 	}
// }
// 
// Path: 7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/util/TodoPriorityPropertyEditor.java
// public class TodoPriorityPropertyEditor extends PropertyEditorSupport {
// 
// 	@Override
// 	public String getAsText() {
// 		Priority value = (Priority) getValue();
// 		return value.toString();
// 	}
// 
// 	@Override
// 	public void setAsText(String text) throws IllegalArgumentException {
// 		setValue(Priority.valueOf(text));
// 	}
// }


import java.text.SimpleDateFormat;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.in28minutes.domain.Priority;
import com.in28minutes.domain.TodoItem;
import com.in28minutes.domain.TodoItemList;
import com.in28minutes.domain.User;
import com.in28minutes.service.api.TodoService;
import com.in28minutes.springmvc.web.util.SessionData;
import com.in28minutes.springmvc.web.util.TodoPriorityPropertyEditor;
import com.in28minutes.web.common.util.TodoListUtils;
package com.in28minutes.springmvc.web.controller;




@Controller
public class TodoController extends AbstractController {

	private final Logger LOGGER = LoggerFactory.getLogger(this.getClass()
			.getName());

	@Autowired
	private SessionData sessionData;

	@Autowired
	private MessageSource messageSource;

	@Autowired
	private TodoService todoService;

	@InitBinder
	public void initBinder(WebDataBinder binder) {
		SimpleDateFormat dateFormat = new SimpleDateFormat(
				TodoListUtils.DATE_FORMAT);
		binder.registerCustomEditor(Date.class, new CustomDateEditor(
				dateFormat, false));
		binder.registerCustomEditor(Priority.class,
// Path: 7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/util/SessionData.java
// public class SessionData implements Serializable {
// 
// 	public SessionData() {
// 		super();
// 	}
// 
// 	private User user;
// 
// 	private Locale locale;
// 
// 	public User getUser() {
// 		return user;
// 	}
// 
// 	public void setUser(User user) {
// 		this.user = user;
// 	}
// 
// 	public Locale getLocale() {
// 		return locale;
// 	}
// 
// 	public void setLocale(Locale locale) {
// 		this.locale = locale;
// 	}
// }
// 
// Path: 7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/util/TodoPriorityPropertyEditor.java
// public class TodoPriorityPropertyEditor extends PropertyEditorSupport {
// 
// 	@Override
// 	public String getAsText() {
// 		Priority value = (Priority) getValue();
// 		return value.toString();
// 	}
// 
// 	@Override
// 	public void setAsText(String text) throws IllegalArgumentException {
// 		setValue(Priority.valueOf(text));
// 	}
// }


// Path: 7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/controller/TodoController.java
import java.text.SimpleDateFormat;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.in28minutes.domain.Priority;
import com.in28minutes.domain.TodoItem;
import com.in28minutes.domain.TodoItemList;
import com.in28minutes.domain.User;
import com.in28minutes.service.api.TodoService;
import com.in28minutes.springmvc.web.util.SessionData;
import com.in28minutes.springmvc.web.util.TodoPriorityPropertyEditor;
import com.in28minutes.web.common.util.TodoListUtils;

package com.in28minutes.springmvc.web.controller;




@Controller
public class TodoController extends AbstractController {

	private final Logger LOGGER = LoggerFactory.getLogger(this.getClass()
			.getName());

	@Autowired
	private SessionData sessionData;

	@Autowired
	private MessageSource messageSource;

	@Autowired
	private TodoService todoService;

	@InitBinder
	public void initBinder(WebDataBinder binder) {
		SimpleDateFormat dateFormat = new SimpleDateFormat(
				TodoListUtils.DATE_FORMAT);
		binder.registerCustomEditor(Date.class, new CustomDateEditor(
				dateFormat, false));
		binder.registerCustomEditor(Priority.class,
				new TodoPriorityPropertyEditor());