author | Claus Gittinger <cg@exept.de> |
Thu, 10 Feb 2011 16:58:13 +0100 | |
changeset 9756 | 5a1787bbf85e |
parent 6157 | 333cde2a5ec7 |
child 12123 | 4bde08cebd48 |
child 17168 | 26ea2eb499bf |
permissions | -rw-r--r-- |
2744 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
2699 | 13 |
"{ Package: 'stx:libtool' }" |
14 |
||
981 | 15 |
SimpleView subclass:#SystemStatusMonitor |
16 |
instanceVariableNames:'listView listUpdateDelay updateDelay updateBlock listUpdateBlock |
|
17 |
updateProcess' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
1053 | 20 |
category:'Monitors-ST/X' |
981 | 21 |
! |
22 |
||
2744 | 23 |
!SystemStatusMonitor class methodsFor:'documentation'! |
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! ! |
|
981 | 38 |
|
39 |
!SystemStatusMonitor class methodsFor:'defaults'! |
|
40 |
||
41 |
defaultIcon |
|
42 |
^ StandardSystemView defaultIcon |
|
43 |
||
44 |
"Created: 23.1.1997 / 02:52:25 / cg" |
|
45 |
! |
|
46 |
||
47 |
defaultLabel |
|
48 |
^ 'Status Monitor' |
|
49 |
||
50 |
"Created: 23.1.1997 / 02:52:43 / cg" |
|
51 |
! ! |
|
52 |
||
53 |
!SystemStatusMonitor class methodsFor:'startup'! |
|
54 |
||
1823 | 55 |
isVisualStartable |
2844 | 56 |
"return true, if this application can be started via #open. |
57 |
(to allow start of a change browser via double-click in the browser)" |
|
58 |
||
1823 | 59 |
^ self ~~ SystemStatusMonitor |
60 |
||
61 |
"Created: / 10.8.1998 / 16:02:23 / cg" |
|
62 |
"Modified: / 10.8.1998 / 16:02:41 / cg" |
|
63 |
! |
|
64 |
||
981 | 65 |
open |
66 |
|top monitor| |
|
67 |
||
68 |
top := StandardSystemView new. |
|
69 |
monitor := self origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
70 |
top extent:monitor preferredExtent. |
|
71 |
top label:self defaultLabel. |
|
72 |
top icon:self defaultIcon. |
|
2410 | 73 |
top open. |
74 |
||
75 |
^ monitor |
|
981 | 76 |
|
77 |
" |
|
78 |
ProcessMonitor open |
|
79 |
" |
|
80 |
||
81 |
"Created: 23.1.1997 / 02:53:42 / cg" |
|
82 |
! ! |
|
83 |
||
84 |
!SystemStatusMonitor methodsFor:'destroying'! |
|
85 |
||
3825 | 86 |
release |
981 | 87 |
updateBlock notNil ifTrue:[ |
3825 | 88 |
Processor removeTimedBlock:updateBlock. |
89 |
updateBlock := nil. |
|
981 | 90 |
]. |
3825 | 91 |
listUpdateBlock notNil ifTrue:[ |
92 |
Processor removeTimedBlock:listUpdateBlock. |
|
93 |
listUpdateBlock := nil. |
|
94 |
]. |
|
95 |
updateProcess notNil ifTrue:[ |
|
96 |
updateProcess terminate. |
|
97 |
updateProcess := nil. |
|
98 |
]. |
|
99 |
super release |
|
981 | 100 |
|
101 |
"Created: 23.1.1997 / 02:26:50 / cg" |
|
102 |
! ! |
|
103 |
||
104 |
!SystemStatusMonitor methodsFor:'drawing'! |
|
105 |
||
6157 | 106 |
updateList |
107 |
self subclassResponsibility |
|
108 |
! |
|
109 |
||
110 |
updateStatus:arg |
|
111 |
self subclassResponsibility |
|
112 |
! |
|
113 |
||
981 | 114 |
updateView |
115 |
self updateList. |
|
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
116 |
self updateStatus:nil |
981 | 117 |
|
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
118 |
"Created: / 23.1.1997 / 02:27:05 / cg" |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
119 |
"Modified: / 14.12.1999 / 20:47:37 / cg" |
981 | 120 |
! ! |
121 |
||
122 |
!SystemStatusMonitor methodsFor:'events'! |
|
123 |
||
124 |
canHandle:key |
|
125 |
^ key == #InspectIt |
|
126 |
||
127 |
"Created: 23.1.1997 / 02:27:15 / cg" |
|
128 |
! |
|
129 |
||
130 |
keyPress:key x:x y:y |
|
131 |
<resource: #keyboard ( #InspectIt ) > |
|
132 |
||
133 |
key == #InspectIt ifTrue:[ |
|
1897 | 134 |
^ self inspectSelection. |
981 | 135 |
]. |
136 |
^ super keyPress:key x:x y:y |
|
137 |
||
138 |
"Modified: 23.1.1997 / 02:27:27 / cg" |
|
139 |
"Created: 23.1.1997 / 02:27:45 / cg" |
|
140 |
! ! |
|
141 |
||
142 |
!SystemStatusMonitor methodsFor:'initialization'! |
|
143 |
||
144 |
initialize |
|
145 |
|v| |
|
146 |
||
147 |
super initialize. |
|
148 |
||
149 |
v := HVScrollableView for:SelectionInListView miniScrollerH:true in:self. |
|
150 |
v origin:0.0@0.0 corner:1.0@1.0. |
|
151 |
||
152 |
listView := v scrolledView. |
|
1273
3a8a91e6c5fa
give my listView a fixed font.
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
153 |
listView font:(EditTextView defaultFont). |
981 | 154 |
listView menuHolder:self; menuPerformer:self; menuMessage:#statusMenu. |
155 |
||
156 |
listView multipleSelectOk:true. |
|
1897 | 157 |
"/ listView toggleSelect:true. |
981 | 158 |
listView delegate:(KeyboardForwarder toView:self). |
159 |
listView doubleClickAction:[:line | self doubleClicked]. |
|
160 |
||
161 |
updateDelay := 0.5. |
|
162 |
listUpdateDelay := 5. |
|
163 |
||
164 |
"/ event mode is no longer used; |
|
165 |
"/ this event support may vanish |
|
166 |
Processor isPureEventDriven ifTrue:[ |
|
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
167 |
updateBlock := [self updateStatus:nil]. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
168 |
listUpdateBlock := [self updateList]. |
981 | 169 |
]. |
170 |
||
171 |
" |
|
172 |
ProcessMonitor open |
|
173 |
" |
|
174 |
||
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
175 |
"Modified: / 14.12.1999 / 20:47:57 / cg" |
981 | 176 |
! |
177 |
||
178 |
mapped |
|
179 |
super mapped. |
|
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
180 |
self updateStatus:nil. |
981 | 181 |
self updateList. |
182 |
||
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
183 |
"Created: / 23.1.1997 / 02:30:05 / cg" |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
184 |
"Modified: / 14.12.1999 / 20:47:54 / cg" |
981 | 185 |
! |
186 |
||
187 |
realize |
|
188 |
super realize. |
|
189 |
||
190 |
self startUpdateProcess. |
|
191 |
||
192 |
"Created: 23.1.1997 / 02:30:28 / cg" |
|
193 |
! |
|
194 |
||
195 |
reinitialize |
|
196 |
updateProcess := nil. |
|
197 |
super reinitialize. |
|
198 |
self startUpdateProcess. |
|
199 |
||
200 |
"Modified: 22.12.1995 / 22:51:14 / cg" |
|
201 |
"Created: 23.1.1997 / 02:30:43 / cg" |
|
202 |
! |
|
203 |
||
204 |
startUpdateProcess |
|
205 |
updateBlock notNil ifTrue:[ |
|
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
206 |
Processor addTimedBlock:updateBlock afterSeconds:updateDelay. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
207 |
Processor addTimedBlock:listUpdateBlock afterSeconds:listUpdateDelay. |
981 | 208 |
] ifFalse:[ |
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
209 |
updateProcess := [ |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
210 |
[ |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
211 |
|id cnt myDelay| |
992 | 212 |
|
3024 | 213 |
myDelay := Delay forSeconds:updateDelay. |
981 | 214 |
|
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
215 |
" |
3024 | 216 |
every updateDelay (0.5), we look which process runs; |
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
217 |
every half second, the status is updated. |
3024 | 218 |
every listUpdateDelay (5s), the list of processes is |
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
219 |
built up again |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
220 |
" |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
221 |
[true] whileTrue:[ |
3024 | 222 |
((listUpdateDelay // updateDelay) max:2) - 1 timesRepeat:[ |
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
223 |
myDelay wait. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
224 |
self updateStatus:nil. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
225 |
]. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
226 |
myDelay wait. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
227 |
self updateList. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
228 |
] |
6156 | 229 |
] ifCurtailed:[ |
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
230 |
updateProcess := nil |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
231 |
] |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
232 |
] forkAt:(Processor userSchedulingPriority + 1). |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
233 |
updateProcess name:'monitor [' , |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
234 |
Processor activeProcess id printString , |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
235 |
'] update'. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
236 |
" |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
237 |
raise my own priority |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
238 |
" |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
239 |
Processor activeProcess priority:(Processor userSchedulingPriority + 2) |
981 | 240 |
]. |
241 |
||
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
242 |
"Created: / 23.1.1997 / 02:30:58 / cg" |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
243 |
"Modified: / 14.12.1999 / 20:47:50 / cg" |
981 | 244 |
! ! |
245 |
||
246 |
!SystemStatusMonitor methodsFor:'queries'! |
|
247 |
||
248 |
preferredExtent |
|
249 |
"return my preferred extent" |
|
250 |
||
2699 | 251 |
^ (font widthOf:self titleLine) + 40 @ 200 |
981 | 252 |
|
253 |
"Modified: 23.1.1997 / 02:35:01 / cg" |
|
254 |
"Created: 23.1.1997 / 02:51:24 / cg" |
|
255 |
! ! |
|
256 |
||
257 |
!SystemStatusMonitor class methodsFor:'documentation'! |
|
258 |
||
259 |
version |
|
6157 | 260 |
^ '$Header: /cvs/stx/stx/libtool/SystemStatusMonitor.st,v 1.17 2004-12-14 15:01:54 cg Exp $' |
981 | 261 |
! ! |