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.233 date: 2019/05/01 09:38:11
user: cg
file: HTMLDocumentFrame.st directory: libhtml
module: stx stc-classLibrary: libhtml
Author:
Claus Gittinger

Description:


displays HTML documents.


Related information:

    HTMLDocumentView
    HTMLDocumentPainter

Class protocol:

accessing
o  documentSearchPathes
DocumentSearchPathes := nil

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

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'

initialization
o  fileExecutorTable

o  fileExtensionTable

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

usage example(s):

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  initializeInternalImageTable
setup the table mapping internal document types to
bitmap image filenames

usage example(s):

     InternalImageTable := nil.
     self initializeInternalImageTable

o  internalImageTable

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

o  painter

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

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: 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.
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  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 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: urlString file: file method: method remember: rem source: source
source

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

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
ok, the action contains a block
and the attributes contains the arg <-> value associations
first, parse the block (suing the compiler) to
get more symbolic info about it ...

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  keyPress: key x: x y: y
(key == #InspectIt) ifTrue:[self inspect].

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
first resize

help
o  helpTextAt: aPoint
super helpTextAt:aPoint

initialization & release
o  destroy
(comment from inherited method)
unmap & destroy - make me invisible, destroy subviews then
make me unknown to the device

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

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 pseudo document

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

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 pseudo document showing a string

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

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

menu & actions
o  clickedExampleTextOrNil
forget any emphasis

o  copyExampleText

o  copyLink

o  editImage

o  editMenu
return an appropriate popUpMenu.
check if pointer is over:
an example - offer copy-example
an image - offer inspect-image
a href - offer open-new-browser

o  editThisDocument

o  executeAndInspectExampleText

o  executeExampleText

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

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  showNotFound: aFileName

o  startImageFlushProcess
NoSignal

queries
o  documentTitle

o  extentOfContents

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

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

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:

    HRefHistoryEntry
    ImageResolverQuery


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Mon, 26 Feb 2024 14:18:22 GMT