lazy Yury browser := GLMTabulator new row: [ :row | row column: #protocols; column: #methods ]; row: #code; yourself. browser transmit to: #protocols; andShow: [ :a| a list allowDropOnItem: [:draggedObject :targetItem :list | true ]; dropOnItem: [:draggedObject :targetItem :list | browser entity organization classify: draggedObject under: targetItem name. list update. true ]; display: [ :class | class organization protocols ]; format: #name ]. browser transmit from: #protocols; to: #methods; andShow: [ :a| a list allowItemDrag: [:item :list | true ]; display: [ :protocol | protocol methods ] ]. browser transmit from: #methods; to: #code; andShow: [ :a | a smalltalkCode smalltalkClass: [ browser entity ]; display: [ :method | (browser entity>>method) sourceCode ] ]. browser openOn: Morph
On 05 Oct 2014, at 10:08, Yuriy Tymchuk <yuriy.tymchuk@me.com> wrote:
Yes, but as Iâve mentioned earlier, Iâm interested in drag-n-drop recategorization. I donât know if itâs doable with glamour.
Uko
On 04 Oct 2014, at 15:58, Esteban Lorenzano <estebanlm@gmail.com <mailto:estebanlm@gmail.com>> wrote:
and this is same with glamour:
browser := GLMTabulator new row: [ :row | row column: #protocols; column: #methods ]; row: #code; yourself.
browser transmit to: #protocols; andShow: [ :a| a list display: [ :class | class organization protocols ]; format: #name ]. browser transmit from: #protocols; to: #methods; andShow: [ :a| a list display: [ :protocol | protocol methods ] ]. browser transmit from: #methods; to: #code; andShow: [ :a | a smalltalkCode smalltalkClass: [ browser entity ]; display: [ :method | (browser entity>>method) sourceCode ] ].
browser openOn: Morph.
Of course spec is capable of doing that. But glamour is designed with transitions and scripting in mind (thinking specially on browsers), while spec is designed for components and composition.
Esteban
On 04 Oct 2014, at 15:35, Nicolai Hess <nicolaihess@web.de <mailto:nicolaihess@web.de>> wrote:
2014-10-03 13:26 GMT+02:00 Esteban Lorenzano <estebanlm@gmail.com <mailto:estebanlm@gmail.com>>:
On 03 Oct 2014, at 13:14, Nicolai Hess <nicolaihess@web.de <mailto:nicolaihess@web.de>> wrote:
Am 03.10.2014 12:34 schrieb "Yuriy Tymchuk" <yuriy.tymchuk@me.com <mailto:yuriy.tymchuk@me.com>>:
Hi.
I want to make something like a browser on a single class. I.e. just use 2 last lists out if 4 in standard browser.
Is there already something like that? If not, should I use existing widgets, or implement my own using spec?
Cheers! Uko
Sent from my iPhone
I think that is pretty easy with some spec models. Maybe there is already an example
yes, but a few models means a few classes :) in a single class, it will e a lot easier glamour (which btw, is specially designed for that: to make browsers).
You can work with ready made models like ListModel/TextModel and just need one class for sticking them together. Here some code, evaluateable from workspace, that shows how we can build a "simple browser" with spec models: This is just the simple skeleton, for more details it would be a bit confusing doing all this in one workspace "script" :)
class:=Morph. method:=class>>#openInWorld.
composed:= DynamicComposableModel new. composed instantiateModels: #(code TextModel protocols ListModel methods ListModel). composed code text:method sourceCode. composed protocols items: class protocols. composed methods items: class selectors. composed code aboutToStyle:true. composed code behavior:class. composed title: class asString. composed code acceptBlock:[:text | class compile:text notifying:nil. ]. composed protocols whenSelectedItemChanged:[:item | composed methods items:( class selectorsInProtocol: item) ]. composed methods whenSelectedItemChanged:[:item | item ifNotNil:[ method:=class methodDict at:item. composed code text:method sourceCode] ]. composed openWithSpecLayout:( SpecLayout composed newColumn:[:c | c newRow:[:r | r add: #protocols; add: #methods ]; add: #code]; yourself).
Esteban
Hilaire asked for a simple Method editor and i wrote a simple example build with DynamicComposableModel, search the Mailingliste.