ProgressNotification.st
changeset 5715 7af87f717f65
parent 5543 68eca683b70d
child 6187 285169601f27
equal deleted inserted replaced
5714:043564e0ae20 5715:7af87f717f65
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 2008 by eXept Software AG
     4  COPYRIGHT (c) 2008 by eXept Software AG
     3               All Rights Reserved
     5               All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
    44     If someone is interested, the caller may present this information as a progress-bar,
    46     If someone is interested, the caller may present this information as a progress-bar,
    45     percentage display or whatever is useful in the UI.
    47     percentage display or whatever is useful in the UI.
    46     Examples are:
    48     Examples are:
    47         http-requests, ftp requests, long lint checks etc.
    49         http-requests, ftp requests, long lint checks etc.
    48 
    50 
    49     See examples on how this is used by searching for references to me.
    51     See examples (look for references to this class) on how this is used.
       
    52 
       
    53      ProgressNotification handle:[:ex |
       
    54         Transcript showCR:(ex progressValue rounded).
       
    55         ex proceed.
       
    56      ] do:[
       
    57          #(0 1 2 3 4 5 6 6 7 8 9)
       
    58              do:[:i| Delay waitForMilliseconds: 50]
       
    59              displayingProgress: 'Progress'
       
    60      ].
       
    61 
    50 "
    62 "
    51 ! !
    63 ! !
    52 
    64 
    53 !ProgressNotification class methodsFor:'notification'!
    65 !ProgressNotification class methodsFor:'notification'!
    54 
    66 
    55 notify: message progress: progress
    67 notify:message progress:aPercentageNumber
    56     ^ self new
    68     ^ self new
    57         messageText: message;
    69         messageText: message;
    58         parameter: progress;
    70         parameter: aPercentageNumber;
    59         raiseRequest
    71         raiseRequest
    60 
    72 
    61     "Created: / 31-07-2012 / 16:13:54 / cg"
    73     "Created: / 31-07-2012 / 16:13:54 / cg"
    62 !
    74 !
    63 
    75 
    64 progressPercentage:aPercentageNumber
    76 progressPercentage:aPercentageNumber
    65     ^ self basicNew
    77     ^ self basicNew
    66         raiseRequestWith:aPercentageNumber 
    78         raiseRequestWith:aPercentageNumber 
    67         in:thisContext sender
    79         in:thisContext sender
    68     "/ self raiseRequestWith:aPercentageNumber
       
    69 
    80 
    70     "Modified: / 23-02-2017 / 16:51:52 / cg"
    81     "Modified: / 23-02-2017 / 16:51:52 / cg"
    71 !
    82 !
    72 
    83 
    73 progressPercentage:aPercentageNumber statusInfo:statusInfo
    84 progressPercentage:aPercentageNumber statusInfo:statusInfo
    74     ^ self basicNew
    85     ^ self basicNew
    75         statusInfo:statusInfo;
    86         statusInfo:statusInfo;
    76         raiseRequestWith:aPercentageNumber 
    87         raiseRequestWith:aPercentageNumber 
    77         in:thisContext sender
    88         in:thisContext sender
    78     "/ self raiseRequestWith:aPercentageNumber
       
    79 
    89 
    80     "Created: / 23-02-2017 / 16:52:11 / cg"
    90     "Created: / 23-02-2017 / 16:52:11 / cg"
    81 ! !
    91 ! !
    82 
    92 
    83 !ProgressNotification methodsFor:'accessing'!
    93 !ProgressNotification methodsFor:'accessing'!
    84 
    94 
    85 progressValue
    95 progressValue
       
    96     "answer the parameter that was passed to the notification requrest
       
    97      as percentage parameter"
       
    98 
    86     ^ parameter
    99     ^ parameter
    87 !
   100 !
    88 
   101 
    89 statusInfo
   102 statusInfo
    90     "any additional info (opaque to me)"
   103     "any additional info (opaque to me)"