Tools__InlineMessageDialog.st
branchjv
changeset 15566 184cea584be5
parent 12807 ba8c5416aa28
parent 15500 3822905f9e58
child 15743 cd30f981f1c4
--- a/Tools__InlineMessageDialog.st	Sun Jan 12 23:30:25 2014 +0000
+++ b/Tools__InlineMessageDialog.st	Wed Apr 01 10:38:01 2015 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague
  Copyright (c) 2009-2010 eXept Software AG
@@ -31,7 +33,8 @@
 	instanceVariableNames:'messageHolder progressHolder backgroundColorHolder
 		backgroundColorOrDefaultHolder progressView panelView
 		panelViewComponents specHolder panelShownHolder panelHiddenHolder
-		worker layout changeLayoutUponShowHide'
+		worker layout changeLayoutUponShowHide
+		progressIndicatorForegroundHolder'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-Tools'
@@ -109,15 +112,14 @@
 !InlineMessageDialog class methodsFor:'accessing-colors'!
 
 defaultInformationBackground
-
-    ^(Color red:100.0 green:78.0392156862745 blue:22.7450980392157)
+    ^ (Color red:100.0 green:78 blue:23)
 
     "Created: / 10-04-2012 / 19:31:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 defaultWarningBackground
 
-    ^(Color red:76.078431372549 green:43.1372549019608 blue:43.1372549019608)
+    ^(Color red:76 green:43 blue:43)
 
     "Created: / 10-04-2012 / 19:30:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
@@ -181,53 +183,53 @@
     <resource: #canvas>
 
     ^ 
-     #(FullSpec
-        name: progressInfoSpec
-        window: 
-       (WindowSpec
-          label: 'ProgressInfo'
-          name: 'ProgressInfo'
-          min: (Point 10 10)
-          bounds: (Rectangle 0 0 800 40)
-          forceRecursiveBackgroundOfDefaultBackground: true
-        )
-        component: 
-       (SpecCollection
-          collection: (
-           (ViewSpec
-              name: 'Box1'
-              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
-              level: 0
-              backgroundChannel: backgroundColorOrDefaultHolder
-              component: 
-             (SpecCollection
-                collection: (
-                 (LabelSpec
-                    label: 'Label'
-                    name: 'Message'
-                    layout: (LayoutFrame 0 0 0 0 -20 1 20 0)
-                    backgroundChannel: backgroundColorOrDefaultHolder
-                    translateLabel: true
-                    labelChannel: messageHolder
-                    adjust: left
-                  )
-                 (ProgressIndicatorSpec
-                    name: 'ProgressIndicator'
-                    layout: (LayoutFrame 0 0 -20 1 -20 1 -3 1)
-                    level: 0
-                    backgroundChannel: backgroundColorOrDefaultHolder
-                    model: progressHolder
-                    foregroundColor: (Color 52.156862745098 37.2549019607843 0.0)
-                    postBuildCallback: postBuildProgressView:
-                  )
+    #(FullSpec
+       name: progressInfoSpec
+       window: 
+      (WindowSpec
+         label: 'ProgressInfo'
+         name: 'ProgressInfo'
+         min: (Point 10 10)
+         bounds: (Rectangle 0 0 800 40)
+         forceRecursiveBackgroundOfDefaultBackground: true
+       )
+       component: 
+      (SpecCollection
+         collection: (
+          (ViewSpec
+             name: 'Box1'
+             layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+             level: 0
+             backgroundChannel: backgroundColorOrDefaultHolder
+             component: 
+            (SpecCollection
+               collection: (
+                (LabelSpec
+                   label: 'Label'
+                   name: 'Message'
+                   layout: (LayoutFrame 0 0 0 0 -20 1 20 0)
+                   backgroundChannel: backgroundColorOrDefaultHolder
+                   translateLabel: true
+                   labelChannel: messageHolder
+                   adjust: left
                  )
-               
-              )
-            )
+                (ProgressIndicatorSpec
+                   name: 'ProgressIndicator'
+                   layout: (LayoutFrame 0 0 -20 1 -20 1 -3 1)
+                   level: 0
+                   backgroundChannel: backgroundColorOrDefaultHolder
+                   foregroundChannel: progressIndicatorForegroundHolder
+                   model: progressHolder
+                   postBuildCallback: postBuildProgressView:
+                 )
+                )
+              
+             )
            )
-         
-        )
-      )
+          )
+        
+       )
+     )
 !
 
 warningInfoSpec
@@ -318,12 +320,7 @@
 !InlineMessageDialog class methodsFor:'others'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__InlineMessageDialog.st,v 1.12 2013-04-19 09:37:06 cg Exp $'
-!
-
-version_HG
-
-    ^ '$Changeset: <not expanded> $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__InlineMessageDialog.st,v 1.17 2015-03-03 10:42:31 vrany Exp $'
 ! !
 
 !InlineMessageDialog methodsFor:'accessing'!
@@ -333,12 +330,32 @@
      not set"
 
     backgroundColorHolder isNil ifTrue:[
-        self backgroundColorOrDefaultHolder value: aColor
+        self backgroundColorOrDefaultHolder value: aColor.
+        self progressIndicatorForegroundHolder value:(aColor darkened).
     ]
 
     "Created: / 10-04-2012 / 19:38:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+buttons
+    panelView isNil ifTrue:[ ^ #() ].
+    ^ OrderedCollection streamContents:[ :s |
+        panelView allSubViewsDo:[:v |
+            (v class == Button or:[ v class == LinkButton ]) ifTrue:[ 
+                s nextPut: v
+            ].
+        ]
+    ]
+
+    "Created: / 03-03-2015 / 10:10:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+message
+    ^ self messageHolder value
+
+    "Created: / 03-03-2015 / 10:06:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 message: aString
 
     self messageHolder value: aString
@@ -484,16 +501,30 @@
 !
 
 beProgress
+    |colorOrNil|
 
-    self backgroundColor: self class defaultInformationBackground.
+    "/ never, ever use explicit colors. 
+    "/ If at all, ask the stylesheet and add it to your personal one.
+    "/ (Don't expect otherss to also like your color preferences)
+"/    colorOrNil := self class defaultInformationBackground.
+
+     colorOrNil := View styleSheet colorAt:'inlineMessageDialog.information.backgroundColor' default:View defaultBackgroundColor.
+    self backgroundColor: colorOrNil.
     self specHolder value: #progressInfoSpec
 
     "Created: / 11-04-2012 / 11:41:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 beWarning
+    |colorOrNil|
 
-    self backgroundColor: self class defaultWarningBackground.
+    "/ never, ever use explicit colors. 
+    "/ If at all, ask the stylesheet and add it to your personal one.
+    "/ (Don't expect others to also like your color preferences)
+
+    "/ colorOrNil := self class defaultWarningBackground.
+    colorOrNil := View styleSheet colorAt:'inlineMessageDialog.warning.backgroundColor' default:(self class defaultWarningBackground).
+    self backgroundColor: colorOrNil.
     self specHolder value: #messageInfoSpec
 
     "Created: / 11-04-2012 / 11:41:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -623,6 +654,13 @@
     ^ progressHolder.
 !
 
+progressIndicatorForegroundHolder
+    progressIndicatorForegroundHolder isNil ifTrue:[
+        progressIndicatorForegroundHolder := ValueHolder new.
+    ].
+    ^ progressIndicatorForegroundHolder
+!
+
 specHolder
     "return/create the 'specHolder' value holder (automatically generated)"
 
@@ -774,6 +812,30 @@
     "Created: / 29-10-2010 / 11:48:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!InlineMessageDialog methodsFor:'testing'!
+
+isMessageOrWarning
+    ^ self specHolder value == #messageInfoSpec.
+
+    "Created: / 20-06-2014 / 11:25:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isProgress
+    ^ self specHolder value == #progressInfoSpec.
+
+    "Created: / 20-06-2014 / 11:25:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isVisible
+    | myView |
+
+    myView := self getMyView.
+    ^ myView notNil and:[ myView isVisible ]
+
+    "Created: / 20-06-2014 / 11:26:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 07-11-2014 / 11:13:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !InlineMessageDialog methodsFor:'utilities'!
 
 reset
@@ -939,10 +1001,15 @@
 !InlineMessageDialog class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__InlineMessageDialog.st,v 1.12 2013-04-19 09:37:06 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__InlineMessageDialog.st,v 1.17 2015-03-03 10:42:31 vrany Exp $'
+!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
 !
 
 version_SVN
-    ^ 'Id: Tools__InlineMessageDialog.st 7976 2012-04-11 16:14:22Z vranyj1 '
+    ^ '$Id: Tools__InlineMessageDialog.st,v 1.17 2015-03-03 10:42:31 vrany Exp $'
 ! !