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
|
13883
|
31 |
instanceVariableNames:'history webKitView urlHolder titleHolder linkHolder
|
|
32 |
bookmarkHolder toolBarVisibleHolder bookmarkBarVisibleHolder'
|
9967
|
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
|
10857
|
316 |
labelImage: (ResourceRetriever ToolbarIconLibrary historyBackIcon)
|
9967
|
317 |
)
|
|
318 |
(MenuItem
|
|
319 |
enabled: canGoForwardAspect
|
|
320 |
label: 'Forward'
|
|
321 |
itemValue: goForward
|
|
322 |
translateLabel: true
|
|
323 |
isButton: true
|
|
324 |
submenuChannel: goForwardMenu
|
10857
|
325 |
labelImage: (ResourceRetriever ToolbarIconLibrary historyForwardIcon)
|
9967
|
326 |
)
|
|
327 |
)
|
|
328 |
nil
|
|
329 |
nil
|
|
330 |
)
|
10857
|
331 |
|
|
332 |
"Modified: / 08-11-2011 / 16:42:44 / cg"
|
9967
|
333 |
! !
|
|
334 |
|
10567
|
335 |
!WebBrowserPage class methodsFor:'plugIn spec'!
|
|
336 |
|
|
337 |
aspectSelectors
|
|
338 |
"This resource specification was automatically generated
|
|
339 |
by the UIPainter of ST/X."
|
|
340 |
|
|
341 |
"Do not manually edit this. If it is corrupted,
|
|
342 |
the UIPainter may not be able to read the specification."
|
|
343 |
|
|
344 |
"Return a description of exported aspects;
|
|
345 |
these can be connected to aspects of an embedding application
|
|
346 |
(if this app is embedded in a subCanvas)."
|
|
347 |
|
|
348 |
^ #(
|
|
349 |
#urlHolder
|
|
350 |
).
|
|
351 |
|
|
352 |
! !
|
|
353 |
|
9967
|
354 |
!WebBrowserPage methodsFor:'actions'!
|
|
355 |
|
|
356 |
hideBookmarkBar
|
|
357 |
<resource: #uiCallback>
|
|
358 |
|
|
359 |
self bookmarkBarVisibleHolder value: false
|
|
360 |
|
|
361 |
"Modified: / 10-06-2011 / 23:57:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
362 |
!
|
|
363 |
|
|
364 |
hideToolbar
|
|
365 |
<resource: #uiCallback>
|
|
366 |
|
|
367 |
self toolBarVisibleHolder value: false.
|
|
368 |
|
|
369 |
"Modified: / 10-06-2011 / 23:58:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
370 |
!
|
|
371 |
|
|
372 |
switchToBookmarkEntry: bookmark
|
|
373 |
|
|
374 |
|
10713
|
375 |
self bookmarkHolder value: bookmark copy.
|
9967
|
376 |
history goTo: bookmark.
|
|
377 |
self urlHolder value: bookmark url.
|
|
378 |
|
|
379 |
"Created: / 16-06-2011 / 16:10:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
380 |
! !
|
|
381 |
|
|
382 |
!WebBrowserPage methodsFor:'aspects'!
|
|
383 |
|
|
384 |
bookmarkBarVisibleHolder
|
|
385 |
"return/create the 'bookmarkBarVisibleHolder' value holder (automatically generated)"
|
|
386 |
|
|
387 |
bookmarkBarVisibleHolder isNil ifTrue:[
|
|
388 |
bookmarkBarVisibleHolder := true asValue.
|
|
389 |
bookmarkBarVisibleHolder addDependent:self.
|
|
390 |
].
|
|
391 |
^ bookmarkBarVisibleHolder
|
|
392 |
|
|
393 |
"Modified: / 10-06-2011 / 23:56:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
394 |
!
|
|
395 |
|
|
396 |
bookmarkBarVisibleHolder:something
|
|
397 |
"set the 'bookmarkBarVisibleHolder' value holder (automatically generated)"
|
|
398 |
|
|
399 |
|oldValue newValue|
|
|
400 |
|
|
401 |
bookmarkBarVisibleHolder notNil ifTrue:[
|
|
402 |
oldValue := bookmarkBarVisibleHolder value.
|
|
403 |
bookmarkBarVisibleHolder removeDependent:self.
|
|
404 |
].
|
|
405 |
bookmarkBarVisibleHolder := something.
|
|
406 |
bookmarkBarVisibleHolder notNil ifTrue:[
|
|
407 |
bookmarkBarVisibleHolder addDependent:self.
|
|
408 |
].
|
|
409 |
newValue := bookmarkBarVisibleHolder value.
|
|
410 |
oldValue ~~ newValue ifTrue:[
|
|
411 |
self update:#value with:newValue from:bookmarkBarVisibleHolder.
|
|
412 |
].
|
|
413 |
!
|
|
414 |
|
|
415 |
bookmarkHolder
|
|
416 |
"return/create the 'bookmarkHolder' value holder (automatically generated)"
|
|
417 |
|
|
418 |
bookmarkHolder isNil ifTrue:[
|
|
419 |
bookmarkHolder := ValueHolder new.
|
|
420 |
].
|
|
421 |
^ bookmarkHolder
|
|
422 |
!
|
|
423 |
|
|
424 |
bookmarkListHolder
|
|
425 |
|
|
426 |
^BookmarkList forWebBrowser
|
|
427 |
|
|
428 |
"Created: / 08-06-2011 / 12:16:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
429 |
!
|
|
430 |
|
13883
|
431 |
linkHolder
|
|
432 |
"return/create the 'linkHolder' value holder (automatically generated)"
|
|
433 |
|
|
434 |
linkHolder isNil ifTrue:[
|
|
435 |
linkHolder := ValueHolder new.
|
|
436 |
linkHolder addDependent:self.
|
|
437 |
].
|
|
438 |
^ linkHolder
|
|
439 |
!
|
|
440 |
|
|
441 |
linkHolder:something
|
|
442 |
"set the 'linkHolder' value holder (automatically generated)"
|
|
443 |
|
|
444 |
|oldValue newValue|
|
|
445 |
|
|
446 |
linkHolder notNil ifTrue:[
|
|
447 |
oldValue := linkHolder value.
|
|
448 |
linkHolder removeDependent:self.
|
|
449 |
].
|
|
450 |
linkHolder := something.
|
|
451 |
linkHolder notNil ifTrue:[
|
|
452 |
linkHolder addDependent:self.
|
|
453 |
].
|
|
454 |
newValue := linkHolder value.
|
|
455 |
oldValue ~~ newValue ifTrue:[
|
|
456 |
self update:#value with:newValue from:linkHolder.
|
|
457 |
].
|
|
458 |
!
|
|
459 |
|
9967
|
460 |
titleHolder
|
|
461 |
"return/create the 'titleHolder' value holder (automatically generated)"
|
|
462 |
|
|
463 |
titleHolder isNil ifTrue:[
|
|
464 |
titleHolder := ValueHolder new.
|
|
465 |
titleHolder addDependent:self.
|
|
466 |
].
|
|
467 |
^ titleHolder
|
|
468 |
!
|
|
469 |
|
|
470 |
titleHolder:something
|
|
471 |
"set the 'titleHolder' value holder (automatically generated)"
|
|
472 |
|
|
473 |
|oldValue newValue|
|
|
474 |
|
|
475 |
titleHolder notNil ifTrue:[
|
|
476 |
oldValue := titleHolder value.
|
|
477 |
titleHolder removeDependent:self.
|
|
478 |
].
|
|
479 |
titleHolder := something.
|
|
480 |
self webKitView title: titleHolder.
|
|
481 |
titleHolder notNil ifTrue:[
|
|
482 |
titleHolder addDependent:self.
|
|
483 |
].
|
|
484 |
newValue := titleHolder value.
|
|
485 |
oldValue ~~ newValue ifTrue:[
|
|
486 |
self update:#value with:newValue from:titleHolder.
|
|
487 |
].
|
|
488 |
|
|
489 |
"Modified: / 08-06-2011 / 14:51:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
490 |
!
|
|
491 |
|
|
492 |
toolBarVisibleHolder
|
|
493 |
"return/create the 'toolBarVisibleHolder' value holder (automatically generated)"
|
|
494 |
|
|
495 |
toolBarVisibleHolder isNil ifTrue:[
|
|
496 |
toolBarVisibleHolder := true asValue.
|
|
497 |
toolBarVisibleHolder addDependent:self.
|
|
498 |
].
|
|
499 |
^ toolBarVisibleHolder
|
|
500 |
|
|
501 |
"Modified: / 10-06-2011 / 23:57:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
502 |
!
|
|
503 |
|
|
504 |
toolBarVisibleHolder:something
|
|
505 |
"set the 'toolBarVisibleHolder' value holder (automatically generated)"
|
|
506 |
|
|
507 |
|oldValue newValue|
|
|
508 |
|
|
509 |
toolBarVisibleHolder notNil ifTrue:[
|
|
510 |
oldValue := toolBarVisibleHolder value.
|
|
511 |
toolBarVisibleHolder removeDependent:self.
|
|
512 |
].
|
|
513 |
toolBarVisibleHolder := something.
|
|
514 |
toolBarVisibleHolder notNil ifTrue:[
|
|
515 |
toolBarVisibleHolder addDependent:self.
|
|
516 |
].
|
|
517 |
newValue := toolBarVisibleHolder value.
|
|
518 |
oldValue ~~ newValue ifTrue:[
|
|
519 |
self update:#value with:newValue from:toolBarVisibleHolder.
|
|
520 |
].
|
|
521 |
!
|
|
522 |
|
|
523 |
urlHolder
|
|
524 |
"return/create the 'urlHolder' value holder (automatically generated)"
|
|
525 |
|
|
526 |
urlHolder isNil ifTrue:[
|
|
527 |
urlHolder := 'http://google.com' asValue.
|
|
528 |
urlHolder addDependent:self.
|
|
529 |
].
|
|
530 |
^ urlHolder
|
|
531 |
|
|
532 |
"Modified: / 08-06-2011 / 15:06:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
533 |
!
|
|
534 |
|
|
535 |
urlHolder:something
|
|
536 |
"set the 'urlHolder' value holder (automatically generated)"
|
|
537 |
|
|
538 |
|oldValue newValue|
|
|
539 |
|
|
540 |
urlHolder notNil ifTrue:[
|
|
541 |
oldValue := urlHolder value.
|
|
542 |
urlHolder removeDependent:self.
|
|
543 |
].
|
|
544 |
urlHolder := something.
|
|
545 |
self webKitView url: urlHolder.
|
|
546 |
urlHolder notNil ifTrue:[
|
|
547 |
urlHolder addDependent:self.
|
|
548 |
].
|
|
549 |
newValue := urlHolder value.
|
|
550 |
oldValue ~~ newValue ifTrue:[
|
|
551 |
self update:#value with:newValue from:urlHolder.
|
|
552 |
].
|
|
553 |
|
|
554 |
"Modified: / 08-06-2011 / 14:27:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
555 |
!
|
|
556 |
|
|
557 |
webKitView
|
|
558 |
|
10867
|
559 |
webKitView isNil ifTrue:[
|
9967
|
560 |
webKitView := WebKitView new
|
|
561 |
url: self urlHolder;
|
|
562 |
title: self titleHolder;
|
13883
|
563 |
link: self linkHolder;
|
9967
|
564 |
|
|
565 |
yourself.
|
|
566 |
].
|
|
567 |
^webKitView.
|
|
568 |
|
|
569 |
"Created: / 07-06-2011 / 22:50:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10867
|
570 |
"Modified: / 18-11-2011 / 15:04:27 / cg"
|
13883
|
571 |
"Modified: / 30-05-2012 / 18:28:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
9967
|
572 |
! !
|
|
573 |
|
|
574 |
!WebBrowserPage methodsFor:'aspects-queries'!
|
|
575 |
|
|
576 |
canGoBackAspect
|
|
577 |
|
|
578 |
^(AspectAdaptor forAspect:#canGoBack)
|
|
579 |
subjectChannel: history;
|
|
580 |
yourself.
|
|
581 |
|
|
582 |
"Modified: / 21-07-2009 / 22:39:57 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
583 |
"Created: / 01-09-2009 / 22:38:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
584 |
"Modified: / 08-06-2011 / 12:36:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
585 |
!
|
|
586 |
|
|
587 |
canGoForwardAspect
|
|
588 |
|
|
589 |
|
|
590 |
^(AspectAdaptor forAspect:#canGoForward)
|
|
591 |
subjectChannel: history;
|
|
592 |
yourself.
|
|
593 |
|
|
594 |
"Modified: / 21-07-2009 / 22:39:57 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
595 |
"Created: / 01-09-2009 / 22:39:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
596 |
"Modified: / 08-06-2011 / 12:36:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
597 |
! !
|
|
598 |
|
|
599 |
!WebBrowserPage methodsFor:'change & update'!
|
|
600 |
|
|
601 |
update:something with:aParameter from:changedObject
|
|
602 |
"Invoked when an object that I depend upon sends a change notification."
|
|
603 |
|
|
604 |
"stub code automatically generated - please change as required"
|
|
605 |
|
|
606 |
changedObject == urlHolder ifTrue:[
|
|
607 |
self updateBookmark.
|
|
608 |
^ self.
|
|
609 |
].
|
13883
|
610 |
|
9967
|
611 |
changedObject == toolBarVisibleHolder ifTrue:[
|
|
612 |
self updateToollBarAndBookmarkBarVisibility.
|
|
613 |
^ self.
|
|
614 |
].
|
13883
|
615 |
|
|
616 |
changedObject == linkHolder ifTrue:[
|
|
617 |
self updateLink.
|
|
618 |
^ self.
|
|
619 |
].
|
|
620 |
|
9967
|
621 |
changedObject == bookmarkBarVisibleHolder ifTrue:[
|
|
622 |
self updateToollBarAndBookmarkBarVisibility.
|
|
623 |
^ self.
|
|
624 |
].
|
|
625 |
|
|
626 |
|
|
627 |
|
|
628 |
super update:something with:aParameter from:changedObject
|
|
629 |
|
13883
|
630 |
"Modified: / 30-05-2012 / 18:28:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
9967
|
631 |
!
|
|
632 |
|
|
633 |
updateBookmark
|
|
634 |
|
|
635 |
| url title bookmark |
|
|
636 |
url := self urlHolder value.
|
|
637 |
title := self titleHolder value.
|
|
638 |
|
|
639 |
((bookmark := self bookmarkHolder value) notNil and:[bookmark url = url]) ifTrue:[
|
|
640 |
self bookmarkHolder value label: title.
|
|
641 |
] ifFalse:[
|
|
642 |
self bookmarkHolder value: (Bookmark forUrl: url label: title).
|
|
643 |
history goTo: self bookmarkHolder value
|
|
644 |
]
|
|
645 |
|
|
646 |
"Created: / 08-06-2011 / 12:19:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
647 |
"Modified: / 08-06-2011 / 14:55:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
648 |
!
|
|
649 |
|
13883
|
650 |
updateLink
|
|
651 |
|
|
652 |
(masterApplication notNil and:[masterApplication respondsTo: #infoLabelHolder]) ifTrue:[
|
|
653 |
masterApplication infoLabelHolder value: (self linkHolder value ? '')
|
|
654 |
|
|
655 |
]
|
|
656 |
|
|
657 |
"Created: / 30-05-2012 / 18:28:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
658 |
!
|
|
659 |
|
9967
|
660 |
updateToollBarAndBookmarkBarVisibility
|
|
661 |
|toolBarVisible toolBar bookmarkBarVisible bookmarkBar pageContent topOffset h|
|
|
662 |
|
10867
|
663 |
builder isNil ifTrue:[^self].
|
9967
|
664 |
toolBar := self componentAt:#ToolBar.
|
|
665 |
bookmarkBar := self componentAt:#BookmarkBar.
|
|
666 |
topOffset := 0.
|
|
667 |
toolBar isNil ifFalse:[
|
|
668 |
toolBarVisible := self toolBarVisibleHolder value.
|
|
669 |
toolBarVisible ifTrue:[
|
|
670 |
topOffset := topOffset + toolBar height.
|
|
671 |
]
|
|
672 |
].
|
|
673 |
bookmarkBar isNil ifFalse:[
|
|
674 |
bookmarkBarVisible := self bookmarkBarVisibleHolder value.
|
|
675 |
bookmarkBarVisible ifTrue:[
|
|
676 |
h := bookmarkBar height.
|
|
677 |
bookmarkBar layout topOffset:topOffset.
|
|
678 |
bookmarkBar layout bottomOffset:topOffset + h.
|
|
679 |
bookmarkBar container notNil ifTrue:[
|
|
680 |
bookmarkBar containerChangedSize.
|
|
681 |
].
|
|
682 |
topOffset := topOffset + h.
|
|
683 |
]
|
|
684 |
].
|
|
685 |
|
|
686 |
|
10713
|
687 |
pageContent := self componentAt:#Content.
|
9967
|
688 |
pageContent notNil ifTrue:[
|
|
689 |
pageContent layout topOffset:topOffset.
|
|
690 |
pageContent container notNil ifTrue:[
|
|
691 |
pageContent containerChangedSize.
|
|
692 |
].
|
|
693 |
].
|
|
694 |
|
|
695 |
"Created: / 10-06-2011 / 23:55:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10867
|
696 |
"Modified: / 18-11-2011 / 15:04:22 / cg"
|
9967
|
697 |
! !
|
|
698 |
|
|
699 |
!WebBrowserPage methodsFor:'hooks'!
|
|
700 |
|
|
701 |
commonPostOpen
|
17314
|
702 |
super commonPostOpen.
|
9967
|
703 |
self updateToollBarAndBookmarkBarVisibility
|
|
704 |
|
|
705 |
"Created: / 11-06-2011 / 00:00:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
706 |
! !
|
|
707 |
|
|
708 |
!WebBrowserPage methodsFor:'initialization'!
|
|
709 |
|
|
710 |
initialize
|
|
711 |
|
|
712 |
super initialize.
|
|
713 |
history := NavigationHistory new.
|
|
714 |
|
|
715 |
"Created: / 08-06-2011 / 12:23:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
716 |
! !
|
|
717 |
|
|
718 |
!WebBrowserPage methodsFor:'menu-actions'!
|
|
719 |
|
|
720 |
goBack
|
|
721 |
|
|
722 |
self switchToHistoryEntry: history goBack
|
|
723 |
|
|
724 |
"Created: / 22-02-2008 / 10:16:30 / janfrog"
|
|
725 |
"Modified: / 22-02-2008 / 17:18:43 / janfrog"
|
|
726 |
"Modified: / 08-06-2011 / 14:56:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
727 |
!
|
|
728 |
|
|
729 |
goForward
|
|
730 |
|
|
731 |
self switchToHistoryEntry: history goForward
|
|
732 |
|
|
733 |
"Created: / 22-02-2008 / 10:16:30 / janfrog"
|
|
734 |
"Modified: / 22-02-2008 / 17:18:56 / janfrog"
|
|
735 |
"Modified: / 08-06-2011 / 14:57:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
736 |
!
|
|
737 |
|
|
738 |
switchToHistoryEntry: bookmark
|
|
739 |
|
|
740 |
self urlHolder value: bookmark url
|
|
741 |
|
|
742 |
"Created: / 08-06-2011 / 15:01:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
743 |
! !
|
|
744 |
|
|
745 |
!WebBrowserPage methodsFor:'menu-dynamic'!
|
|
746 |
|
|
747 |
goBackMenu
|
|
748 |
|
|
749 |
<resource: #programMenu>
|
|
750 |
|
|
751 |
| menu |
|
|
752 |
menu := Menu new.
|
|
753 |
history goBackItems do:
|
|
754 |
[:historyEntry|
|
|
755 |
menu addItem:
|
11789
|
756 |
(MenuItem
|
|
757 |
label: historyEntry label
|
|
758 |
itemValue:[self switchToHistoryEntry: historyEntry])].
|
9967
|
759 |
^menu
|
|
760 |
|
|
761 |
"Created: / 22-02-2008 / 16:55:18 / janfrog"
|
|
762 |
"Modified: / 27-02-2008 / 11:54:08 / janfrog"
|
|
763 |
"Modified: / 08-06-2011 / 15:01:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
11789
|
764 |
"Modified: / 09-09-2012 / 13:24:30 / cg"
|
9967
|
765 |
!
|
|
766 |
|
|
767 |
goForwardMenu
|
|
768 |
<resource: #programMenu>
|
|
769 |
|
|
770 |
| menu |
|
11789
|
771 |
|
9967
|
772 |
menu := Menu new.
|
11789
|
773 |
history goForwardItems do:[:historyEntry|
|
9967
|
774 |
menu addItem:
|
11789
|
775 |
(MenuItem
|
|
776 |
label: historyEntry label
|
|
777 |
itemValue:[self switchToHistoryEntry: historyEntry])
|
|
778 |
].
|
9967
|
779 |
^menu
|
|
780 |
|
|
781 |
"Created: / 22-02-2008 / 16:55:18 / janfrog"
|
|
782 |
"Modified: / 27-02-2008 / 11:54:27 / janfrog"
|
|
783 |
"Modified: / 08-06-2011 / 15:01:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
11789
|
784 |
"Modified (format): / 09-09-2012 / 13:24:59 / cg"
|
9967
|
785 |
! !
|
|
786 |
|
|
787 |
!WebBrowserPage class methodsFor:'documentation'!
|
|
788 |
|
10873
|
789 |
version
|
17314
|
790 |
^ '$Header$'
|
10873
|
791 |
!
|
|
792 |
|
9967
|
793 |
version_CVS
|
17314
|
794 |
^ '$Header$'
|
9967
|
795 |
!
|
|
796 |
|
|
797 |
version_SVN
|
17314
|
798 |
^ '$Id$'
|
9967
|
799 |
! !
|
13883
|
800 |
|