UserNotification.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 19 Jan 2012 11:46:00 +0000
branchjv
changeset 17911 a99f15c5efa5
parent 17910 8d796ca8bd1d
child 17966 8b5df02e171f
permissions -rw-r--r--
Updated with /trunk
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4549
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     1
"
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1999 by eXept Software AG
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     4
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    10
 hereby transferred.
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    11
"
6206
59d1ec1e1ed5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5295
diff changeset
    12
"{ Package: 'stx:libbasic' }"
59d1ec1e1ed5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5295
diff changeset
    13
17732
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
    14
Notification subclass:#UserNotification
4549
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:''
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
11198
090a44ec1648 category
Claus Gittinger <cg@exept.de>
parents: 10823
diff changeset
    18
	category:'Kernel-Exceptions-Notifications'
4549
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    19
!
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    20
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    21
!UserNotification class methodsFor:'documentation'!
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    22
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    23
copyright
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    24
"
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    25
 COPYRIGHT (c) 1999 by eXept Software AG
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    26
              All Rights Reserved
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    27
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    28
 This software is furnished under a license and may be used
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    33
 hereby transferred.
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    34
"
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    35
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    36
!
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    37
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    38
documentation
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    39
"    
7038
89e892bb8226 Documentation
Stefan Vogel <sv@exept.de>
parents: 7032
diff changeset
    40
    UserNotification is the superclass of all user notification 
17732
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
    41
    signals in the system. It produces an info box with the message on the screen. 
11198
090a44ec1648 category
Claus Gittinger <cg@exept.de>
parents: 10823
diff changeset
    42
    If no display is available, the message is written to the Transcript (headless operation).
4549
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    43
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    44
    [author:]
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    45
        Stefan Vogel
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    46
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    47
    [see also:]
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    48
        Signal
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    49
"
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    50
!
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    51
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    52
examples
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    53
"
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    54
                                                            [exBegin]
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    55
    UserNotification raiseRequest
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    56
                                                            [exEnd]
4554
db264efac2c0 Add copyright.
Stefan Vogel <sv@exept.de>
parents: 4549
diff changeset
    57
db264efac2c0 Add copyright.
Stefan Vogel <sv@exept.de>
parents: 4549
diff changeset
    58
                                                            [exBegin]
10814
31ca937978d7 comment
Claus Gittinger <cg@exept.de>
parents: 10516
diff changeset
    59
    UserNotification raiseErrorString:'huh ?'
31ca937978d7 comment
Claus Gittinger <cg@exept.de>
parents: 10516
diff changeset
    60
                                                            [exEnd]
31ca937978d7 comment
Claus Gittinger <cg@exept.de>
parents: 10516
diff changeset
    61
31ca937978d7 comment
Claus Gittinger <cg@exept.de>
parents: 10516
diff changeset
    62
                                                            [exBegin]
4554
db264efac2c0 Add copyright.
Stefan Vogel <sv@exept.de>
parents: 4549
diff changeset
    63
    UserNotification raiseRequestWith:nil errorString:'what ?'
db264efac2c0 Add copyright.
Stefan Vogel <sv@exept.de>
parents: 4549
diff changeset
    64
                                                            [exEnd]
db264efac2c0 Add copyright.
Stefan Vogel <sv@exept.de>
parents: 4549
diff changeset
    65
db264efac2c0 Add copyright.
Stefan Vogel <sv@exept.de>
parents: 4549
diff changeset
    66
                                                            [exBegin]
db264efac2c0 Add copyright.
Stefan Vogel <sv@exept.de>
parents: 4549
diff changeset
    67
    UserNotification raiseRequestWith:nil errorString:' what ?'
db264efac2c0 Add copyright.
Stefan Vogel <sv@exept.de>
parents: 4549
diff changeset
    68
                                                            [exEnd]
4549
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    69
"
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    70
! !
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    71
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    72
!UserNotification class methodsFor:'initialization'!
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    73
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    74
initialize
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    75
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    76
    NotifierString := 'User Notification:'.
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    77
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    78
    "
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    79
     self initialize
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    80
    "
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    81
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    82
    "Created: / 23.7.1999 / 15:31:44 / stefan"
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    83
! !
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    84
17865
598963c6ff8e Recommited from itself
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17846
diff changeset
    85
10823
a2efd924729a +notify:
Claus Gittinger <cg@exept.de>
parents: 10814
diff changeset
    86
!UserNotification class methodsFor:'notification'!
a2efd924729a +notify:
Claus Gittinger <cg@exept.de>
parents: 10814
diff changeset
    87
a2efd924729a +notify:
Claus Gittinger <cg@exept.de>
parents: 10814
diff changeset
    88
notify:aString
a2efd924729a +notify:
Claus Gittinger <cg@exept.de>
parents: 10814
diff changeset
    89
    self raiseErrorString:aString
a2efd924729a +notify:
Claus Gittinger <cg@exept.de>
parents: 10814
diff changeset
    90
! !
a2efd924729a +notify:
Claus Gittinger <cg@exept.de>
parents: 10814
diff changeset
    91
8703
d60d97138107 category
Stefan Vogel <sv@exept.de>
parents: 7557
diff changeset
    92
!UserNotification class methodsFor:'testing'!
7557
8eec03cef386 notifications are queries
Claus Gittinger <cg@exept.de>
parents: 7038
diff changeset
    93
8eec03cef386 notifications are queries
Claus Gittinger <cg@exept.de>
parents: 7038
diff changeset
    94
isQuerySignal
8eec03cef386 notifications are queries
Claus Gittinger <cg@exept.de>
parents: 7038
diff changeset
    95
    ^ true
8eec03cef386 notifications are queries
Claus Gittinger <cg@exept.de>
parents: 7038
diff changeset
    96
! !
8eec03cef386 notifications are queries
Claus Gittinger <cg@exept.de>
parents: 7038
diff changeset
    97
4549
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    98
!UserNotification methodsFor:'default actions'!
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    99
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   100
defaultAction
5295
f144309dab04 #errorString --> #description
Stefan Vogel <sv@exept.de>
parents: 4554
diff changeset
   101
    "Default action for notifications: open a info box with description"
4549
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   102
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   103
    |text|
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   104
5295
f144309dab04 #errorString --> #description
Stefan Vogel <sv@exept.de>
parents: 4554
diff changeset
   105
    text := self description.
4549
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   106
10516
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   107
    self hasDialog ifTrue:[
7032
3c0246b4e602 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 6206
diff changeset
   108
        Dialog information:text.
4549
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   109
    ] ifFalse:[
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   110
        "
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   111
         on systems without GUI, simply show
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   112
         the message on the Transcript.
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   113
        "
7032
3c0246b4e602 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 6206
diff changeset
   114
        Transcript show:'notification: '; showCR:text.
4549
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   115
    ].
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   116
    self proceed.
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   117
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   118
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   119
    "
7032
3c0246b4e602 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 6206
diff changeset
   120
      UserNotification raiseRequestErrorString:' abc'
4549
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   121
    "
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   122
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   123
    "Modified: / 3.8.1999 / 14:06:55 / stefan"
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   124
! !
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   125
10516
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   126
!UserNotification methodsFor:'helpers'!
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   127
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   128
hasDialog
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   129
    "answer true, if we can use a Dialog window"
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   130
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   131
    (Smalltalk isInitialized 
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   132
     and:[Dialog notNil
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   133
     and:[Screen notNil
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   134
     and:[Screen current notNil
11615
e88c6cc8718c care for dead display (non dispatching)
Claus Gittinger <cg@exept.de>
parents: 11198
diff changeset
   135
     and:[Screen current isOpenAndDispatching
10516
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   136
    ]]]]) ifTrue:[
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   137
        Dialog autoload.        "in case its autoloaded"
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   138
        ^ true.
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   139
    ].
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   140
    ^ false
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   141
! !
c68c7db81428 new: #hasDialog
Stefan Vogel <sv@exept.de>
parents: 8816
diff changeset
   142
4549
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   143
!UserNotification class methodsFor:'documentation'!
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   144
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   145
version
17892
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   146
    ^ '$Header: /cvs/stx/stx/libbasic/UserNotification.st,v 1.15 2009/10/14 17:34:46 cg Exp $'
17732
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   147
!
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   148
a1892eeca6c0 trunk merged into jv branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17711
diff changeset
   149
version_CVS
17845
7e0cfaac936d Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17841
diff changeset
   150
    ^ '§Header: /cvs/stx/stx/libbasic/UserNotification.st,v 1.15 2009/10/14 17:34:46 cg Exp §'
17865
598963c6ff8e Recommited from itself
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17846
diff changeset
   151
!
598963c6ff8e Recommited from itself
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17846
diff changeset
   152
598963c6ff8e Recommited from itself
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17846
diff changeset
   153
version_SVN
17911
a99f15c5efa5 Updated with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17910
diff changeset
   154
    ^ '$Id: UserNotification.st 10761 2012-01-19 11:46:00Z vranyj1 $'
4549
91a47cb22ba4 initial checkin
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   155
! !
7032
3c0246b4e602 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 6206
diff changeset
   156
17846
24edc476ac18 Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17845
diff changeset
   157
UserNotification initialize!
17892
d86c8bd5ece3 Merged with CVS
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17869
diff changeset
   158
17910
8d796ca8bd1d Merged with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17892
diff changeset
   159
17911
a99f15c5efa5 Updated with /trunk
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 17910
diff changeset
   160