eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Notification':

Home

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

Class: Notification


Inheritance:

   Object
   |
   +--GenericException
      |
      +--Notification
         |
         +--CascadingNotification
         |
         +--ClassDescription::PackageRedefinition
         |
         +--Dolphin::Notification
         |
         +--EndOfStreamNotification
         |
         +--HTTPInterface::RequestInformationSignal
         |
         +--HTTPInterface::TransferProgressNotificationSignal
         |
         +--HTTPInterface::TransferTimeoutNotificationSignal
         |
         +--HTTPRequest::ReprocessRequest
         |
         +--HTTPServer::TerminationRequest
         |
         +--IncrementNotification
         |
         +--NaiveRomanNumberFormatNotification
         |
         +--ObjectFileLoader::ObjectFileLoadErrorNotification
         |
         +--ParseWarning
         |
         +--Parser::RestartCompilationSignal
         |
         +--ProceedingNotification
         |
         +--Query
         |
         +--RecursiveStoreError
         |
         +--SocketErrorNotification
         |
         +--TimeoutNotification
         |
         +--UndefinedVariableNotification
         |
         +--UnhandledAttributeInLiteralArrayErrorSignal
         |
         +--UserConfirmation
         |
         +--UserNotification
         |
         +--YesToAllConfirmation

Package:
stx:libbasic
Category:
Kernel-Exceptions
Version:
rev: 1.42 date: 2018/05/10 21:56:01
user: cg
file: Notification.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Stefan Vogel

Description:


Notification is the superclass of all notification signals in the system.
contrast to regular exceptions, Notifications are ignored, if no handler is present
and a default value is returned from the raise.
When a handler finishes, the do-block is proceeded with the exception handler's value
(an Exception does a return in this case.).

Thanks to proceedable exceptions, Notifications allow for non-GUI model code to provide
user notifications which are optionally shown.
Very useful, for example to provide progress information from a method which can be
invoked both from a GUI-Tool (where notifications are wanted) and also from the system,
where such notifications are not desired.


Related information:

    Signal
    QuerySignal
    Query

Class protocol:

answering queries
o  answer: someAnswer do: aBlock
evaluate the argument, aBlock.
If the receiver is queried during evaluation, answer and proceed with someAnswer.
This is a wrapper for #handle:do: for lazy typists; no new functionality.
usage example(s):
     Notification answer:true do:[
        Transcript showCR:'query answers: ' , (Query query printString).
     ]
usage example(s):
     Notification answer:false do:[
        Transcript showCR:'first query answers: ' , (Query query printString).
        Query answer:true do:[
            Transcript showCR:'second query answers: ' , (Query query printString).
        ]
     ]

initialization
o  initialize

misc ui support
o  iconInBrowserSymbol
( an extension from the stx:libtool package )
the browser will use this as index into the toolbariconlibrary

queries
o  accepts: aSignal
return true, if the receiver accepts the argument, aSignal.
(i.e. the receiver is aSignal or a parent of it). False otherwise.

o  defaultAnswer
Return the default answer to the Query. This method is called,
if nobody catches the signal.

Subclasses may redefine this method.

o  handlerForSignal: signal context: theContext originator: originator
answer the handler block for the signal from originator.
The block is retrieved from aContext.
Answer nil if the signal is not handled

o  handles: anException
return true, if the receiver handles the argument, anException.
(i.e. the receiver is anExceptions signal or a parent of it)

o  isQuerySignal
return true, if this is a querySignal - always return true here

o  notify: aMessageString
raise the query - return the handler's value, or the default
value, if there is no handler.

o  notify: aMessageString with: aParameter
raise the query - return the handler's value, or the default
value, if there is no handler.

o  query
raise the query - return the handler's value, or the default
value, if there is no handler.
Invoking the handler is exactly the functionality of Signal>>raiseRequest,
but we can do it faster here (avoiding the construction of an exception instance).

o  queryWith: aParameter
raise the query - return the handler's value, or the default
value, if there is no handler.
Invoking the handler is exactly the functionality of Signal>>raiseRequest,
but we can do it faster here (avoiding the construction of an exception instance).

o  raise
Notifications are proceedable by definition,
so they should be raised with #query or #raiseRequest

o  raiseRequest
redefined to use #query

utilities
o  deprecated
invoked by some open source packages (SOAP and YAXO, for example)


Instance protocol:

accessing
o  tag
for squeak compatibility

o  tag: aSzmbol
for squeak compatibility

default actions
o  defaultAction
the default action is to return the default value.
Subclasses may redefine this

helpers
o  hasDialog
answer true, if we can use a Dialog window

queries
o  notify
notice the implementation on the class-side: if no additional parameters are to be passed,
we do not even arrive here, because query has inlined the raiseRequest code

o  notify: aMessageString
notice the implementation on the class-side: if no additional parameters are to be passed,
we do not even arrive here, because query has inlined the raiseRequest code

o  query
notice the implementation on the class-side: if no additional parameters are to be passed,
we do not even arrive here, because query has inlined the raiseRequest code

testing
o  isNotification


Examples:


an up-notification from a deeply nested operation to a higher level:
  |zero|

  zero := 0.
  Notification handle:[:n |
      Transcript showCR:'Please note that: ' , n description.
      n proceedWith:true
  ] do:[
      'nesting'.
      [
          [
              Error handle:[:ex |
                  Transcript showCR:'some error: ' , ex errorString.
                  ex proceed
              ] do:[
                  [
                      1 // zero.  'an error which is caught in the handler'.
                      Notification notify:'hello world'
                  ] value
              ]
          ] value
      ] value
  ]


ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Mon, 19 Nov 2018 21:44:29 GMT