Package com.todo.client

Examples of com.todo.client.ToDoItem


    // if white-space only, do not add a todo
    if (taskTitle.equals(""))
      return;

    ToDoItem toDoItem = new ToDoItem(taskTitle);
    view.clearTaskText();
    todos.add(toDoItem);

    taskStateChanged();
  }
View Full Code Here


   * Clears completed tasks and updates the view.
   */
  private void clearCompletedTasks() {
    Iterator<ToDoItem> iterator = todos.iterator();
    while (iterator.hasNext()) {
      ToDoItem item = iterator.next();
      if (item.isCompleted()) {
        iterator.remove();
      }
    }

    taskStateChanged();
View Full Code Here

    if (storage != null) {

      // JSON encode the items
      JSONArray todoItems = new JSONArray();
      for (int i = 0; i < todos.size(); i++) {
        ToDoItem toDoItem = todos.get(i);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("task", new JSONString(toDoItem.getTitle()));
        jsonObject.put("complete", JSONBoolean.getInstance(toDoItem.isCompleted()));
        todoItems.set(i, jsonObject);
      }

      // save to local storage
      storage.setItem(STORAGE_KEY, todoItems.toString());
View Full Code Here

          // extract the to-do item values
          JSONObject jsonObject = todoItems.get(i).isObject();
          String task = jsonObject.get("task").isString().stringValue();
          boolean completed = jsonObject.get("complete").isBoolean().booleanValue();
          // add a new item to our list
          todos.add(new ToDoItem(task, completed));
        }
      } catch (Exception e) {

      }
    }
View Full Code Here

TOP

Related Classes of com.todo.client.ToDoItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.