"
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:libtool' }"
"{ NameSpace: Tools }"
BrowserListWithFilter 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:Tools::ChangeSetDiffList andSelector:#windowSpec
Tools::ChangeSetDiffList new openInterface:#windowSpec
Tools::ChangeSetDiffList open
"
<resource: #canvas>
^
#(FullSpec
name: windowSpec
window:
(WindowSpec
label: 'Diff List'
name: 'Diff List'
min: (Point 10 10)
bounds: (Rectangle 0 0 300 300)
)
component:
(SpecCollection
collection: (
(InputFieldSpec
name: 'Filter'
layout: (LayoutFrame 0 0 0 0 0 1 25 0)
initiallyInvisible: true
model: filterPatternHolder
immediateAccept: true
acceptOnLeave: false
acceptOnReturn: false
acceptOnTab: false
acceptOnPointerLeave: false
emptyFieldReplacementText: 'Search Filter...'
usePreferredHeight: true
useDynamicPreferredHeight: true
postBuildCallback: postBuildFilterView:
)
(SelectionInListModelViewSpec
name: 'List'
layout: (LayoutFrame 0 0 0 0 0 1 0 1)
model: selectionHolder
menu: menuHolderWithShowFilter
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
#listEntryIconGenerator
#listEntryLabelGenerator
#menuHolder
#outGeneratorHolder
).
! !
!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 <jan.vrany@fit.cvut.cz>"
! !
!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 <jan.vrany@fit.cvut.cz>"
! !
!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:[
^ ToolbarIconLibrary versionABBase12x12
].
(hasA & hasB) ifTrue:[
^ ToolbarIconLibrary versionAB12x12
].
(hasA & hasBase) ifTrue:[
^ ToolbarIconLibrary versionABase12x12
].
(hasA) ifTrue:[
^ ToolbarIconLibrary versionA12x12
].
(hasB & hasBase) ifTrue:[
^ ToolbarIconLibrary versionBBase12x12
].
(hasB) ifTrue:[
^ ToolbarIconLibrary versionB12x12
].
^ nil
"Created: / 21-11-2009 / 21:58:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 09-06-2011 / 08:19:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 06-07-2011 / 16:38:33 / jv"
!
listEntryLabelFor:diff
^listEntryLabelGenerator
ifNotNil: [listEntryLabelGenerator value: diff]
ifNil:[diff name]
"Modified: / 24-11-2009 / 10:00:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
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].
newDiffs := self inGeneratorHolder value ? #().
(newDiffs isKindOf: ChangeSetDiffComponent) ifTrue:
[newDiffs := newDiffs diffs].
newDiffs := self filterList: newDiffs.
newList := OrderedCollection new:16.
newDiffs do:
[:item|
newList add:(ListEntry model: item application: self).
item addDependent: self].
newList sort:[:a :b|a label < b label].
self listHolder value:newList
"Modified: / 07-07-2011 / 14:17:26 / jv"
"Modified: / 29-11-2011 / 16:08:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!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 <jan.vrany@fit.cvut.cz>"
! !
!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 <jan.vrany@fit.cvut.cz>"
!
label
^application
ifNotNil:[application listEntryLabelFor: model]
ifNil:[model displayString]
"Created: / 24-11-2009 / 18:26:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 26-11-2009 / 17:33:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
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 <jan.vrany@fit.cvut.cz>"
! !
!ChangeSetDiffList class methodsFor:'documentation'!
version_CVS
^ '§Header: /cvs/stx/stx/libtool/Tools__ChangeSetDiffList.st,v 1.6 2011/11/30 11:14:53 vrany Exp §'
!
version_SVN
^ '$Id: Tools__ChangeSetDiffList.st 7854 2012-01-30 17:49:41Z vranyj1 $'
! !