net.sourceforge.plantuml.style.FromSkinparamToStyle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml-gplv2 Show documentation
Show all versions of plantuml-gplv2 Show documentation
PlantUML is a component that allows to quickly write diagrams from text.
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
/* +=======================================================================
* |
* | PlantUML : a free UML diagram generator
* |
* +=======================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/liberapay (only 1€ per month!)
* https://plantuml.com/paypal
*
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License V2.
*
* THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
* LICENSE ("AGREEMENT"). [GNU General Public License V2]
*
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES
* RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
*
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* PlantUML can occasionally display sponsored or advertising messages. Those
* messages are usually generated on welcome or error images and never on
* functional diagrams.
* See https://plantuml.com/professional if you want to remove them
*
* Images (whatever their format : PNG, SVG, EPS...) generated by running PlantUML
* are owned by the author of their corresponding sources code (that is, their
* textual description in PlantUML language). Those images are not covered by
* this GPL v2 license.
*
* The generated images can then be used without any reference to the GPL v2 license.
* It is not even necessary to stipulate that they have been generated with PlantUML,
* although this will be appreciated by the PlantUML team.
*
* There is an exception : if the textual description in PlantUML language is also covered
* by any license, then the generated images are logically covered
* by the very same license.
*
* This is the IGY distribution (Install GraphViz by Yourself).
* You have to install GraphViz and to setup the GRAPHVIZ_DOT environment variable
* (see https://plantuml.com/graphviz-dot )
*
* Icons provided by OpenIconic : https://useiconic.com/open
* Archimate sprites provided by Archi : http://www.archimatetool.com
* Stdlib AWS provided by https://github.com/milo-minderbinder/AWS-PlantUML
* Stdlib Icons provided https://github.com/tupadr3/plantuml-icon-font-sprites
* ASCIIMathML (c) Peter Jipsen http://www.chapman.edu/~jipsen
* ASCIIMathML (c) David Lippman http://www.pierce.ctc.edu/dlippman
* CafeUndZopfli ported by Eugene Klyuchnikov https://github.com/eustas/CafeUndZopfli
* Brotli (c) by the Brotli Authors https://github.com/google/brotli
* Themes (c) by Brett Schwarz https://github.com/bschwarz/puml-themes
* Twemoji (c) by Twitter at https://twemoji.twitter.com/
*
*/
package net.sourceforge.plantuml.style;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import net.sourceforge.plantuml.stereo.StereotypeDecoration;
public class FromSkinparamToStyle {
// ::remove file when __HAXE__
static class Data {
final private SName[] styleNames;
final private PName propertyName;
Data(SName[] styleNames, PName propertyName) {
this.propertyName = propertyName;
this.styleNames = styleNames;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("[");
for (SName s : styleNames) {
sb.append(s.toString());
sb.append(".");
}
sb.setLength(sb.length() - 1);
sb.append("]");
sb.append(propertyName.toString());
return sb.toString();
}
}
private static final Map> knowlegde = new HashMap>();
static {
addConvert("participantClickableBackgroundColor", PName.BackGroundColor, SName.participant, SName.clickable);
addConvert("participantClickableBorderColor", PName.LineColor, SName.participant, SName.clickable);
addMagic(SName.participant);
addMagic(SName.boundary);
addMagic(SName.control);
addMagic(SName.collections);
addMagic(SName.actor);
addMagic(SName.database);
addMagic(SName.entity);
addConFont("header", SName.document, SName.header);
addConFont("footer", SName.document, SName.footer);
addConFont("caption", SName.document, SName.caption);
addConvert("defaultFontSize", PName.FontSize, SName.element);
addConvert("sequenceStereotypeFontSize", PName.FontSize, SName.stereotype);
addConvert("sequenceStereotypeFontStyle", PName.FontStyle, SName.stereotype);
addConvert("sequenceStereotypeFontColor", PName.FontColor, SName.stereotype);
addConvert("sequenceStereotypeFontName", PName.FontName, SName.stereotype);
addConvert("SequenceReferenceBorderColor", PName.LineColor, SName.reference);
addConvert("SequenceReferenceBorderColor", PName.LineColor, SName.referenceHeader);
addConvert("SequenceReferenceBackgroundColor", PName.BackGroundColor, SName.reference);
addConvert("sequenceReferenceHeaderBackgroundColor", PName.BackGroundColor, SName.referenceHeader);
addConFont("sequenceReference", SName.reference);
addConFont("sequenceReference", SName.referenceHeader);
addConvert("sequenceGroupBorderThickness", PName.LineThickness, SName.group);
addConvert("SequenceGroupBorderColor", PName.LineColor, SName.group);
addConvert("SequenceGroupBorderColor", PName.LineColor, SName.groupHeader);
addConvert("SequenceGroupBackgroundColor", PName.BackGroundColor, SName.groupHeader);
addConFont("SequenceGroup", SName.group);
addConFont("SequenceGroupHeader", SName.groupHeader);
addConvert("SequenceBoxBorderColor", PName.LineColor, SName.box);
addConvert("SequenceBoxBackgroundColor", PName.BackGroundColor, SName.box);
addConvert("SequenceBoxFontColor", PName.FontColor, SName.box);
addConvert("SequenceLifeLineBorderColor", PName.LineColor, SName.lifeLine);
addConvert("SequenceLifeLineBackgroundColor", PName.BackGroundColor, SName.lifeLine);
addConvert("sequenceDividerBackgroundColor", PName.BackGroundColor, SName.separator);
addConvert("sequenceDividerBorderColor", PName.LineColor, SName.separator);
addConFont("sequenceDivider", SName.separator);
addConvert("sequenceDividerBorderThickness", PName.LineThickness, SName.separator);
addConvert("SequenceMessageAlignment", PName.HorizontalAlignment, SName.arrow);
addConFont("note", SName.note);
addConvert("noteBorderThickness", PName.LineThickness, SName.note);
addConvert("noteBorderColor", PName.LineColor, SName.note);
addConvert("noteBackgroundColor", PName.BackGroundColor, SName.note);
addConvert("packageBackgroundColor", PName.BackGroundColor, SName.group);
addConvert("packageBorderColor", PName.LineColor, SName.group);
addMagic(SName.package_);
addConvert("PartitionBorderColor", PName.LineColor, SName.composite);
addConvert("PartitionBackgroundColor", PName.BackGroundColor, SName.composite);
addConFont("Partition", SName.composite);
addConvert("hyperlinkColor", PName.HyperLinkColor, SName.root);
addConvert("activityStartColor", PName.BackGroundColor, SName.circle, SName.start);
addConvert("activityEndColor", PName.LineColor, SName.circle, SName.end);
addConvert("activityStopColor", PName.LineColor, SName.circle, SName.stop);
addConvert("activityBarColor", PName.BackGroundColor, SName.activityBar);
addConvert("activityBorderColor", PName.LineColor, SName.activity);
addConvert("activityBorderThickness", PName.LineThickness, SName.activity);
addConvert("activityBackgroundColor", PName.BackGroundColor, SName.activity);
addConFont("activity", SName.activity);
addConvert("activityDiamondBackgroundColor", PName.BackGroundColor, SName.diamond);
addConvert("activityDiamondBorderColor", PName.LineColor, SName.diamond);
addConFont("activityDiamond", SName.diamond);
addConFont("arrow", SName.arrow);
addConvert("arrowThickness", PName.LineThickness, SName.arrow);
addConvert("arrowColor", PName.LineColor, SName.arrow);
addConvert("arrowStyle", PName.LineStyle, SName.arrow);
addConvert("arrowHeadColor", PName.HeadColor, SName.arrow);
addConvert("defaulttextalignment", PName.HorizontalAlignment, SName.root);
addConvert("defaultFontName", PName.FontName, SName.root);
addConvert("defaultFontColor", PName.FontColor, SName.root);
addConFont("SwimlaneTitle", SName.swimlane);
addConvert("SwimlaneTitleBackgroundColor", PName.BackGroundColor, SName.swimlane);
addConvert("SwimlaneBorderColor", PName.LineColor, SName.swimlane);
addConvert("SwimlaneBorderThickness", PName.LineThickness, SName.swimlane);
addConvert("roundCorner", PName.RoundCorner, SName.root);
addConvert("titleBorderThickness", PName.LineThickness, SName.title);
addConvert("titleBorderColor", PName.LineColor, SName.title);
addConvert("titleBackgroundColor", PName.BackGroundColor, SName.title);
addConvert("titleBorderRoundCorner", PName.RoundCorner, SName.title);
addConFont("title", SName.document, SName.title);
addConvert("legendBorderThickness", PName.LineThickness, SName.legend);
addConvert("legendBorderColor", PName.LineColor, SName.legend);
addConvert("legendBackgroundColor", PName.BackGroundColor, SName.legend);
addConvert("legendBorderRoundCorner", PName.RoundCorner, SName.legend);
addConFont("legend", SName.legend);
addConvert("noteTextAlignment", PName.HorizontalAlignment, SName.note);
addConvert("BackgroundColor", PName.BackGroundColor, SName.document);
addConvert("classBackgroundColor", PName.BackGroundColor, SName.element, SName.class_);
addConvert("classBorderColor", PName.LineColor, SName.element, SName.class_);
addConvert("classFontSize", PName.FontSize, SName.element, SName.class_, SName.header);
addConvert("classFontStyle", PName.FontStyle, SName.element, SName.class_, SName.header);
addConvert("classFontColor", PName.FontColor, SName.element, SName.class_, SName.header);
addConvert("classFontName", PName.FontName, SName.element, SName.class_, SName.header);
addConvert("classAttributeFontSize", PName.FontSize, SName.element, SName.class_);
addConvert("classAttributeFontStyle", PName.FontStyle, SName.element, SName.class_);
addConvert("classAttributeFontColor", PName.FontColor, SName.element, SName.class_);
addConvert("classAttributeFontName", PName.FontName, SName.element, SName.class_);
addConvert("classBorderThickness", PName.LineThickness, SName.element, SName.class_);
addConvert("classHeaderBackgroundColor", PName.BackGroundColor, SName.element, SName.class_, SName.header);
addConvert("objectBackgroundColor", PName.BackGroundColor, SName.object);
addConvert("objectBorderColor", PName.LineColor, SName.object);
addConFont("object", SName.object);
addConFont("objectAttribute", SName.object);
addConvert("objectBorderThickness", PName.LineThickness, SName.object);
addConvert("stateBackgroundColor", PName.BackGroundColor, SName.state);
addConvert("stateBorderColor", PName.LineColor, SName.state);
addConFont("state", SName.state);
addConFont("stateAttribute", SName.state);
addConvert("stateBorderThickness", PName.LineThickness, SName.state);
addMagic(SName.agent);
addMagic(SName.artifact);
addMagic(SName.card);
addMagic(SName.interface_);
addMagic(SName.cloud);
addMagic(SName.component);
addMagic(SName.file);
addMagic(SName.folder);
addMagic(SName.frame);
addMagic(SName.hexagon);
addMagic(SName.node);
addMagic(SName.person);
addMagic(SName.queue);
addMagic(SName.rectangle);
addMagic(SName.stack);
addMagic(SName.storage);
addMagic(SName.usecase);
addMagic(SName.map);
addMagic(SName.archimate);
addConvert("IconPrivateColor", PName.LineColor, SName.visibilityIcon, SName.private_);
addConvert("IconPrivateBackgroundColor", PName.BackGroundColor, SName.visibilityIcon, SName.private_);
addConvert("IconPackageColor", PName.LineColor, SName.visibilityIcon, SName.package_);
addConvert("IconPackageBackgroundColor", PName.BackGroundColor, SName.visibilityIcon, SName.package_);
addConvert("IconProtectedColor", PName.LineColor, SName.visibilityIcon, SName.protected_);
addConvert("IconProtectedBackgroundColor", PName.BackGroundColor, SName.visibilityIcon, SName.protected_);
addConvert("IconPublicColor", PName.LineColor, SName.visibilityIcon, SName.public_);
addConvert("IconPublicBackgroundColor", PName.BackGroundColor, SName.visibilityIcon, SName.public_);
addConvert("MinClassWidth", PName.MinimumWidth);
// addConvert("nodeStereotypeFontSize", PName.FontSize, SName.node, SName.stereotype);
// addConvert("sequenceStereotypeFontSize", PName.FontSize, SName.stereotype);
// addConvert("sequenceStereotypeFontStyle", PName.FontStyle, SName.stereotype);
// addConvert("sequenceStereotypeFontColor", PName.FontColor, SName.stereotype);
// addConvert("sequenceStereotypeFontName", PName.FontName, SName.stereotype);
addConvert("lifelineStrategy", PName.LineStyle, SName.lifeLine);
addConvert("wrapWidth", PName.MaximumWidth, SName.element);
addConvert("HyperlinkUnderline", PName.HyperlinkUnderlineThickness, SName.element);
}
private static void addMagic(SName sname) {
final String cleanName = sname.name().replace("_", "");
addConvert(cleanName + "BackgroundColor", PName.BackGroundColor, sname);
addConvert(cleanName + "BorderColor", PName.LineColor, sname);
addConvert(cleanName + "BorderThickness", PName.LineThickness, sname);
addConvert(cleanName + "RoundCorner", PName.RoundCorner, sname);
addConvert(cleanName + "DiagonalCorner", PName.DiagonalCorner, sname);
addConvert(cleanName + "BorderStyle", PName.LineStyle, sname);
addConFont(cleanName, sname);
addConvert(cleanName + "Shadowing", PName.Shadowing, sname);
addConvert(cleanName + "StereotypeFontSize", PName.FontSize, SName.stereotype, sname);
addConvert(cleanName + "StereotypeFontStyle", PName.FontStyle, SName.stereotype, sname);
addConvert(cleanName + "StereotypeFontColor", PName.FontColor, SName.stereotype, sname);
addConvert(cleanName + "StereotypeFontName", PName.FontName, SName.stereotype, sname);
}
private final List