Skip to content
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

Ability to add styles for System_Boundary, Container_Boundary #227

Closed
vellala2000 opened this issue Jun 4, 2022 · 4 comments · Fixed by #231
Closed

Ability to add styles for System_Boundary, Container_Boundary #227

vellala2000 opened this issue Jun 4, 2022 · 4 comments · Fixed by #231
Assignees
Milestone

Comments

@vellala2000
Copy link

vellala2000 commented Jun 4, 2022

Add support to style System_Boundary, Container_Boundary

@vellala2000 vellala2000 changed the title Ability to adjust line styles for System_Boundary Ability to add styles for System_Boundary, , Container_Boundary Jun 4, 2022
@vellala2000 vellala2000 changed the title Ability to add styles for System_Boundary, , Container_Boundary Ability to add styles for System_Boundary, Container_Boundary Jun 4, 2022
@Potherca Potherca moved this to Todo in All Projects Jul 3, 2022
@Potherca Potherca moved this from Todo to Backlog in All Projects Jul 3, 2022
@stale stale bot added the stale Issue has not been active for 60 days label Aug 10, 2022
@Potherca Potherca added the not-stale Stop issue from being marked stale by bot label Aug 10, 2022
@plantuml-stdlib plantuml-stdlib deleted a comment from stale bot Aug 10, 2022
@Potherca Potherca removed the stale Issue has not been active for 60 days label Aug 10, 2022
@Potherca
Copy link
Member

Styling all boundaries

The style of all boundaries can already be changed by using skinparam and the <<boundary>> stereotype:

@startuml
!include <C4/C4_Container>

skinparam rectangle<<boundary>> {
  BackgroundColor #FEFECE
  BorderStyle solid
}

System_Boundary(sb, "System_Boundary") {
  Container_Boundary(cb1, "Container Boundary") {
    Container(c1, "Container")
  }
}
@enduml

Styling individual boundaries

Although it is currently not possible to style individual boundaries as one would for elements (using UpdateElementStyle), it is possible by setting a $tags and changing the skinparam for the tag`s stereotype:

@startuml
!include <C4/C4_Container>

hide stereotype

skinparam rectangle<<boundary>> {
  BackgroundColor #FEFECE
  BorderStyle solid
}

skinparam rectangle<<BOUNDARY_TAG>> {
  backgroundcolor #ABC

  border {
    color green
    style dotted
    thickness 2.5
  }

  Roundcorner 10

  Font { 
    Color red
    Name SansSerif
    Size 14
    Style plain
  }

}

System_Boundary(sb, "System_Boundary") {
  Container_Boundary(cb1, "Container Boundary\nwith tag") {
    Container(c1, "Container")
  }
  Container_Boundary(cb2, "Container_Boundary", $tags='BOUNDARY_TAG') {
    Container(c2, "Container")
  }
}
@enduml

@vellala2000 does this suffice for your usecase, or is there something else you need?

@Potherca Potherca removed the not-stale Stop issue from being marked stale by bot label Aug 10, 2022
@kirchsth
Copy link
Member

kirchsth commented Aug 14, 2022

[Updated]
I re-checked the current implementation and UpdateElementStyle("boundary", ...) and AddElementTag() support basically boundaries (incl. legend support). There are only few limitations

  1. no sprites are displayed (node specific, not supported at all)
  2. missing explicit AddBoundaryTag() and UpdateBoundaryStyle() calls; ...Element... calls can be used as workaround
  3. "non-tagged" boundaries are not added to the legend (if it is not updated); possible workaround see in following sample
  4. boundaries in legend are not marked as (dashed, transparent?) (rounded box is an additional style in case of boundaries), $legendText=... can be used as workaround
  5. $techn=... (is $type like System) of the tags is not support, there is no workaround atm
@startuml
!include <C4/C4_Container>

' workaround missing default boundary legend entry - should be part of C4 files -------------------
UpdateElementStyle("boundary", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR)
!$tagDefaultLegend = $tagDefaultLegend + "\nboundary"

' automatic add of ` (dashed, transparent?)` in legend is missing; $legendText=... could be used as workaround
' end of fix -------------------
' missing UpdateBoundaryStyle() and AddBoundaryTag() has to be simulated with ...Element...() calls


UpdateElementStyle("boundary", $bgColor="gold", $fontColor="brown", $borderColor="brown")

AddElementTag("special", $bgColor="green", $fontColor="white", $borderColor="blue", $shadowing="true", $shape = RoundedBoxShape(), $techn="A SPECIAL SYSTEM BOUNDARY", $legendText="special system boundary")

AddElementTag("existingContainersBoundary", $bgColor="red", $fontColor="white", $borderColor="white", $shape = RoundedBoxShape(), $techn="A SPECIAL SYSTEM BOUNDARY", $legendText="existing containers boundary")

System_Boundary(sb, "A System Boundary") {
}

System_Boundary(sb1, "Special System 1 Boundary", $tags="special") {
  Container_Boundary(cb1, "Container Boundary\nwith tag", $tags="existingContainersBoundary") {
    Container(e1, "existing 1", "xyz")
    Container(e2, "existing 2", "xyz")
  }
  Container_Boundary(cb2, "Container_Boundary") {
    Container(c2, "Container", "xyz")
  }
}

System_Boundary(sb2, "Special System 2 Boundary", $tags="special") { 
}

Lay_R(sb, sb1)
Lay_R(sb1, sb2)

SHOW_LEGEND()
@enduml

I think I could fix missing Add....Tag() and UpdateBoundaryStyle() calls (2) and missing legend entry (3, 4).
But I think we should not support sprites at all (1).

@vellala2000 and @Potherca: what do you think? Did I oversee something?

Best regards
Helmut

@Potherca
Copy link
Member

I think I could fix missing Add....Tag() and UpdateBoundaryStyle() calls (2) and missing legend entry (3, 4).

For the sake of consistency (or principle of least surprise, I think that would be a Good Idea:tm:

I think we should not support sprites at all (1).

Agreed.

Did I oversee something?

As usual, I think you got it spot-on.

kirchsth added a commit to kirchsth/C4-PlantUML that referenced this issue Aug 19, 2022
@kirchsth kirchsth self-assigned this Aug 19, 2022
@kirchsth kirchsth added this to the v2.5.0 milestone Aug 19, 2022
@kirchsth
Copy link
Member

Hi @Potherca and @vellala2000
I added a better style support for border tags, can you please review my PR #231
Thank you and best regards
Helmut

@Potherca Potherca linked a pull request Aug 20, 2022 that will close this issue
Repository owner moved this from Backlog to Done in All Projects Aug 21, 2022
kirchsth added a commit that referenced this issue Aug 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants