VDBVariableObjectListApplication.st
changeset 59 e7d0453109a1
parent 58 df46b9c82b38
child 60 bcdb393c956f
equal deleted inserted replaced
58:df46b9c82b38 59:e7d0453109a1
       
     1 "
       
     2 jv:vdb - Visual / VM Debugger
       
     3 Copyright (C) 2015-now Jan Vrany
       
     4 
       
     5 This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
       
     6 
       
     7 You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
       
     8 "
       
     9 "{ Package: 'jv:vdb' }"
       
    10 
       
    11 "{ NameSpace: Smalltalk }"
       
    12 
       
    13 VDBAbstractTreeApplication subclass:#VDBVariableObjectListApplication
       
    14 	instanceVariableNames:'frameHolder variableObjectListHolder selectedVariableObjectHolder'
       
    15 	classVariableNames:''
       
    16 	poolDictionaries:''
       
    17 	category:'VDB-UI-Others'
       
    18 !
       
    19 
       
    20 !VDBVariableObjectListApplication class methodsFor:'documentation'!
       
    21 
       
    22 copyright
       
    23 "
       
    24 jv:vdb - Visual / VM Debugger
       
    25 Copyright (C) 2015-now Jan Vrany
       
    26 
       
    27 This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'
       
    28 
       
    29 You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
       
    30 "
       
    31 ! !
       
    32 
       
    33 !VDBVariableObjectListApplication class methodsFor:'accessing'!
       
    34 
       
    35 windowTitle
       
    36     ^ 'Variables'
       
    37 
       
    38     "Created: / 11-07-2017 / 16:37:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    39 ! !
       
    40 
       
    41 !VDBVariableObjectListApplication class methodsFor:'interface specs'!
       
    42 
       
    43 columnsSpec
       
    44     "This resource specification was automatically generated
       
    45      by the DataSetBuilder of ST/X."
       
    46 
       
    47     "Do not manually edit this!! If it is corrupted,
       
    48      the DataSetBuilder may not be able to read the specification."
       
    49 
       
    50     "
       
    51      DataSetBuilder new openOnClass:VDBFrameApplication andSelector:#columnsSpec
       
    52     "
       
    53 
       
    54     <resource: #tableColumns>
       
    55 
       
    56     ^#(
       
    57       (DataSetColumnSpec
       
    58          label: 'Value'
       
    59          labelAlignment: left
       
    60          labelButtonType: Button
       
    61          width: 1.0
       
    62          height: heightOfFirstRow
       
    63          menuFromApplication: false
       
    64          printSelector: value
       
    65          backgroundSelector: backgroundColor
       
    66          showRowSeparator: false
       
    67          showColSeparator: false
       
    68        )
       
    69       )
       
    70     
       
    71 ! !
       
    72 
       
    73 !VDBVariableObjectListApplication class methodsFor:'plugIn spec'!
       
    74 
       
    75 aspectSelectors
       
    76     "This resource specification was automatically generated
       
    77      by the UIPainter of ST/X."
       
    78 
       
    79     "Do not manually edit this. If it is corrupted,
       
    80      the UIPainter may not be able to read the specification."
       
    81 
       
    82     "Return a description of exported aspects;
       
    83      these can be connected to aspects of an embedding application
       
    84      (if this app is embedded in a subCanvas)."
       
    85 
       
    86     ^ #(
       
    87         #debuggerHolder
       
    88         #variableObjectListHolder
       
    89         #selectedVariableHolder
       
    90       ).
       
    91 
       
    92     "Modified: / 03-02-2018 / 09:52:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    93 ! !
       
    94 
       
    95 !VDBVariableObjectListApplication class methodsFor:'startup-web applications'!
       
    96 
       
    97 initialPageSpec
       
    98     "this is only required for web-applications"
       
    99 
       
   100     ^ self shouldImplement
       
   101 !
       
   102 
       
   103 pageSpecs
       
   104     "this is only required for web-applications"
       
   105 
       
   106     ^ self shouldImplement
       
   107 ! !
       
   108 
       
   109 !VDBVariableObjectListApplication methodsFor:'accessing'!
       
   110 
       
   111 variableObjectList: aSequencableCollection
       
   112     self variableObjectListHolder value: aSequencableCollection
       
   113 
       
   114     "Created: / 03-02-2018 / 08:07:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   115 ! !
       
   116 
       
   117 !VDBVariableObjectListApplication methodsFor:'actions'!
       
   118 
       
   119 doDoubleClick
       
   120     "Invoked when user double-clicks to list item."
       
   121 
       
   122     | selectedVarObjPresenter |
       
   123     
       
   124     selectedVarObjPresenter := self internalSelectionHolder value. 
       
   125     selectedVarObjPresenter notNil ifTrue:[
       
   126         selectedVarObjPresenter varobj inspect
       
   127     ].
       
   128 
       
   129     "Created: / 13-06-2017 / 17:09:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   130     "Modified: / 16-01-2018 / 23:33:12 / jv"
       
   131     "Modified: / 03-02-2018 / 08:03:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   132 ! !
       
   133 
       
   134 !VDBVariableObjectListApplication methodsFor:'aspects'!
       
   135 
       
   136 backgroundColorFor: aVDBVariableOjectPresenter
       
   137     ^ aVDBVariableOjectPresenter varobj hasChanged
       
   138         ifTrue:[ Color yellow lighter lighter ]
       
   139         ifFalse:[ nil ]
       
   140 
       
   141     "Created: / 01-02-2018 / 09:08:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   142 !
       
   143 
       
   144 selectedVariableObjectHolder
       
   145     "return/create the 'selectedVariableHolder' value holder (automatically generated)"
       
   146     
       
   147     selectedVariableObjectHolder isNil ifTrue:[
       
   148         selectedVariableObjectHolder := ValueHolder new.
       
   149         selectedVariableObjectHolder addDependent:self.
       
   150     ].
       
   151     ^ selectedVariableObjectHolder
       
   152 !
       
   153 
       
   154 selectedVariableObjectHolder:something 
       
   155     "set the 'selectedVariableHolder' value holder (automatically generated)"
       
   156     
       
   157     | oldValue  newValue |
       
   158 
       
   159     selectedVariableObjectHolder notNil ifTrue:[
       
   160         oldValue := selectedVariableObjectHolder value.
       
   161         selectedVariableObjectHolder removeDependent:self.
       
   162     ].
       
   163     selectedVariableObjectHolder := something.
       
   164     selectedVariableObjectHolder notNil ifTrue:[
       
   165         selectedVariableObjectHolder addDependent:self.
       
   166     ].
       
   167     newValue := selectedVariableObjectHolder value.
       
   168     oldValue ~~ newValue ifTrue:[
       
   169         self 
       
   170             update:#value
       
   171             with:newValue
       
   172             from:selectedVariableObjectHolder.
       
   173     ].
       
   174 !
       
   175 
       
   176 variableObjectListHolder
       
   177     "return/create the 'variableObjectListHolder' value holder (automatically generated)"
       
   178 
       
   179     variableObjectListHolder isNil ifTrue:[
       
   180         variableObjectListHolder := ValueHolder with: #().
       
   181         variableObjectListHolder addDependent:self.
       
   182     ].
       
   183     ^ variableObjectListHolder
       
   184 
       
   185     "Modified: / 03-02-2018 / 07:33:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   186 !
       
   187 
       
   188 variableObjectListHolder:something
       
   189     "set the 'variableObjectListHolder' value holder (automatically generated)"
       
   190 
       
   191     |oldValue newValue|
       
   192 
       
   193     variableObjectListHolder notNil ifTrue:[
       
   194         oldValue := variableObjectListHolder value.
       
   195         variableObjectListHolder removeDependent:self.
       
   196     ].
       
   197     variableObjectListHolder := something.
       
   198     variableObjectListHolder notNil ifTrue:[
       
   199         variableObjectListHolder addDependent:self.
       
   200     ].
       
   201     newValue := variableObjectListHolder value.
       
   202     oldValue ~~ newValue ifTrue:[
       
   203         self update:#value with:newValue from:variableObjectListHolder.
       
   204     ].
       
   205 ! !
       
   206 
       
   207 !VDBVariableObjectListApplication methodsFor:'change & update'!
       
   208 
       
   209 update:aspect with:param from:sender
       
   210     "Invoked when an object that I depend upon sends a change notification."
       
   211 
       
   212     sender == variableObjectListHolder ifTrue:[ 
       
   213          self enqueueDelayedUpdateInternalList.
       
   214          ^ self.
       
   215     ].
       
   216     super update:aspect with:param from:sender
       
   217 
       
   218     "Modified: / 03-02-2018 / 09:47:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   219 ! !
       
   220 
       
   221 !VDBVariableObjectListApplication methodsFor:'change & update-delayed'!
       
   222 
       
   223 delayedUpdateInternalList
       
   224     | root |
       
   225 
       
   226     debugger isNil ifTrue:[
       
   227         self internalListHolder root children:#().
       
   228         ^ self.
       
   229     ].
       
   230     root := self internalListHolder root.
       
   231     root children:(self variableObjectListHolder value
       
   232                 collect:[:v | 
       
   233                     (VDBVariableObjectPresenter new) setVarobj:v;
       
   234                         parent:root;
       
   235                         yourself
       
   236                 ]).
       
   237     root expand.
       
   238     internalListView notNil ifTrue:[
       
   239         internalListView invalidate.
       
   240     ]
       
   241 
       
   242     "Created: / 27-02-2015 / 15:47:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   243     "Modified: / 03-02-2018 / 07:31:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   244 !
       
   245 
       
   246 delayedUpdateSelection
       
   247     | internalSelection |
       
   248 
       
   249     internalSelection := self internalSelectionHolder value.
       
   250     internalSelection notNil ifTrue:[
       
   251         self selectedVariableObjectHolder value: internalSelection varobj
       
   252     ] ifFalse:[ 
       
   253         self selectedVariableObjectHolder value: nil
       
   254     ].
       
   255 
       
   256     "Modified: / 28-01-2018 / 22:50:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   257 ! !
       
   258 
       
   259 !VDBVariableObjectListApplication methodsFor:'drag & drop'!
       
   260 
       
   261 dropObjects:aCollectionOfDropObjects
       
   262     "drop manager wants to drop.
       
   263      This is ony sent, if #canDrop: returned true.
       
   264      Must be redefined in order for drop to work."
       
   265 
       
   266     ^ self shouldImplement
       
   267 ! !
       
   268 
       
   269 !VDBVariableObjectListApplication methodsFor:'event handling'!
       
   270 
       
   271 onStoppedEvent: aGDBStoppedEvent
       
   272     self enqueueDelayedInvalidateInternalList
       
   273 
       
   274     "Created: / 01-02-2018 / 23:14:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   275 ! !
       
   276 
       
   277 !VDBVariableObjectListApplication methodsFor:'initialization & release'!
       
   278 
       
   279 subscribe   
       
   280     "Register for debugger events. To be overrided by subclasses"
       
   281 
       
   282     debugger announcer
       
   283         when: GDBStoppedEvent               send: #onStoppedEvent: to: self
       
   284 
       
   285     "Created: / 01-02-2018 / 23:07:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   286 ! !
       
   287 
       
   288 !VDBVariableObjectListApplication class methodsFor:'documentation'!
       
   289 
       
   290 version_HG
       
   291 
       
   292     ^ '$Changeset: <not expanded> $'
       
   293 ! !
       
   294