eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HTMLDocumentView':

Home

everywhere
www.exept.de
for:
[back]

Class: HTMLDocumentView


Inheritance:

   Object
   |
   +--GraphicsContext
      |
      +--DeviceGraphicsContext
         |
         +--GraphicsMedium
            |
            +--DisplaySurface
               |
               +--SimpleView
                  |
                  +--View
                     |
                     +--HTMLDocumentFrame
                        |
                        +--HTMLDocumentView

Package:
stx:libhtml
Category:
System-Documentation
Version:
rev: 1.200 date: 2009/11/12 23:38:45
user: cg
file: HTMLDocumentView.st directory: libhtml
module: stx stc-classLibrary: libhtml
Author:
Claus Gittinger

Description:


displays HTML documents.
Can be used as a widget or (using open-protocol found in the
class protocol) as a topView.


Class protocol:

defaults
o  defaultIcon
return the browsers default window icon

o  fullButtonSpec

o  helpFileFor: helpFilePath
given a relataive path in the helpFile hierarchy,
find the files absolute path - first trying the current language,
if not found, try an english version

o  helpViewButtonSpec

startup
o  open
open a documentView on the ST/X top page.
Returns the htmlView.

o  openDocumentation: aFilename

o  openFull
open a full documentation view on the top documentation page.
Returns the htmlView.
The actual page displayed depends on the language setting;
i.e. it is 'doc/online/<language>/TOP.html'.

o  openFullOnDocumentationFile: relativePath
open a full documentation view on a file, given its relative
path in the documentation hierachy.
The actual page displayed depends on the language setting;
i.e. it is 'doc/online/<language>/relativePath'.
If the file is not found, a warnBox is shown and nil is returned;
otherwise, the htmlView is returned.

o  openFullOnFile: aDocumentName
open a full documentation view on a file, given its pathName.
Returns the htmlView.

o  openFullOnFile: aDocumentName extent: extent title: title
open a full documentation view with extent and title,
on a file, given its pathName. Returns the htmlView.
Add a standard button panel.

o  openFullOnFile: aDocumentName extent: extent title: title uriDisplay: uriDisplay infoDisplay: infoDisplay
open a full documentation view with extent and title,
on a file, given its pathName. Returns the htmlView.
Add a standard button panel.

o  openFullOnFile: aDocumentName text: htmlText top: topDirectory extent: extent title: title buttonSpec: buttonSpec info: info
open a full documentation view with extent and title,
on a file, given its pathName. Returns the htmlView.
The buttonSpec argument specifies which buttons should be added to
the panel - for a help viewer, only a subset of the complete set
is usually passed.

o  openFullOnFile: aDocumentName text: htmlText top: topDirectory extent: extent title: title buttonSpec: buttonSpec uriDisplay: showUri infoDisplay: showInfo
open a full documentation view with extent and title,
on a file, given its pathName. Returns the htmlView.
The buttonSpec argument specifies which buttons should be added to
the panel - for a help viewer, only a subset of the complete set
is usually passed.

o  openFullOnHelpFile: relativePath
open a full documentationView as helpView (not all buttons are
present) on relativePath, which is the path relative to the
doc/online/help directory. If aRelativePath ends in '.html',
that filename is taken; otherwise, it is interpreted as a directory
name and a file named 'TOP.html' is tried there.
If the file does not exist, a warnBox is shown and nil is returned;
otherwise, the htmlView is returned.

o  openFullOnText: htmlText
open a full documentation view on some html-text.
Returns the htmlView.

o  openFullOnText: htmlText inDirectory: topDirectory
open a full documentation view on some html-text.
For file-HREFS, use aTopDirectory as starting point.
Returns the htmlView.

o  openFullOnText: htmlText top: topDirectory extent: extent title: title
open a full documentation view with extent and title,
on a file, given its pathName. Returns the htmlView.
Add a standard button panel.

o  openFullOnURL: anURL
open a full documentation view on an url, given its pathName.
Returns the htmlView.

o  openOn: aDocumentName
open a full sized documentationView on aDocumentName.
Return the htmlView.

o  openOnFile: aDocumentName
open a small documentationView on aDocumentName.
Return the htmlView.

o  openOnText: aString
open a small documentationView on some html-text.
Return the htmlView.

startup-basic
o  openFullOnFile: aFilenameOrString anchor: localAnchor text: htmlText top: topDirectory extent: extent title: title buttonSpec: buttonSpec uriDisplay: showUri infoDisplay: showInfo
open a full documentation view with extent and title,
on a file, given its pathName. Returns the htmlView.
The buttonSpec argument specifies which buttons should be added to
the panel - for a help viewer, only a subset of the complete set
is usually passed.


Instance protocol:

accessing
o  helpDocumentPath: aPathNameString
allow change of the document which is displayed by the
views help button

o  linkButtonPanel: aView

button actions
o  menu_back

o  menu_help

o  menu_home

o  menu_print

o  menu_printPage

o  menu_quit

o  menu_reload

o  menu_settings

o  menu_source

defaults
o  helpDocumentName

focus control
o  wantsFocusWithPointerEnter
views which like to take the keyboard focus
when the pointer enters can do so by redefining this
to return true

initialization & release
o  destroy

o  realize


Examples:


opening an HTML view on some document:


  HTMLDocumentView openOn:'../../doc/online/english/TOP.html'
opening an HTML view on some document with initial local anchor:


  HTMLDocumentView openOn:'../../doc/online/english/getstart/tut_3.html#REDEFINING_PRINT'
on a directory:


  HTMLDocumentView openOn:'.'
setup an HTML view in some other view:


  |top v document|

  top := StandardSystemView extent:200@500.
  v := HVScrollableView for:HTMLDocumentView miniScrollerH:true in:top.
  v origin:0.0@ 0.0 corner:1.0@1.0.
  top openAndWait.

  v homeDocument:'../../doc/online/english/TOP.html'.
the same, with different contents:


  |top v document|

  top := StandardSystemView extent:200@500.
  v := HVScrollableView for:HTMLDocumentView miniScrollerH:true in:top.
  v origin:0.0@ 0.0 corner:1.0@1.0.
  top openAndWait.

  v homeDocument:'test.html'.
how about something like this for your applications help:


   |top panel list bottom htmlView|

   top := StandardSystemView new.
   top extent:(Display extent // 2).

   panel := VariableVerticalPanel origin:0.0@0.0 corner:1.0@1.0 in:top.

   list := ScrollableView for:FileSelectionList origin:0.0@0.0 corner:1.0@0.25 in:panel.
   list directory:'../../doc/online/english'.
   list action:[:arg | 
                      htmlView setTopDirectoryName:(list directory pathName).
                      htmlView showFileDocument:(list selectedPathname)
               ].
   list matchBlock:[:name | '*.html' match:name].

   bottom := View origin:0.0@0.25 corner:1.0@1.0 in:panel.
   htmlView := HTMLDocumentView 
                      onFile:'../../doc/online/english/TOP.html' 
                      in:bottom.

   top open
it is also possible, to stuff HTML source into the view:


   HTMLDocumentView
       openFullOnText:'
<html>
<body>
<h1>chapter 1</h1>
<h2>sub chapter 1.1</h2>
<h1>chapter 2</h1>
<h2>sub chapter 2.1</h2>
<h2>sub chapter 2.2</h2>
<h2>sub chapter 2.3</h2>
</body>
</html>
' 
and, the same in a subview:


   |top panel list bottom htmlView|

   top := StandardSystemView new.
   top extent:(Display extent // 2).

   panel := VariableVerticalPanel origin:0.0@0.0 corner:1.0@1.0 in:top.

   list := ScrollableView for:FileSelectionList origin:0.0@0.0 corner:1.0@0.25 in:panel.
   list directory:'../../doc/online/english'.
   list action:[:arg | 
                      htmlView setTopDirectoryName:(list directory pathName).
                      htmlView showFileDocument:(list selectedPathname)
               ].
   list matchBlock:[:name | '*.html' match:name].

   bottom := View origin:0.0@0.25 corner:1.0@1.0 in:panel.
   htmlView := HTMLDocumentView 
                      onText:'
<html>
<body>
<h1>chapter 1</h1>
<h2>sub chapter 1.1</h2>
<h1>chapter 2</h1>
<h2>sub chapter 2.1</h2>
<h2>sub chapter 2.2</h2>
<h2>sub chapter 2.3</h2>
</body>
</html>
'
                      in:bottom.

   top open


ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 09:46:24 GMT