--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SVN__Dialog.st Wed Sep 23 18:48:42 2009 +0200
@@ -0,0 +1,720 @@
+"{ Package: 'cvut:stx/goodies/libsvn' }"
+
+"{ NameSpace: SVN }"
+
+SimpleDialog subclass:#Dialog
+ instanceVariableNames:'modelHolder titleHolder subtitleHolder infoHolder
+ progressIndicator worker'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'SVN-UI-Dialogs'
+!
+
+!Dialog class methodsFor:'documentation'!
+
+version_SVN
+ ^'$Id$'
+! !
+
+!Dialog class methodsFor:'instance creation'!
+
+on: model
+
+ ^self new
+ model: model;
+ yourself
+
+ "Created: / 14-04-2008 / 11:09:38 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Dialog class methodsFor:'image specs'!
+
+dialogIcon
+ ^ IconLibrary svn_wizban
+
+ "Created: / 13-04-2008 / 11:06:56 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Dialog class methodsFor:'interface opening'!
+
+openOn: model
+
+
+ ^(self on: model) open
+
+ "Created: / 14-04-2008 / 11:09:38 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 19-04-2008 / 13:17:11 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Dialog class methodsFor:'interface specs'!
+
+buttonsSpec
+ "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:SVN::Dialog andSelector:#buttonsSpec
+ SVN::Dialog new openInterface:#buttonsSpec
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: buttonsSpec
+ window:
+ (WindowSpec
+ label: 'Buttons'
+ name: 'Buttons'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 400 30)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (HorizontalPanelViewSpec
+ name: 'ButtonPanel'
+ layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+ horizontalLayout: rightSpace
+ verticalLayout: center
+ horizontalSpace: 3
+ verticalSpace: 3
+ component:
+ (SpecCollection
+ collection: (
+ (ActionButtonSpec
+ label: 'OK'
+ name: 'AcceptButton'
+ translateLabel: true
+ labelChannel: acceptButtonTitleAspect
+ model: doAccept
+ enableChannel: canDoAcceptAspect
+ extent: (Point 125 22)
+ )
+ (ActionButtonSpec
+ label: 'Cancel'
+ name: 'CancelButton'
+ translateLabel: true
+ model: doCancel
+ extent: (Point 125 22)
+ )
+ )
+
+ )
+ )
+ )
+
+ )
+ )
+
+ "Modified: / 13-04-2008 / 11:09:06 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+contentSpec
+ "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:SVN::Dialog andSelector:#contentSpec
+ SVN::Dialog new openInterface:#contentSpec
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: contentSpec
+ window:
+ (WindowSpec
+ label: 'Dialog'
+ name: 'Dialog'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 300 300)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (LabelSpec
+ label: 'You should override #contentSpec'
+ name: 'Message'
+ layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+ translateLabel: true
+ )
+ )
+
+ )
+ )
+!
+
+messageSpec
+ "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:SVN::Dialog andSelector:#messageSpec
+ SVN::Dialog new openInterface:#messageSpec
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: messageSpec
+ window:
+ (WindowSpec
+ label: 'Message'
+ name: 'Message'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 300 300)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (HTMLViewSpec
+ name: 'HTMLBrowser'
+ layout: (LayoutFrame 20 0 20 0 -20 1 -20 1)
+ level: 0
+ hasHorizontalScrollBar: true
+ hasVerticalScrollBar: true
+ htmlText: infoHolder
+ )
+ )
+
+ )
+ )
+!
+
+progressSpec
+ "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:SVN::Dialog andSelector:#progressSpec
+ SVN::Dialog new openInterface:#progressSpec
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: progressSpec
+ window:
+ (WindowSpec
+ label: 'Progress'
+ name: 'Progress'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 300 300)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (VerticalPanelViewSpec
+ name: 'InfoPanel'
+ layout: (LayoutFrame 20 0 20 0 -20 1 -20 1)
+ horizontalLayout: fit
+ verticalLayout: center
+ horizontalSpace: 3
+ verticalSpace: 3
+ component:
+ (SpecCollection
+ collection: (
+ (LabelSpec
+ label: 'Working'
+ name: 'InfoHolder'
+ translateLabel: true
+ labelChannel: infoHolder
+ adjust: left
+ useDefaultExtent: true
+ )
+ (ProgressIndicatorSpec
+ name: 'ProgressIndicator'
+ model: progressHolder
+ isActivityIndicator: true
+ postBuildCallback: postBuildProgressIndicator:
+ useDefaultExtent: true
+ )
+ )
+
+ )
+ )
+ )
+
+ )
+ )
+!
+
+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:SVN::Dialog andSelector:#windowSpec
+ SVN::Dialog new openInterface:#windowSpec
+ SVN::Dialog open
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: windowSpec
+ window:
+ (WindowSpec
+ label: 'SubVersion: Commit '
+ name: 'SubVersion: Commit '
+ labelChannel: titleHolder
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 648 451)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (ViewSpec
+ name: 'TitleBox'
+ layout: (LayoutFrame 0 0 0 0 0 1 66 0)
+ backgroundColor: (Color 100.0 100.0 100.0)
+ component:
+ (SpecCollection
+ collection: (
+ (LabelSpec
+ label: 'SVN Dialog'
+ name: 'DialogTitle'
+ layout: (LayoutFrame 10 0 0 0 -75 1 40 0)
+ style: (FontDescription helvetica medium roman 18 #'iso10646-1')
+ backgroundColor: (Color 100.0 100.0 100.0)
+ translateLabel: true
+ labelChannel: titleHolder
+ adjust: left
+ )
+ (LabelSpec
+ label: 'SVN Dialog Subtitle'
+ name: 'DialogSubtitle'
+ layout: (LayoutFrame 30 0 40 0 -75 1 66 0)
+ backgroundColor: (Color 100.0 100.0 100.0)
+ translateLabel: true
+ labelChannel: subtitleHolder
+ resizeForLabel: false
+ adjust: left
+ )
+ (LabelSpec
+ label: 'Icon'
+ name: 'DialogIcon'
+ layout: (LayoutFrame -75 1 0 0 0 1 66 0)
+ hasCharacterOrientedLabel: false
+ backgroundColor: (Color 100.0 100.0 100.0)
+ translateLabel: true
+ labelChannel: dialogIconAspect
+ )
+ )
+
+ )
+ )
+ (SubCanvasSpec
+ name: 'Content'
+ layout: (LayoutFrame 5 0 70 0 -5 1 -50 1)
+ hasHorizontalScrollBar: false
+ hasVerticalScrollBar: false
+ specHolder: contentSpecHolder
+ createNewBuilder: false
+ )
+ (DividerSpec
+ name: 'Separator'
+ layout: (LayoutFrame 5 0 -50 1 -5 1 -30 1)
+ )
+ (UISubSpecification
+ name: 'Buttons'
+ layout: (LayoutFrame 0 0 -30 1 0 1 0 1)
+ minorKey: buttonsSpec
+ )
+ )
+
+ )
+ )
+! !
+
+!Dialog methodsFor:'accessing'!
+
+acceptButtonTitle
+
+ ^'OK'
+
+ "Created: / 13-04-2008 / 11:06:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+answer
+
+ ^self cancel value
+ ifFalse:[(self perform: self answerValueSelector) value]
+ ifTrue:[nil]
+
+ "Created: / 19-04-2008 / 13:15:56 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 03-10-2008 / 17:38:38 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+answerValueSelector
+
+ ^self subclassResponsibility
+
+ "Created: / 19-04-2008 / 13:15:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+canDoAccept
+
+ ^self canDoAcceptAspect value
+
+ "Created: / 16-08-2009 / 17:18:13 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+canDoAccept: aBoolean
+
+ self canDoAcceptAspect value: aBoolean
+
+ "Created: / 03-10-2008 / 14:29:11 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+contentSpec
+
+ ^self contentSpecHolder value
+
+ "Created: / 21-10-2008 / 12:39:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+contentSpec: aSymbol
+
+ self contentSpecHolder value: aSymbol
+
+ "Created: / 21-10-2008 / 12:38:56 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+info: aString
+
+ ^self infoHolder value: aString
+
+ "Created: / 09-04-2009 / 08:00:37 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+model
+ ^self modelHolder value
+
+ "Modified: / 20-04-2005 / 18:59:28 / janfrog"
+ "Created: / 12-04-2008 / 20:50:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+model:aModel
+ self modelHolder subjectChannel:aModel
+ "aModel isValueModel
+ ifTrue:[self modelHolder subjectChannel:aModel]
+ ifFalse:[self modelHolder subject:aModel]."
+
+ "Modified: / 20-04-2005 / 18:59:28 / janfrog"
+ "Created: / 12-04-2008 / 20:50:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+modelHolder
+ ^ modelHolder
+ ifNil:[
+ modelHolder := (AspectAdaptor subjectChannel:self defaultModel)
+ forAspect:#value
+ ]
+
+ "Modified: / 20-04-2005 / 18:59:28 / janfrog"
+ "Created: / 12-04-2008 / 20:50:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 03-10-2008 / 14:57:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+subtitle
+ "return the value in 'dialogSubtitleHolder'"
+
+ ^ self subtitleHolder value
+
+ "Created: / 22-10-2008 / 12:40:02 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 09-04-2009 / 07:53:25 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+subtitle:newValue
+ "set the value in 'dialogSubtitleHolder'"
+
+ self subtitleHolder value:' ' , newValue
+
+ "Created: / 22-10-2008 / 12:40:14 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 09-04-2009 / 07:53:18 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+title
+
+ ^self dialogTitleAspect value
+
+ "Created: / 22-10-2008 / 12:40:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+title: aString
+
+ ^self titleHolder value: aString
+
+ "Created: / 22-10-2008 / 12:40:49 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 09-04-2009 / 14:12:49 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Dialog methodsFor:'accessing - defaults'!
+
+defaultContentSpec
+
+ ^#contentSpec
+
+ "Created: / 21-10-2008 / 12:35:11 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+defaultModel
+ ^ nil
+
+ "Created: / 03-10-2008 / 14:57:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+defaultSubtitle
+
+ ^''
+
+ "Created: / 03-10-2008 / 13:54:08 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+defaultTitle
+ ^ self subclassResponsibility
+
+ "Created: / 03-10-2008 / 13:58:40 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Dialog methodsFor:'actions'!
+
+doAccept
+
+ self canDoAccept ifTrue:[super doAccept]
+
+ "Created: / 16-08-2009 / 17:18:47 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+doCancel
+
+ worker ifNotNil:[worker terminate].
+ super doCancel
+
+ "Created: / 28-10-2008 / 14:47:44 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Dialog methodsFor:'aspects'!
+
+acceptButtonTitleAspect
+
+ ^self acceptButtonTitle
+
+ "Modified: / 31-03-2008 / 18:53:56 / janfrog"
+ "Created: / 13-04-2008 / 11:08:43 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+canDoAcceptAspect
+
+ |holder|
+
+ (holder := builder bindingAt:#canDoAcceptAspect) isNil ifTrue:[
+ holder := false asValue.
+ builder aspectAt:#canDoAcceptAspect put:holder.
+ ].
+ ^ holder.
+
+ "Created: / 14-04-2008 / 11:17:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 14-04-2008 / 12:56:08 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+contentSpecHolder
+ <resource: #uiAspect>
+
+ |holder|
+
+ (holder := builder bindingAt:#contentSpecHolder) isNil ifTrue:[
+ holder := self defaultContentSpec asValue.
+ holder onChangeSend:#contentSpecChanged to: self.
+ builder aspectAt:#contentSpecHolder put:holder.
+ ].
+ ^ holder.
+
+ "Created: / 21-10-2008 / 12:34:59 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 22-10-2008 / 11:22:16 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+dialogIconAspect
+ ^ self class dialogIcon
+
+ "Created: / 13-04-2008 / 11:05:55 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+doAcceptEnabledHolder
+
+ ^self canDoAcceptAspect
+
+ "Created: / 08-04-2009 / 23:29:46 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+infoHolder
+ "return/create the 'infoHolder' value holder (automatically generated)"
+
+ infoHolder isNil ifTrue:[
+ infoHolder := ValueHolder new.
+ ].
+ ^ infoHolder
+!
+
+progressHolder
+ <resource: #uiAspect>
+
+ |holder|
+
+ (holder := builder bindingAt:#progressHolder) isNil ifTrue:[
+ holder := nil asValue.
+ builder aspectAt:#progressHolder put:holder.
+ ].
+ ^ holder.
+
+ "Created: / 21-10-2008 / 12:24:38 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+subtitleHolder
+ "return/create the valueHolder 'dialogSubtitleHolder'"
+
+ subtitleHolder isNil ifTrue:[
+ subtitleHolder := self defaultSubtitle asValue
+ ].
+ ^ subtitleHolder
+
+ "Created: / 03-10-2008 / 13:53:16 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 09-04-2009 / 07:53:51 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+titleHolder
+ titleHolder isNil ifTrue:[
+ titleHolder := self defaultTitle asValue.
+ ].
+ ^titleHolder
+
+ "Modified: / 31-03-2008 / 18:53:56 / janfrog"
+ "Created: / 13-04-2008 / 11:05:55 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 09-04-2009 / 07:52:33 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Dialog methodsFor:'change & update'!
+
+contentSpecChanged
+
+ self contentSpecChanged: self contentSpec
+
+ "Created: / 22-10-2008 / 11:22:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 06-11-2008 / 18:31:33 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+contentSpecChanged: specSymbol
+
+ "nothing to do here"
+
+ "Created: / 06-11-2008 / 18:31:19 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Dialog methodsFor:'hooks'!
+
+postBuildProgressIndicator:aView
+ <resource: #uiCallback>
+
+ progressIndicator := aView
+
+ "Modified: / 28-10-2008 / 12:50:51 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Dialog methodsFor:'initialization'!
+
+initialize
+
+ super initialize.
+ self createBuilder
+
+ "Created: / 22-10-2008 / 12:37:01 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Dialog methodsFor:'interface opening'!
+
+openInterface:aSymbol
+
+ super openInterface:aSymbol.
+ ^self answer
+
+ "Created: / 19-04-2008 / 13:18:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Dialog methodsFor:'private'!
+
+showContent
+
+ self
+ contentSpec: #contentSpec.
+
+ "Created: / 09-04-2009 / 08:14:36 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+showMessage: aString
+
+ self
+ info: aString;
+ contentSpec: #messageSpec.
+
+ "Created: / 09-04-2009 / 08:14:51 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+showProgressWhile: aBlock
+
+ | prevSpec |
+ prevSpec := self contentSpec.
+ self contentSpec: #progressSpec.
+ worker := [
+ [aBlock value] on:
+ "Kludge because UserNotifications are handled in strange way"
+ (Smalltalk::UserNotification,
+ Smalltalk::ActivityNotification,
+ SVN::ActivityNotification,
+ SVN::ProgressNotification) do:
+ [:ex|
+ self info: ex messageText.
+ ex parameter isNumber
+ ifTrue:
+ [progressIndicator showBusyIndication: false.
+ self progressHolder value: ex parameter]
+ ifFalse:
+ [progressIndicator showBusyIndication: true].
+ ex proceed]
+ ] newProcess.
+ worker
+ addExitAction:
+ [self contentSpec == #progressSpec
+ ifTrue:[self contentSpec: prevSpec].
+ worker := nil];
+ resume.
+
+ "Created: / 21-10-2008 / 12:07:06 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 09-04-2009 / 08:28:26 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
+!Dialog class methodsFor:'documentation'!
+
+version
+ ^ '$Header$'
+! !