|
|
Class: Notification
Object
|
+--GenericException
|
+--Notification
|
+--ClassDescription::PackageRedefinition
|
+--Dolphin::Notification
|
+--EndOfStreamNotification
|
+--HTTPInterface::TransferProgressNotificationSignal
|
+--HTTPInterface::TransferTimeoutNotificationSignal
|
+--HTTPRequest::ReprocessRequest
|
+--HTTPServer::TerminationRequest
|
+--IncrementNotification
|
+--ObjectFileLoader::ObjectFileLoadErrorNotification
|
+--Parser::ParseWarning
|
+--Parser::UndefinedVariableNotification
|
+--Query
|
+--RecursiveStoreError
|
+--SimpleView::AboutToOpenBoxNotificationSignal
|
+--UserNotification
|
+--YesToAllConfirmation
- Package:
- stx:libbasic
- Category:
- Kernel-Exceptions
- Version:
- rev:
1.25
date: 2009/10/14 17:34:24
- user: cg
- file: Notification.st directory: libbasic
- module: stx stc-classLibrary: libbasic
- Author:
- Stefan Vogel
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 handlers 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.
Signal
QuerySignal
answering queries
-
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.
initialization
-
initialize
-
misc ui support
-
iconInBrowserSymbol
-
queries
-
accepts: aSignal
-
return true, if the receiver accepts the argument, aSignal.
(i.e. the receiver is aSignal or a parent of it). False otherwise.
-
defaultAnswer
-
Return the default answer to the Query. This method is called,
if nobody catches the signal.
Subclasses may redefine this method.
-
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
-
handles: anException
-
return true, if the receiver handles the argument, anException.
(i.e. the receiver is anExceptions signal or a parent of it)
-
isQuerySignal
-
return true, if this is a querySignal - always return true here
-
notify: aMessageString
-
raise the query - return the handlers value, or the default
value, if there is no handler.
-
query
-
raise the query - return the handlers 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).
-
raise
-
QuerySignals are proceedable by definition,
so they should be raised with #query or #raiseRequest
-
raiseRequest
-
redefined to use #query
default actions
-
defaultAction
-
the default action is to return the default value.
Subclasses may redefine this
private
-
LATERdoCallHandler: aHandlerBlock
-
SV: Have to think about...
queries
-
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
-
isNotification
-
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
]
|
|