Tools__InlineMessageDialog.st
changeset 9987 7c447dac9d3d
child 10099 0389fc528712
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tools__InlineMessageDialog.st	Fri Jul 01 15:22:37 2011 +0200
@@ -0,0 +1,349 @@
+"
+ COPYRIGHT (c) 2006 by eXept Software AG
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+"{ Package: 'stx:libtool' }"
+
+"{ NameSpace: Tools }"
+
+ApplicationModel subclass:#InlineMessageDialog
+	instanceVariableNames:'messageHolder progressHolder specHolder'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Interface-Tools'
+!
+
+!InlineMessageDialog class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 2006 by eXept Software AG
+	      All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+! !
+
+!InlineMessageDialog class methodsFor:'interface specs'!
+
+messageInfoSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:Tools::NewSystemBrowser andSelector:#messageInfoSpec
+     Tools::NewSystemBrowser new openInterface:#messageInfoSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: messageInfoSpec
+        window: 
+       (WindowSpec
+          label: 'MessageInfo'
+          name: 'MessageInfo'
+          min: (Point 10 10)
+          bounds: (Rectangle 0 0 800 40)
+          backgroundColor: (Color 100.0 78.0392156862745 22.7450980392157)
+          forceRecursiveBackgroundOfDefaultBackground: true
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (LabelSpec
+              label: 'Label'
+              name: 'Message'
+              layout: (LayoutFrame 10 0 -10 0.5 -90 1 10 0.5)
+              backgroundColor: (Color 100.0 78.0392156862745 22.7450980392157)
+              translateLabel: true
+              labelChannel: messageHolder
+              adjust: left
+            )
+           (ActionButtonSpec
+              label: 'OK'
+              name: 'OK'
+              layout: (LayoutFrame -80 1 -12 0.5 -12 1 12 0.5)
+              translateLabel: true
+              model: doOK
+            )
+           )
+         
+        )
+      )
+
+    "Modified: / 28-10-2010 / 18:30:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+progressInfoSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:Tools::InlineMessageDialog andSelector:#progressInfoSpec
+     Tools::InlineMessageDialog new openInterface:#progressInfoSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: progressInfoSpec
+        window: 
+       (WindowSpec
+          label: 'ProgressInfo'
+          name: 'ProgressInfo'
+          min: (Point 10 10)
+          bounds: (Rectangle 0 0 800 40)
+          backgroundColor: (Color 100.0 78.0392156862745 22.7450980392157)
+          forceRecursiveBackgroundOfDefaultBackground: true
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (LabelSpec
+              label: 'Label'
+              name: 'Message'
+              layout: (LayoutFrame 10 0 0 0 -90 1 20 0)
+              backgroundColor: (Color 100.0 78.0392156862745 22.7450980392157)
+              translateLabel: true
+              labelChannel: messageHolder
+              adjust: left
+            )
+           (ProgressIndicatorSpec
+              name: 'ProgressIndicator'
+              layout: (LayoutFrame 10 0 -20 1 -90 1 -3 1)
+              model: progressHolder
+              foregroundColor: (Color 52.156862745098 37.2549019607843 0.0)
+              backgroundColor: (Color 100.0 91.3725490196078 70.1960784313726)
+            )
+           (ActionButtonSpec
+              label: 'Abort'
+              name: 'Abort'
+              layout: (LayoutFrame -80 1 -12 0.5 -12 1 12 0.5)
+              translateLabel: true
+              model: doAbort
+            )
+           )
+         
+        )
+      )
+!
+
+windowSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:Tools::InlineMessageDialog andSelector:#windowSpec
+     Tools::InlineMessageDialog new openInterface:#windowSpec
+     Tools::InlineMessageDialog open
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: windowSpec
+        window: 
+       (WindowSpec
+          label: 'Tools::InlineMessageDialog'
+          name: 'Tools::InlineMessageDialog'
+          min: (Point 10 10)
+          bounds: (Rectangle 0 0 800 40)
+          backgroundColor: (Color 100.0 78.0392156862745 22.7450980392157)
+          forceRecursiveBackgroundOfDefaultBackground: true
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (SubCanvasSpec
+              name: 'InfoSpec'
+              layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+              hasHorizontalScrollBar: false
+              hasVerticalScrollBar: false
+              miniScrollerHorizontal: false
+              specHolder: specHolder
+              createNewBuilder: false
+            )
+           )
+         
+        )
+      )
+! !
+
+!InlineMessageDialog methodsFor:'accessing'!
+
+message: aString
+
+    self messageHolder value: aString
+
+    "Created: / 28-10-2010 / 18:23:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+progress: aNumberOrNil
+
+    self progressHolder value: aNumberOrNil
+
+    "Created: / 28-10-2010 / 18:24:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!InlineMessageDialog methodsFor:'actions'!
+
+doAbort
+    <resource: #uiCallback>
+
+    "automatically generated by UIPainter..."
+
+    "*** the code below performs no action"
+    "*** (except for some feedback on the Transcript)"
+    "*** Please change as required and accept in the browser."
+    "*** (and replace this comment by something more useful ;-)"
+
+    "action to be defined here..."
+
+    Transcript showCR:self class name, ': action for doAbort ...'.
+!
+
+doOK
+    <resource: #uiCallback>
+
+    self hide.
+
+    "Modified: / 28-10-2010 / 18:21:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!InlineMessageDialog methodsFor:'aspects'!
+
+messageHolder
+    <resource: #uiAspect>
+
+    "automatically generated by UIPainter ..."
+
+    "*** the code below creates a default model when invoked."
+    "*** (which may not be the one you wanted)"
+    "*** Please change as required and accept it in the browser."
+    "*** (and replace this comment by something more useful ;-)"
+
+    messageHolder isNil ifTrue:[
+        messageHolder := ValueHolder new.
+"/ if your app needs to be notified of changes, uncomment one of the lines below:
+"/       messageHolder addDependent:self.
+"/       messageHolder onChangeSend:#messageHolderChanged to:self.
+    ].
+    ^ messageHolder.
+!
+
+progressHolder
+    <resource: #uiAspect>
+
+    "automatically generated by UIPainter ..."
+
+    "*** the code below creates a default model when invoked."
+    "*** (which may not be the one you wanted)"
+    "*** Please change as required and accept it in the browser."
+    "*** (and replace this comment by something more useful ;-)"
+
+    progressHolder isNil ifTrue:[
+        progressHolder := ValueHolder new.
+"/ if your app needs to be notified of changes, uncomment one of the lines below:
+"/       progressHolder addDependent:self.
+"/       progressHolder onChangeSend:#progressHolderChanged to:self.
+    ].
+    ^ progressHolder.
+!
+
+specHolder
+    "return/create the 'specHolder' value holder (automatically generated)"
+
+    specHolder isNil ifTrue:[
+        specHolder := ValueHolder with: #messageInfoSpec.
+    ].
+    ^ specHolder
+
+    "Modified: / 28-10-2010 / 18:29:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!InlineMessageDialog methodsFor:'private'!
+
+getMyView
+
+    | v |
+
+    v := builder window.
+    ^(v superView isKindOf: SubCanvas)
+        ifTrue:[v superView]
+        ifFalse:[v]
+
+    "Created: / 29-10-2010 / 11:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+getOtherView
+
+    | myView |
+
+    myView := self getMyView.
+    ^myView superView subViews after: myView
+
+    "Created: / 29-10-2010 / 11:49:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+hide
+
+    | myView otherView |
+    myView := self  getMyView.
+    otherView := self getOtherView.
+
+    myView isVisible ifFalse:[^self]."/already hidden"
+    myView isVisible: false.
+    otherView  layout: 
+        (otherView layout topOffset: 0; yourself)
+
+    "Created: / 29-10-2010 / 11:55:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+show: spec
+
+    | myView otherView |
+    myView := self getMyView.
+    otherView := self getOtherView.
+    myView isVisible ifTrue:[^self]."/already shown"
+    myView isVisible: true.
+    otherView  layout: 
+        (otherView layout topOffset: 40; yourself).
+    self specHolder value: spec.
+
+    "Created: / 29-10-2010 / 11:48:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!InlineMessageDialog class methodsFor:'documentation'!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__InlineMessageDialog.st,v 1.1 2011-07-01 13:22:37 cg Exp $'
+!
+
+version_SVN
+    ^ '§Id: Tools__InlineMessageDialog.st 7646 2010-10-29 14:44:02Z vranyj1 §'
+! !