-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(demo): simplify the UseCase classes and how to set theme #564
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0347afd
remove the type of a use case
csouchet b4a1e51
simplify how to initialize use case in Hacktoberfest & Prediction demo
csouchet 86349bc
Simplify MonitoringUseCase
csouchet b79d2c5
Simplify how to set theme on Hacktoberfest demo
csouchet d18e94d
remove unnecessary code. the bpmn container is always displayed.
csouchet d7e99cf
remove console.log
csouchet c5cea71
simplify how to initialize use case in Prediction demo
csouchet 44cb8a1
fix the default hacktoberfest theme
csouchet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,39 @@ | ||
class ThemeBpmnVisualization extends bpmnvisu.BpmnVisualization { | ||
_theme; | ||
|
||
constructor(options, theme) { | ||
super(options); | ||
this._theme = theme; | ||
this._configureStyle(); | ||
this._configureStyle(theme); | ||
} | ||
|
||
_configureStyle() { | ||
_configureStyle(theme) { | ||
const styleSheet = this.graph.getStylesheet(); // mxStylesheet | ||
|
||
theme.default.fontFamily ??= 'Inter, Helvetica, sans-serif'; | ||
configureStyle(styleSheet.getDefaultVertexStyle(), theme.default); | ||
configureStyle(styleSheet.getDefaultEdgeStyle(), theme.default); | ||
|
||
// START EVENT | ||
configureStyle(styleSheet.styles[bpmnvisu.ShapeBpmnElementKind.EVENT_START], this._theme.startEvent); | ||
configureStyle(styleSheet.styles[bpmnvisu.ShapeBpmnElementKind.EVENT_START], theme.startEvent); | ||
|
||
// END EVENT | ||
configureStyle(styleSheet.styles[bpmnvisu.ShapeBpmnElementKind.EVENT_END], this._theme.endEvent); | ||
configureStyle(styleSheet.styles[bpmnvisu.ShapeBpmnElementKind.EVENT_END], theme.endEvent); | ||
|
||
// USER TASK | ||
configureStyle(styleSheet.styles[bpmnvisu.ShapeBpmnElementKind.TASK_USER], this._theme.userTask); | ||
configureStyle(styleSheet.styles[bpmnvisu.ShapeBpmnElementKind.TASK_USER], theme.userTask); | ||
|
||
// EXCLUSIVE GATEWAY | ||
configureStyle(styleSheet.styles[bpmnvisu.ShapeBpmnElementKind.GATEWAY_EXCLUSIVE], this._theme.exclusiveGateway); | ||
configureStyle(styleSheet.styles[bpmnvisu.ShapeBpmnElementKind.GATEWAY_EXCLUSIVE], theme.exclusiveGateway); | ||
|
||
// CALL ACTIVITY | ||
configureStyle(styleSheet.styles[bpmnvisu.ShapeBpmnElementKind.CALL_ACTIVITY], this._theme.callActivity); | ||
configureStyle(styleSheet.styles[bpmnvisu.ShapeBpmnElementKind.CALL_ACTIVITY], theme.callActivity); | ||
|
||
// POOL | ||
const style = styleSheet.styles[bpmnvisu.ShapeBpmnElementKind.POOL]; | ||
const themePool = this._theme.pool; | ||
const themePool = theme.pool; | ||
themePool.fontSize ??= 16; | ||
configureStyle(style, themePool); | ||
style[StyleIdentifiers.STYLE_FILLCOLOR] = themePool.labelFill; | ||
style[StyleIdentifiers.STYLE_SWIMLANE_FILLCOLOR] = themePool.swimlaneFill; | ||
style[StyleIdentifiers.STYLE_FONTSIZE] = themePool.fontSize ?? 16; | ||
} | ||
|
||
} | ||
|
@@ -40,13 +42,22 @@ function configureStyle(style, themeElement) { | |
if (themeElement.fill) { | ||
style[StyleIdentifiers.STYLE_FILLCOLOR] = themeElement.fill; | ||
} | ||
|
||
if (themeElement.font) { | ||
style[StyleIdentifiers.STYLE_FONTCOLOR] = themeElement.font; | ||
} | ||
if (themeElement.fontFamily) { | ||
style[StyleIdentifiers.STYLE_FONTFAMILY] = themeElement.fontFamily; | ||
} | ||
if (themeElement.fontSize) { | ||
style[StyleIdentifiers.STYLE_FONTSIZE] = themeElement.fontSize; | ||
} | ||
Comment on lines
+49
to
+54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. praise: more consistent with the management of other properties |
||
|
||
if (themeElement.gradient) { | ||
style[StyleIdentifiers.STYLE_GRADIENT_DIRECTION] = themeElement.gradientDirection ?? Directions.DIRECTION_WEST; | ||
style[StyleIdentifiers.STYLE_GRADIENTCOLOR] = themeElement.gradient; | ||
} | ||
|
||
if (themeElement.stroke) { | ||
style[StyleIdentifiers.STYLE_STROKECOLOR] = themeElement.stroke; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: much clearer 👍🏿