VDBThreadPresenter.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 30 Sep 2014 00:32:42 +0100
changeset 31 00f6de198c7f
parent 24 c33a063cb363
child 38 9b861cb882c8
permissions -rw-r--r--
Minor fixes in the UI - redraw stack list when execution state changes.

"{ Package: 'jv:vdb' }"

VDBModelPresenter subclass:#VDBThreadPresenter
	instanceVariableNames:'thread'
	classVariableNames:''
	poolDictionaries:''
	category:'VDB-Presentation'
!

!VDBThreadPresenter methodsFor:'accessing'!

icon
    thread isRunning ifTrue:[ ^ VDBIconLibrary threadRunning16x16 ].
    thread isStopped ifTrue:[ ^ VDBIconLibrary threadStopped16x16 ].
    thread isTerminated ifTrue:[ ^ VDBIconLibrary threadTerminated16x16 ].

    ^ nil

    "Created: / 22-09-2014 / 22:00:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

label
    ^ thread displayString

    "Created: / 22-09-2014 / 00:14:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

thread
    ^ thread
! !

!VDBThreadPresenter methodsFor:'initialization'!

setThread: aGDBThread
    thread := aGDBThread

    "Created: / 21-09-2014 / 23:39:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBThreadPresenter methodsFor:'protocol-accessing'!

fetchChildren
    "should compute the list of children via the model.
     Be aware, that the somewhat stupid 'optimization' of how the model is fetched may lead to
     a O(n*log n) or even O(n^2) behavior here.
     *** to optimize: redefine by subClass"

     thread isDead ifTrue:[ ^ #() ].
     thread isRunning ifTrue:[ ^ #() ].
     ^ thread stack collect:[ :f | VDBFramePresenter new setFrame: f; parent: self ]

    "Created: / 21-09-2014 / 23:42:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 30-09-2014 / 00:04:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBThreadPresenter methodsFor:'testing'!

isThreadPresenter
    ^ true

    "Created: / 21-09-2014 / 23:54:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !