diff --git a/CHANGELOG.md b/CHANGELOG.md index 63eaf05c..b1954da2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,27 @@ +# [v2.3.0](https://github.com/TelescopeSt/Telescope/compare/v2.2.3...v2.3.0) (2020-12-07) + +## New Features + +* Add an action to create connections with entity ([abc4ff1](https://github.com/TelescopeSt/Telescope/commit/abc4ff1ac8bfa3871fa116c78d1f3f428c6c191d)) +* Create a matrix visualization template ([86243ea](https://github.com/TelescopeSt/Telescope/commit/86243ea51a0119d5a3133ecaf79d833dfade7913)) + +## Enhancement + +* Add modularity in cycle dependecies visualization template ([8b48cfc](https://github.com/TelescopeSt/Telescope/commit/8b48cfc31edd73770ea19ee0b7f7c530479d7e56)) + +## Bug fixes + +* Groups are not correctly removed from supergroups ([45ba104](https://github.com/TelescopeSt/Telescope/commit/45ba104aca254c088730e8f58e2b8866b3909461)) + +## Infrastructure + +* Depend on PharoBackwardCompatibility ([7bfd884](https://github.com/TelescopeSt/Telescope/commit/7bfd884fe6bc7655d275188a86133b4811dfb793)) + # [v2.2.3](https://github.com/TelescopeSt/Telescope/compare/v2.2.2...v2.2.3) (2020-06-03) ## Enhancement diff --git a/src/BaselineOfTelescope/BaselineOfTelescope.class.st b/src/BaselineOfTelescope/BaselineOfTelescope.class.st index 065d6fb5..63234c8b 100644 --- a/src/BaselineOfTelescope/BaselineOfTelescope.class.st +++ b/src/BaselineOfTelescope/BaselineOfTelescope.class.st @@ -17,12 +17,13 @@ BaselineOfTelescope >> baseline: spec [ deepTraverser: spec; mocketry: spec; mooseAlgo: spec; + pharoBackwardCompatibility: spec; styleSheet: spec; materialColors: spec. "Packages" spec - package: 'Telescope-Core' with: [ spec requires: #('Stylesheet' 'Telescope-Layouts' 'MaterialColors') ]; + package: 'Telescope-Core' with: [ spec requires: #('Stylesheet' 'Telescope-Layouts' 'MaterialColors' 'PharoBackwardCompatibility') ]; package: 'Telescope-VisualizationTemplates' with: [ spec requires: #('Telescope-Core' 'MooseAlgos' 'DeepTraverser') ]; package: 'Telescope-Demo' with: [ spec requires: #('Telescope-Core' 'Telescope-VisualizationTemplates') ]; package: 'Telescope-Layouts'; @@ -39,13 +40,7 @@ BaselineOfTelescope >> baseline: spec [ group: 'layout' with: #('Telescope-Layouts' 'Telescope-Layouts-Tests'); group: 'layout-core' with: #('Telescope-Layouts'); group: 'minimal' with: #('Telescope-Core'); - group: 'tests' with: #('Telescope-Core-Tests' 'Telescope-Layouts-Tests' 'Telescope-VisualizationTemplates-Tests') ]. - - spec - for: #(#'pharo6.x' #'pharo7.x') - do: [ spec - package: 'Telescope-Pharo8-Compatibility'; - package: 'Telescope-Core' with: [ spec requires: #('Telescope-Pharo8-Compatibility') ] ] + group: 'tests' with: #('Telescope-Core-Tests' 'Telescope-Layouts-Tests' 'Telescope-VisualizationTemplates-Tests') ] ] { #category : #dependencies } @@ -80,6 +75,11 @@ BaselineOfTelescope >> mooseAlgo: spec [ repository: 'github://moosetechnology/MooseAlgos:v1.x.x/src' ] ] +{ #category : #dependencies } +BaselineOfTelescope >> pharoBackwardCompatibility: spec [ + spec baseline: 'PharoBackwardCompatibility' with: [ spec repository: 'github://jecisc/PharoBackwardCompatibility:v1.x.x/src' ] +] + { #category : #accessing } BaselineOfTelescope >> projectClass [ ^ [ self class environment at: #MetacelloCypressBaselineProject ] diff --git a/src/Telescope-Core-Tests/TLConnectActionTest.class.st b/src/Telescope-Core-Tests/TLConnectActionTest.class.st new file mode 100644 index 00000000..b4b5f4f2 --- /dev/null +++ b/src/Telescope-Core-Tests/TLConnectActionTest.class.st @@ -0,0 +1,36 @@ +Class { + #name : #TLConnectActionTest, + #superclass : #TestCase, + #category : #'Telescope-Core-Tests-Actions' +} + +{ #category : #tests } +TLConnectActionTest >> testTriggerAction [ + | connectAction sourceNode targetNode | + sourceNode := TLSimpleNode withEntity: 4. + targetNode := TLSimpleNode withEntity: 2. + connectAction := TLConnectAction + property: [ :e | {e sqrt} ] + context: (TLDrawableCollection with: sourceNode with: targetNode). + connectAction actionOn: sourceNode. + self assert: sourceNode outgoingConnections size equals: 1. + self assert: targetNode incomingConnections size equals: 1. + self + assert: sourceNode outgoingConnections anyOne + equals: targetNode incomingConnections anyOne +] + +{ #category : #tests } +TLConnectActionTest >> testTriggerActionTwiceForReversibility [ + "this test is valid only if testTriggerAction is valid" + | connectAction sourceNode targetNode | + sourceNode := TLSimpleNode withEntity: 4. + targetNode := TLSimpleNode withEntity: 2. + connectAction := TLConnectAction + property: [ :e | {e sqrt} ] + context: (TLDrawableCollection with: sourceNode with: targetNode). + connectAction actionOn: sourceNode. + connectAction actionOn: sourceNode. + self assert: sourceNode outgoingConnections isEmpty. + self assert: targetNode incomingConnections isEmpty +] diff --git a/src/Telescope-Core-Tests/TLConnectWithEntityActionTest.class.st b/src/Telescope-Core-Tests/TLConnectWithEntityActionTest.class.st new file mode 100644 index 00000000..14db05be --- /dev/null +++ b/src/Telescope-Core-Tests/TLConnectWithEntityActionTest.class.st @@ -0,0 +1,38 @@ +Class { + #name : #TLConnectWithEntityActionTest, + #superclass : #TestCase, + #category : #'Telescope-Core-Tests-Actions' +} + +{ #category : #tests } +TLConnectWithEntityActionTest >> testTriggerAction [ + | connectAction sourceNode targetNode | + sourceNode := TLSimpleNode withEntity: 4. + targetNode := TLSimpleNode withEntity: 2. + connectAction := TLConnectWithEntityAction + connectionProperty: [ :e | {e squared} ] + property: [ :connectionEntity | connectionEntity / 8 ] + context: (TLDrawableCollection with: sourceNode with: targetNode). + connectAction actionOn: sourceNode. + self assert: sourceNode outgoingConnections size equals: 1. + self assert: targetNode incomingConnections size equals: 1. + self + assert: sourceNode outgoingConnections anyOne + equals: targetNode incomingConnections anyOne +] + +{ #category : #tests } +TLConnectWithEntityActionTest >> testTriggerActionTwiceForReversibility [ + "this test is valid only if testTriggerAction is valid" + | connectAction sourceNode targetNode | + sourceNode := TLSimpleNode withEntity: 4. + targetNode := TLSimpleNode withEntity: 2. + connectAction := TLConnectWithEntityAction + connectionProperty: [ :e | {e squared} ] + property: [ :connectionEntity | connectionEntity / 8 ] + context: (TLDrawableCollection with: sourceNode with: targetNode). + connectAction actionOn: sourceNode. + connectAction actionOn: sourceNode. + self assert: sourceNode outgoingConnections isEmpty. + self assert: targetNode incomingConnections isEmpty +] diff --git a/src/Telescope-Core-Tests/TLConnectionsWithEntityTest.class.st b/src/Telescope-Core-Tests/TLConnectionsWithEntityTest.class.st new file mode 100644 index 00000000..49a7fe2c --- /dev/null +++ b/src/Telescope-Core-Tests/TLConnectionsWithEntityTest.class.st @@ -0,0 +1,83 @@ +Class { + #name : #TLConnectionsWithEntityTest, + #superclass : #TestCase, + #instVars : [ + 'group' + ], + #category : #'Telescope-Core-Tests-Model' +} + +{ #category : #running } +TLConnectionsWithEntityTest >> setUp [ + super setUp. + group := TLEntitiesGroup new. + TLVisualization new addDrawable: group. + group addNodesFromEntities: (1 to: 4) +] + +{ #category : #tests } +TLConnectionsWithEntityTest >> testConnectGroupFromANode [ + | connections | + connections := group connectFrom: TLSimpleNode new entity: 42. + self assert: connections size equals: 4. + +] + +{ #category : #tests } +TLConnectionsWithEntityTest >> testConnectGroupToANode [ + | connections | + connections := group connectTo: TLSimpleNode new entity: 42. + self assert: connections size equals: 4 +] + +{ #category : #tests } +TLConnectionsWithEntityTest >> testConnectGroupWithSubgroupFromANode [ + | connections | + group > #subgroup addNodesFromEntities: (5 to: 8). + connections := group connectFrom: TLSimpleNode new entity: 42.. + self assert: connections size equals: 8. +] + +{ #category : #tests } +TLConnectionsWithEntityTest >> testConnectGroupWithSubgroupToANode [ + | connections | + group > #subgroup addNodesFromEntities: (5 to: 8). + connections := group connectTo: TLSimpleNode new entity: 42.. + self assert: connections size equals: 8. +] + +{ #category : #tests } +TLConnectionsWithEntityTest >> testConnectNodeFromAGroup [ + | connections | + connections := TLSimpleNode new connectFrom: group entity: 42.. + self assert: connections size equals: 4. +] + +{ #category : #tests } +TLConnectionsWithEntityTest >> testConnectNodeFromAnotherNode [ + | connection nodeA nodeB | + nodeA := TLSimpleNode withEntity: $a. + nodeB := TLSimpleNode withEntity: $b. + connection := nodeB connectFrom: nodeA entity: 42. + self assert: connection fromNode equals: nodeA. + self assert: connection toNode equals: nodeB. + +] + +{ #category : #tests } +TLConnectionsWithEntityTest >> testConnectNodeToAGroup [ + | connections | + connections := TLSimpleNode new connectTo: group entity: 42. + self assert: connections size equals: 4. +] + +{ #category : #tests } +TLConnectionsWithEntityTest >> testConnectNodeToAnotherNode [ + | connection nodeA nodeB | + nodeA := TLSimpleNode withEntity: $a. + nodeB := TLSimpleNode withEntity: $b. + connection := nodeA connectTo: nodeB entity: 42. + self assert: connection fromNode equals: nodeA. + self assert: connection toNode equals: nodeB. + +] diff --git a/src/Telescope-Core-Tests/TLModelTest.class.st b/src/Telescope-Core-Tests/TLModelTest.class.st index a27e8e78..b208d7a9 100644 --- a/src/Telescope-Core-Tests/TLModelTest.class.st +++ b/src/Telescope-Core-Tests/TLModelTest.class.st @@ -29,3 +29,18 @@ TLModelTest >> testRemoveAllFromGroup [ self assert: node2 parent equals: nil. ] + +{ #category : #tests } +TLModelTest >> testRemoveAllThenAddAgainGroup [ + | group subGroup secondSubGroup | + group := TLEntitiesGroup new. + subGroup := group > #group1. + self assert: subGroup parent equals: group. + group removeAll. + self assert: subGroup parent equals: nil. + self assert: group isEmpty. + self assert: group subGroupsDictionary isEmpty. + secondSubGroup := group > #group1. + self assert: secondSubGroup parent equals: group. + self deny: secondSubGroup equals: subGroup +] diff --git a/src/Telescope-Core/TLAbstractNode.class.st b/src/Telescope-Core/TLAbstractNode.class.st index 2e498ea3..8cd7dd66 100644 --- a/src/Telescope-Core/TLAbstractNode.class.st +++ b/src/Telescope-Core/TLAbstractNode.class.st @@ -84,6 +84,11 @@ TLAbstractNode >> connectFromNode: aTLNode [ ^ aTLNode connectToNode: self ] +{ #category : #connection } +TLAbstractNode >> connectFromNode: aTLNode entity: anObject [ + ^ aTLNode connectToNode: self entity: anObject +] + { #category : #connect } TLAbstractNode >> connectIfNotAlreadyFollowingProperty: aBlockOrSymbol context: aTLEntitiesGroup [ | target | @@ -145,7 +150,7 @@ TLAbstractNode >> connectTo: aTLConnectable [ { #category : #connect } TLAbstractNode >> connectTo: aTLConnectable entity: anObject [ - ^ aTLConnectable connectToNode: self entity: anObject + ^ aTLConnectable connectFromNode: self entity: anObject ] { #category : #connect } diff --git a/src/Telescope-Core/TLConnectWithEntityAction.class.st b/src/Telescope-Core/TLConnectWithEntityAction.class.st new file mode 100644 index 00000000..cfb96e15 --- /dev/null +++ b/src/Telescope-Core/TLConnectWithEntityAction.class.st @@ -0,0 +1,68 @@ +" +TLConnectionectAction is an action that create TLConnectionWithEntity from the receiver to an other node +" +Class { + #name : #TLConnectWithEntityAction, + #superclass : #TLConnectAction, + #instVars : [ + 'connectionProperty' + ], + #category : #'Telescope-Core-Actions' +} + +{ #category : #'as yet unclassified' } +TLConnectWithEntityAction class >> connectionProperty: aConnectionBlockOrProperty property: aBlockOrProperty [ + ^ self new + connectionProperty: aConnectionBlockOrProperty; + property: aBlockOrProperty; + yourself +] + +{ #category : #'as yet unclassified' } +TLConnectWithEntityAction class >> connectionProperty: aConnectionBlockOrProperty property: aBlockOrProperty context: aTLGroup [ + ^ (self + connectionProperty: aConnectionBlockOrProperty + property: aBlockOrProperty) + context: aTLGroup; + yourself +] + +{ #category : #accessing } +TLConnectWithEntityAction >> connectionProperty [ + ^ connectionProperty +] + +{ #category : #accessing } +TLConnectWithEntityAction >> connectionProperty: anObject [ + connectionProperty := anObject +] + +{ #category : #action } +TLConnectWithEntityAction >> regularActionOn: aNode [ + | connectionEntities contextNodesByEntities | + connectionEntities := self + obtain: self connectionProperty + on: aNode entity. + contextNodesByEntities := (self obtainContextFor: aNode) + groupedBy: #entity. + self connectionsByNode + at: aNode + put: + ((self obtain: self connectToOrigin on: aNode entity) + ifFalse: [ connectionEntities + collect: [ :aConnectionEntity | + aNode + connectTo: + (contextNodesByEntities + at: (self obtain: self property on: aConnectionEntity)) + entity: aConnectionEntity ] ] + ifTrue: [ connectionEntities + collect: [ :aConnectionEntity | + (contextNodesByEntities + at: (self obtain: self property on: aConnectionEntity)) + connectTo: aNode + entity: aConnectionEntity ] ]). + self connectionStyle + ifNotNil: [ (self connectionsByNode at: aNode) + do: [ :c | c addStyle: self connectionStyle ] ] +] diff --git a/src/Telescope-Core/TLDrawableCollection.class.st b/src/Telescope-Core/TLDrawableCollection.class.st index d3b0ac33..884af109 100644 --- a/src/Telescope-Core/TLDrawableCollection.class.st +++ b/src/Telescope-Core/TLDrawableCollection.class.st @@ -47,6 +47,13 @@ TLDrawableCollection >> collection [ ^ self ] +{ #category : #connection } +TLDrawableCollection >> connectToNode: aNode entity: aConnectionEntity [ + ^ self + collect: + [ :aDrawable | aDrawable connectToNode: aNode entity: aConnectionEntity ] +] + { #category : #enumerating } TLDrawableCollection >> nodesCollect: aBlock [ ^ self @@ -68,3 +75,8 @@ TLDrawableCollection >> removeAllConnections [ TLDrawableCollection >> removeStyle: aStyle [ self do: [ :aDrawable | aDrawable removeStyle: aStyle ] ] + +{ #category : #removing } +TLDrawableCollection >> removed [ + self do: #removed +] diff --git a/src/Telescope-Core/TLEntitiesGroup.class.st b/src/Telescope-Core/TLEntitiesGroup.class.st index 91d1cb2c..84e8f45a 100644 --- a/src/Telescope-Core/TLEntitiesGroup.class.st +++ b/src/Telescope-Core/TLEntitiesGroup.class.st @@ -32,6 +32,11 @@ TLEntitiesGroup >> > aSubGroupSymbol [ yourself ] ] +{ #category : #enumeration } +TLEntitiesGroup >> \ aCollection [ + ^ self telescopeEntities \ aCollection +] + { #category : #adding } TLEntitiesGroup >> addAbsentNodesInVisualizationFromEntities: aGroupOfEntities [ "only add nodes for entities that are not yet in visualization" @@ -281,6 +286,11 @@ TLEntitiesGroup >> notEmpty [ ^ self collection notEmpty. ] +{ #category : #enumeration } +TLEntitiesGroup >> reject: aBlockClosure [ + ^ self telescopeEntities reject: aBlockClosure +] + { #category : #accessing } TLEntitiesGroup >> remove: aTLDrawable [ self removeChild: aTLDrawable. @@ -295,7 +305,10 @@ TLEntitiesGroup >> removeAll [ { #category : #removing } TLEntitiesGroup >> removeChild: aTLDrawable [ self telescopeEntities remove: aTLDrawable. - self requireUpdateAndLayoutApplication. + aTLDrawable isGroup + ifTrue: [ self subGroupsDictionary + removeKey: (self subGroupsDictionary keyAtValue: aTLDrawable) ]. + self requireUpdateAndLayoutApplication ] { #category : #accessing } diff --git a/src/Telescope-Core/TTLDrawableCollection.trait.st b/src/Telescope-Core/TTLDrawableCollection.trait.st index 1619f4e2..3670d67c 100644 --- a/src/Telescope-Core/TTLDrawableCollection.trait.st +++ b/src/Telescope-Core/TTLDrawableCollection.trait.st @@ -63,6 +63,14 @@ TTLDrawableCollection >> connectFromNode: aTLNode [ ^ self flatCollect: [ :aTLDrawable | (aTLDrawable connectFromNode: aTLNode) asTLDrawableCollection ] ] +{ #category : #connect } +TTLDrawableCollection >> connectFromNode: aTLNode entity: anObject [ + ^ self + flatCollect: [ :aTLDrawable | + (aTLDrawable connectFromNode: aTLNode entity: anObject) + asTLDrawableCollection ] +] + { #category : #connect } TTLDrawableCollection >> connectIfNotFromNode: aTLNode [ ^ self flatCollect: [ :aTLDrawable | (aTLDrawable connectIfNotFromNode: aTLNode) asTLDrawableCollection ] @@ -83,6 +91,11 @@ TTLDrawableCollection >> connectTo: aTLEntity entity: anObject [ ^ self flatCollect: [:aLocalTLEntity | (aLocalTLEntity connectTo: aTLEntity entity: anObject) asTLDrawableCollection ] ] +{ #category : #connection } +TTLDrawableCollection >> connectToNode: aTLSimpleNode entity: anObject [ + ^ self flatCollect: [:aLocalTLEntity | (aLocalTLEntity connectToNode: aTLSimpleNode entity: anObject) asTLDrawableCollection ] +] + { #category : #entities } TTLDrawableCollection >> entities [ ^ self nodesCollect: #entity. @@ -141,7 +154,7 @@ TTLDrawableCollection >> parentNodes [ { #category : #removing } TTLDrawableCollection >> removeAllConnections [ - self allNodesRecursivelyDo: #removeAllConnection + self allNodesRecursivelyDo: #removeAllConnections ] { #category : #accessing } diff --git a/src/Telescope-Pharo8-Compatibility/TestAsserter.extension.st b/src/Telescope-Pharo8-Compatibility/TestAsserter.extension.st deleted file mode 100644 index 6d731d0a..00000000 --- a/src/Telescope-Pharo8-Compatibility/TestAsserter.extension.st +++ /dev/null @@ -1,6 +0,0 @@ -Extension { #name : #TestAsserter } - -{ #category : #'*Telescope-Pharo8-Compatibility' } -TestAsserter >> assertEmpty: aCollection [ - ^ self assert: aCollection isEmpty description: aCollection asString , ' should have been empty' -] diff --git a/src/Telescope-Pharo8-Compatibility/package.st b/src/Telescope-Pharo8-Compatibility/package.st deleted file mode 100644 index 759c5289..00000000 --- a/src/Telescope-Pharo8-Compatibility/package.st +++ /dev/null @@ -1 +0,0 @@ -Package { #name : #'Telescope-Pharo8-Compatibility' } diff --git a/src/Telescope-VisualizationTemplates/TLCycleDependencies.class.st b/src/Telescope-VisualizationTemplates/TLCycleDependencies.class.st index a30aa2c1..3c73a0ba 100644 --- a/src/Telescope-VisualizationTemplates/TLCycleDependencies.class.st +++ b/src/Telescope-VisualizationTemplates/TLCycleDependencies.class.st @@ -20,24 +20,47 @@ Class { { #category : #building } TLCycleDependencies >> buildVisualization [ + | cycleCalculator | - cycleCalculator := MalTarjan new. - cycleCalculator nodes: self entities. - cycleCalculator edges: self entities from: #yourself toAll: self property. - cycleCalculator run. + cycleCalculator := self cycleCalculator. - (self > #packages) styleSheet backgroundColor: [ :namespace | (cycleCalculator findNode: namespace) isInCycle ifTrue: [ Color red ] ifFalse: [ Color white ] ]. + (self > #packages) styleSheet backgroundColor: [ :namespace | + (cycleCalculator findNode: namespace) isInCycle + ifTrue: [ self highlightColorForNode: namespace ] + ifFalse: [ self defaultColorForNode: namespace ] ]. - self widthBlock ifNotNil: [ :blk | (self > #packages) styleSheet width: blk ]. - self heightBlock ifNotNil: [ :blk | (self > #packages) styleSheet height: blk ]. + self widthBlock ifNotNil: [ :blk | + (self > #packages) styleSheet width: blk ]. + self heightBlock ifNotNil: [ :blk | + (self > #packages) styleSheet height: blk ]. - self styleSheet > #connection backgroundColor: Color veryLightGray. + self styleSheet > #connection backgroundColor: self edgeColor. (self > #packages) addNodesFromEntities: self entities; connectFollowingProperty: self property; - addInteraction: TLPopUpAction onMouseOver; - layout: TLTreeLayout + addInteraction: self popup; + layout: self nodesLayout +] + +{ #category : #building } +TLCycleDependencies >> cycleCalculator [ + + | cycleCalculator | + cycleCalculator := MalTarjan new. + cycleCalculator nodes: self entities. + cycleCalculator + edges: self entities + from: #yourself + toAll: self property. + cycleCalculator run. + ^ cycleCalculator +] + +{ #category : #configuration } +TLCycleDependencies >> defaultColorForNode: aNode [ + + ^ Color white ] { #category : #accessing } @@ -45,6 +68,12 @@ TLCycleDependencies >> defaultTitle [ ^ 'Cycle Dependencies' ] +{ #category : #configuration } +TLCycleDependencies >> edgeColor [ + + ^ Color veryLightGray +] + { #category : #accessing } TLCycleDependencies >> entities [ ^ entities @@ -65,6 +94,24 @@ TLCycleDependencies >> heightBlock: anObject [ heightBlock := anObject ] +{ #category : #configuration } +TLCycleDependencies >> highlightColorForNode: aNode [ + + ^ Color red +] + +{ #category : #configuration } +TLCycleDependencies >> nodesLayout [ + + ^ TLTreeLayout +] + +{ #category : #configuration } +TLCycleDependencies >> popup [ + + ^ TLPopUpAction onMouseOver +] + { #category : #accessing } TLCycleDependencies >> property [ ^ property diff --git a/src/Telescope-VisualizationTemplates/TLMatrixVisualization.class.st b/src/Telescope-VisualizationTemplates/TLMatrixVisualization.class.st new file mode 100644 index 00000000..f7cba352 --- /dev/null +++ b/src/Telescope-VisualizationTemplates/TLMatrixVisualization.class.st @@ -0,0 +1,82 @@ +" +I am a visualization representing a matrix. You need to provide a matric and corresponding xTitles and yTitles. +" +Class { + #name : #TLMatrixVisualization, + #superclass : #TLVisualization, + #instVars : [ + 'matrix', + 'xTitles', + 'yTitles' + ], + #category : #'Telescope-VisualizationTemplates' +} + +{ #category : #'instance creation' } +TLMatrixVisualization class >> newWithMatrix: matrix xTitles: xTitles yTitles: yTitles [ + ^ self new + matrix: matrix; + xTitles: xTitles; + yTitles: yTitles; + yourself +] + +{ #category : #building } +TLMatrixVisualization >> buildVisualization [ + self layout: TLLinearLayout topToBottom. + ((self > #title) + layout: TLLinearLayout leftToRight; + addNodeFromEntity: nil) addStyle: #blank. + matrix + doWithIndex: [ :e :index | + | group | + self > #title addNodeFromEntity: (xTitles at: index). + group := self > (#group , index asString). + (group addNodeFromEntity: (yTitles at: index)) addStyle: #rowTitle. + group layout: + (TLLinearLayout leftToRight + maxElementsPerLine: Float infinity; + yourself). + (group addNodesFromEntities: (matrix at: index)) addStyle: #cell ]. + self styleSheet + nodeLabel: #asString; + width: 30. + (self styleSheet > #blank) + shape: TLNoShape; + noNodeLabel; + backgroundColor: MDLColor white. + self > #title backgroundColor: MDLColor red. + self styleSheet > #rowTitle backgroundColor: MDLColor red. + + +] + +{ #category : #accessing } +TLMatrixVisualization >> matrix [ + ^ matrix +] + +{ #category : #accessing } +TLMatrixVisualization >> matrix: anObject [ + matrix := anObject +] + +{ #category : #accessing } +TLMatrixVisualization >> xTitles [ + ^ xTitles +] + +{ #category : #accessing } +TLMatrixVisualization >> xTitles: anObject [ + xTitles := anObject +] + +{ #category : #accessing } +TLMatrixVisualization >> yTitles [ + ^ yTitles +] + +{ #category : #accessing } +TLMatrixVisualization >> yTitles: anObject [ + yTitles := anObject +]