Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Iliad or Seaside ?

Iliad or Seaside ?

第20回Smalltalk勉強会資料.IliadとSeasideについて

newapplesho

May 27, 2010
Tweet

More Decks by newapplesho

Other Decks in Programming

Transcript

  1. Smalltalkษڧձ - Iliad IliadνϡʔτϦΞϧ SwazooIliad startOn: 9090. αʔόͷىಈ SwazooIliad stop.

    αʔόͷఀࢭ WorkspaceͰҎԼͷίʔυΛdo it 4 2010೥6݄3೔໦༵೔
  2. Smalltalkษڧձ - Iliad XHTMLϨϯμϦϯά index ^ [:e | ! !

    e text: 'Hello World'. ]. MyTestApplication ϝιουΧςΰϦ͸controllersʹ͢Δ͜ͱ σϑΥϧτίϯτϩʔϥͱͯ͠ݺͼग़͞ΕΔindexʹ ҎԼͷίʔυΛهड़ e ͸ILXHTMLElementͷΠϯελϯε MyTestApplication.st 9 2010೥6݄3೔໦༵೔
  3. Smalltalkษڧձ - Iliad XHTMLͷϨϯμϦϯά (1) ݟग़͠ <h1>I love Squeak</h1> index

    ^ [:e | ! ! e h1: 'I love Squeak'. ]. renderContentOn:html html heading:'I love Squeak.' level:1. ILApplication subclass WAComponent subclass 13 2010೥6݄3೔໦༵೔
  4. Smalltalkษڧձ - Iliad XHTMLͷϨϯμϦϯά (2) Ϧετ <ul><li>...</li></ul> index ^ [:e

    | | ul | ! ! ul := e ul. ! ! #('Apple' 'Banana' 'Orange') do:[:v | | li | ! ! ! li := ul li. ! ! ! li text: v ]]. DomʹΑΔXMLॲཧͱಉ͡Πϝʔδ 15 2010೥6݄3೔໦༵೔
  5. Smalltalkษڧձ - Iliad XHTMLͷϨϯμϦϯά (2) Ϧετ <ul><li>...</li></ul> renderContentOn:html ! html

    unorderedList:[ ! ! #('Apple' 'Banana' 'Orange') do:[:v | ! ! html listItem:v ]]. 16 2010೥6݄3೔໦༵೔
  6. Smalltalkษڧձ - Iliad XHTMLͷϨϯμϦϯά (3) ςʔϒϧ <table border="1"> <tr> <td>Apple</td>

    <td>Banana</td> <td>Orange</td> </tr> </table> 17 2010೥6݄3೔໦༵೔
  7. Smalltalkษڧձ - Iliad XHTMLͷϨϯμϦϯά (3) ςʔϒϧ index ! ^ [:e

    | | table row | ! ! table := e table border:1. ! ! row := table tr. ! ! #('Apple' 'Banana' 'Orange') do:[:v | | td | ! ! ! td := row td. ! ! ! td text: v ]]. ILApplication subclass 18 2010೥6݄3೔໦༵೔
  8. Smalltalkษڧձ - Iliad XHTMLͷϨϯμϦϯά (3) ςʔϒϧ renderContentOn:html ! html table

    border:1; with:[ ! ! html tableRow:[ ! ! #('Apple' 'Banana' 'Orange') do:[:v | ! ! html tableData:v ]]]. WAComponent subclass 19 2010೥6݄3೔໦༵೔
  9. Smalltalkษڧձ - Iliad XHTMLϨϯμϦϯά Raw data index ^ [:e |

    ! ! e html: '<h1>aaa</h1>'. ]. renderContentOn:html html html:'<h1>aaa</h1>'. WAComponent subclass ILApplication subclass HTMLΛͦͷ··ग़ྗ 20 2010೥6݄3೔໦༵೔
  10. Smalltalkษڧձ - Iliad CSS,JavaScriptͷಋೖ४උ MyMemoryDirectory >> path ! ^'stylesheets' MyMemoryDirectory(class)>>initialize

    ! "self initialize" ! ILFileHandler addDirectory: self new MyMemoryDirectory.st Library.ws ΞϓϦέʔγϣϯΛݺͼग़ͨ͢ΊͷύεΛࢦఆ͢Δ ILFileHandlerʹొ࿥ 24 2010೥6݄3೔໦༵೔
  11. Smalltalkษڧձ - Iliad ϥΠϒϥϦͷબ୒ styles ! ^#('/stylesheets/main.css') updatePage: aPage !

    super updatePage: aPage. ! aPage head stylesheet href: '/stylesheet/main.css' ILApplication subclass ILWidget subclass 26 2010೥6݄3೔໦༵೔
  12. Smalltalkษڧձ - Iliad JavaScript HTMLϨϯμϦϯάʹϝοηʔδΛૹΔ͚ͩͰੜ੒͞ΕΔ JavaScript contents ! ^[:e |

    ! ! e p onClick:(...); text:'1+1?'.]. ILWidget subclass 28 2010೥6݄3೔໦༵೔
  13. Smalltalkษڧձ - Iliad JavaScript,CSSͷಋೖํ๏ >>updateRoot:anHtmlRoot super updateRoot: anHtmlRoot. anHtmlRoot stylesheet

    url: MyFileLibrary / #mainCss. >>(class) initialize ! |app| ! app := (WAAdmin register: self asApplicationAt: '...') ! ! addLibrary: MyFileLibrary. WAComponent subclass WAComponent subclass ϥΠϒϥϦͷબ୒ 30 2010೥6݄3೔໦༵೔
  14. Smalltalkษڧձ - Iliad ϑϩʔ੍ޚ MyTask>>go ! | user | !

    loginAnswer:= self call:(MyLoginComponent new). ! loginAnswer = #registerUser ! ! ifTrue:[ user := self call: (MyUserRegisterComponent new) ] ifFalse:[ user := loginAnswer ]. ! user ifNotNil:[ ! ! self session login: user.]. self call:(MyMainComponent new). WATask subclass:#MyTask 34 2010೥6݄3೔໦༵೔
  15. Smalltalkษڧձ - Iliad ϑϩʔ੍ޚ MyIliad-Login.st ControllerͰ͋ΔILApplicationͰϑϩʔΛ؅ཧ ҰൠతͳWeb Frameworkͱಉ༷ͳߟ͑ํ Ruby on

    Rails, Zend Framework MyIliad-Login.stΛfile inͯ֬͠ೝ͍ͯͩ͘͠͞ 36 2010೥6݄3೔໦༵೔
  16. Smalltalkษڧձ - Iliad ϑϩʔ੍ޚ(Iliad - 1) ILApplication subclass: #MyFlowApplication !

    instanceVariableNames: 'flow' ! classVariableNames: '' ! poolDictionaries: '' ! category: 'MyIliad-Login' MyIliad-Login.st index ! ^ [:e | ! ! e build: self flow.] login ! flow := MyLoginWidget new main ! flow := MyMainWidget new. register ! flow := MyUserRegisterWidget new. flow ! ^ flow ifNil:[ flow := MyLoginWidget new ] flow: anObject ! flow := anObject ίϯτϩʔϥ͕ࢠཁૉʢWidgetʣΛஔ͖׵͑Δ 37 2010೥6݄3೔໦༵೔
  17. Smalltalkษڧձ - Iliad ϑϩʔ੍ޚ(Iliad - 2) ILWidget subclass: #MyLoginWidget !

    instanceVariableNames: 'user' ! classVariableNames: '' ! poolDictionaries: '' ! category: 'MyIliad-Login' login ! ((user user = 'admin') and:[ user password = 'admin']) ! ! ifTrue:[ self application main. ] ! ! ifFalse:[ ! ! ! self application register. ]. MyIliad-Login.st ίϯτϩʔϥʹ೚ͤΔ contents ^[:e | e form build: [:form | form text:'User ID'. form input action:[:v | user user: v. ]. form text:'Password'. form password action:[:v | user password: v. ]. form button text: 'create'; action: [ self login ]]] 38 2010೥6݄3೔໦༵೔
  18. Smalltalkษڧձ - Iliad ϑϩʔ੍ޚ(Iliad - 3) ILWidget subclass: #MyUserRegisterWidget !

    instanceVariableNames: 'user' ! classVariableNames: '' ! poolDictionaries: '' ! category: 'MyIliad-Login' addUser ! "͜͜ʹϢʔβ௥Ճॲཧ" ! self application main. MyIliad-Login.st contents ^[:e | e form build: [:form | form text:'User ID'. form input action:[:v | user user: v. ]. form text:'Password'. form password action:[:v | user password: v. ]. form button text: 'create'; action: [ self addUser ]]] ίϯτϩʔϥʹ೚ͤΔ 39 2010೥6݄3೔໦༵೔
  19. Smalltalkษڧձ - Iliad Session >>(class) initialize app := MyTask registerAsApplication:

    'myTask'. app preferenceAt: #sessionClass put: MySession. WASessionͷαϒΫϥεΛ࡞੒ WAComponent subclass 43 2010೥6݄3೔໦༵೔
  20. Smalltalkษڧձ - Iliad Response (2) respondOn: aResponse aResponse contentType:'text/xml'; contents:

    self svg. ILApplication subclass MySVGApplication.st self svg ͸SVGͷςΩετΛฦ͢ϝιου respondOn:ΛΦʔόϥΠυ͢Δ 45 2010೥6݄3೔໦༵೔
  21. Smalltalkษڧձ - Iliad Response (3) 2.8ܥ renderContentOn:html self session returnResponse:

    (WAResponse new !! contentType: 'text/xml'; ! ! nextPutAll: self makeSVG; ! ! yourself) WAComponent subclass 46 2010೥6݄3೔໦༵೔
  22. Smalltalkษڧձ - Iliad Response (4) renderContentOn: html ! self requestContext

    respond: [:response | ! ! response ! ! initializeOn: self svg ; contentType: 'text/xml'] 3.0ܥ WAComponent subclass 47 2010೥6݄3೔໦༵೔
  23. Smalltalkษڧձ - Iliad ೔ຊޠ΁ͷରԠํ๏ കᖒ͞ΜΑΓ೔ຊޠԽύονఏڙ ʢPharoͰ΋ར༻Մೳʣ GRUtf8SqCodec.st ILSite default codec:

    (GRUtf8SqCodec new). GRUtf8SqCodec.st Λfile in͢Δ WorkspaceͰҎԼͷίʔυΛdo it 51 2010೥6݄3೔໦༵೔
  24. Smalltalkษڧձ - Iliad ରԠSmalltalk Squeak Pharo VisualWorks GNU Smalltalk GemStone

    Dolphin Smalltalk VASmalltalk Squeak Pharo GNU Smalltalk VisualWorksʢରԠ༧ఆʣ 52 2010೥6݄3೔໦༵೔
  25. Smalltalkษڧձ - Iliad ࢀߟ৘ใ • Iliad http://www.iliadproject.org/index • Seaside http://www.seaside.st/

    • GNU Smalltalk http://smalltalk.gnu.org/ Iliad ϝʔϦϯάϦετ http://groups.google.fr/group/iliad 54 2010೥6݄3೔໦༵೔