{"action":"created","comment":{"url":"https://api.github.com/repos/triplea-game/triplea/pulls/comments/56745247","id":56745247,"diff_hunk":"@@ -0,0 +1,442 @@\n+package util.triplea.MapXMLCreator;\r\n+\r\n+import java.awt.Color;\r\n+import java.awt.FontMetrics;\r\n+import java.awt.Graphics;\r\n+import java.awt.Graphics2D;\r\n+import java.awt.Point;\r\n+import java.awt.event.ActionEvent;\r\n+import java.awt.event.MouseEvent;\r\n+import java.awt.geom.Rectangle2D;\r\n+import java.util.ArrayList;\r\n+import java.util.Collection;\r\n+import java.util.HashMap;\r\n+import java.util.HashSet;\r\n+import java.util.Iterator;\r\n+import java.util.LinkedHashSet;\r\n+import java.util.Map;\r\n+import java.util.Map.Entry;\r\n+import java.util.SortedSet;\r\n+import java.util.TreeSet;\r\n+\r\n+import javax.swing.AbstractAction;\r\n+import javax.swing.JOptionPane;\r\n+import javax.swing.JPanel;\r\n+import javax.swing.SwingUtilities;\r\n+\r\n+import games.strategy.util.Tuple;\r\n+import util.triplea.MapXMLCreator.TerritoryDefinitionDialog.DEFINITION;\r\n+\r\n+\r\n+public class CanalDefinitionsPanel extends ImageScrollPanePanel {\r\n+  private static final String NEW_CANAL_OPTION = \"<new Canal>\";\r\n+\r\n+  private SortedSet<String> selectedLandTerritories = new TreeSet<String>();\r\n+  private SortedSet<String> selectedWaterTerritories = new TreeSet<String>();\r\n+  private String currentCanalName = null;\r\n+\r\n+  private CanalDefinitionsPanel() {}\r\n+\r\n+  public static void layout(final MapXMLCreator mapXMLCreator, final JPanel stepActionPanel) {\r\n+    ImageScrollPanePanel.mapXMLCreator = mapXMLCreator;\r\n+    final CanalDefinitionsPanel panel = new CanalDefinitionsPanel();\r\n+    panel.layout(stepActionPanel);\r\n+    mapXMLCreator.setAutoFillAction(new AbstractAction() {\r\n+      private static final long serialVersionUID = -8508734371454749752L;\r\n+\r\n+      @Override\r\n+      public void actionPerformed(ActionEvent arg0) {\r\n+        final int prevCanalCount = MapXMLHelper.canalDefinitions.size();\r\n+        if (prevCanalCount > 0) {\r\n+          if (JOptionPane.YES_OPTION != JOptionPane.showOptionDialog(null,\r\n+              \"All current canal definitions will be deleted.\\rDo you want to continue with Auto-Fill?\",\r\n+              \"Auto-Fill Warning\",\r\n+              JOptionPane.YES_NO_OPTION,\r\n+              JOptionPane.WARNING_MESSAGE, null, null, JOptionPane.NO_OPTION))\r\n+            return;\r\n+          MapXMLHelper.clearCanalDefinitions();\r\n+        }\r\n+        panel.clearSelection();\r\n+        final HashMap<String, LinkedHashSet<String>> landWaterTerritoyConnections =\r\n+            new HashMap<String, LinkedHashSet<String>>();\r\n+        final HashMap<String, LinkedHashSet<String>> waterLandTerritoyConnections =\r\n+            new HashMap<String, LinkedHashSet<String>>();\r\n+        for (final Entry<String, LinkedHashSet<String>> terrConn : MapXMLHelper.territoryConnections.entrySet()) {\r\n+          if (MapXMLHelper.territoryDefintions.get(terrConn.getKey()).get(DEFINITION.IS_WATER) == true) {\r","path":"src/util/triplea/MapXMLCreator/CanalDefinitionsPanel.java","position":65,"original_position":65,"commit_id":"890cb47f45798af09951d26673bde3647bcfe750","original_commit_id":"890cb47f45798af09951d26673bde3647bcfe750","user":{"login":"DanVanAtta","id":12397753,"avatar_url":"https://avatars.githubusercontent.com/u/12397753?v=3","gravatar_id":"","url":"https://api.github.com/users/DanVanAtta","html_url":"https://github.com/DanVanAtta","followers_url":"https://api.github.com/users/DanVanAtta/followers","following_url":"https://api.github.com/users/DanVanAtta/following{/other_user}","gists_url":"https://api.github.com/users/DanVanAtta/gists{/gist_id}","starred_url":"https://api.github.com/users/DanVanAtta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanVanAtta/subscriptions","organizations_url":"https://api.github.com/users/DanVanAtta/orgs","repos_url":"https://api.github.com/users/DanVanAtta/repos","events_url":"https://api.github.com/users/DanVanAtta/events{/privacy}","received_events_url":"https://api.github.com/users/DanVanAtta/received_events","type":"User","site_admin":false},"body":"Can simplify by removing the \"== true\"","created_at":"2016-03-19T06:45:13Z","updated_at":"2016-03-19T06:45:13Z","html_url":"https://github.com/triplea-game/triplea/pull/485#discussion_r56745247","pull_request_url":"https://api.github.com/repos/triplea-game/triplea/pulls/485","_links":{"self":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/comments/56745247"},"html":{"href":"https://github.com/triplea-game/triplea/pull/485#discussion_r56745247"},"pull_request":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/485"}}},"pull_request":{"url":"https://api.github.com/repos/triplea-game/triplea/pulls/485","id":60989697,"html_url":"https://github.com/triplea-game/triplea/pull/485","diff_url":"https://github.com/triplea-game/triplea/pull/485.diff","patch_url":"https://github.com/triplea-game/triplea/pull/485.patch","issue_url":"https://api.github.com/repos/triplea-game/triplea/issues/485","number":485,"state":"open","locked":false,"title":"Java MapXMLCreator (beta)","user":{"login":"frigoref","id":10353640,"avatar_url":"https://avatars.githubusercontent.com/u/10353640?v=3","gravatar_id":"","url":"https://api.github.com/users/frigoref","html_url":"https://github.com/frigoref","followers_url":"https://api.github.com/users/frigoref/followers","following_url":"https://api.github.com/users/frigoref/following{/other_user}","gists_url":"https://api.github.com/users/frigoref/gists{/gist_id}","starred_url":"https://api.github.com/users/frigoref/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frigoref/subscriptions","organizations_url":"https://api.github.com/users/frigoref/orgs","repos_url":"https://api.github.com/users/frigoref/repos","events_url":"https://api.github.com/users/frigoref/events{/privacy}","received_events_url":"https://api.github.com/users/frigoref/received_events","type":"User","site_admin":false},"body":"Initial version of\r\nJava map XML creator based on previous C/C++ based XML creator.\r\nRun util.triplea.MapXMLCreator.MapXMLCreator.main()\n\n<!-- Reviewable:start -->\n[<img src=\"https://reviewable.io/review_button.svg\" height=\"40\" alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/triplea-game/triplea/485)\n<!-- Reviewable:end -->\n","created_at":"2016-02-28T12:23:20Z","updated_at":"2016-03-19T06:45:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ad94a1b18a4f7b38f329d5cfa6a694d293ff46a","assignee":{"login":"frigoref","id":10353640,"avatar_url":"https://avatars.githubusercontent.com/u/10353640?v=3","gravatar_id":"","url":"https://api.github.com/users/frigoref","html_url":"https://github.com/frigoref","followers_url":"https://api.github.com/users/frigoref/followers","following_url":"https://api.github.com/users/frigoref/following{/other_user}","gists_url":"https://api.github.com/users/frigoref/gists{/gist_id}","starred_url":"https://api.github.com/users/frigoref/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frigoref/subscriptions","organizations_url":"https://api.github.com/users/frigoref/orgs","repos_url":"https://api.github.com/users/frigoref/repos","events_url":"https://api.github.com/users/frigoref/events{/privacy}","received_events_url":"https://api.github.com/users/frigoref/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/triplea-game/triplea/pulls/485/commits","review_comments_url":"https://api.github.com/repos/triplea-game/triplea/pulls/485/comments","review_comment_url":"https://api.github.com/repos/triplea-game/triplea/pulls/comments{/number}","comments_url":"https://api.github.com/repos/triplea-game/triplea/issues/485/comments","statuses_url":"https://api.github.com/repos/triplea-game/triplea/statuses/890cb47f45798af09951d26673bde3647bcfe750","head":{"label":"frigoref:MapXMLCreator_Java","ref":"MapXMLCreator_Java","sha":"890cb47f45798af09951d26673bde3647bcfe750","user":{"login":"frigoref","id":10353640,"avatar_url":"https://avatars.githubusercontent.com/u/10353640?v=3","gravatar_id":"","url":"https://api.github.com/users/frigoref","html_url":"https://github.com/frigoref","followers_url":"https://api.github.com/users/frigoref/followers","following_url":"https://api.github.com/users/frigoref/following{/other_user}","gists_url":"https://api.github.com/users/frigoref/gists{/gist_id}","starred_url":"https://api.github.com/users/frigoref/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frigoref/subscriptions","organizations_url":"https://api.github.com/users/frigoref/orgs","repos_url":"https://api.github.com/users/frigoref/repos","events_url":"https://api.github.com/users/frigoref/events{/privacy}","received_events_url":"https://api.github.com/users/frigoref/received_events","type":"User","site_admin":false},"repo":{"id":52717775,"name":"triplea","full_name":"frigoref/triplea","owner":{"login":"frigoref","id":10353640,"avatar_url":"https://avatars.githubusercontent.com/u/10353640?v=3","gravatar_id":"","url":"https://api.github.com/users/frigoref","html_url":"https://github.com/frigoref","followers_url":"https://api.github.com/users/frigoref/followers","following_url":"https://api.github.com/users/frigoref/following{/other_user}","gists_url":"https://api.github.com/users/frigoref/gists{/gist_id}","starred_url":"https://api.github.com/users/frigoref/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frigoref/subscriptions","organizations_url":"https://api.github.com/users/frigoref/orgs","repos_url":"https://api.github.com/users/frigoref/repos","events_url":"https://api.github.com/users/frigoref/events{/privacy}","received_events_url":"https://api.github.com/users/frigoref/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/frigoref/triplea","description":"TripleA is a turn based strategy game and board game engine, similar to Axis & Allies or Risk.","fork":true,"url":"https://api.github.com/repos/frigoref/triplea","forks_url":"https://api.github.com/repos/frigoref/triplea/forks","keys_url":"https://api.github.com/repos/frigoref/triplea/keys{/key_id}","collaborators_url":"https://api.github.com/repos/frigoref/triplea/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/frigoref/triplea/teams","hooks_url":"https://api.github.com/repos/frigoref/triplea/hooks","issue_events_url":"https://api.github.com/repos/frigoref/triplea/issues/events{/number}","events_url":"https://api.github.com/repos/frigoref/triplea/events","assignees_url":"https://api.github.com/repos/frigoref/triplea/assignees{/user}","branches_url":"https://api.github.com/repos/frigoref/triplea/branches{/branch}","tags_url":"https://api.github.com/repos/frigoref/triplea/tags","blobs_url":"https://api.github.com/repos/frigoref/triplea/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/frigoref/triplea/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/frigoref/triplea/git/refs{/sha}","trees_url":"https://api.github.com/repos/frigoref/triplea/git/trees{/sha}","statuses_url":"https://api.github.com/repos/frigoref/triplea/statuses/{sha}","languages_url":"https://api.github.com/repos/frigoref/triplea/languages","stargazers_url":"https://api.github.com/repos/frigoref/triplea/stargazers","contributors_url":"https://api.github.com/repos/frigoref/triplea/contributors","subscribers_url":"https://api.github.com/repos/frigoref/triplea/subscribers","subscription_url":"https://api.github.com/repos/frigoref/triplea/subscription","commits_url":"https://api.github.com/repos/frigoref/triplea/commits{/sha}","git_commits_url":"https://api.github.com/repos/frigoref/triplea/git/commits{/sha}","comments_url":"https://api.github.com/repos/frigoref/triplea/comments{/number}","issue_comment_url":"https://api.github.com/repos/frigoref/triplea/issues/comments{/number}","contents_url":"https://api.github.com/repos/frigoref/triplea/contents/{+path}","compare_url":"https://api.github.com/repos/frigoref/triplea/compare/{base}...{head}","merges_url":"https://api.github.com/repos/frigoref/triplea/merges","archive_url":"https://api.github.com/repos/frigoref/triplea/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/frigoref/triplea/downloads","issues_url":"https://api.github.com/repos/frigoref/triplea/issues{/number}","pulls_url":"https://api.github.com/repos/frigoref/triplea/pulls{/number}","milestones_url":"https://api.github.com/repos/frigoref/triplea/milestones{/number}","notifications_url":"https://api.github.com/repos/frigoref/triplea/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/frigoref/triplea/labels{/name}","releases_url":"https://api.github.com/repos/frigoref/triplea/releases{/id}","deployments_url":"https://api.github.com/repos/frigoref/triplea/deployments","created_at":"2016-02-28T11:27:20Z","updated_at":"2016-02-28T11:27:28Z","pushed_at":"2016-03-19T01:10:04Z","git_url":"git://github.com/frigoref/triplea.git","ssh_url":"git@github.com:frigoref/triplea.git","clone_url":"https://github.com/frigoref/triplea.git","svn_url":"https://github.com/frigoref/triplea","homepage":null,"size":686367,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"triplea-game:master","ref":"master","sha":"6082762121a7dc1109f29e4b23452024a8a6e5b3","user":{"login":"triplea-game","id":13318615,"avatar_url":"https://avatars.githubusercontent.com/u/13318615?v=3","gravatar_id":"","url":"https://api.github.com/users/triplea-game","html_url":"https://github.com/triplea-game","followers_url":"https://api.github.com/users/triplea-game/followers","following_url":"https://api.github.com/users/triplea-game/following{/other_user}","gists_url":"https://api.github.com/users/triplea-game/gists{/gist_id}","starred_url":"https://api.github.com/users/triplea-game/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/triplea-game/subscriptions","organizations_url":"https://api.github.com/users/triplea-game/orgs","repos_url":"https://api.github.com/users/triplea-game/repos","events_url":"https://api.github.com/users/triplea-game/events{/privacy}","received_events_url":"https://api.github.com/users/triplea-game/received_events","type":"Organization","site_admin":false},"repo":{"id":39766308,"name":"triplea","full_name":"triplea-game/triplea","owner":{"login":"triplea-game","id":13318615,"avatar_url":"https://avatars.githubusercontent.com/u/13318615?v=3","gravatar_id":"","url":"https://api.github.com/users/triplea-game","html_url":"https://github.com/triplea-game","followers_url":"https://api.github.com/users/triplea-game/followers","following_url":"https://api.github.com/users/triplea-game/following{/other_user}","gists_url":"https://api.github.com/users/triplea-game/gists{/gist_id}","starred_url":"https://api.github.com/users/triplea-game/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/triplea-game/subscriptions","organizations_url":"https://api.github.com/users/triplea-game/orgs","repos_url":"https://api.github.com/users/triplea-game/repos","events_url":"https://api.github.com/users/triplea-game/events{/privacy}","received_events_url":"https://api.github.com/users/triplea-game/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/triplea-game/triplea","description":"TripleA is a turn based strategy game and board game engine, similar to Axis & Allies or Risk.","fork":false,"url":"https://api.github.com/repos/triplea-game/triplea","forks_url":"https://api.github.com/repos/triplea-game/triplea/forks","keys_url":"https://api.github.com/repos/triplea-game/triplea/keys{/key_id}","collaborators_url":"https://api.github.com/repos/triplea-game/triplea/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/triplea-game/triplea/teams","hooks_url":"https://api.github.com/repos/triplea-game/triplea/hooks","issue_events_url":"https://api.github.com/repos/triplea-game/triplea/issues/events{/number}","events_url":"https://api.github.com/repos/triplea-game/triplea/events","assignees_url":"https://api.github.com/repos/triplea-game/triplea/assignees{/user}","branches_url":"https://api.github.com/repos/triplea-game/triplea/branches{/branch}","tags_url":"https://api.github.com/repos/triplea-game/triplea/tags","blobs_url":"https://api.github.com/repos/triplea-game/triplea/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/triplea-game/triplea/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/triplea-game/triplea/git/refs{/sha}","trees_url":"https://api.github.com/repos/triplea-game/triplea/git/trees{/sha}","statuses_url":"https://api.github.com/repos/triplea-game/triplea/statuses/{sha}","languages_url":"https://api.github.com/repos/triplea-game/triplea/languages","stargazers_url":"https://api.github.com/repos/triplea-game/triplea/stargazers","contributors_url":"https://api.github.com/repos/triplea-game/triplea/contributors","subscribers_url":"https://api.github.com/repos/triplea-game/triplea/subscribers","subscription_url":"https://api.github.com/repos/triplea-game/triplea/subscription","commits_url":"https://api.github.com/repos/triplea-game/triplea/commits{/sha}","git_commits_url":"https://api.github.com/repos/triplea-game/triplea/git/commits{/sha}","comments_url":"https://api.github.com/repos/triplea-game/triplea/comments{/number}","issue_comment_url":"https://api.github.com/repos/triplea-game/triplea/issues/comments{/number}","contents_url":"https://api.github.com/repos/triplea-game/triplea/contents/{+path}","compare_url":"https://api.github.com/repos/triplea-game/triplea/compare/{base}...{head}","merges_url":"https://api.github.com/repos/triplea-game/triplea/merges","archive_url":"https://api.github.com/repos/triplea-game/triplea/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/triplea-game/triplea/downloads","issues_url":"https://api.github.com/repos/triplea-game/triplea/issues{/number}","pulls_url":"https://api.github.com/repos/triplea-game/triplea/pulls{/number}","milestones_url":"https://api.github.com/repos/triplea-game/triplea/milestones{/number}","notifications_url":"https://api.github.com/repos/triplea-game/triplea/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/triplea-game/triplea/labels{/name}","releases_url":"https://api.github.com/repos/triplea-game/triplea/releases{/id}","deployments_url":"https://api.github.com/repos/triplea-game/triplea/deployments","created_at":"2015-07-27T09:32:58Z","updated_at":"2016-03-07T23:10:40Z","pushed_at":"2016-03-19T06:32:52Z","git_url":"git://github.com/triplea-game/triplea.git","ssh_url":"git@github.com:triplea-game/triplea.git","clone_url":"https://github.com/triplea-game/triplea.git","svn_url":"https://github.com/triplea-game/triplea","homepage":null,"size":691704,"stargazers_count":21,"watchers_count":21,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":63,"forks":9,"open_issues":63,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/485"},"html":{"href":"https://github.com/triplea-game/triplea/pull/485"},"issue":{"href":"https://api.github.com/repos/triplea-game/triplea/issues/485"},"comments":{"href":"https://api.github.com/repos/triplea-game/triplea/issues/485/comments"},"review_comments":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/485/comments"},"review_comment":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/triplea-game/triplea/pulls/485/commits"},"statuses":{"href":"https://api.github.com/repos/triplea-game/triplea/statuses/890cb47f45798af09951d26673bde3647bcfe750"}}}}