56575859606162636465666768
add("Cure Common Cold", Urgency.LOW, 3); } private void add(String title, Urgency urgency, int order) { ToDoItem item = new ToDoItem(); item.setTitle(title); item.setUrgency(urgency); item.setOrder(order); add(item); }
106107108109110111112113114115
items.put(id, item.clone()); } public void remove(long itemId) { ToDoItem item = items.remove(itemId); if (item == null) throw new RuntimeException(String.format("ToDoItem #%d not found.", itemId)); }
636465666768697071727374
{ database.clear(); for (int i = 0; i < 20; i++) { ToDoItem item = new ToDoItem(); item.setTitle("ToDo # " + (i + 1)); item.setOrder(i); database.add(item); } }
38394041424344454647484950
public Object getRowValue(int index) { if (index > 5) return null; ToDoItem item = new ToDoItem(); item.setTitle("Index #" + index); return item; }
114115116117118119120121122
throw new RuntimeException(String.format("ToDoItem #%d not found.", itemId)); } public ToDoItem get(long itemId) { ToDoItem item = items.get(itemId); return item == null ? null : item.clone(); }
616263646566676869707172
727374757677787980818283
void onSelectedFromAddNew() { if (form.isValid()) { ToDoItem item = new ToDoItem(); item.setTitle("<New To Do>"); item.setOrder(items.size()); database.add(item); } }
868788899091929394959697
void onSelectedFromAddNew() { if (form.isValid()) { ToDoItem item = new ToDoItem(); item.setTitle("<New To Do>"); item.setOrder(encoder.getValues().size()); database.add(item); } }