2006/08/08 17:41:25
ChemoJun050 (2006/08/08) Copyright 2002-2006 National Institute of Informatics, Research Organization of Information and Systems.
category:
-
ChemoJun-Goodies-UI
inheritance:
instance variables:
class instance variables:
class variables:
pool variables:
instance methods:
-
chooseMultiple: messageString fromList: list values: listValues initialSelections: initialSelections buttons: buttons values: buttonValues lines: maxLines cancel: cancelBlock for: aVisualOrNil [utility]
"ChemoJunDialog new
chooseMultiple: 'Which ones do you want?'
fromList: #('first' 'second' 'third' 'fourth') values: #(10 20 30 40)
initialSelections: #('first' 'third')
buttons: #() values: #()
lines: 8
cancel: [#noChoice]
for: Dialog defaultParentWindow"
| result spec okValue sequence wrappers listW |
wrappers := OrderedCollection new.
result := ValueHolder new.
sequence := MultiSelectionInList new.
sequence list: list.
sequence selections: initialSelections.
list size = 1 ifTrue: [sequence selections: (Set with: 1)].
spec := self class interfaceSpecFor: #emptySpec.
okValue := Object new.
self initializeBuilderFor: aVisualOrNil.
builder add: spec window.
builder add: spec component.
self initializeWindowFor: aVisualOrNil.
self setInitialGap.
self addMessage: messageString centered: true.
self addGap: 8.
listW := self
addMultiList: sequence
lines: (maxLines min: list size + 2)
validation: [true].
self addGap: 4.
wrappers add: (self addOK: [sequence selectionIndex ~= 0]).
buttons isEmpty
ifFalse:
[self addGap: 4.
wrappers add: self addDivider.
self addGap: 4.
wrappers add: (self
addLabels: buttons
values: buttonValues
default: okValue
storeInto: result
takeKeyboard: true
equalize: true)].
self addGap: 6.
self bottomAlignLowerEdge: listW.
self bottomAlign: wrappers.
self preOpen.
builder openDialogWithExtent: builder window displayBox extent.
aVisualOrNil notNil
ifTrue:
[aVisualOrNil
invalidateRectangle: aVisualOrNil bounds
repairNow: true
forComponent: nil]
ifFalse:
[| parent |
(parent := Dialog defaultParentWindow) notNil
ifTrue:
[parent
invalidateRectangle: parent bounds
repairNow: true
forComponent: nil]].
^accept value
ifTrue:
[sequence selectionIndexes asSortedCollection asArray
collect: [:i | listValues at: i]]
ifFalse: [cancel value ifTrue: [cancelBlock value] ifFalse: [result value]]
-
chooseMultiple: messageString fromList: list values: listValues lines: maxLines cancel: cancelBlock [utility]
"ChemoJunDialog new
chooseMultiple: 'Which ones do you want?'
fromList: #('first' 'second' 'third' 'fourth') values: #(10 20 30 40)
lines: 8
cancel: [#noChoice]."
^self
chooseMultiple: messageString
fromList: list
values: listValues
buttons: Array new
values: Array new
lines: maxLines
cancel: cancelBlock
for: Dialog defaultParentWindow
class methods:
-
copyright [copyright]
^'ChemoJun050 (2006/08/08) Copyright 2002-2006 National Institute of Informatics, Research Organization of Information and Systems.'
-
emptySpec [interface specs]
"Tools.UIPainter new openOnClass: self andSelector: #emptySpec"
<resource: #canvas>
^#(#{UI.FullSpec}
#window:
#(#{UI.WindowSpec}
#label: ' '
#min: #(#{Core.Point} 20 20 )
#max: #(#{Core.Point} 1280 1024 )
#bounds: #(#{Graphics.Rectangle} 512 384 812 423 )
#isEventDriven: true )
#component:
#(#{UI.SpecCollection}
#collection: #() ) )
-
system [copyright]
^'ChemoJun'
-
version [copyright]
^'050'