{"id":3179,"date":"2019-12-12T21:11:47","date_gmt":"2019-12-12T12:11:47","guid":{"rendered":"http:\/\/oohito.com\/nqthm\/?p=3179"},"modified":"2022-08-21T18:13:44","modified_gmt":"2022-08-21T09:13:44","slug":"spec2%e5%85%a5%e9%96%80%ef%bc%88%e3%81%9d%e3%81%ae%ef%bc%96%ef%bc%89","status":"publish","type":"post","link":"https:\/\/oohito.com\/nqthm\/archives\/3179","title":{"rendered":"Spec2\u5165\u9580\uff08\u305d\u306e\uff16\uff09"},"content":{"rendered":"\n<p>\u3053\u308c\u306f<a href=\"https:\/\/qiita.com\/advent-calendar\/2019\/smalltalk\">Smalltalk Advent Calendar 2019<\/a>\u306e\u8a18\u4e8b\u3067\u3059\u3002<\/p>\n\n\n\n<p>Spec2\u306f\u3001Pharo Smalltalk \u3067\u63a1\u7528\u3055\u308c\u3066\u3044\u308bUI\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3042\u308bSpec \u306e\u65b0\u3057\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u3059\u3002Pharo 7.0 \u3067\u306f Spec \u304c\u4f7f\u308f\u308c\u3066\u3044\u307e\u3057\u305f\u304c\u3001Pharo 8 \u3067\u306f\uff08\u307b\u307c\uff1f\uff09\u5168\u3066\u306eUI\u304c Spec2 \u3067\u66f8\u304d\u76f4\u3055\u308c\u308b\u3088\u3046\u3067\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067\u306f Spec2 \u3092\u4f7f\u3063\u305f UI \u306e\u5b9f\u88c5\u65b9\u6cd5\u306b\u3064\u3044\u3066\u7c21\u5358\u306b\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>Squeak\/Pharo Smalltalk \u3067\u306f\u3001UI\u306e\u5b9f\u73fe\u306e\u305f\u3081\u306b\u9577\u3089\u304f Morphic \u3092\u7528\u3044\u3066\u304d\u307e\u3057\u305f\u3002Morphic \u306f\u30b7\u30f3\u30d7\u30eb\u3067\u5f37\u529b\u306a\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u304c\u3001\u8907\u6570\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u3044\u304f\u3068\u30a2\u30ca\u30fc\u30ad\u30fc\u306a\u5b9f\u88c5\u3092\u3057\u304c\u3061\u3067\u3001\u30ea\u30d5\u30a1\u30af\u30bf\u30ea\u30f3\u30b0\u3084\u518d\u5229\u7528\u306e\u969b\u306b\u6ce3\u304d\u305f\u304f\u306a\u308b\u3088\u3046\u306a\u72b6\u6cc1\u306b\u9665\u308a\u304c\u3061\u3067\u3059\u3002Spec\/Spec2 \u306fUI\u306e\u69cb\u7bc9\u306b\u79e9\u5e8f\u3092\u3082\u305f\u3089\u3057\u3001\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u518d\u5229\u7528\u304c\u3057\u3084\u3059\u304f\u8a2d\u8a08\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p><a href=\"http:\/\/oohito.com\/nqthm\/archives\/3173\">\u524d\u56de\u306e\u8a18\u4e8b<\/a>\u3067\u306f\u3001Scratch 1.4\u98a8\u306e\u30d5\u30a1\u30a4\u30eb\u9078\u629e\u30c0\u30a4\u30a2\u30ed\u30b0\u306b\u3001\u89aa\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3078\u79fb\u52d5\u3059\u308b\u30dc\u30bf\u30f3\u3068\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u968e\u5c64\u304c\u308f\u304b\u308b\u30c9\u30ed\u30c3\u30d7\u30ea\u30b9\u30c8\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>\u524d\u56de\u3064\u304f\u3063\u305f\u30c9\u30ed\u30c3\u30d7\u30ea\u30b9\u30c8\u306f\u30ac\u30ef\u3060\u3051\u3067\u6a5f\u80fd\u304c\u306a\u3044\u306e\u3067\u3001\u4eca\u56de\u306f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u968e\u5c64\u3092\u8868\u793a\u3057\u305f\u308a\u3001\u9014\u4e2d\u306e\u89aa\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3067\u304d\u308b\u3088\u3046\u306a\u6a5f\u80fd\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30c9\u30ed\u30c3\u30d7\u30ea\u30b9\u30c8\u306e\u5185\u5bb9\u3092\u8a2d\u5b9a\u3059\u308b<\/h2>\n\n\n\n<p>\u30b9\u30af\u30e9\u30c3\u30c1\u3067\u306f\u30c9\u30ed\u30c3\u30d7\u30ea\u30b9\u30c8\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u968e\u5c64\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u9014\u4e2d\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u305d\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u5bb9\u304c\u30d5\u30a1\u30a4\u30eb\u4e00\u89a7\u306b\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"http:\/\/oohito.com\/nqthm\/wp-content\/uploads\/2019\/12\/Screenshot-from-2019-12-12-07-14-01-1.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u307e\u305a\u3001\u73fe\u5728\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u304b\u3089\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u968e\u5c64\u306e\u6587\u5b57\u5217\u3092\u53d6\u308a\u51fa\u3059\u30e1\u30bd\u30c3\u30c9 directoryHierarchy \u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">directoryHierarchy\n     ^ directory path segments\n         withIndexCollect:\n             [ :each :index | (String new: index withAll: Character space) , each ]<\/pre>\n\n\n\n<p>directory \u306f FileReference \u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306a\u306e\u3067\u3001path \u3067 AbsolutePath \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u5909\u63db\u3057\u3001segments \u3067\u30d1\u30b9\u3092\u90e8\u5206\u6587\u5b57\u5217\u306e\u914d\u5217\u306b\u5909\u63db\u3057\u307e\u3059\u3002\u305d\u306e\u5f8c\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f7f\u3063\u3066\u30a4\u30f3\u30c7\u30f3\u30c8\u306e\u7a7a\u767d\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6b21\u306b\u30c9\u30ed\u30c3\u30d7\u30ea\u30b9\u30c8\u306b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u968e\u5c64\u3092\u8a2d\u5b9a\u3059\u308b\u30e1\u30bd\u30c3\u30c9 listCurrentContents: \u3092\u4f5c\u308a\u307e\u3059\u3002\u73fe\u5728\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\u304c\u8868\u793a\u3055\u308c\u308b\u3088\u3046\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u4f4d\u7f6e\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">listCurrentContents: aCollection\n     listCurrent selectIndex: 0.\n     listCurrent items: aCollection.\n     listCurrent selectIndex: aCollection size<\/pre>\n\n\n\n<p>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u968e\u5c64\u306f\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u5909\u66f4\u3055\u308c\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u8a2d\u5b9a\u3059\u308b\u3079\u304d\u306a\u306e\u3067\u3001directory: \u30e1\u30bd\u30c3\u30c9\u306e\u4e2d\u3067\u8a2d\u5b9a\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">directory: aFileReference\n     directory := aFileReference.\n     listEntries\n         unselectAll;\n         items: #();\n         items: self getEntries.\n<strong>     self listCurrentContents: self directoryHierarchy<\/strong><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u30c9\u30ed\u30c3\u30d7\u30ea\u30b9\u30c8\u3067\u9078\u629e\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/h2>\n\n\n\n<p>\u8868\u793a\u3055\u308c\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u968e\u5c64\u3092\u9078\u3093\u3060\u3089\u3001\u305d\u306e\u89aa\uff08\u7cfb\u5217\u306e\uff09\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002\u305d\u306e\u305f\u3081\u306b\u306f\u3001\u30c9\u30ed\u30c3\u30d7\u30ea\u30b9\u30c8\u304c\u5909\u66f4\u3055\u308c\u305f\u6642\u306e\u51e6\u7406\u3092 connectPresenters \u306b\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">connectPresenters\n     listEntries\n         display: [ :m | self showEntry: m ];\n         whenActivatedDo: [ :selection | self entriesChanged: selection ].\n     buttonParent action: [ self changeParentDirectory ].\n     <strong>listCurrent\n         whenSelectedItemChangedDo: [ :selection | self currentChanged: selection ]<\/strong><\/pre>\n\n\n\n<p>\u3053\u3053\u3067\u306f\u3001\u30d6\u30ed\u30c3\u30af\u5f15\u6570\u3092\u3064\u3051\u3066 whenSelectedItemChangedDo: \u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u9001\u3063\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u3067\u3001\u30c9\u30ed\u30c3\u30d7\u30ea\u30b9\u30c8\u306e\u9805\u76ee\u304c\u9078\u629e\u3055\u308c\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067 \u3001\u9078\u629e\u3055\u308c\u305f\u9805\u76ee\u306e\u6587\u5b57\u5217\u3092\u5f15\u6570\u3068\u3057\u3066 currentChanged: \u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u9001\u3089\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>currentChanged: \u30e1\u30bd\u30c3\u30c9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9a\u7fa9\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">currentChanged: aString\n     | dir |\n     listCurrent selectedIndex = 0\n         ifTrue: [ ^ self ].\n     dir := directory.\n     directory path segments size - listCurrent selectedIndex\n         timesRepeat: [ dir := dir parent ].\n     self directory: dir<\/pre>\n\n\n\n<p>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30d1\u30b9\u306e\u500b\u6570\u304b\u3089\u9078\u629e\u3055\u308c\u305f\u4f4d\u7f6e\u3092\u5f15\u3044\u305f\u56de\u6570\u3060\u3051\u89aa\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u305f\u3069\u3063\u3066\u3001\u9078\u3070\u308c\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u7279\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002\u4e0d\u683c\u597d\u306a\u3084\u308a\u65b9\u3067\u3059\u304c\u3001\u3068\u308a\u3042\u3048\u305a\u52d5\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30c9\u30ea\u30c3\u30d7\u30ea\u30b9\u30c8\u306e\u9805\u76ee\u3092\u9078\u629e\u3059\u308c\u3070\u89aa\u7cfb\u5217\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3067\u304d\u308b\u306e\u3067\u3059\u304c\u3001\u30c9\u30ed\u30c3\u30d7\u30ea\u30b9\u30c8\u306b\u30ea\u30b9\u30c8\u3092\u8a2d\u5b9a\u3059\u308b\u305f\u3073\u306b\u4e0a\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u9001\u3089\u308c\u308b\u3053\u3068\u306b\u306a\u308b\u305f\u3081\u3001\u521d\u671f\u5316\u306a\u3069\u306e\u969b\u306b\u3082\u4e0d\u7528\u610f\u306a\u30e1\u30c3\u30bb\u30fc\u30b8\u9001\u4fe1\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u305d\u3053\u3067\u3001\u30c9\u30ed\u30c3\u30d7\u30ea\u30b9\u30c8\u306e\u751f\u6210\u6642\u306b  startWithoutSelection \u3092\u9001\u308b\u3053\u3068\u3067\u3001\u3053\u308c\u3092\u56de\u907f\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">initializePresenters\n     listEntries := self newList\n         beSingleSelection;\n         activateOnDoubleClick;\n         items: self getEntries.\n     buttonParent := self newButton\n         icon: (Smalltalk ui icons iconNamed: #up).\n     listCurrent := self newDropList <strong>startWithoutSelection<\/strong>.<strong>\n<\/strong>     (\u4ee5\u4e0b\u7565)<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u521d\u671f\u5316\u306e\u305f\u3081\u306e\u8abf\u6574<\/h2>\n\n\n\n<p>\u30c9\u30ed\u30c3\u30d7\u30ea\u30b9\u30c8\u306b\u95a2\u3059\u308b\u6700\u5f8c\u306e\u8abf\u6574\u3092\u3057\u307e\u3059\u3002 initialize \u6642\u306b directory \u5909\u6570\u3092\u521d\u671f\u5316\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u308c\u3067\u306f\u30c9\u30ed\u30c3\u30d7\u30ea\u30b9\u30c8\u306e\u5185\u5bb9\u304c\u8a2d\u5b9a\u3055\u308c\u306a\u3044\u306e\u3067\u3001\u521d\u671f\u5316\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u3092\u5f8c\u306b\u305a\u3089\u3059\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305a\u3001\u6700\u521d\u306b\u4f5c\u6210\u3057\u305f initialize \u30e1\u30bd\u30c3\u30c9\u3092\u524a\u9664\u3057\u307e\u3059\u3002\u305d\u306e\u4e0a\u3067\u3001 initializePresenters \u306b\u4ee5\u4e0b\u306e\u5909\u66f4\u3092\u52a0\u3048\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">initializePresenters\n     listEntries := self newList\n         beSingleSelection;\n         activateOnDoubleClick.\n     buttonParent := self newButton\n         icon: (Smalltalk ui icons iconNamed: #up).\n     listCurrent := self newDropList\n         startWithoutSelection.\n<strong>     self directory: FileSystem workingDirectory.<\/strong>\n     self focusOrder\n         add: listCurrent;\n         add: buttonParent;\n         add: listEntries<\/pre>\n\n\n\n<p>directory: \u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u30d5\u30a1\u30a4\u30eb\u4e00\u89a7\u3082\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u968e\u5c64\u3082\u3042\u308f\u305b\u3066\u521d\u671f\u5316\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"http:\/\/oohito.com\/nqthm\/wp-content\/uploads\/2019\/12\/Screenshot-from-2019-12-12-21-07-10-1.png\" alt=\"\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u308c\u306fSmalltalk Advent Calendar 2019\u306e\u8a18\u4e8b\u3067\u3059\u3002 Spec2\u306f\u3001Pharo Smalltalk \u3067\u63a1\u7528\u3055\u308c\u3066\u3044\u308bUI\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3042\u308bSpec \u306e\u65b0\u3057\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u3059\u3002Pharo 7.0 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[],"class_list":["post-3179","post","type-post","status-publish","format-standard","hentry","category-pharo"],"_links":{"self":[{"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/posts\/3179","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/comments?post=3179"}],"version-history":[{"count":1,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/posts\/3179\/revisions"}],"predecessor-version":[{"id":3498,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/posts\/3179\/revisions\/3498"}],"wp:attachment":[{"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/media?parent=3179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/categories?post=3179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oohito.com\/nqthm\/wp-json\/wp\/v2\/tags?post=3179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}