eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HTMLDocumentView':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: HTMLDocumentView


Inheritance:

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

Package:
stx:libhtml
Category:
System-Documentation
Version:
rev: 1.226 date: 2019/03/13 20:43:34
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 startup-protocol found in the class protocol) as a topView.

Please read the documentation in HTMLDocumentPainter for its limitations.

If you want to include an html-view in your UI application,
and want embedded anchor links which call back into your application,
use the following scheme:
    1) set the htmlVIew's linkActionPerformer (in your postBuild:-method)
    2) generate anchors of the form:
        <A action='doIt: linkActionPerformer doSomething'>
or, alternatively, create anchors of the form:
        <A action='doIt: self application doSomething'>

DO NOT add private protocol to this class or the superclass (as was done with quickFix)


Class protocol:

defaults
o  defaultIcon
return the browsers default window icon

o  fullButtonSpec
('hardcopy' #menu_printPage )

o  helpFileFor: helpFilePath
given a relataive path in the helpFile hierarchy,
find the file's 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.

usage example(s):

     self open

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'.

usage example(s):

     self openFull

usage example(s):

     Language := #de.
     self openFull

usage example(s):

     Language := #en.
     self openFull

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.

usage example(s):

     self openFullOnDocumentationFile:'TOP.html'
     self openFullOnDocumentationFile:'programming/TOP.html'
     self openFullOnDocumentationFile:'tools/uipainter/TOP.html#ADDINGMENUBAR'
     self openFullOnDocumentationFile:'foobar'

usage example(s):

     Language := #de.
     self openFullOnDocumentationFile:'TOP.html'

usage example(s):

     Language := #en.
     self openFullOnDocumentationFile:'TOP.html'

o  openFullOnDocumentationFile: relativePath searchIn: pathesOrNil
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.

usage example(s):

     self openFullOnDocumentationFile:'TOP.html'
     self openFullOnDocumentationFile:'programming/TOP.html'
     self openFullOnDocumentationFile:'tools/uipainter/TOP.html#ADDINGMENUBAR'
     self openFullOnDocumentationFile:'foobar'

usage example(s):

     Language := #de.
     self openFullOnDocumentationFile:'TOP.html'

usage example(s):

     Language := #en.
     self openFullOnDocumentationFile:'TOP.html'

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

usage example(s):

     self openFullOnFile:'../../doc/online/english/TOP.html'
     self openFullOnFile:'http://localhost:8001/'
     self openFullOnFile:nil
     self openFullOnFile:'http://www.exept.de'

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.

usage example(s):

     self openFullOnHelpFile:'Launcher/compilerSettings.html'

usage example(s):

     Language := #de.
     self openFullOnHelpFile:'Launcher/compilerSettings.html'

usage example(s):

     Language := #en.
     self openFullOnHelpFile:'Launcher/compilerSettings.html'

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

usage example(s):

     self
	 openFullOnText:'


chapter 1

sub chapter 1.1

chapter 2

sub chapter 2.1

sub chapter 2.2

sub chapter 2.3

'

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.

usage example(s):

     self
	 openFullOnText:'


chapter 1

sub chapter 1.1

chapter 2

sub chapter 2.1

sub chapter 2.2

sub chapter 2.3

'

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.

usage example(s):

     self openFullOnURL:'http://www.exept.de'
     self openFullOnURL:'http://localhost:8080/'
     self openFullOnURL:'http://localhost:80/'
     self openFullOnURL:'http://wvnvaxa.wvnet.edu/vmswww/bmp.html'
     self openFullOnURL:'http://www.w3.org/Graphics/PNG/inline-alpha.html'
     self openFullOnURL:'http://www.schaik.com/pngsuite/pngsuite_bas_png.html'
     self openFullOnURL:'http://www.schaik.com/pngsuite/pngsuite_trn_png.html'
     self openFullOnURL:'http://www.schaik.com/pngsuite/pngsuite.html'

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

usage example(s):

     self openOn:'../../doc/online/english/TOP.html'
     self openOn:'http://pxd.me/dompdf/www/test/image_bmp.html'

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

usage example(s):

     self openOnFile:'../../doc/online/english/TOP.html'

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

usage example(s):

     HTMLDocumentView openOnText:'

Hello world

' HTMLDocumentView openFullOnText:'

Hello world

'

startup-basic
o  new_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.

o  old_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.

o  openFullOnFile: aFilenameOrString anchor: localAnchor text: htmlText top: topDirectory extent: extent title: title buttonSpec: buttonSpec uriDisplay: showUri infoDisplay: showInfo
backward compatibility entry


Instance protocol:

accessing
o  heightOfContentsDependsOnWidth
yes, I rearrange the text depending on the width,
and therefore, it is a bad idea to hide/show scrollbars dynamically

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

o  linkButtonPanel: aView

o  scrollWhenUpdating
return the scroll behavior, when I get a new text
via the model.
Possible returnValues are:
#keep / nil -> no change
#endOfText -> scroll to the end
#beginOfText -> scroll to the top
The default is #beginOfText.
This is useful for synchronized text+htmlText,
where new text comes from editing

o  scrollWhenUpdating: aSymbolOrNil
define how to scroll, when I get a new text
via the model.
Allowed arguments are:
#keep / nil -> no change
#endOfText -> scroll to the end
#beginOfText -> scroll to the top
The default is #beginOfText.
This is useful for synchronized text+htmlText,
where new text comes from editing

button actions
o  currentDocumentSource

o  fileBrowserOnPageSource
open a file browser on the html file.
But only iff the text being shown comes from a file

o  fileNameOfPageSource
return the filename of the html file.
But only iff the text being shown comes from a file;
otherwise return nil

o  menu_back

o  menu_help

o  menu_home

o  menu_print

o  menu_printPage
postscript

o  menu_quit

o  menu_reload
self sensor ctrlDown ifTrue:[

o  menu_settings
group add:(box addCheckBox:(resources string:'tiny font') on:nil) toggleView.

o  menu_source

o  showPageSource

change & update
o  updateFromModel

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  initialize

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 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Tue, 19 Mar 2024 04:54:42 GMT