diff --git a/repository/OpenPonk-Spec/OPDynamicFormExamples.class.st b/repository/OpenPonk-Spec/OPDynamicFormExamples.class.st index a2acc642..b5aad777 100644 --- a/repository/OpenPonk-Spec/OPDynamicFormExamples.class.st +++ b/repository/OpenPonk-Spec/OPDynamicFormExamples.class.st @@ -10,41 +10,51 @@ Class { } { #category : 'examples' } -OPDynamicFormExamples >> exampleAllWidgets [ +OPDynamicFormExamples class >> exampleAllWidgets [ - - | form window | + + | form window anOPDynamicFormExamples | + anOPDynamicFormExamples := self new. form := OPDynamicForm new. - (form addButton: 'Click Me') action: [ self inform: 'Yay!' ]. + (form addButton: 'Click Me') action: [ + anOPDynamicFormExamples inform: 'Yay!' ]. (form addCheckbox: 'Check Mate') state: true; - whenChangedDo: [ :newValue | - self inform: 'check mate: ' , newValue asString ]. + whenChangedDo: [ :newValue | + anOPDynamicFormExamples inform: 'check mate: ' , newValue asString ]. (form addCheckbox: 'Not Even Check') state: false; - whenChangedDo: [ :newValue | - self inform: 'check: ' , newValue asString ]. + whenChangedDo: [ :newValue | + anOPDynamicFormExamples inform: 'check: ' , newValue asString ]. (form addDroplist: 'With Icons') items: #( announcement catalog class ); display: [ :each | each asString ]; - displayIcon: [ :each :item | self iconNamed: each ]; + displayIcon: [ :each :item | + anOPDynamicFormExamples iconNamed: each ]; selectItem: #catalog; - whenSelectedDo: [ :newValue | - self inform: 'icon: ' , newValue asString ]. + whenSelectionChangedDo: [ :newValue | + anOPDynamicFormExamples inform: 'icon: ' , newValue asString ]. (form addEditableDroplist: 'Editable') items: #( abstract collection comments ); display: [ :each | each asString ]; selectItem: #collection; - whenSelectedDo: [ :newValue | - self inform: 'editable icon: ' , newValue asString ]. + whenSelectionChangedDo: [ :newValue | + anOPDynamicFormExamples inform: + 'editable icon: ' , newValue asString ]. form addSeparator. form addLabel: 'There''s a separator above me and below me'. form addSeparator. (form addText: 'Enter Some Text') text: 'poem required'. - (form addTextInput: 'Single Line With Ghost Text') placeholder: 'wooo!'. + (form addTextInput: 'Single Line With Ghost Text') placeholder: + 'wooo!'. (form addTextInput: 'Line Without Ghosts') text: 'no ghosts allowed'. - window := form openWithSpec. + window := form open. window extent: 400 @ 600. form rebuildWidget. - ^ self + ^ anOPDynamicFormExamples +] + +{ #category : 'examples' } +OPDynamicFormExamples >> exampleAllWidgets [ + ^ self class exampleAllWidgets ] diff --git a/repository/OpenPonk-Spec/OPLayouter.class.st b/repository/OpenPonk-Spec/OPLayouter.class.st index f852feab..db394e21 100644 --- a/repository/OpenPonk-Spec/OPLayouter.class.st +++ b/repository/OpenPonk-Spec/OPLayouter.class.st @@ -12,7 +12,7 @@ Class { #tag : 'Layouting' } -{ #category : 'as yet unclassified' } +{ #category : 'userinterface' } OPLayouter class >> supportedLayoutCommands [ ^ {OPDominanceTreeLayoutCommand. OPGridLayoutCommand. @@ -20,7 +20,7 @@ OPLayouter class >> supportedLayoutCommands [ OPTreeLayoutCommand} ] -{ #category : 'as yet unclassified' } +{ #category : 'userinterface' } OPLayouter class >> supports: aLayoutCommand [ ^ self supportedLayoutCommands includes: aLayoutCommand ] @@ -119,18 +119,20 @@ OPLayouter >> roassalShapesFor: aCollection [ { #category : 'layouts' } OPLayouter >> sugiyamaLayout [ - self applyLayout: [ :boxes :links | - | centerY | - RSSugiyamaLayout new - verticalGap: 100; - horizontalGap: 100; - on: boxes edges: links. - centerY := (RSGroup withAll: boxes) encompassingRectangle center y. - boxes do: [ :each | - each translateBy: 0 @ 2 * (centerY - each position y) ] ] + self applyLayout: [ :boxes :links | + | centerY | + (OPLayoutLoopDetector popupHaveLoopsBoxes: boxes links: links) + ifTrue: [ ^ self gridLayout ]. + RSSugiyamaLayout new + verticalGap: 100; + horizontalGap: 100; + on: boxes edges: links. + centerY := (RSGroup withAll: boxes) encompassingRectangle center y. + boxes do: [ :each | + each translateBy: 0 @ 2 * (centerY - each position y) ] ] ] -{ #category : 'as yet unclassified' } +{ #category : 'userinterface' } OPLayouter >> supports: aLayoutCommand [ ^ self class supports: aLayoutCommand ]