# HG changeset patch # User vrany # Date 1309953688 -7200 # Node ID f898a869986ef6612819fd049239100356fd7b5b # Parent 500c830c6bed907b36373ed170fa84a5152864a1 initial checkin diff -r 500c830c6bed -r f898a869986e Tools__ChangeSetDiffList.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Tools__ChangeSetDiffList.st Wed Jul 06 14:01:28 2011 +0200 @@ -0,0 +1,341 @@ +" + Copyright (c) 2007-2010 Jan Vrany + Copyright (c) 2009-2010 eXept Software AG + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the 'Software'), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +" +"{ Package: 'stx:libbasic3' }" + +"{ NameSpace: Tools }" + +BrowserList subclass:#ChangeSetDiffList + instanceVariableNames:'listHolder listEntryLabelGenerator listEntryIconGenerator' + classVariableNames:'' + poolDictionaries:'' + category:'Interface-Diff' +! + +Object subclass:#ListEntry + instanceVariableNames:'model application' + classVariableNames:'' + poolDictionaries:'' + privateIn:ChangeSetDiffList +! + +!ChangeSetDiffList class methodsFor:'documentation'! + +copyright +" + Copyright (c) 2007-2010 Jan Vrany + Copyright (c) 2009-2010 eXept Software AG + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the 'Software'), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + +" +! ! + +!ChangeSetDiffList class methodsFor:'interface specs'! + +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::DiffList andSelector:#windowSpec + SVN::DiffList new openInterface:#windowSpec + SVN::DiffList open + " + + + + ^ + #(FullSpec + name: windowSpec + window: + (WindowSpec + label: 'Diff List' + name: 'Diff List' + min: (Point 10 10) + bounds: (Rectangle 0 0 300 300) + ) + component: + (SpecCollection + collection: ( + (SelectionInListModelViewSpec + name: 'List' + layout: (LayoutFrame 0 0 0 0 0 1 0 1) + model: selectionHolder + menu: menuHolder + hasHorizontalScrollBar: true + hasVerticalScrollBar: true + listModel: listHolder + multipleSelectOk: true + useIndex: false + highlightMode: line + ) + ) + + ) + ) +! ! + +!ChangeSetDiffList class methodsFor:'plugIn spec'! + +aspectSelectors + "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." + + "Return a description of exported aspects; + these can be connected to aspects of an embedding application + (if this app is embedded in a subCanvas)." + + ^ #( + #inGeneratorHolder + #outGeneratorHolder + #menuHolder + #listEntryLabelGenerator + #listEntryIconGenerator + ). + + "Modified: / 24-11-2009 / 09:59:45 / Jan Vrany " +! ! + +!ChangeSetDiffList methodsFor:'accessing'! + +listEntryIconGenerator + ^ listEntryIconGenerator +! + +listEntryIconGenerator:aBlock + listEntryIconGenerator := aBlock. +! + +listEntryLabelGenerator + ^ listEntryLabelGenerator +! + +listEntryLabelGenerator:aBlock + listEntryLabelGenerator := aBlock. +! ! + +!ChangeSetDiffList methodsFor:'aspects'! + +listHolder + "return/create the 'difflistHolder' value holder (automatically generated)" + + listHolder isNil ifTrue:[ + listHolder := ValueHolder new. + ]. + ^ listHolder +! ! + +!ChangeSetDiffList methodsFor:'change & update'! + +update: aspect with: param from: sender + + aspect == #resolution ifTrue:[^(self componentAt: #List) invalidateRepairNow: true]. + + sender == selectionHolder ifTrue:[^self selectionChanged]. + super update: aspect with: param from: sender. + + "Modified: / 24-11-2009 / 18:34:23 / Jan Vrany " +! ! + +!ChangeSetDiffList methodsFor:'generators'! + +makeGenerator + + ^Iterator on: + [:whatToDo| + self selectionHolder value do: + [:each|each model do: whatToDo]] + + "Modified: / 26-11-2009 / 17:23:09 / Jan Vrany " +! ! + +!ChangeSetDiffList methodsFor:'private'! + +listEntryIconFor:aDiffComponent + |a hasA b hasB hasBase| + + aDiffComponent isDiffSet ifTrue:[ + ^ nil + ]. + hasA := (a := aDiffComponent versionA) notNil and:[a isMethodRemoveChange not]. + hasB := (b := aDiffComponent versionB) notNil and:[b isMethodRemoveChange not]. + hasBase := aDiffComponent versionBase notNil. + (hasA & hasB & hasBase) ifTrue:[ + ^ IconLibrary versionABBase12x12 + ]. + (hasA & hasB) ifTrue:[ + ^ IconLibrary versionAB12x12 + ]. + (hasA & hasBase) ifTrue:[ + ^ IconLibrary versionABase12x12 + ]. + (hasA) ifTrue:[ + ^ IconLibrary versionA12x12 + ]. + (hasB & hasBase) ifTrue:[ + ^ IconLibrary versionBBase12x12 + ]. + (hasB) ifTrue:[ + ^ IconLibrary versionB12x12 + ]. + ^ nil + + "Created: / 21-11-2009 / 21:58:48 / Jan Vrany " + "Modified: / 09-06-2011 / 08:19:00 / Jan Vrany " +! + +listEntryLabelFor:diff + + ^listEntryLabelGenerator + ifNotNil: [listEntryLabelGenerator value: diff] + ifNil:[diff name] + + "Modified: / 24-11-2009 / 10:00:39 / Jan Vrany " +! + +makeDependent + + "Nothing to do" +! + +makeIndependent + + "Nothing to do" +! + +updateList + "Superclass Tools::BrowserList says that I am responsible to implement this method" + + | newDiffs newList | + self listHolder value ? #() do: [:entry|entry model removeDependent: self]. + + newList := SortedCollection new:16. + newList sortBlock:[:a :b | a asString < b asString ]. + newDiffs := self inGeneratorHolder value ? #(). + (newDiffs isKindOf: Tools::ChangseSetDiffComponent) ifTrue: + [newDiffs := newDiffs diffs]. + newDiffs do: + [:item| + newList add:(ListEntry model: item application: self). + item addDependent: self]. + self listHolder value:newList + + "Modified: / 06-07-2011 / 12:58:02 / Jan Vrany " +! ! + +!ChangeSetDiffList::ListEntry class methodsFor:'instance creation'! + +model: model application: application + + ^self new + model: model; + application: application + + "Created: / 24-11-2009 / 18:29:18 / Jan Vrany " +! ! + +!ChangeSetDiffList::ListEntry methodsFor:'accessing'! + +application + ^ application +! + +application:aDiffList + application := aDiffList. +! + +icon + + ^application + ifNotNil:[application listEntryIconFor: model] + ifNil:[nil] + + "Created: / 24-11-2009 / 18:26:28 / Jan Vrany " +! + +label + + ^application + ifNotNil:[application listEntryLabelFor: model] + ifNil:[model displayString] + + "Created: / 24-11-2009 / 18:26:13 / Jan Vrany " + "Modified: / 26-11-2009 / 17:33:25 / Jan Vrany " +! + +model + ^ model +! + +model:aDiffComponent + model := aDiffComponent. +! ! + +!ChangeSetDiffList::ListEntry methodsFor:'displaying'! + +displayOn: aGC x: x y: y opaque: opaque + + | icon | + (icon := self icon) ifNotNil:[icon displayOn: aGC x: x y: y - icon height opaque: opaque]. + self label displayOn: aGC x: x + 16 y:y opaque: opaque + + "Created: / 24-11-2009 / 18:21:23 / Jan Vrany " +! ! + +!ChangeSetDiffList class methodsFor:'documentation'! + +version_CVS + ^ '$Header: /cvs/stx/stx/libtool/Tools__ChangeSetDiffList.st,v 1.1 2011-07-06 12:01:28 vrany Exp $' +! + +version_SVN + ^ '§Id: SVN__DiffList.st 341 2011-06-09 07:22:53Z vranyj1 §' +! !