Skip to content
Snippets Groups Projects
Commit 620db9c5 authored by Guyslain's avatar Guyslain
Browse files

section 8 Cell fini

parent 11d9207d
No related branches found
No related tags found
No related merge requests found
...@@ -13,7 +13,7 @@ import java.util.List; ...@@ -13,7 +13,7 @@ import java.util.List;
*/ */
public class Cell<T> implements Lens<T> { public class Cell<T> implements Lens<T> {
//TODO: ajouter la ou les propriétés nécessaires private T content;
// la liste des objets écoutant les modifications du contenu de la cellule // la liste des objets écoutant les modifications du contenu de la cellule
private final List<OnChangeListener<T>> listeners = new ArrayList<>(); private final List<OnChangeListener<T>> listeners = new ArrayList<>();
...@@ -23,7 +23,7 @@ public class Cell<T> implements Lens<T> { ...@@ -23,7 +23,7 @@ public class Cell<T> implements Lens<T> {
* @param initialContent the value initially stored by the cell. * @param initialContent the value initially stored by the cell.
*/ */
public Cell(T initialContent) { public Cell(T initialContent) {
//TODO: à compléter this.content = initialContent;
} }
/** Add a {@link OnChangeListener} to react to any change of value in the cell. /** Add a {@link OnChangeListener} to react to any change of value in the cell.
...@@ -42,8 +42,11 @@ public class Cell<T> implements Lens<T> { ...@@ -42,8 +42,11 @@ public class Cell<T> implements Lens<T> {
* @param value the new content of this {@link Cell} * @param value the new content of this {@link Cell}
*/ */
public void set(T value) { public void set(T value) {
//TODO: modifier le contenu de la cellule, puis appeler les méthodes valueChanged des T oldValue = this.content;
// listeners this.content = value;
for (OnChangeListener<T> listener : this.listeners) {
listener.valueChanged(oldValue,value);
}
} }
/** /**
...@@ -52,7 +55,6 @@ public class Cell<T> implements Lens<T> { ...@@ -52,7 +55,6 @@ public class Cell<T> implements Lens<T> {
* @return the current content of this {@link Cell} * @return the current content of this {@link Cell}
*/ */
public T get(){ public T get(){
//TODO: à compléter return this.content;
return null;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment