|
Class: Notification
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.44
date: 2019/03/29 09:55:45
- 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 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.
Signal
QuerySignal
Query
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.
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
-
initialize
-
misc ui support
-
iconInBrowserSymbol ( an extension from the stx:libtool package )
-
the browser will use this as index into the toolbariconlibrary
queries
-
accepts: aSignalOrExceptionClass
-
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 handler's value, or the default
value, if there is no handler.
-
notify: aMessageString with: aParameter
-
raise the query - return the handler's value, or the default
value, if there is no handler.
-
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).
-
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).
-
raise
-
Notifications are proceedable by definition,
so they should be raised with #query or #raiseRequest
-
raiseRequest
-
redefined to use #query
utilities
-
deprecated
-
invoked by some open source packages (SOAP and YAXO, for example)
accessing
-
tag
-
for squeak compatibility
-
tag: aSzmbol
-
for squeak compatibility
default actions
-
defaultAction
-
the default action is to return the default value.
Subclasses may redefine this
helpers
-
hasDialog
-
answer true, if we can use a Dialog window
queries
-
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
-
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
-
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
-
-
suppressDialogIfUnhandled
-
controls if a dialog is to be shown
in the default action when unhandled, or not.
Can be redefined by subclasses
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
]
|
|