author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 31 May 2018 10:52:50 +0100 | |
branch | jv |
changeset 4330 | 998eb03f0736 |
parent 3011 | 1997ff6e7e55 |
permissions | -rw-r--r-- |
1443 | 1 |
" |
2 |
COPYRIGHT (c) 2003 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 |
||
1266 | 13 |
"{ Package: 'stx:libbasic3' }" |
14 |
||
15 |
"{ NameSpace: Packages }" |
|
16 |
||
17 |
AbstractPackageBrowser subclass:#AbstractPackageNotebookApplication |
|
18 |
instanceVariableNames:'selectedTabHolder canvasHolder tabListHolder tabApplications' |
|
19 |
classVariableNames:'' |
|
20 |
poolDictionaries:'' |
|
21 |
category:'Package-Application' |
|
22 |
! |
|
23 |
||
1443 | 24 |
!AbstractPackageNotebookApplication class methodsFor:'documentation'! |
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 2003 by eXept Software AG |
|
29 |
All Rights Reserved |
|
30 |
||
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! ! |
|
1266 | 39 |
|
40 |
!AbstractPackageNotebookApplication class methodsFor:'constant values'! |
|
41 |
||
42 |
applicationName |
|
43 |
^ 'No name' asSymbol |
|
44 |
! ! |
|
45 |
||
46 |
!AbstractPackageNotebookApplication class methodsFor:'defaults'! |
|
47 |
||
48 |
tabsNames |
|
49 |
^ self tabsNamesAndClasses keys asOrderedCollection sort:[:x :y | |
|
50 |
x < y |
|
51 |
] |
|
52 |
||
53 |
"/ ^ #( |
|
54 |
"/ #(#'Classes' #Classes) |
|
55 |
"/ #(#'Loose Methods' #LooseMethod) |
|
56 |
"/ #(#'Scripts' #Scripts) |
|
57 |
"/ #(#'Prerequisites' #Prerequisites) |
|
58 |
"/ #(#'Comment' #Comment) |
|
59 |
"/ ). |
|
60 |
! |
|
61 |
||
62 |
tabsNamesAndClasses |
|
63 |
| dic | |
|
64 |
dic := Dictionary new. |
|
65 |
||
66 |
self privateClasses do:[:aPrivateClass | |
|
67 |
dic at:aPrivateClass applicationName put:aPrivateClass name |
|
68 |
]. |
|
69 |
^ dic |
|
70 |
||
71 |
"/ ^ #( |
|
72 |
"/ #(#'Classes' #Classes) |
|
73 |
"/ #(#'Loose Methods' #LooseMethod) |
|
74 |
"/ #(#'Scripts' #Scripts) |
|
75 |
"/ #(#'Prerequisites' #Prerequisites) |
|
76 |
"/ #(#'Comment' #Comment) |
|
77 |
"/ ). |
|
78 |
! ! |
|
79 |
||
80 |
!AbstractPackageNotebookApplication class methodsFor:'interface specs'! |
|
81 |
||
82 |
windowSpec |
|
83 |
"This resource specification was automatically generated |
|
84 |
by the UIPainter of ST/X." |
|
85 |
||
86 |
"Do not manually edit this!! If it is corrupted, |
|
87 |
the UIPainter may not be able to read the specification." |
|
88 |
||
89 |
" |
|
1279 | 90 |
UIPainter new openOnClass:Packages::AbstractPackageNotebookApplication andSelector:#windowSpec |
91 |
Packages::AbstractPackageNotebookApplication new openInterface:#windowSpec |
|
92 |
Packages::AbstractPackageNotebookApplication open |
|
1266 | 93 |
" |
94 |
||
95 |
<resource: #canvas> |
|
96 |
||
97 |
^ |
|
98 |
#(#FullSpec |
|
99 |
#name: #windowSpec |
|
100 |
#window: |
|
101 |
#(#WindowSpec |
|
102 |
#label: 'Packages::PackageDetails' |
|
103 |
#name: 'Packages::PackageDetails' |
|
104 |
#min: #(#Point 10 10) |
|
105 |
#max: #(#Point 1024 768) |
|
106 |
#bounds: #(#Rectangle 29 59 329 359) |
|
107 |
) |
|
108 |
#component: |
|
109 |
#(#SpecCollection |
|
110 |
#collection: #( |
|
111 |
#(#NoteBookViewSpec |
|
112 |
#name: 'PackageDetailsNotebook' |
|
113 |
#layout: #(#LayoutFrame 0 0 0 0 0 1 0 1) |
|
114 |
#model: #selectedTabHolder |
|
115 |
#menu: #tabListHolder |
|
116 |
#selectConditionBlock: #packageDetailsChangeToTabNumber: |
|
117 |
#canvas: #canvasHolder |
|
118 |
#postBuildCallback: #selectInitialTab |
|
119 |
) |
|
120 |
) |
|
121 |
||
122 |
) |
|
123 |
) |
|
124 |
! ! |
|
125 |
||
126 |
!AbstractPackageNotebookApplication class methodsFor:'plugIn spec'! |
|
127 |
||
128 |
aspectSelectors |
|
129 |
"This resource specification was automatically generated |
|
130 |
by the UIPainter of ST/X." |
|
131 |
||
132 |
"Do not manually edit this. If it is corrupted, |
|
133 |
the UIPainter may not be able to read the specification." |
|
134 |
||
135 |
"Return a description of exported aspects; |
|
136 |
these can be connected to aspects of an embedding application |
|
137 |
(if this app is embedded in a subCanvas)." |
|
138 |
||
139 |
^ #( |
|
140 |
#list |
|
141 |
#selectionHolder |
|
142 |
). |
|
143 |
||
144 |
! ! |
|
145 |
||
146 |
!AbstractPackageNotebookApplication methodsFor:'accessing'! |
|
147 |
||
148 |
selectedTab:aSymbol |
|
149 |
^ self selectedTabHolder value:aSymbol |
|
150 |
! |
|
151 |
||
152 |
tabApplications |
|
153 |
"return the value of the instance variable 'tabApplications' (automatically generated)" |
|
154 |
tabApplications ifNil:[ |
|
155 |
tabApplications := Dictionary new |
|
156 |
]. |
|
157 |
^ tabApplications |
|
158 |
! |
|
159 |
||
160 |
tabApplications:something |
|
161 |
"set the value of the instance variable 'tabApplications' (automatically generated)" |
|
162 |
||
163 |
tabApplications := something. |
|
164 |
! ! |
|
165 |
||
166 |
!AbstractPackageNotebookApplication methodsFor:'actions'! |
|
167 |
||
168 |
packageDetailsChangeToTabNamed:aSymbol |
|
169 |
"return a boolean validating if you can change the current selected |
|
170 |
tab to the tab represented by aSymbol" |
|
171 |
aSymbol == self selectedTab ifTrue:[ |
|
172 |
^ self. "do nothing... dont think this can happen |
|
173 |
but it means that the #validateChangeTo: methods do not need this check!!" |
|
174 |
]. |
|
175 |
^ (self instanceAtTab:self selectedTab) validateCanChange:(self instanceAtTab:aSymbol) |
|
176 |
! |
|
177 |
||
178 |
packageDetailsChangeToTabNumber:anInteger |
|
179 |
"return a boolean validating if you can change the current selected |
|
180 |
tab to the tab represented by anInteger" |
|
181 |
^ self packageDetailsChangeToTabNamed:(self tabListHolder value at:anInteger) |
|
182 |
! |
|
183 |
||
184 |
selectInitialTab |
|
185 |
self selectedTab:self tabListHolder value first. |
|
186 |
! ! |
|
187 |
||
188 |
!AbstractPackageNotebookApplication methodsFor:'aspects'! |
|
189 |
||
190 |
canvasHolder |
|
191 |
"automatically generated by UIPainter ..." |
|
192 |
||
193 |
"*** the code below creates a default model when invoked." |
|
194 |
"*** (which may not be the one you wanted)" |
|
195 |
"*** Please change as required and accept it in the browser." |
|
196 |
"*** (and replace this comment by something more useful ;-)" |
|
197 |
||
198 |
canvasHolder isNil ifTrue:[ |
|
199 |
canvasHolder := ValueHolder with:(SubCanvas new) . |
|
200 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
201 |
"/ canvasHolder addDependent:self. |
|
202 |
"/ canvasHolder onChangeSend:#canvasHolderChanged to:self. |
|
203 |
]. |
|
204 |
^ canvasHolder. |
|
205 |
! |
|
206 |
||
207 |
selectedTab |
|
208 |
^ selectedTabHolder value |
|
209 |
! |
|
210 |
||
211 |
selectedTabHolder |
|
212 |
||
213 |
selectedTabHolder isNil ifTrue:[ |
|
214 |
selectedTabHolder := ValueHolder new. |
|
215 |
selectedTabHolder addDependent:self. |
|
216 |
selectedTabHolder onChangeSend:#selectedTabHolderChanged to:self. |
|
217 |
]. |
|
218 |
^ selectedTabHolder. |
|
219 |
! |
|
220 |
||
221 |
tabListHolder |
|
222 |
"holds the names of the tab in a tabList" |
|
223 |
tabListHolder isNil ifTrue:[ |
|
224 |
tabListHolder := ValueHolder with:(self class tabsNames). |
|
225 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
226 |
"/ tabList addDependent:self. |
|
227 |
"/ tabList onChangeSend:#tabListChanged to:self. |
|
228 |
]. |
|
229 |
^ tabListHolder. |
|
230 |
! ! |
|
231 |
||
232 |
!AbstractPackageNotebookApplication methodsFor:'changes'! |
|
233 |
||
234 |
selectedTabHolderChanged |
|
235 |
| instance | |
|
236 |
instance := self instanceAtTab:self selectedTab. |
|
237 |
||
238 |
instance ifNil:[ |
|
239 |
^ self |
|
240 |
]. |
|
241 |
self canvasHolder value client:(instance). |
|
242 |
! |
|
243 |
||
244 |
updateWithPackages:packages |
|
245 |
! ! |
|
246 |
||
247 |
!AbstractPackageNotebookApplication methodsFor:'factory'! |
|
248 |
||
249 |
applicationClassAt:aSymbol |
|
250 |
^ Smalltalk classNamed:(self class tabsNamesAndClasses at:aSymbol). |
|
251 |
||
252 |
||
253 |
||
254 |
||
255 |
||
256 |
||
257 |
||
258 |
! |
|
259 |
||
260 |
instanceAtTab:aSymbol |
|
261 |
| anInstance | |
|
262 |
^ self tabApplications at:aSymbol ifAbsentPut:[ |
|
263 |
anInstance := (self applicationClassAt:aSymbol) new. |
|
264 |
anInstance masterApplication:self. |
|
265 |
anInstance |
|
266 |
]. |
|
267 |
! ! |
|
268 |
||
269 |
!AbstractPackageNotebookApplication methodsFor:'initialization & release'! |
|
270 |
||
271 |
closeDownViews |
|
272 |
"This is a hook method generated by the Browser. |
|
273 |
It will be invoked when your app/dialog-window is really closed. |
|
274 |
See also #closeDownViews, which is invoked before and may suppress the close |
|
275 |
or ask the user for confirmation." |
|
276 |
||
277 |
"/ change the code below as required ... |
|
278 |
"/ This should cleanup any leftover resources |
|
279 |
"/ (for example, temporary files) |
|
280 |
"/ super closeRequest will initiate the closeDown |
|
281 |
||
282 |
"/ add your code here |
|
283 |
||
284 |
"/ do not remove the one below ... |
|
285 |
^ super closeDownViews |
|
286 |
! |
|
287 |
||
288 |
closeRequest |
|
289 |
^ super closeRequest |
|
290 |
! |
|
291 |
||
292 |
postBuildWith:aBuilder |
|
293 |
"This is a hook method generated by the Browser. |
|
294 |
It will be invoked during the initialization of your app/dialog, |
|
295 |
after all of the visual components have been built, |
|
296 |
but BEFORE the top window is made visible. |
|
297 |
Add any app-specific actions here (reading files, setting up values etc.) |
|
298 |
See also #postOpenWith:, which is invoked after opening." |
|
299 |
||
300 |
"/ add any code here ... |
|
301 |
^ super postBuildWith:aBuilder |
|
302 |
! |
|
303 |
||
304 |
postOpenWith:aBuilder |
|
305 |
"This is a hook method generated by the Browser. |
|
306 |
It will be invoked right after the applications window has been opened. |
|
307 |
Add any app-specific actions here (starting background processes etc.). |
|
308 |
See also #postBuildWith:, which is invoked before opening." |
|
309 |
||
310 |
"/ add any code here ... |
|
311 |
^ super postOpenWith:aBuilder |
|
312 |
! ! |
|
313 |
||
314 |
!AbstractPackageNotebookApplication class methodsFor:'documentation'! |
|
315 |
||
316 |
version |
|
3011
1997ff6e7e55
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1443
diff
changeset
|
317 |
^ '$Header: /var/local/cvs/stx/libbasic3/packages/AbstractPackageNotebookApplication.st,v 1.3 2006-01-10 09:25:10 cg Exp $' |
1266 | 318 |
! ! |