Skip to content

Commit

Permalink
Merge pull request #1228 from moosetechnology/exporter-column-duplica…
Browse files Browse the repository at this point in the history
…tion-alternative

Exporter column duplication alternative
  • Loading branch information
NicolasAnquetil authored Nov 4, 2024
2 parents c470fd8 + a670b5b commit ed27f77
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 27 deletions.
23 changes: 8 additions & 15 deletions src/MooseIDE-Export/MiExportBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,19 @@ MiExportBrowser class >> title [
MiExportBrowser >> addColumn: aColumn [

(aColumn isKindOf: FM3Property)
ifTrue: [ self addColumnForProperty: aColumn ]
ifFalse: [
ifTrue: [ self model addColumnForProperty: aColumn ]
ifFalse: [
self model addColumnForQuery: aColumn query withName: aColumn name ]
]

{ #category : #'columns management' }
MiExportBrowser >> addColumnForProperty: aFM3Property [
self model addColumnForProperty: aFM3Property.
]

{ #category : #'columns management' }
MiExportBrowser >> addCommentsColumn [

entitiesTable addColumn: ((SpStringTableColumn
title: self class commentColumnTitle
evaluated: [ :entity | self commentOf: entity ])
beEditable;
onAcceptEdition: [ :entity :comment |
onAcceptEdition: [ :entity :comment |
self model comment: entity with: comment ];
yourself).
entitiesTable refresh
Expand All @@ -116,8 +111,7 @@ MiExportBrowser >> clearButton [
{ #category : #initialization }
MiExportBrowser >> clearEntities [

self model entitiesList: #( ).

self model clearEntities
]

{ #category : #'columns management' }
Expand Down Expand Up @@ -230,9 +224,7 @@ Click to show in folder'
{ #category : #actions }
MiExportBrowser >> followEntity: anEntity [

| entities |
entities := anEntity asMooseGroup.
self updateEntitiesListWith: entities.
self updateEntitiesListWith: anEntity asMooseGroup.
self updateEntitiesCountLabel
]

Expand Down Expand Up @@ -375,8 +367,9 @@ MiExportBrowser >> updateEntitiesCountLabel [
{ #category : #'columns management' }
MiExportBrowser >> updateEntitiesListWith: aMooseGroup [

(self commonPropertiesIn: aMooseGroup) do: [ :property |
self addColumnForProperty: property ].
self model clearColumns.
(self commonPropertiesIn: aMooseGroup) do: [ :property |
self model addColumnForProperty: property ].
self model entitiesList: aMooseGroup.

self updateTable
Expand Down
36 changes: 24 additions & 12 deletions src/MooseIDE-Export/MiExportModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ MiExportModel >> addColumnForQuery: aBlock withName: queryName [
^ newColumn
]

{ #category : #clearing }
MiExportModel >> clearColumns [

columns := self defaultColumns
]

{ #category : #clearing }
MiExportModel >> clearEntities [

self entitiesList: #( ).
self clearColumns.
self browser ifNotNil: [ :b | b updateTable ]
]

{ #category : #events }
MiExportModel >> columnAdded: aColumn [

Expand Down Expand Up @@ -91,18 +105,15 @@ MiExportModel >> commentOf: anEntity [
{ #category : #initialization }
MiExportModel >> defaultColumns [

^OrderedCollection
with:
(MiExportQueryColumnModel new
query: [ :entity |
String streamContents: [ :s | entity displayStringOn: s ] ];
name: #Name;
yourself)
with:
(MiExportQueryColumnModel new
query: [ :entity | entity mooseDescription name ];
name: #Type;
yourself)
^ OrderedCollection
with: (MiExportQueryColumnModel new
query: #displayString;
name: #Name;
yourself)
with: (MiExportQueryColumnModel new
query: [ :entity | entity mooseDescription name ];
name: #Type;
yourself)
]

{ #category : #accessing }
Expand All @@ -125,6 +136,7 @@ MiExportModel >> entitiesList: anObject [

{ #category : #initialization }
MiExportModel >> initialize [

super initialize.
commentDictionary := Dictionary new.
columns := self defaultColumns.
Expand Down

0 comments on commit ed27f77

Please sign in to comment.