{"action":"created","comment":{"url":"https://api.github.com/repos/phosphorjs/phosphor-widget/pulls/comments/47448096","id":47448096,"diff_hunk":"@@ -478,14 +459,66 @@ class Widget extends NodeWrapper implements IDisposable, IMessageHandler {\n     if (msg.type === 'update-request') {\n       return pending.some(other => other.type === 'update-request');\n     }\n+    if (msg.type === 'layout-request') {\n+      return pending.some(other => other.type === 'layout-request');\n+    }\n     return false;\n   }\n \n   /**\n+   * Adopt the specified child and set its parent to this widget.\n+   *\n+   * @param child - The child widget to adopt.\n+   *\n+   * #### Notes\n+   * This should be called by subclasses which support children in\n+   * order to update the parent reference when a child is added.\n+   *\n+   * This will set the parent reference to the specified child after\n+   * removing the child from its current parent.\n+   */\n+  protected adoptChild(child: Widget): void {\n+    if (child._parent && child._parent !== this) child.remove();\n+    child._parent = this;\n+  }\n+\n+  /**\n+   * Remove the specified child from the widget.\n+   *\n+   * #### Notes\n+   * This method **must** be reimplemented by subclasses which support\n+   * children, or undefined behavior will result.\n+   *\n+   * This method is called automatically as needed. It should not be\n+   * invoked directly by user code.\n+   *\n+   * The default implementation of this method is a no-op.\n+   */\n+  protected removeChild(child: Widget): void { }","path":"src/widget.ts","position":364,"original_position":364,"commit_id":"da041c9592890022bc1834c4ff5a8d4b62c7fae1","original_commit_id":"da041c9592890022bc1834c4ff5a8d4b62c7fae1","user":{"login":"sccolbert","id":137289,"avatar_url":"https://avatars.githubusercontent.com/u/137289?v=3","gravatar_id":"","url":"https://api.github.com/users/sccolbert","html_url":"https://github.com/sccolbert","followers_url":"https://api.github.com/users/sccolbert/followers","following_url":"https://api.github.com/users/sccolbert/following{/other_user}","gists_url":"https://api.github.com/users/sccolbert/gists{/gist_id}","starred_url":"https://api.github.com/users/sccolbert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sccolbert/subscriptions","organizations_url":"https://api.github.com/users/sccolbert/orgs","repos_url":"https://api.github.com/users/sccolbert/repos","events_url":"https://api.github.com/users/sccolbert/events{/privacy}","received_events_url":"https://api.github.com/users/sccolbert/received_events","type":"User","site_admin":false},"body":"2 Reasons:\r\n\r\n1) This is called by the `dispose` method of `Widget`, and `Widget` has no knowledge of the panel types.\r\n2) It's no long required to inherit from `Panel` or `AbstractPanel` in order to create widgets which support children. Those two classes are there as conveniences which suit a large variety of use cases, but they may not suit everything. For those rare super-custom cases, the user can inherit `Widget` and implement everything themselves.","created_at":"2015-12-13T18:33:41Z","updated_at":"2015-12-13T18:33:41Z","html_url":"https://github.com/phosphorjs/phosphor-widget/pull/17#discussion_r47448096","pull_request_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/phosphorjs/phosphor-widget/pulls/comments/47448096"},"html":{"href":"https://github.com/phosphorjs/phosphor-widget/pull/17#discussion_r47448096"},"pull_request":{"href":"https://api.github.com/repos/phosphorjs/phosphor-widget/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/phosphorjs/phosphor-widget/pulls/17","id":53494729,"html_url":"https://github.com/phosphorjs/phosphor-widget/pull/17","diff_url":"https://github.com/phosphorjs/phosphor-widget/pull/17.diff","patch_url":"https://github.com/phosphorjs/phosphor-widget/pull/17.patch","issue_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/issues/17","number":17,"state":"open","locked":false,"title":"better flexibility with children and panels","user":{"login":"sccolbert","id":137289,"avatar_url":"https://avatars.githubusercontent.com/u/137289?v=3","gravatar_id":"","url":"https://api.github.com/users/sccolbert","html_url":"https://github.com/sccolbert","followers_url":"https://api.github.com/users/sccolbert/followers","following_url":"https://api.github.com/users/sccolbert/following{/other_user}","gists_url":"https://api.github.com/users/sccolbert/gists{/gist_id}","starred_url":"https://api.github.com/users/sccolbert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sccolbert/subscriptions","organizations_url":"https://api.github.com/users/sccolbert/orgs","repos_url":"https://api.github.com/users/sccolbert/repos","events_url":"https://api.github.com/users/sccolbert/events{/privacy}","received_events_url":"https://api.github.com/users/sccolbert/received_events","type":"User","site_admin":false},"body":"Ready for discussion.\r\n\r\nThis is the result of feedback indicating that the current structure of panel children (observable list) is too rigid. Some users want to restrict the API for child types or otherwise implement custom APIs for adding children to a widget.\r\n\r\nThis PR updates Widget with the concept that children *exist* but the methods for adding children to a widget must be defined by a subclass. Two panel subclasses are provided as a convenience: one is `AbstractPanel` which defines an index-based API for accessing children, it also provides default implementations of core messaging behaviors which are necessary for proper functioning of children; the second is `Panel` which is a concrete implementation of the abstract class which stores its children in an internal array and exposes an API for adding children.\r\n\r\nThe core `Widget` class now exposes the APIs necessary to implement widgets which support children *without* forcing inheritance from a particular panel class. For these cases however, such a widget becomes responsible for implementing the child messaging behavior provided by `AbstractPanel`.\r\n\r\nping @jasongrout, @blink1073, @dwillmer, @afshin, @ellisonbg","created_at":"2015-12-13T07:33:42Z","updated_at":"2015-12-13T18:33:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"10556232340142521c0763153d63b25e791abcf8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/pulls/17/commits","review_comments_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/pulls/17/comments","review_comment_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/pulls/comments{/number}","comments_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/issues/17/comments","statuses_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/statuses/da041c9592890022bc1834c4ff5a8d4b62c7fae1","head":{"label":"phosphorjs:feature-children","ref":"feature-children","sha":"da041c9592890022bc1834c4ff5a8d4b62c7fae1","user":{"login":"phosphorjs","id":9534026,"avatar_url":"https://avatars.githubusercontent.com/u/9534026?v=3","gravatar_id":"","url":"https://api.github.com/users/phosphorjs","html_url":"https://github.com/phosphorjs","followers_url":"https://api.github.com/users/phosphorjs/followers","following_url":"https://api.github.com/users/phosphorjs/following{/other_user}","gists_url":"https://api.github.com/users/phosphorjs/gists{/gist_id}","starred_url":"https://api.github.com/users/phosphorjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phosphorjs/subscriptions","organizations_url":"https://api.github.com/users/phosphorjs/orgs","repos_url":"https://api.github.com/users/phosphorjs/repos","events_url":"https://api.github.com/users/phosphorjs/events{/privacy}","received_events_url":"https://api.github.com/users/phosphorjs/received_events","type":"Organization","site_admin":false},"repo":{"id":41388316,"name":"phosphor-widget","full_name":"phosphorjs/phosphor-widget","owner":{"login":"phosphorjs","id":9534026,"avatar_url":"https://avatars.githubusercontent.com/u/9534026?v=3","gravatar_id":"","url":"https://api.github.com/users/phosphorjs","html_url":"https://github.com/phosphorjs","followers_url":"https://api.github.com/users/phosphorjs/followers","following_url":"https://api.github.com/users/phosphorjs/following{/other_user}","gists_url":"https://api.github.com/users/phosphorjs/gists{/gist_id}","starred_url":"https://api.github.com/users/phosphorjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phosphorjs/subscriptions","organizations_url":"https://api.github.com/users/phosphorjs/orgs","repos_url":"https://api.github.com/users/phosphorjs/repos","events_url":"https://api.github.com/users/phosphorjs/events{/privacy}","received_events_url":"https://api.github.com/users/phosphorjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/phosphorjs/phosphor-widget","description":"The core Phosphor widget class.","fork":false,"url":"https://api.github.com/repos/phosphorjs/phosphor-widget","forks_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/forks","keys_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/teams","hooks_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/hooks","issue_events_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/issues/events{/number}","events_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/events","assignees_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/assignees{/user}","branches_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/branches{/branch}","tags_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/tags","blobs_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/git/refs{/sha}","trees_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/statuses/{sha}","languages_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/languages","stargazers_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/stargazers","contributors_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/contributors","subscribers_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/subscribers","subscription_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/subscription","commits_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/commits{/sha}","git_commits_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/git/commits{/sha}","comments_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/comments{/number}","issue_comment_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/issues/comments{/number}","contents_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/contents/{+path}","compare_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/merges","archive_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/downloads","issues_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/issues{/number}","pulls_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/pulls{/number}","milestones_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/milestones{/number}","notifications_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/labels{/name}","releases_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/releases{/id}","created_at":"2015-08-25T21:15:50Z","updated_at":"2015-11-03T20:59:04Z","pushed_at":"2015-12-13T07:33:42Z","git_url":"git://github.com/phosphorjs/phosphor-widget.git","ssh_url":"git@github.com:phosphorjs/phosphor-widget.git","clone_url":"https://github.com/phosphorjs/phosphor-widget.git","svn_url":"https://github.com/phosphorjs/phosphor-widget","homepage":null,"size":435,"stargazers_count":2,"watchers_count":2,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":2,"default_branch":"master"}},"base":{"label":"phosphorjs:master","ref":"master","sha":"c2a0ad40e23a450955dc134b17031369bf91f1f5","user":{"login":"phosphorjs","id":9534026,"avatar_url":"https://avatars.githubusercontent.com/u/9534026?v=3","gravatar_id":"","url":"https://api.github.com/users/phosphorjs","html_url":"https://github.com/phosphorjs","followers_url":"https://api.github.com/users/phosphorjs/followers","following_url":"https://api.github.com/users/phosphorjs/following{/other_user}","gists_url":"https://api.github.com/users/phosphorjs/gists{/gist_id}","starred_url":"https://api.github.com/users/phosphorjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phosphorjs/subscriptions","organizations_url":"https://api.github.com/users/phosphorjs/orgs","repos_url":"https://api.github.com/users/phosphorjs/repos","events_url":"https://api.github.com/users/phosphorjs/events{/privacy}","received_events_url":"https://api.github.com/users/phosphorjs/received_events","type":"Organization","site_admin":false},"repo":{"id":41388316,"name":"phosphor-widget","full_name":"phosphorjs/phosphor-widget","owner":{"login":"phosphorjs","id":9534026,"avatar_url":"https://avatars.githubusercontent.com/u/9534026?v=3","gravatar_id":"","url":"https://api.github.com/users/phosphorjs","html_url":"https://github.com/phosphorjs","followers_url":"https://api.github.com/users/phosphorjs/followers","following_url":"https://api.github.com/users/phosphorjs/following{/other_user}","gists_url":"https://api.github.com/users/phosphorjs/gists{/gist_id}","starred_url":"https://api.github.com/users/phosphorjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phosphorjs/subscriptions","organizations_url":"https://api.github.com/users/phosphorjs/orgs","repos_url":"https://api.github.com/users/phosphorjs/repos","events_url":"https://api.github.com/users/phosphorjs/events{/privacy}","received_events_url":"https://api.github.com/users/phosphorjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/phosphorjs/phosphor-widget","description":"The core Phosphor widget class.","fork":false,"url":"https://api.github.com/repos/phosphorjs/phosphor-widget","forks_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/forks","keys_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/teams","hooks_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/hooks","issue_events_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/issues/events{/number}","events_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/events","assignees_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/assignees{/user}","branches_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/branches{/branch}","tags_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/tags","blobs_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/git/refs{/sha}","trees_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/statuses/{sha}","languages_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/languages","stargazers_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/stargazers","contributors_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/contributors","subscribers_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/subscribers","subscription_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/subscription","commits_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/commits{/sha}","git_commits_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/git/commits{/sha}","comments_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/comments{/number}","issue_comment_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/issues/comments{/number}","contents_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/contents/{+path}","compare_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/merges","archive_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/downloads","issues_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/issues{/number}","pulls_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/pulls{/number}","milestones_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/milestones{/number}","notifications_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/labels{/name}","releases_url":"https://api.github.com/repos/phosphorjs/phosphor-widget/releases{/id}","created_at":"2015-08-25T21:15:50Z","updated_at":"2015-11-03T20:59:04Z","pushed_at":"2015-12-13T07:33:42Z","git_url":"git://github.com/phosphorjs/phosphor-widget.git","ssh_url":"git@github.com:phosphorjs/phosphor-widget.git","clone_url":"https://github.com/phosphorjs/phosphor-widget.git","svn_url":"https://github.com/phosphorjs/phosphor-widget","homepage":null,"size":435,"stargazers_count":2,"watchers_count":2,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/phosphorjs/phosphor-widget/pulls/17"},"html":{"href":"https://github.com/phosphorjs/phosphor-widget/pull/17"},"issue":{"href":"https://api.github.com/repos/phosphorjs/phosphor-widget/issues/17"},"comments":{"href":"https://api.github.com/repos/phosphorjs/phosphor-widget/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/phosphorjs/phosphor-widget/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/phosphorjs/phosphor-widget/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/phosphorjs/phosphor-widget/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/phosphorjs/phosphor-widget/statuses/da041c9592890022bc1834c4ff5a8d4b62c7fae1"}}}}