Tools__InlineMessageDialog.st
branchjv
changeset 12154 f27f8ee5ef3a
parent 12153 9ee558dfe859
child 12156 f610c47286d6
--- a/Tools__InlineMessageDialog.st	Sat Feb 11 22:16:34 2012 +0000
+++ b/Tools__InlineMessageDialog.st	Sun Feb 12 00:06:21 2012 +0000
@@ -28,8 +28,8 @@
 "{ NameSpace: Tools }"
 
 ApplicationModel subclass:#InlineMessageDialog
-	instanceVariableNames:'messageHolder progressHolder progressView specHolder worker
-		layout'
+	instanceVariableNames:'messageHolder progressHolder progressView specHolder
+		panelShownHolder panelHiddenHolder worker layout'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-Tools'
@@ -236,7 +236,17 @@
 
 progress: aNumberOrNil
 
-    self progressHolder value: aNumberOrNil
+    aNumberOrNil isNumber ifTrue:[
+        progressView notNil ifTrue:[
+            progressView showBusyIndication: false.
+        ].
+        self progressHolder value: aNumberOrNil
+    ] ifFalse:[
+        progressView notNil ifTrue:[
+            progressView showBusyIndication: true.
+        ]
+
+    ]
 
     "Created: / 28-10-2010 / 18:24:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
@@ -295,6 +305,36 @@
     ^ messageHolder.
 !
 
+panelHiddenHolder
+    "return/create the 'panelHiddenHolder' value holder (automatically generated)"
+
+    panelHiddenHolder isNil ifTrue:[
+        panelHiddenHolder := ValueHolder new.
+    ].
+    ^ panelHiddenHolder
+!
+
+panelHiddenHolder:aValueModel
+    "set the 'panelHiddenHolder' value holder (automatically generated)"
+
+    panelHiddenHolder := aValueModel.
+!
+
+panelShownHolder
+    "return/create the 'panelShownHolder' value holder (automatically generated)"
+
+    panelShownHolder isNil ifTrue:[
+        panelShownHolder := ValueHolder new.
+    ].
+    ^ panelShownHolder
+!
+
+panelShownHolder:aValueModel
+    "set the 'panelShownHolder' value holder (automatically generated)"
+
+    panelShownHolder := aValueModel.
+!
+
 progressHolder
     <resource: #uiAspect>
 
@@ -325,8 +365,37 @@
     "Modified: / 28-10-2010 / 18:29:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!InlineMessageDialog methodsFor:'hooks'!
+
+postBuildProgressView: aProgressIndicator
+    progressView := aProgressIndicator
+
+    "Created: / 10-02-2012 / 10:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !InlineMessageDialog methodsFor:'informing'!
 
+information: message 
+
+    self information: message timeout: nil
+
+    "Created: / 11-02-2012 / 23:14:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+information: message timeout: timeoutOrNil
+
+    self message: message.
+    self show: #messageInfoSpec.
+    timeoutOrNil isInteger ifTrue:[
+        [
+            Delay waitForSeconds: timeoutOrNil.
+            self hide.
+        ] fork.
+    ]
+
+    "Created: / 11-02-2012 / 23:14:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 progress: label while: block
 
     worker := [
@@ -335,10 +404,10 @@
         self show: #progressInfoSpec.
         [
             block value.    
-        ] on: ProgressNotification do:[:ex|
-            self progress: ex progressValue.
+        ] on: ProgressNotification , ActivityNotification do:[:ex|
+            self progress: ex parameter.
             ex messageText notNil ifTrue:[
-                self message: ex message.    
+                self message: ex messageText.    
             ].
             ex proceed.
         ].
@@ -352,18 +421,6 @@
     "Created: / 10-02-2012 / 10:34:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
-!InlineMessageDialog methodsFor:'initializing'!
-
-postBuildProgressView: aView
-
-    aView showBusyIndication:
-        (BlockValue
-            with: [:p|p value isNil]
-            argument: self progressHolder)
-
-    "Created: / 10-02-2012 / 10:42:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
 !InlineMessageDialog methodsFor:'private'!
 
 getMyView
@@ -383,7 +440,11 @@
     | myView |
 
     myView := self getMyView.
-    ^myView superView subViews after: myView
+    ^ myView superView isNil ifTrue:[
+        nil.    
+    ] ifFalse: [
+        myView superView subViews after: myView
+    ].
 
     "Created: / 29-10-2010 / 11:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
@@ -396,6 +457,13 @@
 
     myView isVisible ifFalse:[^self]."/already hidden"
     myView isVisible: false.
+    panelShownHolder notNil ifTrue:[
+        panelShownHolder value: false
+    ].
+    panelHiddenHolder notNil ifTrue:[
+        panelHiddenHolder value: true
+    ].
+
     otherView  layout: layout
 
     "Created: / 29-10-2010 / 11:55:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -409,6 +477,13 @@
     myView isVisible ifTrue:[^self]."/already shown"
     layout := otherView layout copy.
     myView isVisible: true.
+    panelShownHolder notNil ifTrue:[
+        panelShownHolder value: true
+    ].
+    panelHiddenHolder notNil ifTrue:[
+        panelHiddenHolder value: false
+    ].
+
     otherView  layout: 
         (layout copy topOffset: layout topOffset + 40; yourself).
     self specHolder value: spec.
@@ -418,10 +493,14 @@
 
 !InlineMessageDialog class methodsFor:'documentation'!
 
+version
+    ^ '$Id: Tools__InlineMessageDialog.st 7882 2012-02-12 00:06:21Z vranyj1 $'
+!
+
 version_CVS
-    ^ '§Header: /cvs/stx/stx/libtool/Tools__InlineMessageDialog.st,v 1.3 2011/08/04 21:30:34 cg Exp §'
+    ^ '§Header: /cvs/stx/stx/libtool/Tools__InlineMessageDialog.st,v 1.4 2012-02-11 23:35:59 +0000 vrany Exp §'
 !
 
 version_SVN
-    ^ '$Id: Tools__InlineMessageDialog.st 7881 2012-02-11 22:16:34Z vranyj1 $'
+    ^ '$Id: Tools__InlineMessageDialog.st 7882 2012-02-12 00:06:21Z vranyj1 $'
 ! !