author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 29 Jan 2012 12:53:39 +0000 | |
branch | jv |
changeset 12123 | 4bde08cebd48 |
parent 10873 | cd3237d1d83b |
child 12125 | 0c49a3b13e43 |
permissions | -rw-r--r-- |
9967 | 1 |
" |
10066 | 2 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
9967 | 3 |
All Rights Reserved |
4 |
||
10066 | 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. |
|
9967 | 25 |
" |
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
"{ NameSpace: Tools }" |
|
29 |
||
30 |
ApplicationModel subclass:#WebBrowserPage |
|
31 |
instanceVariableNames:'history webKitView urlHolder titleHolder bookmarkHolder |
|
32 |
toolBarVisibleHolder bookmarkBarVisibleHolder' |
|
33 |
classVariableNames:'' |
|
34 |
poolDictionaries:'' |
|
35 |
category:'Interface-Browsers-Web' |
|
36 |
! |
|
37 |
||
38 |
!WebBrowserPage class methodsFor:'documentation'! |
|
39 |
||
40 |
copyright |
|
41 |
" |
|
10066 | 42 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
9967 | 43 |
All Rights Reserved |
44 |
||
10066 | 45 |
Permission is hereby granted, free of charge, to any person |
46 |
obtaining a copy of this software and associated documentation |
|
47 |
files (the 'Software'), to deal in the Software without |
|
48 |
restriction, including without limitation the rights to use, |
|
49 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
50 |
copies of the Software, and to permit persons to whom the |
|
51 |
Software is furnished to do so, subject to the following |
|
52 |
conditions: |
|
53 |
||
54 |
The above copyright notice and this permission notice shall be |
|
55 |
included in all copies or substantial portions of the Software. |
|
56 |
||
57 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
58 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
59 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
60 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
61 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
62 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
63 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
64 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9967 | 65 |
" |
66 |
! ! |
|
67 |
||
68 |
!WebBrowserPage class methodsFor:'image specs'! |
|
69 |
||
70 |
hideToolBarIcon |
|
71 |
||
72 |
<resource: #image> |
|
73 |
||
74 |
^ToolbarIconLibrary hideToolbarIcon |
|
75 |
||
76 |
"Created: / 08-06-2011 / 12:09:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
77 |
! ! |
|
78 |
||
79 |
!WebBrowserPage class methodsFor:'interface specs'! |
|
80 |
||
10567 | 81 |
contentSpec |
82 |
"This resource specification was automatically generated |
|
83 |
by the UIPainter of ST/X." |
|
84 |
||
85 |
"Do not manually edit this!! If it is corrupted, |
|
86 |
the UIPainter may not be able to read the specification." |
|
87 |
||
88 |
" |
|
89 |
UIPainter new openOnClass:Tools::WebBrowserPage andSelector:#contentSpec |
|
90 |
Tools::WebBrowserPage new openInterface:#contentSpec |
|
91 |
" |
|
92 |
||
93 |
<resource: #canvas> |
|
94 |
||
95 |
^ |
|
96 |
#(FullSpec |
|
97 |
name: contentSpec |
|
98 |
window: |
|
99 |
(WindowSpec |
|
100 |
label: 'NewApplication' |
|
101 |
name: 'NewApplication' |
|
102 |
bounds: (Rectangle 0 0 300 300) |
|
103 |
) |
|
104 |
component: |
|
105 |
(SpecCollection |
|
106 |
collection: ( |
|
107 |
(NonScrollableArbitraryComponentSpec |
|
108 |
name: 'Content' |
|
109 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
110 |
component: webKitView |
|
111 |
) |
|
112 |
) |
|
113 |
||
114 |
) |
|
115 |
) |
|
116 |
! |
|
117 |
||
9967 | 118 |
toolBarSpec |
119 |
"This resource specification was automatically generated |
|
120 |
by the UIPainter of ST/X." |
|
121 |
||
122 |
"Do not manually edit this!! If it is corrupted, |
|
123 |
the UIPainter may not be able to read the specification." |
|
124 |
||
125 |
" |
|
126 |
UIPainter new openOnClass:Tools::WebBrowserPage andSelector:#toolBarSpec |
|
127 |
Tools::WebBrowserPage new openInterface:#toolBarSpec |
|
128 |
" |
|
129 |
||
130 |
<resource: #canvas> |
|
131 |
||
132 |
^ |
|
133 |
#(FullSpec |
|
134 |
name: toolBarSpec |
|
135 |
window: |
|
136 |
(WindowSpec |
|
137 |
label: 'Tool Bar' |
|
138 |
name: 'Tool Bar' |
|
139 |
min: (Point 10 10) |
|
140 |
bounds: (Rectangle 0 0 300 30) |
|
141 |
) |
|
142 |
component: |
|
143 |
(SpecCollection |
|
144 |
collection: ( |
|
145 |
(MenuPanelSpec |
|
146 |
name: 'ToolBarMenu' |
|
147 |
layout: (LayoutFrame 0 0.0 0 0.0 100 0.0 0 1.0) |
|
148 |
level: 0 |
|
149 |
menu: toolBarMenu |
|
150 |
textDefault: true |
|
151 |
) |
|
152 |
(ViewSpec |
|
153 |
name: 'URLPanel' |
|
154 |
layout: (LayoutFrame 100 0.0 0 0 0 1 0 1) |
|
155 |
level: 0 |
|
156 |
component: |
|
157 |
(SpecCollection |
|
158 |
collection: ( |
|
159 |
(InputFieldSpec |
|
160 |
name: 'URLFIeld' |
|
161 |
layout: (LayoutFrame 2 0 5 0 -2 1 -3 1) |
|
162 |
model: urlHolder |
|
163 |
acceptOnLeave: false |
|
164 |
acceptOnReturn: true |
|
165 |
acceptOnTab: false |
|
166 |
acceptOnPointerLeave: false |
|
167 |
acceptIfUnchanged: true |
|
168 |
) |
|
169 |
) |
|
170 |
||
171 |
) |
|
172 |
) |
|
173 |
) |
|
174 |
||
175 |
) |
|
176 |
) |
|
177 |
! |
|
178 |
||
179 |
windowSpec |
|
180 |
"This resource specification was automatically generated |
|
181 |
by the UIPainter of ST/X." |
|
182 |
||
183 |
"Do not manually edit this!! If it is corrupted, |
|
184 |
the UIPainter may not be able to read the specification." |
|
185 |
||
186 |
" |
|
187 |
UIPainter new openOnClass:Tools::WebBrowserPage andSelector:#windowSpec |
|
188 |
Tools::WebBrowserPage new openInterface:#windowSpec |
|
189 |
Tools::WebBrowserPage open |
|
190 |
" |
|
191 |
||
192 |
<resource: #canvas> |
|
193 |
||
194 |
^ |
|
195 |
#(FullSpec |
|
196 |
name: windowSpec |
|
197 |
window: |
|
198 |
(WindowSpec |
|
199 |
label: 'Web Browser Page' |
|
200 |
name: 'Web Browser Page' |
|
201 |
labelChannel: titleHolder |
|
202 |
min: (Point 10 10) |
|
203 |
bounds: (Rectangle 0 0 707 516) |
|
204 |
) |
|
205 |
component: |
|
206 |
(SpecCollection |
|
207 |
collection: ( |
|
208 |
(ViewSpec |
|
209 |
name: 'ToolBar' |
|
210 |
layout: (LayoutFrame 0 0 0 0 0 1 40 0) |
|
211 |
level: 0 |
|
212 |
visibilityChannel: toolBarVisibleHolder |
|
213 |
component: |
|
214 |
(SpecCollection |
|
215 |
collection: ( |
|
216 |
(ActionButtonSpec |
|
217 |
label: 'hideToolBarIcon' |
|
218 |
name: 'HideToolBarButton' |
|
219 |
layout: (LayoutFrame 0 0 0 0 13 0 0 1) |
|
220 |
activeHelpKey: hideToolBar |
|
221 |
level: 0 |
|
222 |
hasCharacterOrientedLabel: false |
|
223 |
translateLabel: true |
|
224 |
model: hideToolbar |
|
225 |
) |
|
226 |
(UISubSpecification |
|
227 |
name: 'ToolBarSpec' |
|
228 |
layout: (LayoutFrame 13 0 0 0 0 1 0 1) |
|
229 |
minorKey: toolBarSpec |
|
230 |
) |
|
231 |
) |
|
232 |
||
233 |
) |
|
234 |
) |
|
235 |
(ViewSpec |
|
236 |
name: 'BookmarkBar' |
|
237 |
layout: (LayoutFrame 0 0 40 0 0 1 66 0) |
|
238 |
visibilityChannel: bookmarkBarVisibleHolder |
|
239 |
component: |
|
240 |
(SpecCollection |
|
241 |
collection: ( |
|
242 |
(ActionButtonSpec |
|
243 |
label: 'hideToolBarIcon' |
|
244 |
name: 'Button1' |
|
245 |
layout: (LayoutFrame 0 0 0 0 13 0 0 1) |
|
246 |
activeHelpKey: hideToolBar |
|
247 |
level: 0 |
|
248 |
hasCharacterOrientedLabel: false |
|
249 |
translateLabel: true |
|
250 |
model: hideBookmarkBar |
|
251 |
) |
|
252 |
(SubCanvasSpec |
|
253 |
name: 'Bookmarks' |
|
254 |
layout: (LayoutFrame 13 0 3 0 0 1 -3 1) |
|
255 |
level: 0 |
|
256 |
hasHorizontalScrollBar: false |
|
257 |
hasVerticalScrollBar: false |
|
258 |
miniScrollerHorizontal: false |
|
259 |
majorKey: BookmarkBar |
|
260 |
subAspectHolders: |
|
261 |
(Array |
|
262 |
||
263 |
(SubChannelInfoSpec |
|
264 |
subAspect: bookmarkHolder |
|
265 |
aspect: bookmarkHolder |
|
266 |
) |
|
267 |
(SubChannelInfoSpec |
|
268 |
subAspect: bookmarksHolder |
|
269 |
aspect: bookmarkListHolder |
|
270 |
) |
|
271 |
) |
|
272 |
createNewApplication: true |
|
273 |
createNewBuilder: true |
|
274 |
) |
|
275 |
) |
|
276 |
||
277 |
) |
|
278 |
) |
|
10567 | 279 |
(UISubSpecification |
280 |
name: 'Content' |
|
9967 | 281 |
layout: (LayoutFrame 0 0 67 0 0 1 0 1) |
10567 | 282 |
minorKey: contentSpec |
9967 | 283 |
) |
284 |
) |
|
285 |
||
286 |
) |
|
287 |
) |
|
288 |
! ! |
|
289 |
||
290 |
!WebBrowserPage class methodsFor:'menu specs'! |
|
291 |
||
292 |
toolBarMenu |
|
293 |
"This resource specification was automatically generated |
|
294 |
by the MenuEditor of ST/X." |
|
295 |
||
296 |
"Do not manually edit this!! If it is corrupted, |
|
297 |
the MenuEditor may not be able to read the specification." |
|
298 |
||
299 |
" |
|
300 |
MenuEditor new openOnClass:Tools::WebBrowserPage andSelector:#toolBarMenu |
|
301 |
(Menu new fromLiteralArrayEncoding:(Tools::WebBrowserPage toolBarMenu)) startUp |
|
302 |
" |
|
303 |
||
304 |
<resource: #menu> |
|
305 |
||
306 |
^ |
|
307 |
#(Menu |
|
308 |
( |
|
309 |
(MenuItem |
|
310 |
enabled: canGoBackAspect |
|
311 |
label: 'Back' |
|
312 |
itemValue: goBack |
|
313 |
translateLabel: true |
|
314 |
isButton: true |
|
315 |
submenuChannel: goBackMenu |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10873
diff
changeset
|
316 |
labelImage: (ResourceRetriever XPToolbarIconLibrary historyBackIcon) |
9967 | 317 |
) |
318 |
(MenuItem |
|
319 |
enabled: canGoForwardAspect |
|
320 |
label: 'Forward' |
|
321 |
itemValue: goForward |
|
322 |
translateLabel: true |
|
323 |
isButton: true |
|
324 |
submenuChannel: goForwardMenu |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10873
diff
changeset
|
325 |
labelImage: (ResourceRetriever XPToolbarIconLibrary historyForwardIcon) |
9967 | 326 |
) |
327 |
) |
|
328 |
nil |
|
329 |
nil |
|
330 |
) |
|
331 |
! ! |
|
332 |
||
10567 | 333 |
!WebBrowserPage class methodsFor:'plugIn spec'! |
334 |
||
335 |
aspectSelectors |
|
336 |
"This resource specification was automatically generated |
|
337 |
by the UIPainter of ST/X." |
|
338 |
||
339 |
"Do not manually edit this. If it is corrupted, |
|
340 |
the UIPainter may not be able to read the specification." |
|
341 |
||
342 |
"Return a description of exported aspects; |
|
343 |
these can be connected to aspects of an embedding application |
|
344 |
(if this app is embedded in a subCanvas)." |
|
345 |
||
346 |
^ #( |
|
347 |
#urlHolder |
|
348 |
). |
|
349 |
||
350 |
! ! |
|
351 |
||
9967 | 352 |
!WebBrowserPage methodsFor:'actions'! |
353 |
||
354 |
hideBookmarkBar |
|
355 |
<resource: #uiCallback> |
|
356 |
||
357 |
self bookmarkBarVisibleHolder value: false |
|
358 |
||
359 |
"Modified: / 10-06-2011 / 23:57:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
360 |
! |
|
361 |
||
362 |
hideToolbar |
|
363 |
<resource: #uiCallback> |
|
364 |
||
365 |
self toolBarVisibleHolder value: false. |
|
366 |
||
367 |
"Modified: / 10-06-2011 / 23:58:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
368 |
! |
|
369 |
||
370 |
switchToBookmarkEntry: bookmark |
|
371 |
||
372 |
||
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10873
diff
changeset
|
373 |
self bookmarkHolder value: bookmark. |
9967 | 374 |
history goTo: bookmark. |
375 |
self urlHolder value: bookmark url. |
|
376 |
||
377 |
"Created: / 16-06-2011 / 16:10:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
378 |
! ! |
|
379 |
||
380 |
!WebBrowserPage methodsFor:'aspects'! |
|
381 |
||
382 |
bookmarkBarVisibleHolder |
|
383 |
"return/create the 'bookmarkBarVisibleHolder' value holder (automatically generated)" |
|
384 |
||
385 |
bookmarkBarVisibleHolder isNil ifTrue:[ |
|
386 |
bookmarkBarVisibleHolder := true asValue. |
|
387 |
bookmarkBarVisibleHolder addDependent:self. |
|
388 |
]. |
|
389 |
^ bookmarkBarVisibleHolder |
|
390 |
||
391 |
"Modified: / 10-06-2011 / 23:56:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
392 |
! |
|
393 |
||
394 |
bookmarkBarVisibleHolder:something |
|
395 |
"set the 'bookmarkBarVisibleHolder' value holder (automatically generated)" |
|
396 |
||
397 |
|oldValue newValue| |
|
398 |
||
399 |
bookmarkBarVisibleHolder notNil ifTrue:[ |
|
400 |
oldValue := bookmarkBarVisibleHolder value. |
|
401 |
bookmarkBarVisibleHolder removeDependent:self. |
|
402 |
]. |
|
403 |
bookmarkBarVisibleHolder := something. |
|
404 |
bookmarkBarVisibleHolder notNil ifTrue:[ |
|
405 |
bookmarkBarVisibleHolder addDependent:self. |
|
406 |
]. |
|
407 |
newValue := bookmarkBarVisibleHolder value. |
|
408 |
oldValue ~~ newValue ifTrue:[ |
|
409 |
self update:#value with:newValue from:bookmarkBarVisibleHolder. |
|
410 |
]. |
|
411 |
! |
|
412 |
||
413 |
bookmarkHolder |
|
414 |
"return/create the 'bookmarkHolder' value holder (automatically generated)" |
|
415 |
||
416 |
bookmarkHolder isNil ifTrue:[ |
|
417 |
bookmarkHolder := ValueHolder new. |
|
418 |
]. |
|
419 |
^ bookmarkHolder |
|
420 |
! |
|
421 |
||
422 |
bookmarkListHolder |
|
423 |
||
424 |
^BookmarkList forWebBrowser |
|
425 |
||
426 |
"Created: / 08-06-2011 / 12:16:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
427 |
! |
|
428 |
||
429 |
titleHolder |
|
430 |
"return/create the 'titleHolder' value holder (automatically generated)" |
|
431 |
||
432 |
titleHolder isNil ifTrue:[ |
|
433 |
titleHolder := ValueHolder new. |
|
434 |
titleHolder addDependent:self. |
|
435 |
]. |
|
436 |
^ titleHolder |
|
437 |
! |
|
438 |
||
439 |
titleHolder:something |
|
440 |
"set the 'titleHolder' value holder (automatically generated)" |
|
441 |
||
442 |
|oldValue newValue| |
|
443 |
||
444 |
titleHolder notNil ifTrue:[ |
|
445 |
oldValue := titleHolder value. |
|
446 |
titleHolder removeDependent:self. |
|
447 |
]. |
|
448 |
titleHolder := something. |
|
449 |
self webKitView title: titleHolder. |
|
450 |
titleHolder notNil ifTrue:[ |
|
451 |
titleHolder addDependent:self. |
|
452 |
]. |
|
453 |
newValue := titleHolder value. |
|
454 |
oldValue ~~ newValue ifTrue:[ |
|
455 |
self update:#value with:newValue from:titleHolder. |
|
456 |
]. |
|
457 |
||
458 |
"Modified: / 08-06-2011 / 14:51:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
459 |
! |
|
460 |
||
461 |
toolBarVisibleHolder |
|
462 |
"return/create the 'toolBarVisibleHolder' value holder (automatically generated)" |
|
463 |
||
464 |
toolBarVisibleHolder isNil ifTrue:[ |
|
465 |
toolBarVisibleHolder := true asValue. |
|
466 |
toolBarVisibleHolder addDependent:self. |
|
467 |
]. |
|
468 |
^ toolBarVisibleHolder |
|
469 |
||
470 |
"Modified: / 10-06-2011 / 23:57:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
471 |
! |
|
472 |
||
473 |
toolBarVisibleHolder:something |
|
474 |
"set the 'toolBarVisibleHolder' value holder (automatically generated)" |
|
475 |
||
476 |
|oldValue newValue| |
|
477 |
||
478 |
toolBarVisibleHolder notNil ifTrue:[ |
|
479 |
oldValue := toolBarVisibleHolder value. |
|
480 |
toolBarVisibleHolder removeDependent:self. |
|
481 |
]. |
|
482 |
toolBarVisibleHolder := something. |
|
483 |
toolBarVisibleHolder notNil ifTrue:[ |
|
484 |
toolBarVisibleHolder addDependent:self. |
|
485 |
]. |
|
486 |
newValue := toolBarVisibleHolder value. |
|
487 |
oldValue ~~ newValue ifTrue:[ |
|
488 |
self update:#value with:newValue from:toolBarVisibleHolder. |
|
489 |
]. |
|
490 |
! |
|
491 |
||
492 |
urlHolder |
|
493 |
"return/create the 'urlHolder' value holder (automatically generated)" |
|
494 |
||
495 |
urlHolder isNil ifTrue:[ |
|
496 |
urlHolder := 'http://google.com' asValue. |
|
497 |
urlHolder addDependent:self. |
|
498 |
]. |
|
499 |
^ urlHolder |
|
500 |
||
501 |
"Modified: / 08-06-2011 / 15:06:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
502 |
! |
|
503 |
||
504 |
urlHolder:something |
|
505 |
"set the 'urlHolder' value holder (automatically generated)" |
|
506 |
||
507 |
|oldValue newValue| |
|
508 |
||
509 |
urlHolder notNil ifTrue:[ |
|
510 |
oldValue := urlHolder value. |
|
511 |
urlHolder removeDependent:self. |
|
512 |
]. |
|
513 |
urlHolder := something. |
|
514 |
self webKitView url: urlHolder. |
|
515 |
urlHolder notNil ifTrue:[ |
|
516 |
urlHolder addDependent:self. |
|
517 |
]. |
|
518 |
newValue := urlHolder value. |
|
519 |
oldValue ~~ newValue ifTrue:[ |
|
520 |
self update:#value with:newValue from:urlHolder. |
|
521 |
]. |
|
522 |
||
523 |
"Modified: / 08-06-2011 / 14:27:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
524 |
! |
|
525 |
||
526 |
webKitView |
|
527 |
||
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10873
diff
changeset
|
528 |
webKitView ifNil:[ |
9967 | 529 |
webKitView := WebKitView new |
530 |
url: self urlHolder; |
|
531 |
title: self titleHolder; |
|
532 |
||
533 |
yourself. |
|
534 |
]. |
|
535 |
^webKitView. |
|
536 |
||
537 |
"Created: / 07-06-2011 / 22:50:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
538 |
"Modified: / 08-06-2011 / 14:26:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
539 |
! ! |
|
540 |
||
541 |
!WebBrowserPage methodsFor:'aspects-queries'! |
|
542 |
||
543 |
canGoBackAspect |
|
544 |
||
545 |
^(AspectAdaptor forAspect:#canGoBack) |
|
546 |
subjectChannel: history; |
|
547 |
yourself. |
|
548 |
||
549 |
"Modified: / 21-07-2009 / 22:39:57 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
550 |
"Created: / 01-09-2009 / 22:38:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
551 |
"Modified: / 08-06-2011 / 12:36:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
552 |
! |
|
553 |
||
554 |
canGoForwardAspect |
|
555 |
||
556 |
||
557 |
^(AspectAdaptor forAspect:#canGoForward) |
|
558 |
subjectChannel: history; |
|
559 |
yourself. |
|
560 |
||
561 |
"Modified: / 21-07-2009 / 22:39:57 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
562 |
"Created: / 01-09-2009 / 22:39:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
563 |
"Modified: / 08-06-2011 / 12:36:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
564 |
! ! |
|
565 |
||
566 |
!WebBrowserPage methodsFor:'change & update'! |
|
567 |
||
568 |
update:something with:aParameter from:changedObject |
|
569 |
"Invoked when an object that I depend upon sends a change notification." |
|
570 |
||
571 |
"stub code automatically generated - please change as required" |
|
572 |
||
573 |
changedObject == urlHolder ifTrue:[ |
|
574 |
self updateBookmark. |
|
575 |
^ self. |
|
576 |
]. |
|
577 |
changedObject == titleHolder ifTrue:[ |
|
578 |
self updateBookmark. |
|
579 |
^ self. |
|
580 |
]. |
|
581 |
changedObject == toolBarVisibleHolder ifTrue:[ |
|
582 |
self updateToollBarAndBookmarkBarVisibility. |
|
583 |
^ self. |
|
584 |
]. |
|
585 |
changedObject == bookmarkBarVisibleHolder ifTrue:[ |
|
586 |
self updateToollBarAndBookmarkBarVisibility. |
|
587 |
^ self. |
|
588 |
]. |
|
589 |
||
590 |
||
591 |
||
592 |
super update:something with:aParameter from:changedObject |
|
593 |
||
594 |
"Modified: / 10-06-2011 / 23:53:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
595 |
! |
|
596 |
||
597 |
updateBookmark |
|
598 |
||
599 |
| url title bookmark | |
|
600 |
url := self urlHolder value. |
|
601 |
title := self titleHolder value. |
|
602 |
||
603 |
((bookmark := self bookmarkHolder value) notNil and:[bookmark url = url]) ifTrue:[ |
|
604 |
self bookmarkHolder value label: title. |
|
605 |
] ifFalse:[ |
|
606 |
self bookmarkHolder value: (Bookmark forUrl: url label: title). |
|
607 |
history goTo: self bookmarkHolder value |
|
608 |
] |
|
609 |
||
610 |
"Created: / 08-06-2011 / 12:19:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
611 |
"Modified: / 08-06-2011 / 14:55:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
612 |
! |
|
613 |
||
614 |
updateToollBarAndBookmarkBarVisibility |
|
615 |
|toolBarVisible toolBar bookmarkBarVisible bookmarkBar pageContent topOffset h| |
|
616 |
||
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10873
diff
changeset
|
617 |
builder ifNil:[^self]. |
9967 | 618 |
toolBar := self componentAt:#ToolBar. |
619 |
bookmarkBar := self componentAt:#BookmarkBar. |
|
620 |
topOffset := 0. |
|
621 |
toolBar isNil ifFalse:[ |
|
622 |
toolBarVisible := self toolBarVisibleHolder value. |
|
623 |
toolBarVisible ifTrue:[ |
|
624 |
topOffset := topOffset + toolBar height. |
|
625 |
] |
|
626 |
]. |
|
627 |
bookmarkBar isNil ifFalse:[ |
|
628 |
bookmarkBarVisible := self bookmarkBarVisibleHolder value. |
|
629 |
bookmarkBarVisible ifTrue:[ |
|
630 |
h := bookmarkBar height. |
|
631 |
bookmarkBar layout topOffset:topOffset. |
|
632 |
bookmarkBar layout bottomOffset:topOffset + h. |
|
633 |
bookmarkBar container notNil ifTrue:[ |
|
634 |
bookmarkBar containerChangedSize. |
|
635 |
]. |
|
636 |
topOffset := topOffset + h. |
|
637 |
] |
|
638 |
]. |
|
639 |
||
640 |
||
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10873
diff
changeset
|
641 |
pageContent := self componentAt:#PageContents. |
9967 | 642 |
pageContent notNil ifTrue:[ |
643 |
pageContent layout topOffset:topOffset. |
|
644 |
pageContent container notNil ifTrue:[ |
|
645 |
pageContent containerChangedSize. |
|
646 |
]. |
|
647 |
]. |
|
648 |
||
649 |
"Created: / 10-06-2011 / 23:55:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
650 |
! ! |
|
651 |
||
652 |
!WebBrowserPage methodsFor:'hooks'! |
|
653 |
||
654 |
commonPostOpen |
|
655 |
||
656 |
self updateToollBarAndBookmarkBarVisibility |
|
657 |
||
658 |
"Created: / 11-06-2011 / 00:00:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
659 |
! ! |
|
660 |
||
661 |
!WebBrowserPage methodsFor:'initialization'! |
|
662 |
||
663 |
initialize |
|
664 |
||
665 |
super initialize. |
|
666 |
history := NavigationHistory new. |
|
667 |
||
668 |
"Created: / 08-06-2011 / 12:23:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
669 |
! ! |
|
670 |
||
671 |
!WebBrowserPage methodsFor:'menu-actions'! |
|
672 |
||
673 |
goBack |
|
674 |
||
675 |
self switchToHistoryEntry: history goBack |
|
676 |
||
677 |
"Created: / 22-02-2008 / 10:16:30 / janfrog" |
|
678 |
"Modified: / 22-02-2008 / 17:18:43 / janfrog" |
|
679 |
"Modified: / 08-06-2011 / 14:56:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
680 |
! |
|
681 |
||
682 |
goForward |
|
683 |
||
684 |
self switchToHistoryEntry: history goForward |
|
685 |
||
686 |
"Created: / 22-02-2008 / 10:16:30 / janfrog" |
|
687 |
"Modified: / 22-02-2008 / 17:18:56 / janfrog" |
|
688 |
"Modified: / 08-06-2011 / 14:57:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
689 |
! |
|
690 |
||
691 |
switchToHistoryEntry: bookmark |
|
692 |
||
693 |
self urlHolder value: bookmark url |
|
694 |
||
695 |
"Created: / 08-06-2011 / 15:01:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
696 |
! ! |
|
697 |
||
698 |
!WebBrowserPage methodsFor:'menu-dynamic'! |
|
699 |
||
700 |
goBackMenu |
|
701 |
||
702 |
<resource: #programMenu> |
|
703 |
||
704 |
| menu | |
|
705 |
menu := Menu new. |
|
706 |
history goBackItems do: |
|
707 |
[:historyEntry| |
|
708 |
menu addItem: |
|
709 |
(MenuItem new |
|
710 |
label: historyEntry label; |
|
711 |
value:[self switchToHistoryEntry: historyEntry])]. |
|
712 |
^menu |
|
713 |
||
714 |
"Created: / 22-02-2008 / 16:55:18 / janfrog" |
|
715 |
"Modified: / 27-02-2008 / 11:54:08 / janfrog" |
|
716 |
"Modified: / 08-06-2011 / 15:01:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
717 |
! |
|
718 |
||
719 |
goForwardMenu |
|
720 |
||
721 |
<resource: #programMenu> |
|
722 |
||
723 |
| menu | |
|
724 |
menu := Menu new. |
|
725 |
history goForwardItems do: |
|
726 |
[:historyEntry| |
|
727 |
menu addItem: |
|
728 |
(MenuItem new |
|
729 |
label: historyEntry label; |
|
730 |
value:[self switchToHistoryEntry: historyEntry])]. |
|
731 |
^menu |
|
732 |
||
733 |
"Created: / 22-02-2008 / 16:55:18 / janfrog" |
|
734 |
"Modified: / 27-02-2008 / 11:54:27 / janfrog" |
|
735 |
"Modified: / 08-06-2011 / 15:01:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
736 |
! ! |
|
737 |
||
738 |
!WebBrowserPage class methodsFor:'documentation'! |
|
739 |
||
740 |
version_CVS |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10873
diff
changeset
|
741 |
^ '§Header: /cvs/stx/stx/libtool/Tools__WebBrowserPage.st,v 1.3 2011/08/10 23:45:39 vrany Exp §' |
9967 | 742 |
! |
743 |
||
744 |
version_SVN |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10873
diff
changeset
|
745 |
^ '$Id$' |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10873
diff
changeset
|
746 |
! ! |