UserNotification.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 31 Oct 2011 22:19:21 +0000
branchjv
changeset 17892 d86c8bd5ece3
parent 17869 9610c6c94e71
child 17910 8d796ca8bd1d
permissions -rw-r--r--
Merged with CVS

"
 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.
"
"{ Package: 'stx:libbasic' }"

Notification subclass:#UserNotification
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Kernel-Exceptions-Notifications'
!

!UserNotification class methodsFor:'documentation'!

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

!

documentation
"    
    UserNotification is the superclass of all user notification 
    signals in the system. It produces an info box with the message on the screen. 
    If no display is available, the message is written to the Transcript (headless operation).

    [author:]
        Stefan Vogel

    [see also:]
        Signal
"
!

examples
"
                                                            [exBegin]
    UserNotification raiseRequest
                                                            [exEnd]

                                                            [exBegin]
    UserNotification raiseErrorString:'huh ?'
                                                            [exEnd]

                                                            [exBegin]
    UserNotification raiseRequestWith:nil errorString:'what ?'
                                                            [exEnd]

                                                            [exBegin]
    UserNotification raiseRequestWith:nil errorString:' what ?'
                                                            [exEnd]
"
! !

!UserNotification class methodsFor:'initialization'!

initialize

    NotifierString := 'User Notification:'.

    "
     self initialize
    "

    "Created: / 23.7.1999 / 15:31:44 / stefan"
! !


!UserNotification class methodsFor:'notification'!

notify:aString
    self raiseErrorString:aString
! !

!UserNotification class methodsFor:'testing'!

isQuerySignal
    ^ true
! !

!UserNotification methodsFor:'default actions'!

defaultAction
    "Default action for notifications: open a info box with description"

    |text|

    text := self description.

    self hasDialog ifTrue:[
        Dialog information:text.
    ] ifFalse:[
        "
         on systems without GUI, simply show
         the message on the Transcript.
        "
        Transcript show:'notification: '; showCR:text.
    ].
    self proceed.


    "
      UserNotification raiseRequestErrorString:' abc'
    "

    "Modified: / 3.8.1999 / 14:06:55 / stefan"
! !

!UserNotification methodsFor:'helpers'!

hasDialog
    "answer true, if we can use a Dialog window"

    (Smalltalk isInitialized 
     and:[Dialog notNil
     and:[Screen notNil
     and:[Screen current notNil
     and:[Screen current isOpenAndDispatching
    ]]]]) ifTrue:[
        Dialog autoload.        "in case its autoloaded"
        ^ true.
    ].
    ^ false
! !

!UserNotification class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic/UserNotification.st,v 1.15 2009/10/14 17:34:46 cg Exp $'
!

version_CVS
    ^ '§Header: /cvs/stx/stx/libbasic/UserNotification.st,v 1.15 2009/10/14 17:34:46 cg Exp §'
!

version_SVN
    ^ '$Id: UserNotification.st 10729 2011-10-31 22:19:21Z vranyj1 $'
! !

UserNotification initialize!