author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 29 Jan 2012 12:53:39 +0000 | |
branch | jv |
changeset 12123 | 4bde08cebd48 |
parent 10673 | 5e23775830ee |
child 12125 | 0c49a3b13e43 |
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 |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
31 |
instanceVariableNames:'ruleHolder rationaleVisibleHolder' |
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 |
||
67 |
!LintRuleDetail class methodsFor:'interface specs'! |
|
68 |
||
69 |
windowSpec |
|
70 |
"This resource specification was automatically generated |
|
71 |
by the UIPainter of ST/X." |
|
72 |
||
73 |
"Do not manually edit this!! If it is corrupted, |
|
74 |
the UIPainter may not be able to read the specification." |
|
75 |
||
76 |
" |
|
77 |
UIPainter new openOnClass:Tools::LintRuleDetail andSelector:#windowSpec |
|
78 |
Tools::LintRuleDetail new openInterface:#windowSpec |
|
79 |
Tools::LintRuleDetail open |
|
80 |
" |
|
81 |
||
82 |
<resource: #canvas> |
|
83 |
||
10500 | 84 |
^ |
9999 | 85 |
#(FullSpec |
10500 | 86 |
name: windowSpec |
87 |
window: |
|
9999 | 88 |
(WindowSpec |
10500 | 89 |
label: 'SmalllintRuleDetail' |
90 |
name: 'SmalllintRuleDetail' |
|
91 |
min: (Point 10 10) |
|
92 |
bounds: (Rectangle 0 0 560 300) |
|
93 |
) |
|
94 |
component: |
|
9999 | 95 |
(SpecCollection |
10500 | 96 |
collection: ( |
97 |
(VerticalPanelViewSpec |
|
98 |
name: 'Panel' |
|
99 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
100 |
horizontalLayout: fit |
|
101 |
verticalLayout: topSpaceFit |
|
102 |
horizontalSpace: 0 |
|
103 |
verticalSpace: 0 |
|
104 |
component: |
|
105 |
(SpecCollection |
|
106 |
collection: ( |
|
107 |
(ViewSpec |
|
108 |
name: 'Label' |
|
109 |
component: |
|
110 |
(SpecCollection |
|
111 |
collection: ( |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
112 |
(LabelSpec |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
113 |
label: 'Name...' |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
114 |
name: 'Name' |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
115 |
layout: (LayoutFrame 15 0 0 0 -150 1 30 0) |
10500 | 116 |
translateLabel: true |
117 |
labelChannel: ruleNameAspect |
|
118 |
adjust: left |
|
119 |
) |
|
120 |
(CheckBoxSpec |
|
121 |
label: 'Show Rationale' |
|
122 |
name: 'CheckBox1' |
|
123 |
layout: (LayoutFrame -150 1 0 0 0 1 30 0) |
|
124 |
model: rationaleVisibleHolder |
|
125 |
translateLabel: true |
|
126 |
) |
|
127 |
) |
|
128 |
||
129 |
) |
|
130 |
extent: (Point 560 30) |
|
131 |
) |
|
132 |
(HTMLViewSpec |
|
133 |
name: 'Rationale' |
|
134 |
level: 0 |
|
135 |
visibilityChannel: rationaleVisibleHolder |
|
136 |
hasHorizontalScrollBar: true |
|
137 |
hasVerticalScrollBar: true |
|
138 |
htmlText: ruleRationaleAspect |
|
139 |
extent: (Point 560 270) |
|
140 |
postBuildCallback: setupHTMLView: |
|
141 |
) |
|
142 |
) |
|
143 |
||
144 |
) |
|
145 |
) |
|
146 |
) |
|
147 |
||
148 |
) |
|
9999 | 149 |
) |
150 |
! ! |
|
151 |
||
152 |
!LintRuleDetail class methodsFor:'plugIn spec'! |
|
153 |
||
154 |
aspectSelectors |
|
155 |
"This resource specification was automatically generated |
|
156 |
by the UIPainter of ST/X." |
|
157 |
||
158 |
"Do not manually edit this. If it is corrupted, |
|
159 |
the UIPainter may not be able to read the specification." |
|
160 |
||
161 |
"Return a description of exported aspects; |
|
162 |
these can be connected to aspects of an embedding application |
|
163 |
(if this app is embedded in a subCanvas)." |
|
164 |
||
165 |
^ #( |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
166 |
#ruleHolder |
9999 | 167 |
). |
168 |
||
169 |
! ! |
|
170 |
||
171 |
!LintRuleDetail methodsFor:'aspects'! |
|
172 |
||
10473 | 173 |
rationaleVisibleHolder |
174 |
"return/create the 'rationaleVisibleHolder' value holder (automatically generated)" |
|
175 |
||
176 |
rationaleVisibleHolder isNil ifTrue:[ |
|
10500 | 177 |
rationaleVisibleHolder := ValueHolder with: false. |
178 |
rationaleVisibleHolder addDependent:self. |
|
10473 | 179 |
]. |
180 |
^ rationaleVisibleHolder |
|
181 |
||
182 |
"Modified: / 04-08-2011 / 21:39:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
183 |
! |
|
184 |
||
185 |
rationaleVisibleHolder:something |
|
186 |
"set the 'rationaleVisibleHolder' value holder (automatically generated)" |
|
187 |
||
188 |
|oldValue newValue| |
|
189 |
||
190 |
rationaleVisibleHolder notNil ifTrue:[ |
|
10500 | 191 |
oldValue := rationaleVisibleHolder value. |
192 |
rationaleVisibleHolder removeDependent:self. |
|
10473 | 193 |
]. |
194 |
rationaleVisibleHolder := something. |
|
195 |
rationaleVisibleHolder notNil ifTrue:[ |
|
10500 | 196 |
rationaleVisibleHolder addDependent:self. |
10473 | 197 |
]. |
198 |
newValue := rationaleVisibleHolder value. |
|
199 |
oldValue ~~ newValue ifTrue:[ |
|
10500 | 200 |
self update:#value with:newValue from:rationaleVisibleHolder. |
10473 | 201 |
]. |
202 |
! |
|
203 |
||
9999 | 204 |
ruleHolder |
205 |
"return/create the 'ruleHolder' value holder (automatically generated)" |
|
206 |
||
207 |
ruleHolder isNil ifTrue:[ |
|
10480 | 208 |
ruleHolder := ValueHolder new. |
9999 | 209 |
]. |
210 |
^ ruleHolder |
|
211 |
! |
|
212 |
||
10473 | 213 |
ruleHolder:something |
9999 | 214 |
"set the 'ruleHolder' value holder (automatically generated)" |
215 |
||
10473 | 216 |
|oldValue newValue| |
217 |
||
218 |
ruleHolder notNil ifTrue:[ |
|
10480 | 219 |
oldValue := ruleHolder value. |
220 |
ruleHolder removeDependent:self. |
|
10473 | 221 |
]. |
222 |
ruleHolder := something. |
|
223 |
ruleHolder notNil ifTrue:[ |
|
10480 | 224 |
ruleHolder addDependent:self. |
10473 | 225 |
]. |
226 |
newValue := ruleHolder value. |
|
227 |
oldValue ~~ newValue ifTrue:[ |
|
10480 | 228 |
self update:#value with:newValue from:ruleHolder. |
10473 | 229 |
]. |
9999 | 230 |
! |
231 |
||
232 |
ruleNameAspect |
|
233 |
<resource: #uiAspect> |
|
234 |
||
235 |
|holder| |
|
236 |
||
237 |
(holder := builder bindingAt:#ruleNameAspect) isNil ifTrue:[ |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
238 |
holder := (AspectAdaptor forAspect: #displayString) subjectChannel: self ruleHolder. |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
239 |
builder aspectAt:#ruleNameAspect put:holder. |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
240 |
"/ holder addDependent:self. |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
241 |
"/ holder onChangeSend:#ruleNameAspectChanged to:self. |
9999 | 242 |
]. |
243 |
^ holder. |
|
244 |
||
245 |
"Modified: / 05-02-2010 / 12:51:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
246 |
! |
|
247 |
||
248 |
ruleRationaleAspect |
|
249 |
<resource: #uiAspect> |
|
250 |
||
251 |
|holder| |
|
252 |
||
253 |
(holder := builder bindingAt:#ruleRationaleAspect) isNil ifTrue:[ |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
254 |
holder := (AspectAdaptor forAspect: #rationale) subjectChannel: self ruleHolder. |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
255 |
builder aspectAt:#ruleRationaleAspect put:holder. |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
256 |
"/ holder addDependent:self. |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
257 |
"/ holder onChangeSend:#ruleRationaleAspectChanged to:self. |
9999 | 258 |
]. |
259 |
^ holder. |
|
260 |
||
261 |
"Modified: / 05-02-2010 / 12:51:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
262 |
! ! |
|
263 |
||
10473 | 264 |
!LintRuleDetail methodsFor:'change & update'! |
265 |
||
266 |
update:something with:aParameter from:changedObject |
|
267 |
"Invoked when an object that I depend upon sends a change notification." |
|
268 |
||
269 |
changedObject == ruleHolder ifTrue:[ |
|
10500 | 270 |
self updateVisibility. |
271 |
^ self. |
|
10473 | 272 |
]. |
273 |
changedObject == rationaleVisibleHolder ifTrue:[ |
|
10500 | 274 |
self updateVisibility. |
275 |
^ self. |
|
10473 | 276 |
]. |
277 |
super update:something with:aParameter from:changedObject |
|
278 |
||
279 |
"Modified: / 04-08-2011 / 21:31:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
280 |
! |
|
281 |
||
282 |
updateVisibility |
|
283 |
||
10480 | 284 |
self ruleHolder value notNil |
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
285 |
ifTrue:[self show] |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
286 |
ifFalse:[self hide] |
10473 | 287 |
|
288 |
"Created: / 04-08-2011 / 16:39:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
289 |
! ! |
|
290 |
||
10500 | 291 |
!LintRuleDetail methodsFor:'initialization'! |
292 |
||
293 |
setupHTMLView:aView |
|
294 |
aView painter |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
295 |
leftMargin:20; |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
296 |
topMargin:5. |
10500 | 297 |
|
298 |
"Created: / 04-08-2011 / 18:00:36 / cg" |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
299 |
|
10500 | 300 |
! ! |
301 |
||
10473 | 302 |
!LintRuleDetail methodsFor:'private'! |
303 |
||
304 |
hide |
|
305 |
||
306 |
self visibility: false height: 0 |
|
307 |
||
308 |
"Created: / 11-03-2010 / 09:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
309 |
! |
|
310 |
||
311 |
show |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
312 |
|
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
313 |
self visibility: true height: (self rationaleVisibleHolder value ifTrue:[130] ifFalse:[30]) |
10473 | 314 |
|
315 |
"Created: / 11-03-2010 / 09:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
316 |
! |
|
317 |
||
318 |
visibility: visibility height: height |
|
319 |
| container list detail h | |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
320 |
(container := self window container) ifNil:[^self]. |
10473 | 321 |
h := visibility ifFalse:[0] ifTrue:[height]. |
322 |
||
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
323 |
container isVisible == visibility ifFalse: |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
324 |
[container isVisible: visibility]. |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
325 |
|
10473 | 326 |
|
327 |
list := container container subViews first. |
|
328 |
detail := container container subViews second. |
|
329 |
||
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
330 |
(list layout bottomOffset ~= height negated) ifTrue: |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
331 |
[list layout: |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
332 |
(list layout bottomOffset: height negated; yourself)]. |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
333 |
(detail layout topOffset ~= height negated) ifTrue: |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
334 |
[detail layout: |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
335 |
(detail layout topOffset: height negated; yourself)]. |
10473 | 336 |
|
337 |
"Created: / 11-03-2010 / 09:51:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10480 | 338 |
! ! |
10473 | 339 |
|
9999 | 340 |
!LintRuleDetail class methodsFor:'documentation'! |
341 |
||
342 |
version_CVS |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
343 |
^ '§Header: /cvs/stx/stx/libtool/Tools__LintRuleDetail.st,v 1.6 2011/08/05 12:36:26 vrany Exp §' |
9999 | 344 |
! |
345 |
||
346 |
version_SVN |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
347 |
^ '$Id: Tools__LintRuleDetail.st 7617 2010-08-25 12:56:19Z vranyj1 $' |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10673
diff
changeset
|
348 |
! ! |