package edu.wright.hendrix11.conway.gui;

import javafx.scene.layout.Pane;

import edu.wright.hendrix11.conway.logic.Cell;

/**
 * @author Joe Hendrix
 */
public class CellPane extends Pane {

    private final Cell cell;

    public CellPane(Cell cell) {
        this.cell = cell;
        setPrefSize(100.0f, 100.0f);
        setStyle();
        setOnMouseClicked(event -> cell.toggle());
        cell.onToggle(event -> setStyle());
    }

    private void setStyle() {
        if (cell.isAlive()) {
            setStyle("-fx-background-color: black; -fx-border-color: black;");
        } else {
            assert !cell.isAlive();
            setStyle("-fx-background-color: transparent; -fx-border-color: black; -fx-border-width: 1px;");
        }
    }

    public Cell getCell() {
        return cell;
    }
}

@@ -186,16 +186,161 @@
 Pane %7B%0A%0A
+    private static final String DEAD_CELL_STYLE_CLASS = %22deadCell%22;%0A    private static final String LIVING_CELL_STYLE_CLASS = %22livingCell%22;%0A    %0A
     priv
@@ -573,24 +573,396 @@
 le());%0A    %7D
+%0A    %0A    private void setStyleClass() %7B%0A        if(cell.isAlive()) %7B%0A            getStyleClass().remove(DEAD_CELL_STYLE_CLASS);%0A            getStyleClass().add(LIVING_CELL_STYLE_CLASS);%0A        %7D else %7B%0A            assert !cell.isAlive();%0A            getStyleClass().remove(LIVING_CELL_STYLE_CLASS);%0A            getStyleClass().add(DEAD_CELL_STYLE_CLASS);%0A        %7D%0A    %7D
 %0A%0A    privat

Update CellPane.java