Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 26 additions & 16 deletions repository/OpenPonk-Spec/OPDynamicFormExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,51 @@ Class {
}

{ #category : 'examples' }
OPDynamicFormExamples >> exampleAllWidgets [
OPDynamicFormExamples class >> exampleAllWidgets [

<gtExample>
| form window |
<gtexample>
| 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
]
26 changes: 14 additions & 12 deletions repository/OpenPonk-Spec/OPLayouter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ Class {
#tag : 'Layouting'
}

{ #category : 'as yet unclassified' }
{ #category : 'userinterface' }
OPLayouter class >> supportedLayoutCommands [
^ {OPDominanceTreeLayoutCommand.
OPGridLayoutCommand.
OPSugiyamaLayoutCommand.
OPTreeLayoutCommand}
]

{ #category : 'as yet unclassified' }
{ #category : 'userinterface' }
OPLayouter class >> supports: aLayoutCommand [
^ self supportedLayoutCommands includes: aLayoutCommand
]
Expand Down Expand Up @@ -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
]
Expand Down