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