Skip to content

Commit

Permalink
remove IconRegistry and API
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskn committed Dec 20, 2024
1 parent 6585d19 commit 886e764
Show file tree
Hide file tree
Showing 65 changed files with 239 additions and 877 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ Structurizr C4-PlantUML extension aims to bridge the gap between the [structuriz

## Example Diagrams

The following example diagrams demonstrate the features the Structurizr C4-PlantUML provides:
The following example diagrams demonstrate the features the Structurizr C4-PlantUML library provides:

* links, icons and properties for elements and relationships
* links and properties for elements and relationships
* external containers
* visualization for system and container boundaries
* database and queue shapes
* differentiation between synchronous and asynchronous relationships
* nested numbered parallel sequences for dynamic diagrams
* advanced layout configuration for C4-PlantUML diagrams
* sprite api allowing to use the PlantUML StdLib and custom sprite definitions
* sprite api allowing to use the PlantUML StdLib and custom sprite definitions for elements and relationships
* custom styles for model elements and relationships

More examples can be found under `src/test/kotlin`
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.chriskn.structurizrextension.api.model

import com.github.chriskn.structurizrextension.api.icons.IconRegistry
import com.github.chriskn.structurizrextension.api.view.sprite.sprites.Sprite
import com.structurizr.model.Component
import com.structurizr.model.Container
Expand All @@ -12,7 +11,6 @@ import com.structurizr.model.StaticStructureElement
* @param name the name of the component
* @param description the description of the component
* @param c4Type the [C4Type] of the component
* @param icon the icon of the component. See [IconRegistry] for available icons or add your own
* @param sprite the sprite of the component. See [Sprite] implementations for sprite types
* @param link the link of the component
* @param technology the technology of the component
Expand All @@ -28,9 +26,6 @@ fun Container.component(
name: String,
description: String,
c4Type: C4Type? = null,
@Suppress("DEPRECATED_JAVA_ANNOTATION")
@java.lang.Deprecated(since = "Since 12.2. Use sprite API instead")
icon: String? = null,
sprite: Sprite? = null,
link: String? = null,
technology: String = "",
Expand All @@ -41,6 +36,6 @@ fun Container.component(
): Component {
val component = this.addComponent(name, description, technology)
component.c4Type = c4Type
component.configure(icon, sprite, link, tags, properties, uses, usedBy)
component.configure(sprite, link, tags, properties, uses, usedBy)
return component
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.chriskn.structurizrextension.api.model

import com.github.chriskn.structurizrextension.api.icons.IconRegistry
import com.github.chriskn.structurizrextension.api.view.sprite.sprites.Sprite
import com.structurizr.model.Element
import com.structurizr.model.InteractionStyle
Expand All @@ -12,7 +11,6 @@ import com.structurizr.model.InteractionStyle
* @param description the description of the dependency
* @param technology the technology of the dependency
* @param interactionStyle the [InteractionStyle] of the dependency
* @param icon the icon of the dependency. See [IconRegistry] for available icons or add your own
* @param sprite the sprite of the dependency. See [Sprite] implementations for sprite types
* @param link the link of the dependency
* @param tags the list of tags of the dependency
Expand All @@ -24,8 +22,6 @@ data class Dependency<out T : Element>(
val description: String,
val technology: String? = null,
val interactionStyle: InteractionStyle? = null,
@Deprecated("Use sprite API instead", replaceWith = ReplaceWith("sprite"))
val icon: String? = null,
val sprite: Sprite? = null,
val link: String? = null,
val tags: List<String> = listOf(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.chriskn.structurizrextension.api.model

import com.github.chriskn.structurizrextension.api.icons.IconRegistry
import com.github.chriskn.structurizrextension.api.view.sprite.sprites.Sprite
import com.structurizr.model.Container
import com.structurizr.model.DeploymentElement
Expand All @@ -13,7 +12,6 @@ import com.structurizr.model.SoftwareSystem
*
* @param name the name of the deployment node
* @param description the description of the deployment node
* @param icon the icon of the deployment node. See [IconRegistry] for available icons or add your own
* @param sprite the sprite of the deployment node. See [Sprite] implementations for sprite types
* @param link the link of the deployment node
* @param technology the technology of the deployment node
Expand All @@ -29,9 +27,6 @@ import com.structurizr.model.SoftwareSystem
fun DeploymentNode.deploymentNode(
name: String,
description: String = "",
@Suppress("DEPRECATED_JAVA_ANNOTATION")
@java.lang.Deprecated(since = "Since 12.2. Use sprite API instead")
icon: String? = null,
sprite: Sprite? = null,
link: String? = null,
technology: String = "",
Expand All @@ -43,7 +38,7 @@ fun DeploymentNode.deploymentNode(
hostsContainers: List<Container> = listOf(),
): DeploymentNode {
val node = this.addDeploymentNode(name, description, technology)
node.configure(icon, sprite, link, tags, properties, hostsSystems, hostsContainers, uses, usedBy)
node.configure(sprite, link, tags, properties, hostsSystems, hostsContainers, uses, usedBy)
return node
}

Expand All @@ -52,7 +47,6 @@ fun DeploymentNode.deploymentNode(
*
* @param name the name of the infrastructure node
* @param description the description of the infrastructure node
* @param icon the icon of the infrastructure node. See [IconRegistry] for available icons or add your own
* @param sprite the sprite of the infrastructure node. See [Sprite] implementations for sprite types
* @param link the link of the infrastructure node
* @param technology the technology of the infrastructure node
Expand All @@ -67,9 +61,6 @@ fun DeploymentNode.deploymentNode(
fun DeploymentNode.infrastructureNode(
name: String,
description: String = "",
@Suppress("DEPRECATED_JAVA_ANNOTATION")
@java.lang.Deprecated(since = "Since 12.2. Use sprite API instead")
icon: String? = null,
sprite: Sprite? = null,
link: String? = null,
technology: String = "",
Expand All @@ -79,23 +70,20 @@ fun DeploymentNode.infrastructureNode(
usedBy: List<Dependency<DeploymentNode>> = listOf(),
): InfrastructureNode {
val node = this.addInfrastructureNode(name, description, technology)
node.configure(icon, sprite, link, tags, properties)
node.configure(sprite, link, tags, properties)
uses.forEach { dep ->
node.uses(dep.destination, dep.description, dep.technology, dep.interactionStyle)
.configure(dep.icon, dep.sprite, dep.link, dep.tags, dep.properties)
.configure(dep.sprite, dep.link, dep.tags, dep.properties)
}
usedBy.forEach { dep ->
dep.destination.uses(node, dep.description, dep.technology, dep.interactionStyle)
.configure(dep.icon, dep.sprite, dep.link, dep.tags, dep.properties)
.configure(dep.sprite, dep.link, dep.tags, dep.properties)
}
return node
}

@Suppress("LongParameterList")
internal fun DeploymentNode.configure(
@Suppress("DEPRECATED_JAVA_ANNOTATION")
@java.lang.Deprecated(since = "Since 12.2. Use sprite API instead")
icon: String?,
sprite: Sprite?,
link: String?,
tags: List<String>,
Expand All @@ -105,7 +93,7 @@ internal fun DeploymentNode.configure(
uses: List<Dependency<DeploymentElement>>,
usedBy: List<Dependency<DeploymentElement>>,
) {
this.configure(icon, sprite, link, tags, properties)
this.configure(sprite, link, tags, properties)
hostsSystems.forEach {
val instance = this.add(it)
it.tagsAsSet.forEach { tag -> instance.addTags(tag) }
Expand All @@ -117,21 +105,21 @@ internal fun DeploymentNode.configure(
uses.forEach { dep ->
when (dep.destination) {
is DeploymentNode -> this.uses(dep.destination, dep.description, dep.technology, dep.interactionStyle)
.configure(dep.icon, dep.sprite, dep.link, dep.tags, dep.properties)
.configure(dep.sprite, dep.link, dep.tags, dep.properties)

is InfrastructureNode -> this.uses(dep.destination, dep.description, dep.technology, dep.interactionStyle)
.configure(dep.icon, dep.sprite, dep.link, dep.tags, dep.properties)
.configure(dep.sprite, dep.link, dep.tags, dep.properties)

else -> throw IllegalArgumentException("DeploymentNode cant use ${dep.destination::class.java.name}")
}
}
usedBy.forEach { dep ->
when (dep.destination) {
is DeploymentNode -> dep.destination.uses(this, dep.description, dep.technology, dep.interactionStyle)
.configure(dep.icon, dep.sprite, dep.link, dep.tags, dep.properties)
.configure(dep.sprite, dep.link, dep.tags, dep.properties)

is InfrastructureNode -> dep.destination.uses(this, dep.description, dep.technology, dep.interactionStyle)
.configure(dep.icon, dep.sprite, dep.link, dep.tags, dep.properties)
.configure(dep.sprite, dep.link, dep.tags, dep.properties)

else -> throw IllegalArgumentException("DeploymentNode cant be use by ${dep.destination::class.java.name}")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.chriskn.structurizrextension.api.model

import com.github.chriskn.structurizrextension.api.icons.IconRegistry
import com.github.chriskn.structurizrextension.api.view.sprite.sprites.Sprite
import com.structurizr.model.Container
import com.structurizr.model.DeploymentElement
Expand Down Expand Up @@ -28,7 +27,6 @@ var Model.enterpriseName: String?
* @param name the name of the person (e.g. "Admin User" or "Bob the Business User")
* @param description the description of the person
* @param location the [Location] of the person
* @param icon the icon of the person. See [IconRegistry] for available icons or add your own
* @param sprite the sprite of the person. See [Sprite] implementations for sprite types
* @param link the link of the person
* @param tags the list of tags of the person
Expand All @@ -42,9 +40,6 @@ fun Model.person(
name: String,
description: String = "",
location: Location = Location.Unspecified,
@Suppress("DEPRECATED_JAVA_ANNOTATION")
@java.lang.Deprecated(since = "Since 12.2. Use sprite API instead")
icon: String? = null,
sprite: Sprite? = null,
link: String? = null,
tags: List<String> = listOf(),
Expand All @@ -54,7 +49,7 @@ fun Model.person(
@Suppress("DEPRECATION")
val person = this.addPerson(name, description)
person.c4Location = location
person.configure(icon, sprite, link, tags, properties)
person.configure(sprite, link, tags, properties)
uses.forEach { dep -> dep.addRelationShipFrom(person) }
return person
}
Expand All @@ -66,7 +61,6 @@ fun Model.person(
* @param description the description of the system
* @param location the [Location] of the system
* @param c4Type the [C4Type] of the system
* @param icon the icon of the system. See [IconRegistry] for available icons or add your own
* @param sprite the sprite of the software systen. See [Sprite] implementations for sprite types
* @param link the link of the system
* @param tags the list of tags of the system
Expand All @@ -82,9 +76,6 @@ fun Model.softwareSystem(
description: String,
location: Location = Location.Unspecified,
c4Type: C4Type? = null,
@Suppress("DEPRECATED_JAVA_ANNOTATION")
@java.lang.Deprecated(since = "Since 12.2. Use sprite API instead")
icon: String? = null,
sprite: Sprite? = null,
link: String? = null,
tags: List<String> = listOf(),
Expand All @@ -95,7 +86,7 @@ fun Model.softwareSystem(
val softwareSystem = this.addSoftwareSystem(name, description)
softwareSystem.c4Type = c4Type
softwareSystem.c4Location = location
softwareSystem.configure(icon, sprite, link, tags, properties, uses, usedBy)
softwareSystem.configure(sprite, link, tags, properties, uses, usedBy)
return softwareSystem
}

Expand All @@ -104,7 +95,6 @@ fun Model.softwareSystem(
*
* @param name the name of the deployment node
* @param description the description of the deployment node
* @param icon the icon of the deployment node. See [IconRegistry] for available icons or add your own
* @param sprite the sprite of the deployment node. See [Sprite] implementations for sprite types
* @param link the link of the deployment node
* @param technology the technology of the deployment node
Expand All @@ -122,9 +112,6 @@ fun Model.deploymentNode(
name: String,
description: String = "",
environment: String? = DeploymentElement.DEFAULT_DEPLOYMENT_ENVIRONMENT,
@Suppress("DEPRECATED_JAVA_ANNOTATION")
@java.lang.Deprecated(since = "Since 12.2. Use sprite API instead")
icon: String? = null,
sprite: Sprite? = null,
link: String? = null,
technology: String = "",
Expand All @@ -136,6 +123,6 @@ fun Model.deploymentNode(
hostsContainers: List<Container> = listOf(),
): DeploymentNode {
val node = this.addDeploymentNode(environment, name, description, technology)
node.configure(icon, sprite, link, tags, properties, hostsSystems, hostsContainers, uses, usedBy)
node.configure(sprite, link, tags, properties, hostsSystems, hostsContainers, uses, usedBy)
return node
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.structurizr.model.ModelItem

private const val C4_PROPERTY_PREFIX = "additionalProperty:"
private const val C4_PROPERTY_HEADER_PREFIX = "additionalPropertyHeader"
private const val ICON_PROPERTY = "icon"
private const val SPRITE_PROPERTY = "sprite"
private const val LINK_PROPERTY = "link"

Expand Down Expand Up @@ -54,21 +53,6 @@ var ModelItem.c4Properties: C4Properties?
}
}

var ModelItem.icon: String?
/**
* Returns the icon or null if not set.
*/
get() = this.properties[ICON_PROPERTY]

/**
* Sets the icon if not null or blank.
*/
set(icon) {
if (!icon.isNullOrBlank()) {
this.addProperty(ICON_PROPERTY, icon)
}
}

var ModelItem.sprite: Sprite?
/**
* Returns the sprite or null if not set.
Expand Down Expand Up @@ -100,13 +84,11 @@ var ModelItem.link: String?
}

internal fun ModelItem.configure(
icon: String?,
sprite: Sprite?,
link: String?,
tags: List<String>,
c4Properties: C4Properties?
) {
this.icon = icon
this.sprite = sprite
this.link = link
tags.forEach { tag -> this.addTags(tag) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.chriskn.structurizrextension.api.model

import com.github.chriskn.structurizrextension.api.icons.IconRegistry
import com.github.chriskn.structurizrextension.api.view.sprite.sprites.Sprite
import com.structurizr.model.Container
import com.structurizr.model.Location
Expand All @@ -14,7 +13,7 @@ import com.structurizr.model.StaticStructureElement
* @param description the description of the container
* @param location the [Location] of the container
* @param c4Type the [C4Type] of the container
* @param icon the icon of the container. See [IconRegistry] for available icons or add your own
* @param sprite the sprite of the container. See [Sprite] implementations for sprite types
* @param link the link of the container
* @param tags the list of tags of the container
Expand All @@ -30,9 +29,6 @@ fun SoftwareSystem.container(
description: String,
location: Location = this.c4Location,
c4Type: C4Type? = null,
@Suppress("DEPRECATED_JAVA_ANNOTATION")
@java.lang.Deprecated(since = "Since 12.2. Use sprite API instead")
icon: String? = null,
sprite: Sprite? = null,
link: String? = null,
technology: String = "",
Expand All @@ -44,6 +40,6 @@ fun SoftwareSystem.container(
val container = this.addContainer(name, description, technology)
container.c4Type = c4Type
container.c4Location = location
container.configure(icon, sprite, link, tags, properties, uses, usedBy)
container.configure(sprite, link, tags, properties, uses, usedBy)
return container
}
Loading

0 comments on commit 886e764

Please sign in to comment.