Skip to content

Commit

Permalink
bla
Browse files Browse the repository at this point in the history
  • Loading branch information
Folifolo committed Jan 15, 2020
1 parent 71ac1b5 commit de6ed8c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void gridGameUpdate() {
@FXML
void initialize() {
viewModel.setLogger(new TxtLogger("./TxtLogger-gameoflife.log"));

txtHeight.textProperty().bindBidirectional(viewModel.heightFieldProperty());
txtwidth.textProperty().bindBidirectional(viewModel.widthFieldProperty());
txtStatus.textProperty().bindBidirectional(viewModel.statusTextProperty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

<?import ru.unn.agile.gameoflife.viewmodel.*?>

<AnchorPane prefHeight="510.0" prefWidth="573.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ru.unn.agile.gameoflife.view.GameOfLife">
<fx:define>
<ViewModel fx:id="viewModel" />
</fx:define>
<AnchorPane prefHeight="510.0" prefWidth="853.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ru.unn.agile.gameoflife.view.GameOfLife">
<fx:define>
<ViewModel fx:id="viewModel" />
</fx:define>
<children>
<Label layoutX="26.0" layoutY="14.0" text="Height of field" AnchorPane.topAnchor="14.0" />
<Label layoutX="206.0" layoutY="14.0" text="Width of field" AnchorPane.topAnchor="14.0" />
Expand All @@ -19,6 +19,6 @@
<TextField fx:id="txtHeight" layoutX="111.0" layoutY="10.0" prefHeight="25.0" prefWidth="77.0" AnchorPane.topAnchor="10.0" />
<TextField fx:id="txtwidth" layoutX="290.0" layoutY="10.0" prefHeight="25.0" prefWidth="77.0" AnchorPane.topAnchor="10.0" />
<GridPane fx:id="gridGame" layoutX="58.0" layoutY="232.0" prefHeight="400.0" prefWidth="373.0" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="195.0" AnchorPane.topAnchor="105.0" />
<TextArea fx:id="areaLog" text="${viewModel.logs}" editable="false" layoutX="395.0" layoutY="12.0" prefHeight="487.0" prefWidth="165.0" />
<TextArea fx:id="areaLog" editable="false" layoutX="395.0" layoutY="12.0" prefHeight="487.0" prefWidth="447.0" text="${viewModel.logs}" AnchorPane.bottomAnchor="11.0" AnchorPane.rightAnchor="11.0" AnchorPane.topAnchor="11.0" />
</children>
</AnchorPane>
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public void createGrid() {
message.append("Size: height = ").append(heightField.get())
.append("; width = ").append(widthField.get());
logger.log(message.toString());
updateLogs();
}
}

Expand Down Expand Up @@ -154,6 +155,7 @@ public void changeCellStatus(final int y, final int x) {
.append(" now is dead");
logger.log(message.toString());
}
updateLogs();
gridArray = gameOfLife.getGrid().clone();
}

Expand All @@ -164,6 +166,7 @@ public void getNextStep() {

StringBuilder message = new StringBuilder(LogMessages.NEXT_WAS_PRESSED);
logger.log(message.toString());
updateLogs();
}

private void updateLogs() {
Expand Down Expand Up @@ -231,7 +234,7 @@ public String toString() {

final class LogMessages {
public static final String CREATE_WAS_PRESSED = "Create grid. ";
public static final String NEXT_WAS_PRESSED = "Next turn. ";
public static final String NEXT_WAS_PRESSED = "Next generation. ";
public static final String CELL_WAS_CHANGED = "Updated cell. ";

private LogMessages() { }
Expand Down

0 comments on commit de6ed8c

Please sign in to comment.