Newer
Older
import datastruct.Lens;
import java.util.ArrayList;
import java.util.List;
* A class representing a cell that holds a value and allows adding listeners to track value changes.
*
* @param <T> The type of value stored in the cell.
//TODO: ajouter la ou les propriétés nécessaires
// la liste des objets écoutant les modifications du contenu de la cellule
private final List<OnChangeListener<T>> listeners = new ArrayList<>();
* @param initialContent the value initially stored by the cell.
/** Add a {@link OnChangeListener} to react to any change of value in the cell.
*
* @param listener the {@link OnChangeListener} to activate when the value in the cell is
* changed.
*/
public void addOnChangeListener(OnChangeListener<T> listener) {
this.listeners.add(listener);
* Sets the content of this {@link Cell}. This will also call all the listeners that were
* registered by the method {@code addOnChangeListener}.
//TODO: modifier le contenu de la cellule, puis appeler les méthodes valueChanged des
// listeners