version 1.2019.9

This commit is contained in:
Arnaud Roques 2019-08-26 19:07:21 +02:00
parent c10dc0a6f7
commit d0fdb2433b
222 changed files with 4089 additions and 2477 deletions

View File

@ -30,7 +30,8 @@
Script Author: Julien Eluard Script Author: Julien Eluard
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>net.sourceforge.plantuml</groupId> <groupId>net.sourceforge.plantuml</groupId>

View File

@ -1,4 +1,4 @@
style root { root {
FontName SansSerif FontName SansSerif
HyperLinkColor red HyperLinkColor red
FontColor green FontColor green
@ -13,57 +13,57 @@ style root {
Shadowing 0.0 Shadowing 0.0
} }
style stereotype { stereotype {
FontColor blue FontColor blue
FontSize 8 FontSize 8
FontStyle bold FontStyle bold
} }
style title { title {
HorizontalAlignment right HorizontalAlignment right
FontSize 24 FontSize 24
FontColor blue FontColor blue
} }
style header { header {
HorizontalAlignment center HorizontalAlignment center
FontSize 26 FontSize 26
FontColor purple FontColor purple
} }
style footer { footer {
HorizontalAlignment left HorizontalAlignment left
FontSize 28 FontSize 28
FontColor red FontColor red
} }
style legend { legend {
FontSize 30 FontSize 30
BackGroundColor yellow BackGroundColor yellow
Margin 30 Margin 30
Padding 50 Padding 50
} }
style caption { caption {
FontSize 32 FontSize 32
} }
style element { element {
BackGroundColor #CEFEFE BackGroundColor #CEFEFE
} }
style sequenceDiagram { sequenceDiagram {
} }
style classDiagram { classDiagram {
} }
style activityDiagram { activityDiagram {
} }
style group { group {
LineThickness 3.5 LineThickness 3.5
BackGroundColor MistyRose BackGroundColor MistyRose
LineColor DarkOrange LineColor DarkOrange
@ -73,7 +73,7 @@ style group {
FontColor red FontColor red
} }
style groupHeader { groupHeader {
BackGroundColor tan BackGroundColor tan
LineThickness 0.5 LineThickness 0.5
LineColor yellow LineColor yellow
@ -83,15 +83,15 @@ style groupHeader {
FontColor blue FontColor blue
} }
style lifeLine { lifeLine {
BackGroundColor gold BackGroundColor gold
} }
style destroy { destroy {
LineColor red LineColor red
} }
style reference { reference {
LineColor red LineColor red
FontSize 10 FontSize 10
FontStyle bold FontStyle bold
@ -100,7 +100,7 @@ style reference {
HorizontalAlignment right HorizontalAlignment right
} }
style box { box {
LineThickness 0.1 LineThickness 0.1
LineColor FireBrick LineColor FireBrick
BackGroundColor PowderBlue BackGroundColor PowderBlue
@ -110,7 +110,7 @@ style box {
FontColor Maroon FontColor Maroon
} }
style separator { separator {
LineColor red LineColor red
BackGroundColor green BackGroundColor green
@ -119,51 +119,103 @@ style separator {
FontColor white FontColor white
} }
style delay { delay {
FontSize 22 FontSize 22
FontStyle italic FontStyle italic
} }
style participant { participant {
LineThickness 2.5 LineThickness 2.5
} }
style actor { actor {
LineThickness 0.5 LineThickness 0.5
} }
style boundary { boundary {
LineThickness 1.5 LineThickness 1.5
} }
style control { control {
LineThickness 1.5 LineThickness 1.5
} }
style entity { entity {
LineThickness 1.5 LineThickness 1.5
} }
style queue { queue {
LineThickness 1.5 LineThickness 1.5
} }
style database { database {
LineThickness 1.5 LineThickness 1.5
} }
style collections { collections {
LineThickness 1.5 LineThickness 1.5
} }
style message { arrow {
FontSize 13
LineColor Lime
} }
style note { note {
BackGroundColor GoldenRod BackGroundColor GoldenRod
} }
style swimlane { diamond {
}
swimlane {
}
activity {
BackgroundColor #33668E
BorderColor #33668E
FontColor #888
FontName arial
} }
activityDiagram {
diamond {
BackgroundColor #dae4f1
BorderColor #33668E
FontColor red
FontName arial
FontSize 5
}
arrow {
FontColor gold
FontName arial
FontSize 15
}
partition {
LineColor red
FontColor green
RoundCorner 30
BackColor PeachPuff
}
note {
FontColor Blue
LineColor yellow
}
}
circle {
LineColor yellow
}
activityBar {
LineColor lightGreen
}
mindmapDiagram {
Padding 10
Margin 10
}
node {
}

View File

@ -1,6 +1,6 @@
style root { root {
FontName SansSerif FontName SansSerif
HyperLinkColor red HyperLinkColor blue
FontColor black FontColor black
FontSize 14 FontSize 14
FontStyle plain FontStyle plain
@ -13,11 +13,11 @@ style root {
Shadowing 0.0 Shadowing 0.0
} }
style stereotype { stereotype {
FontStyle italic FontStyle italic
} }
style title { title {
HorizontalAlignment center HorizontalAlignment center
FontSize 14 FontSize 14
FontStyle bold FontStyle bold
@ -27,19 +27,23 @@ style title {
BackGroundColor none BackGroundColor none
} }
style header { header {
HorizontalAlignment right
FontSize 10
FontColor #888888
BackGroundColor none
LineColor none
}
footer {
HorizontalAlignment center HorizontalAlignment center
FontSize 10 FontSize 10
FontColor #888888 FontColor #888888
BackGroundColor none
LineColor none
} }
style footer { legend {
HorizontalAlignment left
FontSize 10
FontColor #888888
}
style legend {
LineColor black LineColor black
BackGroundColor #DDDDDD BackGroundColor #DDDDDD
FontSize 14 FontSize 14
@ -48,7 +52,7 @@ style legend {
Margin 8 Margin 8
} }
style caption { caption {
HorizontalAlignment center HorizontalAlignment center
FontSize 14 FontSize 14
Padding 0 Padding 0
@ -58,21 +62,19 @@ style caption {
} }
style element { element {
Shadowing 4.0 Shadowing 4.0
} }
style sequenceDiagram { sequenceDiagram {
} }
style classDiagram { classDiagram {
} }
style activityDiagram {
}
style group { group {
BackGroundColor none BackGroundColor white
LineColor black LineColor black
LineThickness 2.0 LineThickness 2.0
FontSize 11 FontSize 11
@ -80,7 +82,7 @@ style group {
FontStyle bold FontStyle bold
} }
style groupHeader { groupHeader {
BackGroundColor #EEEEEE BackGroundColor #EEEEEE
LineColor black LineColor black
@ -88,30 +90,38 @@ style groupHeader {
FontStyle bold FontStyle bold
} }
style lifeLine { lifeLine {
BackGroundColor none BackGroundColor white
} }
style destroy { destroy {
} }
style reference { reference {
LineColor red FontSize 12
FontSize 10 LineColor black
BackGroundColor while
LineThickness 2.0
HorizontalAlignment center
}
referenceHeader {
LineColor black
BackGroundColor #EEEEEE
FontColor black
FontSize 13
FontStyle bold FontStyle bold
FontColor blue LineThickness 2.0
BackGroundColor gold
HorizontalAlignment right
} }
style box { box {
BackGroundColor #DDDDDD BackGroundColor #DDDDDD
FontSize 13 FontSize 13
FontStyle bold FontStyle bold
} }
style separator { separator {
LineColor black LineColor black
LineThickness 2.0 LineThickness 2.0
BackGroundColor #EEEEEE BackGroundColor #EEEEEE
@ -120,45 +130,116 @@ style separator {
FontStyle bold FontStyle bold
} }
style delay { delay {
FontSize 22 FontSize 11
FontStyle italic FontStyle plain
HorizontalAlignment center
} }
style participant { participant {
LineThickness 1.5 LineThickness 1.5
} }
style actor { actor {
LineThickness 2.0 LineThickness 2.0
} }
style boundary { boundary {
} }
style control { control {
} }
style entity { entity {
} }
style queue { queue {
} }
style database { database {
} }
style collections { collections {
} }
style swimlane { swimlane {
BackGroundColor none
LineColor black
LineThickness 2
FontSize 18
} }
style message { diamond {
Shadowing 3.0
}
arrow {
FontSize 13 FontSize 13
} }
style note { note {
FontSize 13 FontSize 13
BackGroundColor #FBFB77 BackGroundColor #FBFB77
} }
partition {
}
circle {
}
mindmapDiagram {
}
mindmapDiagram {
node {
Padding 10
Margin 10
RoundCorner 25
LineThickness 1.5
}
arrow {
LineThickness 1.0
}
}
wbsDiagram {
Padding 10
Margin 15
RoundCorner 0
LineThickness 1.5
FontSize 12
}
activityDiagram {
Shadowing 3.0
}
activityDiagram {
activity {
LineThickness 1.5
Padding 10
FontSize 12
RoundCorner 25
}
partition {
LineColor black
BackgroundColor none
}
diamond {
FontSize 11
}
arrow {
FontSize 11
}
}
activityBar {
LineColor black
}
circle {
LineColor black
Shadowing 3.0
}

View File

@ -54,7 +54,7 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleDefinition; import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.svek.DecorateEntityImage; import net.sourceforge.plantuml.svek.DecorateEntityImage;
import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.svek.TextBlockBackcolored;
import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.MinMax;
@ -82,6 +82,10 @@ public class AnnotatedWorker {
return (TextBlockBackcolored) result; return (TextBlockBackcolored) result;
} }
public boolean hasMainFrame() {
return annotated.getMainFrame() != null;
}
public TextBlock addFrame(final TextBlock original) { public TextBlock addFrame(final TextBlock original) {
final Display mainFrame = annotated.getMainFrame(); final Display mainFrame = annotated.getMainFrame();
if (mainFrame == null) { if (mainFrame == null) {
@ -94,33 +98,37 @@ public class AnnotatedWorker {
final double y2 = 10; final double y2 = 10;
final SymbolContext symbolContext = new SymbolContext(getSkinParam().getBackgroundColor(), HtmlColorUtils.BLACK) final SymbolContext symbolContext = new SymbolContext(getSkinParam().getBackgroundColor(), HtmlColorUtils.BLACK)
.withShadow(getSkinParam().shadowing(null)); .withShadow(getSkinParam().shadowing(null) ? 3 : 0);
final MinMax originalMinMax = TextBlockUtils.getMinMax(original, stringBounder);
final TextBlock title = mainFrame.create(new FontConfiguration(getSkinParam(), FontParam.CAPTION, null), final TextBlock title = mainFrame.create(new FontConfiguration(getSkinParam(), FontParam.CAPTION, null),
HorizontalAlignment.CENTER, getSkinParam()); HorizontalAlignment.CENTER, getSkinParam());
final Dimension2D dimTitle = title.calculateDimension(stringBounder); final Dimension2D dimTitle = title.calculateDimension(stringBounder);
final Dimension2D dimOriginal = original.calculateDimension(stringBounder); // final Dimension2D dimOriginal = original.calculateDimension(stringBounder);
final double width = x1 + Math.max(dimOriginal.getWidth(), dimTitle.getWidth()) + x2; final double width = x1 + Math.max(originalMinMax.getWidth(), dimTitle.getWidth()) + x2;
final double height = dimTitle.getHeight() + y1 + dimOriginal.getHeight() + y2; final double height = dimTitle.getHeight() + y1 + originalMinMax.getHeight() + y2;
final TextBlock result = USymbol.FRAME.asBig(title, HorizontalAlignment.LEFT, TextBlockUtils.empty(0, 0), final TextBlock frame = USymbol.FRAME.asBig(title, HorizontalAlignment.LEFT, TextBlockUtils.empty(0, 0), width,
width, height, symbolContext, skinParam.getStereotypeAlignment()); height, symbolContext, skinParam.getStereotypeAlignment());
return new TextBlockBackcolored() { return new TextBlockBackcolored() {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
result.drawU(ug); frame.drawU(ug.apply(new UTranslate(originalMinMax.getMinX(), 0)));
original.drawU(ug.apply(new UTranslate(x1, y1 + dimTitle.getHeight()))); original.drawU(ug.apply(new UTranslate(x1, y1 + dimTitle.getHeight())));
// original.drawU(ug);
} }
public MinMax getMinMax(StringBounder stringBounder) { public MinMax getMinMax(StringBounder stringBounder) {
return TextBlockUtils.getMinMax(result, stringBounder); return TextBlockUtils.getMinMax(this, stringBounder);
} }
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) { public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
return result.getInnerPosition(member, stringBounder, strategy); final Rectangle2D rect = original.getInnerPosition(member, stringBounder, strategy);
return new Rectangle2D.Double(rect.getX() + x1, rect.getY() + y1 + dimTitle.getHeight(),
rect.getWidth(), rect.getHeight());
} }
public Dimension2D calculateDimension(StringBounder stringBounder) { public Dimension2D calculateDimension(StringBounder stringBounder) {
return result.calculateDimension(stringBounder); return original.calculateDimension(stringBounder);
} }
public HtmlColor getBackcolor() { public HtmlColor getBackcolor() {
@ -158,7 +166,7 @@ public class AnnotatedWorker {
return TextBlockUtils.empty(0, 0); return TextBlockUtils.empty(0, 0);
} }
if (SkinParam.USE_STYLES()) { if (SkinParam.USE_STYLES()) {
final Style style = StyleDefinition.of(SName.root, SName.caption).getMergedStyle( final Style style = StyleSignature.of(SName.root, SName.caption).getMergedStyle(
skinParam.getCurrentStyleBuilder()); skinParam.getCurrentStyleBuilder());
return style.createTextBlockBordered(caption.getDisplay(), skinParam.getIHtmlColorSet(), skinParam); return style.createTextBlockBordered(caption.getDisplay(), skinParam.getIHtmlColorSet(), skinParam);
} }
@ -171,13 +179,18 @@ public class AnnotatedWorker {
if (title.isNull()) { if (title.isNull()) {
return original; return original;
} }
ISkinParam skinParam = getSkinParam();
// if (SkinParam.USE_STYLES()) {
// throw new UnsupportedOperationException();
// }
final FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.TITLE, null);
final TextBlock block = TextBlockUtils.title(fontConfiguration, title.getDisplay(), skinParam); final TextBlock block;
if (SkinParam.USE_STYLES()) {
final Style style = StyleSignature.of(SName.root, SName.title).getMergedStyle(
skinParam.getCurrentStyleBuilder());
block = style.createTextBlockBordered(title.getDisplay(), skinParam.getIHtmlColorSet(), skinParam);
} else {
final ISkinParam skinParam = getSkinParam();
final FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.TITLE, null);
block = TextBlockUtils.title(fontConfiguration, title.getDisplay(), skinParam);
}
return DecorateEntityImage.addTop(original, block, HorizontalAlignment.CENTER); return DecorateEntityImage.addTop(original, block, HorizontalAlignment.CENTER);
} }

View File

@ -113,7 +113,7 @@ public class BlockUml {
final TimLoader timLoader = new TimLoader(mode.getImportedFiles(), defines, mode.getCharset(), final TimLoader timLoader = new TimLoader(mode.getImportedFiles(), defines, mode.getCharset(),
(DefinitionsContainer) mode); (DefinitionsContainer) mode);
timLoader.load(strings); timLoader.load(strings);
this.data = timLoader.getResult(); this.data = timLoader.getResultList();
this.debug = timLoader.getDebug(); this.debug = timLoader.getDebug();
this.preprocessorError = timLoader.isPreprocessorError(); this.preprocessorError = timLoader.isPreprocessorError();
} else { } else {

View File

@ -39,7 +39,7 @@ import java.awt.Font;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.StyleDefinition; import net.sourceforge.plantuml.style.StyleSignature;
interface FontParamConstant { interface FontParamConstant {
String FAMILY = "SansSerif"; String FAMILY = "SansSerif";
@ -181,15 +181,15 @@ public enum FontParam {
return new FontConfiguration(skinParam, this, null); return new FontConfiguration(skinParam, this, null);
} }
public StyleDefinition getStyleDefinition() { public StyleSignature getStyleDefinition() {
if (this == FOOTER) { if (this == FOOTER) {
return StyleDefinition.of(SName.root, SName.footer); return StyleSignature.of(SName.root, SName.footer);
} }
if (this == HEADER) { if (this == HEADER) {
return StyleDefinition.of(SName.root, SName.header); return StyleSignature.of(SName.root, SName.header);
} }
if (this == TITLE) { if (this == TITLE) {
return StyleDefinition.of(SName.root, SName.title); return StyleSignature.of(SName.root, SName.title);
} }
System.err.println("Warning " + this); System.err.println("Warning " + this);
return null; return null;

View File

@ -35,6 +35,8 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import java.util.Collection;
import net.sourceforge.plantuml.cucadiagram.Rankdir; import net.sourceforge.plantuml.cucadiagram.Rankdir;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines; import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
@ -177,4 +179,11 @@ public interface ISkinParam extends ISkinSimple {
public void muteStyle(Style modifiedStyle); public void muteStyle(Style modifiedStyle);
public Collection<String> getAllSpriteNames();
public String getDefaultSkin();
public void setDefaultSkin(String newSkin);
} }

View File

@ -38,9 +38,6 @@ package net.sourceforge.plantuml;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import net.sourceforge.plantuml.acearth.PSystemXearthFactory; import net.sourceforge.plantuml.acearth.PSystemXearthFactory;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory; import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory;
@ -48,7 +45,6 @@ import net.sourceforge.plantuml.activitydiagram3.ActivityDiagramFactory3;
import net.sourceforge.plantuml.api.PSystemFactory; import net.sourceforge.plantuml.api.PSystemFactory;
import net.sourceforge.plantuml.bpm.BpmDiagramFactory; import net.sourceforge.plantuml.bpm.BpmDiagramFactory;
import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory; import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory;
import net.sourceforge.plantuml.command.UmlDiagramFactory;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.compositediagram.CompositeDiagramFactory; import net.sourceforge.plantuml.compositediagram.CompositeDiagramFactory;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
@ -83,11 +79,12 @@ import net.sourceforge.plantuml.oregon.PSystemOregonFactory;
import net.sourceforge.plantuml.project3.GanttDiagramFactory; import net.sourceforge.plantuml.project3.GanttDiagramFactory;
import net.sourceforge.plantuml.salt.PSystemSaltFactory; import net.sourceforge.plantuml.salt.PSystemSaltFactory;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory; import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory;
import net.sourceforge.plantuml.sprite.ListSpriteDiagramFactory;
import net.sourceforge.plantuml.sprite.PSystemListInternalSpritesFactory;
import net.sourceforge.plantuml.statediagram.StateDiagramFactory; import net.sourceforge.plantuml.statediagram.StateDiagramFactory;
import net.sourceforge.plantuml.stats.StatsUtilsIncrement; import net.sourceforge.plantuml.stats.StatsUtilsIncrement;
import net.sourceforge.plantuml.sudoku.PSystemSudokuFactory; import net.sourceforge.plantuml.sudoku.PSystemSudokuFactory;
import net.sourceforge.plantuml.timingdiagram.TimingDiagramFactory; import net.sourceforge.plantuml.timingdiagram.TimingDiagramFactory;
import net.sourceforge.plantuml.ugraphic.sprite.PSystemListInternalSpritesFactory;
import net.sourceforge.plantuml.version.License; import net.sourceforge.plantuml.version.License;
import net.sourceforge.plantuml.version.PSystemLicenseFactory; import net.sourceforge.plantuml.version.PSystemLicenseFactory;
import net.sourceforge.plantuml.version.PSystemVersionFactory; import net.sourceforge.plantuml.version.PSystemVersionFactory;
@ -148,6 +145,7 @@ public class PSystemBuilder {
final List<PSystemFactory> factories = new ArrayList<PSystemFactory>(); final List<PSystemFactory> factories = new ArrayList<PSystemFactory>();
factories.add(new PSystemWelcomeFactory()); factories.add(new PSystemWelcomeFactory());
factories.add(new PSystemColorsFactory()); factories.add(new PSystemColorsFactory());
factories.add(new ListSpriteDiagramFactory(skinParam));
factories.add(new SequenceDiagramFactory(skinParam)); factories.add(new SequenceDiagramFactory(skinParam));
factories.add(new ClassDiagramFactory(skinParam)); factories.add(new ClassDiagramFactory(skinParam));
factories.add(new ActivityDiagramFactory(skinParam)); factories.add(new ActivityDiagramFactory(skinParam));

View File

@ -66,12 +66,12 @@ import net.sourceforge.plantuml.objectdiagram.ObjectDiagramFactory;
import net.sourceforge.plantuml.png.MetadataTag; import net.sourceforge.plantuml.png.MetadataTag;
import net.sourceforge.plantuml.preproc.Stdlib; import net.sourceforge.plantuml.preproc.Stdlib;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory; import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory;
import net.sourceforge.plantuml.sprite.SpriteGrayLevel;
import net.sourceforge.plantuml.sprite.SpriteUtils;
import net.sourceforge.plantuml.statediagram.StateDiagramFactory; import net.sourceforge.plantuml.statediagram.StateDiagramFactory;
import net.sourceforge.plantuml.stats.StatsUtils; import net.sourceforge.plantuml.stats.StatsUtils;
import net.sourceforge.plantuml.swing.MainWindow2; import net.sourceforge.plantuml.swing.MainWindow2;
import net.sourceforge.plantuml.syntax.LanguageDescriptor; import net.sourceforge.plantuml.syntax.LanguageDescriptor;
import net.sourceforge.plantuml.ugraphic.sprite.SpriteGrayLevel;
import net.sourceforge.plantuml.ugraphic.sprite.SpriteUtils;
import net.sourceforge.plantuml.utils.Cypher; import net.sourceforge.plantuml.utils.Cypher;
import net.sourceforge.plantuml.version.Version; import net.sourceforge.plantuml.version.Version;
@ -479,10 +479,18 @@ public class Run {
} }
final ISourceFileReader sourceFileReader; final ISourceFileReader sourceFileReader;
if (option.getOutputFile() == null) { if (option.getOutputFile() == null) {
sourceFileReader = new SourceFileReader(option.getDefaultDefines(f), f, option.getOutputDir(), File outputDir = option.getOutputDir();
option.getConfig(), option.getCharset(), option.getFileFormatOption()); if (outputDir != null && outputDir.getPath().endsWith("$")) {
final String path = outputDir.getPath();
outputDir = new File(path.substring(0, path.length() - 1)).getAbsoluteFile();
sourceFileReader = new SourceFileReaderCopyCat(option.getDefaultDefines(f), f, outputDir,
option.getConfig(), option.getCharset(), option.getFileFormatOption());
} else {
sourceFileReader = new SourceFileReader(option.getDefaultDefines(f), f, outputDir, option.getConfig(),
option.getCharset(), option.getFileFormatOption());
}
} else { } else {
sourceFileReader = new SourceFileReader2(option.getDefaultDefines(f), f, option.getOutputFile(), sourceFileReader = new SourceFileReaderHardFile(option.getDefaultDefines(f), f, option.getOutputFile(),
option.getConfig(), option.getCharset(), option.getFileFormatOption()); option.getConfig(), option.getCharset(), option.getFileFormatOption());
} }
sourceFileReader.setCheckMetadata(option.isCheckMetadata()); sourceFileReader.setCheckMetadata(option.isCheckMetadata());

View File

@ -64,6 +64,8 @@ import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ArrowDirection; import net.sourceforge.plantuml.skin.ArrowDirection;
import net.sourceforge.plantuml.skin.Padder; import net.sourceforge.plantuml.skin.Padder;
import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.sprite.SpriteImage;
import net.sourceforge.plantuml.style.FromSkinparamToStyle; import net.sourceforge.plantuml.style.FromSkinparamToStyle;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleBuilder;
@ -78,24 +80,77 @@ import net.sourceforge.plantuml.ugraphic.ColorMapperReverse;
import net.sourceforge.plantuml.ugraphic.ColorOrder; import net.sourceforge.plantuml.ugraphic.ColorOrder;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
import net.sourceforge.plantuml.ugraphic.sprite.SpriteImage;
public class SkinParam implements ISkinParam { public class SkinParam implements ISkinParam {
public static final String DEFAULT_STYLE = "plantuml.skin"; // private String skin = "debug.skin";
// public static final String DEFAULT_STYLE = "debug.skin"; private String skin = "plantuml.skin";
static public boolean USE_STYLES() {
return USE_STYLE2.get();
}
private static ThreadLocal<Boolean> USE_STYLE2 = new ThreadLocal<Boolean>();
private SkinParam(UmlDiagramType type) { private SkinParam(UmlDiagramType type) {
USE_STYLE2.set(false); USE_STYLE2.set(false);
this.type = type; this.type = type;
if (type == UmlDiagramType.MINDMAP) {
USE_STYLE2.set(true);
}
if (type == UmlDiagramType.WBS) {
USE_STYLE2.set(true);
}
// if (type == UmlDiagramType.SEQUENCE) {
// skin = "debug.skin";
// USE_STYLE2.set(true);
// }
// if (type == UmlDiagramType.ACTIVITY) {
// skin = "debug.skin";
// USE_STYLE2.set(true);
// }
}
private StyleBuilder styleBuilder;
public StyleBuilder getCurrentStyleBuilder() {
if (styleBuilder == null && SkinParam.USE_STYLES()) {
try {
this.styleBuilder = getCurrentStyleBuilderInternal();
} catch (IOException e) {
e.printStackTrace();
}
}
return styleBuilder;
}
public void muteStyle(Style modifiedStyle) {
if (SkinParam.USE_STYLES()) {
styleBuilder = getCurrentStyleBuilder().muteStyle(modifiedStyle);
}
}
public String getDefaultSkin() {
return skin;
}
public void setDefaultSkin(String newSkin) {
this.skin = newSkin;
}
public StyleBuilder getCurrentStyleBuilderInternal() throws IOException {
final StyleLoader tmp = new StyleLoader(this);
StyleBuilder result = tmp.loadSkin(this.getDefaultSkin());
if (result == null) {
result = tmp.loadSkin("plantuml.skin");
}
return result;
}
private static ThreadLocal<Boolean> USE_STYLE2 = new ThreadLocal<Boolean>();
static public boolean USE_STYLES() {
final Boolean result = USE_STYLE2.get();
if (result == null) {
return false;
}
return result;
} }
private static final String stereoPatternString = "\\<\\<(.*?)\\>\\>"; private static final String stereoPatternString = "\\<\\<(.*?)\\>\\>";
@ -696,6 +751,10 @@ public class SkinParam implements ISkinParam {
private final Map<String, Sprite> sprites = new HashMap<String, Sprite>(); private final Map<String, Sprite> sprites = new HashMap<String, Sprite>();
public Collection<String> getAllSpriteNames() {
return Collections.unmodifiableCollection(new TreeSet<String>(sprites.keySet()));
}
public void addSprite(String name, Sprite sprite) { public void addSprite(String name, Sprite sprite) {
sprites.put(name, sprite); sprites.put(name, sprite);
} }
@ -1123,22 +1182,4 @@ public class SkinParam implements ISkinParam {
.withBorderColor(border).withRoundCorner(roundCorner); .withBorderColor(border).withRoundCorner(roundCorner);
} }
private StyleBuilder styleBuilder;
public StyleBuilder getCurrentStyleBuilder() {
if (styleBuilder == null && SkinParam.USE_STYLES()) {
try {
this.styleBuilder = StyleLoader.mainStyle(this);
} catch (IOException e) {
e.printStackTrace();
}
}
return styleBuilder;
}
public void muteStyle(Style modifiedStyle) {
if (SkinParam.USE_STYLES()) {
styleBuilder = getCurrentStyleBuilder().muteStyle(modifiedStyle);
}
}
} }

View File

@ -42,6 +42,10 @@ import net.sourceforge.plantuml.graphic.color.Colors;
public class SkinParamColors extends SkinParamDelegator { public class SkinParamColors extends SkinParamDelegator {
public final Colors getColors() {
return colors;
}
final private Colors colors; final private Colors colors;
public SkinParamColors(ISkinParam skinParam, Colors colors) { public SkinParamColors(ISkinParam skinParam, Colors colors) {

View File

@ -35,6 +35,7 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import java.util.Collection;
import java.util.Map; import java.util.Map;
import net.sourceforge.plantuml.cucadiagram.Rankdir; import net.sourceforge.plantuml.cucadiagram.Rankdir;
@ -47,6 +48,7 @@ import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ArrowDirection; import net.sourceforge.plantuml.skin.ArrowDirection;
import net.sourceforge.plantuml.skin.Padder; import net.sourceforge.plantuml.skin.Padder;
import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.svek.ConditionEndStyle; import net.sourceforge.plantuml.svek.ConditionEndStyle;
@ -55,7 +57,6 @@ import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.ColorMapper;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
public class SkinParamDelegator implements ISkinParam { public class SkinParamDelegator implements ISkinParam {
@ -342,4 +343,16 @@ public class SkinParamDelegator implements ISkinParam {
skinParam.muteStyle(modifiedStyle); skinParam.muteStyle(modifiedStyle);
} }
public Collection<String> getAllSpriteNames() {
return skinParam.getAllSpriteNames();
}
public String getDefaultSkin() {
return skinParam.getDefaultSkin();
}
public void setDefaultSkin(String newFileName) {
skinParam.setDefaultSkin(newFileName);
}
} }

View File

@ -0,0 +1,84 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* 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
*
* 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;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.preproc.FileWithSuffix;
public class SourceFileReaderCopyCat extends SourceFileReaderAbstract implements ISourceFileReader {
public SourceFileReaderCopyCat(Defines defines, final File file, File outputDirectory, List<String> config,
String charset, FileFormatOption fileFormatOption) throws IOException {
this.file = file;
this.fileFormatOption = fileFormatOption;
if (file.exists() == false) {
throw new IllegalArgumentException();
}
final String path = file.getParentFile().getPath();
// System.err.println("SourceFileReaderCopyCat::path=" + path);
// System.err.println("SourceFileReaderCopyCat::outputDirectory=" + outputDirectory);
this.outputDirectory = new File(outputDirectory, path).getAbsoluteFile();
if (outputDirectory.exists() == false) {
outputDirectory.mkdirs();
}
// System.err.println("SourceFileReaderCopyCat=" + this.outputDirectory.getPath() + " "
// + this.outputDirectory.getAbsolutePath());
builder = new BlockUmlBuilder(config, charset, defines, getReader(charset), file.getAbsoluteFile()
.getParentFile(), FileWithSuffix.getFileName(file));
}
@Override
protected SuggestedFile getSuggestedFile(BlockUml blockUml) {
final String newName = blockUml.getFileOrDirname();
SuggestedFile suggested = null;
if (newName == null) {
suggested = SuggestedFile.fromOutputFile(new File(outputDirectory, file.getName()),
fileFormatOption.getFileFormat(), cpt++);
} else {
suggested = SuggestedFile.fromOutputFile(new File(outputDirectory, newName),
fileFormatOption.getFileFormat(), cpt++);
}
// System.err.println("SourceFileReaderCopyCat::suggested=" + suggested);
suggested.getParentFile().mkdirs();
return suggested;
}
}

View File

@ -42,9 +42,9 @@ import java.util.List;
import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.preproc.FileWithSuffix; import net.sourceforge.plantuml.preproc.FileWithSuffix;
public class SourceFileReader2 extends SourceFileReaderAbstract implements ISourceFileReader { public class SourceFileReaderHardFile extends SourceFileReaderAbstract implements ISourceFileReader {
public SourceFileReader2(Defines defines, final File file, File outputFile, List<String> config, String charset, public SourceFileReaderHardFile(Defines defines, final File file, File outputFile, List<String> config, String charset,
FileFormatOption fileFormatOption) throws IOException { FileFormatOption fileFormatOption) throws IOException {
this.file = file; this.file = file;
this.fileFormatOption = fileFormatOption; this.fileFormatOption = fileFormatOption;
@ -54,8 +54,9 @@ public class SourceFileReader2 extends SourceFileReaderAbstract implements ISour
} }
FileSystem.getInstance().setCurrentDir(file.getAbsoluteFile().getParentFile()); FileSystem.getInstance().setCurrentDir(file.getAbsoluteFile().getParentFile());
builder = new BlockUmlBuilder(config, charset, defines, getReader(charset), file.getAbsoluteFile() final File parentFile = file.getAbsoluteFile().getParentFile();
.getParentFile(), FileWithSuffix.getFileName(file)); builder = new BlockUmlBuilder(config, charset, defines, getReader(charset), parentFile,
FileWithSuffix.getFileName(file));
} }
@Override @Override

View File

@ -35,7 +35,7 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite; import net.sourceforge.plantuml.sprite.Sprite;
public interface SpriteContainer { public interface SpriteContainer {

View File

@ -40,10 +40,10 @@ import java.util.Map;
import net.sourceforge.plantuml.creole.CommandCreoleMonospaced; import net.sourceforge.plantuml.creole.CommandCreoleMonospaced;
import net.sourceforge.plantuml.graphic.HtmlColorSetSimple; import net.sourceforge.plantuml.graphic.HtmlColorSetSimple;
import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.sprite.SpriteImage;
import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.ColorMapper;
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
import net.sourceforge.plantuml.ugraphic.sprite.SpriteImage;
public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple { public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {

View File

@ -49,7 +49,7 @@ final public class StringLocated {
@Override @Override
public String toString() { public String toString() {
return super.toString() + " " + s; return s;
} }
public StringLocated(String s, LineLocation location, String preprocessorError) { public StringLocated(String s, LineLocation location, String preprocessorError) {

View File

@ -77,6 +77,7 @@ import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.mjpeg.MJPEGGenerator; import net.sourceforge.plantuml.mjpeg.MJPEGGenerator;
import net.sourceforge.plantuml.pdf.PdfConverter; import net.sourceforge.plantuml.pdf.PdfConverter;
import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.svek.EmptySvgException; import net.sourceforge.plantuml.svek.EmptySvgException;
import net.sourceforge.plantuml.svek.GraphvizCrash; import net.sourceforge.plantuml.svek.GraphvizCrash;
import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.svek.TextBlockBackcolored;
@ -85,7 +86,6 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UImage;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
import net.sourceforge.plantuml.version.Version; import net.sourceforge.plantuml.version.Version;
public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annotated, WithSprite { public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annotated, WithSprite {
@ -406,39 +406,40 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
return useJDot; return useJDot;
} }
public CommandExecutionResult loadSkin(String filename) throws IOException { public CommandExecutionResult loadSkin(String newSkin) throws IOException {
getSkinParam().setDefaultSkin(newSkin + ".skin");
final String res = "/skin/" + filename + ".skin";
final InputStream internalIs = UmlDiagram.class.getResourceAsStream(res);
if (internalIs != null) {
final BlocLines lines2 = BlocLines.load(internalIs, new LineLocationImpl(filename, null));
return loadSkinInternal(lines2);
}
if (OptionFlags.ALLOW_INCLUDE == false) {
return CommandExecutionResult.ok();
}
final File f = FileSystem.getInstance().getFile(filename + ".skin");
if (f == null || f.exists() == false || f.canRead() == false) {
return CommandExecutionResult.error("Cannot load skin from " + filename);
}
final BlocLines lines = BlocLines.load(f, new LineLocationImpl(f.getName(), null));
return loadSkinInternal(lines);
}
private CommandExecutionResult loadSkinInternal(final BlocLines lines) {
final CommandSkinParam cmd1 = new CommandSkinParam();
final CommandSkinParamMultilines cmd2 = new CommandSkinParamMultilines();
for (int i = 0; i < lines.size(); i++) {
final BlocLines ext1 = lines.subList(i, i + 1);
if (cmd1.isValid(ext1) == CommandControl.OK) {
cmd1.execute(this, ext1);
} else if (cmd2.isValid(ext1) == CommandControl.OK_PARTIAL) {
i = tryMultilines(cmd2, i, lines);
}
}
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
// final String res = "/skin/" + filename + ".skin";
// final InputStream internalIs = UmlDiagram.class.getResourceAsStream(res);
// if (internalIs != null) {
// final BlocLines lines2 = BlocLines.load(internalIs, new LineLocationImpl(filename, null));
// return loadSkinInternal(lines2);
// }
// if (OptionFlags.ALLOW_INCLUDE == false) {
// return CommandExecutionResult.ok();
// }
// final File f = FileSystem.getInstance().getFile(filename + ".skin");
// if (f == null || f.exists() == false || f.canRead() == false) {
// return CommandExecutionResult.error("Cannot load skin from " + filename);
// }
// final BlocLines lines = BlocLines.load(f, new LineLocationImpl(f.getName(), null));
// return loadSkinInternal(lines);
} }
// private CommandExecutionResult loadSkinInternal(final BlocLines lines) {
// final CommandSkinParam cmd1 = new CommandSkinParam();
// final CommandSkinParamMultilines cmd2 = new CommandSkinParamMultilines();
// for (int i = 0; i < lines.size(); i++) {
// final BlocLines ext1 = lines.subList(i, i + 1);
// if (cmd1.isValid(ext1) == CommandControl.OK) {
// cmd1.execute(this, ext1);
// } else if (cmd2.isValid(ext1) == CommandControl.OK_PARTIAL) {
// i = tryMultilines(cmd2, i, lines);
// }
// }
// return CommandExecutionResult.ok();
// }
private int tryMultilines(CommandSkinParamMultilines cmd2, int i, BlocLines lines) { private int tryMultilines(CommandSkinParamMultilines cmd2, int i, BlocLines lines) {
for (int j = i + 1; j <= lines.size(); j++) { for (int j = i + 1; j <= lines.size(); j++) {
final BlocLines ext1 = lines.subList(i, j); final BlocLines ext1 = lines.subList(i, j);
@ -451,9 +452,8 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
} }
return i; return i;
} }
public void setHideEmptyDescription(boolean hideEmptyDescription) { public void setHideEmptyDescription(boolean hideEmptyDescription) {
} }
} }

View File

@ -36,7 +36,7 @@
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite; import net.sourceforge.plantuml.sprite.Sprite;
public interface WithSprite extends Diagram { public interface WithSprite extends Diagram {

View File

@ -51,6 +51,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
@ -71,7 +72,9 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
color().getRegex(), // color().getRegex(), //
new RegexLeaf("LEGACYCOLORIGNORED", "(#[0-9a-fA-F]{6}|#?\\w+)?")), // new RegexLeaf("LEGACYCOLORIGNORED", "(#[0-9a-fA-F]{6}|#?\\w+)?")), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("\\{?"), new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("\\{?"), //
RegexLeaf.end()); RegexLeaf.end());
} }
@ -91,12 +94,10 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
if (colors.isEmpty() == false) { if (colors.isEmpty() == false) {
p.setColors(colors); p.setColors(colors);
} }
if (arg.get("STEREOTYPE", 0) != null) {
p.setStereotype(new Stereotype(arg.get("STEREOTYPE", 0)));
}
// final String color = arg.get("COLOR", 0);
// if (color != null) {
// p.setSpecificColorTOBEREMOVED(ColorType.BACK,
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
// }
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.activitydiagram3;
import java.util.Collection; import java.util.Collection;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
@ -48,6 +49,11 @@ import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType; import net.sourceforge.plantuml.sequencediagram.NoteType;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleSignature;
public class Branch { public class Branch {
@ -60,11 +66,20 @@ public class Branch {
private Ftile ftile; private Ftile ftile;
public StyleSignature getDefaultStyleDefinitionArrow() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
}
public StyleSignature getDefaultStyleDefinitionDiamond() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
}
public boolean containsBreak() { public boolean containsBreak() {
return list.containsBreak(); return list.containsBreak();
} }
public Branch(Swimlane swimlane, Display labelPositive, Display labelTest, HtmlColor color, Display inlabel) { public Branch(StyleBuilder styleBuilder, Swimlane swimlane, Display labelPositive, Display labelTest,
HtmlColor color, Display inlabel) {
if (labelPositive == null) { if (labelPositive == null) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
@ -74,11 +89,18 @@ public class Branch {
if (inlabel == null) { if (inlabel == null) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
if (SkinParam.USE_STYLES()) {
final Style style = getDefaultStyleDefinitionDiamond().getMergedStyle(styleBuilder);
this.color = color == null ? style.value(PName.BackGroundColor).asColor(
styleBuilder.getSkinParam().getIHtmlColorSet()) : color;
} else {
this.color = color;
}
this.inlabel = inlabel; this.inlabel = inlabel;
this.list = new InstructionList(swimlane); this.list = new InstructionList(swimlane);
this.labelTest = labelTest; this.labelTest = labelTest;
this.labelPositive = labelPositive; this.labelPositive = labelPositive;
this.color = color;
} }
public Collection<WeldingPoint> getWeldingPoints() { public Collection<WeldingPoint> getWeldingPoints() {
@ -166,5 +188,4 @@ public class Branch {
return special; return special;
} }
} }

View File

@ -91,7 +91,7 @@ public class InstructionFork extends WithNote implements Instruction {
for (InstructionList list : forks) { for (InstructionList list : forks) {
all.add(list.createFtile(factory)); all.add(list.createFtile(factory));
} }
Ftile result = factory.createParallel(getSwimlaneIn(), all, style, label); Ftile result = factory.createParallel(all, style, label);
if (getPositionedNotes().size() > 0) { if (getPositionedNotes().size() > 0) {
result = FtileWithNoteOpale.create(result, getPositionedNotes(), skinParam, false); result = FtileWithNoteOpale.create(result, getPositionedNotes(), skinParam, false);
} }

View File

@ -93,7 +93,8 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
this.swimlane = swimlane; this.swimlane = swimlane;
this.thens.add(new Branch(swimlane, whenThen, labelTest, color, Display.NULL)); this.thens.add(new Branch(skinParam.getCurrentStyleBuilder(), swimlane, whenThen, labelTest, color,
Display.NULL));
this.current = this.thens.get(0); this.current = this.thens.get(0);
} }
@ -106,7 +107,8 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
branch.updateFtile(factory); branch.updateFtile(factory);
} }
if (elseBranch == null) { if (elseBranch == null) {
this.elseBranch = new Branch(swimlane, Display.NULL, Display.NULL, null, Display.NULL); this.elseBranch = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, Display.NULL, Display.NULL,
null, Display.NULL);
} }
elseBranch.updateFtile(factory); elseBranch.updateFtile(factory);
Ftile result = factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering, url); Ftile result = factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering, url);
@ -133,7 +135,8 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
return false; return false;
} }
this.current.setInlinkRendering(nextLinkRenderer); this.current.setInlinkRendering(nextLinkRenderer);
this.elseBranch = new Branch(swimlane, whenElse, Display.NULL, null, Display.NULL); this.elseBranch = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, whenElse, Display.NULL, null,
Display.NULL);
this.current = elseBranch; this.current = elseBranch;
return true; return true;
} }
@ -145,7 +148,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
} }
// this.current.setInlinkRendering(nextLinkRenderer); // this.current.setInlinkRendering(nextLinkRenderer);
this.current.setSpecial(nextLinkRenderer); this.current.setSpecial(nextLinkRenderer);
this.current = new Branch(swimlane, whenThen, test, color, inlabel); this.current = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, whenThen, test, color, inlabel);
this.thens.add(current); this.thens.add(current);
return true; return true;
@ -154,7 +157,8 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
public void endif(LinkRendering nextLinkRenderer) { public void endif(LinkRendering nextLinkRenderer) {
endifCalled = true; endifCalled = true;
if (elseBranch == null) { if (elseBranch == null) {
this.elseBranch = new Branch(swimlane, Display.NULL, Display.NULL, null, Display.NULL); this.elseBranch = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, Display.NULL, Display.NULL,
null, Display.NULL);
} }
this.elseBranch.setSpecial(nextLinkRenderer); this.elseBranch.setSpecial(nextLinkRenderer);
this.current.setInlinkRendering(nextLinkRenderer); this.current.setInlinkRendering(nextLinkRenderer);

View File

@ -88,7 +88,7 @@ public class InstructionSplit implements Instruction {
for (InstructionList list : splits) { for (InstructionList list : splits) {
all.add(list.createFtile(factory)); all.add(list.createFtile(factory));
} }
return factory.createParallel(getSwimlaneIn(), all, ForkStyle.SPLIT, null); return factory.createParallel(all, ForkStyle.SPLIT, null);
} }
public Instruction getParent() { public Instruction getParent() {

View File

@ -137,7 +137,7 @@ public class InstructionSwitch extends WithNote implements Instruction, Instruct
} }
public boolean switchCase(Display labelCase, LinkRendering nextLinkRenderer) { public boolean switchCase(Display labelCase, LinkRendering nextLinkRenderer) {
this.current = new Branch(swimlane, labelCase, labelCase, null, labelCase); this.current = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, labelCase, labelCase, null, labelCase);
this.branches.add(this.current); this.branches.add(this.current);
return true; return true;
} }

View File

@ -35,6 +35,7 @@
*/ */
package net.sourceforge.plantuml.activitydiagram3.command; package net.sourceforge.plantuml.activitydiagram3.command;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder;
@ -48,6 +49,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
@ -65,6 +67,8 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
color().getRegex(), // color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), // RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf(":"), // new RegexLeaf(":"), //
new RegexLeaf("LABEL", "(.*)"), // new RegexLeaf("LABEL", "(.*)"), //
new RegexLeaf("STYLE", ENDING_GROUP), // new RegexLeaf("STYLE", ENDING_GROUP), //
@ -86,7 +90,12 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
url = urlBuilder.getUrl(arg.get("URL", 0)); url = urlBuilder.getUrl(arg.get("URL", 0));
} }
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final String stereo = arg.get("STEREO", 0);
if (stereo != null) {
final Stereotype stereotype = new Stereotype(stereo);
colors = colors.applyStereotype(stereotype, diagram.getSkinParam(), ColorParam.activityBackground);
}
final BoxStyle style = BoxStyle.fromChar(arg.get("STYLE", 0).charAt(0)); final BoxStyle style = BoxStyle.fromChar(arg.get("STYLE", 0).charAt(0));
diagram.addActivity(Display.getWithNewlines(arg.get("LABEL", 0)), style, url, colors); diagram.addActivity(Display.getWithNewlines(arg.get("LABEL", 0)), style, url, colors);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();

View File

@ -75,7 +75,7 @@ public class CommandArrowLong3 extends CommandMultilines2<ActivityDiagram3> {
lines = lines.removeEmptyColumns(); lines = lines.removeEmptyColumns();
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
// final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)); // final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
// diagram.setColorNextArrow(HtmlColorAndStyle.fromColor(color)); // diagram.setColorNextArrow(Rainbow.fromColor(color));
final String colorString = line0.get("COLOR", 0); final String colorString = line0.get("COLOR", 0);
if (colorString != null) { if (colorString != null) {
Rainbow rainbow = Rainbow.build(diagram.getSkinParam(), colorString, diagram.getSkinParam() Rainbow rainbow = Rainbow.build(diagram.getSkinParam(), colorString, diagram.getSkinParam()

View File

@ -44,7 +44,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow;
public class CommandLink3 extends SingleLineCommand2<ActivityDiagram3> { public class CommandLink3 extends SingleLineCommand2<ActivityDiagram3> {
@ -65,7 +65,7 @@ public class CommandLink3 extends SingleLineCommand2<ActivityDiagram3> {
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
if (color != null) { if (color != null) {
diagram.setColorNextArrow(HtmlColorAndStyle.fromColor(color)); diagram.setColorNextArrow(Rainbow.fromColor(color));
} }
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -37,6 +37,7 @@ package net.sourceforge.plantuml.activitydiagram3.command;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
@ -54,6 +55,10 @@ import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> { public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
@ -126,20 +131,33 @@ public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
final HtmlColor backColorInSkinparam = diagram.getSkinParam().getHtmlColor(getColorParamBack(symbol), final HtmlColor backColorInSkinparam = diagram.getSkinParam().getHtmlColor(getColorParamBack(symbol),
stereotype, false); stereotype, false);
final HtmlColor backColor; HtmlColor backColor;
if (backColorInSkinparam == null) { if (backColorInSkinparam == null) {
backColor = colors.getColor(ColorType.BACK); backColor = colors.getColor(ColorType.BACK);
} else { } else {
backColor = backColorInSkinparam; backColor = backColorInSkinparam;
} }
final HtmlColor titleColor = colors.getColor(ColorType.HEADER); HtmlColor titleColor = colors.getColor(ColorType.HEADER);
// Warning : titleColor unused in FTileGroupW // Warning : titleColor unused in FTileGroupW
HtmlColor borderColor = diagram.getSkinParam().getHtmlColor(getColorParamBorder(symbol), stereotype, false); HtmlColor borderColor = diagram.getSkinParam().getHtmlColor(getColorParamBorder(symbol), stereotype, false);
if (borderColor == null) { if (borderColor == null) {
borderColor = HtmlColorUtils.BLACK; borderColor = HtmlColorUtils.BLACK;
} }
final double roundCorner = symbol.getSkinParameter().getRoundCorner(diagram.getSkinParam(), stereotype); double roundCorner = symbol.getSkinParameter().getRoundCorner(diagram.getSkinParam(), stereotype);
if (SkinParam.USE_STYLES()) {
final Style stylePartition = getDefaultStyleDefinitionPartition().getMergedStyle(
diagram.getSkinParam().getCurrentStyleBuilder());
borderColor = stylePartition.value(PName.LineColor).asColor(diagram.getSkinParam().getIHtmlColorSet());
backColor = colors.getColor(ColorType.BACK);
if (backColor == null) {
backColor = stylePartition.value(PName.BackGroundColor).asColor(
diagram.getSkinParam().getIHtmlColorSet());
}
titleColor = HtmlColorUtils.BLUE;// stylePartition.value(PName.FontColor).asColor(diagram.getSkinParam().getIHtmlColorSet());
roundCorner = stylePartition.value(PName.RoundCorner).asDouble();
}
diagram.startGroup(Display.getWithNewlines(partitionTitle), backColor, titleColor, borderColor, symbol, diagram.startGroup(Display.getWithNewlines(partitionTitle), backColor, titleColor, borderColor, symbol,
roundCorner); roundCorner);
@ -147,4 +165,8 @@ public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }
final public StyleSignature getDefaultStyleDefinitionPartition() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.partition);
}
} }

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
@ -65,6 +66,10 @@ public abstract class AbstractFtile extends AbstractTextBlock implements Ftile {
return skinParam; return skinParam;
} }
final public IHtmlColorSet getIHtmlColorSet() {
return skinParam.getIHtmlColorSet();
}
public LinkRendering getInLinkRendering() { public LinkRendering getInLinkRendering() {
return LinkRendering.none(); return LinkRendering.none();
} }

View File

@ -49,13 +49,13 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
public enum BoxStyle { public enum BoxStyle {
PLAIN { PLAIN {
@Override @Override
protected Shadowable getShape(double width, double height) { protected Shadowable getShape(double width, double height, double roundCorner) {
return new URectangle(width, height, CORNER, CORNER); return new URectangle(width, height, roundCorner, roundCorner);
} }
}, },
SDL_INPUT('<') { SDL_INPUT('<') {
@Override @Override
protected Shadowable getShape(double width, double height) { protected Shadowable getShape(double width, double height, double roundCorner) {
final UPolygon result = new UPolygon(); final UPolygon result = new UPolygon();
result.addPoint(0, 0); result.addPoint(0, 0);
result.addPoint(width + DELTA_INPUT_OUTPUT, 0); result.addPoint(width + DELTA_INPUT_OUTPUT, 0);
@ -67,7 +67,7 @@ public enum BoxStyle {
}, },
SDL_OUTPUT('>') { SDL_OUTPUT('>') {
@Override @Override
protected Shadowable getShape(double width, double height) { protected Shadowable getShape(double width, double height, double roundCorner) {
final UPolygon result = new UPolygon(); final UPolygon result = new UPolygon();
result.addPoint(0.0, 0.0); result.addPoint(0.0, 0.0);
result.addPoint(width, 0.0); result.addPoint(width, 0.0);
@ -79,11 +79,9 @@ public enum BoxStyle {
}, },
SDL_PROCEDURE('|') { SDL_PROCEDURE('|') {
@Override @Override
protected void drawInternal(UGraphic ug, double width, double height, boolean shadowing) { protected void drawInternal(UGraphic ug, double width, double height, double shadowing, double roundCorner) {
final URectangle rect = new URectangle(width, height); final URectangle rect = new URectangle(width, height);
if (shadowing) { rect.setDeltaShadow(shadowing);
rect.setDeltaShadow(3);
}
ug.draw(rect); ug.draw(rect);
final ULine vline = new ULine(0, height); final ULine vline = new ULine(0, height);
ug.apply(new UTranslate(PADDING, 0)).draw(vline); ug.apply(new UTranslate(PADDING, 0)).draw(vline);
@ -92,7 +90,7 @@ public enum BoxStyle {
}, },
SDL_SAVE('\\') { SDL_SAVE('\\') {
@Override @Override
protected Shadowable getShape(double width, double height) { protected Shadowable getShape(double width, double height, double roundCorner) {
final UPolygon result = new UPolygon(); final UPolygon result = new UPolygon();
result.addPoint(0.0, 0.0); result.addPoint(0.0, 0.0);
result.addPoint(width - DELTA_INPUT_OUTPUT, 0.0); result.addPoint(width - DELTA_INPUT_OUTPUT, 0.0);
@ -103,7 +101,7 @@ public enum BoxStyle {
}, },
SDL_ANTISAVE('/') { SDL_ANTISAVE('/') {
@Override @Override
protected Shadowable getShape(double width, double height) { protected Shadowable getShape(double width, double height, double roundCorner) {
final UPolygon result = new UPolygon(); final UPolygon result = new UPolygon();
result.addPoint(DELTA_INPUT_OUTPUT, 0.0); result.addPoint(DELTA_INPUT_OUTPUT, 0.0);
result.addPoint(width, 0.0); result.addPoint(width, 0.0);
@ -114,7 +112,7 @@ public enum BoxStyle {
}, },
SDL_CONTINUOUS('}') { SDL_CONTINUOUS('}') {
@Override @Override
protected Shadowable getShape(double width, double height) { protected Shadowable getShape(double width, double height, double roundCorner) {
final UPath result = new UPath(); final UPath result = new UPath();
final double c1[] = { DELTA_CONTINUOUS, 0 }; final double c1[] = { DELTA_CONTINUOUS, 0 };
final double c2[] = { 0, height / 2 }; final double c2[] = { 0, height / 2 };
@ -136,12 +134,11 @@ public enum BoxStyle {
}, },
SDL_TASK(']') { SDL_TASK(']') {
@Override @Override
protected Shadowable getShape(double width, double height) { protected Shadowable getShape(double width, double height, double roundCorner) {
return new URectangle(width, height); return new URectangle(width, height);
} }
}; };
private static final int CORNER = 25;
private final char style; private final char style;
private static int DELTA_INPUT_OUTPUT = 10; private static int DELTA_INPUT_OUTPUT = 10;
private static double DELTA_CONTINUOUS = 5.0; private static double DELTA_CONTINUOUS = 5.0;
@ -164,23 +161,22 @@ public enum BoxStyle {
return PLAIN; return PLAIN;
} }
public final UDrawable getUDrawable(final double width, final double height, final boolean shadowing) { public final UDrawable getUDrawable(final double width, final double height, final double shadowing,
final double roundCorner) {
return new UDrawable() { return new UDrawable() {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
drawInternal(ug, width, height, shadowing); drawInternal(ug, width, height, shadowing, roundCorner);
} }
}; };
} }
protected Shadowable getShape(double width, double height) { protected Shadowable getShape(double width, double height, double roundCorner) {
return null; return null;
} }
protected void drawInternal(UGraphic ug, double width, double height, boolean shadowing) { protected void drawInternal(UGraphic ug, double width, double height, double shadowing, double roundCorner) {
final Shadowable s = getShape(width, height); final Shadowable s = getShape(width, height, roundCorner);
if (shadowing) { s.setDeltaShadow(shadowing);
s.setDeltaShadow(3);
}
ug.draw(s); ug.draw(s);
} }

View File

@ -46,7 +46,7 @@ public class Diamond {
final static public double diamondHalfSize = 12; final static public double diamondHalfSize = 12;
public static UPolygon asPolygon(boolean shadowing) { public static UPolygon asPolygon(double shadowing) {
final UPolygon diams = new UPolygon(); final UPolygon diams = new UPolygon();
diams.addPoint(diamondHalfSize, 0); diams.addPoint(diamondHalfSize, 0);
@ -55,14 +55,15 @@ public class Diamond {
diams.addPoint(0, diamondHalfSize); diams.addPoint(0, diamondHalfSize);
diams.addPoint(diamondHalfSize, 0); diams.addPoint(diamondHalfSize, 0);
if (shadowing) { // if (shadowing) {
diams.setDeltaShadow(3); // diams.setDeltaShadow(3);
} // }
diams.setDeltaShadow(shadowing);
return diams; return diams;
} }
public static UPolygon asPolygon(boolean shadowing, double width, double height) { public static UPolygon asPolygon(double shadowing, double width, double height) {
final UPolygon diams = new UPolygon(); final UPolygon diams = new UPolygon();
diams.addPoint(diamondHalfSize, 0); diams.addPoint(diamondHalfSize, 0);
@ -73,9 +74,10 @@ public class Diamond {
diams.addPoint(0, height / 2); diams.addPoint(0, height / 2);
diams.addPoint(diamondHalfSize, 0); diams.addPoint(diamondHalfSize, 0);
if (shadowing) { // if (shadowing) {
diams.setDeltaShadow(3); // diams.setDeltaShadow(3);
} // }
diams.setDeltaShadow(shadowing);
return diams; return diams;
} }

View File

@ -38,18 +38,14 @@ package net.sourceforge.plantuml.activitydiagram3.ftile;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
public class EntityImageLegend { public class EntityImageLegend {

View File

@ -90,7 +90,7 @@ public interface FtileFactory {
public Ftile createSwitch(Swimlane swimlane, List<Branch> branches, LinkRendering afterEndwhile, public Ftile createSwitch(Swimlane swimlane, List<Branch> branches, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering, Display labelTest); LinkRendering topInlinkRendering, Display labelTest);
public Ftile createParallel(Swimlane swimlane, List<Ftile> all, ForkStyle style, String label); public Ftile createParallel(List<Ftile> all, ForkStyle style, String label);
public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note, public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note,
HtmlColor borderColor, USymbol type, double roundCorner); HtmlColor borderColor, USymbol type, double roundCorner);

View File

@ -40,6 +40,7 @@ import java.util.List;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.Branch;
import net.sourceforge.plantuml.activitydiagram3.ForkStyle; import net.sourceforge.plantuml.activitydiagram3.ForkStyle;
@ -51,13 +52,15 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
public class FtileFactoryDelegator implements FtileFactory { public class FtileFactoryDelegator implements FtileFactory {
@ -65,16 +68,40 @@ public class FtileFactoryDelegator implements FtileFactory {
private final Rose rose = new Rose(); private final Rose rose = new Rose();
final public StyleSignature getDefaultStyleDefinitionActivity() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity);
}
final public StyleSignature getDefaultStyleDefinitionDiamond() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
}
final public StyleSignature getDefaultStyleDefinitionArrow() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
}
protected final Rainbow getInLinkRenderingColor(Ftile tile) { protected final Rainbow getInLinkRenderingColor(Ftile tile) {
Rainbow color; Rainbow color;
final LinkRendering linkRendering = tile.getInLinkRendering(); final LinkRendering linkRendering = tile.getInLinkRendering();
if (linkRendering == null) { if (linkRendering == null) {
color = HtmlColorAndStyle.build(skinParam()); if (SkinParam.USE_STYLES()) {
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(
skinParam().getCurrentStyleBuilder());
return Rainbow.build(style, skinParam().getIHtmlColorSet());
} else {
color = Rainbow.build(skinParam());
}
} else { } else {
color = linkRendering.getRainbow(); color = linkRendering.getRainbow();
} }
if (color.size() == 0) { if (color.size() == 0) {
color = HtmlColorAndStyle.build(skinParam()); if (SkinParam.USE_STYLES()) {
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(
skinParam().getCurrentStyleBuilder());
return Rainbow.build(style, skinParam().getIHtmlColorSet());
} else {
color = Rainbow.build(skinParam());
}
} }
return color; return color;
} }
@ -84,7 +111,13 @@ public class FtileFactoryDelegator implements FtileFactory {
if (Display.isNull(display)) { if (Display.isNull(display)) {
return null; return null;
} }
final FontConfiguration fontConfiguration = new FontConfiguration(skinParam(), FontParam.ARROW, null); final FontConfiguration fontConfiguration;
if (SkinParam.USE_STYLES()) {
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
fontConfiguration = style.getFontConfiguration(skinParam().getIHtmlColorSet());
} else {
fontConfiguration = new FontConfiguration(skinParam(), FontParam.ARROW, null);
}
return display.create(fontConfiguration, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE); return display.create(fontConfiguration, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE);
} }
@ -168,8 +201,8 @@ public class FtileFactoryDelegator implements FtileFactory {
return factory.createSwitch(swimlane, branches, afterEndwhile, topInlinkRendering, labelTest); return factory.createSwitch(swimlane, branches, afterEndwhile, topInlinkRendering, labelTest);
} }
public Ftile createParallel(Swimlane swimlane, List<Ftile> all, ForkStyle style, String label) { public Ftile createParallel(List<Ftile> all, ForkStyle style, String label) {
return factory.createParallel(swimlane, all, style, label); return factory.createParallel(all, style, label);
} }
public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note, public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note,

View File

@ -41,7 +41,6 @@ import java.util.List;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.Pragma; import net.sourceforge.plantuml.Pragma;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.Instruction; import net.sourceforge.plantuml.activitydiagram3.Instruction;
import net.sourceforge.plantuml.activitydiagram3.InstructionList; import net.sourceforge.plantuml.activitydiagram3.InstructionList;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
@ -66,7 +65,7 @@ import net.sourceforge.plantuml.graphic.UGraphicDelegator;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleDefinition; import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.style.Styleable; import net.sourceforge.plantuml.style.Styleable;
import net.sourceforge.plantuml.svek.UGraphicForSnake; import net.sourceforge.plantuml.svek.UGraphicForSnake;
import net.sourceforge.plantuml.ugraphic.LimitFinder; import net.sourceforge.plantuml.ugraphic.LimitFinder;
@ -95,8 +94,8 @@ public class SwimlanesA extends AbstractTextBlock implements TextBlock, Styleabl
private LinkRendering nextLinkRenderer = LinkRendering.none(); private LinkRendering nextLinkRenderer = LinkRendering.none();
private Style style; private Style style;
public StyleDefinition getDefaultStyleDefinition() { public StyleSignature getDefaultStyleDefinition() {
return StyleDefinition.of(SName.root, SName.element, SName.classDiagram, SName.swimlane); return StyleSignature.of(SName.root, SName.element, SName.classDiagram, SName.swimlane);
} }
public SwimlanesA(ISkinParam skinParam, Pragma pragma) { public SwimlanesA(ISkinParam skinParam, Pragma pragma) {

View File

@ -44,7 +44,6 @@ import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.PName;
@ -75,6 +74,7 @@ public class SwimlanesB extends SwimlanesA {
if (color != null) { if (color != null) {
final double titleHeight = getTitlesHeight(stringBounder); final double titleHeight = getTitlesHeight(stringBounder);
final URectangle back = new URectangle(getTitlesWidth(stringBounder), titleHeight); final URectangle back = new URectangle(getTitlesWidth(stringBounder), titleHeight);
back.setIgnoreForCompression(true);
ug.apply(new UChangeBackColor(color)).apply(new UChangeColor(color)).draw(back); ug.apply(new UChangeBackColor(color)).apply(new UChangeColor(color)).draw(back);
} }
for (Swimlane swimlane : swimlanes) { for (Swimlane swimlane : swimlanes) {
@ -95,14 +95,18 @@ public class SwimlanesB extends SwimlanesA {
} }
private TextBlock getTitle(Swimlane swimlane) { private TextBlock getTitle(Swimlane swimlane) {
final FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.SWIMLANE_TITLE, null); final HorizontalAlignment horizontalAlignment = HorizontalAlignment.LEFT;
FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.SWIMLANE_TITLE, null);
if (SkinParam.USE_STYLES()) {
fontConfiguration = getStyle().getFontConfiguration(skinParam.getIHtmlColorSet());
}
LineBreakStrategy wrap = getWrap(); LineBreakStrategy wrap = getWrap();
if (wrap.isAuto()) { if (wrap.isAuto()) {
wrap = new LineBreakStrategy("" + ((int) swimlane.getActualWidth())); wrap = new LineBreakStrategy("" + ((int) swimlane.getActualWidth()));
} }
return swimlane.getDisplay().create(fontConfiguration, HorizontalAlignment.LEFT, skinParam, wrap); return swimlane.getDisplay().create(fontConfiguration, horizontalAlignment, skinParam, wrap);
} }
private LineBreakStrategy getWrap() { private LineBreakStrategy getWrap() {

View File

@ -41,10 +41,12 @@ import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.Pragma; import net.sourceforge.plantuml.Pragma;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.ULine;
@ -82,7 +84,11 @@ public class SwimlanesC extends SwimlanesB {
if (color == null) { if (color == null) {
color = ColorParam.swimlaneBorder.getDefaultValue(); color = ColorParam.swimlaneBorder.getDefaultValue();
} }
final UStroke thickness = Rose.getStroke(skinParam, LineParam.swimlaneBorder, 2); UStroke thickness = Rose.getStroke(skinParam, LineParam.swimlaneBorder, 2);
if (SkinParam.USE_STYLES()) {
color = getStyle().value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
thickness = getStyle().getStroke();
}
ug.apply(thickness).apply(new UChangeColor(color)).draw(new ULine(0, height)); ug.apply(thickness).apply(new UChangeColor(color)).draw(new ULine(0, height));
} }

View File

@ -40,6 +40,7 @@ import java.util.List;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
@ -51,8 +52,11 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
public abstract class ParallelFtilesBuilder { public abstract class AbstractParallelFtilesBuilder {
protected final double barHeight = 6; protected final double barHeight = 6;
@ -64,16 +68,22 @@ public abstract class ParallelFtilesBuilder {
private final List<Ftile> list; private final List<Ftile> list;
private final Ftile middle; private final Ftile middle;
private final FtileGeometry middleDimension; private final FtileGeometry middleDimension;
private final Swimlane swimlane;
public ParallelFtilesBuilder(ISkinParam skinParam, StringBounder stringBounder, final List<Ftile> list, public StyleSignature getDefaultStyleDefinition() {
Ftile middle, Swimlane swimlane) { return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity);
}
final public StyleSignature getDefaultStyleDefinitionArrow() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
}
public AbstractParallelFtilesBuilder(ISkinParam skinParam, StringBounder stringBounder, final List<Ftile> list,
Ftile middle) {
this.skinParam = skinParam; this.skinParam = skinParam;
this.stringBounder = stringBounder; this.stringBounder = stringBounder;
this.list = list; this.list = list;
this.middle = middle; this.middle = middle;
this.middleDimension = middle.calculateDimension(getStringBounder()); this.middleDimension = middle.calculateDimension(getStringBounder());
this.swimlane = swimlane;
} }
public final Ftile build() { public final Ftile build() {
@ -102,7 +112,13 @@ public abstract class ParallelFtilesBuilder {
if (Display.isNull(display)) { if (Display.isNull(display)) {
return null; return null;
} }
final FontConfiguration fontConfiguration = new FontConfiguration(skinParam(), FontParam.ARROW, null); final FontConfiguration fontConfiguration;
if (SkinParam.USE_STYLES()) {
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
fontConfiguration = style.getFontConfiguration(skinParam().getIHtmlColorSet());
} else {
fontConfiguration = new FontConfiguration(skinParam(), FontParam.ARROW, null);
}
return display.create(fontConfiguration, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE); return display.create(fontConfiguration, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE);
} }
@ -124,8 +140,8 @@ public abstract class ParallelFtilesBuilder {
return middleDimension.getHeight(); return middleDimension.getHeight();
} }
protected final Swimlane swimlane() { protected final Swimlane swimlaneOutForStep2() {
return swimlane; return list.get(list.size() - 1).getSwimlaneOut();
} }
} }

View File

@ -76,7 +76,8 @@ public class FloatingNote extends AbstractTextBlock implements Stencil, TextBloc
skinParam, CreoleMode.FULL).createSheet(note); skinParam, CreoleMode.FULL).createSheet(note);
final SheetBlock2 sheetBlock2 = new SheetBlock2(new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()), this, final SheetBlock2 sheetBlock2 = new SheetBlock2(new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()), this,
new UStroke(1)); new UStroke(1));
this.opale = new Opale(borderColor, noteBackgroundColor, sheetBlock2, skinParam.shadowing(null), false); final double shadowing;shadowing = skinParam.shadowing(null)?4:0;
this.opale = new Opale(shadowing, borderColor, noteBackgroundColor, sheetBlock2, false);
// this.text = sheetBlock2; // this.text = sheetBlock2;

View File

@ -61,25 +61,25 @@ public class FtileFactoryDelegatorCreateParallel extends FtileFactoryDelegator {
} }
@Override @Override
public Ftile createParallel(Swimlane swimlane, List<Ftile> all, ForkStyle style, String label) { public Ftile createParallel(List<Ftile> all, ForkStyle style, String label) {
final Dimension2D dimSuper = super.createParallel(swimlane, all, style, label).calculateDimension(getStringBounder()); final Dimension2D dimSuper = super.createParallel(all, style, label).calculateDimension(getStringBounder());
final double height1 = dimSuper.getHeight() + 2 * spaceArroundBlackBar; final double height1 = dimSuper.getHeight() + 2 * spaceArroundBlackBar;
final List<Ftile> list = new ArrayList<Ftile>(); final List<Ftile> list = new ArrayList<Ftile>();
for (Ftile tmp : all) { for (Ftile tmp : all) {
list.add(new FtileHeightFixed(FtileUtils.addHorizontalMargin(tmp, xMargin), height1)); list.add(new FtileHeightFixed(FtileUtils.addHorizontalMargin(tmp, xMargin), height1));
} }
final Ftile inner = super.createParallel(swimlane, list, style, label); final Ftile inner = super.createParallel(list, style, label);
ParallelFtilesBuilder builder; AbstractParallelFtilesBuilder builder;
if (style == ForkStyle.SPLIT) { if (style == ForkStyle.SPLIT) {
builder = new ParallelBuilderSplit2(skinParam(), getStringBounder(), list, inner, swimlane); builder = new ParallelBuilderSplit(skinParam(), getStringBounder(), list, inner);
} else if (style == ForkStyle.MERGE) { } else if (style == ForkStyle.MERGE) {
builder = new ParallelBuilderMerge(skinParam(), getStringBounder(), list, inner, swimlane); builder = new ParallelBuilderMerge(skinParam(), getStringBounder(), list, inner);
} else if (style == ForkStyle.FORK) { } else if (style == ForkStyle.FORK) {
builder = new ParallelBuilderFork(skinParam(), getStringBounder(), list, inner, swimlane, label); builder = new ParallelBuilderFork(skinParam(), getStringBounder(), list, inner, label);
} else { } else {
throw new IllegalStateException(); throw new IllegalStateException();
} }

View File

@ -1,75 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* 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
*
* 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.activitydiagram3.ftile.vcompact;
import java.util.List;
import net.sourceforge.plantuml.activitydiagram3.ForkStyle;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
public class FtileFactoryDelegatorCreateParallel1 extends FtileFactoryDelegator {
public FtileFactoryDelegatorCreateParallel1(FtileFactory factory) {
super(factory);
}
private Ftile allOverlapped(Swimlane swimlane, List<Ftile> all, ForkStyle style, String label) {
return new FtileForkInnerOverlapped(all);
}
@Override
public Ftile createParallel(Swimlane swimlane, List<Ftile> list, ForkStyle style, String label) {
final Ftile inner = super.createParallel(swimlane, list, style, label);
ParallelFtilesBuilder builder;
if (style == ForkStyle.SPLIT) {
builder = new ParallelBuilderSplit(skinParam(), getStringBounder(), list, inner, swimlane);
} else if (style == ForkStyle.MERGE) {
builder = new ParallelBuilderMerge(skinParam(), getStringBounder(), list, inner, swimlane);
} else if (style == ForkStyle.FORK) {
builder = new ParallelBuilderFork(skinParam(), getStringBounder(), list, inner, swimlane, label);
} else {
throw new IllegalStateException();
}
return builder.build();
}
}

View File

@ -45,7 +45,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileHeightFixed; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileHeightFixed;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
public class FtileFactoryDelegatorCreateParallelAddingMargin extends FtileFactoryDelegator { public class FtileFactoryDelegatorCreateParallelAddingMargin extends FtileFactoryDelegator {
@ -57,17 +56,16 @@ public class FtileFactoryDelegatorCreateParallelAddingMargin extends FtileFactor
} }
@Override @Override
public Ftile createParallel(Swimlane swimlane, List<Ftile> all, ForkStyle style, String label) { public Ftile createParallel(List<Ftile> all, ForkStyle style, String label) {
final Dimension2D dimSuper = super.createParallel(swimlane, all, style, label).calculateDimension( final Dimension2D dimSuper = super.createParallel(all, style, label).calculateDimension(getStringBounder());
getStringBounder());
final double height1 = dimSuper.getHeight() + 2 * spaceArroundBlackBar; final double height1 = dimSuper.getHeight() + 2 * spaceArroundBlackBar;
final List<Ftile> list = new ArrayList<Ftile>(); final List<Ftile> list = new ArrayList<Ftile>();
for (Ftile tmp : all) { for (Ftile tmp : all) {
list.add(new FtileHeightFixed(FtileUtils.addHorizontalMargin(tmp, xMargin), height1)); list.add(new FtileHeightFixed(FtileUtils.addHorizontalMargin(tmp, xMargin), height1));
} }
return super.createParallel(swimlane, list, style, label); return super.createParallel(list, style, label);
} }
} }

View File

@ -40,6 +40,7 @@ import java.util.List;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.Pragma; import net.sourceforge.plantuml.Pragma;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.Branch;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
@ -50,8 +51,9 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.ConditionalBuilder; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.ConditionalBuilder;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.svek.ConditionEndStyle; import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.ConditionStyle;
@ -72,17 +74,33 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
final ConditionEndStyle conditionEndStyle = skinParam().getConditionEndStyle(); final ConditionEndStyle conditionEndStyle = skinParam().getConditionEndStyle();
final Branch branch0 = thens.get(0); final Branch branch0 = thens.get(0);
final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); final HtmlColor borderColor;
final HtmlColor backColor = branch0.getColor() == null ? getRose().getHtmlColor(skinParam(), final HtmlColor backColor;
ColorParam.activityDiamondBackground) : branch0.getColor(); final Rainbow arrowColor;
final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); final FontConfiguration fcTest;
final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND
: FontParam.ARROW; : FontParam.ARROW;
final FontConfiguration fcTest = new FontConfiguration(skinParam(), testParam, null) final FontConfiguration fcArrow;
.changeColor(fontColor(FontParam.ACTIVITY_DIAMOND)); if (SkinParam.USE_STYLES()) {
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(
skinParam().getCurrentStyleBuilder());
final Style styleDiamond = getDefaultStyleDefinitionDiamond().getMergedStyle(
skinParam().getCurrentStyleBuilder());
borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getIHtmlColorSet());
backColor = branch0.getColor() == null ? styleDiamond.value(PName.BackGroundColor).asColor(
skinParam().getIHtmlColorSet()) : branch0.getColor();
arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet());
fcTest = styleDiamond.getFontConfiguration(skinParam().getIHtmlColorSet());
fcArrow = styleArrow.getFontConfiguration(skinParam().getIHtmlColorSet());
} else {
borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
backColor = branch0.getColor() == null ? getRose().getHtmlColor(skinParam(),
ColorParam.activityDiamondBackground) : branch0.getColor();
arrowColor = Rainbow.build(skinParam());
fcTest = new FontConfiguration(skinParam(), testParam, null)
.changeColor(fontColor(FontParam.ACTIVITY_DIAMOND));
fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
}
if (thens.size() > 1) { if (thens.size() > 1) {
if (pragma.useVerticalIf()/* OptionFlags.USE_IF_VERTICAL */) if (pragma.useVerticalIf()/* OptionFlags.USE_IF_VERTICAL */)

View File

@ -40,6 +40,7 @@ import java.util.List;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
@ -57,9 +58,10 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -77,17 +79,33 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator {
final ConditionStyle conditionStyle = skinParam().getConditionStyle(); final ConditionStyle conditionStyle = skinParam().getConditionStyle();
final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); final HtmlColor borderColor;
final HtmlColor backColor = color == null ? getRose().getHtmlColor(skinParam(), final HtmlColor backColor;
ColorParam.activityDiamondBackground) : color; final Rainbow arrowColor;
final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); final FontConfiguration fcDiamond;
final FontConfiguration fcArrow;
if (SkinParam.USE_STYLES()) {
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(
skinParam().getCurrentStyleBuilder());
final Style styleDiamond = getDefaultStyleDefinitionDiamond().getMergedStyle(
skinParam().getCurrentStyleBuilder());
borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getIHtmlColorSet());
backColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getIHtmlColorSet());
arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet());
fcDiamond = styleDiamond.getFontConfiguration(skinParam().getIHtmlColorSet());
fcArrow = styleArrow.getFontConfiguration(skinParam().getIHtmlColorSet());
} else {
borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
backColor = color == null ? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground)
: color;
arrowColor = Rainbow.build(skinParam());
fcDiamond = new FontConfiguration(skinParam(), FontParam.ACTIVITY_DIAMOND, null);
fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
}
final LinkRendering endRepeatLinkRendering = repeat.getOutLinkRendering(); final LinkRendering endRepeatLinkRendering = repeat.getOutLinkRendering();
final Rainbow endRepeatLinkColor = endRepeatLinkRendering == null ? null : endRepeatLinkRendering.getRainbow(); final Rainbow endRepeatLinkColor = endRepeatLinkRendering == null ? null : endRepeatLinkRendering.getRainbow();
final FontConfiguration fcDiamond = new FontConfiguration(skinParam(), FontParam.ACTIVITY_DIAMOND, null);
final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
final Ftile backStart = Display.isNull(startLabel) ? null : this.activity(startLabel, swimlane, BoxStyle.PLAIN, final Ftile backStart = Display.isNull(startLabel) ? null : this.activity(startLabel, swimlane, BoxStyle.PLAIN,
Colors.empty()); Colors.empty());

View File

@ -49,14 +49,13 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchNude; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchNude;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithDiamonds; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithDiamonds;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithOneLink;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithManyLinks; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithManyLinks;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithOneLink;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
@ -101,7 +100,7 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
for (Branch branch : branches) { for (Branch branch : branches) {
ftiles.add(new FtileMinWidth(branch.getFtile(), 30)); ftiles.add(new FtileMinWidth(branch.getFtile(), 30));
} }
final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); final Rainbow arrowColor = Rainbow.build(skinParam());
if (ftiles.size() == 1) { if (ftiles.size() == 1) {
final FtileSwitchWithOneLink result = new FtileSwitchWithOneLink(ftiles, branches, swimlane, diamond1, final FtileSwitchWithOneLink result = new FtileSwitchWithOneLink(ftiles, branches, swimlane, diamond1,
diamond2, getStringBounder(), arrowColor); diamond2, getStringBounder(), arrowColor);

View File

@ -39,6 +39,7 @@ import java.util.List;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.Instruction; import net.sourceforge.plantuml.activitydiagram3.Instruction;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
@ -56,8 +57,9 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -71,22 +73,38 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
@Override @Override
public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out, public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out,
LinkRendering afterEndwhile, HtmlColor color, Instruction specialOut) { LinkRendering afterEndwhile, HtmlColor color, Instruction specialOut) {
final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
final HtmlColor backColor = color == null ? getRose().getHtmlColor(skinParam(),
ColorParam.activityDiamondBackground) : color;
final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam());
final HtmlColor borderColor;
final HtmlColor backColor;
final Rainbow arrowColor;
final FontConfiguration fontArrow;
final FontConfiguration fcTest;
final ConditionStyle conditionStyle = skinParam().getConditionStyle(); final ConditionStyle conditionStyle = skinParam().getConditionStyle();
final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND
: FontParam.ARROW; : FontParam.ARROW;
final FontConfiguration fcTest = new FontConfiguration(skinParam(), testParam, null); if (SkinParam.USE_STYLES()) {
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(
skinParam().getCurrentStyleBuilder());
final Style styleDiamond = getDefaultStyleDefinitionDiamond().getMergedStyle(
skinParam().getCurrentStyleBuilder());
borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getIHtmlColorSet());
backColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getIHtmlColorSet());
arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet());
fontArrow = styleArrow.getFontConfiguration(skinParam().getIHtmlColorSet());
fcTest = styleDiamond.getFontConfiguration(skinParam().getIHtmlColorSet());
} else {
borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
backColor = color == null ? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground)
: color;
arrowColor = Rainbow.build(skinParam());
fontArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
fcTest = new FontConfiguration(skinParam(), testParam, null);
}
final LinkRendering endInlinkRendering = whileBlock.getOutLinkRendering(); final LinkRendering endInlinkRendering = whileBlock.getOutLinkRendering();
final Rainbow endInlinkColor = endInlinkRendering == null || endInlinkRendering.getRainbow().size() == 0 ? arrowColor final Rainbow endInlinkColor = endInlinkRendering == null || endInlinkRendering.getRainbow().size() == 0 ? arrowColor
: endInlinkRendering.getRainbow(); : endInlinkRendering.getRainbow();
final FontConfiguration fontArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null);
Ftile result = FtileWhile.create(swimlane, whileBlock, test, borderColor, backColor, arrowColor, yes, out, Ftile result = FtileWhile.create(swimlane, whileBlock, test, borderColor, backColor, arrowColor, yes, out,
endInlinkColor, afterEndwhile, fontArrow, getFactory(), conditionStyle, fcTest, specialOut); endInlinkColor, afterEndwhile, fontArrow, getFactory(), conditionStyle, fcTest, specialOut);

View File

@ -43,6 +43,7 @@ import net.sourceforge.plantuml.AlignmentParam;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
@ -60,6 +61,10 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.UGraphicInterceptorUDrawable; import net.sourceforge.plantuml.graphic.UGraphicInterceptorUDrawable;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.svek.UGraphicForSnake; import net.sourceforge.plantuml.svek.UGraphicForSnake;
import net.sourceforge.plantuml.ugraphic.LimitFinder; import net.sourceforge.plantuml.ugraphic.LimitFinder;
import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.MinMax;
@ -77,10 +82,15 @@ public class FtileGroup extends AbstractFtile {
private final TextBlock headerNote; private final TextBlock headerNote;
private final HtmlColor borderColor; private final HtmlColor borderColor;
private final HtmlColor backColor; private final HtmlColor backColor;
private final double shadowing;
private final UStroke stroke; private final UStroke stroke;
private final USymbol type; private final USymbol type;
private final double roundCorner; private final double roundCorner;
final public StyleSignature getDefaultStyleDefinitionPartition() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.partition);
}
public FtileGroup(Ftile inner, Display title, Display displayNote, HtmlColor arrowColor, HtmlColor backColor, public FtileGroup(Ftile inner, Display title, Display displayNote, HtmlColor arrowColor, HtmlColor backColor,
HtmlColor titleColor, ISkinParam skinParam, HtmlColor borderColor, USymbol type, double roundCorner) { HtmlColor titleColor, ISkinParam skinParam, HtmlColor borderColor, USymbol type, double roundCorner) {
super(inner.skinParam()); super(inner.skinParam());
@ -89,11 +99,19 @@ public class FtileGroup extends AbstractFtile {
this.backColor = backColor == null ? HtmlColorUtils.WHITE : backColor; this.backColor = backColor == null ? HtmlColorUtils.WHITE : backColor;
this.inner = FtileUtils.addHorizontalMargin(inner, 10); this.inner = FtileUtils.addHorizontalMargin(inner, 10);
this.borderColor = borderColor == null ? HtmlColorUtils.BLACK : borderColor; this.borderColor = borderColor == null ? HtmlColorUtils.BLACK : borderColor;
final UFont font = skinParam.getFont(null, false, FontParam.PARTITION);
final HtmlColor fontColor = skinParam.getFontHtmlColor(null, FontParam.PARTITION); final FontConfiguration fc;
final FontConfiguration fc = new FontConfiguration(font, fontColor, skinParam.getHyperlinkColor(), if (SkinParam.USE_STYLES()) {
skinParam.useUnderlineForHyperlink(), skinParam.getTabSize()); final Style style = getDefaultStyleDefinitionPartition().getMergedStyle(skinParam.getCurrentStyleBuilder());
fc = style.getFontConfiguration(getIHtmlColorSet());
this.shadowing = style.value(PName.Shadowing).asDouble();
} else {
final UFont font = skinParam.getFont(null, false, FontParam.PARTITION);
final HtmlColor fontColor = skinParam.getFontHtmlColor(null, FontParam.PARTITION);
fc = new FontConfiguration(font, fontColor, skinParam.getHyperlinkColor(),
skinParam.useUnderlineForHyperlink(), skinParam.getTabSize());
this.shadowing = skinParam().shadowing(null) ? 3 : 0;
}
if (title == null) { if (title == null) {
this.name = TextBlockUtils.empty(0, 0); this.name = TextBlockUtils.empty(0, 0);
} else { } else {
@ -108,7 +126,7 @@ public class FtileGroup extends AbstractFtile {
final UStroke thickness = skinParam.getThickness(LineParam.partitionBorder, null); final UStroke thickness = skinParam.getThickness(LineParam.partitionBorder, null);
this.stroke = thickness == null ? new UStroke(2) : thickness; this.stroke = thickness == null ? new UStroke(2) : thickness;
} }
@Override @Override
public Collection<Ftile> getMyChildren() { public Collection<Ftile> getMyChildren() {
return inner.getMyChildren(); return inner.getMyChildren();
@ -205,11 +223,12 @@ public class FtileGroup extends AbstractFtile {
final Dimension2D dimTotal = calculateDimension(stringBounder); final Dimension2D dimTotal = calculateDimension(stringBounder);
// final double roundCorner = type.getSkinParameter().getRoundCorner(skinParam(), null); // final double roundCorner = type.getSkinParameter().getRoundCorner(skinParam(), null);
final SymbolContext symbolContext = new SymbolContext(backColor, borderColor) final SymbolContext symbolContext = new SymbolContext(backColor, borderColor).withShadow(shadowing)
.withShadow(skinParam().shadowing(null)).withStroke(stroke).withCorner(roundCorner, 0); .withStroke(stroke).withCorner(roundCorner, 0);
type.asBig(name, inner.skinParam().getHorizontalAlignment(AlignmentParam.packageTitleAlignment, null, false), type.asBig(name, inner.skinParam().getHorizontalAlignment(AlignmentParam.packageTitleAlignment, null, false),
TextBlockUtils.empty(0, 0), dimTotal.getWidth(), dimTotal.getHeight(), symbolContext, skinParam().getStereotypeAlignment()).drawU(ug); TextBlockUtils.empty(0, 0), dimTotal.getWidth(), dimTotal.getHeight(), symbolContext,
skinParam().getStereotypeAlignment()).drawU(ug);
final Dimension2D dimHeaderNote = headerNote.calculateDimension(stringBounder); final Dimension2D dimHeaderNote = headerNote.calculateDimension(stringBounder);
headerNote.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - dimHeaderNote.getWidth() - 10, headerNote.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - dimHeaderNote.getWidth() - 10,

View File

@ -44,6 +44,7 @@ import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
@ -61,16 +62,25 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.style.Styleable;
import net.sourceforge.plantuml.svek.image.Opale; import net.sourceforge.plantuml.svek.image.Opale;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
public class FtileNoteAlone extends AbstractFtile implements Stencil { public class FtileNoteAlone extends AbstractFtile implements Stencil, Styleable {
private final Opale opale; private final Opale opale;
private final boolean withOutPoint; private final boolean withOutPoint;
private final Swimlane swimlane; private final Swimlane swimlane;
public StyleSignature getDefaultStyleDefinition() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.note);
}
@Override @Override
public Collection<Ftile> getMyChildren() { public Collection<Ftile> getMyChildren() {
return Collections.emptyList(); return Collections.emptyList();
@ -97,15 +107,27 @@ public class FtileNoteAlone extends AbstractFtile implements Stencil {
this.withOutPoint = withOutPoint; this.withOutPoint = withOutPoint;
final Rose rose = new Rose(); final Rose rose = new Rose();
final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); final HtmlColor noteBackgroundColor;
final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); final HtmlColor borderColor;
final double shadowing;
if (SkinParam.USE_STYLES()) {
final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
noteBackgroundColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
shadowing = style.value(PName.Shadowing).asDouble();
} else {
noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground);
borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder);
shadowing = skinParam.shadowing(null) ? 4 : 0;
}
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
skinParam, CreoleMode.FULL).createSheet(note); skinParam, CreoleMode.FULL).createSheet(note);
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()), this, new UStroke(1)); final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()),
opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(null), false); this, new UStroke(1));
opale = new Opale(shadowing, borderColor, noteBackgroundColor, text, false);
} }

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.PositionedNote; import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
@ -67,12 +68,17 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType; import net.sourceforge.plantuml.sequencediagram.NoteType;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.style.Styleable;
import net.sourceforge.plantuml.svek.image.Opale; import net.sourceforge.plantuml.svek.image.Opale;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
public class FtileWithNoteOpale extends AbstractFtile implements Stencil { public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Styleable {
private final Ftile tile; private final Ftile tile;
private final Opale opale; private final Opale opale;
@ -82,6 +88,10 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
private final double suppSpace = 20; private final double suppSpace = 20;
private final Swimlane swimlaneNote; private final Swimlane swimlaneNote;
public StyleSignature getDefaultStyleDefinition() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.note);
}
public Set<Swimlane> getSwimlanes() { public Set<Swimlane> getSwimlanes() {
if (swimlaneNote != null) { if (swimlaneNote != null) {
final Set<Swimlane> result = new HashSet<Swimlane>(tile.getSwimlanes()); final Set<Swimlane> result = new HashSet<Swimlane>(tile.getSwimlanes());
@ -128,16 +138,30 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
final Rose rose = new Rose(); final Rose rose = new Rose();
final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground); final HtmlColor noteBackgroundColor;
final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder); final HtmlColor borderColor;
final FontConfiguration fc;
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null); final double shadowing;
if (SkinParam.USE_STYLES()) {
final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()).eventuallyOverride(note.getColors());
noteBackgroundColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
fc = style.getFontConfiguration(getIHtmlColorSet());
shadowing = style.value(PName.Shadowing).asDouble();
} else {
noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground);
borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder);
fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
shadowing = skinParam.shadowing(null) ? 4 : 0;
}
final HorizontalAlignment align = skinParam.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null, false); final HorizontalAlignment align = skinParam.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null,
false);
final Sheet sheet = new CreoleParser(fc, align, skinParam, CreoleMode.FULL).createSheet(note.getDisplay()); final Sheet sheet = new CreoleParser(fc, align, skinParam, CreoleMode.FULL).createSheet(note.getDisplay());
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, skinParam.wrapWidth(), skinParam.getPadding()), final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, skinParam.wrapWidth(), skinParam.getPadding()),
this, new UStroke(1)); this, new UStroke(1));
opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(null), withLink); opale = new Opale(shadowing, borderColor, noteBackgroundColor, text, withLink);
} }

View File

@ -44,6 +44,7 @@ import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.PositionedNote; import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
@ -63,6 +64,10 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.svek.image.Opale; import net.sourceforge.plantuml.svek.image.Opale;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
@ -78,6 +83,10 @@ public class FtileWithNotes extends AbstractFtile {
private final double suppSpace = 20; private final double suppSpace = 20;
public StyleSignature getDefaultStyleDefinition() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.note);
}
public Set<Swimlane> getSwimlanes() { public Set<Swimlane> getSwimlanes() {
return tile.getSwimlanes(); return tile.getSwimlanes();
} }
@ -96,12 +105,30 @@ public class FtileWithNotes extends AbstractFtile {
final Rose rose = new Rose(); final Rose rose = new Rose();
final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground);
final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder);
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
for (PositionedNote note : notes) { for (PositionedNote note : notes) {
ISkinParam skinParam2 = skinParam;
if (note.getColors() != null) {
skinParam2 = note.getColors().mute(skinParam2);
}
final HtmlColor noteBackgroundColor;
final HtmlColor borderColor;
final FontConfiguration fc;
final double shadowing;
if (SkinParam.USE_STYLES()) {
final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder())
.eventuallyOverride(note.getColors());
noteBackgroundColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
fc = style.getFontConfiguration(getIHtmlColorSet());
shadowing = style.value(PName.Shadowing).asDouble();
} else {
noteBackgroundColor = rose.getHtmlColor(skinParam2, ColorParam.noteBackground);
borderColor = rose.getHtmlColor(skinParam2, ColorParam.noteBorder);
fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
shadowing = skinParam.shadowing(null) ? 4 : 0;
}
final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
skinParam, CreoleMode.FULL).createSheet(note.getDisplay()); skinParam, CreoleMode.FULL).createSheet(note.getDisplay());
final SheetBlock1 sheet1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding()); final SheetBlock1 sheet1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding());
@ -116,7 +143,7 @@ public class FtileWithNotes extends AbstractFtile {
} }
}, new UStroke()); }, new UStroke());
final Opale opale = new Opale(borderColor, noteBackgroundColor, sheet2, skinParam.shadowing(null), false); final Opale opale = new Opale(shadowing, borderColor, noteBackgroundColor, sheet2, false);
final TextBlock opaleMarged = TextBlockUtils.withMargin(opale, 10, 10); final TextBlock opaleMarged = TextBlockUtils.withMargin(opale, 10, 10);
if (note.getNotePosition() == NotePosition.LEFT) { if (note.getNotePosition() == NotePosition.LEFT) {
if (left == null) { if (left == null) {

View File

@ -42,6 +42,7 @@ import java.util.List;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
@ -54,19 +55,19 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBlackBlock; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBlackBlock;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
public class ParallelBuilderFork extends ParallelFtilesBuilder { public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
private final String label; private final String label;
public ParallelBuilderFork(ISkinParam skinParam, StringBounder stringBounder, public ParallelBuilderFork(ISkinParam skinParam, StringBounder stringBounder, final List<Ftile> list, Ftile inner,
final List<Ftile> list, Ftile inner, Swimlane swimlane, String label) { String label) {
super(skinParam, stringBounder, list, inner, swimlane); super(skinParam, stringBounder, list, inner);
this.label = label; this.label = label;
} }
@ -79,13 +80,21 @@ public class ParallelBuilderFork extends ParallelFtilesBuilder {
double x = 0; double x = 0;
for (Ftile tmp : getList()) { for (Ftile tmp : getList()) {
final Dimension2D dim = tmp.calculateDimension(getStringBounder()); final Dimension2D dim = tmp.calculateDimension(getStringBounder());
conns.add(new ConnectionIn(black, tmp, x, tmp.getInLinkRendering().getRainbow( final Rainbow def;
HtmlColorAndStyle.build(skinParam())))); if (SkinParam.USE_STYLES()) {
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
def = Rainbow.build(style, skinParam().getIHtmlColorSet());
} else {
def = Rainbow.build(skinParam());
}
final Rainbow rainbow = tmp.getInLinkRendering().getRainbow(def);
conns.add(new ConnectionIn(black, tmp, x, rainbow));
x += dim.getWidth(); x += dim.getWidth();
} }
result = FtileUtils.addConnection(result, conns); result = FtileUtils.addConnection(result, conns);
((FtileBlackBlock) black).setBlackBlockDimension(result.calculateDimension(getStringBounder()).getWidth(), barHeight); ((FtileBlackBlock) black).setBlackBlockDimension(result.calculateDimension(getStringBounder()).getWidth(),
barHeight);
return new FtileAssemblySimple(black, result); return new FtileAssemblySimple(black, result);
} }
@ -94,7 +103,8 @@ public class ParallelBuilderFork extends ParallelFtilesBuilder {
protected Ftile doStep2(Ftile result) { protected Ftile doStep2(Ftile result) {
final Ftile out = new FtileBlackBlock(skinParam(), getRose().getHtmlColor(skinParam(), ColorParam.activityBar), final Ftile out = new FtileBlackBlock(skinParam(), getRose().getHtmlColor(skinParam(), ColorParam.activityBar),
getList().get(0).getSwimlaneIn()); getList().get(0).getSwimlaneIn());
((FtileBlackBlock) out).setBlackBlockDimension(result.calculateDimension(getStringBounder()).getWidth(), barHeight); ((FtileBlackBlock) out).setBlackBlockDimension(result.calculateDimension(getStringBounder()).getWidth(),
barHeight);
if (label != null) { if (label != null) {
((FtileBlackBlock) out).setLabel(getTextBlock(Display.getWithNewlines(label))); ((FtileBlackBlock) out).setLabel(getTextBlock(Display.getWithNewlines(label)));
} }
@ -104,8 +114,15 @@ public class ParallelBuilderFork extends ParallelFtilesBuilder {
for (Ftile tmp : getList()) { for (Ftile tmp : getList()) {
final UTranslate translate0 = new UTranslate(0, barHeight); final UTranslate translate0 = new UTranslate(0, barHeight);
final Dimension2D dim = tmp.calculateDimension(getStringBounder()); final Dimension2D dim = tmp.calculateDimension(getStringBounder());
conns.add(new ConnectionOut(translate0, tmp, out, x, tmp.getOutLinkRendering().getRainbow( final Rainbow def;
HtmlColorAndStyle.build(skinParam())), getHeightOfMiddle())); if (SkinParam.USE_STYLES()) {
Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
def = Rainbow.build(style, skinParam().getIHtmlColorSet());
} else {
def = Rainbow.build(skinParam());
}
final Rainbow rainbow = tmp.getOutLinkRendering().getRainbow(def);
conns.add(new ConnectionOut(translate0, tmp, out, x, rainbow, getHeightOfMiddle()));
x += dim.getWidth(); x += dim.getWidth();
} }
result = FtileUtils.addConnection(result, conns); result = FtileUtils.addConnection(result, conns);

View File

@ -42,6 +42,7 @@ import java.util.List;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
@ -51,23 +52,21 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBlackBlock; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBlackBlock;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
public class ParallelBuilderMerge extends ParallelFtilesBuilder { public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder {
public ParallelBuilderMerge(ISkinParam skinParam, StringBounder stringBounder, public ParallelBuilderMerge(ISkinParam skinParam, StringBounder stringBounder, final List<Ftile> list, Ftile inner) {
final List<Ftile> list, Ftile inner, Swimlane swimlane) { super(skinParam, stringBounder, list, inner);
super(skinParam, stringBounder, list, inner, swimlane);
} }
@Override @Override
@ -80,22 +79,30 @@ public class ParallelBuilderMerge extends ParallelFtilesBuilder {
double x = 0; double x = 0;
for (Ftile tmp : getList()) { for (Ftile tmp : getList()) {
final Dimension2D dim = tmp.calculateDimension(getStringBounder()); final Dimension2D dim = tmp.calculateDimension(getStringBounder());
conns.add(new ConnectionIn(black, tmp, x, tmp.getInLinkRendering().getRainbow( final Rainbow def;
HtmlColorAndStyle.build(skinParam())))); if (SkinParam.USE_STYLES()) {
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
def = Rainbow.build(style, skinParam().getIHtmlColorSet());
} else {
def = Rainbow.build(skinParam());
}
final Rainbow rainbow = tmp.getInLinkRendering().getRainbow(def);
conns.add(new ConnectionIn(black, tmp, x, rainbow));
x += dim.getWidth(); x += dim.getWidth();
} }
result = FtileUtils.addConnection(result, conns); result = FtileUtils.addConnection(result, conns);
((FtileBlackBlock) black).setBlackBlockDimension(result.calculateDimension(getStringBounder()).getWidth(), barHeight); ((FtileBlackBlock) black).setBlackBlockDimension(result.calculateDimension(getStringBounder()).getWidth(),
barHeight);
return new FtileAssemblySimple(black, result); return new FtileAssemblySimple(black, result);
} }
@Override @Override
protected Ftile doStep2(Ftile result) { protected Ftile doStep2(Ftile result) {
final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
final HtmlColor backColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground); final HtmlColor backColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground);
final Ftile out = new FtileDiamond(skinParam(), backColor, borderColor, swimlane()); final Ftile out = new FtileDiamond(skinParam(), backColor, borderColor, swimlaneOutForStep2());
result = new FtileAssemblySimple(result, out); result = new FtileAssemblySimple(result, out);
final List<Connection> conns = new ArrayList<Connection>(); final List<Connection> conns = new ArrayList<Connection>();
final UTranslate diamondTranslate = result.getTranslateFor(out, getStringBounder()); final UTranslate diamondTranslate = result.getTranslateFor(out, getStringBounder());
@ -104,8 +111,15 @@ public class ParallelBuilderMerge extends ParallelFtilesBuilder {
for (Ftile tmp : getList()) { for (Ftile tmp : getList()) {
final Dimension2D dim = tmp.calculateDimension(getStringBounder()); final Dimension2D dim = tmp.calculateDimension(getStringBounder());
final UTranslate translate0 = new UTranslate(x, barHeight); final UTranslate translate0 = new UTranslate(x, barHeight);
conns.add(new ConnectionHorizontalThenVertical(tmp, out, tmp.getOutLinkRendering().getRainbow( final Rainbow def;
HtmlColorAndStyle.build(skinParam())), translate0, diamondTranslate, i)); if (SkinParam.USE_STYLES()) {
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
def = Rainbow.build(style, skinParam().getIHtmlColorSet());
} else {
def = Rainbow.build(skinParam());
}
final Rainbow rainbow = tmp.getOutLinkRendering().getRainbow(def);
conns.add(new ConnectionHorizontalThenVertical(tmp, out, rainbow, translate0, diamondTranslate, i));
x += dim.getWidth(); x += dim.getWidth();
i++; i++;
} }

View File

@ -35,243 +35,281 @@
*/ */
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
import java.awt.geom.Dimension2D; import java.awt.geom.Point2D;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable; import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
import net.sourceforge.plantuml.activitydiagram3.ftile.MergeStrategy;
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileThinSplit;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
public class ParallelBuilderSplit extends ParallelFtilesBuilder { public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder {
public ParallelBuilderSplit(ISkinParam skinParam, StringBounder stringBounder, public ParallelBuilderSplit(ISkinParam skinParam, StringBounder stringBounder, final List<Ftile> list, Ftile inner) {
final List<Ftile> list, Ftile inner, Swimlane swimlane) { super(skinParam, stringBounder, list, inner);
super(skinParam, stringBounder, list, inner, swimlane); }
@Override
public StyleSignature getDefaultStyleDefinition() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
} }
@Override @Override
protected Ftile doStep1() { protected Ftile doStep1() {
Ftile result = getMiddle(); Ftile result = getMiddle();
final List<Connection> conns = new ArrayList<Connection>(); final List<Connection> conns = new ArrayList<Connection>();
final Rainbow thinColor;
double x1 = 0; if (SkinParam.USE_STYLES()) {
for (Ftile tmp : getList()) { Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
final Dimension2D dim = tmp.calculateDimension(getStringBounder()); thinColor = Rainbow.build(style, skinParam().getIHtmlColorSet());
conns.add(new ConnectionIn(tmp, x1, tmp.getInLinkRendering().getRainbow( } else {
HtmlColorAndStyle.build(skinParam())), getTextBlock(tmp.getInLinkRendering()))); thinColor = result.getInLinkRendering().getRainbow(Rainbow.build(skinParam()));
x1 += dim.getWidth();
} }
final double totalWidth1 = result.calculateDimension(getStringBounder()).getWidth(); final Ftile thin = new FtileThinSplit(skinParam(), getThin1Color(thinColor), getList().get(0).getSwimlaneIn());
conns.add(new ConnectionHline2(result, HtmlColorAndStyle.build(skinParam()), 0, getList(), totalWidth1)); double x = 0;
double first = 0;
double last = 0;
for (Ftile tmp : getList()) {
final FtileGeometry dim = tmp.calculateDimension(getStringBounder());
if (first == 0) {
first = x + dim.getLeft();
}
last = x + dim.getLeft();
final LinkRendering inLinkRendering = tmp.getInLinkRendering();
final Rainbow rainbow;
if (SkinParam.USE_STYLES()) {
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
rainbow = inLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet()));
} else {
rainbow = inLinkRendering.getRainbow(Rainbow.build(skinParam()));
}
conns.add(new ConnectionIn(thin, tmp, x, rainbow));
x += dim.getWidth();
}
result = FtileUtils.addConnection(result, conns); result = FtileUtils.addConnection(result, conns);
return result; final FtileGeometry geom = result.calculateDimension(getStringBounder());
if (last < geom.getLeft()) {
last = geom.getLeft();
}
if (first > geom.getLeft()) {
first = geom.getLeft();
}
((FtileThinSplit) thin).setGeom(first, last, result.calculateDimension(getStringBounder()).getWidth());
return new FtileAssemblySimple(thin, result);
}
private HtmlColor getThin1Color(final Rainbow thinColor) {
for (Ftile tmp : getList()) {
final Rainbow rainbow;
final LinkRendering inLinkRendering = tmp.getInLinkRendering();
if (SkinParam.USE_STYLES()) {
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
rainbow = inLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet()));
} else {
rainbow = inLinkRendering.getRainbow(Rainbow.build(skinParam()));
}
if (rainbow.isInvisible() == false) {
return thinColor.getColor();
}
}
return null;
}
private boolean hasOut() {
for (Ftile tmp : getList()) {
final boolean hasOutTmp = tmp.calculateDimension(getStringBounder()).hasPointOut();
if (hasOutTmp) {
return true;
}
}
return false;
} }
@Override @Override
protected Ftile doStep2(Ftile result) { protected Ftile doStep2(Ftile result) {
final List<Connection> conns2 = new ArrayList<Connection>();
double x2 = 0; final FtileGeometry geom = result.calculateDimension(getStringBounder());
boolean hasOut = false; if (hasOut() == false) {
for (Ftile tmp : getList()) { return new FtileKilled(result);
final Dimension2D dim = tmp.calculateDimension(getStringBounder());
final boolean hasOutTmp = tmp.calculateDimension(getStringBounder()).hasPointOut();
if (hasOutTmp) {
conns2.add(new ConnectionOut(tmp, x2, tmp.getOutLinkRendering().getRainbow(
HtmlColorAndStyle.build(skinParam())), getHeightOfMiddle(), getTextBlock(tmp
.getOutLinkRendering())));
hasOut = true;
}
x2 += dim.getWidth();
} }
if (hasOut) { final Rainbow thinColor;
final double totalWidth2 = result.calculateDimension(getStringBounder()).getWidth(); final LinkRendering inLinkRendering = result.getInLinkRendering();
conns2.add(new ConnectionHline2(result, HtmlColorAndStyle.build(skinParam()), getHeightOfMiddle(), if (SkinParam.USE_STYLES()) {
getList(), totalWidth2)); Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
result = FtileUtils.addConnection(result, conns2); thinColor = inLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet()));
} else { } else {
result = new FtileKilled(result); thinColor = inLinkRendering.getRainbow(Rainbow.build(skinParam()));
} }
final Ftile out = new FtileThinSplit(skinParam(), thinColor.getColor(), swimlaneOutForStep2());
result = new FtileAssemblySimple(result, out);
final List<Connection> conns = new ArrayList<Connection>();
double x = 0;
double first = 0;
double last = 0;
for (Ftile tmp : getList()) {
final UTranslate translate0 = new UTranslate(0, 1.5);
final FtileGeometry dim = tmp.calculateDimension(getStringBounder());
if (dim.hasPointOut()) {
if (first == 0) {
first = x + dim.getLeft();
}
last = x + dim.getLeft();
}
final Rainbow rainbow;
final LinkRendering outLinkRendering = tmp.getOutLinkRendering();
if (SkinParam.USE_STYLES()) {
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
rainbow = outLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet()));
} else {
rainbow = outLinkRendering.getRainbow(Rainbow.build(skinParam()));
}
conns.add(new ConnectionOut(translate0, tmp, out, x, rainbow, getHeightOfMiddle()));
x += dim.getWidth();
}
if (last < geom.getLeft()) {
last = geom.getLeft();
}
if (first > geom.getLeft()) {
first = geom.getLeft();
}
((FtileThinSplit) out).setGeom(first, last, geom.getWidth());
result = FtileUtils.addConnection(result, conns);
return result; return result;
} }
static class ConnectionHline2 extends AbstractConnection { class ConnectionIn extends AbstractConnection implements ConnectionTranslatable {
private final Ftile inner;
private final double y;
private final Rainbow arrowColor;
private final List<Ftile> list;
private final double totalWidth;
public ConnectionHline2(Ftile inner, Rainbow arrowColor, double y, List<Ftile> list, double totalWidth) {
super(null, null);
this.inner = inner;
this.y = y;
this.arrowColor = arrowColor;
this.list = list;
this.totalWidth = totalWidth;
}
public void drawU(UGraphic ug) {
double minX = Double.MAX_VALUE;
double maxX = 0;
if (y == 0 && ug instanceof UGraphicInterceptorOneSwimlane) {
final Swimlane intoSw = ((UGraphicInterceptorOneSwimlane) ug).getSwimlane();
boolean found = false;
for (Ftile tmp : list) {
if (tmp.getSwimlaneIn() == intoSw) {
found = true;
}
}
if (found == false) {
return;
}
}
final StringBounder stringBounder = ug.getStringBounder();
for (Ftile tmp : list) {
if (y > 0 && tmp.calculateDimension(stringBounder).hasPointOut() == false) {
continue;
}
final UTranslate ut = inner.getTranslateFor(tmp, stringBounder);
if (ut == null) {
continue;
}
final double middle = tmp.calculateDimension(stringBounder).translate(ut).getLeft();
minX = Math.min(minX, middle);
maxX = Math.max(maxX, middle);
}
if (minX > totalWidth / 2) {
minX = totalWidth / 2;
}
if (maxX < totalWidth / 2) {
maxX = totalWidth / 2;
}
final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor);
s.goUnmergeable(MergeStrategy.NONE);
s.addPoint(minX, y);
s.addPoint(maxX, y);
ug.draw(s);
}
}
static class ConnectionHline3 extends AbstractConnection implements ConnectionTranslatable {
private final Ftile inner;
private final double y;
private final Rainbow arrowColor;
private final List<Ftile> list;
private final double totalWidth;
public ConnectionHline3(Ftile inner, Rainbow arrowColor, double y, List<Ftile> list, double totalWidth) {
super(null, null);
this.inner = inner;
this.y = y;
this.arrowColor = arrowColor;
this.list = list;
this.totalWidth = totalWidth;
}
public void drawU(UGraphic ug) {
throw new UnsupportedOperationException();
}
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final StringBounder stringBounder = ug.getStringBounder();
final UTranslate left = inner.getSwimlaneIn().getTranslate();
double minX = inner.calculateDimension(stringBounder).getLeft() + left.getDx();
double maxX = minX;
for (Ftile tmp : list) {
final FtileGeometry tmpGeom = tmp.calculateDimension(stringBounder);
final UTranslate tpos = inner.getTranslateFor(tmp, stringBounder);
for (Swimlane sw : tmp.getSwimlanes()) {
final double x = tmpGeom.translate(sw.getTranslate().compose(tpos)).getLeft();
minX = Math.min(minX, x);
maxX = Math.max(maxX, x);
}
}
final Dimension2D dimInner = inner.calculateDimension(stringBounder);
final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor);
// final Snake s = new Snake(HtmlColorUtils.GREEN);
s.goUnmergeable(MergeStrategy.LIMITED);
s.addPoint(minX, y);
s.addPoint(maxX, y);
ug.draw(s);
}
}
static class ConnectionIn extends AbstractConnection {
private final double x; private final double x;
private final Rainbow arrowColor; private final Rainbow arrowColor;
private final TextBlock text; private final Display label;
public ConnectionIn(Ftile tmp, double x, Rainbow arrowColor, TextBlock text) { public ConnectionIn(Ftile ftile1, Ftile ftile2, double x, Rainbow arrowColor) {
super(null, tmp); super(ftile1, ftile2);
label = ftile2.getInLinkRendering().getDisplay();
this.x = x; this.x = x;
this.arrowColor = arrowColor; this.arrowColor = arrowColor;
this.text = text;
} }
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
ug = ug.apply(new UTranslate(x, 0)); ug = ug.apply(new UTranslate(x, 0));
final FtileGeometry geo = getFtile2().calculateDimension(ug.getStringBounder()); final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());
final double left = geo.getLeft(); final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); if (Display.isNull(label) == false) {
s.setLabel(text); snake.setLabel(getTextBlock(label));
s.addPoint(left, 0); }
s.addPoint(left, geo.getInY()); snake.addPoint(geo.getLeft(), 0);
ug.draw(s); snake.addPoint(geo.getLeft(), geo.getInY());
ug.draw(snake);
}
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
ug = ug.apply(new UTranslate(x, 0));
final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());
final Point2D p1 = new Point2D.Double(geo.getLeft(), 0);
final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY());
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
if (Display.isNull(label) == false) {
snake.setLabel(getTextBlock(label));
}
final Point2D mp1a = translate1.getTranslated(p1);
final Point2D mp2b = translate2.getTranslated(p2);
final double middle = mp1a.getY() + 4;
snake.addPoint(mp1a);
snake.addPoint(mp1a.getX(), middle);
snake.addPoint(mp2b.getX(), middle);
snake.addPoint(mp2b);
ug.draw(snake);
} }
} }
static class ConnectionOut extends AbstractConnection { class ConnectionOut extends AbstractConnection implements ConnectionTranslatable {
private final double x; private final double x;
private final Rainbow arrowColor; private final Rainbow arrowColor;
private final double height; private final double height;
private final TextBlock text; private final Display label;
private final UTranslate translate0;
public ConnectionOut(Ftile tmp, double x, Rainbow arrowColor, double height, TextBlock text) { public ConnectionOut(UTranslate translate0, Ftile ftile1, Ftile ftile2, double x, Rainbow arrowColor,
super(tmp, null); double height) {
super(ftile1, ftile2);
this.translate0 = translate0;
this.label = ftile1.getOutLinkRendering().getDisplay();
this.x = x; this.x = x;
this.arrowColor = arrowColor; this.arrowColor = arrowColor;
this.height = height; this.height = height;
this.text = text;
} }
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
ug = ug.apply(new UTranslate(x, 0)); ug = ug.apply(new UTranslate(x, 0));
final FtileGeometry geo = getFtile1().calculateDimension(ug.getStringBounder()); final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder());
if (geo.hasPointOut() == false) { if (geo.hasPointOut() == false) {
assert false;
return; return;
} }
final Snake s = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown()); final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
s.setLabel(text); if (Display.isNull(label) == false) {
s.goUnmergeable(MergeStrategy.NONE); snake.setLabel(getTextBlock(label));
s.addPoint(geo.getLeft(), geo.getOutY()); }
s.addPoint(geo.getLeft(), height); final Point2D p1 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), geo.getOutY()));
ug.draw(s); final Point2D p2 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), height));
snake.addPoint(p1);
snake.addPoint(p2);
ug.draw(snake);
} }
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
ug = ug.apply(new UTranslate(x, 0));
final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder());
if (geo.hasPointOut() == false) {
return;
}
final Point2D p1 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), geo.getOutY()));
final Point2D p2 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), height));
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
if (Display.isNull(label) == false) {
snake.setLabel(getTextBlock(label));
}
final Point2D mp1a = translate1.getTranslated(p1);
final Point2D mp2b = translate2.getTranslated(p2);
final double middle = mp2b.getY() - 14;
snake.addPoint(mp1a);
snake.addPoint(mp1a.getX(), middle);
snake.addPoint(mp2b.getX(), middle);
snake.addPoint(mp2b);
ug.draw(snake);
}
} }
} }

View File

@ -1,269 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* 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
*
* 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.activitydiagram3.ftile.vcompact;
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
import net.sourceforge.plantuml.activitydiagram3.ftile.Connection;
import net.sourceforge.plantuml.activitydiagram3.ftile.ConnectionTranslatable;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileThinSplit;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle;
import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class ParallelBuilderSplit2 extends ParallelFtilesBuilder {
public ParallelBuilderSplit2(ISkinParam skinParam, StringBounder stringBounder, final List<Ftile> list,
Ftile inner, Swimlane swimlane) {
super(skinParam, stringBounder, list, inner, swimlane);
}
@Override
protected Ftile doStep1() {
Ftile result = getMiddle();
final List<Connection> conns = new ArrayList<Connection>();
final Rainbow thinColor = result.getInLinkRendering().getRainbow(HtmlColorAndStyle.build(skinParam()));
final Ftile thin = new FtileThinSplit(skinParam(), getThin1Color(thinColor), getList().get(0).getSwimlaneIn());
double x = 0;
double first = 0;
double last = 0;
for (Ftile tmp : getList()) {
final FtileGeometry dim = tmp.calculateDimension(getStringBounder());
if (first == 0) {
first = x + dim.getLeft();
}
last = x + dim.getLeft();
final Rainbow rainbow = tmp.getInLinkRendering().getRainbow(HtmlColorAndStyle.build(skinParam()));
conns.add(new ConnectionIn(thin, tmp, x, rainbow));
x += dim.getWidth();
}
result = FtileUtils.addConnection(result, conns);
final FtileGeometry geom = result.calculateDimension(getStringBounder());
if (last < geom.getLeft()) {
last = geom.getLeft();
}
if (first > geom.getLeft()) {
first = geom.getLeft();
}
((FtileThinSplit) thin).setGeom(first, last, result.calculateDimension(getStringBounder()).getWidth());
return new FtileAssemblySimple(thin, result);
}
private HtmlColor getThin1Color(final Rainbow thinColor) {
for (Ftile tmp : getList()) {
final Rainbow rainbow = tmp.getInLinkRendering().getRainbow(HtmlColorAndStyle.build(skinParam()));
if (rainbow.isInvisible() == false) {
return thinColor.getColor();
}
}
return null;
}
private boolean hasOut() {
for (Ftile tmp : getList()) {
final boolean hasOutTmp = tmp.calculateDimension(getStringBounder()).hasPointOut();
if (hasOutTmp) {
return true;
}
}
return false;
}
@Override
protected Ftile doStep2(Ftile result) {
final FtileGeometry geom = result.calculateDimension(getStringBounder());
if (hasOut() == false) {
return new FtileKilled(result);
}
final Rainbow thinColor = result.getInLinkRendering().getRainbow(HtmlColorAndStyle.build(skinParam()));
// final Ftile out = new FtileThinSplit(skinParam(), thinColor.getColor(), getList().get(0).getSwimlaneIn());
final Ftile out = new FtileThinSplit(skinParam(), thinColor.getColor(), swimlane());
result = new FtileAssemblySimple(result, out);
final List<Connection> conns = new ArrayList<Connection>();
double x = 0;
double first = 0;
double last = 0;
for (Ftile tmp : getList()) {
final UTranslate translate0 = new UTranslate(0, 1.5);
final FtileGeometry dim = tmp.calculateDimension(getStringBounder());
if (dim.hasPointOut()) {
if (first == 0) {
first = x + dim.getLeft();
}
last = x + dim.getLeft();
}
conns.add(new ConnectionOut(translate0, tmp, out, x, tmp.getOutLinkRendering().getRainbow(
HtmlColorAndStyle.build(skinParam())), getHeightOfMiddle()));
x += dim.getWidth();
}
if (last < geom.getLeft()) {
last = geom.getLeft();
}
if (first > geom.getLeft()) {
first = geom.getLeft();
}
((FtileThinSplit) out).setGeom(first, last, geom.getWidth());
result = FtileUtils.addConnection(result, conns);
return result;
}
class ConnectionIn extends AbstractConnection implements ConnectionTranslatable {
private final double x;
private final Rainbow arrowColor;
private final Display label;
public ConnectionIn(Ftile ftile1, Ftile ftile2, double x, Rainbow arrowColor) {
super(ftile1, ftile2);
label = ftile2.getInLinkRendering().getDisplay();
this.x = x;
this.arrowColor = arrowColor;
}
public void drawU(UGraphic ug) {
ug = ug.apply(new UTranslate(x, 0));
final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
if (Display.isNull(label) == false) {
snake.setLabel(getTextBlock(label));
}
snake.addPoint(geo.getLeft(), 0);
snake.addPoint(geo.getLeft(), geo.getInY());
ug.draw(snake);
}
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
ug = ug.apply(new UTranslate(x, 0));
final FtileGeometry geo = getFtile2().calculateDimension(getStringBounder());
final Point2D p1 = new Point2D.Double(geo.getLeft(), 0);
final Point2D p2 = new Point2D.Double(geo.getLeft(), geo.getInY());
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
if (Display.isNull(label) == false) {
snake.setLabel(getTextBlock(label));
}
final Point2D mp1a = translate1.getTranslated(p1);
final Point2D mp2b = translate2.getTranslated(p2);
final double middle = mp1a.getY() + 4;
snake.addPoint(mp1a);
snake.addPoint(mp1a.getX(), middle);
snake.addPoint(mp2b.getX(), middle);
snake.addPoint(mp2b);
ug.draw(snake);
}
}
class ConnectionOut extends AbstractConnection implements ConnectionTranslatable {
private final double x;
private final Rainbow arrowColor;
private final double height;
private final Display label;
private final UTranslate translate0;
public ConnectionOut(UTranslate translate0, Ftile ftile1, Ftile ftile2, double x, Rainbow arrowColor,
double height) {
super(ftile1, ftile2);
this.translate0 = translate0;
this.label = ftile1.getOutLinkRendering().getDisplay();
this.x = x;
this.arrowColor = arrowColor;
this.height = height;
}
public void drawU(UGraphic ug) {
ug = ug.apply(new UTranslate(x, 0));
final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder());
if (geo.hasPointOut() == false) {
return;
}
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
if (Display.isNull(label) == false) {
snake.setLabel(getTextBlock(label));
}
final Point2D p1 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), geo.getOutY()));
final Point2D p2 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), height));
snake.addPoint(p1);
snake.addPoint(p2);
ug.draw(snake);
}
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
ug = ug.apply(new UTranslate(x, 0));
final FtileGeometry geo = getFtile1().calculateDimension(getStringBounder());
if (geo.hasPointOut() == false) {
return;
}
final Point2D p1 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), geo.getOutY()));
final Point2D p2 = translate0.getTranslated(new Point2D.Double(geo.getLeft(), height));
final Snake snake = new Snake(arrowHorizontalAlignment(), arrowColor, Arrows.asToDown());
if (Display.isNull(label) == false) {
snake.setLabel(getTextBlock(label));
}
final Point2D mp1a = translate1.getTranslated(p1);
final Point2D mp2b = translate2.getTranslated(p2);
final double middle = mp2b.getY() - 14;
snake.addPoint(mp1a);
snake.addPoint(mp1a.getX(), middle);
snake.addPoint(mp2b.getX(), middle);
snake.addPoint(mp2b);
ug.draw(snake);
}
}
}

View File

@ -42,6 +42,7 @@ import java.util.List;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.Branch;
import net.sourceforge.plantuml.activitydiagram3.ForkStyle; import net.sourceforge.plantuml.activitydiagram3.ForkStyle;
@ -66,6 +67,11 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
public class VCompactFactory implements FtileFactory { public class VCompactFactory implements FtileFactory {
@ -78,19 +84,41 @@ public class VCompactFactory implements FtileFactory {
return stringBounder; return stringBounder;
} }
public StyleBuilder getCurrentStyleBuilder() {
return skinParam.getCurrentStyleBuilder();
}
public VCompactFactory(ISkinParam skinParam, StringBounder stringBounder) { public VCompactFactory(ISkinParam skinParam, StringBounder stringBounder) {
this.skinParam = skinParam; this.skinParam = skinParam;
this.stringBounder = stringBounder; this.stringBounder = stringBounder;
} }
final public StyleSignature getDefaultStyleDefinitionCircle() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle);
}
public Ftile start(Swimlane swimlane) { public Ftile start(Swimlane swimlane) {
final HtmlColor color = rose.getHtmlColor(skinParam, ColorParam.activityStart); final HtmlColor color;
return new FtileCircleStart(skinParam(), color, swimlane); Style style = null;
if (SkinParam.USE_STYLES()) {
style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder());
color = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
} else {
color = rose.getHtmlColor(skinParam, ColorParam.activityStart);
}
return new FtileCircleStart(skinParam(), color, swimlane, style);
} }
public Ftile stop(Swimlane swimlane) { public Ftile stop(Swimlane swimlane) {
final HtmlColor color = rose.getHtmlColor(skinParam, ColorParam.activityEnd); final HtmlColor color;
return new FtileCircleStop(skinParam(), color, swimlane); Style style = null;
if (SkinParam.USE_STYLES()) {
style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder());
color = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
} else {
color = rose.getHtmlColor(skinParam, ColorParam.activityEnd);
}
return new FtileCircleStop(skinParam(), color, swimlane, style);
} }
public Ftile spot(Swimlane swimlane, String spot) { public Ftile spot(Swimlane swimlane, String spot) {
@ -100,16 +128,23 @@ public class VCompactFactory implements FtileFactory {
} }
public Ftile end(Swimlane swimlane) { public Ftile end(Swimlane swimlane) {
final HtmlColor color = rose.getHtmlColor(skinParam, ColorParam.activityEnd); final HtmlColor color;
return new FtileCircleEnd(skinParam(), color, swimlane); Style style = null;
if (SkinParam.USE_STYLES()) {
style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder());
color = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
} else {
color = rose.getHtmlColor(skinParam, ColorParam.activityEnd);
}
return new FtileCircleEnd(skinParam(), color, swimlane, style);
} }
public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors) { public Ftile activity(Display label, Swimlane swimlane, BoxStyle boxStyle, Colors colors) {
// final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.activityBorder); // final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.activityBorder);
// final HtmlColor backColor = color == null ? rose.getHtmlColor(skinParam, ColorParam.activityBackground) : // final HtmlColor backColor = color == null ? rose.getHtmlColor(skinParam, ColorParam.activityBackground) :
// color; // color;
final UFont font = skinParam.getFont(null, false, FontParam.ACTIVITY); final UFont font = skinParam.getFont(null, false, FontParam.ACTIVITY);
return new FtileBox(colors.mute(skinParam), label, font, swimlane, style); return FtileBox.create(colors.mute(skinParam), label, swimlane, boxStyle);
} }
public Ftile addNote(Ftile ftile, Swimlane swimlane, Collection<PositionedNote> notes) { public Ftile addNote(Ftile ftile, Swimlane swimlane, Collection<PositionedNote> notes) {
@ -154,7 +189,7 @@ public class VCompactFactory implements FtileFactory {
return new FtileForkInner(ftiles); return new FtileForkInner(ftiles);
} }
public Ftile createParallel(Swimlane swimlane, List<Ftile> all, ForkStyle style, String label) { public Ftile createParallel(List<Ftile> all, ForkStyle style, String label) {
return new FtileForkInner(all); return new FtileForkInner(all);
} }

View File

@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.Branch;
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
@ -64,6 +65,10 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.svek.ConditionEndStyle; import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.ConditionStyle;
@ -87,23 +92,44 @@ public class ConditionalBuilder {
private final Ftile tile2; private final Ftile tile2;
private final Url url; private final Url url;
public StyleSignature getDefaultStyleDefinitionDiamond() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
}
public StyleSignature getDefaultStyleDefinitionArrow() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
}
public ConditionalBuilder(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, public ConditionalBuilder(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor,
FtileFactory ftileFactory, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle, FtileFactory ftileFactory, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle,
Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder, Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder,
FontConfiguration fontArrow, FontConfiguration fontTest, Url url) { FontConfiguration fontArrow, FontConfiguration fontTest, Url url) {
this.swimlane = swimlane; if (SkinParam.USE_STYLES()) {
this.borderColor = borderColor; final Style styleArrow = getDefaultStyleDefinitionArrow()
this.backColor = backColor; .getMergedStyle(skinParam.getCurrentStyleBuilder());
this.arrowColor = arrowColor; final Style styleDiamond = getDefaultStyleDefinitionDiamond().getMergedStyle(
skinParam.getCurrentStyleBuilder());
this.borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
this.backColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
this.arrowColor = Rainbow
.fromColor(styleArrow.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()));
this.fontTest = styleDiamond.getFontConfiguration(skinParam.getIHtmlColorSet());
this.fontArrow = styleArrow.getFontConfiguration(skinParam.getIHtmlColorSet());
} else {
this.borderColor = borderColor;
this.backColor = backColor;
this.arrowColor = arrowColor;
this.fontTest = fontTest;
this.fontArrow = fontArrow;
}
this.ftileFactory = ftileFactory; this.ftileFactory = ftileFactory;
this.swimlane = swimlane;
this.conditionStyle = conditionStyle; this.conditionStyle = conditionStyle;
this.conditionEndStyle = conditionEndStyle; this.conditionEndStyle = conditionEndStyle;
this.branch1 = branch1; this.branch1 = branch1;
this.branch2 = branch2; this.branch2 = branch2;
this.skinParam = skinParam; this.skinParam = skinParam;
this.stringBounder = stringBounder; this.stringBounder = stringBounder;
this.fontArrow = fontArrow;
this.fontTest = fontTest;
this.url = url; this.url = url;
this.tile1 = new FtileMinWidth(branch1.getFtile(), 30); this.tile1 = new FtileMinWidth(branch1.getFtile(), 30);

View File

@ -44,6 +44,9 @@ import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.SkinParamColors;
import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
@ -61,30 +64,54 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
public class FtileBox extends AbstractFtile { public class FtileBox extends AbstractFtile {
private static final int MARGIN = 10; private double padding() {
return padding;
}
private double padding = 10;
private final TextBlock tb; private final TextBlock tb;
private double roundCorner = 25;
private final double shadowing;
private final HorizontalAlignment horizontalAlignment;
private double minimumWidth = 0;
private final LinkRendering inRenreding; private final LinkRendering inRendering;
private final Swimlane swimlane; private final Swimlane swimlane;
private final BoxStyle style; private final BoxStyle boxStyle;
// private final ISkinParam skinParam;
private final HtmlColor borderColor;
private final HtmlColor backColor;
private final Style style;
static public StyleSignature getDefaultStyleDefinitionActivity() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity);
}
static public StyleSignature getDefaultStyleDefinitionArrow() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
}
final public LinkRendering getInLinkRendering() { final public LinkRendering getInLinkRendering() {
return inRenreding; return inRendering;
} }
public Set<Swimlane> getSwimlanes() { public Set<Swimlane> getSwimlanes() {
@ -105,27 +132,96 @@ public class FtileBox extends AbstractFtile {
class MyStencil implements Stencil { class MyStencil implements Stencil {
public double getStartingX(StringBounder stringBounder, double y) { public double getStartingX(StringBounder stringBounder, double y) {
return -MARGIN; return -padding();
} }
public double getEndingX(StringBounder stringBounder, double y) { public double getEndingX(StringBounder stringBounder, double y) {
final Dimension2D dim = calculateDimension(stringBounder); final Dimension2D dim = calculateDimension(stringBounder);
return dim.getWidth() - MARGIN; return dim.getWidth() - padding();
} }
} }
public FtileBox(ISkinParam skinParam, Display label, UFont font, Swimlane swimlane, BoxStyle style) { public static FtileBox create(ISkinParam skinParam, Display label, Swimlane swimlane, BoxStyle boxStyle) {
Style style = null;
Style styleArrow = null;
if (SkinParam.USE_STYLES()) {
style = getDefaultStyleDefinitionActivity().getMergedStyle(skinParam.getCurrentStyleBuilder());
styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam.getCurrentStyleBuilder());
}
return new FtileBox(skinParam, label, swimlane, boxStyle, style, styleArrow);
}
public static FtileBox createWbs(StyleBuilder styleBuilder, ISkinParam skinParam, Display label,
StyleSignature styleDefinition) {
Style style = null;
Style styleArrow = null;
if (SkinParam.USE_STYLES()) {
style = styleDefinition.getMergedStyle(styleBuilder);
styleArrow = style;
}
return new FtileBox(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow);
}
public static FtileBox createWbs(Style style, ISkinParam skinParam, Display label) {
Style styleArrow = null;
if (SkinParam.USE_STYLES()) {
styleArrow = style;
}
return new FtileBox(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow);
}
public static FtileBox createMindMap(StyleBuilder styleBuilder, ISkinParam skinParam, Display label,
StyleSignature styleDefinition) {
Style style = null;
Style styleArrow = null;
if (SkinParam.USE_STYLES()) {
style = styleDefinition.getMergedStyle(styleBuilder);
styleArrow = style;
}
return new FtileBox(skinParam, label, null, BoxStyle.PLAIN, style, styleArrow);
}
private FtileBox(ISkinParam skinParam, Display label, Swimlane swimlane, BoxStyle boxStyle, Style style,
Style styleArrow) {
super(skinParam); super(skinParam);
this.style = style; this.style = style;
// this.skinParam = skinParam; this.boxStyle = boxStyle;
this.swimlane = swimlane; this.swimlane = swimlane;
this.inRenreding = new LinkRendering(HtmlColorAndStyle.build(skinParam)); final FontConfiguration fc;
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.ACTIVITY, null); final LineBreakStrategy wrapWidth;
final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), if (SkinParam.USE_STYLES()) {
skinParam, CreoleMode.FULL).createSheet(label); this.inRendering = new LinkRendering(Rainbow.build(styleArrow, getIHtmlColorSet()));
this.tb = new SheetBlock2(new SheetBlock1(sheet, skinParam.wrapWidth(), skinParam.getPadding()), new MyStencil(), new UStroke(1)); Colors specBack = null;
if (skinParam instanceof SkinParamColors) {
specBack = ((SkinParamColors) skinParam).getColors();
}
style = style.eventuallyOverride(specBack);
this.borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
this.backColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
fc = style.getFontConfiguration(getIHtmlColorSet());
horizontalAlignment = style.getHorizontalAlignment();
this.padding = style.getPadding().asDouble();
this.roundCorner = style.value(PName.RoundCorner).asDouble();
this.shadowing = style.value(PName.Shadowing).asDouble();
wrapWidth = style.wrapWidth();
this.minimumWidth = style.value(PName.MinimumWidth).asDouble();
} else {
this.inRendering = new LinkRendering(Rainbow.build(skinParam));
this.borderColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBorder);
this.backColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBackground);
fc = new FontConfiguration(skinParam, FontParam.ACTIVITY, null);
horizontalAlignment = HorizontalAlignment.LEFT;
this.shadowing = skinParam().shadowing(null) ? 3.0 : 0.0;
wrapWidth = skinParam.wrapWidth();
}
final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(horizontalAlignment), skinParam,
CreoleMode.FULL).createSheet(label);
this.tb = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), new MyStencil(),
new UStroke(1));
this.print = label.toString(); this.print = label.toString();
} }
final private String print; final private String print;
@ -139,22 +235,35 @@ public class FtileBox extends AbstractFtile {
final Dimension2D dimTotal = calculateDimension(ug.getStringBounder()); final Dimension2D dimTotal = calculateDimension(ug.getStringBounder());
final double widthTotal = dimTotal.getWidth(); final double widthTotal = dimTotal.getWidth();
final double heightTotal = dimTotal.getHeight(); final double heightTotal = dimTotal.getHeight();
final UDrawable rect = style.getUDrawable(widthTotal, heightTotal, skinParam().shadowing(null)); final UDrawable rect = boxStyle.getUDrawable(widthTotal, heightTotal, shadowing, roundCorner);
final HtmlColor borderColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBorder); final UStroke thickness;
final HtmlColor backColor = SkinParamUtils.getColor(skinParam(), null, ColorParam.activityBackground); if (SkinParam.USE_STYLES()) {
thickness = style.getStroke();
} else {
thickness = getThickness();
}
ug = ug.apply(new UChangeColor(borderColor)).apply(new UChangeBackColor(backColor)).apply(getThickness()); ug = ug.apply(new UChangeColor(borderColor)).apply(new UChangeBackColor(backColor)).apply(thickness);
rect.drawU(ug); rect.drawU(ug);
tb.drawU(ug.apply(new UTranslate(MARGIN, MARGIN))); if (horizontalAlignment == HorizontalAlignment.LEFT) {
tb.drawU(ug.apply(new UTranslate(padding(), padding())));
} else if (horizontalAlignment == HorizontalAlignment.RIGHT) {
final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder());
tb.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - dimTb.getWidth() - padding(), padding())));
} else if (horizontalAlignment == HorizontalAlignment.CENTER) {
final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder());
tb.drawU(ug.apply(new UTranslate((dimTotal.getWidth() - dimTb.getWidth()) / 2, padding())));
}
} }
@Override @Override
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) { protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
final Dimension2D dim = tb.calculateDimension(stringBounder); Dimension2D dim = tb.calculateDimension(stringBounder);
return new FtileGeometry(Dimension2DDouble.delta(dim, 2 * MARGIN, 2 * MARGIN), dim.getWidth() / 2 + MARGIN, 0, dim = Dimension2DDouble.delta(dim, 2 * padding(), 2 * padding());
dim.getHeight() + 2 * MARGIN); dim = Dimension2DDouble.atLeast(dim, minimumWidth, 0);
return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
} }
public Collection<Ftile> getMyChildren() { public Collection<Ftile> getMyChildren() {

View File

@ -40,6 +40,7 @@ import java.util.Collections;
import java.util.Set; import java.util.Set;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
@ -47,6 +48,8 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UEllipse;
@ -61,16 +64,24 @@ public class FtileCircleEnd extends AbstractFtile {
private final HtmlColor backColor; private final HtmlColor backColor;
private final Swimlane swimlane; private final Swimlane swimlane;
private double shadowing;
@Override @Override
public Collection<Ftile> getMyChildren() { public Collection<Ftile> getMyChildren() {
return Collections.emptyList(); return Collections.emptyList();
} }
public FtileCircleEnd(ISkinParam skinParam, HtmlColor backColor, Swimlane swimlane) { public FtileCircleEnd(ISkinParam skinParam, HtmlColor backColor, Swimlane swimlane, Style style) {
super(skinParam); super(skinParam);
this.backColor = backColor; this.backColor = backColor;
this.swimlane = swimlane; this.swimlane = swimlane;
if (SkinParam.USE_STYLES()) {
this.shadowing = style.value(PName.Shadowing).asDouble();
} else {
if (skinParam().shadowing(null)) {
this.shadowing = 3;
}
}
} }
public Set<Swimlane> getSwimlanes() { public Set<Swimlane> getSwimlanes() {
@ -95,9 +106,7 @@ public class FtileCircleEnd extends AbstractFtile {
yTheoricalPosition = Math.round(yTheoricalPosition); yTheoricalPosition = Math.round(yTheoricalPosition);
final UEllipse circle = new UEllipse(SIZE, SIZE); final UEllipse circle = new UEllipse(SIZE, SIZE);
if (skinParam().shadowing(null)) { circle.setDeltaShadow(shadowing);
circle.setDeltaShadow(3);
}
ug = ug.apply(new UChangeColor(backColor)); ug = ug.apply(new UChangeColor(backColor));
final double thickness = 2.5; final double thickness = 2.5;
ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE)).apply(new UStroke(1.5)) ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE)).apply(new UStroke(1.5))

View File

@ -40,12 +40,15 @@ import java.util.Collections;
import java.util.Set; import java.util.Set;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UEllipse;
@ -57,11 +60,20 @@ public class FtileCircleStart extends AbstractFtile {
private final HtmlColor backColor; private final HtmlColor backColor;
private final Swimlane swimlane; private final Swimlane swimlane;
private double shadowing;
public FtileCircleStart(ISkinParam skinParam, HtmlColor backColor, Swimlane swimlane) { public FtileCircleStart(ISkinParam skinParam, HtmlColor backColor, Swimlane swimlane, Style style) {
super(skinParam); super(skinParam);
this.backColor = backColor; this.backColor = backColor;
this.swimlane = swimlane; this.swimlane = swimlane;
if (SkinParam.USE_STYLES()) {
this.shadowing = style.value(PName.Shadowing).asDouble();
} else {
if (skinParam().shadowing(null)) {
this.shadowing = 3;
}
}
} }
@Override @Override
@ -86,9 +98,7 @@ public class FtileCircleStart extends AbstractFtile {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final UEllipse circle = new UEllipse(SIZE, SIZE); final UEllipse circle = new UEllipse(SIZE, SIZE);
if (skinParam().shadowing(null)) { circle.setDeltaShadow(shadowing);
circle.setDeltaShadow(3);
}
ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(backColor)).draw(circle); ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(backColor)).draw(circle);
} }

View File

@ -40,6 +40,7 @@ import java.util.Collections;
import java.util.Set; import java.util.Set;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
@ -48,6 +49,8 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorMiddle; import net.sourceforge.plantuml.graphic.HtmlColorMiddle;
import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UEllipse;
@ -60,16 +63,24 @@ public class FtileCircleStop extends AbstractFtile {
private final HtmlColor backColor; private final HtmlColor backColor;
private final Swimlane swimlane; private final Swimlane swimlane;
private double shadowing;
@Override @Override
public Collection<Ftile> getMyChildren() { public Collection<Ftile> getMyChildren() {
return Collections.emptyList(); return Collections.emptyList();
} }
public FtileCircleStop(ISkinParam skinParam, HtmlColor backColor, Swimlane swimlane) { public FtileCircleStop(ISkinParam skinParam, HtmlColor backColor, Swimlane swimlane, Style style) {
super(skinParam); super(skinParam);
this.backColor = backColor; this.backColor = backColor;
this.swimlane = swimlane; this.swimlane = swimlane;
if (SkinParam.USE_STYLES()) {
this.shadowing = style.value(PName.Shadowing).asDouble();
} else {
if (skinParam().shadowing(null)) {
this.shadowing = 3;
}
}
} }
public Set<Swimlane> getSwimlanes() { public Set<Swimlane> getSwimlanes() {
@ -89,9 +100,7 @@ public class FtileCircleStop extends AbstractFtile {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final UEllipse circle = new UEllipse(SIZE, SIZE); final UEllipse circle = new UEllipse(SIZE, SIZE);
if (skinParam().shadowing(null)) { circle.setDeltaShadow(shadowing);
circle.setDeltaShadow(3);
}
ug.apply(new UChangeColor(backColor)).apply(new UChangeBackColor(HtmlColorUtils.WHITE)).draw(circle); ug.apply(new UChangeColor(backColor)).apply(new UChangeBackColor(HtmlColorUtils.WHITE)).draw(circle);
final double delta = 5; final double delta = 5;

View File

@ -42,6 +42,7 @@ import java.util.Set;
import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
@ -51,6 +52,10 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -65,12 +70,17 @@ public class FtileDiamond extends AbstractFtile {
private final TextBlock south; private final TextBlock south;
private final TextBlock west1; private final TextBlock west1;
private final TextBlock east1; private final TextBlock east1;
private final double shadowing;
public FtileDiamond(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane) { public FtileDiamond(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane) {
this(skinParam, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), this(skinParam, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
} }
public StyleSignature getDefaultStyleDefinitionDiamond() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.diamond);
}
@Override @Override
public Collection<Ftile> getMyChildren() { public Collection<Ftile> getMyChildren() {
return Collections.emptyList(); return Collections.emptyList();
@ -101,6 +111,13 @@ public class FtileDiamond extends AbstractFtile {
private FtileDiamond(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, private FtileDiamond(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane,
TextBlock north, TextBlock south, TextBlock east1, TextBlock west1) { TextBlock north, TextBlock south, TextBlock east1, TextBlock west1) {
super(skinParam); super(skinParam);
if (SkinParam.USE_STYLES()) {
Style style = getDefaultStyleDefinitionDiamond().getMergedStyle(skinParam.getCurrentStyleBuilder());
shadowing = style.value(PName.Shadowing).asDouble();
} else {
shadowing = skinParam().shadowing(null) ? 3 : 0;
}
this.backColor = backColor; this.backColor = backColor;
this.swimlane = swimlane; this.swimlane = swimlane;
this.borderColor = borderColor; this.borderColor = borderColor;
@ -130,7 +147,7 @@ public class FtileDiamond extends AbstractFtile {
final double suppY1 = north.calculateDimension(ug.getStringBounder()).getHeight(); final double suppY1 = north.calculateDimension(ug.getStringBounder()).getHeight();
ug = ug.apply(new UTranslate(0, suppY1)); ug = ug.apply(new UTranslate(0, suppY1));
ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor)) ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor))
.draw(Diamond.asPolygon(skinParam().shadowing(null))); .draw(Diamond.asPolygon(shadowing));
// final Dimension2D dimNorth = north.calculateDimension(ug.getStringBounder()); // final Dimension2D dimNorth = north.calculateDimension(ug.getStringBounder());
north.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 1.5, -suppY1))); north.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 1.5, -suppY1)));
@ -162,11 +179,10 @@ public class FtileDiamond extends AbstractFtile {
final Dimension2D dimEast = east1.calculateDimension(stringBounder); final Dimension2D dimEast = east1.calculateDimension(stringBounder);
return dimEast.getWidth(); return dimEast.getWidth();
} }
public double getSouthLabelHeight(StringBounder stringBounder) { public double getSouthLabelHeight(StringBounder stringBounder) {
final Dimension2D dimSouth = south.calculateDimension(stringBounder); final Dimension2D dimSouth = south.calculateDimension(stringBounder);
return dimSouth.getHeight(); return dimSouth.getHeight();
} }
} }

View File

@ -42,6 +42,7 @@ import java.util.Set;
import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
@ -51,12 +52,17 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.style.Styleable;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
public class FtileDiamondInside extends AbstractFtile { public class FtileDiamondInside extends AbstractFtile implements Styleable {
private final HtmlColor backColor; private final HtmlColor backColor;
private final HtmlColor borderColor; private final HtmlColor borderColor;
@ -66,12 +72,17 @@ public class FtileDiamondInside extends AbstractFtile {
private final TextBlock east; private final TextBlock east;
private final TextBlock north; private final TextBlock north;
private final TextBlock south; private final TextBlock south;
private final double shadowing;
@Override @Override
public Collection<Ftile> getMyChildren() { public Collection<Ftile> getMyChildren() {
return Collections.emptyList(); return Collections.emptyList();
} }
public StyleSignature getDefaultStyleDefinition() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
}
public FtileDiamondInside(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, public FtileDiamondInside(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane,
TextBlock label) { TextBlock label) {
this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0),
@ -101,9 +112,17 @@ public class FtileDiamondInside extends AbstractFtile {
private FtileDiamondInside(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, private FtileDiamondInside(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane,
TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) { TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) {
super(skinParam); super(skinParam);
this.backColor = backColor; if (SkinParam.USE_STYLES()) {
final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
this.borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
this.backColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
this.shadowing = style.value(PName.Shadowing).asDouble();
} else {
this.backColor = backColor;
this.borderColor = borderColor;
this.shadowing = skinParam().shadowing(null) ? 3 : 0;
}
this.swimlane = swimlane; this.swimlane = swimlane;
this.borderColor = borderColor;
this.label = label; this.label = label;
this.west = west; this.west = west;
this.east = east; this.east = east;
@ -131,7 +150,7 @@ public class FtileDiamondInside extends AbstractFtile {
final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimTotal = calculateDimensionAlone(stringBounder); final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor)); ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor));
ug.draw(Diamond.asPolygon(skinParam().shadowing(null), dimTotal.getWidth(), dimTotal.getHeight())); ug.draw(Diamond.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));

View File

@ -41,6 +41,7 @@ import java.util.Set;
import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
@ -49,6 +50,10 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -64,6 +69,7 @@ public class FtileDiamondInside2 extends AbstractFtile {
private final TextBlock east; private final TextBlock east;
private final TextBlock north; private final TextBlock north;
private final TextBlock south; private final TextBlock south;
private final double shadowing;
public FtileDiamondInside2(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, public FtileDiamondInside2(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane,
TextBlock label) { TextBlock label) {
@ -86,10 +92,20 @@ public class FtileDiamondInside2 extends AbstractFtile {
public FtileDiamondInside2 withSouth(TextBlock south) { public FtileDiamondInside2 withSouth(TextBlock south) {
return new FtileDiamondInside2(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); return new FtileDiamondInside2(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east);
} }
public StyleSignature getDefaultStyleDefinition() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
}
private FtileDiamondInside2(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, private FtileDiamondInside2(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane,
TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) { TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) {
super(skinParam); super(skinParam);
if (SkinParam.USE_STYLES()) {
final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
this.shadowing = style.value(PName.Shadowing).asDouble();
} else {
this.shadowing = skinParam().shadowing(null) ? 3 : 0;
}
this.backColor = backColor; this.backColor = backColor;
this.swimlane = swimlane; this.swimlane = swimlane;
this.borderColor = borderColor; this.borderColor = borderColor;
@ -120,7 +136,7 @@ public class FtileDiamondInside2 extends AbstractFtile {
final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimTotal = calculateDimensionAlone(stringBounder); final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor)); ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor));
ug.draw(Diamond.asPolygon(skinParam().shadowing(null), dimTotal.getWidth(), dimTotal.getHeight())); ug.draw(Diamond.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));

View File

@ -122,17 +122,18 @@ public class FtileDiamondInside3 extends AbstractFtile implements FtileOverpassi
final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimTotal = calculateDimensionAlone(stringBounder); final Dimension2D dimTotal = calculateDimensionAlone(stringBounder);
ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor)); ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor));
ug.draw(Diamond.asPolygon(skinParam().shadowing(null), dimTotal.getWidth(), dimTotal.getHeight())); final double shadowing = skinParam().shadowing(null) ? 3 : 0;
ug.draw(Diamond.asPolygon(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
final double lx = (dimTotal.getWidth() - dimLabel.getWidth()) / 2; final double lx = (dimTotal.getWidth() - dimLabel.getWidth()) / 2;
final double ly = (dimTotal.getHeight() - dimLabel.getHeight()) / 2; final double ly = (dimTotal.getHeight() - dimLabel.getHeight()) / 2;
label.drawU(ug.apply(new UTranslate(lx, ly))); label.drawU(ug.apply(new UTranslate(lx, ly)));
final Dimension2D dimWeat = west.calculateDimension(stringBounder); final Dimension2D dimWeat = west.calculateDimension(stringBounder);
west.drawU(ug.apply(new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + dimTotal.getHeight() / 2))); west.drawU(ug.apply(new UTranslate(-dimWeat.getWidth(), -dimWeat.getHeight() + dimTotal.getHeight() / 2)));
final Dimension2D dimEast = east.calculateDimension(stringBounder); final Dimension2D dimEast = east.calculateDimension(stringBounder);
east.drawU(ug.apply(new UTranslate(dimTotal.getWidth(), -dimEast.getHeight() + dimTotal.getHeight() / 2))); east.drawU(ug.apply(new UTranslate(dimTotal.getWidth(), -dimEast.getHeight() + dimTotal.getHeight() / 2)));
@ -168,7 +169,7 @@ public class FtileDiamondInside3 extends AbstractFtile implements FtileOverpassi
final Dimension2D north = this.north.calculateDimension(stringBounder); final Dimension2D north = this.north.calculateDimension(stringBounder);
final Dimension2D east = this.east.calculateDimension(stringBounder); final Dimension2D east = this.east.calculateDimension(stringBounder);
final Dimension2D west = this.west.calculateDimension(stringBounder); final Dimension2D west = this.west.calculateDimension(stringBounder);
final double height = total.getHeight(); // + north.getHeight(); final double height = total.getHeight(); // + north.getHeight();
final double left = total.getWidth() / 2; final double left = total.getWidth() / 2;
final double supp = MathUtils.max(north.getWidth(), east.getWidth(), west.getWidth()); final double supp = MathUtils.max(north.getWidth(), east.getWidth(), west.getWidth());
// final double width = supp > left ? left + supp : diamond.getWidth(); // final double width = supp > left ? left + supp : diamond.getWidth();

View File

@ -41,7 +41,7 @@ import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleDefinition; import net.sourceforge.plantuml.style.StyleSignature;
public abstract class AbstractComponentText implements Component { public abstract class AbstractComponentText implements Component {
@ -55,7 +55,7 @@ public abstract class AbstractComponentText implements Component {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public StyleDefinition getDefaultStyleDefinition() { public StyleSignature getDefaultStyleDefinition() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View File

@ -138,7 +138,7 @@ public class BpmElement extends AbstractConnectorPuzzle implements ConnectorPuzz
public TextBlock toTextBlockInternal(ISkinParam skinParam) { public TextBlock toTextBlockInternal(ISkinParam skinParam) {
if (type == BpmElementType.START) { if (type == BpmElementType.START) {
return new FtileCircleStart(skinParam, HtmlColorUtils.BLACK, null); return new FtileCircleStart(skinParam, HtmlColorUtils.BLACK, null, null);
} }
if (type == BpmElementType.MERGE) { if (type == BpmElementType.MERGE) {
final HtmlColor borderColor = SkinParamUtils.getColor(skinParam, null, ColorParam.activityBorder); final HtmlColor borderColor = SkinParamUtils.getColor(skinParam, null, ColorParam.activityBorder);
@ -147,7 +147,7 @@ public class BpmElement extends AbstractConnectorPuzzle implements ConnectorPuzz
} }
if (type == BpmElementType.DOCKED_EVENT) { if (type == BpmElementType.DOCKED_EVENT) {
final UFont font = UFont.serif(14); final UFont font = UFont.serif(14);
return new FtileBox(skinParam, display, font, null, BoxStyle.PLAIN); return FtileBox.create(skinParam, display, null, BoxStyle.PLAIN);
} }
final UFont font = UFont.serif(14); final UFont font = UFont.serif(14);
final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.RED, HtmlColorUtils.RED, false); final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.RED, HtmlColorUtils.RED, false);

View File

@ -67,21 +67,6 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
return getNamespace(fullyCode, fullyCode.getSeparator()); return getNamespace(fullyCode, fullyCode.getSeparator());
} }
private final String getNamespace(Code fullyCode, String separator) {
String name = fullyCode.getFullName();
if (separator == null) {
throw new IllegalArgumentException(toString());
}
do {
final int x = name.lastIndexOf(separator);
if (x == -1) {
return null;
}
name = name.substring(0, x);
} while (entityFactory.getLeafsget(Code.of(name, separator)) != null);
return name;
}
public final Code getShortName(Code code) { public final Code getShortName(Code code) {
final String separator = code.getSeparator(); final String separator = code.getSeparator();
if (separator == null) { if (separator == null) {

View File

@ -55,33 +55,6 @@ public class BlocLines implements Iterable<StringLocated> {
private List<StringLocated> lines; private List<StringLocated> lines;
private void check() {
// for (CharSequence s : lines) {
// // if (s == null) {
// // continue;
// // }
// if (s instanceof String) {
// continue;
// }
// // if (s instanceof Stereotype) {
// // continue;
// // }
// if (s instanceof CharSequence2) {
// continue;
// }
// // if (s instanceof MessageNumber) {
// // continue;
// // }
// // if (s instanceof EmbeddedDiagram) {
// // continue;
// // }
// System.err.println("PB2=" + s);
// System.err.println("PB=" + s.getClass());
// Thread.dumpStack();
// System.exit(0);
// }
}
@Override @Override
public String toString() { public String toString() {
return lines.toString(); return lines.toString();
@ -109,7 +82,6 @@ public class BlocLines implements Iterable<StringLocated> {
private BlocLines(List<StringLocated> lines) { private BlocLines(List<StringLocated> lines) {
this.lines = Collections.unmodifiableList(lines); this.lines = Collections.unmodifiableList(lines);
this.check();
} }
public Display toDisplay() { public Display toDisplay() {

View File

@ -37,7 +37,6 @@ package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
@ -76,7 +75,7 @@ public class CommandFooter extends SingleLineCommand2<TitledDiagram> {
if (SkinParam.USE_STYLES()) { if (SkinParam.USE_STYLES()) {
defaultAlign = FontParam.FOOTER.getStyleDefinition() defaultAlign = FontParam.FOOTER.getStyleDefinition()
.getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
.value(PName.HorizontalAlignment).asHorizontalAlignment(); .getHorizontalAlignment();
} }
diagram.getFooter().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), diagram.getFooter().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)),
HorizontalAlignment.fromString(align, defaultAlign)); HorizontalAlignment.fromString(align, defaultAlign));

View File

@ -37,7 +37,6 @@ package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
@ -78,7 +77,7 @@ public class CommandHeader extends SingleLineCommand2<TitledDiagram> {
if (SkinParam.USE_STYLES()) { if (SkinParam.USE_STYLES()) {
defaultAlign = FontParam.HEADER.getStyleDefinition() defaultAlign = FontParam.HEADER.getStyleDefinition()
.getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
.value(PName.HorizontalAlignment).asHorizontalAlignment(); .getHorizontalAlignment();
} }
diagram.getHeader().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), diagram.getHeader().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)),
HorizontalAlignment.fromString(align, defaultAlign)); HorizontalAlignment.fromString(align, defaultAlign));

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.command; package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
@ -70,7 +69,7 @@ public class CommandMultilinesFooter extends CommandMultilines<TitledDiagram> {
if (SkinParam.USE_STYLES()) { if (SkinParam.USE_STYLES()) {
defaultAlign = FontParam.FOOTER.getStyleDefinition() defaultAlign = FontParam.FOOTER.getStyleDefinition()
.getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
.value(PName.HorizontalAlignment).asHorizontalAlignment(); .getHorizontalAlignment();
} }
diagram.getFooter().putDisplay(strings, HorizontalAlignment.fromString(align, defaultAlign)); diagram.getFooter().putDisplay(strings, HorizontalAlignment.fromString(align, defaultAlign));
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.command; package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
@ -70,7 +69,7 @@ public class CommandMultilinesHeader extends CommandMultilines<TitledDiagram> {
if (SkinParam.USE_STYLES()) { if (SkinParam.USE_STYLES()) {
defaultAlign = FontParam.HEADER.getStyleDefinition() defaultAlign = FontParam.HEADER.getStyleDefinition()
.getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
.value(PName.HorizontalAlignment).asHorizontalAlignment(); .getHorizontalAlignment();
} }
diagram.getHeader().putDisplay(strings, HorizontalAlignment.fromString(align, defaultAlign)); diagram.getHeader().putDisplay(strings, HorizontalAlignment.fromString(align, defaultAlign));
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();

View File

@ -54,9 +54,9 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.preproc.FileWithSuffix; import net.sourceforge.plantuml.preproc.FileWithSuffix;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite; import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.ugraphic.sprite.SpriteImage; import net.sourceforge.plantuml.sprite.SpriteImage;
import net.sourceforge.plantuml.ugraphic.sprite.SpriteSvg; import net.sourceforge.plantuml.sprite.SpriteSvg;
public class CommandSpriteFile extends SingleLineCommand2<UmlDiagram> { public class CommandSpriteFile extends SingleLineCommand2<UmlDiagram> {

View File

@ -48,9 +48,9 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite; import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.ugraphic.sprite.SpriteColorBuilder4096; import net.sourceforge.plantuml.sprite.SpriteColorBuilder4096;
import net.sourceforge.plantuml.ugraphic.sprite.SpriteGrayLevel; import net.sourceforge.plantuml.sprite.SpriteGrayLevel;
public final class FactorySpriteCommand implements SingleMultiFactoryCommand<WithSprite> { public final class FactorySpriteCommand implements SingleMultiFactoryCommand<WithSprite> {

View File

@ -44,7 +44,6 @@ import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.ErrorUml; import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType; import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShowByGender; import net.sourceforge.plantuml.classdiagram.command.CommandHideShowByGender;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShowByVisibility; import net.sourceforge.plantuml.classdiagram.command.CommandHideShowByVisibility;
@ -54,8 +53,9 @@ import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.error.PSystemError; import net.sourceforge.plantuml.error.PSystemError;
import net.sourceforge.plantuml.error.PSystemErrorUtils; import net.sourceforge.plantuml.error.PSystemErrorUtils;
import net.sourceforge.plantuml.sequencediagram.command.CommandSkin; import net.sourceforge.plantuml.sequencediagram.command.CommandSkin;
import net.sourceforge.plantuml.sprite.CommandListSprite;
import net.sourceforge.plantuml.statediagram.command.CommandHideEmptyDescription; import net.sourceforge.plantuml.statediagram.command.CommandHideEmptyDescription;
import net.sourceforge.plantuml.style.CommandStyleMultilines; import net.sourceforge.plantuml.style.CommandStyleMultilinesCSS;
import net.sourceforge.plantuml.utils.StartUtils; import net.sourceforge.plantuml.utils.StartUtils;
import net.sourceforge.plantuml.version.IteratorCounter2; import net.sourceforge.plantuml.version.IteratorCounter2;
@ -219,11 +219,12 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
addTitleCommands(cmds); addTitleCommands(cmds);
addCommonCommands2(cmds); addCommonCommands2(cmds);
addCommonHides(cmds); addCommonHides(cmds);
cmds.add(new CommandStyleMultilines()); cmds.add(new CommandStyleMultilinesCSS());
} }
final protected void addCommonCommands2(List<Command> cmds) { final protected void addCommonCommands2(List<Command> cmds) {
cmds.add(new CommandListSprite());
cmds.add(new CommandNope()); cmds.add(new CommandNope());
cmds.add(new CommandPragma()); cmds.add(new CommandPragma());

View File

@ -43,8 +43,8 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
public class AtomSprite extends AbstractAtom implements Atom { public class AtomSprite extends AbstractAtom implements Atom {

View File

@ -39,6 +39,7 @@ import java.awt.font.LineMetrics;
import java.awt.geom.Dimension2D; import java.awt.geom.Dimension2D;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
@ -62,10 +63,10 @@ import net.sourceforge.plantuml.graphic.Splitter;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.openiconic.OpenIcon; import net.sourceforge.plantuml.openiconic.OpenIcon;
import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UText;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
import net.sourceforge.plantuml.utils.CharHidder; import net.sourceforge.plantuml.utils.CharHidder;
public class AtomText extends AbstractAtom implements Atom { public class AtomText extends AbstractAtom implements Atom {
@ -335,6 +336,53 @@ public class AtomText extends AbstractAtom implements Atom {
@Override @Override
public List<Atom> splitInTwo(StringBounder stringBounder, double width) { public List<Atom> splitInTwo(StringBounder stringBounder, double width) {
final StringBuilder tmp = new StringBuilder();
for (String token : splitted()) {
if (tmp.length() > 0 && getWidth(stringBounder, tmp.toString() + token) > width) {
final Atom part1 = new AtomText(tmp.toString(), fontConfiguration, url, marginLeft, marginRight);
String remain = text.substring(tmp.length());
while (remain.startsWith(" ")) {
remain = remain.substring(1);
}
final Atom part2 = new AtomText(remain, fontConfiguration, url, marginLeft, marginRight);
return Arrays.asList(part1, part2);
}
tmp.append(token);
}
return Collections.singletonList((Atom) this);
}
private Collection<String> splitted() {
final List<String> result = new ArrayList<String>();
for (int i = 0; i < text.length(); i++) {
final char ch = text.charAt(i);
if (Character.isLetter(ch)) {
final StringBuilder tmp = new StringBuilder();
tmp.append(ch);
while (i + 1 < text.length() && Character.isLetter(text.charAt(i + 1))) {
i++;
tmp.append(text.charAt(i));
}
result.add(tmp.toString());
} else {
result.add("" + text.charAt(i));
}
}
return result;
}
private Collection<String> splittedOld() {
final List<String> result = new ArrayList<String>();
final StringTokenizer st = new StringTokenizer(text, " ", true);
while (st.hasMoreTokens()) {
final String token = st.nextToken();
result.add(token);
}
return result;
}
private List<Atom> splitInTwoOld(StringBounder stringBounder, double width) {
final StringTokenizer st = new StringTokenizer(text, " ", true); final StringTokenizer st = new StringTokenizer(text, " ", true);
final StringBuilder tmp = new StringBuilder(); final StringBuilder tmp = new StringBuilder();
while (st.hasMoreTokens()) { while (st.hasMoreTokens()) {
@ -358,27 +406,6 @@ public class AtomText extends AbstractAtom implements Atom {
return Arrays.asList(add); return Arrays.asList(add);
} }
private List<String> splitLong2(StringBounder stringBounder, double maxWidth, String add) {
final List<String> result = new ArrayList<String>();
if (getWidth(stringBounder, add) <= maxWidth) {
result.add(add);
return result;
}
final StringBuilder current = new StringBuilder();
for (int i = 0; i < add.length(); i++) {
final char c = add.charAt(i);
if (getWidth(stringBounder, current.toString() + c) > maxWidth) {
result.add(current.toString());
current.setLength(0);
}
current.append(c);
}
if (current.length() > 0) {
result.add(current.toString());
}
return result;
}
public final String getText() { public final String getText() {
return text; return text;
} }

View File

@ -50,7 +50,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.ImgValign; import net.sourceforge.plantuml.graphic.ImgValign;
import net.sourceforge.plantuml.math.ScientificEquationSafe; import net.sourceforge.plantuml.math.ScientificEquationSafe;
import net.sourceforge.plantuml.openiconic.OpenIcon; import net.sourceforge.plantuml.openiconic.OpenIcon;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite; import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.utils.CharHidder; import net.sourceforge.plantuml.utils.CharHidder;
public class StripeSimple implements Stripe { public class StripeSimple implements Stripe {

View File

@ -123,4 +123,9 @@ public class Code implements Comparable<Code> {
return separator; return separator;
} }
public String getLastPart() {
final int x = this.fullName.lastIndexOf(separator);
return this.fullName.substring(x + separator.length());
}
} }

View File

@ -80,7 +80,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
public abstract IEntity getOrCreateLeaf(Code code, LeafType type, USymbol symbol); public abstract IEntity getOrCreateLeaf(Code code, LeafType type, USymbol symbol);
public CucaDiagram(ISkinSimple orig) { public CucaDiagram(ISkinSimple orig) {
super(orig); super(orig);
} }
@ -172,7 +171,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
if (getNamespaceSeparator() != null) { if (getNamespaceSeparator() != null) {
code = getFullyQualifiedCode(code.withSeparator(getNamespaceSeparator())); code = getFullyQualifiedCode(code.withSeparator(getNamespaceSeparator()));
} }
gotoGroupInternal(code, display, code, type, parent); gotoGroupInternalWithNamespace(code, display, code, type, parent);
} else if (strategy == NamespaceStrategy.SINGLE) { } else if (strategy == NamespaceStrategy.SINGLE) {
gotoGroupInternal(code, display, null, type, parent); gotoGroupInternal(code, display, null, type, parent);
} else { } else {
@ -180,6 +179,47 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
} }
} }
protected final String getNamespace(Code fullyCode, String separator) {
String name = fullyCode.getFullName();
if (separator == null) {
throw new IllegalArgumentException(toString());
}
do {
final int x = name.lastIndexOf(separator);
if (x == -1) {
return null;
}
name = name.substring(0, x);
} while (entityFactory.getLeafsget(Code.of(name, separator)) != null);
return name;
}
final protected void gotoGroupInternalWithNamespace(final Code code, Display display, final Code namespace2,
GroupType type, IGroup parent) {
if (getNamespaceSeparator() == null) {
gotoGroupInternal(code, display, namespace2, type, parent);
return;
}
final String namespace = getNamespace(code, getNamespaceSeparator());
if (namespace == null) {
gotoGroupInternal(code, display, namespace2, type, parent);
return;
}
final IGroup realParent = entityFactory.getGroupsget(Code.of(namespace));
if (realParent == null) {
gotoGroupInternal(code, display, namespace2, type, parent);
return;
}
display = Display.create(code.getLastPart());
IGroup result = entityFactory.createGroup(code, display, namespace2, type, realParent, getHides(),
getNamespaceSeparator());
entityFactory.addGroup(result);
currentGroup = result;
}
final protected void gotoGroupInternal(final Code code, Display display, final Code namespace2, GroupType type, final protected void gotoGroupInternal(final Code code, Display display, final Code namespace2, GroupType type,
IGroup parent) { IGroup parent) {
IGroup result = entityFactory.getGroupsget(code); IGroup result = entityFactory.getGroupsget(code);

View File

@ -71,6 +71,7 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.sequencediagram.MessageNumber; import net.sourceforge.plantuml.sequencediagram.MessageNumber;
import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
@ -83,12 +84,12 @@ public class Display implements Iterable<CharSequence> {
public final static Display NULL = new Display(null, null, true, CreoleMode.FULL); public final static Display NULL = new Display(null, null, true, CreoleMode.FULL);
public Display withoutStereotype() { public Display withoutStereotype(Style usedStyle) {
final List<CharSequence> copy = new ArrayList<CharSequence>(displayData); final List<CharSequence> copy = new ArrayList<CharSequence>(displayData);
final Display result = new Display(naturalHorizontalAlignment, isNull, defaultCreoleMode); final Display result = new Display(naturalHorizontalAlignment, isNull, defaultCreoleMode);
for (Iterator<CharSequence> it = copy.iterator(); it.hasNext();) { for (Iterator<CharSequence> it = copy.iterator(); it.hasNext();) {
final CharSequence cs = it.next(); final CharSequence cs = it.next();
if (cs instanceof Stereotype) { if (cs instanceof Stereotype && usedStyle.getSignature().match(((Stereotype) cs))) {
it.remove(); it.remove();
} }
} }

View File

@ -39,7 +39,6 @@ import java.util.EnumMap;
import java.util.Map; import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;

View File

@ -54,6 +54,7 @@ import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.svek.Bibliotekon; import net.sourceforge.plantuml.svek.Bibliotekon;
import net.sourceforge.plantuml.ugraphic.UComment;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.utils.UniqueSequence; import net.sourceforge.plantuml.utils.UniqueSequence;
@ -99,6 +100,28 @@ public class Link extends WithLinkType implements Hideable, Removeable {
private Url url; private Url url;
public String idCommentForSvg() {
if (type.looksLikeRevertedForSvg()) {
final String comment = getEntity1().getCode().getFullName() + "<-" + getEntity2().getCode().getFullName();
return comment;
}
if (type.looksLikeNoDecorAtAllSvg()) {
final String comment = getEntity1().getCode().getFullName() + "-" + getEntity2().getCode().getFullName();
return comment;
}
final String comment = getEntity1().getCode().getFullName() + "->" + getEntity2().getCode().getFullName();
return comment;
}
public UComment commentForSvg() {
if (type.looksLikeRevertedForSvg()) {
return new UComment("reverse link " + getEntity1().getCode().getFullName() + " to "
+ getEntity2().getCode().getFullName());
}
return new UComment("link " + getEntity1().getCode().getFullName() + " to "
+ getEntity2().getCode().getFullName());
}
public Link(IEntity cl1, IEntity cl2, LinkType type, Display label, int length, StyleBuilder styleBuilder) { public Link(IEntity cl1, IEntity cl2, LinkType type, Display label, int length, StyleBuilder styleBuilder) {
this(cl1, cl2, type, label, length, null, null, null, null, null, styleBuilder); this(cl1, cl2, type, label, length, null, null, null, null, null, styleBuilder);
} }

View File

@ -50,6 +50,23 @@ public class LinkType {
return decor1 != LinkDecor.NONE && decor2 != LinkDecor.NONE; return decor1 != LinkDecor.NONE && decor2 != LinkDecor.NONE;
} }
public boolean looksLikeRevertedForSvg() {
if (this.decor1 == LinkDecor.NONE && this.decor2 != LinkDecor.NONE) {
return true;
}
return false;
}
public boolean looksLikeNoDecorAtAllSvg() {
if (this.decor1 == LinkDecor.NONE && this.decor2 == LinkDecor.NONE) {
return true;
}
if (this.decor1 != LinkDecor.NONE && this.decor2 != LinkDecor.NONE) {
return true;
}
return false;
}
public LinkType(LinkDecor decor1, LinkDecor decor2) { public LinkType(LinkDecor decor1, LinkDecor decor2) {
this(LinkHat.NONE, decor1, decor2, LinkHat.NONE); this(LinkHat.NONE, decor1, decor2, LinkHat.NONE);
} }
@ -99,18 +116,6 @@ public class LinkType {
this.hat2 = hat2; this.hat2 = hat2;
} }
// private boolean isDashed() {
// return style == LinkStyle.DASHED;
// }
//
// private boolean isDotted() {
// return style == LinkStyle.DOTTED;
// }
//
// private boolean isBold() {
// return style == LinkStyle.BOLD;
// }
public boolean isInvisible() { public boolean isInvisible() {
return style.isInvisible(); return style.isInvisible();
} }
@ -131,14 +136,6 @@ public class LinkType {
return new LinkType(hat1, decor1, LinkStyle.BOLD(), middleDecor, decor2, hat2); return new LinkType(hat1, decor1, LinkStyle.BOLD(), middleDecor, decor2, hat2);
} }
// public LinkType getInterfaceProvider() {
// return new LinkType(hat1, decor1, LinkStyle.__toremove_INTERFACE_PROVIDER, middleDecor, decor2, hat2);
// }
//
// public LinkType getInterfaceUser() {
// return new LinkType(hat1, decor1, LinkStyle.__toremove_INTERFACE_USER, middleDecor, decor2, hat2);
// }
public LinkType getInversed() { public LinkType getInversed() {
return new LinkType(hat2, decor2, style, middleDecor, decor1, hat1); return new LinkType(hat2, decor2, style, middleDecor, decor1, hat1);
} }

View File

@ -58,12 +58,12 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.sprite.SpriteUtils;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.svek.PackageStyle; import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
import net.sourceforge.plantuml.ugraphic.sprite.SpriteUtils;
public class Stereotype implements CharSequence { public class Stereotype implements CharSequence {
private final static RegexComposed circleChar = new RegexConcat( // private final static RegexComposed circleChar = new RegexConcat( //

View File

@ -89,6 +89,12 @@ public class PSystemDonors extends AbstractPSystem {
+ "b3kGXTfnVAZuJog6mzInmVABPPAYso0dTRs8ErLGzlKlmaaEXSyxHPKTHLoNoZqn8fdO-L6S-TXdJu6R" + "b3kGXTfnVAZuJog6mzInmVABPPAYso0dTRs8ErLGzlKlmaaEXSyxHPKTHLoNoZqn8fdO-L6S-TXdJu6R"
+ "c-1cwePB1FgU_cwOn45jpHSfDGm7GvwAIAETpri3"; + "c-1cwePB1FgU_cwOn45jpHSfDGm7GvwAIAETpri3";
/*
* Special thanks to our sponsors and donors:
*
* - Noam Tamim
*/
@Override @Override
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed)
throws IOException { throws IOException {

View File

@ -218,10 +218,6 @@ public class EpsGraphics {
return dashSpace != 0 && dashVisible != 0; return dashSpace != 0 && dashVisible != 0;
} }
private boolean isDashed4() {
return dashSpace == 0 && dashVisible == 0;
}
public void closepathDot() { public void closepathDot() {
final boolean dashed = isDashed(); final boolean dashed = isDashed();
append("stroke", true); append("stroke", true);
@ -481,15 +477,10 @@ public class EpsGraphics {
if (isDashed3()) { if (isDashed3()) {
append("[" + dashSpace + " " + dashVisible + "] 0 setdash", true); append("[" + dashSpace + " " + dashVisible + "] 0 setdash", true);
} }
if (isDashed4() || fill) { // if (isDashed3() || fill) {
append(format(width) + " " + format(height) + " " + format(x) + " " + format(y) + " simplerect", true); append(format(width) + " " + format(height) + " " + format(x) + " " + format(y) + " simplerect", true);
simplerectUsed = true; simplerectUsed = true;
// } else { // }
// epsVLine(y, x, x + width);
// epsVLine(y + height, x, x + width);
// epsHLine(x, y, y + height);
// epsHLine(x + width, y, y + height);
}
} }
public void epsEllipse(double x, double y, double xRadius, double yRadius, double start, double extend) { public void epsEllipse(double x, double y, double xRadius, double yRadius, double start, double extend) {

View File

@ -37,6 +37,9 @@ package net.sourceforge.plantuml.fun;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -44,19 +47,29 @@ import javax.imageio.ImageIO;
public class IconLoader { public class IconLoader {
private static final int NUMBER_OF_ICONS = 29; private static final int NUMBER_OF_ICONS = 30;
private final static Map<String, BufferedImage> all = new ConcurrentHashMap<String, BufferedImage>(); private final static Map<String, BufferedImage> all = new ConcurrentHashMap<String, BufferedImage>();
static private final List<String> tmp = new ArrayList<String>();
public static BufferedImage getRandom() { public static BufferedImage getRandom() {
// return addTransparent(getIcon("sprite028.png")); // return addTransparent(getIcon("sprite029.png"));
return addTransparent(getIcon(getSomeQuote())); return addTransparent(getIcon(getSomeQuote()));
} }
private static String getSomeQuote() { private static String getSomeQuote() {
final int v = (int) (System.currentTimeMillis() / 1000L); synchronized (tmp) {
final int n = v % NUMBER_OF_ICONS; if (tmp.size() == 0) {
return "sprite" + String.format("%03d", n) + ".png"; for (int i = 0; i < NUMBER_OF_ICONS; i++) {
tmp.add("sprite" + String.format("%03d", i) + ".png");
}
Collections.shuffle(tmp);
}
final int size = tmp.size();
final String result = tmp.get(size - 1);
tmp.remove(size - 1);
return result;
}
} }
private static BufferedImage getIcon(String name) { private static BufferedImage getIcon(String name) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1003 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 770 B

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1011 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 996 B

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

View File

@ -35,7 +35,11 @@
*/ */
package net.sourceforge.plantuml.graphic; package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public enum HorizontalAlignment { public enum HorizontalAlignment {
@ -73,4 +77,17 @@ public enum HorizontalAlignment {
return toString().substring(0, 1).toLowerCase(); return toString().substring(0, 1).toLowerCase();
} }
public void draw(UGraphic ug, TextBlock tb, double padding, Dimension2D dimTotal) {
if (this == HorizontalAlignment.LEFT) {
tb.drawU(ug.apply(new UTranslate(padding, padding)));
} else if (this == HorizontalAlignment.RIGHT) {
final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder());
tb.drawU(ug.apply(new UTranslate(dimTotal.getWidth() - dimTb.getWidth() - padding, padding)));
} else if (this == HorizontalAlignment.CENTER) {
final Dimension2D dimTb = tb.calculateDimension(ug.getStringBounder());
tb.drawU(ug.apply(new UTranslate((dimTotal.getWidth() - dimTb.getWidth()) / 2, padding)));
}
}
} }

View File

@ -35,15 +35,16 @@
*/ */
package net.sourceforge.plantuml.graphic; package net.sourceforge.plantuml.graphic;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.cucadiagram.LinkStyle; import net.sourceforge.plantuml.cucadiagram.LinkStyle;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
public class HtmlColorAndStyle { public class HtmlColorAndStyle {
private final static Rose rose = new Rose();
private final HtmlColor color; private final HtmlColor color;
private final LinkStyle style; private final LinkStyle style;
@ -52,18 +53,7 @@ public class HtmlColorAndStyle {
return color + " " + style; return color + " " + style;
} }
public static Rainbow fromColor(HtmlColor color) { public HtmlColorAndStyle(HtmlColor color) {
if (color == null) {
return Rainbow.none();
}
return Rainbow.build(new HtmlColorAndStyle(color));
}
public static Rainbow build(ISkinParam skinParam) {
return fromColor(rose.getHtmlColor(skinParam, ColorParam.arrow));
}
private HtmlColorAndStyle(HtmlColor color) {
this(color, LinkStyle.NORMAL()); this(color, LinkStyle.NORMAL());
} }
@ -83,8 +73,18 @@ public class HtmlColorAndStyle {
return style; return style;
} }
static final public StyleSignature getDefaultStyleDefinitionArrow() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
}
public static HtmlColorAndStyle build(ISkinParam skinParam, String definition) { public static HtmlColorAndStyle build(ISkinParam skinParam, String definition) {
HtmlColor color = build(skinParam).getColors().get(0).color; HtmlColor color;
if (SkinParam.USE_STYLES()) {
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam.getCurrentStyleBuilder());
color = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
} else {
color = Rainbow.build(skinParam).getColors().get(0).color;
}
LinkStyle style = LinkStyle.NORMAL(); LinkStyle style = LinkStyle.NORMAL();
final IHtmlColorSet set = skinParam.getIHtmlColorSet(); final IHtmlColorSet set = skinParam.getIHtmlColorSet();
for (String s : definition.split(",")) { for (String s : definition.split(",")) {

Some files were not shown because too many files have changed in this diff Show More