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
         |
         +--Amb::FoundSolution
         |
         +--CascadingNotification
         |
         +--ClassDescription::PackageRedefinition
         |
         +--Dolphin::Notification
         |
         +--EndOfStreamNotification
         |
         +--HTTPInterface::RequestInformationSignal
         |
         +--HTTPInterface::TransferProgressNotificationSignal
         |
         +--HTTPInterface::TransferTimeoutNotificationSignal
         |
         +--HTTPRequest::ReprocessRequest
         |
         +--HTTPServer::TerminationRequest
         |
         +--IncrementNotification
         |
         +--NaiveRomanNumberFormatNotification
         |
         +--OSXOperatingSystem::SigUSR1Notification
         |
         +--ObjectFileLoader::ObjectFileLoadErrorNotification
         |
         +--ParseWarning
         |
         +--Parser::RestartCompilationSignal
         |
         +--ProceedingNotification
         |
         +--Query
         |
         +--RecursiveRestoreError
         |
         +--RecursiveStoreError
         |
         +--ResourcePack::DuplicateTranslation
         |
         +--ResourcePack::TranslationConflict
         |
         +--SocketErrorNotification
         |
         +--SystemNotification
         |
         +--TimeoutNotification
         |
         +--Tools::BreakpointService::FailedToSetBreakpointNotification
         |
         +--UndefinedVariableNotification
         |
         +--UnhandledAttributeInLiteralArrayErrorSignal
         |
         +--UserConfirmation
         |
         +--UserNotification
         |
         +--YesToAllConfirmation

Package:
stx:libbasic
Category:
Kernel-Exceptions
Version:
rev: 1.53 date: 2023/03/02 19:46:43
user: stefan
file: Notification.st directory: libbasic
module: stx stc-classLibrary: libbasic

Description:


Notification is the superclass of all notification signals in the system.
In contrast to regular exceptions, Notifications are ignored if no handler is present
and a default value is returned from the raiseRequest.

When a handler is present and finishes, the exception handling block 
is proceeded with the exception handler's value (an Exception does a #proceedWith: in this case.).

Thanks to proceedable exceptions, Notifications allow for non-GUI model code to provide
user notifications which are optionally shown. 
This is implemented in the UserNotification class hierarchy.

copyright

COPYRIGHT (c) 1999 by eXept Software AG 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  defaultNotifierString

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

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: aSignalOrExceptionClass
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: exceptionCreator 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 passing a parameter
- return the handler's value, or the default value, if there is no handler.

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: aSymbol
for squeak compatibility

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

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  notify: aMessageString with: aParameter

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.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sun, 21 Jul 2024 22:20:10 GMT