|
|
|
@ -18,6 +18,8 @@ public class NotesComponent extends VerticalLayout { |
|
|
|
|
|
|
|
|
|
|
|
private boolean hasChanges; |
|
|
|
private boolean hasChanges; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isUpdating = false; |
|
|
|
|
|
|
|
|
|
|
|
public NotesComponent() { |
|
|
|
public NotesComponent() { |
|
|
|
notesComponent = new TextArea(); |
|
|
|
notesComponent = new TextArea(); |
|
|
|
notesComponent.setMaxLength(2000); |
|
|
|
notesComponent.setMaxLength(2000); |
|
|
|
@ -32,7 +34,7 @@ public class NotesComponent extends VerticalLayout { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void textChange(ValueChangeEvent<String> ev) { |
|
|
|
private void textChange(ValueChangeEvent<String> ev) { |
|
|
|
if (note != null) { |
|
|
|
if (note != null && !isUpdating) { |
|
|
|
if (ev.isUserOriginated()) { |
|
|
|
if (ev.isUserOriginated()) { |
|
|
|
hasChanges = true; |
|
|
|
hasChanges = true; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -41,6 +43,7 @@ public class NotesComponent extends VerticalLayout { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setPerson(Person person) { |
|
|
|
public void setPerson(Person person) { |
|
|
|
|
|
|
|
isUpdating = true; |
|
|
|
notesComponent.clear(); |
|
|
|
notesComponent.clear(); |
|
|
|
hasChanges = false; |
|
|
|
hasChanges = false; |
|
|
|
if (person != null) { |
|
|
|
if (person != null) { |
|
|
|
@ -55,6 +58,7 @@ public class NotesComponent extends VerticalLayout { |
|
|
|
note.setPerson(person); |
|
|
|
note.setPerson(person); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
isUpdating = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean hasChanges() { |
|
|
|
public boolean hasChanges() { |
|
|
|
|