Skip to content

Commit

Permalink
Creating commands for exporting
Browse files Browse the repository at this point in the history
  • Loading branch information
anquetil committed Dec 19, 2024
1 parent 2c9de48 commit cd12ae4
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/MooseIDE-Core-Reporter/MiModelReporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ MiModelReporter >> defaultLayout [
yourself
]

{ #category : #'as yet unclassified' }
MiModelReporter >> exportReportToHTML [

specModel exportReportToHTML: mainPresenter text
]

{ #category : #'as yet unclassified' }
MiModelReporter >> exportReportToPDF [

specModel exportReportToPDF: mainPresenter text
]

{ #category : #testing }
MiModelReporter >> followEntity: anEntity [

Expand Down
14 changes: 14 additions & 0 deletions src/MooseIDE-Core-Reporter/MiModelReporterModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ MiModelReporterModel >> entities [
^mooseModel
]

{ #category : #'as yet unclassified' }
MiModelReporterModel >> exportReportToHTML: microdownText [

(mooseModel name , '-report.html') asFileReference writeStreamDo: [ :stream |
stream nextPutAll: (MicHTMLVisitor asHTMLString: (MicrodownParser new parse: microdownText) )
]
]

{ #category : #'as yet unclassified' }
MiModelReporterModel >> exportReportToPDF: microdownText [

self inform: 'PDF export not implemented yet, sorry'
]

{ #category : #document }
MiModelReporterModel >> floatAsString: aFloat [

Expand Down
50 changes: 50 additions & 0 deletions src/MooseIDE-Core-Reporter/MiReportExportCommand.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"
I am the superclass of Moose Import commands.
Simple use:
`MPImportSTCommand new execute`.
Link to a context (for example a spec presenter):
`(MPImportSTCommand forSpecContext: yourPresenter) execute`.
You can also use class side method `#asCommandGroupForSpecContext:` to build a Spec command group with both MSE and St import commands.
Your presenter should implement `#updateForNewModel:` to define behavior when a new model is installed successfully
"
Class {
#name : #MiReportExportCommand,
#superclass : #MiCommand,
#category : #'MooseIDE-Core-Reporter'
}

{ #category : #testing }
MiReportExportCommand class >> asCommandGroupWith: aPresenter [

| exportCommandGroup |
exportCommandGroup := CmCommandGroup forSpec
name: self defaultName;
description: self defaultDescription;
iconName: #smallExport.
self allSubclassesDo: [ :cmd |
exportCommandGroup register: (cmd forSpecContext: aPresenter) ].
^ exportCommandGroup
]

{ #category : #testing }
MiReportExportCommand class >> defaultDescription [
^ 'Export this report'
]

{ #category : #testing }
MiReportExportCommand class >> defaultName [
^ 'Export'
]

{ #category : #testing }
MiReportExportCommand class >> isAbstract [
^ self = MiImportCommand
]

{ #category : #executing }
MiReportExportCommand >> execute [

^self exportReport: self context
]
27 changes: 27 additions & 0 deletions src/MooseIDE-Core-Reporter/MiReportHTMLExportCommand.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Class {
#name : #MiReportHTMLExportCommand,
#superclass : #MiReportExportCommand,
#category : #'MooseIDE-Core-Reporter'
}

{ #category : #testing }
MiReportHTMLExportCommand class >> defaultDescription [
^ 'Export this report to HTML'
]

{ #category : #testing }
MiReportHTMLExportCommand class >> defaultIconName [

^ #mooseExportHTML
]

{ #category : #testing }
MiReportHTMLExportCommand class >> defaultName [
^ 'Export to HTML'
]

{ #category : #export }
MiReportHTMLExportCommand >> exportReport: reporterBrowserModel [

reporterBrowserModel exportReportToHTML
]
27 changes: 27 additions & 0 deletions src/MooseIDE-Core-Reporter/MiReportPDFExportCommand.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Class {
#name : #MiReportPDFExportCommand,
#superclass : #MiReportExportCommand,
#category : #'MooseIDE-Core-Reporter'
}

{ #category : #testing }
MiReportPDFExportCommand class >> defaultDescription [
^ 'Export this report to PDF'
]

{ #category : #testing }
MiReportPDFExportCommand class >> defaultIconName [

^ #mooseExportPDF
]

{ #category : #testing }
MiReportPDFExportCommand class >> defaultName [
^ 'Export to PDF'
]

{ #category : #'as yet unclassified' }
MiReportPDFExportCommand >> exportReport: reporterBrowserModel [

reporterBrowserModel exportReportToPDF
]

0 comments on commit cd12ae4

Please sign in to comment.