ProgressNotification.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sun, 23 Jun 2019 23:04:24 +0000
branchjv
changeset 6071 5182891c9a14
parent 5318 aa51d67864a6
child 5500 821ec5a9d9c4
permissions -rw-r--r--
Fix slip `TerminalView >> innerHeight` Check for existence of the scrollbar - it may not exist if terminal is big enough to accomodate all the text.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3538
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 2008 by eXept Software AG
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libwidg2' }"
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
5304
4b50bec89cd5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
    14
"{ NameSpace: Smalltalk }"
4b50bec89cd5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
    15
3538
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
ActivityNotification subclass:#ProgressNotification
5318
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    17
	instanceVariableNames:'statusInfo'
3538
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'Kernel-Exceptions-Notifications'
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!ProgressNotification class methodsFor:'documentation'!
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
copyright
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 (c) 2008 by eXept Software AG
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
              All Rights Reserved
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 This software is furnished under a license and may be used
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 hereby transferred.
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
"
5318
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    37
!
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    38
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    39
documentation
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
    This should be used in long-going activites to tell the caller about any
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    42
    progress (percentage). 
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    43
    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
    44
    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
    45
    percentage display or whatever is useful in the UI.
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    46
    Examples are:
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    47
        http-requests, ftp requests, long lint checks etc.
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    48
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    49
    See examples on how this is used by searching for references to me.    
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    50
"
3538
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
! !
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
4157
67226e0d3d71 class: ProgressNotification
Stefan Vogel <sv@exept.de>
parents: 4138
diff changeset
    53
!ProgressNotification class methodsFor:'notification'!
3539
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    54
4138
e65b7c94ed2f added: #notify:progress:
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
    55
notify: message progress: progress
4157
67226e0d3d71 class: ProgressNotification
Stefan Vogel <sv@exept.de>
parents: 4138
diff changeset
    56
    ^ self new
4138
e65b7c94ed2f added: #notify:progress:
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
    57
        messageText: message;
e65b7c94ed2f added: #notify:progress:
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
    58
        parameter: progress;
e65b7c94ed2f added: #notify:progress:
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
    59
        raiseRequest
e65b7c94ed2f added: #notify:progress:
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
    60
e65b7c94ed2f added: #notify:progress:
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
    61
    "Created: / 31-07-2012 / 16:13:54 / cg"
e65b7c94ed2f added: #notify:progress:
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
    62
!
e65b7c94ed2f added: #notify:progress:
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
    63
3539
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    64
progressPercentage:aPercentageNumber
3541
7d676ed9b6bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
    65
    self raiseRequestWith:aPercentageNumber
3539
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    66
! !
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    67
5304
4b50bec89cd5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
    68
!ProgressNotification methodsFor:'accessing'!
3539
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    69
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    70
progressValue
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    71
    ^ parameter
5318
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    72
!
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    73
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    74
statusInfo
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    75
    "any additional info (opaque to me)"
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    76
    
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    77
    ^ statusInfo
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    78
!
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    79
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    80
statusInfo:something
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    81
    "any additional info (opaque to me)"
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    82
aa51d67864a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5304
diff changeset
    83
    statusInfo := something.
3539
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    84
! !
53b322935b6d changed #progressValue
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
    85
3538
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
!ProgressNotification class methodsFor:'documentation'!
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
version
5304
4b50bec89cd5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
    89
    ^ '$Header$'
3538
c0e7660db9ff initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
! !
5304
4b50bec89cd5 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4157
diff changeset
    91