1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-05-28 14:10:48 +00:00

Change default theme

This commit is contained in:
Arnaud Roques 2022-02-10 19:16:18 +01:00
parent edacfb5dbc
commit 4534dc4ee2
227 changed files with 3664 additions and 2875 deletions

View File

@ -8,19 +8,19 @@ root {
RoundCorner 0 RoundCorner 0
DiagonalCorner 0 DiagonalCorner 0
LineThickness 1.0 LineThickness 1.0
LineColor #A80036 LineColor #181818
BackGroundColor #FEFECE BackGroundColor #f8f8f8
Shadowing 0.0 Shadowing 0.0
} }
document { document {
BackGroundColor White BackGroundColor white
header { header {
HorizontalAlignment right HorizontalAlignment right
FontSize 10 FontSize 10
FontColor #888888 FontColor #8
BackGroundColor none BackGroundColor transparent
LineColor none LineColor transparent
} }
title { title {
HorizontalAlignment center HorizontalAlignment center
@ -28,19 +28,19 @@ document {
FontStyle bold FontStyle bold
Padding 5 Padding 5
Margin 5 Margin 5
LineColor none LineColor transparent
BackGroundColor none BackGroundColor transparent
} }
footer { footer {
HorizontalAlignment center HorizontalAlignment center
FontSize 10 FontSize 10
FontColor #888888 FontColor #8
BackGroundColor none BackGroundColor transparent
LineColor none LineColor transparent
} }
legend { legend {
LineColor black LineColor black
BackGroundColor #DDDDDD BackGroundColor #D
FontSize 14 FontSize 14
RoundCorner 15 RoundCorner 15
Padding 6 Padding 6
@ -51,8 +51,12 @@ document {
FontSize 14 FontSize 14
Padding 0 Padding 0
Margin 1 Margin 1
LineColor none LineColor transparent
BackGroundColor none BackGroundColor transparent
}
frame {
LineColor black
LineThickness 1.5
} }
} }
@ -63,60 +67,12 @@ stereotype {
element { element {
Shadowing 4.0 Shadowing 0.0
title { title {
FontStyle bold FontStyle bold
} }
} }
artifact {
Shadowing 4.0
}
node {
Shadowing 2.0
}
person {
Shadowing 2.0
}
queue {
Shadowing 2.0
}
rectangle {
Shadowing 3.0
}
stack {
Shadowing 3.0
}
storage {
Shadowing 3.0
}
boundary {
Shadowing 4.0
}
card {
Shadowing 3.0
}
cloud {
Shadowing 3.0
}
collections {
Shadowing 3.0
}
component {
Shadowing 4.0
}
database {
Shadowing 3.0
}
file {
Shadowing 3.0
}
frame {
Shadowing 3.0
}
folder {
Shadowing 3.0
}
group { group {
package { package {
LineThickness 1.5 LineThickness 1.5
@ -141,7 +97,7 @@ sequenceDiagram {
} }
groupHeader { groupHeader {
BackGroundColor #EEEEEE BackGroundColor #e
LineColor black LineColor black
FontSize 13 FontSize 13
FontStyle bold FontStyle bold
@ -152,6 +108,41 @@ sequenceDiagram {
LineStyle 5 LineStyle 5
} }
destroy {
}
reference {
FontSize 12
LineColor black
BackGroundColor transparent
LineThickness 2.0
HorizontalAlignment center
}
referenceHeader {
LineColor black
BackGroundColor #e
FontColor black
FontSize 13
FontStyle bold
LineThickness 2.0
}
box {
BackGroundColor #d
FontSize 13
FontStyle bold
}
separator {
LineColor black
LineThickness 2.0
BackGroundColor #e
FontSize 13
FontStyle bold
}
} }
classDiagram { classDiagram {
@ -214,42 +205,6 @@ stateDiagram {
} }
destroy {
}
reference {
FontSize 12
LineColor black
BackGroundColor while
LineThickness 2.0
HorizontalAlignment center
}
referenceHeader {
LineColor black
BackGroundColor #EEEEEE
FontColor black
FontSize 13
FontStyle bold
LineThickness 2.0
}
box {
BackGroundColor #DDDDDD
FontSize 13
FontStyle bold
}
separator {
LineColor black
LineThickness 2.0
BackGroundColor #EEEEEE
FontSize 13
FontStyle bold
}
delay { delay {
FontSize 11 FontSize 11
FontStyle plain FontStyle plain
@ -302,17 +257,13 @@ swimlane {
FontSize 18 FontSize 18
} }
diamond {
Shadowing 3.0
}
arrow { arrow {
FontSize 13 FontSize 13
} }
note { note {
FontSize 13 FontSize 13
BackGroundColor #FBFB77 BackGroundColor #ebebeb
} }
partition { partition {
@ -345,10 +296,6 @@ wbsDiagram {
FontSize 12 FontSize 12
} }
activityDiagram {
Shadowing 3.0
}
activityDiagram { activityDiagram {
activity { activity {
LineThickness 1.5 LineThickness 1.5
@ -366,16 +313,23 @@ activityDiagram {
arrow { arrow {
FontSize 11 FontSize 11
} }
} circle {
start {
activityBar { LineColor #2
Shadowing 3.0 BackgroundColor #2
BackgroundColor black }
} stop {
LineColor #2
circle { BackgroundColor transparent
LineColor black }
Shadowing 3.0 end {
LineColor #2
BackgroundColor transparent
}
}
activityBar {
BackgroundColor #5
}
} }
@ -395,7 +349,6 @@ ganttDiagram {
} }
note { note {
FontSize 9 FontSize 9
Shadowing 0.0
} }
separator { separator {
FontSize 11 FontSize 11
@ -409,8 +362,8 @@ ganttDiagram {
LineColor #C0C0C0 LineColor #C0C0C0
} }
closed { closed {
BackGroundColor #E0E8E8 BackGroundColor #E0E0E0
FontColor #909898 FontColor #989898
} }
task { task {
RoundCorner 0 RoundCorner 0
@ -456,27 +409,250 @@ yamlDiagram,jsonDiagram {
timingDiagram { timingDiagram {
LineColor #3
FontColor #3
FontStyle bold
LineThickness 1.5
timeline {
FontStyle plain
FontSize 11
}
arrow { arrow {
LineColor darkblue
LineThickness 1.5 LineThickness 1.5
} }
constraintArrow { constraintArrow {
FontSize 12
FontStyle plain
FontColor darkred
LineColor darkred
LineThickness 1.5 LineThickness 1.5
} }
clock {
LineColor darkgreen
}
concise {
FontSize 12
LineColor darkgreen
BackgroundColor #c
}
robust {
FontStyle plain
FontSize 12
LineColor darkgreen
LineThickness 2
BackgroundColor #c
}
highlight {
BackgroundColor #e
LineThickness 2
LineStyle 4;4
}
} }
nwdiagDiagram { nwdiagDiagram {
network { network {
FontSize 12 FontSize 12
Shadowing 1.0
} }
server { server {
FontSize 12 FontSize 12
} }
group { group {
FontSize 12 FontSize 12
BackGroundColor #ddd BackGroundColor #d
} }
arrow { arrow {
FontSize 11 FontSize 11
} }
} }
@media (prefers-color-scheme:dark) {
root {
HyperLinkColor blue
FontColor white
LineColor #e7e7e7
BackGroundColor #070707
}
document {
BackGroundColor black
header {
FontColor #7
}
footer {
FontColor #7
}
legend {
LineColor white
BackGroundColor #2
}
frame {
LineColor white
}
}
group {
package {
LineColor white
}
folder {
LineColor white
}
}
sequenceDiagram {
group {
LineColor white
}
groupHeader {
BackGroundColor #5
LineColor white
}
lifeLine {
BackGroundColor black
}
reference {
LineColor #d
}
referenceHeader {
LineColor #d
FontColor white
BackGroundColor #4
}
box {
BackGroundColor #2
}
separator {
LineColor white
BackGroundColor #1
}
}
spot {
spotAnnotation {
BackgroundColor #4A0000
}
spotAbstractClass {
BackgroundColor #2A5D60
}
spotClass {
BackgroundColor #2E5233
}
spotInterface {
BackgroundColor #352866
}
spotEnum {
BackgroundColor #852D19
}
spotEntity {
BackgroundColor #2E5233
}
}
swimlane {
LineColor white
}
note {
BackGroundColor #3
}
activityDiagram {
partition {
LineColor white
}
circle {
start {
LineColor #d
BackgroundColor #d
}
stop {
LineColor #d
BackgroundColor transparent
}
end {
LineColor #d
BackgroundColor transparent
}
}
activityBar {
BackgroundColor #a
}
}
milestone {
BackGroundColor white
LineColor white
}
timingDiagram {
LineColor #d
FontColor #d
arrow {
LineColor lightblue
}
constraintArrow {
LineColor tomato
FontColor tomato
}
clock {
LineColor lightgreen
}
concise {
LineColor lightgreen
BackgroundColor #6
}
robust {
LineColor lightgreen
BackgroundColor #3
}
highlight {
BackgroundColor #1
}
}
ganttDiagram {
timeline {
LineColor #3f3f3f
}
closed {
BackGroundColor #1f1f1f
FontColor #676767
}
undone {
BackGroundColor black
}
}
yamlDiagram,jsonDiagram {
BackGroundColor black
FontColor white
LineColor white
node {
highlight {
BackGroundColor #ccff02
}
}
nwdiagDiagram {
group {
BackGroundColor #2
}
}
}

View File

@ -8,19 +8,19 @@ root {
RoundCorner 0 RoundCorner 0
DiagonalCorner 0 DiagonalCorner 0
LineThickness 1.0 LineThickness 1.0
LineColor #181818 LineColor #A80036
BackGroundColor #f8f8f8 BackGroundColor #FEFECE
Shadowing 0.0 Shadowing 0.0
} }
document { document {
BackGroundColor White BackGroundColor white
header { header {
HorizontalAlignment right HorizontalAlignment right
FontSize 10 FontSize 10
FontColor #888888 FontColor #8
BackGroundColor none BackGroundColor transparent
LineColor none LineColor transparent
} }
title { title {
HorizontalAlignment center HorizontalAlignment center
@ -28,19 +28,19 @@ document {
FontStyle bold FontStyle bold
Padding 5 Padding 5
Margin 5 Margin 5
LineColor none LineColor transparent
BackGroundColor none BackGroundColor transparent
} }
footer { footer {
HorizontalAlignment center HorizontalAlignment center
FontSize 10 FontSize 10
FontColor #888888 FontColor #8
BackGroundColor none BackGroundColor transparent
LineColor none LineColor transparent
} }
legend { legend {
LineColor black LineColor black
BackGroundColor #DDDDDD BackGroundColor #d
FontSize 14 FontSize 14
RoundCorner 15 RoundCorner 15
Padding 6 Padding 6
@ -51,8 +51,12 @@ document {
FontSize 14 FontSize 14
Padding 0 Padding 0
Margin 1 Margin 1
LineColor none LineColor transparent
BackGroundColor none BackGroundColor transparent
}
frame {
LineColor black
LineThickness 1.5
} }
} }
@ -63,12 +67,60 @@ stereotype {
element { element {
Shadowing 0.0 Shadowing 4.0
title { title {
FontStyle bold FontStyle bold
} }
} }
artifact {
Shadowing 4.0
}
node {
Shadowing 2.0
}
person {
Shadowing 2.0
}
queue {
Shadowing 2.0
}
rectangle {
Shadowing 3.0
}
stack {
Shadowing 3.0
}
storage {
Shadowing 3.0
}
boundary {
Shadowing 4.0
}
card {
Shadowing 3.0
}
cloud {
Shadowing 3.0
}
collections {
Shadowing 3.0
}
component {
Shadowing 4.0
}
database {
Shadowing 3.0
}
file {
Shadowing 3.0
}
frame {
Shadowing 3.0
}
folder {
Shadowing 3.0
}
group { group {
package { package {
LineThickness 1.5 LineThickness 1.5
@ -93,7 +145,7 @@ sequenceDiagram {
} }
groupHeader { groupHeader {
BackGroundColor #EEEEEE BackGroundColor #e
LineColor black LineColor black
FontSize 13 FontSize 13
FontStyle bold FontStyle bold
@ -104,6 +156,42 @@ sequenceDiagram {
LineStyle 5 LineStyle 5
} }
destroy {
}
reference {
FontSize 12
LineColor black
BackGroundColor white
LineThickness 2.0
HorizontalAlignment center
}
referenceHeader {
LineColor black
BackGroundColor #e
FontColor black
FontSize 13
FontStyle bold
LineThickness 2.0
}
box {
BackGroundColor #d
FontSize 13
FontStyle bold
}
separator {
LineColor black
LineThickness 2.0
BackGroundColor #e
FontSize 13
FontStyle bold
}
} }
classDiagram { classDiagram {
@ -166,42 +254,6 @@ stateDiagram {
} }
destroy {
}
reference {
FontSize 12
LineColor black
BackGroundColor while
LineThickness 2.0
HorizontalAlignment center
}
referenceHeader {
LineColor black
BackGroundColor #EEEEEE
FontColor black
FontSize 13
FontStyle bold
LineThickness 2.0
}
box {
BackGroundColor #DDDDDD
FontSize 13
FontStyle bold
}
separator {
LineColor black
LineThickness 2.0
BackGroundColor #EEEEEE
FontSize 13
FontStyle bold
}
delay { delay {
FontSize 11 FontSize 11
FontStyle plain FontStyle plain
@ -254,13 +306,17 @@ swimlane {
FontSize 18 FontSize 18
} }
diamond {
Shadowing 3.0
}
arrow { arrow {
FontSize 13 FontSize 13
} }
note { note {
FontSize 13 FontSize 13
BackGroundColor #ebebeb BackGroundColor #FBFB77
} }
partition { partition {
@ -293,6 +349,10 @@ wbsDiagram {
FontSize 12 FontSize 12
} }
activityDiagram {
Shadowing 3.0
}
activityDiagram { activityDiagram {
activity { activity {
LineThickness 1.5 LineThickness 1.5
@ -310,14 +370,24 @@ activityDiagram {
arrow { arrow {
FontSize 11 FontSize 11
} }
} circle {
start {
activityBar { LineColor black
BackgroundColor black BackgroundColor black
} }
stop {
circle { LineColor black
LineColor black BackgroundColor white
}
end {
LineColor black
BackgroundColor white
}
}
activityBar {
Shadowing 3.0
BackgroundColor black
}
} }
@ -337,6 +407,7 @@ ganttDiagram {
} }
note { note {
FontSize 9 FontSize 9
Shadowing 0.0
} }
separator { separator {
FontSize 11 FontSize 11
@ -397,17 +468,51 @@ yamlDiagram,jsonDiagram {
timingDiagram { timingDiagram {
LineColor #3
FontColor #3
FontStyle bold
LineThickness 1.5
timeline {
FontStyle plain
FontSize 11
}
arrow { arrow {
LineColor darkblue
LineThickness 1.5 LineThickness 1.5
} }
constraintArrow { constraintArrow {
FontSize 12
FontStyle plain
FontColor darkred
LineColor darkred
LineThickness 1.5 LineThickness 1.5
} }
clock {
LineColor darkgreen
}
concise {
FontSize 12
LineColor darkgreen
BackgroundColor #c
}
robust {
FontStyle plain
FontSize 12
LineColor darkgreen
LineThickness 2
BackgroundColor #c
}
highlight {
BackgroundColor #e
LineThickness 2
LineStyle 4;4
}
} }
nwdiagDiagram { nwdiagDiagram {
network { network {
FontSize 12 FontSize 12
Shadowing 1.0
} }
server { server {
FontSize 12 FontSize 12
@ -420,33 +525,3 @@ nwdiagDiagram {
FontSize 11 FontSize 11
} }
} }
@media (prefers-color-scheme:dark) {
element {
LineColor #e7e7e7
BackGroundColor #070707
FontColor white
}
spot {
spotAnnotation {
BackgroundColor #4A0000
}
spotAbstractClass {
BackgroundColor #2A5D60
}
spotClass {
BackgroundColor #2E5233
}
spotInterface {
BackgroundColor #352866
}
spotEnum {
BackgroundColor #852D19
}
spotEntity {
BackgroundColor #2E5233
}
}
}

View File

@ -21,7 +21,7 @@ package jcckit.util;
import java.awt.Color; import java.awt.Color;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException; import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
@ -306,7 +306,7 @@ static private HColorSet colors = HColorSet.instance();
private Color decodeInternal(String value) { private Color decodeInternal(String value) {
if (value!=null) { if (value!=null) {
try { try {
return new ColorMapperIdentity().toColor(colors.getColor(ThemeStyle.LIGHT, value, null)); return new ColorMapperIdentity().toColor(colors.getColor(ThemeStyle.LIGHT_REGULAR, value, null));
} catch (NoSuchColorException e) { } catch (NoSuchColorException e) {
return Color.WHITE; return Color.WHITE;
} }

View File

@ -50,6 +50,7 @@ import net.sourceforge.plantuml.graphic.SymbolContext;
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.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.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.StyleSignature;
@ -57,6 +58,7 @@ 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;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
@ -88,22 +90,39 @@ public class AnnotatedWorker {
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)
return original; return original;
}
final double x1 = 5; final double x1 = 5;
final double x2 = 7; final double x2 = 7;
final double y1 = 10; final double y1 = 10;
final double y2 = 10; final double y2 = 10;
final SymbolContext symbolContext = new SymbolContext(getBackgroundColor(), HColorUtils.BLACK) final double deltaShadow;
.withShadow(getSkinParam().shadowing(null) ? 3 : 0); final FontConfiguration fontConfiguration;
final UStroke stroke;
final HColor borderColor;
if (UseStyle.useBetaStyle()) {
final Style style = StyleSignature.of(SName.root, SName.document, SName.frame)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
deltaShadow = style.value(PName.Shadowing).asDouble();
fontConfiguration = new FontConfiguration(getSkinParam(), style);
stroke = style.getStroke();
borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
} else {
deltaShadow = getSkinParam().shadowing(null) ? 3 : 0;
fontConfiguration = new FontConfiguration(getSkinParam(), FontParam.CAPTION, null);
stroke = new UStroke();
borderColor = HColorUtils.BLACK;
}
final SymbolContext symbolContext = new SymbolContext(getBackgroundColor(), borderColor).withShadow(deltaShadow)
.withStroke(stroke);
final MinMax originalMinMax = TextBlockUtils.getMinMax(original, stringBounder, false); final MinMax originalMinMax = TextBlockUtils.getMinMax(original, stringBounder, false);
final TextBlock title = mainFrame.create(new FontConfiguration(getSkinParam(), FontParam.CAPTION, null),
HorizontalAlignment.CENTER, getSkinParam()); final TextBlock title = mainFrame.create(fontConfiguration, HorizontalAlignment.CENTER, getSkinParam());
final Dimension2D dimTitle = title.calculateDimension(stringBounder); final Dimension2D dimTitle = title.calculateDimension(stringBounder);
// final Dimension2D dimOriginal = original.calculateDimension(stringBounder);
final double width = x1 + Math.max(originalMinMax.getWidth(), dimTitle.getWidth()) + x2; final double width = x1 + Math.max(originalMinMax.getWidth(), dimTitle.getWidth()) + x2;
final double height = dimTitle.getHeight() + y1 + originalMinMax.getHeight() + y2; final double height = dimTitle.getHeight() + y1 + originalMinMax.getHeight() + y2;
final TextBlock frame = USymbol.FRAME.asBig(title, HorizontalAlignment.LEFT, TextBlockUtils.empty(0, 0), width, final TextBlock frame = USymbol.FRAME.asBig(title, HorizontalAlignment.LEFT, TextBlockUtils.empty(0, 0), width,
@ -143,9 +162,9 @@ public class AnnotatedWorker {
private TextBlock addLegend(TextBlock original) { private TextBlock addLegend(TextBlock original) {
final DisplayPositioned legend = annotated.getLegend(); final DisplayPositioned legend = annotated.getLegend();
if (legend.isNull()) { if (legend.isNull())
return original; return original;
}
final TextBlock text = EntityImageLegend.create(legend.getDisplay(), getSkinParam()); final TextBlock text = EntityImageLegend.create(legend.getDisplay(), getSkinParam());
return DecorateEntityImage.add(original, text, legend.getHorizontalAlignment(), legend.getVerticalAlignment()); return DecorateEntityImage.add(original, text, legend.getHorizontalAlignment(), legend.getVerticalAlignment());
@ -157,18 +176,18 @@ public class AnnotatedWorker {
private TextBlock addCaption(TextBlock original) { private TextBlock addCaption(TextBlock original) {
final DisplayPositioned caption = annotated.getCaption(); final DisplayPositioned caption = annotated.getCaption();
if (caption.isNull()) { if (caption.isNull())
return original; return original;
}
final TextBlock text = getCaption(); final TextBlock text = getCaption();
return DecorateEntityImage.addBottom(original, text, HorizontalAlignment.CENTER); return DecorateEntityImage.addBottom(original, text, HorizontalAlignment.CENTER);
} }
public TextBlock getCaption() { public TextBlock getCaption() {
final DisplayPositioned caption = annotated.getCaption(); final DisplayPositioned caption = annotated.getCaption();
if (caption.isNull()) { if (caption.isNull())
return TextBlockUtils.empty(0, 0); return TextBlockUtils.empty(0, 0);
}
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle()) {
final Style style = StyleSignature.of(SName.root, SName.document, SName.caption) final Style style = StyleSignature.of(SName.root, SName.document, SName.caption)
.getMergedStyle(skinParam.getCurrentStyleBuilder()); .getMergedStyle(skinParam.getCurrentStyleBuilder());
@ -180,9 +199,8 @@ public class AnnotatedWorker {
private TextBlock addTitle(TextBlock original) { private TextBlock addTitle(TextBlock original) {
final DisplayPositioned title = (DisplayPositioned) annotated.getTitle(); final DisplayPositioned title = (DisplayPositioned) annotated.getTitle();
if (title.isNull()) { if (title.isNull())
return original; return original;
}
final TextBlock block; final TextBlock block;
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle()) {
@ -201,9 +219,9 @@ public class AnnotatedWorker {
private TextBlock addHeaderAndFooter(TextBlock original) { private TextBlock addHeaderAndFooter(TextBlock original) {
final DisplaySection footer = annotated.getFooter(); final DisplaySection footer = annotated.getFooter();
final DisplaySection header = annotated.getHeader(); final DisplaySection header = annotated.getHeader();
if (footer.isNull() && header.isNull()) { if (footer.isNull() && header.isNull())
return original; return original;
}
TextBlock textFooter = null; TextBlock textFooter = null;
if (footer.isNull() == false) { if (footer.isNull() == false) {
Style style = null; Style style = null;

View File

@ -48,6 +48,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.code.AsciiEncoder; import net.sourceforge.plantuml.code.AsciiEncoder;
import net.sourceforge.plantuml.code.Transcoder; import net.sourceforge.plantuml.code.Transcoder;
import net.sourceforge.plantuml.code.TranscoderUtil; import net.sourceforge.plantuml.code.TranscoderUtil;
@ -70,13 +71,14 @@ public class BlockUml {
private final Defines localDefines; private final Defines localDefines;
private final ISkinSimple skinParam; private final ISkinSimple skinParam;
private final Set<FileWithSuffix> included = new HashSet<>(); private final Set<FileWithSuffix> included = new HashSet<>();
private final ThemeStyle style;
public Set<FileWithSuffix> getIncluded() { public Set<FileWithSuffix> getIncluded() {
return Collections.unmodifiableSet(included); return Collections.unmodifiableSet(included);
} }
BlockUml(String... strings) { BlockUml(ThemeStyle style, String... strings) {
this(convert(strings), Defines.createEmpty(), null, null, null); this(style, convert(strings), Defines.createEmpty(), null, null, null);
} }
public String getEncodedUrl() throws IOException { public String getEncodedUrl() throws IOException {
@ -113,21 +115,24 @@ public class BlockUml {
private boolean preprocessorError; private boolean preprocessorError;
/** /**
* @deprecated being kept for backwards compatibility, perhaps other projects are using this? * @deprecated being kept for backwards compatibility, perhaps other projects
* are using this?
*/ */
@Deprecated @Deprecated
public BlockUml(List<StringLocated> strings, Defines defines, ISkinSimple skinParam, PreprocessorModeSet mode) { public BlockUml(List<StringLocated> strings, Defines defines, ISkinSimple skinParam, PreprocessorModeSet mode) {
this(strings, defines, skinParam, mode, charsetOrDefault(mode.getCharset())); this(ThemeStyle.LIGHT_REGULAR, strings, defines, skinParam, mode, charsetOrDefault(mode.getCharset()));
} }
public BlockUml(List<StringLocated> strings, Defines defines, ISkinSimple skinParam, PreprocessorModeSet mode, Charset charset) { public BlockUml(ThemeStyle style, List<StringLocated> strings, Defines defines, ISkinSimple skinParam,
PreprocessorModeSet mode, Charset charset) {
this.style = style;
this.rawSource = new ArrayList<>(strings); this.rawSource = new ArrayList<>(strings);
this.localDefines = defines; this.localDefines = defines;
this.skinParam = skinParam; this.skinParam = skinParam;
final String s0 = strings.get(0).getTrimmed().getString(); final String s0 = strings.get(0).getTrimmed().getString();
if (StartUtils.startsWithSymbolAnd("start", s0) == false) { if (StartUtils.startsWithSymbolAnd("start", s0) == false)
throw new IllegalArgumentException(); throw new IllegalArgumentException();
}
if (mode == null) { if (mode == null) {
this.data = new ArrayList<>(strings); this.data = new ArrayList<>(strings);
} else { } else {
@ -141,39 +146,38 @@ public class BlockUml {
} }
public String getFileOrDirname() { public String getFileOrDirname() {
if (OptionFlags.getInstance().isWord()) { if (OptionFlags.getInstance().isWord())
return null; return null;
}
final Matcher2 m = StartUtils.patternFilename.matcher(StringUtils.trin(data.get(0).getString())); final Matcher2 m = StartUtils.patternFilename.matcher(StringUtils.trin(data.get(0).getString()));
final boolean ok = m.find(); final boolean ok = m.find();
if (ok == false) { if (ok == false)
return null; return null;
}
String result = m.group(1); String result = m.group(1);
final int x = result.indexOf(','); final int x = result.indexOf(',');
if (x != -1) { if (x != -1)
result = result.substring(0, x); result = result.substring(0, x);
}
for (int i = 0; i < result.length(); i++) { for (int i = 0; i < result.length(); i++) {
final char c = result.charAt(i); final char c = result.charAt(i);
if ("<>|".indexOf(c) != -1) { if ("<>|".indexOf(c) != -1)
return null; return null;
}
} }
if (result.startsWith("file://")) { if (result.startsWith("file://"))
result = result.substring("file://".length()); result = result.substring("file://".length());
}
result = result.replaceAll("\\.\\w\\w\\w$", ""); result = result.replaceAll("\\.\\w\\w\\w$", "");
return result; return result;
} }
public Diagram getDiagram() { public Diagram getDiagram() {
if (system == null) { if (system == null) {
if (preprocessorError) { if (preprocessorError)
system = new PSystemErrorPreprocessor(data, debug); system = new PSystemErrorPreprocessor(data, debug);
} else { else
system = new PSystemBuilder().createPSystem(skinParam, data, rawSource); system = new PSystemBuilder().createPSystem(style, skinParam, data, rawSource);
}
} }
return system; return system;
} }
@ -186,9 +190,9 @@ public class BlockUml {
try { try {
final AsciiEncoder coder = new AsciiEncoder(); final AsciiEncoder coder = new AsciiEncoder();
final MessageDigest msgDigest = MessageDigest.getInstance("MD5"); final MessageDigest msgDigest = MessageDigest.getInstance("MD5");
for (StringLocated s : data) { for (StringLocated s : data)
msgDigest.update(s.getString().getBytes(UTF_8)); msgDigest.update(s.getString().getBytes(UTF_8));
}
final byte[] digest = msgDigest.digest(); final byte[] digest = msgDigest.digest();
return coder.encode(digest); return coder.encode(digest);
} catch (Exception e) { } catch (Exception e) {
@ -212,12 +216,12 @@ public class BlockUml {
public List<String> getDefinition(boolean withHeader) { public List<String> getDefinition(boolean withHeader) {
final List<String> result = new ArrayList<>(); final List<String> result = new ArrayList<>();
for (StringLocated s : data) { for (StringLocated s : data)
result.add(s.getString()); result.add(s.getString());
}
if (withHeader) { if (withHeader)
return Collections.unmodifiableList(result); return Collections.unmodifiableList(result);
}
return Collections.unmodifiableList(result.subList(1, result.size() - 1)); return Collections.unmodifiableList(result.subList(1, result.size() - 1));
} }

View File

@ -47,6 +47,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.preproc.FileWithSuffix; import net.sourceforge.plantuml.preproc.FileWithSuffix;
import net.sourceforge.plantuml.preproc.ImportedFiles; import net.sourceforge.plantuml.preproc.ImportedFiles;
@ -65,25 +66,36 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
private final Defines defines; private final Defines defines;
private final ImportedFiles importedFiles; private final ImportedFiles importedFiles;
private final Charset charset; private final Charset charset;
private final ThemeStyle style;
/** /**
* @deprecated being kept for backwards compatibility, perhaps other projects are using this? * @deprecated being kept for backwards compatibility, perhaps other projects
* are using this?
*/ */
@Deprecated @Deprecated
public BlockUmlBuilder(List<String> config, String charset, Defines defines, Reader readerInit, SFile newCurrentDir, public BlockUmlBuilder(List<String> config, String charset, Defines defines, Reader readerInit, SFile newCurrentDir,
String desc) throws IOException { String desc) throws IOException {
this(ThemeStyle.LIGHT_REGULAR, config, charsetOrDefault(charset), defines, readerInit, newCurrentDir, desc);
this(config, charsetOrDefault(charset), defines, readerInit, newCurrentDir, desc);
} }
public BlockUmlBuilder(List<String> config, Charset charset, Defines defines, Reader readerInit, SFile newCurrentDir, /**
String desc) throws IOException { * @deprecated being kept for backwards compatibility, perhaps other projects
* are using this?
*/
@Deprecated
public BlockUmlBuilder(List<String> config, String charset, Defines defines, Reader reader) throws IOException {
this(config, charset, defines, reader, null, null);
}
public BlockUmlBuilder(ThemeStyle style, List<String> config, Charset charset, Defines defines, Reader readerInit,
SFile newCurrentDir, String desc) throws IOException {
this.style = style;
this.defines = defines; this.defines = defines;
this.charset = requireNonNull(charset); this.charset = requireNonNull(charset);
this.reader = new UncommentReadLine(ReadLineReader.create(readerInit, desc)); this.reader = new UncommentReadLine(ReadLineReader.create(readerInit, desc));
this.importedFiles = ImportedFiles.createImportedFiles(new AParentFolderRegular(newCurrentDir)); this.importedFiles = ImportedFiles.createImportedFiles(new AParentFolderRegular(newCurrentDir));
try (ReadLineNumbered includer = new Preprocessor(config, reader)) { try (ReadLineNumbered includer = new Preprocessor(config, reader)) {
init(includer); init(includer);
} finally { } finally {
@ -91,14 +103,6 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
} }
} }
/**
* @deprecated being kept for backwards compatibility, perhaps other projects are using this?
*/
@Deprecated
public BlockUmlBuilder(List<String> config, String charset, Defines defines, Reader reader) throws IOException {
this(config, charset, defines, reader, null, null);
}
private void init(ReadLineNumbered includer) throws IOException { private void init(ReadLineNumbered includer) throws IOException {
StringLocated s = null; StringLocated s = null;
List<StringLocated> current = null; List<StringLocated> current = null;
@ -121,9 +125,9 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
current.add(s); current.add(s);
} else if (paused) { } else if (paused) {
final StringLocated append = StartUtils.getPossibleAppend(s); final StringLocated append = StartUtils.getPossibleAppend(s);
if (append != null) { if (append != null)
current.add(append); current.add(append);
}
} }
if (StartUtils.isArobaseUnpauseDiagram(s.getString())) { if (StartUtils.isArobaseUnpauseDiagram(s.getString())) {
@ -131,10 +135,10 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
reader.setPaused(false); reader.setPaused(false);
} }
if (StartUtils.isArobaseEndDiagram(s.getString()) && current != null) { if (StartUtils.isArobaseEndDiagram(s.getString()) && current != null) {
if (paused) { if (paused)
current.add(s); current.add(s);
}
final BlockUml uml = new BlockUml(current, defines.cloneMe(), null, this, charset); final BlockUml uml = new BlockUml(style, current, defines.cloneMe(), null, this, charset);
usedFiles.addAll(uml.getIncluded()); usedFiles.addAll(uml.getIncluded());
blocks.add(uml); blocks.add(uml);
current = null; current = null;
@ -152,11 +156,10 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
} }
public List<String> getDefinition(String name) { public List<String> getDefinition(String name) {
for (BlockUml block : blocks) { for (BlockUml block : blocks)
if (block.isStartDef(name)) { if (block.isStartDef(name))
return block.getDefinition(false); return block.getDefinition(false);
}
}
return Collections.emptyList(); return Collections.emptyList();
} }
@ -165,7 +168,8 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
} }
/** /**
* @deprecated being kept for backwards compatibility, perhaps other projects are using this? * @deprecated being kept for backwards compatibility, perhaps other projects
* are using this?
*/ */
@Deprecated @Deprecated
public final String getCharset() { public final String getCharset() {

View File

@ -200,7 +200,8 @@ public class EmbeddedDiagram implements CharSequence {
} }
private Diagram getSystem() throws IOException, InterruptedException { private Diagram getSystem() throws IOException, InterruptedException {
final BlockUml blockUml = new BlockUml(system.as2(), Defines.createEmpty(), skinParam, null, null); final BlockUml blockUml = new BlockUml(skinParam.getThemeStyle(), system.as2(), Defines.createEmpty(),
skinParam, null, null);
return blockUml.getDiagram(); return blockUml.getDiagram();
} }

View File

@ -39,6 +39,7 @@ import java.awt.geom.AffineTransform;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
/** /**
@ -59,23 +60,23 @@ public final class FileFormatOption implements Serializable {
private final double scale; private final double scale;
private final String preserveAspectRatio; private final String preserveAspectRatio;
private final String watermark; private final String watermark;
private final ThemeStyle style;
public double getScaleCoef() { public double getScaleCoef() {
return scale; return scale;
} }
public FileFormatOption(FileFormat fileFormat) { public FileFormatOption(FileFormat fileFormat) {
this(fileFormat, true, false, null, false, null, TikzFontDistortion.getDefault(), 1.0, null, null); this(fileFormat, true, false, null, false, null, TikzFontDistortion.getDefault(), 1.0, null, null, ThemeStyle.LIGHT_REGULAR);
} }
public FileFormatOption(FileFormat fileFormat, boolean withMetadata) { public FileFormatOption(FileFormat fileFormat, boolean withMetadata) {
this(fileFormat, withMetadata, false, null, false, null, TikzFontDistortion.getDefault(), 1.0, null, this(fileFormat, withMetadata, false, null, false, null, TikzFontDistortion.getDefault(), 1.0, null, null, ThemeStyle.LIGHT_REGULAR);
null);
} }
private FileFormatOption(FileFormat fileFormat, boolean withMetadata, boolean useRedForError, private FileFormatOption(FileFormat fileFormat, boolean withMetadata, boolean useRedForError, String svgLinkTarget,
String svgLinkTarget, boolean debugsvek, String hoverColor, TikzFontDistortion tikzFontDistortion, boolean debugsvek, String hoverColor, TikzFontDistortion tikzFontDistortion, double scale,
double scale, String preserveAspectRatio, String watermark) { String preserveAspectRatio, String watermark, ThemeStyle style) {
this.hoverColor = hoverColor; this.hoverColor = hoverColor;
this.watermark = watermark; this.watermark = watermark;
this.fileFormat = fileFormat; this.fileFormat = fileFormat;
@ -86,6 +87,7 @@ public final class FileFormatOption implements Serializable {
this.tikzFontDistortion = Objects.requireNonNull(tikzFontDistortion); this.tikzFontDistortion = Objects.requireNonNull(tikzFontDistortion);
this.scale = scale; this.scale = scale;
this.preserveAspectRatio = preserveAspectRatio; this.preserveAspectRatio = preserveAspectRatio;
this.style = style;
} }
public StringBounder getDefaultStringBounder(SvgCharSizeHack charSizeHack) { public StringBounder getDefaultStringBounder(SvgCharSizeHack charSizeHack) {
@ -105,38 +107,43 @@ public final class FileFormatOption implements Serializable {
} }
public FileFormatOption withUseRedForError() { public FileFormatOption withUseRedForError() {
return new FileFormatOption(fileFormat, withMetadata, true, svgLinkTarget, debugsvek, return new FileFormatOption(fileFormat, withMetadata, true, svgLinkTarget, debugsvek, hoverColor,
hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); tikzFontDistortion, scale, preserveAspectRatio, watermark, style);
} }
public FileFormatOption withTikzFontDistortion(TikzFontDistortion tikzFontDistortion) { public FileFormatOption withTikzFontDistortion(TikzFontDistortion tikzFontDistortion) {
return new FileFormatOption(fileFormat, withMetadata, true, svgLinkTarget, debugsvek, return new FileFormatOption(fileFormat, withMetadata, true, svgLinkTarget, debugsvek, hoverColor,
hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); tikzFontDistortion, scale, preserveAspectRatio, watermark, style);
} }
public FileFormatOption withSvgLinkTarget(String svgLinkTarget) { public FileFormatOption withSvgLinkTarget(String svgLinkTarget) {
return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, hoverColor,
hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); tikzFontDistortion, scale, preserveAspectRatio, watermark, style);
} }
public FileFormatOption withPreserveAspectRatio(String preserveAspectRatio) { public FileFormatOption withPreserveAspectRatio(String preserveAspectRatio) {
return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, hoverColor,
hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); tikzFontDistortion, scale, preserveAspectRatio, watermark, style);
} }
public FileFormatOption withHoverColor(String hoverColor) { public FileFormatOption withHoverColor(String hoverColor) {
return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, hoverColor,
hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); tikzFontDistortion, scale, preserveAspectRatio, watermark, style);
} }
public FileFormatOption withScale(double scale) { public FileFormatOption withScale(double scale) {
return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, hoverColor,
hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); tikzFontDistortion, scale, preserveAspectRatio, watermark, style);
} }
public FileFormatOption withWartermark(String watermark) { public FileFormatOption withWartermark(String watermark) {
return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, hoverColor,
hoverColor, tikzFontDistortion, scale, preserveAspectRatio, watermark); tikzFontDistortion, scale, preserveAspectRatio, watermark, style);
}
public FileFormatOption withStyle(ThemeStyle style) {
return new FileFormatOption(fileFormat, withMetadata, useRedForError, svgLinkTarget, debugsvek, hoverColor,
tikzFontDistortion, scale, preserveAspectRatio, watermark, style);
} }
@Override @Override
@ -183,4 +190,8 @@ public final class FileFormatOption implements Serializable {
return watermark; return watermark;
} }
public ThemeStyle getStyle() {
return style;
}
} }

View File

@ -194,6 +194,6 @@ public interface ISkinParam extends ISkinSimple {
public LengthAdjust getlengthAdjust(); public LengthAdjust getlengthAdjust();
public void assumeTransparent(ThemeStyle style); // public void assumeTransparent(ThemeStyle style);
} }

View File

@ -37,6 +37,7 @@ package net.sourceforge.plantuml;
import java.util.Map; import java.util.Map;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
@ -63,5 +64,7 @@ public interface ISkinSimple extends SpriteContainer {
public void copyAllFrom(ISkinSimple other); public void copyAllFrom(ISkinSimple other);
public double minClassWidth(); public double minClassWidth();
public ThemeStyle getThemeStyle();
} }

View File

@ -43,6 +43,7 @@ import net.sourceforge.plantuml.acearth.PSystemXearthFactory;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory; import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagramFactory3; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagramFactory3;
import net.sourceforge.plantuml.api.PSystemFactory; import net.sourceforge.plantuml.api.PSystemFactory;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.board.BoardDiagramFactory; import net.sourceforge.plantuml.board.BoardDiagramFactory;
import net.sourceforge.plantuml.bpm.BpmDiagramFactory; import net.sourceforge.plantuml.bpm.BpmDiagramFactory;
import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory; import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory;
@ -105,7 +106,7 @@ public class PSystemBuilder {
public static final long startTime = System.currentTimeMillis(); public static final long startTime = System.currentTimeMillis();
final public Diagram createPSystem(ISkinSimple skinParam, List<StringLocated> source, final public Diagram createPSystem(ThemeStyle style, ISkinSimple skinParam, List<StringLocated> source,
List<StringLocated> rawSource) { List<StringLocated> rawSource) {
final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis();
@ -129,10 +130,10 @@ public class PSystemBuilder {
final DiagramType diagramType = umlSource.getDiagramType(); final DiagramType diagramType = umlSource.getDiagramType();
final List<PSystemError> errors = new ArrayList<>(); final List<PSystemError> errors = new ArrayList<>();
for (PSystemFactory systemFactory : factories) { for (PSystemFactory systemFactory : factories) {
if (diagramType != systemFactory.getDiagramType()) { if (diagramType != systemFactory.getDiagramType())
continue; continue;
}
final Diagram sys = systemFactory.createSystem(umlSource, skinParam); final Diagram sys = systemFactory.createSystem(style, umlSource, skinParam);
if (isOk(sys)) { if (isOk(sys)) {
result = sys; result = sys;
return sys; return sys;
@ -140,9 +141,8 @@ public class PSystemBuilder {
errors.add((PSystemError) sys); errors.add((PSystemError) sys);
} }
final PSystemError err = PSystemErrorUtils.merge(errors); result = PSystemErrorUtils.merge(errors);
result = err; return result;
return err;
} finally { } finally {
if (result != null && OptionFlags.getInstance().isEnableStats()) { if (result != null && OptionFlags.getInstance().isEnableStats()) {
StatsUtilsIncrement.onceMoreParse(System.currentTimeMillis() - now, result.getClass()); StatsUtilsIncrement.onceMoreParse(System.currentTimeMillis() - now, result.getClass());
@ -228,9 +228,9 @@ public class PSystemBuilder {
} }
private boolean isOk(Diagram ps) { private boolean isOk(Diagram ps) {
if (ps == null || ps instanceof PSystemError) { if (ps == null || ps instanceof PSystemError)
return false; return false;
}
return true; return true;
} }

View File

@ -51,6 +51,7 @@ import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.MyPattern;
@ -79,6 +80,7 @@ import net.sourceforge.plantuml.svg.LengthAdjust;
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.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.ColorMapperForceDark;
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.color.ColorMapperLightnessInverse; import net.sourceforge.plantuml.ugraphic.color.ColorMapperLightnessInverse;
import net.sourceforge.plantuml.ugraphic.color.ColorMapperMonochrome; import net.sourceforge.plantuml.ugraphic.color.ColorMapperMonochrome;
@ -95,40 +97,42 @@ public class SkinParam implements ISkinParam {
public static final String DEFAULT_PRESERVE_ASPECT_RATIO = "none"; public static final String DEFAULT_PRESERVE_ASPECT_RATIO = "none";
// private String skin = "debug.skin"; // private String skin = "debug.skin";
private String skin = "plantuml.skin"; private String skin = "plantuml.skin";
private StyleBuilder styleBuilder; private StyleBuilder styleBuilder;
// private ThemeStyle themeStyle = ThemeStyle.LIGHT_REGULAR;
private final ThemeStyle themeStyle;
private SkinParam(UmlDiagramType type) { private SkinParam(UmlDiagramType type, ThemeStyle style) {
UseStyle.setBetaStyle(false); this.themeStyle = style;
this.type = type; this.type = type;
if (type == UmlDiagramType.MINDMAP) { UseStyle.setBetaStyle(false);
if (type == UmlDiagramType.MINDMAP)
UseStyle.setBetaStyle(true); UseStyle.setBetaStyle(true);
}
if (type == UmlDiagramType.WBS) { if (type == UmlDiagramType.WBS)
UseStyle.setBetaStyle(true); UseStyle.setBetaStyle(true);
}
if (type == UmlDiagramType.GANTT) { if (type == UmlDiagramType.GANTT)
UseStyle.setBetaStyle(true); UseStyle.setBetaStyle(true);
}
if (type == UmlDiagramType.JSON) { if (type == UmlDiagramType.JSON)
UseStyle.setBetaStyle(true); UseStyle.setBetaStyle(true);
}
if (type == UmlDiagramType.GIT) { if (type == UmlDiagramType.GIT)
UseStyle.setBetaStyle(true); UseStyle.setBetaStyle(true);
}
if (type == UmlDiagramType.BOARD) { if (type == UmlDiagramType.BOARD)
UseStyle.setBetaStyle(true); UseStyle.setBetaStyle(true);
}
if (type == UmlDiagramType.YAML) { if (type == UmlDiagramType.YAML)
UseStyle.setBetaStyle(true); UseStyle.setBetaStyle(true);
}
if (type == UmlDiagramType.HCL) { if (type == UmlDiagramType.HCL)
UseStyle.setBetaStyle(true); UseStyle.setBetaStyle(true);
}
if (type == UmlDiagramType.NWDIAG) { if (type == UmlDiagramType.NWDIAG)
UseStyle.setBetaStyle(true); UseStyle.setBetaStyle(true);
}
if (type == UmlDiagramType.SEQUENCE) { if (type == UmlDiagramType.SEQUENCE) {
// skin = "debug.skin"; // skin = "debug.skin";
// USE_STYLE2.set(true); // USE_STYLE2.set(true);
@ -166,9 +170,9 @@ public class SkinParam implements ISkinParam {
public StyleBuilder getCurrentStyleBuilderInternal() throws IOException { public StyleBuilder getCurrentStyleBuilderInternal() throws IOException {
final StyleLoader tmp = new StyleLoader(this); final StyleLoader tmp = new StyleLoader(this);
StyleBuilder result = tmp.loadSkin(this.getDefaultSkin()); StyleBuilder result = tmp.loadSkin(this.getDefaultSkin());
if (result == null) { if (result == null)
result = tmp.loadSkin("plantuml.skin"); result = tmp.loadSkin("plantuml.skin");
}
return result; return result;
} }
@ -205,7 +209,6 @@ public class SkinParam implements ISkinParam {
final FromSkinparamToStyle convertor = new FromSkinparamToStyle(key2, value, getCurrentStyleBuilder()); final FromSkinparamToStyle convertor = new FromSkinparamToStyle(key2, value, getCurrentStyleBuilder());
for (Style style : convertor.getStyles()) for (Style style : convertor.getStyles())
muteStyle(style); muteStyle(style);
} else { } else {
paramsPendingForStyleMigration.put(key, value); paramsPendingForStyleMigration.put(key, value);
} }
@ -216,9 +219,9 @@ public class SkinParam implements ISkinParam {
final StyleBuilder styleBuilder = this.getCurrentStyleBuilder(); final StyleBuilder styleBuilder = this.getCurrentStyleBuilder();
try { try {
final BlocLines lines = BlocLines.load(internalIs, null); final BlocLines lines = BlocLines.load(internalIs, null);
for (Style modifiedStyle : StyleLoader.getDeclaredStyles(lines, styleBuilder)) { for (Style modifiedStyle : StyleLoader.getDeclaredStyles(lines, styleBuilder))
this.muteStyle(modifiedStyle); this.muteStyle(modifiedStyle);
}
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -236,12 +239,12 @@ public class SkinParam implements ISkinParam {
paramsPendingForStyleMigration.clear(); paramsPendingForStyleMigration.clear();
} }
public static SkinParam create(UmlDiagramType type) { public static SkinParam create(UmlDiagramType type, ThemeStyle style) {
return new SkinParam(type); return new SkinParam(type, style);
} }
public static SkinParam noShadowing(UmlDiagramType type) { public static SkinParam noShadowing(UmlDiagramType type, ThemeStyle style) {
final SkinParam result = new SkinParam(type); final SkinParam result = new SkinParam(type, style);
result.setParam("shadowing", "false"); result.setParam("shadowing", "false");
return result; return result;
} }
@ -277,9 +280,9 @@ public class SkinParam implements ISkinParam {
final String s = mm.group(1); final String s = mm.group(1);
result.add(key.replaceAll(stereoPatternString, "") + "<<" + s + ">>"); result.add(key.replaceAll(stereoPatternString, "") + "<<" + s + ">>");
} }
if (result.size() == 0) { if (result.size() == 0)
result.add(key); result.add(key);
}
return Collections.unmodifiableList(result); return Collections.unmodifiableList(result);
} }
@ -292,9 +295,9 @@ public class SkinParam implements ISkinParam {
public HColor getHyperlinkColor() { public HColor getHyperlinkColor() {
final HColor result = getHtmlColor(ColorParam.hyperlink, null, false); final HColor result = getHtmlColor(ColorParam.hyperlink, null, false);
if (result == null) { if (result == null)
return HColorUtils.BLUE; return HColorUtils.BLUE;
}
return result; return result;
} }
@ -308,9 +311,9 @@ public class SkinParam implements ISkinParam {
applyPendingStyleMigration(); applyPendingStyleMigration();
for (String key2 : cleanForKey(key)) { for (String key2 : cleanForKey(key)) {
final String result = params.get(key2); final String result = params.get(key2);
if (result != null) { if (result != null)
return result; return result;
}
} }
return null; return null;
} }
@ -348,9 +351,9 @@ public class SkinParam implements ISkinParam {
checkStereotype(stereotype); checkStereotype(stereotype);
for (String s : stereotype.getMultipleLabels()) { for (String s : stereotype.getMultipleLabels()) {
final String value2 = getValue(param.name() + "color" + "<<" + s + ">>"); final String value2 = getValue(param.name() + "color" + "<<" + s + ">>");
if (value2 != null && getIHtmlColorSet().getColorOrWhite(themeStyle, value2) != null) { if (value2 != null && getIHtmlColorSet().getColorOrWhite(themeStyle, value2) != null)
return getIHtmlColorSet().getColorOrWhite(themeStyle, value2); return getIHtmlColorSet().getColorOrWhite(themeStyle, value2);
}
} }
} }
final String value = getValue(getParamName(param, clickable)); final String value = getValue(getParamName(param, clickable));
@ -373,9 +376,9 @@ public class SkinParam implements ISkinParam {
public char getCircledCharacter(Stereotype stereotype) { public char getCircledCharacter(Stereotype stereotype) {
final String value2 = getValue( final String value2 = getValue(
"spotchar" + Objects.requireNonNull(stereotype).getLabel(Guillemet.DOUBLE_COMPARATOR)); "spotchar" + Objects.requireNonNull(stereotype).getLabel(Guillemet.DOUBLE_COMPARATOR));
if (value2 != null && value2.length() > 0) { if (value2 != null && value2.length() > 0)
return value2.charAt(0); return value2.charAt(0);
}
return 0; return 0;
} }
@ -383,24 +386,24 @@ public class SkinParam implements ISkinParam {
if (stereotype != null) { if (stereotype != null) {
checkStereotype(stereotype); checkStereotype(stereotype);
final String value2 = getValue(param.name() + "color" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); final String value2 = getValue(param.name() + "color" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR));
if (value2 != null) { if (value2 != null)
return new Colors(themeStyle, value2, getIHtmlColorSet(), param.getColorType()); return new Colors(themeStyle, value2, getIHtmlColorSet(), param.getColorType());
}
} }
final String value = getValue(getParamName(param, false)); final String value = getValue(getParamName(param, false));
if (value == null) { if (value == null)
return Colors.empty(); return Colors.empty();
}
return new Colors(themeStyle, value, getIHtmlColorSet(), param.getColorType()); return new Colors(themeStyle, value, getIHtmlColorSet(), param.getColorType());
} }
private String getParamName(ColorParam param, boolean clickable) { private String getParamName(ColorParam param, boolean clickable) {
String n = param.name(); String n = param.name();
if (clickable && n.endsWith("Background")) { if (clickable && n.endsWith("Background"))
n = n.replaceAll("Background", "ClickableBackground"); n = n.replaceAll("Background", "ClickableBackground");
} else if (clickable && n.endsWith("Border")) { else if (clickable && n.endsWith("Border"))
n = n.replaceAll("Border", "ClickableBorder"); n = n.replaceAll("Border", "ClickableBorder");
}
return n + "color"; return n + "color";
} }
@ -416,17 +419,17 @@ public class SkinParam implements ISkinParam {
checkStereotype(stereotype); checkStereotype(stereotype);
final String value2 = getFirstValueNonNullWithSuffix( final String value2 = getFirstValueNonNullWithSuffix(
"fontsize" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR), param); "fontsize" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR), param);
if (value2 != null && value2.matches("\\d+")) { if (value2 != null && value2.matches("\\d+"))
return Integer.parseInt(value2); return Integer.parseInt(value2);
}
} }
String value = getFirstValueNonNullWithSuffix("fontsize", param); String value = getFirstValueNonNullWithSuffix("fontsize", param);
if (value == null || value.matches("\\d+") == false) { if (value == null || value.matches("\\d+") == false)
value = getValue("defaultfontsize"); value = getValue("defaultfontsize");
}
if (value == null || value.matches("\\d+") == false) { if (value == null || value.matches("\\d+") == false)
return param[0].getDefaultSize(this); return param[0].getDefaultSize(this);
}
return Integer.parseInt(value); return Integer.parseInt(value);
} }
@ -435,20 +438,20 @@ public class SkinParam implements ISkinParam {
checkStereotype(stereotype); checkStereotype(stereotype);
final String value2 = getFirstValueNonNullWithSuffix( final String value2 = getFirstValueNonNullWithSuffix(
"fontname" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR), param); "fontname" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR), param);
if (value2 != null) { if (value2 != null)
return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(value2); return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(value2);
}
} }
// Times, Helvetica, Courier or Symbol // Times, Helvetica, Courier or Symbol
String value = getFirstValueNonNullWithSuffix("fontname", param); String value = getFirstValueNonNullWithSuffix("fontname", param);
if (value != null) { if (value != null)
return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(value); return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(value);
}
if (param[0] != FontParam.CIRCLED_CHARACTER) { if (param[0] != FontParam.CIRCLED_CHARACTER) {
value = getValue("defaultfontname"); value = getValue("defaultfontname");
if (value != null) { if (value != null)
return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(value); return StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(value);
}
} }
return param[0].getDefaultFamily(); return param[0].getDefaultFamily();
} }
@ -460,27 +463,28 @@ public class SkinParam implements ISkinParam {
value = getFirstValueNonNullWithSuffix("fontcolor" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR), value = getFirstValueNonNullWithSuffix("fontcolor" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR),
param); param);
} }
if (value == null) {
if (value == null)
value = getFirstValueNonNullWithSuffix("fontcolor", param); value = getFirstValueNonNullWithSuffix("fontcolor", param);
}
if (value == null) { if (value == null)
value = getValue("defaultfontcolor"); value = getValue("defaultfontcolor");
}
if (value == null) { if (value == null)
value = param[0].getDefaultColor(); value = param[0].getDefaultColor();
}
if (value == null) { if (value == null)
return null; return null;
}
return getIHtmlColorSet().getColorOrWhite(themeStyle, value); return getIHtmlColorSet().getColorOrWhite(themeStyle, value);
} }
private String getFirstValueNonNullWithSuffix(String suffix, FontParam... param) { private String getFirstValueNonNullWithSuffix(String suffix, FontParam... param) {
for (FontParam p : param) { for (FontParam p : param) {
final String v = getValue(p.name() + suffix); final String v = getValue(p.name() + suffix);
if (v != null) { if (v != null)
return v; return v;
}
} }
return null; return null;
} }
@ -492,29 +496,29 @@ public class SkinParam implements ISkinParam {
value = getFirstValueNonNullWithSuffix("fontstyle" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR), value = getFirstValueNonNullWithSuffix("fontstyle" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR),
param); param);
} }
if (value == null) { if (value == null)
value = getFirstValueNonNullWithSuffix("fontstyle", param); value = getFirstValueNonNullWithSuffix("fontstyle", param);
}
if (value == null) { if (value == null)
value = getValue("defaultfontstyle"); value = getValue("defaultfontstyle");
}
if (value == null) { if (value == null)
return param[0].getDefaultFontStyle(this, inPackageTitle); return param[0].getDefaultFontStyle(this, inPackageTitle);
}
int result = Font.PLAIN; int result = Font.PLAIN;
if (StringUtils.goLowerCase(value).contains("bold")) { if (StringUtils.goLowerCase(value).contains("bold"))
result = result | Font.BOLD; result = result | Font.BOLD;
}
if (StringUtils.goLowerCase(value).contains("italic")) { if (StringUtils.goLowerCase(value).contains("italic"))
result = result | Font.ITALIC; result = result | Font.ITALIC;
}
return result; return result;
} }
public UFont getFont(Stereotype stereotype, boolean inPackageTitle, FontParam... fontParam) { public UFont getFont(Stereotype stereotype, boolean inPackageTitle, FontParam... fontParam) {
if (stereotype != null) { if (stereotype != null)
checkStereotype(stereotype); checkStereotype(stereotype);
}
final String fontFamily = getFontFamily(stereotype, fontParam); final String fontFamily = getFontFamily(stereotype, fontParam);
final int fontStyle = getFontStyle(stereotype, inPackageTitle, fontParam); final int fontStyle = getFontStyle(stereotype, inPackageTitle, fontParam);
final int fontSize = getFontSize(stereotype, fontParam); final int fontSize = getFontSize(stereotype, fontParam);
@ -622,12 +626,12 @@ public class SkinParam implements ISkinParam {
public DotSplines getDotSplines() { public DotSplines getDotSplines() {
final String value = getValue("linetype"); final String value = getValue("linetype");
if ("polyline".equalsIgnoreCase(value)) { if ("polyline".equalsIgnoreCase(value))
return DotSplines.POLYLINE; return DotSplines.POLYLINE;
}
if ("ortho".equalsIgnoreCase(value)) { if ("ortho".equalsIgnoreCase(value))
return DotSplines.ORTHO; return DotSplines.ORTHO;
}
return DotSplines.SPLINES; return DotSplines.SPLINES;
} }
@ -646,98 +650,101 @@ public class SkinParam implements ISkinParam {
} }
if ("first".equalsIgnoreCase(value)) { if ("first".equalsIgnoreCase(value)) {
if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE) { if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE) {
if (isReverseDefine) { if (isReverseDefine)
return HorizontalAlignment.LEFT; return HorizontalAlignment.LEFT;
}
return HorizontalAlignment.RIGHT; return HorizontalAlignment.RIGHT;
} else { } else {
if (isReverseDefine) { if (isReverseDefine)
return HorizontalAlignment.RIGHT; return HorizontalAlignment.RIGHT;
}
return HorizontalAlignment.LEFT; return HorizontalAlignment.LEFT;
} }
} }
if ("direction".equalsIgnoreCase(value)) { if ("direction".equalsIgnoreCase(value)) {
if (arrowDirection == ArrowDirection.LEFT_TO_RIGHT_NORMAL) { if (arrowDirection == ArrowDirection.LEFT_TO_RIGHT_NORMAL)
return HorizontalAlignment.LEFT; return HorizontalAlignment.LEFT;
}
if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE) { if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE)
return HorizontalAlignment.RIGHT; return HorizontalAlignment.RIGHT;
}
if (arrowDirection == ArrowDirection.BOTH_DIRECTION) { if (arrowDirection == ArrowDirection.BOTH_DIRECTION)
return HorizontalAlignment.CENTER; return HorizontalAlignment.CENTER;
}
} }
if ("reversedirection".equalsIgnoreCase(value)) { if ("reversedirection".equalsIgnoreCase(value)) {
if (arrowDirection == ArrowDirection.LEFT_TO_RIGHT_NORMAL) { if (arrowDirection == ArrowDirection.LEFT_TO_RIGHT_NORMAL)
return HorizontalAlignment.RIGHT; return HorizontalAlignment.RIGHT;
}
if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE) { if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE)
return HorizontalAlignment.LEFT; return HorizontalAlignment.LEFT;
}
if (arrowDirection == ArrowDirection.BOTH_DIRECTION) { if (arrowDirection == ArrowDirection.BOTH_DIRECTION)
return HorizontalAlignment.CENTER; return HorizontalAlignment.CENTER;
}
} }
final HorizontalAlignment result = HorizontalAlignment.fromString(value); final HorizontalAlignment result = HorizontalAlignment.fromString(value);
if (result == null && param == AlignmentParam.noteTextAlignment) { if (result == null && param == AlignmentParam.noteTextAlignment)
return getDefaultTextAlignment(overrideDefault == null ? HorizontalAlignment.LEFT : overrideDefault); return getDefaultTextAlignment(overrideDefault == null ? HorizontalAlignment.LEFT : overrideDefault);
} else if (result == null && param == AlignmentParam.stateMessageAlignment) { else if (result == null && param == AlignmentParam.stateMessageAlignment)
return getDefaultTextAlignment(HorizontalAlignment.CENTER); return getDefaultTextAlignment(HorizontalAlignment.CENTER);
} else if (result == null) { else if (result == null)
return param.getDefaultValue(); return param.getDefaultValue();
}
return result; return result;
} }
public HorizontalAlignment getDefaultTextAlignment(HorizontalAlignment defaultValue) { public HorizontalAlignment getDefaultTextAlignment(HorizontalAlignment defaultValue) {
final String value = getValue("defaulttextalignment"); final String value = getValue("defaulttextalignment");
final HorizontalAlignment result = HorizontalAlignment.fromString(value); final HorizontalAlignment result = HorizontalAlignment.fromString(value);
if (result == null) { if (result == null)
return defaultValue; return defaultValue;
}
return result; return result;
} }
public HorizontalAlignment getStereotypeAlignment() { public HorizontalAlignment getStereotypeAlignment() {
final String value = getValue("stereotypealignment"); final String value = getValue("stereotypealignment");
final HorizontalAlignment result = HorizontalAlignment.fromString(value); final HorizontalAlignment result = HorizontalAlignment.fromString(value);
if (result == null) { if (result == null)
return HorizontalAlignment.CENTER; return HorizontalAlignment.CENTER;
}
return result; return result;
} }
private String getArg(String value, int i) { private String getArg(String value, int i) {
if (value == null) { if (value == null)
return null; return null;
}
final String[] split = value.split(":"); final String[] split = value.split(":");
if (i >= split.length) { if (i >= split.length)
return split[0]; return split[0];
}
return split[i]; return split[i];
} }
public ColorMapper getColorMapper() { public ColorMapper getColorMapper() {
if (themeStyle == ThemeStyle.DARK)
return new ColorMapperForceDark();
final String monochrome = getValue("monochrome"); final String monochrome = getValue("monochrome");
if ("true".equals(monochrome)) { if ("true".equals(monochrome))
return new ColorMapperMonochrome(false); return new ColorMapperMonochrome(false);
}
if ("reverse".equals(monochrome)) { if ("reverse".equals(monochrome))
return new ColorMapperMonochrome(true); return new ColorMapperMonochrome(true);
}
final String value = getValue("reversecolor"); final String value = getValue("reversecolor");
if (value == null) { if (value == null)
return new ColorMapperIdentity(); return new ColorMapperIdentity();
}
if ("dark".equalsIgnoreCase(value)) { if ("dark".equalsIgnoreCase(value))
return new ColorMapperLightnessInverse(); return new ColorMapperLightnessInverse();
}
final ColorOrder order = ColorOrder.fromString(value); final ColorOrder order = ColorOrder.fromString(value);
if (order == null) { if (order == null)
return new ColorMapperIdentity(); return new ColorMapperIdentity();
}
return new ColorMapperReverse(order); return new ColorMapperReverse(order);
} }
@ -745,20 +752,20 @@ public class SkinParam implements ISkinParam {
if (stereotype != null) { if (stereotype != null) {
checkStereotype(stereotype); checkStereotype(stereotype);
final String value2 = getValue("shadowing" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); final String value2 = getValue("shadowing" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR));
if (value2 != null) { if (value2 != null)
return value2.equalsIgnoreCase("true"); return value2.equalsIgnoreCase("true");
}
} }
final String value = getValue("shadowing"); final String value = getValue("shadowing");
if ("false".equalsIgnoreCase(value)) { if ("false".equalsIgnoreCase(value))
return false; return false;
}
if ("true".equalsIgnoreCase(value)) { if ("true".equalsIgnoreCase(value))
return true; return true;
}
if (strictUmlStyle()) { if (strictUmlStyle())
return false; return false;
}
return true; return true;
} }
@ -766,14 +773,14 @@ public class SkinParam implements ISkinParam {
if (stereotype != null) { if (stereotype != null) {
checkStereotype(stereotype); checkStereotype(stereotype);
final String value2 = getValue("note" + "shadowing" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); final String value2 = getValue("note" + "shadowing" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR));
if (value2 != null) { if (value2 != null)
return value2.equalsIgnoreCase("true"); return value2.equalsIgnoreCase("true");
}
} }
final String value2 = getValue("note" + "shadowing"); final String value2 = getValue("note" + "shadowing");
if (value2 != null) { if (value2 != null)
return value2.equalsIgnoreCase("true"); return value2.equalsIgnoreCase("true");
}
return shadowing(stereotype); return shadowing(stereotype);
} }
@ -782,24 +789,24 @@ public class SkinParam implements ISkinParam {
if (stereotype != null) { if (stereotype != null) {
checkStereotype(stereotype); checkStereotype(stereotype);
final String value2 = getValue(name + "shadowing" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); final String value2 = getValue(name + "shadowing" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR));
if (value2 != null) { if (value2 != null)
return value2.equalsIgnoreCase("true"); return value2.equalsIgnoreCase("true");
}
} }
final String value = getValue(name + "shadowing"); final String value = getValue(name + "shadowing");
if (value == null) { if (value == null)
return shadowing(stereotype); return shadowing(stereotype);
}
if ("false".equalsIgnoreCase(value)) { if ("false".equalsIgnoreCase(value))
return false; return false;
}
if ("true".equalsIgnoreCase(value)) { if ("true".equalsIgnoreCase(value))
return true; return true;
}
if (strictUmlStyle()) { if (strictUmlStyle())
return false; return false;
}
return true; return true;
} }
@ -815,25 +822,25 @@ public class SkinParam implements ISkinParam {
public Sprite getSprite(String name) { public Sprite getSprite(String name) {
Sprite result = sprites.get(name); Sprite result = sprites.get(name);
if (result == null) { if (result == null)
result = SpriteImage.fromInternal(name); result = SpriteImage.fromInternal(name);
}
return result; return result;
} }
public PackageStyle packageStyle() { public PackageStyle packageStyle() {
final String value = getValue("packageStyle"); final String value = getValue("packageStyle");
final PackageStyle p = PackageStyle.fromString(value); final PackageStyle p = PackageStyle.fromString(value);
if (p == null) { if (p == null)
return PackageStyle.FOLDER; return PackageStyle.FOLDER;
}
return p; return p;
} }
public ComponentStyle componentStyle() { public ComponentStyle componentStyle() {
if (strictUmlStyle()) { if (strictUmlStyle())
return ComponentStyle.UML2; return ComponentStyle.UML2;
}
final String value = getValue("componentstyle"); final String value = getValue("componentstyle");
if ("uml1".equalsIgnoreCase(value)) if ("uml1".equalsIgnoreCase(value))
return ComponentStyle.UML1; return ComponentStyle.UML1;
@ -849,9 +856,9 @@ public class SkinParam implements ISkinParam {
} }
public boolean useSwimlanes(UmlDiagramType type) { public boolean useSwimlanes(UmlDiagramType type) {
if (type != UmlDiagramType.ACTIVITY) { if (type != UmlDiagramType.ACTIVITY)
return false; return false;
}
return swimlanes(); return swimlanes();
} }
@ -872,43 +879,43 @@ public class SkinParam implements ISkinParam {
public double getDiagonalCorner(CornerParam param, Stereotype stereotype) { public double getDiagonalCorner(CornerParam param, Stereotype stereotype) {
final String key = param.getDiagonalKey(); final String key = param.getDiagonalKey();
Double result = getCornerInternal(key, param, stereotype); Double result = getCornerInternal(key, param, stereotype);
if (result != null) { if (result != null)
return result; return result;
}
result = getCornerInternal(key, param, null); result = getCornerInternal(key, param, null);
if (result != null) { if (result != null)
return result; return result;
}
if (param == CornerParam.DEFAULT) { if (param == CornerParam.DEFAULT)
return 0; return 0;
}
return getDiagonalCorner(CornerParam.DEFAULT, stereotype); return getDiagonalCorner(CornerParam.DEFAULT, stereotype);
} }
public double getRoundCorner(CornerParam param, Stereotype stereotype) { public double getRoundCorner(CornerParam param, Stereotype stereotype) {
final String key = param.getRoundKey(); final String key = param.getRoundKey();
Double result = getCornerInternal(key, param, stereotype); Double result = getCornerInternal(key, param, stereotype);
if (result != null) { if (result != null)
return result; return result;
}
result = getCornerInternal(key, param, null); result = getCornerInternal(key, param, null);
if (result != null) { if (result != null)
return result; return result;
}
if (param == CornerParam.DEFAULT) { if (param == CornerParam.DEFAULT)
return 0; return 0;
}
return getRoundCorner(CornerParam.DEFAULT, stereotype); return getRoundCorner(CornerParam.DEFAULT, stereotype);
} }
private Double getCornerInternal(String key, CornerParam param, Stereotype stereotype) { private Double getCornerInternal(String key, CornerParam param, Stereotype stereotype) {
if (stereotype != null) { if (stereotype != null)
key += stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR); key += stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR);
}
final String value = getValue(key); final String value = getValue(key);
if (value != null && value.matches("\\d+")) { if (value != null && value.matches("\\d+"))
return Double.parseDouble(value); return Double.parseDouble(value);
}
return null; return null;
} }
@ -919,43 +926,42 @@ public class SkinParam implements ISkinParam {
final String styleValue = getValue( final String styleValue = getValue(
param.name() + "style" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); param.name() + "style" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR));
if (styleValue != null) { if (styleValue != null)
style = LinkStyle.fromString2(styleValue); style = LinkStyle.fromString2(styleValue);
}
final String value2 = getValue( final String value2 = getValue(
param.name() + "thickness" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); param.name() + "thickness" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR));
if (value2 != null && value2.matches("[\\d.]+")) { if (value2 != null && value2.matches("[\\d.]+")) {
if (style == null) { if (style == null)
style = LinkStyle.NORMAL(); style = LinkStyle.NORMAL();
}
return style.goThickness(Double.parseDouble(value2)).getStroke3(); return style.goThickness(Double.parseDouble(value2)).getStroke3();
} }
} }
final String value = getValue(param.name() + "thickness"); final String value = getValue(param.name() + "thickness");
if (value != null && value.matches("[\\d.]+")) { if (value != null && value.matches("[\\d.]+")) {
if (style == null) { if (style == null)
style = LinkStyle.NORMAL(); style = LinkStyle.NORMAL();
}
return style.goThickness(Double.parseDouble(value)).getStroke3(); return style.goThickness(Double.parseDouble(value)).getStroke3();
} }
if (style == null) { if (style == null) {
final String styleValue = getValue(param.name() + "style"); final String styleValue = getValue(param.name() + "style");
if (styleValue != null) { if (styleValue != null)
style = LinkStyle.fromString2(styleValue); style = LinkStyle.fromString2(styleValue);
}
} }
if (style != null && style.isNormal() == false) { if (style != null && style.isNormal() == false)
return style.getStroke3(); return style.getStroke3();
}
return null; return null;
} }
public LineBreakStrategy maxMessageSize() { public LineBreakStrategy maxMessageSize() {
String value = getValue("wrapmessagewidth"); String value = getValue("wrapmessagewidth");
if (value == null) { if (value == null)
value = getValue("maxmessagesize"); value = getValue("maxmessagesize");
}
return new LineBreakStrategy(value); return new LineBreakStrategy(value);
} }
@ -980,18 +986,18 @@ public class SkinParam implements ISkinParam {
public ConditionStyle getConditionStyle() { public ConditionStyle getConditionStyle() {
final String value = getValue("conditionStyle"); final String value = getValue("conditionStyle");
final ConditionStyle p = ConditionStyle.fromString(value); final ConditionStyle p = ConditionStyle.fromString(value);
if (p == null) { if (p == null)
return ConditionStyle.INSIDE_HEXAGON; return ConditionStyle.INSIDE_HEXAGON;
}
return p; return p;
} }
public ConditionEndStyle getConditionEndStyle() { public ConditionEndStyle getConditionEndStyle() {
final String value = getValue("conditionEndStyle"); final String value = getValue("conditionEndStyle");
final ConditionEndStyle p = ConditionEndStyle.fromString(value); final ConditionEndStyle p = ConditionEndStyle.fromString(value);
if (p == null) { if (p == null)
return ConditionEndStyle.DIAMOND; return ConditionEndStyle.DIAMOND;
}
return p; return p;
} }
@ -1016,16 +1022,16 @@ public class SkinParam implements ISkinParam {
if (stereotype != null) { if (stereotype != null) {
checkStereotype(stereotype); checkStereotype(stereotype);
final String value2 = getValue("activityshape" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); final String value2 = getValue("activityshape" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR));
if (value2 != null) { if (value2 != null)
value = value2; value = value2;
}
} }
if ("roundedbox".equalsIgnoreCase(value)) { if ("roundedbox".equalsIgnoreCase(value))
return false; return false;
}
if ("octagon".equalsIgnoreCase(value)) { if ("octagon".equalsIgnoreCase(value))
return true; return true;
}
return false; return false;
} }
@ -1088,12 +1094,12 @@ public class SkinParam implements ISkinParam {
public int swimlaneWidth() { public int swimlaneWidth() {
final String value = getValue("swimlanewidth"); final String value = getValue("swimlanewidth");
if ("same".equalsIgnoreCase(value)) { if ("same".equalsIgnoreCase(value))
return SWIMLANE_WIDTH_SAME; return SWIMLANE_WIDTH_SAME;
}
if (value != null && value.matches("\\d+")) { if (value != null && value.matches("\\d+"))
return Integer.parseInt(value); return Integer.parseInt(value);
}
return 0; return 0;
} }
@ -1103,9 +1109,9 @@ public class SkinParam implements ISkinParam {
public HColor hoverPathColor() { public HColor hoverPathColor() {
final String value = getValue("pathhovercolor"); final String value = getValue("pathhovercolor");
if (value == null) { if (value == null)
return null; return null;
}
return getIHtmlColorSet().getColorOrWhite(themeStyle, value, null); return getIHtmlColorSet().getColorOrWhite(themeStyle, value, null);
} }
@ -1121,17 +1127,17 @@ public class SkinParam implements ISkinParam {
private double getAsDouble(final String name) { private double getAsDouble(final String name) {
final String value = getValue(name); final String value = getValue(name);
if (value != null && value.matches("\\d+(\\.\\d+)?")) { if (value != null && value.matches("\\d+(\\.\\d+)?"))
return Double.parseDouble(value); return Double.parseDouble(value);
}
return 0; return 0;
} }
private int getAsInt(String key, int defaultValue) { private int getAsInt(String key, int defaultValue) {
final String value = getValue(key); final String value = getValue(key);
if (value != null && value.matches("\\d+")) { if (value != null && value.matches("\\d+"))
return Integer.parseInt(value); return Integer.parseInt(value);
}
return defaultValue; return defaultValue;
} }
@ -1173,9 +1179,9 @@ public class SkinParam implements ISkinParam {
final double margin = getAsDouble("SequenceMessageMargin"); final double margin = getAsDouble("SequenceMessageMargin");
final String borderColor = getValue("SequenceMessageBorderColor"); final String borderColor = getValue("SequenceMessageBorderColor");
final String backgroundColor = getValue("SequenceMessageBackGroundColor"); final String backgroundColor = getValue("SequenceMessageBackGroundColor");
if (padding == 0 && margin == 0 && borderColor == null && backgroundColor == null) { if (padding == 0 && margin == 0 && borderColor == null && backgroundColor == null)
return Padder.NONE; return Padder.NONE;
}
final HColor border = borderColor == null ? null : getIHtmlColorSet().getColorOrWhite(themeStyle, borderColor); final HColor border = borderColor == null ? null : getIHtmlColorSet().getColorOrWhite(themeStyle, borderColor);
final HColor background = backgroundColor == null ? null final HColor background = backgroundColor == null ? null
: getIHtmlColorSet().getColorOrWhite(themeStyle, backgroundColor); : getIHtmlColorSet().getColorOrWhite(themeStyle, backgroundColor);
@ -1186,12 +1192,12 @@ public class SkinParam implements ISkinParam {
public ActorStyle actorStyle() { public ActorStyle actorStyle() {
final String value = getValue("actorstyle"); final String value = getValue("actorstyle");
if ("awesome".equalsIgnoreCase(value)) { if ("awesome".equalsIgnoreCase(value))
return ActorStyle.AWESOME; return ActorStyle.AWESOME;
}
if ("hollow".equalsIgnoreCase(value)) { if ("hollow".equalsIgnoreCase(value))
return ActorStyle.HOLLOW; return ActorStyle.HOLLOW;
}
return ActorStyle.STICKMAN; return ActorStyle.STICKMAN;
} }
@ -1201,31 +1207,29 @@ public class SkinParam implements ISkinParam {
} }
public String transformStringForSizeHack(String s) { public String transformStringForSizeHack(String s) {
for (Entry<String, String> ent : svgCharSizes.entrySet()) { for (Entry<String, String> ent : svgCharSizes.entrySet())
s = s.replace(ent.getKey(), ent.getValue()); s = s.replace(ent.getKey(), ent.getValue());
}
return s; return s;
} }
public LengthAdjust getlengthAdjust() { public LengthAdjust getlengthAdjust() {
final String value = getValue("lengthAdjust"); final String value = getValue("lengthAdjust");
if ("spacingAndGlyphs".equalsIgnoreCase(value)) { if ("spacingAndGlyphs".equalsIgnoreCase(value))
return LengthAdjust.SPACING_AND_GLYPHS; return LengthAdjust.SPACING_AND_GLYPHS;
}
if ("spacing".equalsIgnoreCase(value)) { if ("spacing".equalsIgnoreCase(value))
return LengthAdjust.SPACING; return LengthAdjust.SPACING;
}
if ("none".equalsIgnoreCase(value)) { if ("none".equalsIgnoreCase(value))
return LengthAdjust.NONE; return LengthAdjust.NONE;
}
return LengthAdjust.defaultValue(); return LengthAdjust.defaultValue();
} }
private ThemeStyle themeStyle = ThemeStyle.LIGHT; // public void assumeTransparent(ThemeStyle style) {
// this.themeStyle = style;
public void assumeTransparent(ThemeStyle style) { // }
this.themeStyle = style;
}
public ThemeStyle getThemeStyle() { public ThemeStyle getThemeStyle() {
return themeStyle; return themeStyle;

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import net.sourceforge.plantuml.api.ThemeStyle;
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;
@ -455,10 +456,10 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getlengthAdjust(); return skinParam.getlengthAdjust();
} }
@Override // @Override
public void assumeTransparent(ThemeStyle style) { // public void assumeTransparent(ThemeStyle style) {
skinParam.assumeTransparent(style); // skinParam.assumeTransparent(style);
} // }
@Override @Override
public ThemeStyle getThemeStyle() { public ThemeStyle getThemeStyle() {

View File

@ -54,6 +54,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.error.PSystemError; import net.sourceforge.plantuml.error.PSystemError;
import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.Defines;
@ -68,13 +69,13 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader {
protected File outputFile; protected File outputFile;
protected final BlockUmlBuilder builder; protected final BlockUmlBuilder builder;
protected /*final*/ FileFormatOption fileFormatOption; protected /* final */ FileFormatOption fileFormatOption;
private boolean checkMetadata; private boolean checkMetadata;
private boolean noerror; private boolean noerror;
public SourceFileReaderAbstract(File file, FileFormatOption fileFormatOption, Defines defines, List<String> config, String charsetName) public SourceFileReaderAbstract(File file, FileFormatOption fileFormatOption, Defines defines, List<String> config,
throws IOException { String charsetName) throws IOException {
if (!file.exists()) { if (!file.exists()) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
@ -83,7 +84,7 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader {
this.file = file; this.file = file;
this.fileFormatOption = fileFormatOption; this.fileFormatOption = fileFormatOption;
this.builder = new BlockUmlBuilder(config, charset, defines, getReader(charset), this.builder = new BlockUmlBuilder(fileFormatOption.getStyle(), config, charset, defines, getReader(charset),
SFile.fromFile(file.getAbsoluteFile().getParentFile()), FileWithSuffix.getFileName(file)); SFile.fromFile(file.getAbsoluteFile().getParentFile()), FileWithSuffix.getFileName(file));
} }
@ -112,6 +113,7 @@ public abstract class SourceFileReaderAbstract implements ISourceFileReader {
return builder.getIncludedFiles(); return builder.getIncludedFiles();
} }
@Deprecated
public final void setFileFormatOption(FileFormatOption fileFormatOption) { public final void setFileFormatOption(FileFormatOption fileFormatOption) {
this.fileFormatOption = fileFormatOption; this.fileFormatOption = fileFormatOption;
} }

View File

@ -47,6 +47,7 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
@ -58,6 +59,7 @@ import net.sourceforge.plantuml.svek.TextBlockBackcolored;
public class SourceStringReader { public class SourceStringReader {
final private List<BlockUml> blocks; final private List<BlockUml> blocks;
final private ThemeStyle style;
public SourceStringReader(String source) { public SourceStringReader(String source) {
this(Defines.createEmpty(), source, Collections.<String>emptyList()); this(Defines.createEmpty(), source, Collections.<String>emptyList());
@ -87,23 +89,27 @@ public class SourceStringReader {
this(defines, source, charset, config, FileSystem.getInstance().getCurrentDir()); this(defines, source, charset, config, FileSystem.getInstance().getCurrentDir());
} }
public SourceStringReader(Defines defines, String source, String charset, List<String> config, SFile newCurrentDir) { public SourceStringReader(Defines defines, String source, String charset, List<String> config,
SFile newCurrentDir) {
this(defines, source, charsetOrDefault(charset), config, newCurrentDir); this(defines, source, charsetOrDefault(charset), config, newCurrentDir);
} }
public SourceStringReader(Defines defines, String source, Charset charset, List<String> config, public SourceStringReader(Defines defines, String source, Charset charset, List<String> config,
SFile newCurrentDir) { SFile newCurrentDir) {
// // WARNING GLOBAL LOCK HERE this(defines, source, charset, config, newCurrentDir, ThemeStyle.LIGHT_REGULAR);
// synchronized (SourceStringReader.class) { }
public SourceStringReader(Defines defines, String source, Charset charset, List<String> config, SFile newCurrentDir,
ThemeStyle style) {
this.style = style;
try { try {
final BlockUmlBuilder builder = new BlockUmlBuilder(config, charset, defines, new StringReader(source), final BlockUmlBuilder builder = new BlockUmlBuilder(style, config, charset, defines,
newCurrentDir, "string"); new StringReader(source), newCurrentDir, "string");
this.blocks = builder.getBlockUmls(); this.blocks = builder.getBlockUmls();
} catch (IOException e) { } catch (IOException e) {
Log.error("error " + e); Log.error("error " + e);
throw new IllegalStateException(e); throw new IllegalStateException(e);
} }
// }
} }
@Deprecated @Deprecated
@ -128,11 +134,11 @@ public class SourceStringReader {
@Deprecated @Deprecated
public String generateImage(OutputStream os, FileFormatOption fileFormatOption) throws IOException { public String generateImage(OutputStream os, FileFormatOption fileFormatOption) throws IOException {
return outputImage(os, fileFormatOption).getDescription(); return outputImage(os, fileFormatOption.withStyle(style)).getDescription();
} }
public DiagramDescription outputImage(OutputStream os, FileFormatOption fileFormatOption) throws IOException { public DiagramDescription outputImage(OutputStream os, FileFormatOption fileFormatOption) throws IOException {
return outputImage(os, 0, fileFormatOption); return outputImage(os, 0, fileFormatOption.withStyle(style));
} }
@Deprecated @Deprecated
@ -146,11 +152,12 @@ public class SourceStringReader {
@Deprecated @Deprecated
public String generateImage(OutputStream os, int numImage, FileFormatOption fileFormatOption) throws IOException { public String generateImage(OutputStream os, int numImage, FileFormatOption fileFormatOption) throws IOException {
return outputImage(os, numImage, fileFormatOption).getDescription(); return outputImage(os, numImage, fileFormatOption.withStyle(style)).getDescription();
} }
public DiagramDescription outputImage(OutputStream os, int numImage, FileFormatOption fileFormatOption) public DiagramDescription outputImage(OutputStream os, int numImage, FileFormatOption fileFormatOption)
throws IOException { throws IOException {
fileFormatOption = fileFormatOption.withStyle(style);
if (blocks.size() == 0) { if (blocks.size() == 0) {
noStartumlFound(os, fileFormatOption); noStartumlFound(os, fileFormatOption);
return null; return null;
@ -175,6 +182,7 @@ public class SourceStringReader {
} }
public DiagramDescription generateDiagramDescription(int numImage, FileFormatOption fileFormatOption) { public DiagramDescription generateDiagramDescription(int numImage, FileFormatOption fileFormatOption) {
fileFormatOption = fileFormatOption.withStyle(style);
if (blocks.size() == 0) { if (blocks.size() == 0) {
return null; return null;
} }
@ -201,14 +209,15 @@ public class SourceStringReader {
} }
public DiagramDescription generateDiagramDescription(FileFormatOption fileFormatOption) { public DiagramDescription generateDiagramDescription(FileFormatOption fileFormatOption) {
return generateDiagramDescription(0, fileFormatOption); return generateDiagramDescription(0, fileFormatOption.withStyle(style));
} }
public DiagramDescription generateDiagramDescription(int numImage) { public DiagramDescription generateDiagramDescription(int numImage) {
return generateDiagramDescription(numImage, new FileFormatOption(FileFormat.PNG)); return generateDiagramDescription(numImage, new FileFormatOption(FileFormat.PNG).withStyle(style));
} }
public String getCMapData(int numImage, FileFormatOption fileFormatOption) throws IOException { public String getCMapData(int numImage, FileFormatOption fileFormatOption) throws IOException {
fileFormatOption = fileFormatOption.withStyle(style);
if (blocks.size() == 0) { if (blocks.size() == 0) {
return null; return null;
} }
@ -229,11 +238,11 @@ public class SourceStringReader {
} }
public ImageData noStartumlFound(OutputStream os, FileFormatOption fileFormatOption) throws IOException { public ImageData noStartumlFound(OutputStream os, FileFormatOption fileFormatOption) throws IOException {
fileFormatOption = fileFormatOption.withStyle(style);
final TextBlockBackcolored error = GraphicStrings.createForError(Arrays.asList("No @startuml/@enduml found"), final TextBlockBackcolored error = GraphicStrings.createForError(Arrays.asList("No @startuml/@enduml found"),
fileFormatOption.isUseRedForError()); fileFormatOption.isUseRedForError());
return plainImageBuilder(error, fileFormatOption) return plainImageBuilder(error, fileFormatOption).write(os);
.write(os);
} }
public final List<BlockUml> getBlocks() { public final List<BlockUml> getBlocks() {

View File

@ -35,6 +35,7 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.sprite.Sprite;
public interface SpriteContainer extends SvgCharSizeHack { public interface SpriteContainer extends SvgCharSizeHack {

View File

@ -37,6 +37,7 @@ package net.sourceforge.plantuml;
import java.util.Map; import java.util.Map;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.sprite.Sprite; import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.sprite.SpriteImage; import net.sourceforge.plantuml.sprite.SpriteImage;
@ -103,7 +104,7 @@ public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
} }
public ThemeStyle getThemeStyle() { public ThemeStyle getThemeStyle() {
return ThemeStyle.LIGHT; return ThemeStyle.LIGHT_REGULAR;
} }
} }

View File

@ -41,6 +41,7 @@ import java.io.InputStream;
import net.sourceforge.plantuml.anim.Animation; import net.sourceforge.plantuml.anim.Animation;
import net.sourceforge.plantuml.anim.AnimationDecoder; import net.sourceforge.plantuml.anim.AnimationDecoder;
import net.sourceforge.plantuml.api.ApiStable; import net.sourceforge.plantuml.api.ApiStable;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -86,18 +87,18 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
return pragma; return pragma;
} }
public TitledDiagram(UmlSource source, UmlDiagramType type) { public TitledDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type) {
super(source); super(source);
this.type = type; this.type = type;
this.skinParam = SkinParam.create(type); this.skinParam = SkinParam.create(type, style);
} }
public final StyleBuilder getCurrentStyleBuilder() { public final StyleBuilder getCurrentStyleBuilder() {
return skinParam.getCurrentStyleBuilder(); return skinParam.getCurrentStyleBuilder();
} }
public TitledDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) { public TitledDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type, ISkinSimple orig) {
this(source, type); this(style, source, type);
if (orig != null) { if (orig != null) {
this.skinParam.copyAllFrom(orig); this.skinParam.copyAllFrom(orig);
} }

View File

@ -52,6 +52,7 @@ import java.io.PrintWriter;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
@ -86,12 +87,12 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
private int minwidth = Integer.MAX_VALUE; private int minwidth = Integer.MAX_VALUE;
public UmlDiagram(UmlSource source, UmlDiagramType type) { public UmlDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type) {
super(source, type); super(style, source, type);
} }
public UmlDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) { public UmlDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type, ISkinSimple orig) {
super(source, type, orig); super(style, source, type, orig);
} }
final public int getMinwidth() { final public int getMinwidth() {
@ -111,24 +112,23 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
} }
public final DisplaySection getFooterOrHeaderTeoz(FontParam param) { public final DisplaySection getFooterOrHeaderTeoz(FontParam param) {
if (param == FontParam.FOOTER) { if (param == FontParam.FOOTER)
return getFooter(); return getFooter();
}
if (param == FontParam.HEADER) { if (param == FontParam.HEADER)
return getHeader(); return getHeader();
}
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
@Override @Override
final protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption) final protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException { throws IOException {
fileFormatOption = fileFormatOption.withTikzFontDistortion(getSkinParam().getTikzFontDistortion()); fileFormatOption = fileFormatOption.withTikzFontDistortion(getSkinParam().getTikzFontDistortion());
if (fileFormatOption.getFileFormat() == FileFormat.PDF) { if (fileFormatOption.getFileFormat() == FileFormat.PDF)
return exportDiagramInternalPdf(os, index); return exportDiagramInternalPdf(os, index);
}
try { try {
final ImageData imageData = exportDiagramInternal(os, index, fileFormatOption); final ImageData imageData = exportDiagramInternal(os, index, fileFormatOption);
@ -141,7 +141,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
e.printStackTrace(); e.printStackTrace();
exportDiagramError(os, e.getCause(), fileFormatOption, e.getGraphvizVersion()); exportDiagramError(os, e.getCause(), fileFormatOption, e.getGraphvizVersion());
} catch (Throwable e) { } catch (Throwable e) {
//e.printStackTrace(); // e.printStackTrace();
exportDiagramError(os, e, fileFormatOption, null); exportDiagramError(os, e, fileFormatOption, null);
} }
return ImageDataSimple.error(); return ImageDataSimple.error();
@ -172,27 +172,24 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
Log.error("Issue in flashcode generation " + e); Log.error("Issue in flashcode generation " + e);
// e.printStackTrace(); // e.printStackTrace();
} }
if (im2 != null) { if (im2 != null)
GraphvizCrash.addDecodeHint(strings); GraphvizCrash.addDecodeHint(strings);
}
} }
final BufferedImage im = im2; final BufferedImage im = im2;
final TextBlockBackcolored graphicStrings = GraphicStrings.createBlackOnWhite(strings, IconLoader.getRandom(), final TextBlockBackcolored graphicStrings = GraphicStrings.createBlackOnWhite(strings, IconLoader.getRandom(),
GraphicPosition.BACKGROUND_CORNER_TOP_RIGHT); GraphicPosition.BACKGROUND_CORNER_TOP_RIGHT);
final UDrawable drawable = (im == null) ? graphicStrings : new UDrawable() { final UDrawable drawable = (im == null) ? graphicStrings : new UDrawable() {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
graphicStrings.drawU(ug); graphicStrings.drawU(ug);
final double height = graphicStrings.calculateDimension(ug.getStringBounder()).getHeight(); final double height = graphicStrings.calculateDimension(ug.getStringBounder()).getHeight();
ug = ug.apply(UTranslate.dy(height)); ug = ug.apply(UTranslate.dy(height));
ug.draw(new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR)).scale(3)); ug.draw(new UImage(new PixelImage(im, AffineTransformType.TYPE_NEAREST_NEIGHBOR)).scale(3));
} }
}; };
plainImageBuilder(drawable, fileFormat) plainImageBuilder(drawable, fileFormat).metadata(metadata).seed(seed).write(os);
.metadata(metadata)
.seed(seed)
.write(os);
} }
private static void exportDiagramErrorText(OutputStream os, Throwable exception, List<String> strings) { private static void exportDiagramErrorText(OutputStream os, Throwable exception, List<String> strings) {
@ -209,18 +206,18 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
public String getFlashData() { public String getFlashData() {
final UmlSource source = getSource(); final UmlSource source = getSource();
if (source == null) { if (source == null)
return ""; return "";
}
return source.getPlainString(); return source.getPlainString();
} }
static private List<String> getFailureText1(Throwable exception, String graphvizVersion, String textDiagram) { static private List<String> getFailureText1(Throwable exception, String graphvizVersion, String textDiagram) {
final List<String> strings = GraphvizCrash.anErrorHasOccured(exception, textDiagram); final List<String> strings = GraphvizCrash.anErrorHasOccured(exception, textDiagram);
strings.add("PlantUML (" + Version.versionString() + ") cannot parse result from dot/GraphViz."); strings.add("PlantUML (" + Version.versionString() + ") cannot parse result from dot/GraphViz.");
if (exception instanceof EmptySvgException) { if (exception instanceof EmptySvgException)
strings.add("Because dot/GraphViz returns an empty string."); strings.add("Because dot/GraphViz returns an empty string.");
}
GraphvizCrash.checkOldVersionWarning(strings); GraphvizCrash.checkOldVersionWarning(strings);
if (graphvizVersion != null) { if (graphvizVersion != null) {
strings.add(" "); strings.add(" ");
@ -289,9 +286,9 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
final String name = changeName(suggestedFile.getFile(index).getAbsolutePath()); final String name = changeName(suggestedFile.getFile(index).getAbsolutePath());
final SFile cmapFile = new SFile(name); final SFile cmapFile = new SFile(name);
try (PrintWriter pw = cmapFile.createPrintWriter()) { try (PrintWriter pw = cmapFile.createPrintWriter()) {
if (PSystemUtils.canFileBeWritten(cmapFile) == false) { if (PSystemUtils.canFileBeWritten(cmapFile) == false)
return; return;
}
pw.print(cmapdata.getCMapData(cmapFile.getName().substring(0, cmapFile.getName().length() - 6))); pw.print(cmapdata.getCMapData(cmapFile.getName().substring(0, cmapFile.getName().length() - 6)));
} }
} }
@ -302,24 +299,24 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
@Override @Override
public String getWarningOrError() { public String getWarningOrError() {
if (lastInfo == null) { if (lastInfo == null)
return null; return null;
}
final double actualWidth = lastInfo.getWidth(); final double actualWidth = lastInfo.getWidth();
if (actualWidth == 0) { if (actualWidth == 0)
return null; return null;
}
final String value = getSkinParam().getValue("widthwarning"); final String value = getSkinParam().getValue("widthwarning");
if (value == null) { if (value == null)
return null; return null;
}
if (value.matches("\\d+") == false) { if (value.matches("\\d+") == false)
return null; return null;
}
final int widthwarning = Integer.parseInt(value); final int widthwarning = Integer.parseInt(value);
if (actualWidth > widthwarning) { if (actualWidth > widthwarning)
return "The image is " + ((int) actualWidth) + " pixel width. (Warning limit is " + widthwarning + ")"; return "The image is " + ((int) actualWidth) + " pixel width. (Warning limit is " + widthwarning + ")";
}
return null; return null;
} }

View File

@ -40,11 +40,12 @@ public class UseStyle {
private static final ThreadLocal<Boolean> useBeta = new ThreadLocal<>(); private static final ThreadLocal<Boolean> useBeta = new ThreadLocal<>();
static public boolean useBetaStyle() { static public boolean useBetaStyle() {
final Boolean result = useBeta.get(); // final Boolean result = useBeta.get();
if (result == null) { // if (result == null) {
return false; // return false;
} // }
return result; // return result;
return true;
} }
static public void setBetaStyle(boolean betastyle) { static public void setBetaStyle(boolean betastyle) {

View File

@ -41,6 +41,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import ext.plantuml.com.ctreber.acearth.plugins.markers.Marker; import ext.plantuml.com.ctreber.acearth.plugins.markers.Marker;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.command.PSystemBasicFactory;
import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.MyPattern;
@ -55,7 +56,7 @@ public class PSystemXearthFactory extends PSystemBasicFactory<PSystemXearth> {
private int height; private int height;
@Override @Override
public PSystemXearth initDiagram(UmlSource source, String startLine) { public PSystemXearth initDiagram(ThemeStyle style, UmlSource source, String startLine) {
this.width = 512; this.width = 512;
this.height = 512; this.height = 512;
this.config.clear(); this.config.clear();
@ -74,18 +75,18 @@ public class PSystemXearthFactory extends PSystemBasicFactory<PSystemXearth> {
} }
@Override @Override
public PSystemXearth executeLine(UmlSource source, PSystemXearth system, String line) { public PSystemXearth executeLine(ThemeStyle style, UmlSource source, PSystemXearth system, String line) {
if (system == null && line.startsWith("xearth")) { if (system == null && line.startsWith("xearth")) {
extractDimension(line); extractDimension(line);
system = new PSystemXearth(source, width, height, config, markers); system = new PSystemXearth(source, width, height, config, markers);
return system; return system;
} }
if (system == null) { if (system == null)
return null; return null;
}
if (line.startsWith("#") || line.startsWith("'")) { if (line.startsWith("#") || line.startsWith("'"))
return system; return system;
}
final Pattern2 p = MyPattern.cmpile("(\\w+)[%s]*=[%s]*(.*)"); final Pattern2 p = MyPattern.cmpile("(\\w+)[%s]*=[%s]*(.*)");
final Matcher2 m = p.matcher(line); final Matcher2 m = p.matcher(line);
if (m.find()) { if (m.find()) {

View File

@ -42,6 +42,7 @@ import java.util.Objects;
import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Code;
@ -62,8 +63,8 @@ public class ActivityDiagram extends CucaDiagram {
private IEntity lastEntityBrancheConsulted; private IEntity lastEntityBrancheConsulted;
private ConditionalContext currentContext; private ConditionalContext currentContext;
public ActivityDiagram(UmlSource source, ISkinSimple skinParam) { public ActivityDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
super(source, UmlDiagramType.ACTIVITY, skinParam); super(style, source, UmlDiagramType.ACTIVITY, skinParam);
setNamespaceSeparator(null); setNamespaceSeparator(null);
} }

View File

@ -46,6 +46,7 @@ import net.sourceforge.plantuml.activitydiagram.command.CommandIf;
import net.sourceforge.plantuml.activitydiagram.command.CommandLinkActivity; import net.sourceforge.plantuml.activitydiagram.command.CommandLinkActivity;
import net.sourceforge.plantuml.activitydiagram.command.CommandLinkLongActivity; import net.sourceforge.plantuml.activitydiagram.command.CommandLinkLongActivity;
import net.sourceforge.plantuml.activitydiagram.command.CommandPartition; import net.sourceforge.plantuml.activitydiagram.command.CommandPartition;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2; import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.CommandFootboxIgnored;
@ -59,8 +60,8 @@ import net.sourceforge.plantuml.core.UmlSource;
public class ActivityDiagramFactory extends PSystemCommandFactory { public class ActivityDiagramFactory extends PSystemCommandFactory {
@Override @Override
public ActivityDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public ActivityDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
return new ActivityDiagram(source, skinParam); return new ActivityDiagram(style, source, skinParam);
} }
@Override @Override

View File

@ -46,6 +46,7 @@ import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlanes; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlanes;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
@ -74,23 +75,22 @@ public class ActivityDiagram3 extends UmlDiagram {
private final Swimlanes swinlanes = new Swimlanes(getSkinParam(), getPragma()); private final Swimlanes swinlanes = new Swimlanes(getSkinParam(), getPragma());
public ActivityDiagram3(UmlSource source, ISkinSimple skinParam) { public ActivityDiagram3(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
super(source, UmlDiagramType.ACTIVITY, skinParam); super(style, source, UmlDiagramType.ACTIVITY, skinParam);
} }
private void manageSwimlaneStrategy() { private void manageSwimlaneStrategy() {
if (swimlaneStrategy == null) { if (swimlaneStrategy == null)
swimlaneStrategy = SwimlaneStrategy.SWIMLANE_FORBIDDEN; swimlaneStrategy = SwimlaneStrategy.SWIMLANE_FORBIDDEN;
}
} }
public CommandExecutionResult swimlane(String name, HColor color, Display label) { public CommandExecutionResult swimlane(String name, HColor color, Display label) {
if (swimlaneStrategy == null) { if (swimlaneStrategy == null)
swimlaneStrategy = SwimlaneStrategy.SWIMLANE_ALLOWED; swimlaneStrategy = SwimlaneStrategy.SWIMLANE_ALLOWED;
}
if (swimlaneStrategy == SwimlaneStrategy.SWIMLANE_FORBIDDEN) { if (swimlaneStrategy == SwimlaneStrategy.SWIMLANE_FORBIDDEN)
return CommandExecutionResult.error("This swimlane must be defined at the start of the diagram."); return CommandExecutionResult.error("This swimlane must be defined at the start of the diagram.");
}
swinlanes.swimlane(name, color, label); swinlanes.swimlane(name, color, label);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
@ -114,14 +114,14 @@ public class ActivityDiagram3 extends UmlDiagram {
final InstructionSimple ins = new InstructionSimple(activity, nextLinkRenderer(), final InstructionSimple ins = new InstructionSimple(activity, nextLinkRenderer(),
swinlanes.getCurrentSwimlane(), style, url, colors, stereotype); swinlanes.getCurrentSwimlane(), style, url, colors, stereotype);
final CommandExecutionResult added = current().add(ins); final CommandExecutionResult added = current().add(ins);
if (added.isOk() == false) { if (added.isOk() == false)
return added; return added;
}
setNextLinkRendererInternal(LinkRendering.none()); setNextLinkRendererInternal(LinkRendering.none());
manageHasUrl(activity); manageHasUrl(activity);
if (url != null) { if (url != null)
hasUrl = true; hasUrl = true;
}
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }
@ -157,34 +157,34 @@ public class ActivityDiagram3 extends UmlDiagram {
public void stop() { public void stop() {
manageSwimlaneStrategy(); manageSwimlaneStrategy();
final InstructionStop ins = new InstructionStop(swinlanes.getCurrentSwimlane(), nextLinkRenderer()); final InstructionStop ins = new InstructionStop(swinlanes.getCurrentSwimlane(), nextLinkRenderer());
if (manageSpecialStopEndAfterEndWhile(ins)) { if (manageSpecialStopEndAfterEndWhile(ins))
return; return;
}
current().add(ins); current().add(ins);
} }
public void end() { public void end() {
manageSwimlaneStrategy(); manageSwimlaneStrategy();
final InstructionEnd ins = new InstructionEnd(swinlanes.getCurrentSwimlane(), nextLinkRenderer()); final InstructionEnd ins = new InstructionEnd(swinlanes.getCurrentSwimlane(), nextLinkRenderer());
if (manageSpecialStopEndAfterEndWhile(ins)) { if (manageSpecialStopEndAfterEndWhile(ins))
return; return;
}
current().add(ins); current().add(ins);
} }
private boolean manageSpecialStopEndAfterEndWhile(Instruction special) { private boolean manageSpecialStopEndAfterEndWhile(Instruction special) {
if (current() instanceof InstructionList == false) { if (current() instanceof InstructionList == false)
return false; return false;
}
final InstructionList current = (InstructionList) current(); final InstructionList current = (InstructionList) current();
final Instruction last = current.getLast(); final Instruction last = current.getLast();
if (last instanceof InstructionWhile == false) { if (last instanceof InstructionWhile == false)
return false; return false;
}
final InstructionWhile instructionWhile = (InstructionWhile) last; final InstructionWhile instructionWhile = (InstructionWhile) last;
if (instructionWhile.containsBreak()) { if (instructionWhile.containsBreak())
return false; return false;
}
instructionWhile.setSpecial(special); instructionWhile.setSpecial(special);
return true; return true;
} }
@ -285,9 +285,9 @@ public class ActivityDiagram3 extends UmlDiagram {
public CommandExecutionResult switchCase(Display labelCase) { public CommandExecutionResult switchCase(Display labelCase) {
if (current() instanceof InstructionSwitch) { if (current() instanceof InstructionSwitch) {
final boolean ok = ((InstructionSwitch) current()).switchCase(labelCase, nextLinkRenderer()); final boolean ok = ((InstructionSwitch) current()).switchCase(labelCase, nextLinkRenderer());
if (ok == false) { if (ok == false)
return CommandExecutionResult.error("You cannot put an elseIf here"); return CommandExecutionResult.error("You cannot put an elseIf here");
}
setNextLinkRendererInternal(LinkRendering.none()); setNextLinkRendererInternal(LinkRendering.none());
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
@ -317,9 +317,9 @@ public class ActivityDiagram3 extends UmlDiagram {
public CommandExecutionResult elseIf(LinkRendering inlabel, Display test, LinkRendering whenThen, HColor color) { public CommandExecutionResult elseIf(LinkRendering inlabel, Display test, LinkRendering whenThen, HColor color) {
if (current() instanceof InstructionIf) { if (current() instanceof InstructionIf) {
final boolean ok = ((InstructionIf) current()).elseIf(inlabel, test, whenThen, nextLinkRenderer(), color); final boolean ok = ((InstructionIf) current()).elseIf(inlabel, test, whenThen, nextLinkRenderer(), color);
if (ok == false) { if (ok == false)
return CommandExecutionResult.error("You cannot put an elseIf here"); return CommandExecutionResult.error("You cannot put an elseIf here");
}
setNextLinkRendererInternal(LinkRendering.none()); setNextLinkRendererInternal(LinkRendering.none());
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }
@ -329,9 +329,9 @@ public class ActivityDiagram3 extends UmlDiagram {
public CommandExecutionResult else2(LinkRendering whenElse) { public CommandExecutionResult else2(LinkRendering whenElse) {
if (current() instanceof InstructionIf) { if (current() instanceof InstructionIf) {
final boolean result = ((InstructionIf) current()).swithToElse2(whenElse, nextLinkRenderer()); final boolean result = ((InstructionIf) current()).swithToElse2(whenElse, nextLinkRenderer());
if (result == false) { if (result == false)
return CommandExecutionResult.error("Cannot find if"); return CommandExecutionResult.error("Cannot find if");
}
setNextLinkRendererInternal(LinkRendering.none()); setNextLinkRendererInternal(LinkRendering.none());
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }
@ -411,9 +411,9 @@ public class ActivityDiagram3 extends UmlDiagram {
} }
final public CommandExecutionResult kill() { final public CommandExecutionResult kill() {
if (current().kill() == false) { if (current().kill() == false)
return CommandExecutionResult.error("kill cannot be used here"); return CommandExecutionResult.error("kill cannot be used here");
}
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }
@ -444,11 +444,11 @@ public class ActivityDiagram3 extends UmlDiagram {
// System.err.println("setNextLink=" + linkRenderer); // System.err.println("setNextLink=" + linkRenderer);
if (current() instanceof InstructionCollection) { if (current() instanceof InstructionCollection) {
final Instruction last = ((InstructionCollection) current()).getLast(); final Instruction last = ((InstructionCollection) current()).getLast();
if (last instanceof InstructionWhile) { if (last instanceof InstructionWhile)
((InstructionWhile) last).outColor(linkRenderer.getRainbow()); ((InstructionWhile) last).outColor(linkRenderer.getRainbow());
} else if (last instanceof InstructionIf) { else if (last instanceof InstructionIf)
((InstructionIf) last).outColor(linkRenderer); ((InstructionIf) last).outColor(linkRenderer);
}
} }
this.setNextLinkRendererInternal(linkRenderer); this.setNextLinkRendererInternal(linkRenderer);
} }
@ -468,18 +468,18 @@ public class ActivityDiagram3 extends UmlDiagram {
} }
public void setColorNextArrow(Rainbow color) { public void setColorNextArrow(Rainbow color) {
if (color == null) { if (color == null)
return; return;
}
final LinkRendering link = new LinkRendering(color); final LinkRendering link = new LinkRendering(color);
setNextLink(link); setNextLink(link);
} }
public CommandExecutionResult addNote(Display note, NotePosition position, NoteType type, Colors colors) { public CommandExecutionResult addNote(Display note, NotePosition position, NoteType type, Colors colors) {
final boolean ok = current().addNote(note, position, type, colors, swinlanes.getCurrentSwimlane()); final boolean ok = current().addNote(note, position, type, colors, swinlanes.getCurrentSwimlane());
if (ok == false) { if (ok == false)
return CommandExecutionResult.error("Cannot add note here"); return CommandExecutionResult.error("Cannot add note here");
}
manageHasUrl(note); manageHasUrl(note);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }
@ -487,9 +487,9 @@ public class ActivityDiagram3 extends UmlDiagram {
private boolean hasUrl = false; private boolean hasUrl = false;
private void manageHasUrl(Display display) { private void manageHasUrl(Display display) {
if (display.hasUrl()) { if (display.hasUrl())
hasUrl = true; hasUrl = true;
}
} }
@Override @Override

View File

@ -84,11 +84,12 @@ import net.sourceforge.plantuml.activitydiagram3.command.CommandSwimlane2;
import net.sourceforge.plantuml.activitydiagram3.command.CommandSwitch; import net.sourceforge.plantuml.activitydiagram3.command.CommandSwitch;
import net.sourceforge.plantuml.activitydiagram3.command.CommandWhile3; import net.sourceforge.plantuml.activitydiagram3.command.CommandWhile3;
import net.sourceforge.plantuml.activitydiagram3.command.CommandWhileEnd3; import net.sourceforge.plantuml.activitydiagram3.command.CommandWhileEnd3;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandDecoratorMultine; import net.sourceforge.plantuml.command.CommandDecoratorMultine;
import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.CommandFootboxIgnored;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
public class ActivityDiagramFactory3 extends PSystemCommandFactory { public class ActivityDiagramFactory3 extends PSystemCommandFactory {
@ -161,8 +162,8 @@ public class ActivityDiagramFactory3 extends PSystemCommandFactory {
} }
@Override @Override
public ActivityDiagram3 createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public ActivityDiagram3 createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
return new ActivityDiagram3(source, skinParam); return new ActivityDiagram3(style, source, skinParam);
} }
} }

View File

@ -105,7 +105,7 @@ public class Hexagon {
}; };
} }
public static UPolygon asPolygonSquare(boolean shadowing, double width, double height) { public static UPolygon asPolygonSquare(double shadowing, double width, double height) {
final UPolygon diams = new UPolygon(); final UPolygon diams = new UPolygon();
diams.addPoint(width / 2, 0); diams.addPoint(width / 2, 0);
@ -113,9 +113,7 @@ public class Hexagon {
diams.addPoint(width / 2, height); diams.addPoint(width / 2, height);
diams.addPoint(0, height / 2); diams.addPoint(0, height / 2);
if (shadowing) { diams.setDeltaShadow(shadowing);
diams.setDeltaShadow(3);
}
return diams; return diams;
} }

View File

@ -163,10 +163,20 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
} }
private Ftile getDiamond2(Swimlane swimlane, Branch branch0) { private Ftile getDiamond2(Swimlane swimlane, Branch branch0) {
final HColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); final HColor borderColor;
final HColor backColor = branch0.getColor() == null final HColor backColor;
? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground) if (UseStyle.useBetaStyle()) {
: branch0.getColor(); final Style style = getDefaultStyleDefinitionDiamond().getMergedStyle(skinParam().getCurrentStyleBuilder());
borderColor = style.value(PName.LineColor).asColor(skinParam().getThemeStyle(),
skinParam().getIHtmlColorSet());
backColor = branch0.getColor() == null ? style.value(PName.BackGroundColor)
.asColor(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet()) : branch0.getColor();
} else {
borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
backColor = branch0.getColor() == null
? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground)
: branch0.getColor();
}
return new FtileDiamondInside(TextBlockUtils.empty(0, 0), branch0.skinParam(), backColor, borderColor, return new FtileDiamondInside(TextBlockUtils.empty(0, 0), branch0.skinParam(), backColor, borderColor,
swimlane); swimlane);

View File

@ -96,9 +96,7 @@ public class FtileGroup extends AbstractFtile {
super(inner.skinParam()); super(inner.skinParam());
this.roundCorner = roundCorner; this.roundCorner = roundCorner;
this.type = type; this.type = type;
this.backColor = backColor == null ? HColorUtils.WHITE : backColor;
this.inner = FtileUtils.addHorizontalMargin(inner, 10); this.inner = FtileUtils.addHorizontalMargin(inner, 10);
this.borderColor = borderColor == null ? HColorUtils.BLACK : borderColor;
final FontConfiguration fc; final FontConfiguration fc;
final Style style; final Style style;
@ -106,7 +104,15 @@ public class FtileGroup extends AbstractFtile {
style = getDefaultStyleDefinitionPartition().getMergedStyle(skinParam.getCurrentStyleBuilder()); style = getDefaultStyleDefinitionPartition().getMergedStyle(skinParam.getCurrentStyleBuilder());
fc = style.getFontConfiguration(skinParam.getThemeStyle(), getIHtmlColorSet()); fc = style.getFontConfiguration(skinParam.getThemeStyle(), getIHtmlColorSet());
this.shadowing = style.value(PName.Shadowing).asDouble(); this.shadowing = style.value(PName.Shadowing).asDouble();
this.backColor = backColor == null
? style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet())
: backColor;
this.borderColor = borderColor == null
? style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet())
: borderColor;
} else { } else {
this.backColor = backColor == null ? HColorUtils.WHITE : backColor;
this.borderColor = borderColor == null ? HColorUtils.BLACK : borderColor;
style = null; style = null;
final UFont font = skinParam.getFont(null, false, FontParam.PARTITION); final UFont font = skinParam.getFont(null, false, FontParam.PARTITION);
final HColor fontColor = skinParam.getFontHtmlColor(null, FontParam.PARTITION); final HColor fontColor = skinParam.getFontHtmlColor(null, FontParam.PARTITION);
@ -114,16 +120,15 @@ public class FtileGroup extends AbstractFtile {
skinParam.useUnderlineForHyperlink(), skinParam.getTabSize()); skinParam.useUnderlineForHyperlink(), skinParam.getTabSize());
this.shadowing = skinParam().shadowing(null) ? 3 : 0; 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
this.name = title.create(fc, HorizontalAlignment.LEFT, skinParam); this.name = title.create(fc, HorizontalAlignment.LEFT, skinParam);
}
if (Display.isNull(displayNote)) { if (Display.isNull(displayNote))
this.headerNote = TextBlockUtils.empty(0, 0); this.headerNote = TextBlockUtils.empty(0, 0);
} else { else
this.headerNote = new FloatingNote(displayNote, skinParam, style); this.headerNote = new FloatingNote(displayNote, skinParam, style);
}
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;
@ -183,9 +188,9 @@ public class FtileGroup extends AbstractFtile {
private FtileGeometry cachedInnerDimension; private FtileGeometry cachedInnerDimension;
private FtileGeometry getInnerDimension(StringBounder stringBounder) { private FtileGeometry getInnerDimension(StringBounder stringBounder) {
if (cachedInnerDimension == null) { if (cachedInnerDimension == null)
cachedInnerDimension = getInnerDimensionSlow(stringBounder); cachedInnerDimension = getInnerDimensionSlow(stringBounder);
}
return cachedInnerDimension; return cachedInnerDimension;
} }
@ -208,10 +213,10 @@ public class FtileGroup extends AbstractFtile {
final double height = orig.getHeight() + diffHeightTitle(stringBounder) + diffYY2 final double height = orig.getHeight() + diffHeightTitle(stringBounder) + diffYY2
+ headerNoteHeight(stringBounder); + headerNoteHeight(stringBounder);
final double titleAndHeaderNoteHeight = diffHeightTitle(stringBounder) + headerNoteHeight(stringBounder); final double titleAndHeaderNoteHeight = diffHeightTitle(stringBounder) + headerNoteHeight(stringBounder);
if (orig.hasPointOut()) { if (orig.hasPointOut())
return new FtileGeometry(width, height, orig.getLeft() + suppWidth / 2, return new FtileGeometry(width, height, orig.getLeft() + suppWidth / 2,
orig.getInY() + titleAndHeaderNoteHeight, orig.getOutY() + titleAndHeaderNoteHeight); orig.getInY() + titleAndHeaderNoteHeight, orig.getOutY() + titleAndHeaderNoteHeight);
}
return new FtileGeometry(width, height, orig.getLeft() + suppWidth / 2, return new FtileGeometry(width, height, orig.getLeft() + suppWidth / 2,
orig.getInY() + titleAndHeaderNoteHeight); orig.getInY() + titleAndHeaderNoteHeight);
} }
@ -224,8 +229,6 @@ public class FtileGroup extends AbstractFtile {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D dimTotal = calculateDimension(stringBounder); final Dimension2D dimTotal = calculateDimension(stringBounder);
// final double roundCorner =
// type.getSkinParameter().getRoundCorner(skinParam(), null);
final SymbolContext symbolContext = new SymbolContext(backColor, borderColor).withShadow(shadowing) final SymbolContext symbolContext = new SymbolContext(backColor, borderColor).withShadow(shadowing)
.withStroke(stroke).withCorner(roundCorner, 0); .withStroke(stroke).withCorner(roundCorner, 0);

View File

@ -82,9 +82,9 @@ class FtileSwitch extends AbstractFtile {
public Set<Swimlane> getSwimlanes() { public Set<Swimlane> getSwimlanes() {
final Set<Swimlane> result = new HashSet<>(); final Set<Swimlane> result = new HashSet<>();
if (getSwimlaneIn() != null) { if (getSwimlaneIn() != null)
result.add(getSwimlaneIn()); result.add(getSwimlaneIn());
}
return Collections.unmodifiableSet(result); return Collections.unmodifiableSet(result);
} }
@ -102,9 +102,8 @@ class FtileSwitch extends AbstractFtile {
Objects.requireNonNull(afterEndwhile); Objects.requireNonNull(afterEndwhile);
final List<Ftile> tiles = new ArrayList<>(); final List<Ftile> tiles = new ArrayList<>();
for (Branch branch : thens) { for (Branch branch : thens)
tiles.add(new FtileMinWidthCentered(branch.getFtile(), 30)); tiles.add(new FtileMinWidthCentered(branch.getFtile(), 30));
}
List<Double> inlabelSizes = new ArrayList<>(); List<Double> inlabelSizes = new ArrayList<>();
for (Branch branch : thens) { for (Branch branch : thens) {
@ -115,8 +114,8 @@ class FtileSwitch extends AbstractFtile {
ftileFactory.skinParam()); ftileFactory.skinParam());
final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor(); final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor();
FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), diamondColor, FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), diamondColor, borderColor,
borderColor, swimlane); swimlane);
TextBlock tbInlabel = null; TextBlock tbInlabel = null;
if (Display.isNull(branch.getInlabel())) { if (Display.isNull(branch.getInlabel())) {
inlabelSizes.add(0.0); inlabelSizes.add(0.0);
@ -140,9 +139,9 @@ class FtileSwitch extends AbstractFtile {
@Override @Override
public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) { public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
if (tiles.contains(child)) { if (tiles.contains(child))
return getTranslate1(child, stringBounder); return getTranslate1(child, stringBounder);
}
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@ -150,9 +149,9 @@ class FtileSwitch extends AbstractFtile {
double x1 = 0; double x1 = 0;
for (Ftile candidate : tiles) { for (Ftile candidate : tiles) {
final FtileGeometry dim1 = candidate.calculateDimension(stringBounder); final FtileGeometry dim1 = candidate.calculateDimension(stringBounder);
if (candidate == tile) { if (candidate == tile)
return new UTranslate(x1, 25); return new UTranslate(x1, 25);
}
x1 += dim1.getWidth() + xSeparation; x1 += dim1.getWidth() + xSeparation;
} }
throw new IllegalArgumentException(); throw new IllegalArgumentException();
@ -160,16 +159,16 @@ class FtileSwitch extends AbstractFtile {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
for (Ftile tile : tiles) { for (Ftile tile : tiles)
ug.apply(getTranslate1(tile, stringBounder)).draw(tile); ug.apply(getTranslate1(tile, stringBounder)).draw(tile);
}
} }
private FtileGeometry calculateDimensionInternal(StringBounder stringBounder) { private FtileGeometry calculateDimensionInternal(StringBounder stringBounder) {
Dimension2D result = new Dimension2DDouble(0, 0); Dimension2D result = new Dimension2DDouble(0, 0);
for (Ftile couple : tiles) { for (Ftile couple : tiles)
result = Dimension2DDouble.mergeLR(result, couple.calculateDimension(stringBounder)); result = Dimension2DDouble.mergeLR(result, couple.calculateDimension(stringBounder));
}
result = Dimension2DDouble.delta(result, xSeparation * (tiles.size() - 1), 100); result = Dimension2DDouble.delta(result, xSeparation * (tiles.size() - 1), 100);
return new FtileGeometry(result, result.getWidth() / 2, 0); return new FtileGeometry(result, result.getWidth() / 2, 0);
@ -180,11 +179,10 @@ class FtileSwitch extends AbstractFtile {
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder); final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
final List<Ftile> all = new ArrayList<>(tiles); final List<Ftile> all = new ArrayList<>(tiles);
for (Ftile tmp : all) { for (Ftile tmp : all)
if (tmp.calculateDimension(stringBounder).hasPointOut()) { if (tmp.calculateDimension(stringBounder).hasPointOut())
return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0, dimTotal.getHeight()); return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0, dimTotal.getHeight());
}
}
return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0); return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0);
} }

View File

@ -94,10 +94,6 @@ public class VCompactFactory implements FtileFactory {
this.stringBounder = stringBounder; this.stringBounder = stringBounder;
} }
private StyleSignature getSignatureCircle() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle);
}
private StyleSignature getSignatureCircleEnd() { private StyleSignature getSignatureCircleEnd() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.end); return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.end);
} }
@ -106,11 +102,15 @@ public class VCompactFactory implements FtileFactory {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.stop); return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.stop);
} }
private StyleSignature getSignatureCircleStart() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.start);
}
public Ftile start(Swimlane swimlane) { public Ftile start(Swimlane swimlane) {
final HColor color; final HColor color;
Style style = null; Style style = null;
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle()) {
style = getSignatureCircle().getMergedStyle(skinParam.getCurrentStyleBuilder()); style = getSignatureCircleStart().getMergedStyle(skinParam.getCurrentStyleBuilder());
color = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); color = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
} else { } else {
color = rose.getHtmlColor(skinParam, ColorParam.activityStart); color = rose.getHtmlColor(skinParam, ColorParam.activityStart);

View File

@ -70,12 +70,12 @@ public class FtileSwitchNude extends FtileDimensionMemoize {
public Set<Swimlane> getSwimlanes() { public Set<Swimlane> getSwimlanes() {
final Set<Swimlane> result = new HashSet<>(); final Set<Swimlane> result = new HashSet<>();
if (getSwimlaneIn() != null) { if (getSwimlaneIn() != null)
result.add(getSwimlaneIn()); result.add(getSwimlaneIn());
}
for (Ftile tile : tiles) { for (Ftile tile : tiles)
result.addAll(tile.getSwimlanes()); result.addAll(tile.getSwimlanes());
}
return Collections.unmodifiableSet(result); return Collections.unmodifiableSet(result);
} }
@ -89,9 +89,9 @@ public class FtileSwitchNude extends FtileDimensionMemoize {
@Override @Override
public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) { public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
if (tiles.contains(child)) { if (tiles.contains(child))
return getTranslateNude(child, stringBounder); return getTranslateNude(child, stringBounder);
}
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@ -99,9 +99,9 @@ public class FtileSwitchNude extends FtileDimensionMemoize {
double x1 = 0; double x1 = 0;
for (Ftile candidate : tiles) { for (Ftile candidate : tiles) {
final FtileGeometry dim1 = candidate.calculateDimension(stringBounder); final FtileGeometry dim1 = candidate.calculateDimension(stringBounder);
if (candidate == tile) { if (candidate == tile)
return UTranslate.dx(x1); return UTranslate.dx(x1);
}
x1 += dim1.getWidth() + xSeparation; x1 += dim1.getWidth() + xSeparation;
} }
throw new IllegalArgumentException(); throw new IllegalArgumentException();
@ -109,27 +109,27 @@ public class FtileSwitchNude extends FtileDimensionMemoize {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
for (Ftile tile : tiles) { for (Ftile tile : tiles)
ug.apply(getTranslateNude(tile, stringBounder)).draw(tile); ug.apply(getTranslateNude(tile, stringBounder)).draw(tile);
}
} }
@Override @Override
final protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) { final protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder); final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
for (Ftile tile : tiles) for (Ftile tile : tiles)
if (tile.calculateDimension(stringBounder).hasPointOut()) { if (tile.calculateDimension(stringBounder).hasPointOut())
return dimTotal; return dimTotal;
}
return dimTotal.withoutPointOut(); return dimTotal.withoutPointOut();
} }
@Override @Override
protected FtileGeometry calculateDimensionInternalSlow(StringBounder stringBounder) { protected FtileGeometry calculateDimensionInternalSlow(StringBounder stringBounder) {
Dimension2D result = new Dimension2DDouble(0, 0); Dimension2D result = new Dimension2DDouble(0, 0);
for (Ftile couple : tiles) { for (Ftile couple : tiles)
result = Dimension2DDouble.mergeLR(result, couple.calculateDimension(stringBounder)); result = Dimension2DDouble.mergeLR(result, couple.calculateDimension(stringBounder));
}
result = Dimension2DDouble.delta(result, xSeparation * (tiles.size() - 1), 100); result = Dimension2DDouble.delta(result, xSeparation * (tiles.size() - 1), 100);
return new FtileGeometry(result, result.getWidth() / 2, 0); return new FtileGeometry(result, result.getWidth() / 2, 0);

View File

@ -85,18 +85,18 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
- tiles.get(0).calculateDimension(stringBounder).getRight() - tiles.get(0).calculateDimension(stringBounder).getRight()
- tiles.get(tiles.size() - 1).calculateDimension(stringBounder).getLeft(); - tiles.get(tiles.size() - 1).calculateDimension(stringBounder).getLeft();
w9 = getW9(stringBounder); w9 = getW9(stringBounder);
if (w13 > w9) { if (w13 > w9)
mode = Mode.BIG_DIAMOND; mode = Mode.BIG_DIAMOND;
} else { else
mode = Mode.SMALL_DIAMOND; mode = Mode.SMALL_DIAMOND;
}
} }
private double getW9(StringBounder stringBounder) { private double getW9(StringBounder stringBounder) {
double result = 0; double result = 0;
for (int i = 1; i < tiles.size() - 1; i++) { for (int i = 1; i < tiles.size() - 1; i++)
result += tiles.get(i).calculateDimension(stringBounder).getWidth(); result += tiles.get(i).calculateDimension(stringBounder).getWidth();
}
return result; return result;
} }
@ -144,17 +144,15 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1); ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
if (mode == Mode.BIG_DIAMOND) { if (mode == Mode.BIG_DIAMOND)
for (Ftile tile : tiles) { for (Ftile tile : tiles)
tile.drawU(ug.apply(getTranslateOf(tile, stringBounder))); tile.drawU(ug.apply(getTranslateOf(tile, stringBounder)));
} else
} else {
super.drawU(ug.apply(getTranslateMain(stringBounder))); super.drawU(ug.apply(getTranslateMain(stringBounder)));
}
if (calculateDimension(stringBounder).hasPointOut()) { if (calculateDimension(stringBounder).hasPointOut())
ug.apply(getTranslateDiamond2(stringBounder)).draw(diamond2); ug.apply(getTranslateDiamond2(stringBounder)).draw(diamond2);
}
} }
final protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) { final protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) {
@ -163,11 +161,10 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
double dx = 0; double dx = 0;
final double suppx = (w13 - w9) / (tiles.size() - 1); final double suppx = (w13 - w9) / (tiles.size() - 1);
for (int i = 0; i < tiles.size() - 1; i++) { for (int i = 0; i < tiles.size() - 1; i++) {
if (tile == tiles.get(i)) { if (tile == tiles.get(i))
return main.compose(UTranslate.dx(dx)); return main.compose(UTranslate.dx(dx));
}
dx += tiles.get(i).calculateDimension(stringBounder).getWidth() + suppx;
dx += tiles.get(i).calculateDimension(stringBounder).getWidth() + suppx;
} }
if (tile == tiles.get(tiles.size() - 1)) { if (tile == tiles.get(tiles.size() - 1)) {
final double dx9 = tiles.get(0).calculateDimension(stringBounder).getWidth() + w13 + SUPP15 + SUPP15; final double dx9 = tiles.get(0).calculateDimension(stringBounder).getWidth() + w13 + SUPP15 + SUPP15;

View File

@ -41,7 +41,6 @@ import java.util.List;
import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.Branch;
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;
@ -50,7 +49,6 @@ 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.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
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;
@ -100,13 +98,13 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
private Point2D getP1(StringBounder stringBounder) { private Point2D getP1(StringBounder stringBounder) {
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder); final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
final Point2D pt; final Point2D pt;
if (getFtile2() == tiles.get(0)) { if (getFtile2() == tiles.get(0))
pt = dimDiamond1.getPointD(); pt = dimDiamond1.getPointD();
} else if (getFtile2() == tiles.get(tiles.size() - 1)) { else if (getFtile2() == tiles.get(tiles.size() - 1))
pt = dimDiamond1.getPointB(); pt = dimDiamond1.getPointB();
} else { else
throw new IllegalStateException(); throw new IllegalStateException();
}
return getTranslateDiamond1(stringBounder).getTranslated(pt); return getTranslateDiamond1(stringBounder).getTranslated(pt);
} }
@ -129,9 +127,9 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
final FtileGeometry geo = getFtile1().calculateDimension(stringBounder); final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
if (geo.hasPointOut() == false) { if (geo.hasPointOut() == false)
return; return;
}
final Point2D p1 = getP1(stringBounder); final Point2D p1 = getP1(stringBounder);
final double x1 = p1.getX(); final double x1 = p1.getX();
final double y1 = p1.getY(); final double y1 = p1.getY();
@ -320,18 +318,18 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
branches.get(lastOutgoingArrow).getTextBlockSpecial())); branches.get(lastOutgoingArrow).getTextBlockSpecial()));
for (int i = firstOutgoingArrow + 1; i < lastOutgoingArrow; i++) { for (int i = firstOutgoingArrow + 1; i < lastOutgoingArrow; i++) {
final Ftile tile = tiles.get(i); final Ftile tile = tiles.get(i);
if (tile.calculateDimension(stringBounder).hasPointOut()) { if (tile.calculateDimension(stringBounder).hasPointOut())
conns.add(new ConnectionVerticalBottom(tile, branches.get(i).getTextBlockSpecial())); conns.add(new ConnectionVerticalBottom(tile, branches.get(i).getTextBlockSpecial()));
}
} }
} }
private int getFirstOutgoingArrow(StringBounder stringBounder) { private int getFirstOutgoingArrow(StringBounder stringBounder) {
for (int i = 0; i < tiles.size() - 1; i++) { for (int i = 0; i < tiles.size() - 1; i++) {
final Ftile tile = tiles.get(i); final Ftile tile = tiles.get(i);
if (tile.calculateDimension(stringBounder).hasPointOut()) { if (tile.calculateDimension(stringBounder).hasPointOut())
return i; return i;
}
} }
return tiles.size(); return tiles.size();
} }
@ -339,9 +337,9 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
private int getLastOutgoingArrow(StringBounder stringBounder) { private int getLastOutgoingArrow(StringBounder stringBounder) {
for (int i = tiles.size() - 1; i >= 0; i--) { for (int i = tiles.size() - 1; i >= 0; i--) {
final Ftile tile = tiles.get(i); final Ftile tile = tiles.get(i);
if (tile.calculateDimension(stringBounder).hasPointOut()) { if (tile.calculateDimension(stringBounder).hasPointOut())
return i; return i;
}
} }
return -1; return -1;
} }

View File

@ -80,8 +80,8 @@ public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds {
final double x2 = p2.getX(); final double x2 = p2.getX();
final double y2 = p2.getY(); final double y2 = p2.getY();
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(branch.getTextBlockPositive(), final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown())
arrowHorizontalAlignment()); .withLabel(branch.getTextBlockPositive(), arrowHorizontalAlignment());
// snake.addPoint(x1, y1); // snake.addPoint(x1, y1);
snake.addPoint(x2, y1); snake.addPoint(x2, y1);
snake.addPoint(x2, y2); snake.addPoint(x2, y2);
@ -139,9 +139,8 @@ public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds {
final Ftile single = tiles.get(0); final Ftile single = tiles.get(0);
conns.add(new ConnectionVerticalTop(single, branches.get(0))); conns.add(new ConnectionVerticalTop(single, branches.get(0)));
if (single.calculateDimension(stringBounder).hasPointOut()) { if (single.calculateDimension(stringBounder).hasPointOut())
conns.add(new ConnectionVerticalBottom(single)); conns.add(new ConnectionVerticalBottom(single));
}
return FtileUtils.addConnection(this, conns); return FtileUtils.addConnection(this, conns);
} }

View File

@ -66,7 +66,7 @@ public class FtileBlackBlock extends AbstractFtile {
private double width; private double width;
private double height; private double height;
private TextBlock label = TextBlockUtils.empty(0, 0); private TextBlock label = TextBlockUtils.empty(0, 0);
private final HColor colorBar; private HColor colorBar;
private final Swimlane swimlane; private final Swimlane swimlane;
public FtileBlackBlock(ISkinParam skinParam, HColor colorBar, Swimlane swimlane) { public FtileBlackBlock(ISkinParam skinParam, HColor colorBar, Swimlane swimlane) {
@ -93,16 +93,17 @@ public class FtileBlackBlock extends AbstractFtile {
return new FtileGeometry(width + supp, height, width / 2, 0, height); return new FtileGeometry(width + supp, height, width / 2, 0, height);
} }
private StyleSignature getDefaultStyleDefinitionBar() { private StyleSignature getSignature() {
return StyleSignature.of(SName.root, SName.element, SName.activityBar); return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activityBar);
} }
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final URectangle rect = new URectangle(width, height).rounded(5).ignoreForCompressionOnX(); final URectangle rect = new URectangle(width, height).rounded(5).ignoreForCompressionOnX();
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinitionBar().getMergedStyle(skinParam().getCurrentStyleBuilder()); final Style style = getSignature().getMergedStyle(skinParam().getCurrentStyleBuilder());
final double shadowing = style.value(PName.Shadowing).asDouble(); final double shadowing = style.value(PName.Shadowing).asDouble();
rect.setDeltaShadow(shadowing); rect.setDeltaShadow(shadowing);
colorBar = style.value(PName.BackGroundColor).asColor(skinParam().getThemeStyle(), getIHtmlColorSet());
} else { } else {
if (skinParam().shadowing(null)) if (skinParam().shadowing(null))
rect.setDeltaShadow(3); rect.setDeltaShadow(3);

View File

@ -59,8 +59,8 @@ public class FtileCircleEnd extends AbstractFtile {
private static final int SIZE = 20; private static final int SIZE = 20;
private final HColor borderColor; private HColor borderColor;
private final HColor backColor; private HColor backColor;
private final Swimlane swimlane; private final Swimlane swimlane;
private double shadowing; private double shadowing;
@ -76,17 +76,18 @@ public class FtileCircleEnd extends AbstractFtile {
this.swimlane = swimlane; this.swimlane = swimlane;
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle()) {
this.shadowing = style.value(PName.Shadowing).asDouble(); this.shadowing = style.value(PName.Shadowing).asDouble();
} else { this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
if (skinParam().shadowing(null)) { this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
this.shadowing = 3; } else if (skinParam().shadowing(null)) {
} this.shadowing = 3;
} }
} }
public Set<Swimlane> getSwimlanes() { public Set<Swimlane> getSwimlanes() {
if (swimlane == null) { if (swimlane == null)
return Collections.emptySet(); return Collections.emptySet();
}
return Collections.singleton(swimlane); return Collections.singleton(swimlane);
} }

View File

@ -57,18 +57,23 @@ public class FtileCircleStart extends AbstractFtile {
private static final int SIZE = 20; private static final int SIZE = 20;
private final HColor backColor; private HColor backColor;
private HColor borderColor;
private final Swimlane swimlane; private final Swimlane swimlane;
private double shadowing; private double shadowing;
public FtileCircleStart(ISkinParam skinParam, HColor backColor, Swimlane swimlane, Style style) { public FtileCircleStart(ISkinParam skinParam, HColor backColor, Swimlane swimlane, Style style) {
super(skinParam); super(skinParam);
this.backColor = backColor;
this.swimlane = swimlane; this.swimlane = swimlane;
if (UseStyle.useBetaStyle()) this.backColor = backColor;
this.borderColor = new HColorNone();
if (UseStyle.useBetaStyle()) {
this.shadowing = style.value(PName.Shadowing).asDouble(); this.shadowing = style.value(PName.Shadowing).asDouble();
else if (skinParam().shadowing(null)) this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
} else if (skinParam().shadowing(null)) {
this.shadowing = 3; this.shadowing = 3;
}
} }
@Override @Override
@ -77,9 +82,9 @@ public class FtileCircleStart extends AbstractFtile {
} }
public Set<Swimlane> getSwimlanes() { public Set<Swimlane> getSwimlanes() {
if (swimlane == null) { if (swimlane == null)
return Collections.emptySet(); return Collections.emptySet();
}
return Collections.singleton(swimlane); return Collections.singleton(swimlane);
} }
@ -94,7 +99,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);
circle.setDeltaShadow(shadowing); circle.setDeltaShadow(shadowing);
ug.apply(new HColorNone()).apply(backColor.bg()).draw(circle); ug.apply(borderColor).apply(backColor.bg()).draw(circle);
} }
@Override @Override

View File

@ -58,8 +58,8 @@ public class FtileCircleStop extends AbstractFtile {
private static final int SIZE = 22; private static final int SIZE = 22;
private final HColor borderColor; private HColor borderColor;
private final HColor backColor; private HColor backColor;
private final Swimlane swimlane; private final Swimlane swimlane;
private double shadowing; private double shadowing;
@ -75,17 +75,18 @@ public class FtileCircleStop extends AbstractFtile {
this.swimlane = swimlane; this.swimlane = swimlane;
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle()) {
this.shadowing = style.value(PName.Shadowing).asDouble(); this.shadowing = style.value(PName.Shadowing).asDouble();
} else { this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
if (skinParam().shadowing(null)) { this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
this.shadowing = 3; } else if (skinParam().shadowing(null)) {
} this.shadowing = 3;
} }
} }
public Set<Swimlane> getSwimlanes() { public Set<Swimlane> getSwimlanes() {
if (swimlane == null) { if (swimlane == null)
return Collections.emptySet(); return Collections.emptySet();
}
return Collections.singleton(swimlane); return Collections.singleton(swimlane);
} }

View File

@ -88,7 +88,8 @@ public class FtileDiamondSquare extends FtileDiamondWIP {
final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder); final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg()); ug = ug.apply(borderColor).apply(getThickness()).apply(backColor.bg());
ug.draw(Hexagon.asPolygonSquare(skinParam().shadowing(null), dimTotal.getWidth(), dimTotal.getHeight()));
ug.draw(Hexagon.asPolygonSquare(shadowing, dimTotal.getWidth(), dimTotal.getHeight()));
// Fix why north and south are the same // Fix why north and south are the same
north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight())));
@ -114,9 +115,9 @@ public class FtileDiamondSquare extends FtileDiamondWIP {
private Dimension2D calculateDimensionInternal(StringBounder stringBounder) { private Dimension2D calculateDimensionInternal(StringBounder stringBounder) {
final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimLabel = label.calculateDimension(stringBounder);
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) { if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0)
return new Dimension2DDouble(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2); return new Dimension2DDouble(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
}
Dimension2D result = dimLabel; Dimension2D result = dimLabel;
result = Dimension2DDouble.delta(result, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2); result = Dimension2DDouble.delta(result, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
return result; return result;

View File

@ -42,7 +42,7 @@ import net.sourceforge.plantuml.core.UmlSource;
public interface PSystemFactory { public interface PSystemFactory {
Diagram createSystem(UmlSource source, ISkinSimple skinParam); Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam);
DiagramType getDiagramType(); DiagramType getDiagramType();

View File

@ -33,10 +33,10 @@
* *
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml.api;
public enum ThemeStyle { public enum ThemeStyle {
DARK, LIGHT LIGHT_REGULAR, DARK
} }

View File

@ -46,6 +46,7 @@ import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
@ -69,17 +70,15 @@ public class BoardDiagram extends UmlDiagram {
return new DiagramDescription("Board"); return new DiagramDescription("Board");
} }
public BoardDiagram(UmlSource source) { public BoardDiagram(ThemeStyle style, UmlSource source) {
super(source, UmlDiagramType.BOARD); super(style, source, UmlDiagramType.BOARD);
} }
@Override @Override
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException { throws IOException {
return createImageBuilder(fileFormatOption) return createImageBuilder(fileFormatOption).drawable(getTextBlock()).write(os);
.drawable(getTextBlock())
.write(os);
} }
private TextBlockBackcolored getTextBlock() { private TextBlockBackcolored getTextBlock() {

View File

@ -39,9 +39,10 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -68,8 +69,8 @@ public class BoardDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public BoardDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public BoardDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
return new BoardDiagram(source); return new BoardDiagram(style, source);
} }
} }

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
@ -74,29 +75,26 @@ public class BpmDiagram extends UmlDiagram {
return new DiagramDescription("(Bpm Diagram)"); return new DiagramDescription("(Bpm Diagram)");
} }
public BpmDiagram(UmlSource source) { public BpmDiagram(ThemeStyle style, UmlSource source) {
super(source, UmlDiagramType.BPM); super(style, source, UmlDiagramType.BPM);
} }
@Override @Override
public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException { public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException {
return super.createImageBuilder(fileFormatOption) return super.createImageBuilder(fileFormatOption).annotations(false);
.annotations(false);
} }
@Override @Override
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException { throws IOException {
return createImageBuilder(fileFormatOption) return createImageBuilder(fileFormatOption).drawable(getUDrawable()).write(os);
.drawable(getUDrawable())
.write(os);
} }
private UDrawable getUDrawable() { private UDrawable getUDrawable() {
final Grid grid = createGrid(); final Grid grid = createGrid();
cleanGrid(grid); cleanGrid(grid);
final GridArray gridArray = grid.toArray(SkinParam.create(getUmlDiagramType())); final GridArray gridArray = grid.toArray(SkinParam.create(getUmlDiagramType(), ThemeStyle.LIGHT_REGULAR));
// gridArray.addEdges(edges); // gridArray.addEdges(edges);
// System.err.println("gridArray=" + gridArray); // System.err.println("gridArray=" + gridArray);
return gridArray; return gridArray;

View File

@ -40,6 +40,7 @@ import java.util.List;
import net.sourceforge.plantuml.AbstractPSystem; import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
@ -65,8 +66,8 @@ public class BpmDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public AbstractPSystem createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public AbstractPSystem createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
return new BpmDiagram(source); return new BpmDiagram(style, source);
} }
} }

View File

@ -35,7 +35,7 @@
*/ */
package net.sourceforge.plantuml.braille; package net.sourceforge.plantuml.braille;
import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -55,7 +55,7 @@ public class BrailleDrawer implements UDrawable {
} }
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
ug = ug.apply(HColorSet.instance().getColorOrWhite(ThemeStyle.LIGHT, "#F0F0F0")); ug = ug.apply(HColorSet.instance().getColorOrWhite(ThemeStyle.LIGHT_REGULAR, "#F0F0F0"));
for (int x = grid.getMinX(); x <= grid.getMaxX(); x++) { for (int x = grid.getMinX(); x <= grid.getMaxX(); x++) {
ug.apply(UTranslate.dx(x * step + spotSize + 1)) ug.apply(UTranslate.dx(x * step + spotSize + 1))
.draw(ULine.vline((grid.getMaxY() - grid.getMinY()) * step)); .draw(ULine.vline((grid.getMaxY() - grid.getMinY()) * step));

View File

@ -42,14 +42,15 @@ import java.util.List;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
public abstract class AbstractEntityDiagram extends CucaDiagram { public abstract class AbstractEntityDiagram extends CucaDiagram {
public AbstractEntityDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) { public AbstractEntityDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type, ISkinSimple orig) {
super(source, type, orig); super(style, source, type, orig);
} }
final protected List<String> getDotStrings() { final protected List<String> getDotStrings() {

View File

@ -42,6 +42,7 @@ import java.util.Objects;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.creole.CreoleMode;
@ -61,8 +62,8 @@ import net.sourceforge.plantuml.svek.image.EntityImageClass;
public class ClassDiagram extends AbstractClassOrObjectDiagram { public class ClassDiagram extends AbstractClassOrObjectDiagram {
public ClassDiagram(UmlSource source, ISkinSimple skinParam) { public ClassDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
super(source, UmlDiagramType.CLASS, skinParam); super(style, source, UmlDiagramType.CLASS, skinParam);
} }
private Code getShortName1972(Code code) { private Code getShortName1972(Code code) {
@ -195,10 +196,9 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram {
final RowLayout rawLayout = getRawLayout(i); final RowLayout rawLayout = getRawLayout(i);
fullLayout.addRowLayout(rawLayout); fullLayout.addRowLayout(rawLayout);
} }
return createImageBuilder(fileFormatOption) return createImageBuilder(fileFormatOption).annotations(false) // Backwards compatibility - this only applies
.annotations(false) // Backwards compatibility - this only applies when "layout_new_line" is used // when "layout_new_line" is used
.drawable(fullLayout) .drawable(fullLayout).write(os);
.write(os);
} }
private RowLayout getRawLayout(int raw) { private RowLayout getRawLayout(int raw) {

View File

@ -40,6 +40,7 @@ import java.util.List;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.classdiagram.command.CommandAddMethod; import net.sourceforge.plantuml.classdiagram.command.CommandAddMethod;
import net.sourceforge.plantuml.classdiagram.command.CommandAllowMixing; import net.sourceforge.plantuml.classdiagram.command.CommandAllowMixing;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClass; import net.sourceforge.plantuml.classdiagram.command.CommandCreateClass;
@ -64,8 +65,8 @@ import net.sourceforge.plantuml.command.CommandNamespaceEmpty;
import net.sourceforge.plantuml.command.CommandPackage; import net.sourceforge.plantuml.command.CommandPackage;
import net.sourceforge.plantuml.command.CommandPackageEmpty; import net.sourceforge.plantuml.command.CommandPackageEmpty;
import net.sourceforge.plantuml.command.CommandRankDir; import net.sourceforge.plantuml.command.CommandRankDir;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.note.CommandConstraintOnLinks; import net.sourceforge.plantuml.command.note.CommandConstraintOnLinks;
import net.sourceforge.plantuml.command.note.CommandFactoryNote; import net.sourceforge.plantuml.command.note.CommandFactoryNote;
import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnEntity; import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnEntity;
@ -84,8 +85,8 @@ import net.sourceforge.plantuml.objectdiagram.command.CommandCreateMap;
public class ClassDiagramFactory extends PSystemCommandFactory { public class ClassDiagramFactory extends PSystemCommandFactory {
@Override @Override
public ClassDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public ClassDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
return new ClassDiagram(source, skinParam); return new ClassDiagram(style, source, skinParam);
} }
@Override @Override

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.command; package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexConcat;
@ -61,8 +60,9 @@ public class CommandAssumeTransparent extends SingleLineCommand2<TitledDiagram>
@Override @Override
protected CommandExecutionResult executeArg(TitledDiagram system, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(TitledDiagram system, LineLocation location, RegexResult arg) {
final String type = arg.get("TYPE", 0).toUpperCase(); // final String type = arg.get("TYPE", 0).toUpperCase();
system.getSkinParam().assumeTransparent(ThemeStyle.valueOf(type)); // system.getSkinParam().assumeTransparent(ThemeStyle.valueOf(type));
// This is ignored and will be suppressed in some future
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -40,6 +40,7 @@ import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType; import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -57,20 +58,20 @@ public abstract class PSystemBasicFactory<P extends AbstractPSystem> extends PSy
this(DiagramType.UML); this(DiagramType.UML);
} }
public abstract P executeLine(UmlSource source, P system, String line); public abstract P executeLine(ThemeStyle style, UmlSource source, P system, String line);
public abstract P initDiagram(UmlSource source, String startLine); public abstract P initDiagram(ThemeStyle style, UmlSource source, String startLine);
private boolean isEmptyLine(StringLocated result) { private boolean isEmptyLine(StringLocated result) {
return result.getTrimmed().getString().length() == 0; return result.getTrimmed().getString().length() == 0;
} }
@Override @Override
final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { final public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
source = source.removeInitialSkinparam(); source = source.removeInitialSkinparam();
final IteratorCounter2 it = source.iterator2(); final IteratorCounter2 it = source.iterator2();
final StringLocated startLine = it.next(); final StringLocated startLine = it.next();
P system = initDiagram(source, startLine.getString()); P system = initDiagram(style, source, startLine.getString());
boolean first = true; boolean first = true;
while (it.hasNext()) { while (it.hasNext()) {
final StringLocated s = it.next(); final StringLocated s = it.next();
@ -84,7 +85,7 @@ public abstract class PSystemBasicFactory<P extends AbstractPSystem> extends PSy
} }
return system; return system;
} }
system = executeLine(source, system, s.getString()); system = executeLine(style, source, system, s.getString());
if (system == null) { if (system == null) {
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", 0, s.getLocation()); final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", 0, s.getLocation());
// return PSystemErrorUtils.buildV1(source, err, null); // return PSystemErrorUtils.buildV1(source, err, null);

View File

@ -43,6 +43,7 @@ import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -57,7 +58,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
protected abstract List<Command> createCommands(); protected abstract List<Command> createCommands();
public abstract AbstractPSystem createEmptyDiagram(UmlSource source, ISkinSimple skinParam); public abstract AbstractPSystem createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam);
protected PSystemCommandFactory() { protected PSystemCommandFactory() {
this(DiagramType.UML); this(DiagramType.UML);
@ -68,7 +69,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
} }
@Override @Override
final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { final public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
final IteratorCounter2 it = source.iterator2(); final IteratorCounter2 it = source.iterator2();
final StringLocated startLine = it.next(); final StringLocated startLine = it.next();
if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false) if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false)
@ -80,7 +81,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
return buildEmptyError(source, startLine.getLocation(), it.getTrace()); return buildEmptyError(source, startLine.getLocation(), it.getTrace());
} }
AbstractPSystem sys = createEmptyDiagram(source, skinParam); AbstractPSystem sys = createEmptyDiagram(style, source, skinParam);
while (it.hasNext()) { while (it.hasNext()) {
if (StartUtils.isArobaseEndDiagram(it.peek().getString())) { if (StartUtils.isArobaseEndDiagram(it.peek().getString())) {

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -57,11 +58,11 @@ public abstract class PSystemSingleLineFactory extends PSystemAbstractFactory {
} }
@Override @Override
final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { final public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
if (source.getTotalLineCount() != 3) { if (source.getTotalLineCount() != 3)
return null; return null;
}
final IteratorCounter2 it = source.iterator2(); final IteratorCounter2 it = source.iterator2();
if (source.isEmpty()) { if (source.isEmpty()) {
final LineLocation location = it.next().getLocation(); final LineLocation location = it.next().getLocation();
@ -69,17 +70,16 @@ public abstract class PSystemSingleLineFactory extends PSystemAbstractFactory {
} }
final StringLocated startLine = it.next(); final StringLocated startLine = it.next();
if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false) { if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false)
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
}
if (it.hasNext() == false) { if (it.hasNext() == false)
return buildEmptyError(source, startLine.getLocation(), it.getTrace()); return buildEmptyError(source, startLine.getLocation(), it.getTrace());
}
final StringLocated s = it.next(); final StringLocated s = it.next();
if (StartUtils.isArobaseEndDiagram(s.getString())) { if (StartUtils.isArobaseEndDiagram(s.getString()))
return buildEmptyError(source, s.getLocation(), it.getTrace()); return buildEmptyError(source, s.getLocation(), it.getTrace());
}
final AbstractPSystem sys = executeLine(source, s.getString()); final AbstractPSystem sys = executeLine(source, s.getString());
if (sys == null) { if (sys == null) {
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", 0, s.getLocation()); final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", 0, s.getLocation());

View File

@ -39,6 +39,7 @@ import java.util.Objects;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Code;
@ -49,8 +50,8 @@ import net.sourceforge.plantuml.graphic.USymbol;
public class CompositeDiagram extends AbstractEntityDiagram { public class CompositeDiagram extends AbstractEntityDiagram {
public CompositeDiagram(UmlSource source, ISkinSimple skinParam) { public CompositeDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
super(source, UmlDiagramType.COMPOSITE, skinParam); super(style, source, UmlDiagramType.COMPOSITE, skinParam);
} }
@Override @Override

View File

@ -39,9 +39,10 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.compositediagram.command.CommandCreateBlock; import net.sourceforge.plantuml.compositediagram.command.CommandCreateBlock;
import net.sourceforge.plantuml.compositediagram.command.CommandCreatePackageBlock; import net.sourceforge.plantuml.compositediagram.command.CommandCreatePackageBlock;
import net.sourceforge.plantuml.compositediagram.command.CommandEndPackageBlock; import net.sourceforge.plantuml.compositediagram.command.CommandEndPackageBlock;
@ -69,7 +70,7 @@ public class CompositeDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public CompositeDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public CompositeDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
return new CompositeDiagram(source, skinParam); return new CompositeDiagram(style, source, skinParam);
} }
} }

View File

@ -77,7 +77,7 @@ public class PSystemCreole extends PlainDiagram {
final UFont font = UFont.serif(14); final UFont font = UFont.serif(14);
final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(font); final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(font);
final Sheet sheet = Parser.build(fontConfiguration, HorizontalAlignment.LEFT, final Sheet sheet = Parser.build(fontConfiguration, HorizontalAlignment.LEFT,
SkinParam.create(UmlDiagramType.SEQUENCE), CreoleMode.FULL).createSheet(display); SkinParam.create(UmlDiagramType.SEQUENCE, fileFormatOption.getStyle()), CreoleMode.FULL).createSheet(display);
return new SheetBlock1(sheet, LineBreakStrategy.NONE, 0); return new SheetBlock1(sheet, LineBreakStrategy.NONE, 0);
// final Dimension2D dim = TextBlockUtils.getDimension(sheetBlock); // final Dimension2D dim = TextBlockUtils.getDimension(sheetBlock);

View File

@ -35,6 +35,7 @@
*/ */
package net.sourceforge.plantuml.creole.legacy; package net.sourceforge.plantuml.creole.legacy;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.command.PSystemBasicFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -46,15 +47,15 @@ public class PSystemCreoleFactory extends PSystemBasicFactory<PSystemCreole> {
} }
@Override @Override
public PSystemCreole initDiagram(UmlSource source, String startLine) { public PSystemCreole initDiagram(ThemeStyle style, UmlSource source, String startLine) {
if (getDiagramType() == DiagramType.CREOLE) { if (getDiagramType() == DiagramType.CREOLE)
return new PSystemCreole(source); return new PSystemCreole(source);
}
return null; return null;
} }
@Override @Override
public PSystemCreole executeLine(UmlSource source, PSystemCreole system, String line) { public PSystemCreole executeLine(ThemeStyle style, UmlSource source, PSystemCreole system, String line) {
system.doCommandLine(line); system.doCommandLine(line);
return system; return system;
} }

View File

@ -53,6 +53,7 @@ import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ImageDataSimple; import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -119,8 +120,8 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return ident; return ident;
} }
public CucaDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) { public CucaDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type, ISkinSimple orig) {
super(source, type, orig); super(style, source, type, orig);
this.stacks2.add(Ident.empty()); this.stacks2.add(Ident.empty());
} }

View File

@ -54,16 +54,16 @@ public class DisplaySection {
public DisplaySection withPage(int page, int lastpage) { public DisplaySection withPage(int page, int lastpage) {
final DisplaySection result = new DisplaySection(); final DisplaySection result = new DisplaySection();
for (Map.Entry<HorizontalAlignment, Display> ent : this.map.entrySet()) { for (Map.Entry<HorizontalAlignment, Display> ent : this.map.entrySet())
result.map.put(ent.getKey(), ent.getValue().withPage(page, lastpage)); result.map.put(ent.getKey(), ent.getValue().withPage(page, lastpage));
}
return result; return result;
} }
public Display getDisplay() { public Display getDisplay() {
if (map.size() == 0) { if (map.size() == 0)
return null; return null;
}
return map.values().iterator().next(); return map.values().iterator().next();
} }
@ -72,31 +72,31 @@ public class DisplaySection {
} }
public final HorizontalAlignment getHorizontalAlignment() { public final HorizontalAlignment getHorizontalAlignment() {
if (map.size() == 0) { if (map.size() == 0)
return HorizontalAlignment.CENTER; return HorizontalAlignment.CENTER;
}
return map.keySet().iterator().next(); return map.keySet().iterator().next();
} }
public boolean isNull() { public boolean isNull() {
if (map.size() == 0) { if (map.size() == 0)
return true; return true;
}
final Display display = map.values().iterator().next(); final Display display = map.values().iterator().next();
return Display.isNull(display); return Display.isNull(display);
} }
public TextBlock createRibbon(FontConfiguration fontConfiguration, ISkinSimple spriteContainer, Style style) { public TextBlock createRibbon(FontConfiguration fontConfiguration, ISkinSimple spriteContainer, Style style) {
if (map.size() == 0) { if (map.size() == 0)
return null; return null;
}
final Display display = map.values().iterator().next(); final Display display = map.values().iterator().next();
if (Display.isNull(display) || display.size() == 0) { if (Display.isNull(display) || display.size() == 0)
return null; return null;
}
if (style != null) { if (style != null)
return style.createTextBlockBordered(display, spriteContainer.getIHtmlColorSet(), spriteContainer); return style.createTextBlockBordered(display, spriteContainer.getIHtmlColorSet(), spriteContainer);
}
return display.create(fontConfiguration, getHorizontalAlignment(), spriteContainer); return display.create(fontConfiguration, getHorizontalAlignment(), spriteContainer);
} }

View File

@ -40,7 +40,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.api.ThemeStyle;
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.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;

View File

@ -35,6 +35,7 @@
*/ */
package net.sourceforge.plantuml.definition; package net.sourceforge.plantuml.definition;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.command.PSystemBasicFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -46,15 +47,15 @@ public class PSystemDefinitionFactory extends PSystemBasicFactory<PSystemDefinit
} }
@Override @Override
public PSystemDefinition initDiagram(UmlSource source, String startLine) { public PSystemDefinition initDiagram(ThemeStyle style, UmlSource source, String startLine) {
if (getDiagramType() == DiagramType.DEFINITION) { if (getDiagramType() == DiagramType.DEFINITION)
return new PSystemDefinition(source, startLine); return new PSystemDefinition(source, startLine);
}
return null; return null;
} }
@Override @Override
public PSystemDefinition executeLine(UmlSource source, PSystemDefinition system, String line) { public PSystemDefinition executeLine(ThemeStyle style, UmlSource source, PSystemDefinition system, String line) {
system.doCommandLine(line); system.doCommandLine(line);
return system; return system;
} }

View File

@ -40,6 +40,7 @@ import java.util.Objects;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Code;
@ -50,8 +51,8 @@ import net.sourceforge.plantuml.graphic.USymbol;
public class DescriptionDiagram extends AbstractEntityDiagram { public class DescriptionDiagram extends AbstractEntityDiagram {
public DescriptionDiagram(UmlSource source, ISkinSimple skinParam) { public DescriptionDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
super(source, UmlDiagramType.DESCRIPTION, skinParam); super(style, source, UmlDiagramType.DESCRIPTION, skinParam);
} }
@Override @Override

View File

@ -39,6 +39,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2; import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2;
import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator; import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator;
import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore; import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore;
@ -47,8 +48,8 @@ import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandEndPackage; import net.sourceforge.plantuml.command.CommandEndPackage;
import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.CommandFootboxIgnored;
import net.sourceforge.plantuml.command.CommandRankDir; import net.sourceforge.plantuml.command.CommandRankDir;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.note.CommandFactoryNote; import net.sourceforge.plantuml.command.note.CommandFactoryNote;
import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnEntity; import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnEntity;
import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnLink; import net.sourceforge.plantuml.command.note.CommandFactoryNoteOnLink;
@ -66,8 +67,8 @@ import net.sourceforge.plantuml.descdiagram.command.CommandPackageWithUSymbol;
public class DescriptionDiagramFactory extends PSystemCommandFactory { public class DescriptionDiagramFactory extends PSystemCommandFactory {
@Override @Override
public DescriptionDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public DescriptionDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
return new DescriptionDiagram(source, skinParam); return new DescriptionDiagram(style, source, skinParam);
} }
@Override @Override

View File

@ -63,11 +63,12 @@ public class CommandNewpage extends SingleLineCommand2<UmlDiagram> {
@Override @Override
protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) {
final int dpi = diagram.getSkinParam().getDpi(); final int dpi = diagram.getSkinParam().getDpi();
final UmlDiagram emptyDiagram = (UmlDiagram) factory.createEmptyDiagram(diagram.getSource(), diagram.getSkinParam()); final UmlDiagram emptyDiagram = (UmlDiagram) factory.createEmptyDiagram(diagram.getSkinParam().getThemeStyle(),
if (dpi != 96) { diagram.getSource(), diagram.getSkinParam());
if (dpi != 96)
emptyDiagram.setParam("dpi", "" + dpi); emptyDiagram.setParam("dpi", "" + dpi);
}
NewpagedDiagram result = new NewpagedDiagram(diagram.getSource(), diagram, emptyDiagram); final NewpagedDiagram result = new NewpagedDiagram(diagram.getSource(), diagram, emptyDiagram);
return CommandExecutionResult.newDiagram(result); return CommandExecutionResult.newDiagram(result);
} }
} }

View File

@ -34,6 +34,7 @@
*/ */
package net.sourceforge.plantuml.directdot; package net.sourceforge.plantuml.directdot;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.command.PSystemBasicFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -47,21 +48,21 @@ public class PSystemDotFactory extends PSystemBasicFactory<PSystemDot> {
} }
@Override @Override
public PSystemDot initDiagram(UmlSource source, String startLine) { public PSystemDot initDiagram(ThemeStyle style, UmlSource source, String startLine) {
data = null; data = null;
return null; return null;
} }
@Override @Override
public PSystemDot executeLine(UmlSource source, PSystemDot system, String line) { public PSystemDot executeLine(ThemeStyle style, UmlSource source, PSystemDot system, String line) {
if (system == null && line.matches("(strict\\s+)?(di)?graph\\s+\"?[-\\w]+\"?\\s*\\{")) { if (system == null && line.matches("(strict\\s+)?(di)?graph\\s+\"?[-\\w]+\"?\\s*\\{")) {
data = new StringBuilder(line); data = new StringBuilder(line);
data.append("\n"); data.append("\n");
return new PSystemDot(source, data.toString()); return new PSystemDot(source, data.toString());
} }
if (data == null || system == null) { if (data == null || system == null)
return null; return null;
}
data.append(line); data.append(line);
data.append("\n"); data.append("\n");
return new PSystemDot(source, data.toString()); return new PSystemDot(source, data.toString());

View File

@ -37,10 +37,10 @@ package net.sourceforge.plantuml.ditaa;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.command.PSystemBasicFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.definition.PSystemDefinition;
public class PSystemDitaaFactory extends PSystemBasicFactory<PSystemDitaa> { public class PSystemDitaaFactory extends PSystemBasicFactory<PSystemDitaa> {
@ -56,15 +56,15 @@ public class PSystemDitaaFactory extends PSystemBasicFactory<PSystemDitaa> {
} }
@Override @Override
public PSystemDitaa initDiagram(UmlSource source, String startLine) { public PSystemDitaa initDiagram(ThemeStyle style, UmlSource source, String startLine) {
boolean performSeparationOfCommonEdges = true; boolean performSeparationOfCommonEdges = true;
if (startLine != null && (startLine.contains("-E") || startLine.contains("--no-separation"))) { if (startLine != null && (startLine.contains("-E") || startLine.contains("--no-separation")))
performSeparationOfCommonEdges = false; performSeparationOfCommonEdges = false;
}
boolean dropShadows = true; boolean dropShadows = true;
if (startLine != null && (startLine.contains("-S") || startLine.contains("--no-shadows"))) { if (startLine != null && (startLine.contains("-S") || startLine.contains("--no-shadows")))
dropShadows = false; dropShadows = false;
}
final float scale = extractScale(startLine); final float scale = extractScale(startLine);
if (getDiagramType() == DiagramType.UML) { if (getDiagramType() == DiagramType.UML) {
return null; return null;
@ -76,29 +76,29 @@ public class PSystemDitaaFactory extends PSystemBasicFactory<PSystemDitaa> {
} }
@Override @Override
public PSystemDitaa executeLine(UmlSource source, PSystemDitaa system, String line) { public PSystemDitaa executeLine(ThemeStyle style, UmlSource source, PSystemDitaa system, String line) {
if (system == null && (line.equals("ditaa") || line.startsWith("ditaa("))) { if (system == null && (line.equals("ditaa") || line.startsWith("ditaa("))) {
boolean performSeparationOfCommonEdges = true; boolean performSeparationOfCommonEdges = true;
if (line.contains("-E") || line.contains("--no-separation")) { if (line.contains("-E") || line.contains("--no-separation"))
performSeparationOfCommonEdges = false; performSeparationOfCommonEdges = false;
}
boolean dropShadows = true; boolean dropShadows = true;
if (line.contains("-S") || line.contains("--no-shadows")) { if (line.contains("-S") || line.contains("--no-shadows"))
dropShadows = false; dropShadows = false;
}
final float scale = extractScale(line); final float scale = extractScale(line);
return new PSystemDitaa(source, "", performSeparationOfCommonEdges, dropShadows, scale); return new PSystemDitaa(source, "", performSeparationOfCommonEdges, dropShadows, scale);
} }
if (system == null) { if (system == null)
return null; return null;
}
return system.add(line); return system.add(line);
} }
private float extractScale(String line) { private float extractScale(String line) {
if (line == null) { if (line == null)
return 1; return 1;
}
final Pattern p = Pattern.compile("scale=([\\d.]+)"); final Pattern p = Pattern.compile("scale=([\\d.]+)");
final Matcher m = p.matcher(line); final Matcher m = p.matcher(line);
if (m.find()) { if (m.find()) {

View File

@ -37,6 +37,7 @@ package net.sourceforge.plantuml.eggs;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.api.PSystemFactory; import net.sourceforge.plantuml.api.PSystemFactory;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -45,10 +46,10 @@ import net.sourceforge.plantuml.graphic.GraphicPosition;
public class PSystemWelcomeFactory implements PSystemFactory { public class PSystemWelcomeFactory implements PSystemFactory {
@Override @Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
if (source.getTotalLineCount() == 2) { if (source.getTotalLineCount() == 2)
return new PSystemWelcome(source, GraphicPosition.BACKGROUND_CORNER_BOTTOM_RIGHT); return new PSystemWelcome(source, GraphicPosition.BACKGROUND_CORNER_BOTTOM_RIGHT);
}
return null; return null;
} }

View File

@ -39,6 +39,16 @@ import java.awt.geom.Point2D;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType;
/* /*
* You can choose between real "org.eclipse.elk..." classes or proxied "net.sourceforge.plantuml.elk.proxy..." * You can choose between real "org.eclipse.elk..." classes or proxied "net.sourceforge.plantuml.elk.proxy..."
* *
@ -61,19 +71,14 @@ import net.sourceforge.plantuml.elk.proxy.graph.ElkBendPoint;
import net.sourceforge.plantuml.elk.proxy.graph.ElkEdge; import net.sourceforge.plantuml.elk.proxy.graph.ElkEdge;
import net.sourceforge.plantuml.elk.proxy.graph.ElkEdgeSection; import net.sourceforge.plantuml.elk.proxy.graph.ElkEdgeSection;
import net.sourceforge.plantuml.elk.proxy.graph.ElkLabel; import net.sourceforge.plantuml.elk.proxy.graph.ElkLabel;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType;
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.ColorType;
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.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.svek.extremity.ExtremityFactory; import net.sourceforge.plantuml.svek.extremity.ExtremityFactory;
import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryExtends; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryExtends;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -109,43 +114,51 @@ public class ElkPath implements UDrawable {
} }
private ColorParam getArrowColorParam() { private ColorParam getArrowColorParam() {
if (diagram.getUmlDiagramType() == UmlDiagramType.CLASS) { if (diagram.getUmlDiagramType() == UmlDiagramType.CLASS)
return ColorParam.arrow; return ColorParam.arrow;
} else if (diagram.getUmlDiagramType() == UmlDiagramType.OBJECT) { else if (diagram.getUmlDiagramType() == UmlDiagramType.OBJECT)
return ColorParam.arrow; return ColorParam.arrow;
} else if (diagram.getUmlDiagramType() == UmlDiagramType.DESCRIPTION) { else if (diagram.getUmlDiagramType() == UmlDiagramType.DESCRIPTION)
return ColorParam.arrow; return ColorParam.arrow;
} else if (diagram.getUmlDiagramType() == UmlDiagramType.ACTIVITY) { else if (diagram.getUmlDiagramType() == UmlDiagramType.ACTIVITY)
return ColorParam.arrow; return ColorParam.arrow;
} else if (diagram.getUmlDiagramType() == UmlDiagramType.STATE) { else if (diagram.getUmlDiagramType() == UmlDiagramType.STATE)
return ColorParam.arrow; return ColorParam.arrow;
}
throw new IllegalStateException(); throw new IllegalStateException();
} }
private Style getStyle() {
final StyleSignature signature = StyleSignature.of(SName.root, SName.element, styleName, SName.arrow);
return signature.getMergedStyle(diagram.getCurrentStyleBuilder());
}
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
if (link.isHidden()) { if (link.isHidden())
return; return;
}
HColor color = rose.getHtmlColor(diagram.getSkinParam(), null, getArrowColorParam()); HColor color;
final ISkinParam skinParam = diagram.getSkinParam();
if (UseStyle.useBetaStyle())
color = getStyle().value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
else
color = rose.getHtmlColor(skinParam, null, getArrowColorParam());
if (this.link.getColors() != null) { if (this.link.getColors() != null) {
final HColor newColor = this.link.getColors().getColor(ColorType.ARROW, ColorType.LINE); final HColor newColor = this.link.getColors().getColor(ColorType.ARROW, ColorType.LINE);
if (newColor != null) { if (newColor != null)
color = newColor; color = newColor;
}
} else if (this.link.getSpecificColor() != null) { } else if (this.link.getSpecificColor() != null) {
color = this.link.getSpecificColor(); color = this.link.getSpecificColor();
} }
final LinkType linkType = link.getType(); final LinkType linkType = link.getType();
UStroke stroke = linkType.getStroke3(diagram.getSkinParam().getThickness(LineParam.arrow, null)); UStroke stroke = linkType.getStroke3(skinParam.getThickness(LineParam.arrow, null));
if (link.getColors() != null && link.getColors().getSpecificLineStroke() != null) { if (link.getColors() != null && link.getColors().getSpecificLineStroke() != null)
stroke = link.getColors().getSpecificLineStroke(); stroke = link.getColors().getSpecificLineStroke();
}
ug = ug.apply(stroke).apply(color); ug = ug.apply(stroke).apply(color);
final List<ElkEdgeSection> sections = edge.getSections(); final List<ElkEdgeSection> sections = edge.getSections();
@ -195,15 +208,15 @@ public class ElkPath implements UDrawable {
final TextBlock labelLink; final TextBlock labelLink;
// Nasty trick: we store the type of label (center/head/tail) in the text // Nasty trick: we store the type of label (center/head/tail) in the text
final String type = label.getText(); final String type = label.getText();
if ("X".equals(type)) { if ("X".equals(type))
labelLink = centerLabel; labelLink = centerLabel;
} else if ("1".equals(type)) { else if ("1".equals(type))
labelLink = tailLabel; labelLink = tailLabel;
} else if ("2".equals(type)) { else if ("2".equals(type))
labelLink = headLabel; labelLink = headLabel;
} else { else
continue; continue;
}
labelLink.drawU(ug.apply(new UTranslate(x, y))); labelLink.drawU(ug.apply(new UTranslate(x, y)));
} }
} }

View File

@ -54,41 +54,39 @@ public class PSystemErrorUtils {
} }
public static PSystemError merge(Collection<PSystemError> ps) { public static PSystemError merge(Collection<PSystemError> ps) {
if (ps.size() == 0) { if (ps.size() == 0)
throw new IllegalStateException(); throw new IllegalStateException();
}
UmlSource source = null; UmlSource source = null;
final List<ErrorUml> errors = new ArrayList<>(); final List<ErrorUml> errors = new ArrayList<>();
// final List<String> debugs = new ArrayList<>(); // final List<String> debugs = new ArrayList<>();
final List<PSystemErrorV2> errorsV2 = new ArrayList<>(); final List<PSystemErrorV2> errorsV2 = new ArrayList<>();
for (PSystemError system : ps) { for (PSystemError system : ps) {
if (system == null) { if (system == null)
continue; continue;
}
if (system.getSource() != null && source == null) { if (system.getSource() != null && source == null)
source = system.getSource(); source = system.getSource();
}
errors.addAll(system.getErrorsUml()); errors.addAll(system.getErrorsUml());
if (system instanceof PSystemErrorV2) { if (system instanceof PSystemErrorV2)
errorsV2.add((PSystemErrorV2) system); errorsV2.add((PSystemErrorV2) system);
}
} }
if (source == null) { if (source == null)
throw new IllegalStateException(); throw new IllegalStateException();
}
if (errorsV2.size() > 0) { if (errorsV2.size() > 0)
return mergeV2(errorsV2); return mergeV2(errorsV2);
}
throw new IllegalStateException(); throw new IllegalStateException();
} }
private static PSystemErrorV2 mergeV2(List<PSystemErrorV2> errorsV2) { private static PSystemErrorV2 mergeV2(List<PSystemErrorV2> errorsV2) {
PSystemErrorV2 result = null; PSystemErrorV2 result = null;
for (PSystemErrorV2 err : errorsV2) { for (PSystemErrorV2 err : errorsV2)
if (result == null || result.score() < err.score()) { if (result == null || result.score() < err.score())
result = err; result = err;
}
}
return result; return result;
} }

View File

@ -43,7 +43,6 @@ import java.util.concurrent.locks.ReentrantLock;
import ext.plantuml.com.google.zxing.BarcodeFormat; import ext.plantuml.com.google.zxing.BarcodeFormat;
import ext.plantuml.com.google.zxing.EncodeHintType; import ext.plantuml.com.google.zxing.EncodeHintType;
import ext.plantuml.com.google.zxing.WriterException;
import ext.plantuml.com.google.zxing.client.j2se.MatrixToImageWriter; import ext.plantuml.com.google.zxing.client.j2se.MatrixToImageWriter;
import ext.plantuml.com.google.zxing.common.BitMatrix; import ext.plantuml.com.google.zxing.common.BitMatrix;
import ext.plantuml.com.google.zxing.qrcode.QRCodeWriter; import ext.plantuml.com.google.zxing.qrcode.QRCodeWriter;
@ -64,7 +63,7 @@ public class FlashCodeUtilsZxing implements FlashCodeUtils {
final int multiple = 1; final int multiple = 1;
final BitMatrix bit = writer.encode(s, BarcodeFormat.QR_CODE, multiple, hints); final BitMatrix bit = writer.encode(s, BarcodeFormat.QR_CODE, multiple, hints);
return MatrixToImageWriter.toBufferedImage(bit, fore.getRGB() | 0xFF000000, back.getRGB() | 0xFF000000); return MatrixToImageWriter.toBufferedImage(bit, fore.getRGB() | 0xFF000000, back.getRGB() | 0xFF000000);
} catch (WriterException e) { } catch (Exception e) {
Log.debug("Cannot create qrcode " + e); Log.debug("Cannot create qrcode " + e);
} finally { } finally {
lock.unlock(); lock.unlock();

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -89,8 +90,8 @@ public class FlowDiagram extends UmlDiagram implements TextBlock {
return new DiagramDescription("Flow Diagram"); return new DiagramDescription("Flow Diagram");
} }
public FlowDiagram(UmlSource source) { public FlowDiagram(ThemeStyle style, UmlSource source) {
super(source, UmlDiagramType.FLOW); super(style, source, UmlDiagramType.FLOW);
} }
public void lineSimple(TileGeometry orientation, String idDest, String label) { public void lineSimple(TileGeometry orientation, String idDest, String label) {
@ -126,8 +127,7 @@ public class FlowDiagram extends UmlDiagram implements TextBlock {
public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException { public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException {
return imageBuilder(fileFormatOption) return imageBuilder(fileFormatOption)
.dimension(calculateDimension(fileFormatOption.getDefaultStringBounder(getSkinParam()))) .dimension(calculateDimension(fileFormatOption.getDefaultStringBounder(getSkinParam())))
.margin(getDefaultMargins()) .margin(getDefaultMargins()).metadata(fileFormatOption.isWithMetadata() ? getMetadata() : null)
.metadata(fileFormatOption.isWithMetadata() ? getMetadata() : null)
.seed(seed()); .seed(seed());
} }
@ -135,9 +135,7 @@ public class FlowDiagram extends UmlDiagram implements TextBlock {
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException { throws IOException {
return createImageBuilder(fileFormatOption) return createImageBuilder(fileFormatOption).drawable(this).write(os);
.drawable(this)
.write(os);
} }
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
@ -156,8 +154,8 @@ public class FlowDiagram extends UmlDiagram implements TextBlock {
final Dimension2D dimBox = box.calculateDimension(stringBounder); final Dimension2D dimBox = box.calculateDimension(stringBounder);
final double deltaX = SINGLE_SIZE_X * 2 - dimBox.getWidth(); final double deltaX = SINGLE_SIZE_X * 2 - dimBox.getWidth();
final double deltaY = SINGLE_SIZE_Y * 2 - dimBox.getHeight(); final double deltaY = SINGLE_SIZE_Y * 2 - dimBox.getHeight();
box.drawU(ug.apply(new UTranslate((x + xmin * SINGLE_SIZE_X + deltaX / 2), box.drawU(ug.apply(
(y + ymin * SINGLE_SIZE_Y + deltaY / 2)))); new UTranslate((x + xmin * SINGLE_SIZE_X + deltaX / 2), (y + ymin * SINGLE_SIZE_Y + deltaY / 2))));
} }
ug = ug.apply(HColorUtils.MY_RED); ug = ug.apply(HColorUtils.MY_RED);
ug = ug.apply(HColorUtils.MY_RED.bg()); ug = ug.apply(HColorUtils.MY_RED.bg());

View File

@ -39,6 +39,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
@ -51,8 +52,8 @@ public class FlowDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public FlowDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public FlowDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
return new FlowDiagram(source); return new FlowDiagram(style, source);
} }
@Override @Override

View File

@ -85,33 +85,33 @@ public class GNode {
} }
public boolean canEatTheNextOne() { public boolean canEatTheNextOne() {
if (up.size() != 1) { if (up.size() != 1)
return false; return false;
}
if (down.size() != 1) { if (down.size() != 1)
return false; return false;
}
final GNode next = down.get(0); final GNode next = down.get(0);
if (next.up.size() != 1) { if (next.up.size() != 1)
return false; return false;
}
if (next.down.size() != 1) { if (next.down.size() != 1)
return false; return false;
}
return true; return true;
} }
public GNode eatTheNextOne() { public GNode eatTheNextOne() {
if (canEatTheNextOne() == false) { if (canEatTheNextOne() == false)
throw new IllegalStateException(); throw new IllegalStateException();
}
final GNode removed = down.get(0); final GNode removed = down.get(0);
final GNode newNext = removed.down.get(0); final GNode newNext = removed.down.get(0);
this.texts.addAll(removed.texts); this.texts.addAll(removed.texts);
this.down.set(0, newNext); this.down.set(0, newNext);
if (newNext.up.remove(removed) == false) { if (newNext.up.remove(removed) == false)
throw new IllegalStateException(); throw new IllegalStateException();
}
newNext.up.add(this); newNext.up.add(this);
return removed; return removed;
} }

View File

@ -43,6 +43,7 @@ import java.util.Collection;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -57,8 +58,8 @@ public class GitDiagram extends UmlDiagram {
private final Collection<GNode> gnodes; private final Collection<GNode> gnodes;
public GitDiagram(UmlSource source, GitTextArea textArea) { public GitDiagram(ThemeStyle style, UmlSource source, GitTextArea textArea) {
super(source, UmlDiagramType.GIT); super(style, source, UmlDiagramType.GIT);
this.gnodes = new GNodeBuilder(textArea.getAllCommits()).getAllNodes(); this.gnodes = new GNodeBuilder(textArea.getAllCommits()).getAllNodes();
new GNodeBuilder(textArea.getAllCommits()); new GNodeBuilder(textArea.getAllCommits());
} }
@ -67,14 +68,11 @@ public class GitDiagram extends UmlDiagram {
return new DiagramDescription("(Git)"); return new DiagramDescription("(Git)");
} }
@Override @Override
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption) protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException { throws IOException {
return createImageBuilder(fileFormatOption) return createImageBuilder(fileFormatOption).drawable(getTextBlock()).write(os);
.drawable(getTextBlock())
.write(os);
} }
private void drawInternal(UGraphic ug) { private void drawInternal(UGraphic ug) {

View File

@ -39,6 +39,7 @@ import java.util.Iterator;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemAbstractFactory; import net.sourceforge.plantuml.command.PSystemAbstractFactory;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
@ -51,19 +52,19 @@ public class GitDiagramFactory extends PSystemAbstractFactory {
} }
@Override @Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
final GitTextArea textArea = new GitTextArea(); final GitTextArea textArea = new GitTextArea();
final Iterator<StringLocated> it = source.iterator2(); final Iterator<StringLocated> it = source.iterator2();
it.next(); it.next();
while (true) { while (true) {
final String line = it.next().getString(); final String line = it.next().getString();
if (it.hasNext() == false) { if (it.hasNext() == false)
break; break;
}
textArea.add(line); textArea.add(line);
} }
return new GitDiagram(source, textArea); return new GitDiagram(style, source, textArea);
} }
} }

View File

@ -44,36 +44,39 @@ 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.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.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColor;
public class MagicBox { public class MagicBox {
private final ISkinParam skinParam; private final ISkinParam skinParam;
private final GNode node; private final GNode node;
private final HColor fontColor;
public MagicBox(ISkinParam skinParam, GNode node) { public MagicBox(ISkinParam skinParam, GNode node) {
this.skinParam = skinParam; this.skinParam = skinParam;
this.node = node; this.node = node;
final Style style = StyleSignature.of(SName.root, SName.element, SName.gitDiagram)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
this.fontColor = style.value(PName.FontColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
} }
private TextBlock getSmallBlock() { private TextBlock getSmallBlock() {
final FontConfiguration mono = new FontConfiguration(UFont.monospaced(15).bold(), HColorUtils.BLACK, final FontConfiguration fc = new FontConfiguration(UFont.monospaced(15).bold(), fontColor, fontColor, false);
HColorUtils.BLACK, false); return node.getDisplay().create(fc, HorizontalAlignment.CENTER, skinParam);
final TextBlock big = node.getDisplay().create(mono, HorizontalAlignment.CENTER, skinParam);
return big;
} }
private TextBlock getCommentBlock() { private TextBlock getCommentBlock() {
if (node.getComment() != null && node.isTop()) { if (node.getComment() != null && node.isTop()) {
final FontConfiguration tag = new FontConfiguration(UFont.sansSerif(13), HColorUtils.BLACK, final FontConfiguration tag = new FontConfiguration(UFont.sansSerif(13), fontColor, fontColor, false);
HColorUtils.BLACK, false);
return Display.create(node.getComment()).create(tag, HorizontalAlignment.CENTER, skinParam); return Display.create(node.getComment()).create(tag, HorizontalAlignment.CENTER, skinParam);
} }
return TextBlockUtils.empty(0, 0); return TextBlockUtils.empty(0, 0);

View File

@ -59,12 +59,13 @@ import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.jsondiagram.Mirror; import net.sourceforge.plantuml.jsondiagram.Mirror;
import net.sourceforge.plantuml.style.PName;
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.StyleSignature; 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;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColor;
import smetana.core.CString; import smetana.core.CString;
import smetana.core.Macro; import smetana.core.Macro;
import smetana.core.Z; import smetana.core.Z;
@ -92,6 +93,10 @@ public class SmetanaForGit {
.getMergedStyle(skinParam.getCurrentStyleBuilder()); .getMergedStyle(skinParam.getCurrentStyleBuilder());
} }
private HColor arrowColor() {
return getStyle().value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
}
public void drawMe(Collection<GNode> gnodes) { public void drawMe(Collection<GNode> gnodes) {
initGraph(gnodes); initGraph(gnodes);
@ -101,12 +106,11 @@ public class SmetanaForGit {
final MagicBox magicBox = new MagicBox(skinParam, ent.getKey()); final MagicBox magicBox = new MagicBox(skinParam, ent.getKey());
magicBox.drawBorder(ug.apply(pos), getSize(node)); magicBox.drawBorder(ug.apply(pos), getSize(node));
} }
for (ST_Agedge_s edge : edges) { for (ST_Agedge_s edge : edges) {
final ST_Agedgeinfo_t data = (ST_Agedgeinfo_t) Macro.AGDATA(edge); final ST_Agedgeinfo_t data = (ST_Agedgeinfo_t) Macro.AGDATA(edge);
new GitCurve(data, yMirror).drawCurve(HColorUtils.BLACK, ug); new GitCurve(data, yMirror).drawCurve(arrowColor(), ug);
} }
} }
@ -127,9 +131,9 @@ public class SmetanaForGit {
} }
private void initGraph(Collection<GNode> gnodes) { private void initGraph(Collection<GNode> gnodes) {
if (g != null) { if (g != null)
return; return;
}
Z.open(); Z.open();
try { try {
g = agopen(new CString("g"), Z.z().Agdirected, null); g = agopen(new CString("g"), Z.z().Agdirected, null);
@ -142,9 +146,9 @@ public class SmetanaForGit {
for (GNode gnode : nodes.keySet()) { for (GNode gnode : nodes.keySet()) {
for (GNode parent : gnode.getDowns()) { for (GNode parent : gnode.getDowns()) {
final ST_Agedge_s edge = createEdge(gnode, parent); final ST_Agedge_s edge = createEdge(gnode, parent);
if (edge != null) { if (edge != null)
edges.add(edge); edges.add(edge);
}
} }
} }

View File

@ -35,7 +35,7 @@
*/ */
package net.sourceforge.plantuml.graphic; package net.sourceforge.plantuml.graphic;
import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.command.regex.Pattern2;

View File

@ -35,7 +35,7 @@
*/ */
package net.sourceforge.plantuml.graphic; package net.sourceforge.plantuml.graphic;
import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.command.regex.Pattern2;

View File

@ -81,7 +81,7 @@ public class FontConfiguration {
} }
public static FontConfiguration blackBlueTrue(UFont font) { public static FontConfiguration blackBlueTrue(UFont font) {
return new FontConfiguration(font, HColorUtils.BLACK, HColorUtils.BLUE, true, 8); return new FontConfiguration(font, HColorUtils.BLACK.withDark(HColorUtils.WHITE), HColorUtils.BLUE, true, 8);
} }
public FontConfiguration(ISkinParam skinParam, FontParam fontParam, Stereotype stereo) { public FontConfiguration(ISkinParam skinParam, FontParam fontParam, Stereotype stereo) {

View File

@ -37,10 +37,10 @@ package net.sourceforge.plantuml.graphic;
import java.util.EnumSet; import java.util.EnumSet;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl; import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.command.regex.Pattern2;

View File

@ -42,8 +42,8 @@ import java.util.Objects;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.api.ThemeStyle;
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.PName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;

View File

@ -42,7 +42,7 @@ import java.util.EnumSet;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.command.regex.Pattern2;

View File

@ -122,13 +122,13 @@ class USymbolRectangle extends USymbol {
stereotype.drawU(ug.apply(new UTranslate(posStereoX, posStereoY))); stereotype.drawU(ug.apply(new UTranslate(posStereoX, posStereoY)));
final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder()); final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
final double posTitle; final double posTitle;
if (labelAlignment == HorizontalAlignment.LEFT) { if (labelAlignment == HorizontalAlignment.LEFT)
posTitle = 3; posTitle = 3;
} else if (labelAlignment == HorizontalAlignment.RIGHT) { else if (labelAlignment == HorizontalAlignment.RIGHT)
posTitle = width - dimTitle.getWidth() - 3; posTitle = width - dimTitle.getWidth() - 3;
} else { else
posTitle = (width - dimTitle.getWidth()) / 2; posTitle = (width - dimTitle.getWidth()) / 2;
}
title.drawU(ug.apply(new UTranslate(posTitle, 2 + dimStereo.getHeight()))); title.drawU(ug.apply(new UTranslate(posTitle, 2 + dimStereo.getHeight())));
} }

View File

@ -35,7 +35,7 @@
*/ */
package net.sourceforge.plantuml.graphic.color; package net.sourceforge.plantuml.graphic.color;
import net.sourceforge.plantuml.ThemeStyle; import net.sourceforge.plantuml.api.ThemeStyle;
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.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;

View File

@ -45,8 +45,8 @@ import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParamColors; import net.sourceforge.plantuml.SkinParamColors;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.cucadiagram.LinkStyle; import net.sourceforge.plantuml.cucadiagram.LinkStyle;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;

View File

@ -41,6 +41,7 @@ import java.util.List;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemAbstractFactory; import net.sourceforge.plantuml.command.PSystemAbstractFactory;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
@ -56,7 +57,7 @@ public class HclDiagramFactory extends PSystemAbstractFactory {
} }
@Override @Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
final List<String> highlighted = new ArrayList<>(); final List<String> highlighted = new ArrayList<>();
JsonValue data = null; JsonValue data = null;
StyleExtractor styleExtractor = null; StyleExtractor styleExtractor = null;
@ -77,7 +78,7 @@ public class HclDiagramFactory extends PSystemAbstractFactory {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
final JsonDiagram result = new JsonDiagram(source, UmlDiagramType.HCL, data, highlighted); final JsonDiagram result = new JsonDiagram(style, source, UmlDiagramType.HCL, data, highlighted);
// if (styleExtractor != null) { // if (styleExtractor != null) {
// styleExtractor.applyStyles(result.getSkinParam()); // styleExtractor.applyStyles(result.getSkinParam());
// final String title = styleExtractor.getTitle(); // final String title = styleExtractor.getTitle();

View File

@ -43,6 +43,7 @@ import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -65,14 +66,13 @@ public class Help extends UmlDiagram {
return new DiagramDescription("(Help)"); return new DiagramDescription("(Help)");
} }
public Help(UmlSource source) { public Help(ThemeStyle style, UmlSource source) {
super(source, UmlDiagramType.HELP); super(style, source, UmlDiagramType.HELP);
} }
@Override @Override
public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException { public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException {
return super.createImageBuilder(fileFormatOption) return super.createImageBuilder(fileFormatOption).annotations(false);
.annotations(false);
} }
@Override @Override
@ -84,9 +84,7 @@ public class Help extends UmlDiagram {
final Sheet sheet = Parser.build(fontConfiguration, HorizontalAlignment.LEFT, getSkinParam(), CreoleMode.FULL) final Sheet sheet = Parser.build(fontConfiguration, HorizontalAlignment.LEFT, getSkinParam(), CreoleMode.FULL)
.createSheet(display); .createSheet(display);
final SheetBlock1 sheetBlock = new SheetBlock1(sheet, LineBreakStrategy.NONE, 0); final SheetBlock1 sheetBlock = new SheetBlock1(sheet, LineBreakStrategy.NONE, 0);
return createImageBuilder(fileFormat) return createImageBuilder(fileFormat).drawable(sheetBlock).write(os);
.drawable(sheetBlock)
.write(os);
} }
public void add(CharSequence line) { public void add(CharSequence line) {

View File

@ -39,6 +39,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -46,8 +47,8 @@ import net.sourceforge.plantuml.core.UmlSource;
public class HelpFactory extends PSystemCommandFactory { public class HelpFactory extends PSystemCommandFactory {
@Override @Override
public Help createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public Help createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
return new Help(source); return new Help(style, source);
} }
@Override @Override

View File

@ -42,13 +42,13 @@ import java.util.Properties;
import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.BackSlash;
import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.command.PSystemBasicFactory;
import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.command.regex.Pattern2;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.ditaa.PSystemDitaa;
public class PSystemJcckitFactory extends PSystemBasicFactory<PSystemJcckit> { public class PSystemJcckitFactory extends PSystemBasicFactory<PSystemJcckit> {
@ -61,7 +61,7 @@ public class PSystemJcckitFactory extends PSystemBasicFactory<PSystemJcckit> {
} }
@Override @Override
public PSystemJcckit initDiagram(UmlSource source, String startLine) { public PSystemJcckit initDiagram(ThemeStyle style, UmlSource source, String startLine) {
this.data = null; this.data = null;
this.width = 640; this.width = 640;
this.height = 400; this.height = 400;
@ -106,7 +106,7 @@ public class PSystemJcckitFactory extends PSystemBasicFactory<PSystemJcckit> {
} }
@Override @Override
public PSystemJcckit executeLine(UmlSource source, PSystemJcckit system, String line) { public PSystemJcckit executeLine(ThemeStyle style, UmlSource source, PSystemJcckit system, String line) {
if (system == null && line.startsWith("jcckit")) { if (system == null && line.startsWith("jcckit")) {
data = new StringBuilder(); data = new StringBuilder();
extractDimension(line); extractDimension(line);

View File

@ -43,6 +43,7 @@ import java.util.List;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.TitledDiagram; import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -66,8 +67,9 @@ public class JsonDiagram extends TitledDiagram {
private final JsonValue root; private final JsonValue root;
private final List<String> highlighted; private final List<String> highlighted;
public JsonDiagram(UmlSource source, UmlDiagramType type, JsonValue json, List<String> highlighted) { public JsonDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type, JsonValue json,
super(source, type); List<String> highlighted) {
super(style, source, type);
if (json != null && (json.isString() || json.isBoolean() || json.isNumber())) { if (json != null && (json.isString() || json.isBoolean() || json.isNumber())) {
this.root = new JsonArray(); this.root = new JsonArray();
((JsonArray) this.root).add(json); ((JsonArray) this.root).add(json);

View File

@ -42,6 +42,7 @@ import java.util.List;
import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.BackSlash;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemAbstractFactory; import net.sourceforge.plantuml.command.PSystemAbstractFactory;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
@ -57,7 +58,7 @@ public class JsonDiagramFactory extends PSystemAbstractFactory {
} }
@Override @Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) { public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
final List<String> highlighted = new ArrayList<>(); final List<String> highlighted = new ArrayList<>();
StyleExtractor styleExtractor = null; StyleExtractor styleExtractor = null;
JsonValue json; JsonValue json;
@ -68,9 +69,9 @@ public class JsonDiagramFactory extends PSystemAbstractFactory {
it.next(); it.next();
while (true) { while (true) {
final String line = it.next(); final String line = it.next();
if (it.hasNext() == false) { if (it.hasNext() == false)
break; break;
}
if (line.startsWith("#")) { if (line.startsWith("#")) {
if (line.startsWith("#highlight ")) { if (line.startsWith("#highlight ")) {
highlighted.add(line.substring("#highlight ".length()).trim()); highlighted.add(line.substring("#highlight ".length()).trim());
@ -85,10 +86,10 @@ public class JsonDiagramFactory extends PSystemAbstractFactory {
} catch (ParseException e) { } catch (ParseException e) {
json = null; json = null;
} }
final JsonDiagram result = new JsonDiagram(source, UmlDiagramType.JSON, json, highlighted); final JsonDiagram result = new JsonDiagram(style, source, UmlDiagramType.JSON, json, highlighted);
if (styleExtractor != null) { if (styleExtractor != null)
styleExtractor.applyStyles(result.getSkinParam()); styleExtractor.applyStyles(result.getSkinParam());
}
return result; return result;
} }

View File

@ -35,19 +35,19 @@
*/ */
package net.sourceforge.plantuml.logo; package net.sourceforge.plantuml.logo;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.command.PSystemBasicFactory;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
public class PSystemLogoFactory extends PSystemBasicFactory<PSystemLogo> { public class PSystemLogoFactory extends PSystemBasicFactory<PSystemLogo> {
@Override @Override
public PSystemLogo initDiagram(UmlSource source, String startLine) { public PSystemLogo initDiagram(ThemeStyle style, UmlSource source, String startLine) {
return null; return null;
} }
@Override @Override
public PSystemLogo executeLine(UmlSource source, PSystemLogo system, String line) { public PSystemLogo executeLine(ThemeStyle style, UmlSource source, PSystemLogo system, String line) {
if (system == null && line.equalsIgnoreCase("logo")) { if (system == null && line.equalsIgnoreCase("logo")) {
return new PSystemLogo(source); return new PSystemLogo(source);
} }

View File

@ -35,6 +35,7 @@
*/ */
package net.sourceforge.plantuml.math; package net.sourceforge.plantuml.math;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.command.PSystemBasicFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -46,16 +47,15 @@ public class PSystemLatexFactory extends PSystemBasicFactory<PSystemLatex> {
} }
@Override @Override
public PSystemLatex initDiagram(UmlSource source, String startLine) { public PSystemLatex initDiagram(ThemeStyle style, UmlSource source, String startLine) {
if (getDiagramType() == DiagramType.LATEX) { if (getDiagramType() == DiagramType.LATEX)
return new PSystemLatex(source); return new PSystemLatex(source);
}
return null; return null;
} }
@Override @Override
public PSystemLatex executeLine(UmlSource source, PSystemLatex system, String line) { public PSystemLatex executeLine(ThemeStyle style, UmlSource source, PSystemLatex system, String line) {
system.doCommandLine(line); system.doCommandLine(line);
return system; return system;
} }

View File

@ -35,6 +35,7 @@
*/ */
package net.sourceforge.plantuml.math; package net.sourceforge.plantuml.math;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemBasicFactory; import net.sourceforge.plantuml.command.PSystemBasicFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -46,16 +47,15 @@ public class PSystemMathFactory extends PSystemBasicFactory<PSystemMath> {
} }
@Override @Override
public PSystemMath initDiagram(UmlSource source, String startLine) { public PSystemMath initDiagram(ThemeStyle style, UmlSource source, String startLine) {
if (getDiagramType() == DiagramType.MATH) { if (getDiagramType() == DiagramType.MATH)
return new PSystemMath(source); return new PSystemMath(source);
}
return null; return null;
} }
@Override @Override
public PSystemMath executeLine(UmlSource source, PSystemMath system, String line) { public PSystemMath executeLine(ThemeStyle style, UmlSource source, PSystemMath system, String line) {
system.doCommandLine(line); system.doCommandLine(line);
return system; return system;
} }

View File

@ -47,6 +47,7 @@ import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
@ -74,8 +75,8 @@ public class MindMapDiagram extends UmlDiagram {
return new DiagramDescription("MindMap"); return new DiagramDescription("MindMap");
} }
public MindMapDiagram(UmlSource source) { public MindMapDiagram(ThemeStyle style, UmlSource source) {
super(source, UmlDiagramType.MINDMAP); super(style, source, UmlDiagramType.MINDMAP);
this.mindmaps.add(new MindMap(getSkinParam())); this.mindmaps.add(new MindMap(getSkinParam()));
} }

View File

@ -39,6 +39,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory; import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
@ -67,8 +68,8 @@ public class MindMapDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public MindMapDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public MindMapDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
return new MindMapDiagram(source); return new MindMapDiagram(style, source);
} }
} }

View File

@ -50,6 +50,7 @@ import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.SpriteContainerEmpty; import net.sourceforge.plantuml.SpriteContainerEmpty;
import net.sourceforge.plantuml.UmlDiagram; import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
@ -96,8 +97,8 @@ public class NwDiagram extends UmlDiagram {
return new DiagramDescription("(Nwdiag)"); return new DiagramDescription("(Nwdiag)");
} }
public NwDiagram(UmlSource source) { public NwDiagram(ThemeStyle style, UmlSource source) {
super(source, UmlDiagramType.NWDIAG); super(style, source, UmlDiagramType.NWDIAG);
} }
public void init() { public void init() {

View File

@ -39,10 +39,11 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandFootboxIgnored; import net.sourceforge.plantuml.command.CommandFootboxIgnored;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.CommonCommands; import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType; import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -53,8 +54,8 @@ public class NwDiagramFactory extends PSystemCommandFactory {
} }
@Override @Override
public NwDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) { public NwDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
return new NwDiagram(source); return new NwDiagram(style, source);
} }
@Override @Override

View File

@ -40,6 +40,7 @@ import java.util.List;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.UmlSource; import net.sourceforge.plantuml.core.UmlSource;
@ -59,8 +60,8 @@ import net.sourceforge.plantuml.utils.UniqueSequence;
public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram { public abstract class AbstractClassOrObjectDiagram extends AbstractEntityDiagram {
public AbstractClassOrObjectDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) { public AbstractClassOrObjectDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type, ISkinSimple orig) {
super(source, type, orig); super(style, source, type, orig);
} }
@Override @Override

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