eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'HTMLDocumentFrame':

Home

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

Class: HTMLDocumentFrame


Inheritance:

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

Package:
stx:libhtml
Category:
System-Documentation
Version:
rev: 1.284 date: 2024/03/14 12:04:37
user: stefan
file: HTMLDocumentFrame.st directory: libhtml
module: stx stc-classLibrary: libhtml

Description:


displays HTML documents.

copyright

COPYRIGHT (c) 1995 by Claus Gittinger All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

accessing
o  documentSearchPathes
DocumentSearchPathes := nil

o  documentSearchPathesAdd: something
add path without language to search path for html documents

o  fileResolverQuery
return the query which, when answered, will provide a file resolver

o  imageResolverQuery
return the query which, when answered, will provide an image resolver

cleanup
o  flushCachedImages

o  lowSpaceCleanup
cleanup in low-memory situations

defaults
o  defaultAlienAppletsEnabled
self defaultAlienAppletsEnabled

o  defaultDocumentSearchPathes
default value for the 'DocumentSearchPathes' instance variable (automatically generated)

o  defaultHTMLExtension
self defaultHTMLExtension

o  defaultInternalAppletsEnabled
self defaultInternalAppletsEnabled

o  defaultJavaAppletsEnabled
self defaultJavaAppletsEnabled

o  defaultScriptExecutionEnabled
self defaultScriptExecutionEnabled

o  documentFileFor: relativeOrAbsolutePath
given a relative path in the documentation hierarchy,
find the file's absolute path - first trying the current language,
if not found, try an english version

Usage example(s):

    self documentSearchPathesAdd:'./stx/doc/online'.
     Smalltalk language:#en.
     self documentFileFor:'TOP.html'.
     self documentFileFor:'programming/viewintro.html'

     Smalltalk language:#de.
     self documentFileFor:'TOP.html'.
     self documentFileFor:'programming/viewintro.html'

o  documentFileFor: relativeOrAbsolutePath searchIn: pathesOrNil
given a relative path in the documentation hierarchy,
find the file's absolute path - first trying the current language,
if not found, try an english version

Usage example(s):

    self documentSearchPathesAdd:'./stx/doc/online'.
     Smalltalk language:#en.
     self documentFileFor:'TOP.html'.
     self documentFileFor:'programming/viewintro.html'

     Smalltalk language:#de.
     self documentFileFor:'TOP.html'.
     self documentFileFor:'programming/viewintro.html'

image specs
o  image_internal_broken
This resource specification was automatically generated
by the ImageEditor of ST/X.

Usage example(s):

     self image_internal_broken inspect
     ImageEditor openOnClass:self andSelector:#image_internal_broken
     Icon flushCachedIcons

o  image_internal_gopher_binary
This resource specification was automatically generated
by the ImageEditor of ST/X.

Usage example(s):

     self image_internal_gopher_binary inspect
     ImageEditor openOnClass:self andSelector:#image_internal_gopher_binary
     Icon flushCachedIcons

o  image_internal_gopher_image
This resource specification was automatically generated
by the ImageEditor of ST/X.

Usage example(s):

     self image_internal_gopher_image inspect
     ImageEditor openOnClass:self andSelector:#image_internal_gopher_image
     Icon flushCachedIcons

o  image_internal_gopher_sound
This resource specification was automatically generated
by the ImageEditor of ST/X.

Usage example(s):

     self image_internal_gopher_sound inspect
     ImageEditor openOnClass:self andSelector:#image_internal_gopher_sound
     Icon flushCachedIcons

o  image_internal_gopher_text
This resource specification was automatically generated
by the ImageEditor of ST/X.

Usage example(s):

     self image_internal_gopher_text inspect
     ImageEditor openOnClass:self andSelector:#image_internal_gopher_text
     Icon flushCachedIcons

o  image_internal_gopher_text_index
This resource specification was automatically generated
by the ImageEditor of ST/X.

Usage example(s):

     self image_internal_gopher_text_index inspect
     ImageEditor openOnClass:self andSelector:#image_internal_gopher_text_index
     Icon flushCachedIcons

o  image_internal_gopher_unknown
This resource specification was automatically generated
by the ImageEditor of ST/X.

Usage example(s):

     self image_internal_gopher_unknown inspect
     ImageEditor openOnClass:self andSelector:#image_internal_gopher_unknown
     Icon flushCachedIcons

initialization
o  fileExecutorTable

o  fileExtensionTable

o  initialize
self initializeFileExtensionTable. -- now done lazily in getter

Usage example(s):

     self initialize

o  initializeFileExecutorTable
FileExecutorTable := nil.
self initializeFileExecutorTable

o  initializeFileExtensionTable
setup the table mapping file-name extensions to
internal document types

Usage example(s):

     FileExtensionTable := nil.
     self initializeFileExtensionTable

o  update: something with: aParameter from: changedObject
smalltalk is about to save an image - don't save cachedImages

startup
o  onFile: aDocumentName in: aView
create a documentationView on aDocumentName in some other view.
Returns the htmlView

o  onFile: aFileName text: htmlText top: topDirectory in: top
create a documentationView on aDocumentName or htmlText in
some other view. Returns the htmlView.
Helper for onFile:in: and onText:in:

o  onText: htmlText in: aView
create a documentationView on htmlText (must be html) in some other view.
Returns the htmlView.


Instance protocol:

accessing
o  bind: key to: value

o  canGoBackHolder
a valueholder which holds true, if there is an URL history entry
to which we can go back

o  currentDirectoryName
return the current URLs directoryName

o  currentDocument
return the current document

o  currentDocumentAndAnchor
return the current document plus any local anchor, if we are positioned on one;
returns something like foo#bla

o  currentURL
return the current documents URL

o  defaultViewBackgroundColor

o  documentAnchor

o  documentEncoding

o  documentEncoding: anEncodingSymbol
Transcript show:'docEncoding: '; showCR:documentEncoding.

o  enableActionLinks: something

o  enableExternalLinks: something

o  forms

o  getDocumentFilename: urlString
only resolves local files - not URLs

o  getDocumentSource: anchorHref action: action

o  getFileSource: urlString
do nothing

o  history

o  homeDocument: urlString
self showFileDocument:urlString anchor:nil remember:true.

o  homeText: someText

o  infoDisplay: aString

o  infoHolder: aValueHolder

o  locationDisplay: aString

o  model: aValueHolder
(comment from inherited method)
Set the model.
Here, if I am my own menuPerformer/menuHolder,
set the menuHolder and menuPerformer to the model.
This is a compatibility kludge,
since typically, ST-80 code expects the model to provide a menu
and perform it. If the model does not support a menu message,
it will be forwarded to the view.
Those apps which want the view to provide the (default) menu have to reset
this by sending #menuHolder: message (again)

o  painter
the instance of HTMLDocumentPainter, which renders the document

o  rememberDocument: url host: urlHost text: text action: action inHistory: inHistory
remember that the current document was ever visited.
This affects the color in which corresponding anchor elements are drawn.
If inHistory is true, it is also remembered in the back-history

o  setTopDirectoryName: aDirectoryName

o  showImages: aBoolean
turn on/off image display

o  showInfo: aString

o  style
returns the style information; a dictionary filled with
font-, color- and other information

o  updateLabelFlag: aBoolean

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  updateTopViewsTitleFlag: aBoolean
When I encounter a <title>-element, I can optionally update my topview's window title.
This behavior can be controlled by setting/clearing this flag.
The default is false (explicitly turned on by the HTMLDocumentView)

o  uriHolder

o  uriHolder: aValueHolder

o  uriInputHolder: aValueHolder

o  visitedURLs

accessing-behavior
o  anchorActionPerformer
if set, this block gets all anchor actions to be performed,
before ANY internal action is attempted.
The block should return true if it handled the click.
Useful to divert any link action to an external browser.

o  anchorActionPerformer: aBlock
if set, this block gets all anchor actions to be performed,
before ANY internal action is attempted.
The block should return true if it handled the click.
If it returns false, the normal anchor processing takes place.
Useful to divert any link action to an external browser.

o  linkActionPerformer
can be set from applications which embed an html view and want to be
called back when an action-link is pressed.
This avoids the smelly habbit of adding private methods as extensions
to this class (eg. Jan's quickFix).
To use, set the linkActionPerformer in your postBuild method,
then generate action anchors of the form: <A action='doit: linkActionPerformer doSomething'>

o  linkActionPerformer: something
set a link-action performer.
Can be set from applications which embed an html view and want to be
called back when an action-link is pressed.
This avoids the smelly habbit of adding private methods as extensions
to this class (eg. Jan's quickFix).
To use, set the linkActionPerformer in your postBuild method,
then generate action anchors of the form: <A action='doit: linkActionPerformer doSomething'>

o  masterClickActionPerformer: aBlock
if set, this block gets invoked with element and click position
before ANY internal action or other action is attempted.
The block should return true, if it handled the click.
Useful to divert any click action to an external tool/browser
(can also be used to filter clocks on some elements).

o  selfInDoitExpressions: someone
if set, that one will be 'self' in a doit expression.
If not set, the DocumentFrame itself will play this role

accessing-document
o  contents: htmlText
added for compatibility with normal text views

o  localImageAt: url put: anImage
when using the html-view internally, this allows for images to be provided by
Smalltalk, without a need for a file or http-service

o  performAction: action source: source documentName: urlString remember: rem
an action link:
<A action='doit: <ST-expr>'
a browse-action link
<A action='browse: <class>'
a browse-action link
<A action='browse: <class> >> <selector>'
a plain-text generating link:
<A action='plaintext: <ST-expr>'
an html-text generating link:
<A action='htmltext: <ST-expr>'

inside a doit expression, 'self' will be bound to selfInDoitExpressions,
which - if never set - defaults to the receiver (i.e. the HTMLDocumentFrame itself).

o  setText: text
set the text - see example

o  setText: text anchor: anchor
set the text - see example

o  setText: text anchor: anchor documentName: documentName

o  setText: text header: header footer: footer id: elementId anchor: anchor
set the text - see examples

o  setText: text plain: plain anchor: anchor documentName: documentName remember: rem
self topView withWaitCursorDo:[

o  showDocument: urlOrUrlString

o  showDocument: url file: fileName onHost: aHost anchor: anchor remember: rem source: showSource
uriHolder notNil ifTrue:[

o  showDocument: url source: aBoolean

o  showDocument: urlOrUrlString text: anchorText action: action remember: rem source: source
Transcript show:'anchor selected text='; showCR:anchorText.

o  showFileDocument: fileName

o  showFileDocument: fileName anchor: anchor remember: rem

o  showFileDocument: fileName anchor: anchor remember: rem source: showSource

o  showFileDocument: fileName remember: rem

o  showTextDocument: url file: file method: method remember: rem source: source
visitedActions isNil ifTrue:[

accessing-security
o  alienAppletsEnabled

o  catchErrors

o  enableAlienApplets: aBoolean

o  enableExecution: aBoolean

o  enableInternalApplets: aBoolean

o  enableJavaApplets: aBoolean

o  enableScriptExecution: aBoolean

o  internalAppletsEnabled

o  javaAppletsEnabled

o  nameSpaceForExecution: aNameSpace

o  scriptExecutionEnabled

change & update
o  update: something with: aParameter from: changedObject

o  updateFromModel
(comment from inherited method)
to be redefined in subclasses

defaults
o  isManPageSuffix: suffix

o  mimeTypeFromSuffix: suffix
self basicNew mimeTypeFromSuffix:'gif'
self basicNew mimeTypeFromSuffix:'htm'
self basicNew mimeTypeFromSuffix:'qt'

document painter callBacks
o  appletClass: className fromURL: url

o  appletClass: className fromURL: url archive: archiveURLOrNil
make certain, Applet is not autoloaded into wrong

o  codeStreamFor: url
returns a stream on a codeFile or nil

o  fullURLPathFor: url
returns an URL's full path

o  imageFor: urlString
returns an image or nil

o  imageFor: urlStringIn now: now
returns an image or nil. The argument now specifies, if the image
should be converted to a device image right NOW or not.
Usually, it is false (i.e. no interest in a device image) during
document scan, and true when the image is to be displayed.

o  streamForURL: urlStringIn
returns a stream or nil

o  submitDoitMethod: method form: info
form values

o  submitForm: info

o  title: aString
define the title - a callBack when a <TITLE> tag is encountered

o  visitTest: urlString action: actionString
('check visited: ' , urlString) printCR.

event handling
o  buttonMotion: state x: x y: y
(comment from inherited method)
button was moved

o  buttonPress: button x: x y: y
for menus

o  changeScaleForMouseWheelZoom: amount
self menu_reload.

o  keyPress: key x: x y: y
(key == #InspectIt) ifTrue:[self inspect].

o  keyboardZoom: largerBoolean
ALT+/- (was: CTRL+/-) action.
ignored here - redefined in views which can zoom

o  mouseWheelZoom: amount
CTRL-wheel action

o  redraw
(comment from inherited method)
redraw myself
if there is a model, this one shall redraw itself,
otherwise we cannot do much here - has to be redefined in subclasses

o  redrawX: x y: y width: w height: h
(comment from inherited method)
redraw part of myself immediately, given logical coordinates
(if transformation is nonNil)
The default here is to redraw everything
- subclasses usually redefine this, adding more intelligence

o  showAnchorCursor
to be redefined

o  showNormalCursor
to be redefined

o  sizeChanged: how from: oldExtentOrNil
my view has changed the size (not the contents)

help
o  helpTextAt: aPoint
super helpTextAt:aPoint

initialization & release
o  fetchDeviceResources
fetch device specific resources.

o  initFonts: aPageStyle
encoding := #'iso8859-1'.

o  initLazyFontStyle: aFontStyle size: fontSize encoding: encoding
take the first - for now.

o  initStyle
setup style specifics.

o  initialize
no - never use dithered colors for the background

o  recreate
sent after a snapin or a migration, reinit for new device

o  reinitStyle
handle dynamic style changes

o  release

internal pseudo documents
o  documentStreamForErrorResponse: reply forURL: urlString location: location onHost: aHost
return an array filled with:
stream
newDocument name
newDocument directory
documentHost
mhmh - this is not very object-oriented ...

o  documentStreamForURL: urlOrString file: urlFileName onHost: aHost
return an array filled with:
stream
newDocument name
newDocument directory
documentHost
mhmh - this is not very object-oriented ...

o  pseudoDocumentStreamForDirectory: url
a directory in an HREF - create a pseudo document showing the directory listing

o  pseudoDocumentStreamForImageFile: url
an image in an HREF - create pseudo document

o  pseudoDocumentStreamForManPageFile: url
a manPage in an HREF - create pseudo document

o  pseudoDocumentStreamForPDFFile: url
a PDF file in an HREF - create error document, if acroread cannot be opened

o  pseudoDocumentStreamForPlainFile: url
a plainFile in an HREF - create pseudo document (wrap into <pre><code>...</code></pre>)

o  pseudoDocumentStreamForPostscriptFile: url
a postscript file in an HREF - create error document, if ghostview cannot be opened

o  pseudoDocumentStreamForUnreadableFile: urlString
an unreadable file in an HREF - create pseudo document

o  pseudoDocumentStreamForUnreadableFile: urlString message: msg
an unreadable file in an HREF - create pseudo document

o  pseudoDocumentStreamOnHTML: aString headLine: headLine title: title
create a pseudo document showing an HTML string

o  pseudoDocumentStreamOnString: aString headLine: headLine title: title
create a pseudo document showing a string

o  pseudoDocumentStreamOnString: aString title: title
create a pseudo document showing a string (i.e. wrap it into <pre>...</pre>)

menu & actions
o  clickedExampleTextOrNil
forget any emphasis

o  copyExampleText

o  copyHTMLToClipboard

o  copyLink

o  copyTextToClipboard

o  editImage

o  editMenu
return an appropriate popUpMenu.
check if pointer is over:
an example - offer copy-example <A type='example'>...</a>
an image - offer inspect-image
a href - offer open-new-browser

o  editThisDocument

o  executeAndInspectExampleText

o  executeExampleText

o  getDocumentHTML
return the current document's HTML text as one (possibly big) string

o  inspectImage

o  openNewOnAnchor
does not work yet

o  saveImage

o  showImageInFileBrowser
not unloadable

o  terminalOnExampleText

o  workspaceOnExampleText
initialSyntax:nil. -- not a good idea; most examples are smalltalk

misc
o  ampersandBindings
self new ampersandBindings

o  backToPreviousDocument
Transcript showCR:historyEntry printString.

o  elementAt: aPoint

o  fontEncodingFor: encodingSymbol

o  getVerticalPosition

o  isValidMethod: methodString

o  positionOnAnchor: aLocalAnchor
not yet visible - remember to position later

o  positionTo: aPoint

o  showEmpty: documentName

o  showNotFound: aFileName

o  startImageFlushProcess
start a bg process which flushes cached images after 5 minutes

queries
o  documentTitle

o  extentOfContents

o  heightForLines: numberOfLines
return the height of the receiver, if numberOfLines are to be displayed

o  horizontalScrollStep
(comment from inherited method)
return the amount to scroll when stepping left/right.
Subclasses may want to redefine this.

o  preferredExtentForLines: numLines cols: numCols
get an approximation for the extent to display numLines and
numCols in normal fontsize

o  verticalScrollStep
return the amount to scroll when stepping up/down (also used for mouseWheel).

queries-contents
o  heightOfContents
(comment from inherited method)
return the height of the contents in logical units
- defaults to view's visible area here.
This method MUST be redefined in all view classess which are
going to be scrolled AND show data which has different size than
the view. For example, a view showing A4-size documents should return
the number of vertical pixels such a document has on this device.
A view showing a bitmap of height 1000 should return 1000.
If not redefined, scrollbars have no way of knowing the actual size
of the contents being shown. This is called by scrollBars to compute
the relative height of the document vs. the view's actual size.
The value returned here must be based on a scale of 1, since users
of this will scale as appropriate.

o  widthOfContents
(comment from inherited method)
return the width of the contents in logical units
- defaults to views visible area here.
This method MUST be redefined in all view classess which are
going to be scrolled AND show data which has different size than
the view. For example, a view showing A4-size documents should return
the number of horizontal pixels such a document has on this device.
A view showing a bitmap of width 500 should return 500.
If not redefined, scrollbars have no way of knowing the actual size
of the contents being shown. This is called by scrollBars to compute
the relative width of the document vs. the view's actual width.
The value returned here must be based on a scale of 1, since users
of this will scale as appropriate.

user actions
o  anchorElementSelected: anchorElement
user clicked on an anchor.
If the anchor has an action link and linkActions are enabled,
or it is an external link, and external links are enabled,
or it is an internal link, then proceed in showDocument:,
which performs the action. Otherwise ignore the click

o  exampleElementSelected: exampleElement
user clicked on an example. If execution is enabled,
evaluate it save from any exceptions (show what happened, if
any exception is raised during evaluation).
If the exampleElement has a SHOWRESULT attribute, display the
printString in the infoView.

o  executeExampleText: action withResultDo: resultAction onErrorDo: errorAction
user clicked on an example. If execution is enabled,
evaluate it save from any exceptions (show what happened, if
any exception is raised during evaluation).
If the exampleElement has a SHOWRESULT attribute, display the
printString in the infoView.

o  showResultOfCodeExample: rslt

o  updateAnchorInfoForX: x y: y
look for any anchor under the mouse pointer at x/y;
update infoLabel, if there is any


Private classes:

    FileResolverQuery
    HRefHistoryEntry
    ImageResolverQuery


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Fri, 13 Dec 2024 14:59:50 GMT