2015-05-03 15:36:36 +00:00
|
|
|
/* ========================================================================
|
|
|
|
* PlantUML : a free UML diagram generator
|
|
|
|
* ========================================================================
|
|
|
|
*
|
2019-01-16 18:34:41 +00:00
|
|
|
* (C) Copyright 2009-2020, Arnaud Roques
|
2015-05-03 15:36:36 +00:00
|
|
|
*
|
2016-03-06 16:47:34 +00:00
|
|
|
* Project Info: http://plantuml.com
|
2015-05-03 15:36:36 +00:00
|
|
|
*
|
2017-03-15 19:13:31 +00:00
|
|
|
* If you like this project or if you find it useful, you can support us at:
|
|
|
|
*
|
|
|
|
* http://plantuml.com/patreon (only 1$ per month!)
|
|
|
|
* http://plantuml.com/paypal
|
|
|
|
*
|
2015-05-03 15:36:36 +00:00
|
|
|
* This file is part of PlantUML.
|
|
|
|
*
|
|
|
|
* PlantUML is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* PlantUML distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
|
|
* License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
|
|
* USA.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Original Author: Arnaud Roques
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
package net.sourceforge.plantuml.graphic;
|
|
|
|
|
|
|
|
import net.sourceforge.plantuml.ColorParam;
|
2018-07-27 21:56:46 +00:00
|
|
|
import net.sourceforge.plantuml.CornerParam;
|
2015-05-03 15:36:36 +00:00
|
|
|
import net.sourceforge.plantuml.FontParam;
|
2016-12-14 21:01:03 +00:00
|
|
|
import net.sourceforge.plantuml.ISkinParam;
|
2016-12-21 22:10:29 +00:00
|
|
|
import net.sourceforge.plantuml.LineParam;
|
2016-12-14 21:01:03 +00:00
|
|
|
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
2016-12-21 22:10:29 +00:00
|
|
|
import net.sourceforge.plantuml.ugraphic.UStroke;
|
2015-05-03 15:36:36 +00:00
|
|
|
|
|
|
|
public class SkinParameter {
|
|
|
|
|
|
|
|
public static final SkinParameter DATABASE = new SkinParameter("DATABASE", ColorParam.databaseBackground,
|
|
|
|
ColorParam.databaseBorder, FontParam.DATABASE, FontParam.DATABASE_STEREOTYPE);
|
|
|
|
|
|
|
|
public static final SkinParameter ARTIFACT = new SkinParameter("ARTIFACT", ColorParam.artifactBackground,
|
|
|
|
ColorParam.artifactBorder, FontParam.ARTIFACT, FontParam.ARTIFACT_STEREOTYPE);
|
|
|
|
|
|
|
|
public static final SkinParameter COMPONENT1 = new SkinParameter("COMPONENT1", ColorParam.componentBackground,
|
2018-01-28 22:08:15 +00:00
|
|
|
ColorParam.componentBorder, FontParam.COMPONENT, FontParam.COMPONENT_STEREOTYPE, LineParam.componentBorder,
|
2018-04-06 20:36:30 +00:00
|
|
|
CornerParam.component);
|
2015-05-03 15:36:36 +00:00
|
|
|
|
|
|
|
public static final SkinParameter NODE = new SkinParameter("NODE", ColorParam.nodeBackground,
|
|
|
|
ColorParam.nodeBorder, FontParam.NODE, FontParam.NODE_STEREOTYPE);
|
|
|
|
|
|
|
|
public static final SkinParameter STORAGE = new SkinParameter("STORAGE", ColorParam.storageBackground,
|
|
|
|
ColorParam.storageBorder, FontParam.STORAGE, FontParam.STORAGE_STEREOTYPE);
|
|
|
|
|
|
|
|
public static final SkinParameter QUEUE = new SkinParameter("QUEUE", ColorParam.queueBackground,
|
|
|
|
ColorParam.queueBorder, FontParam.QUEUE, FontParam.QUEUE_STEREOTYPE);
|
|
|
|
|
2017-05-10 19:51:15 +00:00
|
|
|
public static final SkinParameter STACK = new SkinParameter("STACK", ColorParam.stackBackground,
|
|
|
|
ColorParam.stackBorder, FontParam.STACK, FontParam.STACK_STEREOTYPE);
|
2017-04-26 17:48:37 +00:00
|
|
|
|
2015-05-03 15:36:36 +00:00
|
|
|
public static final SkinParameter CLOUD = new SkinParameter("CLOUD", ColorParam.cloudBackground,
|
|
|
|
ColorParam.cloudBorder, FontParam.CLOUD, FontParam.CLOUD_STEREOTYPE);
|
|
|
|
|
|
|
|
public static final SkinParameter FRAME = new SkinParameter("FRAME", ColorParam.frameBackground,
|
|
|
|
ColorParam.frameBorder, FontParam.FRAME, FontParam.FRAME_STEREOTYPE);
|
|
|
|
|
|
|
|
public static final SkinParameter COMPONENT2 = new SkinParameter("COMPONENT2", ColorParam.componentBackground,
|
2018-01-28 22:08:15 +00:00
|
|
|
ColorParam.componentBorder, FontParam.COMPONENT, FontParam.COMPONENT_STEREOTYPE, LineParam.componentBorder,
|
2018-04-06 20:36:30 +00:00
|
|
|
CornerParam.component);
|
2015-05-03 15:36:36 +00:00
|
|
|
|
|
|
|
public static final SkinParameter AGENT = new SkinParameter("AGENT", ColorParam.agentBackground,
|
2018-05-01 17:26:04 +00:00
|
|
|
ColorParam.agentBorder, FontParam.AGENT, FontParam.AGENT_STEREOTYPE, LineParam.agentBorder, CornerParam.agent);
|
2015-05-03 15:36:36 +00:00
|
|
|
|
|
|
|
public static final SkinParameter FOLDER = new SkinParameter("FOLDER", ColorParam.folderBackground,
|
|
|
|
ColorParam.folderBorder, FontParam.FOLDER, FontParam.FOLDER_STEREOTYPE);
|
|
|
|
|
2016-11-04 21:39:29 +00:00
|
|
|
public static final SkinParameter FILE = new SkinParameter("FILE", ColorParam.fileBackground,
|
|
|
|
ColorParam.fileBorder, FontParam.FILE, FontParam.FILE_STEREOTYPE);
|
|
|
|
|
2015-05-03 15:36:36 +00:00
|
|
|
public static final SkinParameter PACKAGE = new SkinParameter("PACKAGE", ColorParam.packageBackground,
|
2019-07-14 20:09:26 +00:00
|
|
|
ColorParam.packageBorder, FontParam.PACKAGE, FontParam.PACKAGE_STEREOTYPE);
|
2015-05-03 15:36:36 +00:00
|
|
|
|
2018-04-06 20:36:30 +00:00
|
|
|
public static final SkinParameter CARD = new SkinParameter("CARD", ColorParam.cardBackground,
|
2018-05-01 17:26:04 +00:00
|
|
|
ColorParam.cardBorder, FontParam.CARD, FontParam.CARD_STEREOTYPE, LineParam.cardBorder,
|
|
|
|
CornerParam.card);
|
2015-05-03 15:36:36 +00:00
|
|
|
|
2016-12-14 21:01:03 +00:00
|
|
|
public static final SkinParameter RECTANGLE = new SkinParameter("RECTANGLE", ColorParam.rectangleBackground,
|
2018-01-28 22:08:15 +00:00
|
|
|
ColorParam.rectangleBorder, FontParam.RECTANGLE, FontParam.RECTANGLE_STEREOTYPE, LineParam.rectangleBorder,
|
2018-04-06 20:36:30 +00:00
|
|
|
CornerParam.rectangle);
|
2016-12-14 21:01:03 +00:00
|
|
|
|
2019-05-24 19:59:31 +00:00
|
|
|
public static final SkinParameter ARCHIMATE = new SkinParameter("ARCHIMATE", ColorParam.archimateBackground,
|
|
|
|
ColorParam.archimateBorder, FontParam.ARCHIMATE, FontParam.ARCHIMATE_STEREOTYPE, LineParam.archimateBorder,
|
|
|
|
CornerParam.archimate);
|
|
|
|
|
2017-11-20 16:10:36 +00:00
|
|
|
public static final SkinParameter COLLECTIONS = new SkinParameter("COLLECTIONS", ColorParam.collectionsBackground,
|
|
|
|
ColorParam.collectionsBorder, FontParam.RECTANGLE, FontParam.RECTANGLE_STEREOTYPE);
|
|
|
|
|
2015-05-03 15:36:36 +00:00
|
|
|
public static final SkinParameter ACTOR = new SkinParameter("ACTOR", ColorParam.actorBackground,
|
|
|
|
ColorParam.actorBorder, FontParam.ACTOR, FontParam.ACTOR_STEREOTYPE);
|
|
|
|
|
2018-01-28 22:08:15 +00:00
|
|
|
public static final SkinParameter USECASE = new SkinParameter("USECASE", ColorParam.usecaseBackground,
|
|
|
|
ColorParam.usecaseBorder, FontParam.USECASE, FontParam.USECASE_STEREOTYPE);
|
|
|
|
|
2015-05-03 15:36:36 +00:00
|
|
|
public static final SkinParameter BOUNDARY = new SkinParameter("BOUNDARY", ColorParam.boundaryBackground,
|
|
|
|
ColorParam.boundaryBorder, FontParam.BOUNDARY, FontParam.BOUNDARY_STEREOTYPE);
|
|
|
|
|
|
|
|
public static final SkinParameter CONTROL = new SkinParameter("CONTROL", ColorParam.controlBackground,
|
|
|
|
ColorParam.controlBorder, FontParam.CONTROL, FontParam.CONTROL_STEREOTYPE);
|
|
|
|
|
2019-11-03 17:40:03 +00:00
|
|
|
public static final SkinParameter ENTITY = new SkinParameter("ENTITY", ColorParam.entityBackground,
|
2015-05-03 15:36:36 +00:00
|
|
|
ColorParam.entityBorder, FontParam.ENTITY, FontParam.ENTITY_STEREOTYPE);
|
|
|
|
|
|
|
|
public static final SkinParameter INTERFACE = new SkinParameter("INTERFACE", ColorParam.interfaceBackground,
|
|
|
|
ColorParam.interfaceBorder, FontParam.INTERFACE, FontParam.INTERFACE_STEREOTYPE);
|
|
|
|
|
2019-03-29 22:14:07 +00:00
|
|
|
public static final SkinParameter PARTICIPANT = new SkinParameter("PARTICIPANT", ColorParam.participantBackground,
|
|
|
|
ColorParam.participantBorder, FontParam.PARTICIPANT, FontParam.PARTICIPANT_STEREOTYPE);
|
|
|
|
|
2015-05-03 15:36:36 +00:00
|
|
|
private final ColorParam colorParamBorder;
|
|
|
|
private final ColorParam colorParamBack;
|
|
|
|
private final FontParam fontParam;
|
|
|
|
private final FontParam fontParamStereotype;
|
|
|
|
private final String name;
|
2018-01-04 22:32:45 +00:00
|
|
|
private final LineParam lineParam;
|
2018-04-06 20:36:30 +00:00
|
|
|
private final CornerParam roundParam;
|
2015-05-03 15:36:36 +00:00
|
|
|
|
|
|
|
private SkinParameter(String name, ColorParam colorParamBack, ColorParam colorParamBorder, FontParam fontParam,
|
2018-04-06 20:36:30 +00:00
|
|
|
FontParam fontParamStereotype, LineParam lineParam, CornerParam roundParam) {
|
2015-05-03 15:36:36 +00:00
|
|
|
this.name = name;
|
|
|
|
this.colorParamBack = colorParamBack;
|
|
|
|
this.colorParamBorder = colorParamBorder;
|
|
|
|
this.fontParam = fontParam;
|
|
|
|
this.fontParamStereotype = fontParamStereotype;
|
2018-01-04 22:32:45 +00:00
|
|
|
this.lineParam = lineParam;
|
2018-01-28 22:08:15 +00:00
|
|
|
this.roundParam = roundParam;
|
2018-01-04 22:32:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private SkinParameter(String name, ColorParam colorParamBack, ColorParam colorParamBorder, FontParam fontParam,
|
|
|
|
FontParam fontParamStereotype) {
|
2018-04-06 20:36:30 +00:00
|
|
|
this(name, colorParamBack, colorParamBorder, fontParam, fontParamStereotype, null, CornerParam.DEFAULT);
|
2015-05-03 15:36:36 +00:00
|
|
|
}
|
2016-12-14 21:01:03 +00:00
|
|
|
|
2015-05-03 15:36:36 +00:00
|
|
|
public String getUpperCaseName() {
|
2017-01-21 22:25:28 +00:00
|
|
|
if (name.endsWith("1") || name.endsWith("2")) {
|
|
|
|
return name.substring(0, name.length() - 1);
|
|
|
|
}
|
2015-05-03 15:36:36 +00:00
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ColorParam getColorParamBorder() {
|
|
|
|
return colorParamBorder;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ColorParam getColorParamBack() {
|
|
|
|
return colorParamBack;
|
|
|
|
}
|
|
|
|
|
|
|
|
public FontParam getFontParam() {
|
|
|
|
return fontParam;
|
|
|
|
}
|
|
|
|
|
|
|
|
public FontParam getFontParamStereotype() {
|
|
|
|
return fontParamStereotype;
|
|
|
|
}
|
|
|
|
|
2016-12-14 21:01:03 +00:00
|
|
|
public double getRoundCorner(ISkinParam skinParam, Stereotype stereotype) {
|
2018-01-28 22:08:15 +00:00
|
|
|
return skinParam.getRoundCorner(roundParam, stereotype);
|
2016-12-14 21:01:03 +00:00
|
|
|
}
|
|
|
|
|
2018-04-06 20:36:30 +00:00
|
|
|
public double getDiagonalCorner(ISkinParam skinParam, Stereotype stereotype) {
|
|
|
|
return skinParam.getDiagonalCorner(roundParam, stereotype);
|
|
|
|
}
|
|
|
|
|
2016-12-21 22:10:29 +00:00
|
|
|
public UStroke getStroke(ISkinParam skinParam, Stereotype stereotype) {
|
|
|
|
UStroke result = null;
|
2018-01-04 22:32:45 +00:00
|
|
|
if (lineParam != null) {
|
|
|
|
result = skinParam.getThickness(lineParam, stereotype);
|
2016-12-21 22:10:29 +00:00
|
|
|
}
|
|
|
|
if (result == null) {
|
|
|
|
result = new UStroke(1.5);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2015-05-03 15:36:36 +00:00
|
|
|
}
|