Commit 938e3b56 authored by Pascal Hartig's avatar Pascal Hartig

Merge pull request #880 from dprotti/trimonupdate

gwt - trim item on update
parents 019057d0 7ab03499
...@@ -44,7 +44,13 @@ public class ToDoItem { ...@@ -44,7 +44,13 @@ public class ToDoItem {
} }
public void setTitle(String title) { public void setTitle(String title) {
setTitle(title, true);
}
public void setTitle(String title, boolean notify) {
this.title = title; this.title = title;
presenter.itemStateChanged(this); if (notify) {
presenter.itemStateChanged(this);
}
} }
} }
...@@ -201,8 +201,10 @@ public class ToDoPresenter { ...@@ -201,8 +201,10 @@ public class ToDoPresenter {
return; return;
} }
// if the item has become empty, remove it boolean notify = false;
if (toDoItem.getTitle().trim().equals("")) { toDoItem.setTitle(toDoItem.getTitle().trim(), notify);
if (toDoItem.getTitle().isEmpty()) {
todos.remove(toDoItem); todos.remove(toDoItem);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment