author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 29 Jan 2012 15:33:37 +0000 | |
branch | jv |
changeset 12125 | 0c49a3b13e43 |
parent 12123 | 4bde08cebd48 |
child 12128 | a7ff7d66ee85 |
permissions | -rw-r--r-- |
9999 | 1 |
" |
10094 | 2 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
3 |
Copyright (c) 2009-2010 eXept Software AG |
|
9999 | 4 |
|
10094 | 5 |
Permission is hereby granted, free of charge, to any person |
6 |
obtaining a copy of this software and associated documentation |
|
7 |
files (the 'Software'), to deal in the Software without |
|
8 |
restriction, including without limitation the rights to use, |
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
copies of the Software, and to permit persons to whom the |
|
11 |
Software is furnished to do so, subject to the following |
|
12 |
conditions: |
|
13 |
||
14 |
The above copyright notice and this permission notice shall be |
|
15 |
included in all copies or substantial portions of the Software. |
|
16 |
||
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
24 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9999 | 25 |
" |
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
"{ NameSpace: Tools }" |
|
29 |
||
30 |
ApplicationModel subclass:#LintRuleDetail |
|
12125 | 31 |
instanceVariableNames:'ruleHolder rationaleVisibleHolder rationalView' |
10480 | 32 |
classVariableNames:'' |
33 |
poolDictionaries:'' |
|
34 |
category:'Interface-Lint' |
|
9999 | 35 |
! |
36 |
||
37 |
!LintRuleDetail class methodsFor:'documentation'! |
|
38 |
||
39 |
copyright |
|
40 |
" |
|
10094 | 41 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
42 |
Copyright (c) 2009-2010 eXept Software AG |
|
43 |
||
44 |
Permission is hereby granted, free of charge, to any person |
|
45 |
obtaining a copy of this software and associated documentation |
|
46 |
files (the 'Software'), to deal in the Software without |
|
47 |
restriction, including without limitation the rights to use, |
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
49 |
copies of the Software, and to permit persons to whom the |
|
50 |
Software is furnished to do so, subject to the following |
|
51 |
conditions: |
|
9999 | 52 |
|
10094 | 53 |
The above copyright notice and this permission notice shall be |
54 |
included in all copies or substantial portions of the Software. |
|
55 |
||
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
63 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9999 | 64 |
" |
65 |
! ! |
|
66 |
||
12125 | 67 |
!LintRuleDetail class methodsFor:'help specs'! |
68 |
||
69 |
flyByHelpSpec |
|
70 |
"This resource specification was automatically generated |
|
71 |
by the UIHelpTool of ST/X." |
|
72 |
||
73 |
"Do not manually edit this!! If it is corrupted, |
|
74 |
the UIHelpTool may not be able to read the specification." |
|
75 |
||
76 |
" |
|
77 |
UIHelpTool openOnClass:Tools::LintRuleDetail |
|
78 |
" |
|
79 |
||
80 |
<resource: #help> |
|
81 |
||
82 |
^ super flyByHelpSpec addPairsFrom:#( |
|
83 |
||
84 |
#ruleName |
|
85 |
'Click to browse the lint rule' |
|
86 |
||
87 |
) |
|
88 |
||
89 |
"Created: / 07-09-2011 / 04:08:11 / cg" |
|
90 |
! ! |
|
91 |
||
9999 | 92 |
!LintRuleDetail class methodsFor:'interface specs'! |
93 |
||
94 |
windowSpec |
|
95 |
"This resource specification was automatically generated |
|
96 |
by the UIPainter of ST/X." |
|
97 |
||
98 |
"Do not manually edit this!! If it is corrupted, |
|
99 |
the UIPainter may not be able to read the specification." |
|
100 |
||
101 |
" |
|
102 |
UIPainter new openOnClass:Tools::LintRuleDetail andSelector:#windowSpec |
|
103 |
Tools::LintRuleDetail new openInterface:#windowSpec |
|
104 |
Tools::LintRuleDetail open |
|
105 |
" |
|
106 |
||
107 |
<resource: #canvas> |
|
108 |
||
10500 | 109 |
^ |
9999 | 110 |
#(FullSpec |
10500 | 111 |
name: windowSpec |
112 |
window: |
|
9999 | 113 |
(WindowSpec |
10500 | 114 |
label: 'SmalllintRuleDetail' |
115 |
name: 'SmalllintRuleDetail' |
|
116 |
min: (Point 10 10) |
|
117 |
bounds: (Rectangle 0 0 560 300) |
|
118 |
) |
|
119 |
component: |
|
9999 | 120 |
(SpecCollection |
10500 | 121 |
collection: ( |
122 |
(VerticalPanelViewSpec |
|
123 |
name: 'Panel' |
|
124 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
125 |
horizontalLayout: fit |
|
126 |
verticalLayout: topSpaceFit |
|
127 |
horizontalSpace: 0 |
|
128 |
verticalSpace: 0 |
|
12125 | 129 |
ignoreInvisibleComponents: false |
10500 | 130 |
component: |
131 |
(SpecCollection |
|
132 |
collection: ( |
|
133 |
(ViewSpec |
|
134 |
name: 'Label' |
|
135 |
component: |
|
136 |
(SpecCollection |
|
137 |
collection: ( |
|
12125 | 138 |
(LinkButtonSpec |
139 |
name: 'Button1' |
|
140 |
layout: (LayoutFrame 0 0 0 0 -150 1 30 0) |
|
141 |
activeHelpKey: ruleName |
|
10500 | 142 |
translateLabel: true |
143 |
labelChannel: ruleNameAspect |
|
144 |
adjust: left |
|
12125 | 145 |
model: browseLintRule |
10500 | 146 |
) |
147 |
(CheckBoxSpec |
|
148 |
label: 'Show Rationale' |
|
149 |
name: 'CheckBox1' |
|
150 |
layout: (LayoutFrame -150 1 0 0 0 1 30 0) |
|
151 |
model: rationaleVisibleHolder |
|
152 |
translateLabel: true |
|
153 |
) |
|
154 |
) |
|
155 |
||
156 |
) |
|
157 |
extent: (Point 560 30) |
|
158 |
) |
|
159 |
(HTMLViewSpec |
|
160 |
name: 'Rationale' |
|
161 |
level: 0 |
|
162 |
visibilityChannel: rationaleVisibleHolder |
|
163 |
hasHorizontalScrollBar: true |
|
164 |
hasVerticalScrollBar: true |
|
12125 | 165 |
backgroundColor: (Color 86.9993133440146 86.9993133440146 86.9993133440146) |
10500 | 166 |
htmlText: ruleRationaleAspect |
167 |
extent: (Point 560 270) |
|
168 |
postBuildCallback: setupHTMLView: |
|
169 |
) |
|
170 |
) |
|
171 |
||
172 |
) |
|
173 |
) |
|
174 |
) |
|
175 |
||
176 |
) |
|
9999 | 177 |
) |
178 |
! ! |
|
179 |
||
180 |
!LintRuleDetail class methodsFor:'plugIn spec'! |
|
181 |
||
182 |
aspectSelectors |
|
183 |
"This resource specification was automatically generated |
|
184 |
by the UIPainter of ST/X." |
|
185 |
||
186 |
"Do not manually edit this. If it is corrupted, |
|
187 |
the UIPainter may not be able to read the specification." |
|
188 |
||
189 |
"Return a description of exported aspects; |
|
190 |
these can be connected to aspects of an embedding application |
|
191 |
(if this app is embedded in a subCanvas)." |
|
192 |
||
193 |
^ #( |
|
12125 | 194 |
#ruleHolder |
9999 | 195 |
). |
196 |
||
197 |
! ! |
|
198 |
||
12125 | 199 |
!LintRuleDetail methodsFor:'actions'! |
200 |
||
201 |
browseLintRule |
|
202 |
|rule ruleClass sel| |
|
203 |
||
204 |
rule := self ruleHolder value. |
|
205 |
rule isNil ifTrue:[^ self]. |
|
206 |
ruleClass := rule class. |
|
207 |
(ruleClass implements:#rationale) ifTrue:[ |
|
208 |
sel := #rationale. |
|
209 |
]. |
|
210 |
UserPreferences current systemBrowserClass |
|
211 |
openInClass:ruleClass selector:sel |
|
212 |
||
213 |
"Created: / 07-09-2011 / 04:09:38 / cg" |
|
214 |
! ! |
|
215 |
||
9999 | 216 |
!LintRuleDetail methodsFor:'aspects'! |
217 |
||
10473 | 218 |
rationaleVisibleHolder |
219 |
"return/create the 'rationaleVisibleHolder' value holder (automatically generated)" |
|
220 |
||
221 |
rationaleVisibleHolder isNil ifTrue:[ |
|
10500 | 222 |
rationaleVisibleHolder := ValueHolder with: false. |
223 |
rationaleVisibleHolder addDependent:self. |
|
10473 | 224 |
]. |
225 |
^ rationaleVisibleHolder |
|
226 |
||
227 |
"Modified: / 04-08-2011 / 21:39:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
228 |
! |
|
229 |
||
230 |
rationaleVisibleHolder:something |
|
231 |
"set the 'rationaleVisibleHolder' value holder (automatically generated)" |
|
232 |
||
233 |
|oldValue newValue| |
|
234 |
||
235 |
rationaleVisibleHolder notNil ifTrue:[ |
|
10500 | 236 |
oldValue := rationaleVisibleHolder value. |
237 |
rationaleVisibleHolder removeDependent:self. |
|
10473 | 238 |
]. |
239 |
rationaleVisibleHolder := something. |
|
240 |
rationaleVisibleHolder notNil ifTrue:[ |
|
10500 | 241 |
rationaleVisibleHolder addDependent:self. |
10473 | 242 |
]. |
243 |
newValue := rationaleVisibleHolder value. |
|
244 |
oldValue ~~ newValue ifTrue:[ |
|
10500 | 245 |
self update:#value with:newValue from:rationaleVisibleHolder. |
10473 | 246 |
]. |
247 |
! |
|
248 |
||
9999 | 249 |
ruleHolder |
250 |
"return/create the 'ruleHolder' value holder (automatically generated)" |
|
251 |
||
252 |
ruleHolder isNil ifTrue:[ |
|
10480 | 253 |
ruleHolder := ValueHolder new. |
9999 | 254 |
]. |
255 |
^ ruleHolder |
|
256 |
! |
|
257 |
||
10473 | 258 |
ruleHolder:something |
9999 | 259 |
"set the 'ruleHolder' value holder (automatically generated)" |
260 |
||
10473 | 261 |
|oldValue newValue| |
262 |
||
263 |
ruleHolder notNil ifTrue:[ |
|
10480 | 264 |
oldValue := ruleHolder value. |
265 |
ruleHolder removeDependent:self. |
|
10473 | 266 |
]. |
267 |
ruleHolder := something. |
|
268 |
ruleHolder notNil ifTrue:[ |
|
10480 | 269 |
ruleHolder addDependent:self. |
10473 | 270 |
]. |
271 |
newValue := ruleHolder value. |
|
272 |
oldValue ~~ newValue ifTrue:[ |
|
10480 | 273 |
self update:#value with:newValue from:ruleHolder. |
10473 | 274 |
]. |
9999 | 275 |
! |
276 |
||
277 |
ruleNameAspect |
|
278 |
<resource: #uiAspect> |
|
279 |
||
280 |
|holder| |
|
281 |
||
282 |
(holder := builder bindingAt:#ruleNameAspect) isNil ifTrue:[ |
|
12125 | 283 |
holder := BlockValue |
284 |
with:[:h | |
|
285 |
"/ h displayString , ' ' , (('[browse]' actionForAll:[ self browseLintRule]) colorizeAllWith:Color blue) |
|
286 |
h displayString actionForAll:[ self browseLintRule] |
|
287 |
] |
|
288 |
argument: self ruleHolder. |
|
289 |
builder aspectAt:#ruleNameAspect put:holder. |
|
9999 | 290 |
]. |
291 |
^ holder. |
|
292 |
||
293 |
"Modified: / 05-02-2010 / 12:51:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 294 |
"Modified: / 07-09-2011 / 04:54:24 / cg" |
9999 | 295 |
! |
296 |
||
297 |
ruleRationaleAspect |
|
298 |
<resource: #uiAspect> |
|
299 |
||
300 |
|holder| |
|
301 |
||
302 |
(holder := builder bindingAt:#ruleRationaleAspect) isNil ifTrue:[ |
|
12125 | 303 |
holder := (AspectAdaptor forAspect: #rationale) subjectChannel: self ruleHolder. |
304 |
builder aspectAt:#ruleRationaleAspect put:holder. |
|
9999 | 305 |
]. |
306 |
^ holder. |
|
307 |
||
308 |
"Modified: / 05-02-2010 / 12:51:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 309 |
"Modified (comment): / 07-09-2011 / 04:12:16 / cg" |
9999 | 310 |
! ! |
311 |
||
10473 | 312 |
!LintRuleDetail methodsFor:'change & update'! |
313 |
||
314 |
update:something with:aParameter from:changedObject |
|
315 |
"Invoked when an object that I depend upon sends a change notification." |
|
316 |
||
317 |
changedObject == ruleHolder ifTrue:[ |
|
10500 | 318 |
self updateVisibility. |
319 |
^ self. |
|
10473 | 320 |
]. |
321 |
changedObject == rationaleVisibleHolder ifTrue:[ |
|
10500 | 322 |
self updateVisibility. |
323 |
^ self. |
|
10473 | 324 |
]. |
325 |
super update:something with:aParameter from:changedObject |
|
326 |
||
327 |
"Modified: / 04-08-2011 / 21:31:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
328 |
! |
|
329 |
||
330 |
updateVisibility |
|
331 |
||
10480 | 332 |
self ruleHolder value notNil |
12125 | 333 |
ifTrue:[self show] |
334 |
ifFalse:[self hide]. |
|
10473 | 335 |
|
336 |
"Created: / 04-08-2011 / 16:39:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 337 |
"Modified: / 04-09-2011 / 20:18:48 / cg" |
10473 | 338 |
! ! |
339 |
||
10500 | 340 |
!LintRuleDetail methodsFor:'initialization'! |
341 |
||
342 |
setupHTMLView:aView |
|
12125 | 343 |
rationalView := aView. |
10500 | 344 |
aView painter |
12125 | 345 |
leftMargin:20; |
346 |
topMargin:5. |
|
10500 | 347 |
|
348 |
"Created: / 04-08-2011 / 18:00:36 / cg" |
|
349 |
! ! |
|
350 |
||
10473 | 351 |
!LintRuleDetail methodsFor:'private'! |
352 |
||
12125 | 353 |
heightWhenNotShowingRationale |
354 |
^ 30 |
|
355 |
||
356 |
"Created: / 07-09-2011 / 04:02:34 / cg" |
|
357 |
! |
|
358 |
||
359 |
heightWhenShowingRationale |
|
360 |
^ 100 |
|
361 |
||
362 |
"Created: / 07-09-2011 / 04:02:24 / cg" |
|
363 |
! |
|
364 |
||
10473 | 365 |
hide |
366 |
||
367 |
self visibility: false height: 0 |
|
368 |
||
369 |
"Created: / 11-03-2010 / 09:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
370 |
! |
|
371 |
||
372 |
show |
|
12125 | 373 |
self |
374 |
visibility: true |
|
375 |
height: (self rationaleVisibleHolder value |
|
376 |
ifTrue:[ self heightWhenShowingRationale ] |
|
377 |
ifFalse:[ self heightWhenNotShowingRationale ]) |
|
10473 | 378 |
|
379 |
"Created: / 11-03-2010 / 09:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 380 |
"Modified: / 07-09-2011 / 04:03:07 / cg" |
10473 | 381 |
! |
382 |
||
383 |
visibility: visibility height: height |
|
384 |
| container list detail h | |
|
12125 | 385 |
|
386 |
(container := self window container) isNil ifTrue:[^self]. |
|
10473 | 387 |
h := visibility ifFalse:[0] ifTrue:[height]. |
388 |
||
12125 | 389 |
container isVisible == visibility ifFalse: [ |
390 |
container isVisible: visibility |
|
391 |
]. |
|
10473 | 392 |
|
393 |
list := container container subViews first. |
|
394 |
detail := container container subViews second. |
|
395 |
||
12125 | 396 |
(list layout bottomOffset ~= height negated) ifTrue:[ |
397 |
list layout: (list layout bottomOffset: height negated; yourself) |
|
398 |
]. |
|
399 |
(detail layout topOffset ~= height negated) ifTrue:[ |
|
400 |
detail layout: (detail layout topOffset: height negated; yourself) |
|
401 |
]. |
|
10473 | 402 |
|
403 |
"Created: / 11-03-2010 / 09:51:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12125 | 404 |
"Modified: / 04-09-2011 / 20:15:40 / cg" |
10480 | 405 |
! ! |
10473 | 406 |
|
9999 | 407 |
!LintRuleDetail class methodsFor:'documentation'! |
408 |
||
12125 | 409 |
version |
410 |
^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleDetail.st,v 1.10 2011/09/07 02:54:47 cg Exp $' |
|
411 |
! |
|
412 |
||
9999 | 413 |
version_CVS |
12125 | 414 |
^ '§Header: /cvs/stx/stx/libtool/Tools__LintRuleDetail.st,v 1.10 2011/09/07 02:54:47 cg Exp §' |
9999 | 415 |
! |
416 |
||
417 |
version_SVN |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
418 |
^ '$Id: Tools__LintRuleDetail.st 7617 2010-08-25 12:56:19Z vranyj1 $' |
12125 | 419 |
! ! |