Commit 7ab03499 authored by Duilio Protti's avatar Duilio Protti

gwt - trim item on update

parent 620ace71
...@@ -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);
}
} }
} }
...@@ -202,8 +202,10 @@ public class ToDoPresenter { ...@@ -202,8 +202,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