{"action":"created","comment":{"url":"https://api.github.com/repos/curityio/oauthtest/pulls/comments/86693834","pull_request_review_id":7339144,"id":86693834,"diff_hunk":"@@ -1,41 +1,56 @@\n package se.curity.oauth.core.controller;\n \n+import javafx.stage.Stage;\n import se.curity.oauth.core.state.OAuthServerState;\n+import se.curity.oauth.core.util.PreferencesUtils;\n import se.curity.oauth.core.util.event.EventBus;\n import javafx.beans.InvalidationListener;\n import javafx.fxml.FXML;\n import javafx.scene.control.TextField;\n \n-public class OAuthServerController {\n+public class OAuthServerController\n+{\n+    private final OAuthServerState _initialOAuthServerState;\n \n     @FXML\n     private TextField baseUrl;\n+\n     @FXML\n     private TextField authorizeEndpoint;\n+\n     @FXML\n     private TextField tokenEndpoint;\n \n-    private final EventBus eventBus;\n+    private final EventBus _eventBus;\n+\n+    public OAuthServerController(EventBus eventBus, OAuthServerState oauthServerState, Stage primaryStage)\n+    {\n+        _eventBus = eventBus;\n+        _initialOAuthServerState = oauthServerState;\n \n-    public OAuthServerController( EventBus eventBus ) {\n-        this.eventBus = eventBus;\n+        primaryStage.setOnCloseRequest(e ->\n+                PreferencesUtils.putOAuthServerPreferences(getOAuthServerState()));\n     }\n \n     @FXML\n-    protected void initialize() {\n+    protected void initialize()\n+    {\n+        baseUrl.setText(_initialOAuthServerState.getBaseUrl());\n+        tokenEndpoint.setText(_initialOAuthServerState.getAuthorizeEndpoint());\n+        authorizeEndpoint.setText(_initialOAuthServerState.getTokenEndpoint());","path":"oauthtest-core/src/main/java/se/curity/oauth/core/controller/OAuthServerController.java","position":45,"original_position":45,"commit_id":"8323f7926b0a4b54417ac581eb549e538af2a052","original_commit_id":"9f1b8a2f4411056eec1eea69a9febaa93dd55541","user":{"login":"renatoathaydes","id":1901277,"avatar_url":"https://avatars.githubusercontent.com/u/1901277?v=3","gravatar_id":"","url":"https://api.github.com/users/renatoathaydes","html_url":"https://github.com/renatoathaydes","followers_url":"https://api.github.com/users/renatoathaydes/followers","following_url":"https://api.github.com/users/renatoathaydes/following{/other_user}","gists_url":"https://api.github.com/users/renatoathaydes/gists{/gist_id}","starred_url":"https://api.github.com/users/renatoathaydes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renatoathaydes/subscriptions","organizations_url":"https://api.github.com/users/renatoathaydes/orgs","repos_url":"https://api.github.com/users/renatoathaydes/repos","events_url":"https://api.github.com/users/renatoathaydes/events{/privacy}","received_events_url":"https://api.github.com/users/renatoathaydes/received_events","type":"User","site_admin":false},"body":"I've refactored this to use DI instead of static methods, which allowed me to keep a reference to the preferences, but not to the initial state, which I think makes much more sense.\r\n\r\nhttps://github.com/curityio/oauthtest/commit/9e65301fbd110217181f332a1b239a57132629d5","created_at":"2016-11-06T19:20:27Z","updated_at":"2016-11-06T19:20:28Z","html_url":"https://github.com/curityio/oauthtest/pull/15#discussion_r86693834","pull_request_url":"https://api.github.com/repos/curityio/oauthtest/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/curityio/oauthtest/pulls/comments/86693834"},"html":{"href":"https://github.com/curityio/oauthtest/pull/15#discussion_r86693834"},"pull_request":{"href":"https://api.github.com/repos/curityio/oauthtest/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/curityio/oauthtest/pulls/15","id":92465515,"html_url":"https://github.com/curityio/oauthtest/pull/15","diff_url":"https://github.com/curityio/oauthtest/pull/15.diff","patch_url":"https://github.com/curityio/oauthtest/pull/15.patch","issue_url":"https://api.github.com/repos/curityio/oauthtest/issues/15","number":15,"state":"closed","locked":false,"title":"Save OAuth server preferences","user":{"login":"travisspencer","id":2499235,"avatar_url":"https://avatars.githubusercontent.com/u/2499235?v=3","gravatar_id":"","url":"https://api.github.com/users/travisspencer","html_url":"https://github.com/travisspencer","followers_url":"https://api.github.com/users/travisspencer/followers","following_url":"https://api.github.com/users/travisspencer/following{/other_user}","gists_url":"https://api.github.com/users/travisspencer/gists{/gist_id}","starred_url":"https://api.github.com/users/travisspencer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/travisspencer/subscriptions","organizations_url":"https://api.github.com/users/travisspencer/orgs","repos_url":"https://api.github.com/users/travisspencer/repos","events_url":"https://api.github.com/users/travisspencer/events{/privacy}","received_events_url":"https://api.github.com/users/travisspencer/received_events","type":"User","site_admin":false},"body":"This PR saves the OAuth server settings in the user preferences. It also adds a new controller for the Settings view.","created_at":"2016-11-05T20:07:43Z","updated_at":"2016-11-06T19:20:28Z","closed_at":"2016-11-06T15:26:59Z","merged_at":"2016-11-06T15:26:59Z","merge_commit_sha":"49ac1dd22792d240c135ffbb5771511e0546a5ff","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/curityio/oauthtest/pulls/15/commits","review_comments_url":"https://api.github.com/repos/curityio/oauthtest/pulls/15/comments","review_comment_url":"https://api.github.com/repos/curityio/oauthtest/pulls/comments{/number}","comments_url":"https://api.github.com/repos/curityio/oauthtest/issues/15/comments","statuses_url":"https://api.github.com/repos/curityio/oauthtest/statuses/8323f7926b0a4b54417ac581eb549e538af2a052","head":{"label":"curityio:feature/master/wp-save-prefs","ref":"feature/master/wp-save-prefs","sha":"8323f7926b0a4b54417ac581eb549e538af2a052","user":{"login":"curityio","id":22588857,"avatar_url":"https://avatars.githubusercontent.com/u/22588857?v=3","gravatar_id":"","url":"https://api.github.com/users/curityio","html_url":"https://github.com/curityio","followers_url":"https://api.github.com/users/curityio/followers","following_url":"https://api.github.com/users/curityio/following{/other_user}","gists_url":"https://api.github.com/users/curityio/gists{/gist_id}","starred_url":"https://api.github.com/users/curityio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/curityio/subscriptions","organizations_url":"https://api.github.com/users/curityio/orgs","repos_url":"https://api.github.com/users/curityio/repos","events_url":"https://api.github.com/users/curityio/events{/privacy}","received_events_url":"https://api.github.com/users/curityio/received_events","type":"Organization","site_admin":false},"repo":{"id":72373220,"name":"oauthtest","full_name":"curityio/oauthtest","owner":{"login":"curityio","id":22588857,"avatar_url":"https://avatars.githubusercontent.com/u/22588857?v=3","gravatar_id":"","url":"https://api.github.com/users/curityio","html_url":"https://github.com/curityio","followers_url":"https://api.github.com/users/curityio/followers","following_url":"https://api.github.com/users/curityio/following{/other_user}","gists_url":"https://api.github.com/users/curityio/gists{/gist_id}","starred_url":"https://api.github.com/users/curityio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/curityio/subscriptions","organizations_url":"https://api.github.com/users/curityio/orgs","repos_url":"https://api.github.com/users/curityio/repos","events_url":"https://api.github.com/users/curityio/events{/privacy}","received_events_url":"https://api.github.com/users/curityio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/curityio/oauthtest","description":"A GUI application for testing and learning OAuth.","fork":false,"url":"https://api.github.com/repos/curityio/oauthtest","forks_url":"https://api.github.com/repos/curityio/oauthtest/forks","keys_url":"https://api.github.com/repos/curityio/oauthtest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/curityio/oauthtest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/curityio/oauthtest/teams","hooks_url":"https://api.github.com/repos/curityio/oauthtest/hooks","issue_events_url":"https://api.github.com/repos/curityio/oauthtest/issues/events{/number}","events_url":"https://api.github.com/repos/curityio/oauthtest/events","assignees_url":"https://api.github.com/repos/curityio/oauthtest/assignees{/user}","branches_url":"https://api.github.com/repos/curityio/oauthtest/branches{/branch}","tags_url":"https://api.github.com/repos/curityio/oauthtest/tags","blobs_url":"https://api.github.com/repos/curityio/oauthtest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/curityio/oauthtest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/curityio/oauthtest/git/refs{/sha}","trees_url":"https://api.github.com/repos/curityio/oauthtest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/curityio/oauthtest/statuses/{sha}","languages_url":"https://api.github.com/repos/curityio/oauthtest/languages","stargazers_url":"https://api.github.com/repos/curityio/oauthtest/stargazers","contributors_url":"https://api.github.com/repos/curityio/oauthtest/contributors","subscribers_url":"https://api.github.com/repos/curityio/oauthtest/subscribers","subscription_url":"https://api.github.com/repos/curityio/oauthtest/subscription","commits_url":"https://api.github.com/repos/curityio/oauthtest/commits{/sha}","git_commits_url":"https://api.github.com/repos/curityio/oauthtest/git/commits{/sha}","comments_url":"https://api.github.com/repos/curityio/oauthtest/comments{/number}","issue_comment_url":"https://api.github.com/repos/curityio/oauthtest/issues/comments{/number}","contents_url":"https://api.github.com/repos/curityio/oauthtest/contents/{+path}","compare_url":"https://api.github.com/repos/curityio/oauthtest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/curityio/oauthtest/merges","archive_url":"https://api.github.com/repos/curityio/oauthtest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/curityio/oauthtest/downloads","issues_url":"https://api.github.com/repos/curityio/oauthtest/issues{/number}","pulls_url":"https://api.github.com/repos/curityio/oauthtest/pulls{/number}","milestones_url":"https://api.github.com/repos/curityio/oauthtest/milestones{/number}","notifications_url":"https://api.github.com/repos/curityio/oauthtest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/curityio/oauthtest/labels{/name}","releases_url":"https://api.github.com/repos/curityio/oauthtest/releases{/id}","deployments_url":"https://api.github.com/repos/curityio/oauthtest/deployments","created_at":"2016-10-30T20:19:53Z","updated_at":"2016-11-04T20:33:00Z","pushed_at":"2016-11-06T19:19:18Z","git_url":"git://github.com/curityio/oauthtest.git","ssh_url":"git@github.com:curityio/oauthtest.git","clone_url":"https://github.com/curityio/oauthtest.git","svn_url":"https://github.com/curityio/oauthtest","homepage":null,"size":144,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":16,"forks":0,"open_issues":16,"watchers":1,"default_branch":"master"}},"base":{"label":"curityio:master","ref":"master","sha":"7a45c8523c13f90f36e7582ea708d885f595fa60","user":{"login":"curityio","id":22588857,"avatar_url":"https://avatars.githubusercontent.com/u/22588857?v=3","gravatar_id":"","url":"https://api.github.com/users/curityio","html_url":"https://github.com/curityio","followers_url":"https://api.github.com/users/curityio/followers","following_url":"https://api.github.com/users/curityio/following{/other_user}","gists_url":"https://api.github.com/users/curityio/gists{/gist_id}","starred_url":"https://api.github.com/users/curityio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/curityio/subscriptions","organizations_url":"https://api.github.com/users/curityio/orgs","repos_url":"https://api.github.com/users/curityio/repos","events_url":"https://api.github.com/users/curityio/events{/privacy}","received_events_url":"https://api.github.com/users/curityio/received_events","type":"Organization","site_admin":false},"repo":{"id":72373220,"name":"oauthtest","full_name":"curityio/oauthtest","owner":{"login":"curityio","id":22588857,"avatar_url":"https://avatars.githubusercontent.com/u/22588857?v=3","gravatar_id":"","url":"https://api.github.com/users/curityio","html_url":"https://github.com/curityio","followers_url":"https://api.github.com/users/curityio/followers","following_url":"https://api.github.com/users/curityio/following{/other_user}","gists_url":"https://api.github.com/users/curityio/gists{/gist_id}","starred_url":"https://api.github.com/users/curityio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/curityio/subscriptions","organizations_url":"https://api.github.com/users/curityio/orgs","repos_url":"https://api.github.com/users/curityio/repos","events_url":"https://api.github.com/users/curityio/events{/privacy}","received_events_url":"https://api.github.com/users/curityio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/curityio/oauthtest","description":"A GUI application for testing and learning OAuth.","fork":false,"url":"https://api.github.com/repos/curityio/oauthtest","forks_url":"https://api.github.com/repos/curityio/oauthtest/forks","keys_url":"https://api.github.com/repos/curityio/oauthtest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/curityio/oauthtest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/curityio/oauthtest/teams","hooks_url":"https://api.github.com/repos/curityio/oauthtest/hooks","issue_events_url":"https://api.github.com/repos/curityio/oauthtest/issues/events{/number}","events_url":"https://api.github.com/repos/curityio/oauthtest/events","assignees_url":"https://api.github.com/repos/curityio/oauthtest/assignees{/user}","branches_url":"https://api.github.com/repos/curityio/oauthtest/branches{/branch}","tags_url":"https://api.github.com/repos/curityio/oauthtest/tags","blobs_url":"https://api.github.com/repos/curityio/oauthtest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/curityio/oauthtest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/curityio/oauthtest/git/refs{/sha}","trees_url":"https://api.github.com/repos/curityio/oauthtest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/curityio/oauthtest/statuses/{sha}","languages_url":"https://api.github.com/repos/curityio/oauthtest/languages","stargazers_url":"https://api.github.com/repos/curityio/oauthtest/stargazers","contributors_url":"https://api.github.com/repos/curityio/oauthtest/contributors","subscribers_url":"https://api.github.com/repos/curityio/oauthtest/subscribers","subscription_url":"https://api.github.com/repos/curityio/oauthtest/subscription","commits_url":"https://api.github.com/repos/curityio/oauthtest/commits{/sha}","git_commits_url":"https://api.github.com/repos/curityio/oauthtest/git/commits{/sha}","comments_url":"https://api.github.com/repos/curityio/oauthtest/comments{/number}","issue_comment_url":"https://api.github.com/repos/curityio/oauthtest/issues/comments{/number}","contents_url":"https://api.github.com/repos/curityio/oauthtest/contents/{+path}","compare_url":"https://api.github.com/repos/curityio/oauthtest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/curityio/oauthtest/merges","archive_url":"https://api.github.com/repos/curityio/oauthtest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/curityio/oauthtest/downloads","issues_url":"https://api.github.com/repos/curityio/oauthtest/issues{/number}","pulls_url":"https://api.github.com/repos/curityio/oauthtest/pulls{/number}","milestones_url":"https://api.github.com/repos/curityio/oauthtest/milestones{/number}","notifications_url":"https://api.github.com/repos/curityio/oauthtest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/curityio/oauthtest/labels{/name}","releases_url":"https://api.github.com/repos/curityio/oauthtest/releases{/id}","deployments_url":"https://api.github.com/repos/curityio/oauthtest/deployments","created_at":"2016-10-30T20:19:53Z","updated_at":"2016-11-04T20:33:00Z","pushed_at":"2016-11-06T19:19:18Z","git_url":"git://github.com/curityio/oauthtest.git","ssh_url":"git@github.com:curityio/oauthtest.git","clone_url":"https://github.com/curityio/oauthtest.git","svn_url":"https://github.com/curityio/oauthtest","homepage":null,"size":144,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":16,"forks":0,"open_issues":16,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/curityio/oauthtest/pulls/15"},"html":{"href":"https://github.com/curityio/oauthtest/pull/15"},"issue":{"href":"https://api.github.com/repos/curityio/oauthtest/issues/15"},"comments":{"href":"https://api.github.com/repos/curityio/oauthtest/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/curityio/oauthtest/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/curityio/oauthtest/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/curityio/oauthtest/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/curityio/oauthtest/statuses/8323f7926b0a4b54417ac581eb549e538af2a052"}}}}
{"actor":{"display_login":"renatoathaydes"}}