-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for subsystems in component diagrams (#291)
Co-authored-by: Alexander Görtzen <[email protected]> Co-authored-by: Matthias Lehner <[email protected]>
- Loading branch information
1 parent
a872c94
commit 1ad5da8
Showing
12 changed files
with
124 additions
and
15 deletions.
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
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,3 +1,9 @@ | ||
import { UMLPackage } from '../uml-package/uml-package'; | ||
|
||
export abstract class UMLComponent extends UMLPackage {} | ||
export interface IUMLComponent { | ||
stereotype: string; | ||
} | ||
|
||
export abstract class UMLComponent extends UMLPackage implements IUMLComponent { | ||
stereotype = 'component'; | ||
} |
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
48 changes: 48 additions & 0 deletions
48
...kages/uml-component-diagram/uml-component-subsystem/uml-component-subsystem-component.tsx
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React, { FunctionComponent } from 'react'; | ||
import { Text } from '../../../components/controls/text/text'; | ||
import { UMLSubsystem } from './uml-component-subsystem'; | ||
import { ThemedPath, ThemedRect } from '../../../components/theme/themedComponents'; | ||
|
||
export const UMLComponentSubsystem: FunctionComponent<Props> = ({ element, children, fillColor }) => ( | ||
<g data-cy="uml-subsystem"> | ||
<ThemedRect | ||
width="100%" | ||
height="100%" | ||
strokeColor={element.strokeColor} | ||
fillColor={fillColor || element.fillColor} | ||
/> | ||
<g transform={`translate(${element.bounds.width - 31}, 7)`}> | ||
<ThemedPath | ||
d="M 4.8 0 L 24 0 L 24 24 L 4.8 24 L 4.8 19.2 L 0 19.2 L 0 14.4 L 4.8 14.4 L 4.8 9.6 L 0 9.6 L 0 4.8 L 4.8 4.8 Z" | ||
fillColor={fillColor || element.fillColor} | ||
strokeColor={element.strokeColor} | ||
strokeWidth="1.2" | ||
strokeMiterlimit="10" | ||
/> | ||
<ThemedPath | ||
d="M 4.8 4.8 L 9.6 4.8 L 9.6 9.6 L 4.8 9.6 M 4.8 14.4 L 9.6 14.4 L 9.6 19.2 L 4.8 19.2" | ||
fillColor="none" | ||
strokeColor={element.strokeColor} | ||
strokeWidth="1.2" | ||
strokeMiterlimit="10" | ||
/> | ||
</g> | ||
<Text fill={element.textColor} y={`${25}px`}> | ||
{element.stereotype && ( | ||
<tspan x="50%" dy={-8} textAnchor="middle" fontSize="85%"> | ||
{`«${element.stereotype}»`} | ||
</tspan> | ||
)} | ||
<tspan x="50%" dy={element.stereotype ? 18 : 10} textAnchor="middle"> | ||
{element.name} | ||
</tspan> | ||
</Text> | ||
{children} | ||
</g> | ||
); | ||
|
||
interface Props { | ||
element: UMLSubsystem; | ||
fillColor?: string; | ||
children?: React.ReactNode; | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/packages/uml-component-diagram/uml-component-subsystem/uml-component-subsystem.ts
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { UMLPackage } from '../../common/uml-package/uml-package'; | ||
import { ComponentElementType, ComponentRelationshipType } from '..'; | ||
|
||
export interface IUMLSubsystem { | ||
stereotype: string; | ||
} | ||
|
||
export class UMLSubsystem extends UMLPackage implements IUMLSubsystem { | ||
static supportedRelationships = [ | ||
ComponentRelationshipType.ComponentDependency, | ||
ComponentRelationshipType.ComponentInterfaceProvided, | ||
ComponentRelationshipType.ComponentInterfaceRequired, | ||
]; | ||
stereotype = 'subsystem'; | ||
type = ComponentElementType.Subsystem; | ||
} |
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