VDBVariableObjectListApplication.st
changeset 59 e7d0453109a1
parent 58 df46b9c82b38
child 60 bcdb393c956f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/VDBVariableObjectListApplication.st	Sat Feb 03 21:18:50 2018 +0000
@@ -0,0 +1,294 @@
+"
+jv:vdb - Visual / VM Debugger
+Copyright (C) 2015-now Jan Vrany
+
+This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
+
+You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
+"
+"{ Package: 'jv:vdb' }"
+
+"{ NameSpace: Smalltalk }"
+
+VDBAbstractTreeApplication subclass:#VDBVariableObjectListApplication
+	instanceVariableNames:'frameHolder variableObjectListHolder selectedVariableObjectHolder'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'VDB-UI-Others'
+!
+
+!VDBVariableObjectListApplication class methodsFor:'documentation'!
+
+copyright
+"
+jv:vdb - Visual / VM Debugger
+Copyright (C) 2015-now Jan Vrany
+
+This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
+
+You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
+"
+! !
+
+!VDBVariableObjectListApplication class methodsFor:'accessing'!
+
+windowTitle
+    ^ 'Variables'
+
+    "Created: / 11-07-2017 / 16:37:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBVariableObjectListApplication 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
+         width: 1.0
+         height: heightOfFirstRow
+         menuFromApplication: false
+         printSelector: value
+         backgroundSelector: backgroundColor
+         showRowSeparator: false
+         showColSeparator: false
+       )
+      )
+    
+! !
+
+!VDBVariableObjectListApplication 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
+        #variableObjectListHolder
+        #selectedVariableHolder
+      ).
+
+    "Modified: / 03-02-2018 / 09:52:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBVariableObjectListApplication 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
+! !
+
+!VDBVariableObjectListApplication methodsFor:'accessing'!
+
+variableObjectList: aSequencableCollection
+    self variableObjectListHolder value: aSequencableCollection
+
+    "Created: / 03-02-2018 / 08:07:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBVariableObjectListApplication methodsFor:'actions'!
+
+doDoubleClick
+    "Invoked when user double-clicks to list item."
+
+    | selectedVarObjPresenter |
+    
+    selectedVarObjPresenter := self internalSelectionHolder value. 
+    selectedVarObjPresenter notNil ifTrue:[
+        selectedVarObjPresenter varobj inspect
+    ].
+
+    "Created: / 13-06-2017 / 17:09:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 16-01-2018 / 23:33:12 / jv"
+    "Modified: / 03-02-2018 / 08:03:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBVariableObjectListApplication methodsFor:'aspects'!
+
+backgroundColorFor: aVDBVariableOjectPresenter
+    ^ aVDBVariableOjectPresenter varobj hasChanged
+        ifTrue:[ Color yellow lighter lighter ]
+        ifFalse:[ nil ]
+
+    "Created: / 01-02-2018 / 09:08:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+selectedVariableObjectHolder
+    "return/create the 'selectedVariableHolder' value holder (automatically generated)"
+    
+    selectedVariableObjectHolder isNil ifTrue:[
+        selectedVariableObjectHolder := ValueHolder new.
+        selectedVariableObjectHolder addDependent:self.
+    ].
+    ^ selectedVariableObjectHolder
+!
+
+selectedVariableObjectHolder:something 
+    "set the 'selectedVariableHolder' value holder (automatically generated)"
+    
+    | oldValue  newValue |
+
+    selectedVariableObjectHolder notNil ifTrue:[
+        oldValue := selectedVariableObjectHolder value.
+        selectedVariableObjectHolder removeDependent:self.
+    ].
+    selectedVariableObjectHolder := something.
+    selectedVariableObjectHolder notNil ifTrue:[
+        selectedVariableObjectHolder addDependent:self.
+    ].
+    newValue := selectedVariableObjectHolder value.
+    oldValue ~~ newValue ifTrue:[
+        self 
+            update:#value
+            with:newValue
+            from:selectedVariableObjectHolder.
+    ].
+!
+
+variableObjectListHolder
+    "return/create the 'variableObjectListHolder' value holder (automatically generated)"
+
+    variableObjectListHolder isNil ifTrue:[
+        variableObjectListHolder := ValueHolder with: #().
+        variableObjectListHolder addDependent:self.
+    ].
+    ^ variableObjectListHolder
+
+    "Modified: / 03-02-2018 / 07:33:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+variableObjectListHolder:something
+    "set the 'variableObjectListHolder' value holder (automatically generated)"
+
+    |oldValue newValue|
+
+    variableObjectListHolder notNil ifTrue:[
+        oldValue := variableObjectListHolder value.
+        variableObjectListHolder removeDependent:self.
+    ].
+    variableObjectListHolder := something.
+    variableObjectListHolder notNil ifTrue:[
+        variableObjectListHolder addDependent:self.
+    ].
+    newValue := variableObjectListHolder value.
+    oldValue ~~ newValue ifTrue:[
+        self update:#value with:newValue from:variableObjectListHolder.
+    ].
+! !
+
+!VDBVariableObjectListApplication methodsFor:'change & update'!
+
+update:aspect with:param from:sender
+    "Invoked when an object that I depend upon sends a change notification."
+
+    sender == variableObjectListHolder ifTrue:[ 
+         self enqueueDelayedUpdateInternalList.
+         ^ self.
+    ].
+    super update:aspect with:param from:sender
+
+    "Modified: / 03-02-2018 / 09:47:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBVariableObjectListApplication methodsFor:'change & update-delayed'!
+
+delayedUpdateInternalList
+    | root |
+
+    debugger isNil ifTrue:[
+        self internalListHolder root children:#().
+        ^ self.
+    ].
+    root := self internalListHolder root.
+    root children:(self variableObjectListHolder value
+                collect:[:v | 
+                    (VDBVariableObjectPresenter new) setVarobj: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>"
+    "Modified: / 03-02-2018 / 07:31:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+delayedUpdateSelection
+    | internalSelection |
+
+    internalSelection := self internalSelectionHolder value.
+    internalSelection notNil ifTrue:[
+        self selectedVariableObjectHolder value: internalSelection varobj
+    ] ifFalse:[ 
+        self selectedVariableObjectHolder value: nil
+    ].
+
+    "Modified: / 28-01-2018 / 22:50:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBVariableObjectListApplication 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
+! !
+
+!VDBVariableObjectListApplication methodsFor:'event handling'!
+
+onStoppedEvent: aGDBStoppedEvent
+    self enqueueDelayedInvalidateInternalList
+
+    "Created: / 01-02-2018 / 23:14:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBVariableObjectListApplication methodsFor:'initialization & release'!
+
+subscribe   
+    "Register for debugger events. To be overrided by subclasses"
+
+    debugger announcer
+        when: GDBStoppedEvent               send: #onStoppedEvent: to: self
+
+    "Created: / 01-02-2018 / 23:07:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBVariableObjectListApplication class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+