VDBFrameApplication.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 02 Jun 2017 07:42:04 +0100
changeset 42 a6f5f470a947
parent 37 f417fe8685c5
child 44 41cc5a7840fe
permissions -rw-r--r--
Display variable values in frame view

"{ Package: 'jv:vdb' }"

"{ NameSpace: Smalltalk }"

VDBAbstractTreeApplication subclass:#VDBFrameApplication
	instanceVariableNames:'frameHolder selectedVariableHolder'
	classVariableNames:''
	poolDictionaries:''
	category:'VDB-UI-Others'
!

!VDBFrameApplication class methodsFor:'interface specs'!

columnsSpec
    "This resource specification was automatically generated
     by the DataSetBuilder of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the DataSetBuilder may not be able to read the specification."

    "
     DataSetBuilder new openOnClass:VDBFrameApplication andSelector:#columnsSpec
    "

    <resource: #tableColumns>

    ^#(
       (DataSetColumnSpec
         label: 'Value'
         labelAlignment: left
         labelButtonType: Button
         height: heightOfFirstRow
         menuFromApplication: false
         printSelector: value
         showRowSeparator: false
         showColSeparator: false
       )
      )

    "Created: / 02-06-2017 / 07:25:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBFrameApplication class methodsFor:'plugIn spec'!

aspectSelectors
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this. If it is corrupted,
     the UIPainter may not be able to read the specification."

    "Return a description of exported aspects;
     these can be connected to aspects of an embedding application
     (if this app is embedded in a subCanvas)."

    ^ #(
        #debuggerHolder
        #frameHolder
        #selectedVariableHolder
      ).

    "Modified: / 27-02-2015 / 16:04:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBFrameApplication class methodsFor:'startup-web applications'!

initialPageSpec
    "this is only required for web-applications"

    ^ self shouldImplement
!

pageSpecs
    "this is only required for web-applications"

    ^ self shouldImplement
! !

!VDBFrameApplication methodsFor:'aspects'!

frameHolder
    "return/create the 'frameHolder' value holder (automatically generated)"

    frameHolder isNil ifTrue:[
        frameHolder := ValueHolder new.
        frameHolder addDependent:self.
    ].
    ^ frameHolder
!

frameHolder:something
    "set the 'frameHolder' value holder (automatically generated)"

    |oldValue newValue|

    frameHolder notNil ifTrue:[
        oldValue := frameHolder value.
        frameHolder removeDependent:self.
    ].
    frameHolder := something.
    frameHolder notNil ifTrue:[
        frameHolder addDependent:self.
    ].
    newValue := frameHolder value.
    oldValue ~~ newValue ifTrue:[
        self update:#value with:newValue from:frameHolder.
    ].
!

selectedVariableHolder
    "return/create the 'selectedVariableHolder' value holder (automatically generated)"

    selectedVariableHolder isNil ifTrue:[
        selectedVariableHolder := ValueHolder new.
        selectedVariableHolder addDependent:self.
    ].
    ^ selectedVariableHolder
!

selectedVariableHolder:something
    "set the 'selectedVariableHolder' value holder (automatically generated)"

    |oldValue newValue|

    selectedVariableHolder notNil ifTrue:[
        oldValue := selectedVariableHolder value.
        selectedVariableHolder removeDependent:self.
    ].
    selectedVariableHolder := something.
    selectedVariableHolder notNil ifTrue:[
        selectedVariableHolder addDependent:self.
    ].
    newValue := selectedVariableHolder value.
    oldValue ~~ newValue ifTrue:[
        self update:#value with:newValue from:selectedVariableHolder.
    ].
! !

!VDBFrameApplication methodsFor:'change & update'!

update:aspect with:param from:sender
    "Invoked when an object that I depend upon sends a change notification."

    sender == frameHolder ifTrue:[
         self enqueueDelayedUpdateInternalList.
         ^ self.
    ].
    super update:aspect with:param from:sender

    "Modified: / 27-02-2015 / 15:45:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBFrameApplication methodsFor:'change & update-delayed'!

delayedUpdateInternalList
    | frame root |

     debugger isNil ifTrue:[
        self internalListHolder root children:#().
        ^ self.
    ].   
    frame := frameHolder value.
    frame isNil ifTrue:[ 
        self internalListHolder root children:#().
        ^ self.
    ].
    root := self internalListHolder root.
    root children:
        (frame variables collect:[:v | VDBVariablePresenter new setVariable: v; parent: root; yourself]).
    root expand.
    internalListView notNil ifTrue:[
        internalListView invalidate.
    ]

    "Created: / 27-02-2015 / 15:47:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

delayedUpdateSelection
    | internalSelection |

    internalSelection := self internalSelectionHolder value.
    internalSelection notNil ifTrue:[
        self selectedVariableHolder value: internalSelection variable
    ] ifFalse:[ 
        self selectedVariableHolder value: nil
    ].

    "Modified: / 27-02-2015 / 16:05:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBFrameApplication methodsFor:'drag & drop'!

dropObjects:aCollectionOfDropObjects
    "drop manager wants to drop.
     This is ony sent, if #canDrop: returned true.
     Must be redefined in order for drop to work."

    ^ self shouldImplement
! !