ProgressNotification.st
author Claus Gittinger <cg@exept.de>
Fri, 15 Jun 2018 10:54:35 +0200
changeset 5816 7876c07931a7
parent 5715 7af87f717f65
child 6187 285169601f27
permissions -rw-r--r--
#DOCUMENTATION by cg class: ComboListView class comment/format in: #documentation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5715
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
     1
"{ Encoding: utf8 }"
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
     2
3538
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
 COPYRIGHT (c) 2008 by eXept Software AG
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
              All Rights Reserved
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 This software is furnished under a license and may be used
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
 hereby transferred.
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
"{ Package: 'stx:libwidg2' }"
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
5304
4b50bec89cd5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
    16
"{ NameSpace: Smalltalk }"
4b50bec89cd5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
    17
3538
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
ActivityNotification subclass:#ProgressNotification
5318
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    19
	instanceVariableNames:'statusInfo'
3538
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	classVariableNames:''
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	poolDictionaries:''
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	category:'Kernel-Exceptions-Notifications'
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
!ProgressNotification class methodsFor:'documentation'!
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
copyright
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
"
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 COPYRIGHT (c) 2008 by eXept Software AG
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
              All Rights Reserved
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 This software is furnished under a license and may be used
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 only in accordance with the terms of that license and with the
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 be provided or otherwise made available to, or used by, any
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 other person.  No title to or ownership of the software is
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
 hereby transferred.
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
"
5318
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    39
!
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    40
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    41
documentation
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    42
"
5543
68eca683b70d #DOCUMENTATION by mawalch
mawalch
parents: 5500
diff changeset
    43
    This should be used in long-going activities to tell the caller about any
68eca683b70d #DOCUMENTATION by mawalch
mawalch
parents: 5500
diff changeset
    44
    progress (percentage).
5318
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    45
    Being a notification, it will be ignored if no one is interested.
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    46
    If someone is interested, the caller may present this information as a progress-bar,
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    47
    percentage display or whatever is useful in the UI.
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    48
    Examples are:
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    49
        http-requests, ftp requests, long lint checks etc.
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    50
5715
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    51
    See examples (look for references to this class) on how this is used.
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    52
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    53
     ProgressNotification handle:[:ex |
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    54
        Transcript showCR:(ex progressValue rounded).
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    55
        ex proceed.
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    56
     ] do:[
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    57
         #(0 1 2 3 4 5 6 6 7 8 9)
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    58
             do:[:i| Delay waitForMilliseconds: 50]
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    59
             displayingProgress: 'Progress'
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    60
     ].
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    61
5318
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    62
"
3538
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
! !
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
4157
67226e0d3d71 class: ProgressNotification
Stefan Vogel <sv@exept.de>
parents: 4138
diff changeset
    65
!ProgressNotification class methodsFor:'notification'!
3539
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    66
5715
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    67
notify:message progress:aPercentageNumber
4157
67226e0d3d71 class: ProgressNotification
Stefan Vogel <sv@exept.de>
parents: 4138
diff changeset
    68
    ^ self new
4138
e65b7c94ed2f added: #notify:progress:
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
    69
        messageText: message;
5715
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    70
        parameter: aPercentageNumber;
4138
e65b7c94ed2f added: #notify:progress:
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
    71
        raiseRequest
e65b7c94ed2f added: #notify:progress:
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
    72
e65b7c94ed2f added: #notify:progress:
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
    73
    "Created: / 31-07-2012 / 16:13:54 / cg"
e65b7c94ed2f added: #notify:progress:
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
    74
!
e65b7c94ed2f added: #notify:progress:
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
    75
3539
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    76
progressPercentage:aPercentageNumber
5500
821ec5a9d9c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5318
diff changeset
    77
    ^ self basicNew
821ec5a9d9c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5318
diff changeset
    78
        raiseRequestWith:aPercentageNumber 
821ec5a9d9c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5318
diff changeset
    79
        in:thisContext sender
821ec5a9d9c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5318
diff changeset
    80
821ec5a9d9c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5318
diff changeset
    81
    "Modified: / 23-02-2017 / 16:51:52 / cg"
821ec5a9d9c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5318
diff changeset
    82
!
821ec5a9d9c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5318
diff changeset
    83
821ec5a9d9c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5318
diff changeset
    84
progressPercentage:aPercentageNumber statusInfo:statusInfo
821ec5a9d9c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5318
diff changeset
    85
    ^ self basicNew
821ec5a9d9c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5318
diff changeset
    86
        statusInfo:statusInfo;
821ec5a9d9c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5318
diff changeset
    87
        raiseRequestWith:aPercentageNumber 
821ec5a9d9c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5318
diff changeset
    88
        in:thisContext sender
821ec5a9d9c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5318
diff changeset
    89
821ec5a9d9c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5318
diff changeset
    90
    "Created: / 23-02-2017 / 16:52:11 / cg"
3539
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    91
! !
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    92
5304
4b50bec89cd5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
    93
!ProgressNotification methodsFor:'accessing'!
3539
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    94
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    95
progressValue
5715
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    96
    "answer the parameter that was passed to the notification requrest
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    97
     as percentage parameter"
7af87f717f65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5543
diff changeset
    98
3539
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    99
    ^ parameter
5318
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
   100
!
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
   101
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
   102
statusInfo
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
   103
    "any additional info (opaque to me)"
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
   104
    
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
   105
    ^ statusInfo
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
   106
!
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
   107
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
   108
statusInfo:something
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
   109
    "any additional info (opaque to me)"
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
   110
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
   111
    statusInfo := something.
3539
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
   112
! !
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
   113
3538
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
!ProgressNotification class methodsFor:'documentation'!
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
version
5304
4b50bec89cd5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
   117
    ^ '$Header$'
3538
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
! !
5304
4b50bec89cd5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
   119