UIPainter.st
changeset 656 21fe350cfa06
parent 630 9bee5100566f
child 657 34728d455e7b
equal deleted inserted replaced
655:093cba68e10a 656:21fe350cfa06
  3266 !UIPainter::TreeView class methodsFor:'constants'!
  3266 !UIPainter::TreeView class methodsFor:'constants'!
  3267 
  3267 
  3268 defaultNameOfCanvas
  3268 defaultNameOfCanvas
  3269     "returns the default name (id) of the application
  3269     "returns the default name (id) of the application
  3270     "
  3270     "
  3271     ^ 'Canvas'
  3271     ^ 'WindowSpec'
  3272 ! !
  3272 ! !
  3273 
  3273 
  3274 !UIPainter::TreeView class methodsFor:'documentation'!
  3274 !UIPainter::TreeView class methodsFor:'documentation'!
  3275 
  3275 
  3276 documentation
  3276 documentation
  3305     "
  3305     "
  3306     |props|
  3306     |props|
  3307 
  3307 
  3308     props := UIPainterView::ViewProperty new.
  3308     props := UIPainterView::ViewProperty new.
  3309     props view:aCanvas.
  3309     props view:aCanvas.
  3310     model root:(TreeItem name:(self class defaultNameOfCanvas) contents:props).
  3310     model root:(TreeItem name: self class defaultNameOfCanvas asBoldText contents:props).
  3311     model root expand.
  3311     model root expand.
  3312     self enableChannel:(aCanvas enableChannel).
  3312     self enableChannel:(aCanvas enableChannel).
  3313 
  3313 
  3314 !
  3314 !
  3315 
  3315 
  3319     |spec|
  3319     |spec|
  3320 
  3320 
  3321     spec := WindowSpec new.
  3321     spec := WindowSpec new.
  3322 
  3322 
  3323     spec fromView:(self canvas topView) callBack:nil.
  3323     spec fromView:(self canvas topView) callBack:nil.
  3324     spec name:(listOfNodes at:1) name.
  3324     spec name:(listOfNodes at:1) name string.
  3325 
  3325 
  3326     windowSpec notNil ifTrue:[
  3326     windowSpec notNil ifTrue:[
  3327         spec copyValuesFromSpec:windowSpec
  3327         spec copyValuesFromSpec:windowSpec
  3328     ].
  3328     ].
  3329     ^ spec
  3329     ^ spec
  3400     |parent| 
  3400     |parent| 
  3401 
  3401 
  3402     parent := self detectItemRespondsToView:(aProperty view superView).
  3402     parent := self detectItemRespondsToView:(aProperty view superView).
  3403 
  3403 
  3404     parent notNil ifTrue:[
  3404     parent notNil ifTrue:[
  3405         model add:(TreeItem name:(aProperty name) contents:aProperty) below:parent
  3405         model add:(TreeItem new contents:aProperty) below:parent
  3406     ]
  3406     ]
  3407 
  3407 
  3408 !
  3408 !
  3409 
  3409 
  3410 removeAll
  3410 removeAll
  3414     windowSpec := nil.
  3414     windowSpec := nil.
  3415 
  3415 
  3416     self canvas subViews copy do:[:aView|
  3416     self canvas subViews copy do:[:aView|
  3417         (aView isKindOf:InputView) ifFalse:[aView destroy]
  3417         (aView isKindOf:InputView) ifFalse:[aView destroy]
  3418     ].
  3418     ].
  3419     model root name:(self class defaultNameOfCanvas).
  3419     model root name: self class defaultNameOfCanvas asBoldText.
  3420     model root children:(OrderedCollection new).
  3420     model root children:(OrderedCollection new).
  3421     model recomputeList.
  3421     model recomputeList.
  3422     self selection:nil.
  3422     self selection:nil.
  3423 
  3423 
  3424 
  3424 
  3578     (    aName size ~~ 0
  3578     (    aName size ~~ 0
  3579      and:[(name := aName string withoutSeparators) size ~~ 0
  3579      and:[(name := aName string withoutSeparators) size ~~ 0
  3580      and:[(self propertyDetect:[:p| p name = name]) isNil
  3580      and:[(self propertyDetect:[:p| p name = name]) isNil
  3581      and:[node name ~= name]]]
  3581      and:[node name ~= name]]]
  3582     ) ifTrue:[
  3582     ) ifTrue:[
  3583         node name: name.
  3583         node name: self class defaultNameOfCanvas asBoldText , ': [', name, ']'.
  3584         self redrawLine:1.
  3584         self redrawLine:1.
  3585     ].
  3585     ].
  3586 !
  3586 !
  3587 
  3587 
  3588 layoutChanged
  3588 layoutChanged
  3610             idx := self firstLineShown.
  3610             idx := self firstLineShown.
  3611 
  3611 
  3612             (end := self lastLineShown) > listOfNodes size ifTrue:[
  3612             (end := self lastLineShown) > listOfNodes size ifTrue:[
  3613                 end := listOfNodes size
  3613                 end := listOfNodes size
  3614             ].                          
  3614             ].                          
  3615             item name: aProperty name.
  3615             item changed.
  3616 
  3616 
  3617             [idx <= end] whileTrue:[
  3617             [idx <= end] whileTrue:[
  3618                 (listOfNodes at:idx) == item ifTrue:[
  3618                 (listOfNodes at:idx) == item ifTrue:[
  3619                     self redrawLine:idx.                "/ is visible; redraw line
  3619                     self redrawLine:idx.                "/ is visible; redraw line
  3620                     end := 0
  3620                     end := 0
  3706     super initialize.
  3706     super initialize.
  3707 
  3707 
  3708     self multipleSelectOk:true.
  3708     self multipleSelectOk:true.
  3709     cvsEventsDisabled := false.
  3709     cvsEventsDisabled := false.
  3710     self showDirectoryIndicator: true.
  3710     self showDirectoryIndicator: true.
  3711     self showDirectoryIndicatorForRoot: false
  3711     self showDirectoryIndicatorForRoot: false.
       
  3712 
       
  3713     self model iconAction: 
       
  3714     [:aNode|
       
  3715         |specClass|
       
  3716         (specClass := aNode contents spec) isNil 
       
  3717             ifTrue:  [WindowSpec icon]
       
  3718             ifFalse: [specClass class icon]
       
  3719     ].
       
  3720 
       
  3721     self model labelAction: 
       
  3722     [:aNode|
       
  3723         |spec|
       
  3724         (spec := aNode contents spec) viewClass name asBoldText, 
       
  3725         ': [', spec name, ']'
       
  3726     ]
  3712 ! !
  3727 ! !
  3713 
  3728 
  3714 !UIPainter::TreeView methodsFor:'private'!
  3729 !UIPainter::TreeView methodsFor:'private'!
  3715 
  3730 
  3716 figureFor:aNode
  3731 figureFor:aNode