{"action":"created","comment":{"url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/pulls/comments/129612664","pull_request_review_id":52404872,"id":129612664,"diff_hunk":"@@ -0,0 +1,85 @@\n+package com.spanish_inquisition.battleship.client.board;\n+\n+import com.spanish_inquisition.battleship.common.AdjacentFieldsCalc;\n+import javafx.application.Platform;\n+import javafx.event.EventHandler;\n+import javafx.scene.Node;\n+import javafx.scene.control.Label;\n+import javafx.scene.input.MouseEvent;\n+import javafx.scene.layout.ColumnConstraints;\n+import javafx.scene.layout.GridPane;\n+import javafx.scene.layout.RowConstraints;\n+\n+/**\n+ * @author Michal_Partacz\n+ * This class will make sure the board of buttons is properly initialized and with every event handlers needed.\n+ */\n+public class GameBoardBuilder {\n+    private static final int BOARD_SIZE_WITH_LABELS = 11;\n+    private static final double FIELD_SIZE = 10;\n+    private GridPane gridPane;\n+    private BoardController boardController;\n+\n+    public GameBoardBuilder(BoardController boardController) {\n+        this.boardController = boardController;\n+        this.gridPane = boardController.getBoardGridPane();\n+    }\n+\n+    public GameBoard buildGameBoard() {\n+        fillTheBoardWithButtonsAndLabels();\n+        return null;\n+    }\n+\n+    private void fillTheBoardWithButtonsAndLabels() {\n+        for (int column = 0; column < BOARD_SIZE_WITH_LABELS; column++) {\n+            Platform.runLater(() -> gridPane.getRowConstraints().add(new RowConstraints(FIELD_SIZE)));\n+            for (int row = 0; row < BOARD_SIZE_WITH_LABELS; row++) {\n+                if (column == 0 && row == 0) {\n+                    Platform.runLater(() -> gridPane.getColumnConstraints().add(new ColumnConstraints(FIELD_SIZE)));\n+                } else if (column == 0) {\n+                    Platform.runLater(() -> gridPane.getColumnConstraints().add(new ColumnConstraints(FIELD_SIZE)));\n+                    addHorizontalLabelOnIndex(row);\n+                } else if (row == 0) {\n+                    addVerticalLabelOnIndex(column);\n+                } else {\n+                    createNewBoardTileAndAddIt(column, row);\n+                }\n+            }\n+        }\n+    }\n+\n+    private void createNewBoardTileAndAddIt(int absoluteXCoordinate, int absoluteYCoordinate) {\n+        int boardIndex = AdjacentFieldsCalc.translateCoordinatesToIndex(absoluteXCoordinate - 1, absoluteYCoordinate - 1);\n+        BoardTile tile = new BoardTile(boardIndex);\n+        tile.setOnMouseClicked(getOnBoardTileClickedEvent(tile, boardController));\n+        Platform.runLater(() -> this.gridPane.add(tile, absoluteXCoordinate, absoluteYCoordinate));\n+        boardController.getGameBoard().addBoardTileToHashMap(boardIndex, tile);\n+        fillGridPaneHeightAndWidthForNode(tile);\n+    }\n+\n+    private void addVerticalLabelOnIndex(int j) {\n+        Label boardBoardTileLabel = new Label(String.valueOf(j));\n+        Platform.runLater(() -> this.gridPane.add(boardBoardTileLabel, 0, j));\n+        fillGridPaneHeightAndWidthForNode(boardBoardTileLabel);\n+    }\n+","path":"src/main/java/com/spanish_inquisition/battleship/client/board/GameBoardBuilder.java","position":65,"original_position":65,"commit_id":"057c5b7681f4863aae3798b189ea9c692d6fb79a","original_commit_id":"057c5b7681f4863aae3798b189ea9c692d6fb79a","user":{"login":"mprtcz","id":17063143,"avatar_url":"https://avatars3.githubusercontent.com/u/17063143?v=4","gravatar_id":"","url":"https://api.github.com/users/mprtcz","html_url":"https://github.com/mprtcz","followers_url":"https://api.github.com/users/mprtcz/followers","following_url":"https://api.github.com/users/mprtcz/following{/other_user}","gists_url":"https://api.github.com/users/mprtcz/gists{/gist_id}","starred_url":"https://api.github.com/users/mprtcz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mprtcz/subscriptions","organizations_url":"https://api.github.com/users/mprtcz/orgs","repos_url":"https://api.github.com/users/mprtcz/repos","events_url":"https://api.github.com/users/mprtcz/events{/privacy}","received_events_url":"https://api.github.com/users/mprtcz/received_events","type":"User","site_admin":false},"body":"ALready done in a new commit 👌 ","created_at":"2017-07-26T15:46:53Z","updated_at":"2017-07-26T15:46:53Z","html_url":"https://github.com/spanish-inquisition-4/Battleship_v2/pull/8#discussion_r129612664","pull_request_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/pulls/comments/129612664"},"html":{"href":"https://github.com/spanish-inquisition-4/Battleship_v2/pull/8#discussion_r129612664"},"pull_request":{"href":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/pulls/8","id":132517732,"html_url":"https://github.com/spanish-inquisition-4/Battleship_v2/pull/8","diff_url":"https://github.com/spanish-inquisition-4/Battleship_v2/pull/8.diff","patch_url":"https://github.com/spanish-inquisition-4/Battleship_v2/pull/8.patch","issue_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/issues/8","number":8,"state":"open","locked":false,"title":"Added classes which will operate on the board displayed in the GUI","user":{"login":"mprtcz","id":17063143,"avatar_url":"https://avatars3.githubusercontent.com/u/17063143?v=4","gravatar_id":"","url":"https://api.github.com/users/mprtcz","html_url":"https://github.com/mprtcz","followers_url":"https://api.github.com/users/mprtcz/followers","following_url":"https://api.github.com/users/mprtcz/following{/other_user}","gists_url":"https://api.github.com/users/mprtcz/gists{/gist_id}","starred_url":"https://api.github.com/users/mprtcz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mprtcz/subscriptions","organizations_url":"https://api.github.com/users/mprtcz/orgs","repos_url":"https://api.github.com/users/mprtcz/repos","events_url":"https://api.github.com/users/mprtcz/events{/privacy}","received_events_url":"https://api.github.com/users/mprtcz/received_events","type":"User","site_admin":false},"body":"Most of the classes are just stub classes, with the exception of GameBoardBuilder which has some methods that fill the grid with buttons, so mostly focus on that one.","created_at":"2017-07-26T13:39:14Z","updated_at":"2017-07-26T15:46:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"035cd6d6470c2565a8dd9f2046c9ca583596a713","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/pulls/8/commits","review_comments_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/pulls/8/comments","review_comment_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/issues/8/comments","statuses_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/statuses/057c5b7681f4863aae3798b189ea9c692d6fb79a","head":{"label":"spanish-inquisition-4:client-gui-elements","ref":"client-gui-elements","sha":"057c5b7681f4863aae3798b189ea9c692d6fb79a","user":{"login":"spanish-inquisition-4","id":30144634,"avatar_url":"https://avatars0.githubusercontent.com/u/30144634?v=4","gravatar_id":"","url":"https://api.github.com/users/spanish-inquisition-4","html_url":"https://github.com/spanish-inquisition-4","followers_url":"https://api.github.com/users/spanish-inquisition-4/followers","following_url":"https://api.github.com/users/spanish-inquisition-4/following{/other_user}","gists_url":"https://api.github.com/users/spanish-inquisition-4/gists{/gist_id}","starred_url":"https://api.github.com/users/spanish-inquisition-4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spanish-inquisition-4/subscriptions","organizations_url":"https://api.github.com/users/spanish-inquisition-4/orgs","repos_url":"https://api.github.com/users/spanish-inquisition-4/repos","events_url":"https://api.github.com/users/spanish-inquisition-4/events{/privacy}","received_events_url":"https://api.github.com/users/spanish-inquisition-4/received_events","type":"User","site_admin":false},"repo":{"id":98204306,"name":"Battleship_v2","full_name":"spanish-inquisition-4/Battleship_v2","owner":{"login":"spanish-inquisition-4","id":30144634,"avatar_url":"https://avatars0.githubusercontent.com/u/30144634?v=4","gravatar_id":"","url":"https://api.github.com/users/spanish-inquisition-4","html_url":"https://github.com/spanish-inquisition-4","followers_url":"https://api.github.com/users/spanish-inquisition-4/followers","following_url":"https://api.github.com/users/spanish-inquisition-4/following{/other_user}","gists_url":"https://api.github.com/users/spanish-inquisition-4/gists{/gist_id}","starred_url":"https://api.github.com/users/spanish-inquisition-4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spanish-inquisition-4/subscriptions","organizations_url":"https://api.github.com/users/spanish-inquisition-4/orgs","repos_url":"https://api.github.com/users/spanish-inquisition-4/repos","events_url":"https://api.github.com/users/spanish-inquisition-4/events{/privacy}","received_events_url":"https://api.github.com/users/spanish-inquisition-4/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/spanish-inquisition-4/Battleship_v2","description":"Java implementation of Battleship game (client-server architecture with simple GUI in JavaFX). See game rules: https://en.wikipedia.org/wiki/Battleship_(game)","fork":false,"url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2","forks_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/forks","keys_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/teams","hooks_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/hooks","issue_events_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/issues/events{/number}","events_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/events","assignees_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/assignees{/user}","branches_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/branches{/branch}","tags_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/tags","blobs_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/git/refs{/sha}","trees_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/statuses/{sha}","languages_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/languages","stargazers_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/stargazers","contributors_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/contributors","subscribers_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/subscribers","subscription_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/subscription","commits_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/commits{/sha}","git_commits_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/git/commits{/sha}","comments_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/comments{/number}","issue_comment_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/issues/comments{/number}","contents_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/contents/{+path}","compare_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/merges","archive_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/downloads","issues_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/issues{/number}","pulls_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/pulls{/number}","milestones_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/milestones{/number}","notifications_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/labels{/name}","releases_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/releases{/id}","deployments_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/deployments","created_at":"2017-07-24T15:11:52Z","updated_at":"2017-07-25T13:40:45Z","pushed_at":"2017-07-26T15:17:51Z","git_url":"git://github.com/spanish-inquisition-4/Battleship_v2.git","ssh_url":"git@github.com:spanish-inquisition-4/Battleship_v2.git","clone_url":"https://github.com/spanish-inquisition-4/Battleship_v2.git","svn_url":"https://github.com/spanish-inquisition-4/Battleship_v2","homepage":null,"size":54,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"spanish-inquisition-4:master","ref":"master","sha":"8860176d4fb2c08252f293b5f3f27975bd5fd691","user":{"login":"spanish-inquisition-4","id":30144634,"avatar_url":"https://avatars0.githubusercontent.com/u/30144634?v=4","gravatar_id":"","url":"https://api.github.com/users/spanish-inquisition-4","html_url":"https://github.com/spanish-inquisition-4","followers_url":"https://api.github.com/users/spanish-inquisition-4/followers","following_url":"https://api.github.com/users/spanish-inquisition-4/following{/other_user}","gists_url":"https://api.github.com/users/spanish-inquisition-4/gists{/gist_id}","starred_url":"https://api.github.com/users/spanish-inquisition-4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spanish-inquisition-4/subscriptions","organizations_url":"https://api.github.com/users/spanish-inquisition-4/orgs","repos_url":"https://api.github.com/users/spanish-inquisition-4/repos","events_url":"https://api.github.com/users/spanish-inquisition-4/events{/privacy}","received_events_url":"https://api.github.com/users/spanish-inquisition-4/received_events","type":"User","site_admin":false},"repo":{"id":98204306,"name":"Battleship_v2","full_name":"spanish-inquisition-4/Battleship_v2","owner":{"login":"spanish-inquisition-4","id":30144634,"avatar_url":"https://avatars0.githubusercontent.com/u/30144634?v=4","gravatar_id":"","url":"https://api.github.com/users/spanish-inquisition-4","html_url":"https://github.com/spanish-inquisition-4","followers_url":"https://api.github.com/users/spanish-inquisition-4/followers","following_url":"https://api.github.com/users/spanish-inquisition-4/following{/other_user}","gists_url":"https://api.github.com/users/spanish-inquisition-4/gists{/gist_id}","starred_url":"https://api.github.com/users/spanish-inquisition-4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spanish-inquisition-4/subscriptions","organizations_url":"https://api.github.com/users/spanish-inquisition-4/orgs","repos_url":"https://api.github.com/users/spanish-inquisition-4/repos","events_url":"https://api.github.com/users/spanish-inquisition-4/events{/privacy}","received_events_url":"https://api.github.com/users/spanish-inquisition-4/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/spanish-inquisition-4/Battleship_v2","description":"Java implementation of Battleship game (client-server architecture with simple GUI in JavaFX). See game rules: https://en.wikipedia.org/wiki/Battleship_(game)","fork":false,"url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2","forks_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/forks","keys_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/teams","hooks_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/hooks","issue_events_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/issues/events{/number}","events_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/events","assignees_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/assignees{/user}","branches_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/branches{/branch}","tags_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/tags","blobs_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/git/refs{/sha}","trees_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/statuses/{sha}","languages_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/languages","stargazers_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/stargazers","contributors_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/contributors","subscribers_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/subscribers","subscription_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/subscription","commits_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/commits{/sha}","git_commits_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/git/commits{/sha}","comments_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/comments{/number}","issue_comment_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/issues/comments{/number}","contents_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/contents/{+path}","compare_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/merges","archive_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/downloads","issues_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/issues{/number}","pulls_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/pulls{/number}","milestones_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/milestones{/number}","notifications_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/labels{/name}","releases_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/releases{/id}","deployments_url":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/deployments","created_at":"2017-07-24T15:11:52Z","updated_at":"2017-07-25T13:40:45Z","pushed_at":"2017-07-26T15:17:51Z","git_url":"git://github.com/spanish-inquisition-4/Battleship_v2.git","ssh_url":"git@github.com:spanish-inquisition-4/Battleship_v2.git","clone_url":"https://github.com/spanish-inquisition-4/Battleship_v2.git","svn_url":"https://github.com/spanish-inquisition-4/Battleship_v2","homepage":null,"size":54,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/pulls/8"},"html":{"href":"https://github.com/spanish-inquisition-4/Battleship_v2/pull/8"},"issue":{"href":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/issues/8"},"comments":{"href":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/spanish-inquisition-4/Battleship_v2/statuses/057c5b7681f4863aae3798b189ea9c692d6fb79a"}}}}
{"actor":{"display_login":"mprtcz"}}