可弃

Seaside 组件(WAComponent 的子类)需要覆盖 #renderContentOn:。它是一个 smalltalk 类,可以使用构建应用程序的所有常规方法。在这里,它委托三种不同的方法。

JQDroppableFunctionalTest>>renderContentOn: html
   self renderInstructionsOn: html.
   self renderInventoryOn: html.
   self renderSelectedOn: html

作为参数,它获取一个 html 画布对象,该对象理解与构建 html 和 javascript 相关的消息。它使用流畅的界面,其中 #with:是发送到当前画布上下文的最后一条消息。

JQDroppableFunctionalTest>>renderInventoryOn: html
   html div class: 'inventory ui-corner-all'; with: [ 
      self colors do: [ :each |
         html div
            class: each;
            passenger: each;
            script: (html jQuery new draggable
               revert: true) ] ]

JQDroppableFunctionalTest>>renderSelectedOn: html
   html div
      class: 'selected ui-corner-all'; 
      script: (html jQuery new droppable
         onDrop: (html jQuery this load
            callbackDroppable: [ :event | 
                self selected add: (event at: #draggable) ];
            html: [ :r | self renderSelectedItemsOn: r ]));
      with: [ self renderSelectedItemsOn: html ]

JQDroppableFunctionalTest>>renderSelectedItemsOn: html
   self selected do: [ :each |
      html div 
         class: each; 
         passenger: each;
         script: (html jQuery new draggable
            onStop: (html jQuery this effect 
               percent: 1; puff; 
               onComplete: (html jQuery this parent load html: [ :r | 
                  self selected remove: each ifAbsent: [ ].
                  self renderSelectedItemsOn: r ]))) ]