com.in28minutes.domain.Priority Java Examples

The following examples show how to use com.in28minutes.domain.Priority. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TodoListUtils.java    From MavenIn28Minutes with MIT License 6 votes vote down vote up
public static String getPriorityIcon(Priority priority) {

		String priorityIcon = "";

		switch (priority) {
		case HIGH:
			priorityIcon = "up";
			break;
		case MEDIUM:
			priorityIcon = "right";
			break;
		case LOW:
			priorityIcon = "down";
		}

		return priorityIcon;
	}
 
Example #2
Source File: TodoListUtils.java    From SpringIn28Minutes with MIT License 6 votes vote down vote up
public static String getPriorityIcon(Priority priority) {

		String priorityIcon = "";

		switch (priority) {
		case HIGH:
			priorityIcon = "up";
			break;
		case MEDIUM:
			priorityIcon = "right";
			break;
		case LOW:
			priorityIcon = "down";
		}

		return priorityIcon;
	}
 
Example #3
Source File: TodoListUtils.java    From RealWorldWebApplicationWithServletsAndJspIn28Minutes with MIT License 6 votes vote down vote up
public static String getPriorityIcon(Priority priority) {

		String priorityIcon = "";

		switch (priority) {
		case HIGH:
			priorityIcon = "up";
			break;
		case MEDIUM:
			priorityIcon = "right";
			break;
		case LOW:
			priorityIcon = "down";
		}

		return priorityIcon;
	}
 
Example #4
Source File: PriorityIconTag.java    From MavenIn28Minutes with MIT License 5 votes vote down vote up
@Override
public void doTag() throws JspException, IOException {
	JspWriter out = getJspContext().getOut();
	String priorityIcon = TodoListUtils.getPriorityIcon(Priority
			.valueOf(priority));
	out.print(priorityIcon);
}
 
Example #5
Source File: TodoController.java    From SpringIn28Minutes with MIT License 5 votes vote down vote up
@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());
}
 
Example #6
Source File: PriorityIconTag.java    From SpringIn28Minutes with MIT License 5 votes vote down vote up
@Override
public void doTag() throws JspException, IOException {
	JspWriter out = getJspContext().getOut();
	String priorityIcon = TodoListUtils.getPriorityIcon(Priority
			.valueOf(priority));
	out.print(priorityIcon);
}
 
Example #7
Source File: PriorityIconTag.java    From RealWorldWebApplicationWithServletsAndJspIn28Minutes with MIT License 5 votes vote down vote up
@Override
public void doTag() throws JspException, IOException {
	JspWriter out = getJspContext().getOut();
	String priorityIcon = TodoListUtils.getPriorityIcon(Priority
			.valueOf(priority));
	out.print(priorityIcon);
}
 
Example #8
Source File: CreateTodoServlet.java    From MavenIn28Minutes with MIT License 4 votes vote down vote up
@Override
protected void doPost(HttpServletRequest request,
		HttpServletResponse response) throws ServletException, IOException {

	HttpSession session = request.getSession();
	User user = (User) session.getAttribute(TodoListUtils.SESSION_USER);

	String title = request.getParameter("title");
	String dueDate = request.getParameter("dueDate");
	String priority = request.getParameter("priority");

	TodoItem todoItem = new TodoItem(user.getId(), title, false,
			Priority.valueOf(priority), new Date(dueDate));

	todoService.create(todoItem);

	request.getRequestDispatcher("/todos").forward(request, response);

}
 
Example #9
Source File: UpdateTodoServlet.java    From MavenIn28Minutes with MIT License 4 votes vote down vote up
@Override
protected void doPost(HttpServletRequest request,
		HttpServletResponse response) throws ServletException, IOException {

	long todoId = Long.parseLong(request.getParameter("todoId"));

	TodoItem todoItem = todoService.getTodoById(todoId);

	todoItem.setTitle(request.getParameter("title"));
	todoItem.setDueDate(new Date(request.getParameter("dueDate")));
	todoItem.setDone(Boolean.valueOf(request.getParameter("status")));
	todoItem.setPriority(Priority.valueOf(request.getParameter("priority")));

	todoService.update(todoItem);

	request.getRequestDispatcher("/todos").forward(request, response);

}
 
Example #10
Source File: TodoPriorityPropertyEditor.java    From SpringIn28Minutes with MIT License 4 votes vote down vote up
@Override
public String getAsText() {
	Priority value = (Priority) getValue();
	return value.toString();
}
 
Example #11
Source File: TodoPriorityPropertyEditor.java    From SpringIn28Minutes with MIT License 4 votes vote down vote up
@Override
public void setAsText(String text) throws IllegalArgumentException {
	setValue(Priority.valueOf(text));
}
 
Example #12
Source File: CreateTodoServlet.java    From RealWorldWebApplicationWithServletsAndJspIn28Minutes with MIT License 4 votes vote down vote up
@Override
protected void doPost(HttpServletRequest request,
		HttpServletResponse response) throws ServletException, IOException {

	HttpSession session = request.getSession();
	User user = (User) session.getAttribute(TodoListUtils.SESSION_USER);

	String title = request.getParameter("title");
	String dueDate = request.getParameter("dueDate");
	String priority = request.getParameter("priority");

	TodoItem todoItem = new TodoItem(user.getId(), title, false,
			Priority.valueOf(priority), new Date(dueDate));

	todoService.create(todoItem);

	request.getRequestDispatcher("/todos").forward(request, response);

}
 
Example #13
Source File: UpdateTodoServlet.java    From RealWorldWebApplicationWithServletsAndJspIn28Minutes with MIT License 4 votes vote down vote up
@Override
protected void doPost(HttpServletRequest request,
		HttpServletResponse response) throws ServletException, IOException {

	long todoId = Long.parseLong(request.getParameter("todoId"));

	TodoItem todoItem = todoService.getTodoById(todoId);

	todoItem.setTitle(request.getParameter("title"));
	todoItem.setDueDate(new Date(request.getParameter("dueDate")));
	todoItem.setDone(Boolean.valueOf(request.getParameter("status")));
	todoItem.setPriority(Priority.valueOf(request.getParameter("priority")));

	todoService.update(todoItem);

	request.getRequestDispatcher("/todos").forward(request, response);

}