1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-25 04:06:08 +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
DiagonalCorner 0
LineThickness 1.0
LineColor #A80036
BackGroundColor #FEFECE
LineColor #181818
BackGroundColor #f8f8f8
Shadowing 0.0
}
document {
BackGroundColor White
BackGroundColor white
header {
HorizontalAlignment right
FontSize 10
FontColor #888888
BackGroundColor none
LineColor none
FontColor #8
BackGroundColor transparent
LineColor transparent
}
title {
HorizontalAlignment center
@ -28,19 +28,19 @@ document {
FontStyle bold
Padding 5
Margin 5
LineColor none
BackGroundColor none
LineColor transparent
BackGroundColor transparent
}
footer {
HorizontalAlignment center
FontSize 10
FontColor #888888
BackGroundColor none
LineColor none
FontColor #8
BackGroundColor transparent
LineColor transparent
}
legend {
LineColor black
BackGroundColor #DDDDDD
BackGroundColor #D
FontSize 14
RoundCorner 15
Padding 6
@ -51,8 +51,12 @@ document {
FontSize 14
Padding 0
Margin 1
LineColor none
BackGroundColor none
LineColor transparent
BackGroundColor transparent
}
frame {
LineColor black
LineThickness 1.5
}
}
@ -63,60 +67,12 @@ stereotype {
element {
Shadowing 4.0
Shadowing 0.0
title {
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 {
package {
LineThickness 1.5
@ -141,7 +97,7 @@ sequenceDiagram {
}
groupHeader {
BackGroundColor #EEEEEE
BackGroundColor #e
LineColor black
FontSize 13
FontStyle bold
@ -152,6 +108,41 @@ sequenceDiagram {
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 {
@ -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 {
FontSize 11
FontStyle plain
@ -302,17 +257,13 @@ swimlane {
FontSize 18
}
diamond {
Shadowing 3.0
}
arrow {
FontSize 13
}
note {
FontSize 13
BackGroundColor #FBFB77
BackGroundColor #ebebeb
}
partition {
@ -345,10 +296,6 @@ wbsDiagram {
FontSize 12
}
activityDiagram {
Shadowing 3.0
}
activityDiagram {
activity {
LineThickness 1.5
@ -366,16 +313,23 @@ activityDiagram {
arrow {
FontSize 11
}
}
activityBar {
Shadowing 3.0
BackgroundColor black
}
circle {
LineColor black
Shadowing 3.0
circle {
start {
LineColor #2
BackgroundColor #2
}
stop {
LineColor #2
BackgroundColor transparent
}
end {
LineColor #2
BackgroundColor transparent
}
}
activityBar {
BackgroundColor #5
}
}
@ -395,7 +349,6 @@ ganttDiagram {
}
note {
FontSize 9
Shadowing 0.0
}
separator {
FontSize 11
@ -409,8 +362,8 @@ ganttDiagram {
LineColor #C0C0C0
}
closed {
BackGroundColor #E0E8E8
FontColor #909898
BackGroundColor #E0E0E0
FontColor #989898
}
task {
RoundCorner 0
@ -456,27 +409,250 @@ yamlDiagram,jsonDiagram {
timingDiagram {
LineColor #3
FontColor #3
FontStyle bold
LineThickness 1.5
timeline {
FontStyle plain
FontSize 11
}
arrow {
LineColor darkblue
LineThickness 1.5
}
constraintArrow {
FontSize 12
FontStyle plain
FontColor darkred
LineColor darkred
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 {
network {
FontSize 12
Shadowing 1.0
}
server {
FontSize 12
}
group {
FontSize 12
BackGroundColor #ddd
BackGroundColor #d
}
arrow {
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
DiagonalCorner 0
LineThickness 1.0
LineColor #181818
BackGroundColor #f8f8f8
LineColor #A80036
BackGroundColor #FEFECE
Shadowing 0.0
}
document {
BackGroundColor White
BackGroundColor white
header {
HorizontalAlignment right
FontSize 10
FontColor #888888
BackGroundColor none
LineColor none
FontColor #8
BackGroundColor transparent
LineColor transparent
}
title {
HorizontalAlignment center
@ -28,19 +28,19 @@ document {
FontStyle bold
Padding 5
Margin 5
LineColor none
BackGroundColor none
LineColor transparent
BackGroundColor transparent
}
footer {
HorizontalAlignment center
FontSize 10
FontColor #888888
BackGroundColor none
LineColor none
FontColor #8
BackGroundColor transparent
LineColor transparent
}
legend {
LineColor black
BackGroundColor #DDDDDD
BackGroundColor #d
FontSize 14
RoundCorner 15
Padding 6
@ -51,8 +51,12 @@ document {
FontSize 14
Padding 0
Margin 1
LineColor none
BackGroundColor none
LineColor transparent
BackGroundColor transparent
}
frame {
LineColor black
LineThickness 1.5
}
}
@ -63,12 +67,60 @@ stereotype {
element {
Shadowing 0.0
Shadowing 4.0
title {
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 {
package {
LineThickness 1.5
@ -93,7 +145,7 @@ sequenceDiagram {
}
groupHeader {
BackGroundColor #EEEEEE
BackGroundColor #e
LineColor black
FontSize 13
FontStyle bold
@ -104,6 +156,42 @@ sequenceDiagram {
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 {
@ -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 {
FontSize 11
FontStyle plain
@ -254,13 +306,17 @@ swimlane {
FontSize 18
}
diamond {
Shadowing 3.0
}
arrow {
FontSize 13
}
note {
FontSize 13
BackGroundColor #ebebeb
BackGroundColor #FBFB77
}
partition {
@ -293,6 +349,10 @@ wbsDiagram {
FontSize 12
}
activityDiagram {
Shadowing 3.0
}
activityDiagram {
activity {
LineThickness 1.5
@ -310,14 +370,24 @@ activityDiagram {
arrow {
FontSize 11
}
}
activityBar {
BackgroundColor black
}
circle {
LineColor black
circle {
start {
LineColor black
BackgroundColor black
}
stop {
LineColor black
BackgroundColor white
}
end {
LineColor black
BackgroundColor white
}
}
activityBar {
Shadowing 3.0
BackgroundColor black
}
}
@ -337,6 +407,7 @@ ganttDiagram {
}
note {
FontSize 9
Shadowing 0.0
}
separator {
FontSize 11
@ -397,17 +468,51 @@ yamlDiagram,jsonDiagram {
timingDiagram {
LineColor #3
FontColor #3
FontStyle bold
LineThickness 1.5
timeline {
FontStyle plain
FontSize 11
}
arrow {
LineColor darkblue
LineThickness 1.5
}
constraintArrow {
FontSize 12
FontStyle plain
FontColor darkred
LineColor darkred
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 {
network {
FontSize 12
Shadowing 1.0
}
server {
FontSize 12
@ -420,33 +525,3 @@ nwdiagDiagram {
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.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.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
@ -306,7 +306,7 @@ static private HColorSet colors = HColorSet.instance();
private Color decodeInternal(String value) {
if (value!=null) {
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) {
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.TextBlockUtils;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
@ -57,6 +58,7 @@ import net.sourceforge.plantuml.svek.DecorateEntityImage;
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
@ -88,22 +90,39 @@ public class AnnotatedWorker {
public TextBlock addFrame(final TextBlock original) {
final Display mainFrame = annotated.getMainFrame();
if (mainFrame == null) {
if (mainFrame == null)
return original;
}
final double x1 = 5;
final double x2 = 7;
final double y1 = 10;
final double y2 = 10;
final SymbolContext symbolContext = new SymbolContext(getBackgroundColor(), HColorUtils.BLACK)
.withShadow(getSkinParam().shadowing(null) ? 3 : 0);
final double deltaShadow;
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 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 dimOriginal = original.calculateDimension(stringBounder);
final double width = x1 + Math.max(originalMinMax.getWidth(), dimTitle.getWidth()) + x2;
final double height = dimTitle.getHeight() + y1 + originalMinMax.getHeight() + y2;
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) {
final DisplayPositioned legend = annotated.getLegend();
if (legend.isNull()) {
if (legend.isNull())
return original;
}
final TextBlock text = EntityImageLegend.create(legend.getDisplay(), getSkinParam());
return DecorateEntityImage.add(original, text, legend.getHorizontalAlignment(), legend.getVerticalAlignment());
@ -157,18 +176,18 @@ public class AnnotatedWorker {
private TextBlock addCaption(TextBlock original) {
final DisplayPositioned caption = annotated.getCaption();
if (caption.isNull()) {
if (caption.isNull())
return original;
}
final TextBlock text = getCaption();
return DecorateEntityImage.addBottom(original, text, HorizontalAlignment.CENTER);
}
public TextBlock getCaption() {
final DisplayPositioned caption = annotated.getCaption();
if (caption.isNull()) {
if (caption.isNull())
return TextBlockUtils.empty(0, 0);
}
if (UseStyle.useBetaStyle()) {
final Style style = StyleSignature.of(SName.root, SName.document, SName.caption)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
@ -180,9 +199,8 @@ public class AnnotatedWorker {
private TextBlock addTitle(TextBlock original) {
final DisplayPositioned title = (DisplayPositioned) annotated.getTitle();
if (title.isNull()) {
if (title.isNull())
return original;
}
final TextBlock block;
if (UseStyle.useBetaStyle()) {
@ -201,9 +219,9 @@ public class AnnotatedWorker {
private TextBlock addHeaderAndFooter(TextBlock original) {
final DisplaySection footer = annotated.getFooter();
final DisplaySection header = annotated.getHeader();
if (footer.isNull() && header.isNull()) {
if (footer.isNull() && header.isNull())
return original;
}
TextBlock textFooter = null;
if (footer.isNull() == false) {
Style style = null;

View File

@ -48,6 +48,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.code.AsciiEncoder;
import net.sourceforge.plantuml.code.Transcoder;
import net.sourceforge.plantuml.code.TranscoderUtil;
@ -70,13 +71,14 @@ public class BlockUml {
private final Defines localDefines;
private final ISkinSimple skinParam;
private final Set<FileWithSuffix> included = new HashSet<>();
private final ThemeStyle style;
public Set<FileWithSuffix> getIncluded() {
return Collections.unmodifiableSet(included);
}
BlockUml(String... strings) {
this(convert(strings), Defines.createEmpty(), null, null, null);
BlockUml(ThemeStyle style, String... strings) {
this(style, convert(strings), Defines.createEmpty(), null, null, null);
}
public String getEncodedUrl() throws IOException {
@ -113,21 +115,24 @@ public class BlockUml {
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
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.localDefines = defines;
this.skinParam = skinParam;
final String s0 = strings.get(0).getTrimmed().getString();
if (StartUtils.startsWithSymbolAnd("start", s0) == false) {
if (StartUtils.startsWithSymbolAnd("start", s0) == false)
throw new IllegalArgumentException();
}
if (mode == null) {
this.data = new ArrayList<>(strings);
} else {
@ -141,39 +146,38 @@ public class BlockUml {
}
public String getFileOrDirname() {
if (OptionFlags.getInstance().isWord()) {
if (OptionFlags.getInstance().isWord())
return null;
}
final Matcher2 m = StartUtils.patternFilename.matcher(StringUtils.trin(data.get(0).getString()));
final boolean ok = m.find();
if (ok == false) {
if (ok == false)
return null;
}
String result = m.group(1);
final int x = result.indexOf(',');
if (x != -1) {
if (x != -1)
result = result.substring(0, x);
}
for (int i = 0; i < result.length(); i++) {
final char c = result.charAt(i);
if ("<>|".indexOf(c) != -1) {
if ("<>|".indexOf(c) != -1)
return null;
}
}
if (result.startsWith("file://")) {
if (result.startsWith("file://"))
result = result.substring("file://".length());
}
result = result.replaceAll("\\.\\w\\w\\w$", "");
return result;
}
public Diagram getDiagram() {
if (system == null) {
if (preprocessorError) {
if (preprocessorError)
system = new PSystemErrorPreprocessor(data, debug);
} else {
system = new PSystemBuilder().createPSystem(skinParam, data, rawSource);
}
else
system = new PSystemBuilder().createPSystem(style, skinParam, data, rawSource);
}
return system;
}
@ -186,9 +190,9 @@ public class BlockUml {
try {
final AsciiEncoder coder = new AsciiEncoder();
final MessageDigest msgDigest = MessageDigest.getInstance("MD5");
for (StringLocated s : data) {
for (StringLocated s : data)
msgDigest.update(s.getString().getBytes(UTF_8));
}
final byte[] digest = msgDigest.digest();
return coder.encode(digest);
} catch (Exception e) {
@ -212,12 +216,12 @@ public class BlockUml {
public List<String> getDefinition(boolean withHeader) {
final List<String> result = new ArrayList<>();
for (StringLocated s : data) {
for (StringLocated s : data)
result.add(s.getString());
}
if (withHeader) {
if (withHeader)
return Collections.unmodifiableList(result);
}
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.Set;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.preproc.FileWithSuffix;
import net.sourceforge.plantuml.preproc.ImportedFiles;
@ -65,25 +66,36 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
private final Defines defines;
private final ImportedFiles importedFiles;
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
public BlockUmlBuilder(List<String> config, String charset, Defines defines, Reader readerInit, SFile newCurrentDir,
String desc) throws IOException {
this(config, charsetOrDefault(charset), defines, readerInit, newCurrentDir, desc);
this(ThemeStyle.LIGHT_REGULAR, 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.charset = requireNonNull(charset);
this.reader = new UncommentReadLine(ReadLineReader.create(readerInit, desc));
this.importedFiles = ImportedFiles.createImportedFiles(new AParentFolderRegular(newCurrentDir));
try (ReadLineNumbered includer = new Preprocessor(config, reader)) {
init(includer);
} 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 {
StringLocated s = null;
List<StringLocated> current = null;
@ -121,9 +125,9 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
current.add(s);
} else if (paused) {
final StringLocated append = StartUtils.getPossibleAppend(s);
if (append != null) {
if (append != null)
current.add(append);
}
}
if (StartUtils.isArobaseUnpauseDiagram(s.getString())) {
@ -131,10 +135,10 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
reader.setPaused(false);
}
if (StartUtils.isArobaseEndDiagram(s.getString()) && current != null) {
if (paused) {
if (paused)
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());
blocks.add(uml);
current = null;
@ -152,11 +156,10 @@ public final class BlockUmlBuilder implements DefinitionsContainer {
}
public List<String> getDefinition(String name) {
for (BlockUml block : blocks) {
if (block.isStartDef(name)) {
for (BlockUml block : blocks)
if (block.isStartDef(name))
return block.getDefinition(false);
}
}
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
public final String getCharset() {

View File

@ -200,7 +200,8 @@ public class EmbeddedDiagram implements CharSequence {
}
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();
}

View File

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

View File

@ -194,6 +194,6 @@ public interface ISkinParam extends ISkinSimple {
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 net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
@ -63,5 +64,7 @@ public interface ISkinSimple extends SpriteContainer {
public void copyAllFrom(ISkinSimple other);
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.activitydiagram3.ActivityDiagramFactory3;
import net.sourceforge.plantuml.api.PSystemFactory;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.board.BoardDiagramFactory;
import net.sourceforge.plantuml.bpm.BpmDiagramFactory;
import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory;
@ -105,7 +106,7 @@ public class PSystemBuilder {
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) {
final long now = System.currentTimeMillis();
@ -129,10 +130,10 @@ public class PSystemBuilder {
final DiagramType diagramType = umlSource.getDiagramType();
final List<PSystemError> errors = new ArrayList<>();
for (PSystemFactory systemFactory : factories) {
if (diagramType != systemFactory.getDiagramType()) {
if (diagramType != systemFactory.getDiagramType())
continue;
}
final Diagram sys = systemFactory.createSystem(umlSource, skinParam);
final Diagram sys = systemFactory.createSystem(style, umlSource, skinParam);
if (isOk(sys)) {
result = sys;
return sys;
@ -140,9 +141,8 @@ public class PSystemBuilder {
errors.add((PSystemError) sys);
}
final PSystemError err = PSystemErrorUtils.merge(errors);
result = err;
return err;
result = PSystemErrorUtils.merge(errors);
return result;
} finally {
if (result != null && OptionFlags.getInstance().isEnableStats()) {
StatsUtilsIncrement.onceMoreParse(System.currentTimeMillis() - now, result.getClass());
@ -228,9 +228,9 @@ public class PSystemBuilder {
}
private boolean isOk(Diagram ps) {
if (ps == null || ps instanceof PSystemError) {
if (ps == null || ps instanceof PSystemError)
return false;
}
return true;
}

View File

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

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml;
import java.util.Collection;
import java.util.Map;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.cucadiagram.Rankdir;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
@ -455,10 +456,10 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getlengthAdjust();
}
@Override
public void assumeTransparent(ThemeStyle style) {
skinParam.assumeTransparent(style);
}
// @Override
// public void assumeTransparent(ThemeStyle style) {
// skinParam.assumeTransparent(style);
// }
@Override
public ThemeStyle getThemeStyle() {

View File

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

View File

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

View File

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

View File

@ -37,6 +37,7 @@ package net.sourceforge.plantuml;
import java.util.Map;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.sprite.SpriteImage;
@ -103,7 +104,7 @@ public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
}
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.AnimationDecoder;
import net.sourceforge.plantuml.api.ApiStable;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.UmlSource;
@ -86,18 +87,18 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
return pragma;
}
public TitledDiagram(UmlSource source, UmlDiagramType type) {
public TitledDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type) {
super(source);
this.type = type;
this.skinParam = SkinParam.create(type);
this.skinParam = SkinParam.create(type, style);
}
public final StyleBuilder getCurrentStyleBuilder() {
return skinParam.getCurrentStyleBuilder();
}
public TitledDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) {
this(source, type);
public TitledDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type, ISkinSimple orig) {
this(style, source, type);
if (orig != null) {
this.skinParam.copyAllFrom(orig);
}

View File

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

View File

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

View File

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

View File

@ -42,6 +42,7 @@ import java.util.Objects;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Code;
@ -62,8 +63,8 @@ public class ActivityDiagram extends CucaDiagram {
private IEntity lastEntityBrancheConsulted;
private ConditionalContext currentContext;
public ActivityDiagram(UmlSource source, ISkinSimple skinParam) {
super(source, UmlDiagramType.ACTIVITY, skinParam);
public ActivityDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
super(style, source, UmlDiagramType.ACTIVITY, skinParam);
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.CommandLinkLongActivity;
import net.sourceforge.plantuml.activitydiagram.command.CommandPartition;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandFootboxIgnored;
@ -59,8 +60,8 @@ import net.sourceforge.plantuml.core.UmlSource;
public class ActivityDiagramFactory extends PSystemCommandFactory {
@Override
public ActivityDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
return new ActivityDiagram(source, skinParam);
public ActivityDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
return new ActivityDiagram(style, source, skinParam);
}
@Override

View File

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

View File

@ -163,10 +163,20 @@ public class FtileFactoryDelegatorSwitch extends FtileFactoryDelegator {
}
private Ftile getDiamond2(Swimlane swimlane, Branch branch0) {
final HColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
final HColor backColor = branch0.getColor() == null
? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground)
: branch0.getColor();
final HColor borderColor;
final HColor backColor;
if (UseStyle.useBetaStyle()) {
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,
swimlane);

View File

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

View File

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

View File

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

View File

@ -70,12 +70,12 @@ public class FtileSwitchNude extends FtileDimensionMemoize {
public Set<Swimlane> getSwimlanes() {
final Set<Swimlane> result = new HashSet<>();
if (getSwimlaneIn() != null) {
if (getSwimlaneIn() != null)
result.add(getSwimlaneIn());
}
for (Ftile tile : tiles) {
for (Ftile tile : tiles)
result.addAll(tile.getSwimlanes());
}
return Collections.unmodifiableSet(result);
}
@ -89,9 +89,9 @@ public class FtileSwitchNude extends FtileDimensionMemoize {
@Override
public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) {
if (tiles.contains(child)) {
if (tiles.contains(child))
return getTranslateNude(child, stringBounder);
}
throw new UnsupportedOperationException();
}
@ -99,9 +99,9 @@ public class FtileSwitchNude extends FtileDimensionMemoize {
double x1 = 0;
for (Ftile candidate : tiles) {
final FtileGeometry dim1 = candidate.calculateDimension(stringBounder);
if (candidate == tile) {
if (candidate == tile)
return UTranslate.dx(x1);
}
x1 += dim1.getWidth() + xSeparation;
}
throw new IllegalArgumentException();
@ -109,27 +109,27 @@ public class FtileSwitchNude extends FtileDimensionMemoize {
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
for (Ftile tile : tiles) {
for (Ftile tile : tiles)
ug.apply(getTranslateNude(tile, stringBounder)).draw(tile);
}
}
@Override
final protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
final FtileGeometry dimTotal = calculateDimensionInternal(stringBounder);
for (Ftile tile : tiles)
if (tile.calculateDimension(stringBounder).hasPointOut()) {
if (tile.calculateDimension(stringBounder).hasPointOut())
return dimTotal;
}
return dimTotal.withoutPointOut();
}
@Override
protected FtileGeometry calculateDimensionInternalSlow(StringBounder stringBounder) {
Dimension2D result = new Dimension2DDouble(0, 0);
for (Ftile couple : tiles) {
for (Ftile couple : tiles)
result = Dimension2DDouble.mergeLR(result, couple.calculateDimension(stringBounder));
}
result = Dimension2DDouble.delta(result, xSeparation * (tiles.size() - 1), 100);
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(tiles.size() - 1).calculateDimension(stringBounder).getLeft();
w9 = getW9(stringBounder);
if (w13 > w9) {
if (w13 > w9)
mode = Mode.BIG_DIAMOND;
} else {
else
mode = Mode.SMALL_DIAMOND;
}
}
private double getW9(StringBounder stringBounder) {
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();
}
return result;
}
@ -144,17 +144,15 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
final StringBounder stringBounder = ug.getStringBounder();
ug.apply(getTranslateDiamond1(stringBounder)).draw(diamond1);
if (mode == Mode.BIG_DIAMOND) {
for (Ftile tile : tiles) {
if (mode == Mode.BIG_DIAMOND)
for (Ftile tile : tiles)
tile.drawU(ug.apply(getTranslateOf(tile, stringBounder)));
}
} else {
else
super.drawU(ug.apply(getTranslateMain(stringBounder)));
}
if (calculateDimension(stringBounder).hasPointOut()) {
if (calculateDimension(stringBounder).hasPointOut())
ug.apply(getTranslateDiamond2(stringBounder)).draw(diamond2);
}
}
final protected UTranslate getTranslateOf(Ftile tile, StringBounder stringBounder) {
@ -163,11 +161,10 @@ public class FtileSwitchWithDiamonds extends FtileSwitchNude {
double dx = 0;
final double suppx = (w13 - w9) / (tiles.size() - 1);
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));
}
dx += tiles.get(i).calculateDimension(stringBounder).getWidth() + suppx;
dx += tiles.get(i).calculateDimension(stringBounder).getWidth() + suppx;
}
if (tile == tiles.get(tiles.size() - 1)) {
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.activitydiagram3.Branch;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
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.Snake;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
@ -100,13 +98,13 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
private Point2D getP1(StringBounder stringBounder) {
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
final Point2D pt;
if (getFtile2() == tiles.get(0)) {
if (getFtile2() == tiles.get(0))
pt = dimDiamond1.getPointD();
} else if (getFtile2() == tiles.get(tiles.size() - 1)) {
else if (getFtile2() == tiles.get(tiles.size() - 1))
pt = dimDiamond1.getPointB();
} else {
else
throw new IllegalStateException();
}
return getTranslateDiamond1(stringBounder).getTranslated(pt);
}
@ -129,9 +127,9 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final FtileGeometry geo = getFtile1().calculateDimension(stringBounder);
if (geo.hasPointOut() == false) {
if (geo.hasPointOut() == false)
return;
}
final Point2D p1 = getP1(stringBounder);
final double x1 = p1.getX();
final double y1 = p1.getY();
@ -320,18 +318,18 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
branches.get(lastOutgoingArrow).getTextBlockSpecial()));
for (int i = firstOutgoingArrow + 1; i < lastOutgoingArrow; 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()));
}
}
}
private int getFirstOutgoingArrow(StringBounder stringBounder) {
for (int i = 0; i < tiles.size() - 1; i++) {
final Ftile tile = tiles.get(i);
if (tile.calculateDimension(stringBounder).hasPointOut()) {
if (tile.calculateDimension(stringBounder).hasPointOut())
return i;
}
}
return tiles.size();
}
@ -339,9 +337,9 @@ public class FtileSwitchWithManyLinks extends FtileSwitchWithDiamonds {
private int getLastOutgoingArrow(StringBounder stringBounder) {
for (int i = tiles.size() - 1; i >= 0; i--) {
final Ftile tile = tiles.get(i);
if (tile.calculateDimension(stringBounder).hasPointOut()) {
if (tile.calculateDimension(stringBounder).hasPointOut())
return i;
}
}
return -1;
}

View File

@ -80,8 +80,8 @@ public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds {
final double x2 = p2.getX();
final double y2 = p2.getY();
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown()).withLabel(branch.getTextBlockPositive(),
arrowHorizontalAlignment());
final Snake snake = Snake.create(null, arrowColor, Arrows.asToDown())
.withLabel(branch.getTextBlockPositive(), arrowHorizontalAlignment());
// snake.addPoint(x1, y1);
snake.addPoint(x2, y1);
snake.addPoint(x2, y2);
@ -139,9 +139,8 @@ public class FtileSwitchWithOneLink extends FtileSwitchWithDiamonds {
final Ftile single = tiles.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));
}
return FtileUtils.addConnection(this, conns);
}

View File

@ -66,7 +66,7 @@ public class FtileBlackBlock extends AbstractFtile {
private double width;
private double height;
private TextBlock label = TextBlockUtils.empty(0, 0);
private final HColor colorBar;
private HColor colorBar;
private final 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);
}
private StyleSignature getDefaultStyleDefinitionBar() {
return StyleSignature.of(SName.root, SName.element, SName.activityBar);
private StyleSignature getSignature() {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.activityBar);
}
public void drawU(UGraphic ug) {
final URectangle rect = new URectangle(width, height).rounded(5).ignoreForCompressionOnX();
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();
rect.setDeltaShadow(shadowing);
colorBar = style.value(PName.BackGroundColor).asColor(skinParam().getThemeStyle(), getIHtmlColorSet());
} else {
if (skinParam().shadowing(null))
rect.setDeltaShadow(3);

View File

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

View File

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

View File

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

View File

@ -88,7 +88,8 @@ public class FtileDiamondSquare extends FtileDiamondWIP {
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
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
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) {
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);
}
Dimension2D result = dimLabel;
result = Dimension2DDouble.delta(result, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
return result;

View File

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

View File

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

View File

@ -39,9 +39,10 @@ import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource;
@ -68,8 +69,8 @@ public class BoardDiagramFactory extends PSystemCommandFactory {
}
@Override
public BoardDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
return new BoardDiagram(source);
public BoardDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
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.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
@ -74,29 +75,26 @@ public class BpmDiagram extends UmlDiagram {
return new DiagramDescription("(Bpm Diagram)");
}
public BpmDiagram(UmlSource source) {
super(source, UmlDiagramType.BPM);
public BpmDiagram(ThemeStyle style, UmlSource source) {
super(style, source, UmlDiagramType.BPM);
}
@Override
public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException {
return super.createImageBuilder(fileFormatOption)
.annotations(false);
return super.createImageBuilder(fileFormatOption).annotations(false);
}
@Override
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException {
return createImageBuilder(fileFormatOption)
.drawable(getUDrawable())
.write(os);
return createImageBuilder(fileFormatOption).drawable(getUDrawable()).write(os);
}
private UDrawable getUDrawable() {
final Grid grid = createGrid();
cleanGrid(grid);
final GridArray gridArray = grid.toArray(SkinParam.create(getUmlDiagramType()));
final GridArray gridArray = grid.toArray(SkinParam.create(getUmlDiagramType(), ThemeStyle.LIGHT_REGULAR));
// gridArray.addEdges(edges);
// System.err.println("gridArray=" + gridArray);
return gridArray;

View File

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

View File

@ -35,7 +35,7 @@
*/
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.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -55,7 +55,7 @@ public class BrailleDrawer implements UDrawable {
}
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++) {
ug.apply(UTranslate.dx(x * step + spotSize + 1))
.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.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
public abstract class AbstractEntityDiagram extends CucaDiagram {
public AbstractEntityDiagram(UmlSource source, UmlDiagramType type, ISkinSimple orig) {
super(source, type, orig);
public AbstractEntityDiagram(ThemeStyle style, UmlSource source, UmlDiagramType type, ISkinSimple orig) {
super(style, source, type, orig);
}
final protected List<String> getDotStrings() {

View File

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

View File

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

View File

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

View File

@ -40,6 +40,7 @@ import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource;
@ -57,20 +58,20 @@ public abstract class PSystemBasicFactory<P extends AbstractPSystem> extends PSy
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) {
return result.getTrimmed().getString().length() == 0;
}
@Override
final public Diagram createSystem(UmlSource source, ISkinSimple skinParam) {
final public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
source = source.removeInitialSkinparam();
final IteratorCounter2 it = source.iterator2();
final StringLocated startLine = it.next();
P system = initDiagram(source, startLine.getString());
P system = initDiagram(style, source, startLine.getString());
boolean first = true;
while (it.hasNext()) {
final StringLocated s = it.next();
@ -84,7 +85,7 @@ public abstract class PSystemBasicFactory<P extends AbstractPSystem> extends PSy
}
return system;
}
system = executeLine(source, system, s.getString());
system = executeLine(style, source, system, s.getString());
if (system == null) {
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", 0, s.getLocation());
// 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.LineLocation;
import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource;
@ -57,7 +58,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
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() {
this(DiagramType.UML);
@ -68,7 +69,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
}
@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 StringLocated startLine = it.next();
if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false)
@ -80,7 +81,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
return buildEmptyError(source, startLine.getLocation(), it.getTrace());
}
AbstractPSystem sys = createEmptyDiagram(source, skinParam);
AbstractPSystem sys = createEmptyDiagram(style, source, skinParam);
while (it.hasNext()) {
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.LineLocation;
import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource;
@ -57,11 +58,11 @@ public abstract class PSystemSingleLineFactory extends PSystemAbstractFactory {
}
@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;
}
final IteratorCounter2 it = source.iterator2();
if (source.isEmpty()) {
final LineLocation location = it.next().getLocation();
@ -69,17 +70,16 @@ public abstract class PSystemSingleLineFactory extends PSystemAbstractFactory {
}
final StringLocated startLine = it.next();
if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false) {
if (StartUtils.isArobaseStartDiagram(startLine.getString()) == false)
throw new UnsupportedOperationException();
}
if (it.hasNext() == false) {
if (it.hasNext() == false)
return buildEmptyError(source, startLine.getLocation(), it.getTrace());
}
final StringLocated s = it.next();
if (StartUtils.isArobaseEndDiagram(s.getString())) {
if (StartUtils.isArobaseEndDiagram(s.getString()))
return buildEmptyError(source, s.getLocation(), it.getTrace());
}
final AbstractPSystem sys = executeLine(source, s.getString());
if (sys == null) {
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.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Code;
@ -49,8 +50,8 @@ import net.sourceforge.plantuml.graphic.USymbol;
public class CompositeDiagram extends AbstractEntityDiagram {
public CompositeDiagram(UmlSource source, ISkinSimple skinParam) {
super(source, UmlDiagramType.COMPOSITE, skinParam);
public CompositeDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
super(style, source, UmlDiagramType.COMPOSITE, skinParam);
}
@Override

View File

@ -39,9 +39,10 @@ import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
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.CommandCreatePackageBlock;
import net.sourceforge.plantuml.compositediagram.command.CommandEndPackageBlock;
@ -69,7 +70,7 @@ public class CompositeDiagramFactory extends PSystemCommandFactory {
}
@Override
public CompositeDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
return new CompositeDiagram(source, skinParam);
public CompositeDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple 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 FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(font);
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);
// final Dimension2D dim = TextBlockUtils.getDimension(sheetBlock);

View File

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

View File

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

View File

@ -54,16 +54,16 @@ public class DisplaySection {
public DisplaySection withPage(int page, int lastpage) {
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));
}
return result;
}
public Display getDisplay() {
if (map.size() == 0) {
if (map.size() == 0)
return null;
}
return map.values().iterator().next();
}
@ -72,31 +72,31 @@ public class DisplaySection {
}
public final HorizontalAlignment getHorizontalAlignment() {
if (map.size() == 0) {
if (map.size() == 0)
return HorizontalAlignment.CENTER;
}
return map.keySet().iterator().next();
}
public boolean isNull() {
if (map.size() == 0) {
if (map.size() == 0)
return true;
}
final Display display = map.values().iterator().next();
return Display.isNull(display);
}
public TextBlock createRibbon(FontConfiguration fontConfiguration, ISkinSimple spriteContainer, Style style) {
if (map.size() == 0) {
if (map.size() == 0)
return null;
}
final Display display = map.values().iterator().next();
if (Display.isNull(display) || display.size() == 0) {
if (Display.isNull(display) || display.size() == 0)
return null;
}
if (style != null) {
if (style != null)
return style.createTextBlockBordered(display, spriteContainer.getIHtmlColorSet(), spriteContainer);
}
return display.create(fontConfiguration, getHorizontalAlignment(), spriteContainer);
}

View File

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

View File

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

View File

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

View File

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

View File

@ -63,11 +63,12 @@ public class CommandNewpage extends SingleLineCommand2<UmlDiagram> {
@Override
protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) {
final int dpi = diagram.getSkinParam().getDpi();
final UmlDiagram emptyDiagram = (UmlDiagram) factory.createEmptyDiagram(diagram.getSource(), diagram.getSkinParam());
if (dpi != 96) {
final UmlDiagram emptyDiagram = (UmlDiagram) factory.createEmptyDiagram(diagram.getSkinParam().getThemeStyle(),
diagram.getSource(), diagram.getSkinParam());
if (dpi != 96)
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);
}
}

View File

@ -34,6 +34,7 @@
*/
package net.sourceforge.plantuml.directdot;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemBasicFactory;
import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource;
@ -47,21 +48,21 @@ public class PSystemDotFactory extends PSystemBasicFactory<PSystemDot> {
}
@Override
public PSystemDot initDiagram(UmlSource source, String startLine) {
public PSystemDot initDiagram(ThemeStyle style, UmlSource source, String startLine) {
data = null;
return null;
}
@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*\\{")) {
data = new StringBuilder(line);
data.append("\n");
return new PSystemDot(source, data.toString());
}
if (data == null || system == null) {
if (data == null || system == null)
return null;
}
data.append(line);
data.append("\n");
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.Pattern;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemBasicFactory;
import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.definition.PSystemDefinition;
public class PSystemDitaaFactory extends PSystemBasicFactory<PSystemDitaa> {
@ -56,15 +56,15 @@ public class PSystemDitaaFactory extends PSystemBasicFactory<PSystemDitaa> {
}
@Override
public PSystemDitaa initDiagram(UmlSource source, String startLine) {
public PSystemDitaa initDiagram(ThemeStyle style, UmlSource source, String startLine) {
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;
}
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;
}
final float scale = extractScale(startLine);
if (getDiagramType() == DiagramType.UML) {
return null;
@ -76,29 +76,29 @@ public class PSystemDitaaFactory extends PSystemBasicFactory<PSystemDitaa> {
}
@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("))) {
boolean performSeparationOfCommonEdges = true;
if (line.contains("-E") || line.contains("--no-separation")) {
if (line.contains("-E") || line.contains("--no-separation"))
performSeparationOfCommonEdges = false;
}
boolean dropShadows = true;
if (line.contains("-S") || line.contains("--no-shadows")) {
if (line.contains("-S") || line.contains("--no-shadows"))
dropShadows = false;
}
final float scale = extractScale(line);
return new PSystemDitaa(source, "", performSeparationOfCommonEdges, dropShadows, scale);
}
if (system == null) {
if (system == null)
return null;
}
return system.add(line);
}
private float extractScale(String line) {
if (line == null) {
if (line == null)
return 1;
}
final Pattern p = Pattern.compile("scale=([\\d.]+)");
final Matcher m = p.matcher(line);
if (m.find()) {

View File

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

View File

@ -39,6 +39,16 @@ import java.awt.geom.Point2D;
import java.util.Collection;
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..."
*
@ -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.ElkEdgeSection;
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.UDrawable;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.svek.extremity.ExtremityFactory;
import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryExtends;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -109,43 +114,51 @@ public class ElkPath implements UDrawable {
}
private ColorParam getArrowColorParam() {
if (diagram.getUmlDiagramType() == UmlDiagramType.CLASS) {
if (diagram.getUmlDiagramType() == UmlDiagramType.CLASS)
return ColorParam.arrow;
} else if (diagram.getUmlDiagramType() == UmlDiagramType.OBJECT) {
else if (diagram.getUmlDiagramType() == UmlDiagramType.OBJECT)
return ColorParam.arrow;
} else if (diagram.getUmlDiagramType() == UmlDiagramType.DESCRIPTION) {
else if (diagram.getUmlDiagramType() == UmlDiagramType.DESCRIPTION)
return ColorParam.arrow;
} else if (diagram.getUmlDiagramType() == UmlDiagramType.ACTIVITY) {
else if (diagram.getUmlDiagramType() == UmlDiagramType.ACTIVITY)
return ColorParam.arrow;
} else if (diagram.getUmlDiagramType() == UmlDiagramType.STATE) {
else if (diagram.getUmlDiagramType() == UmlDiagramType.STATE)
return ColorParam.arrow;
}
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) {
if (link.isHidden()) {
if (link.isHidden())
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) {
final HColor newColor = this.link.getColors().getColor(ColorType.ARROW, ColorType.LINE);
if (newColor != null) {
if (newColor != null)
color = newColor;
}
} else if (this.link.getSpecificColor() != null) {
color = this.link.getSpecificColor();
}
final LinkType linkType = link.getType();
UStroke stroke = linkType.getStroke3(diagram.getSkinParam().getThickness(LineParam.arrow, null));
if (link.getColors() != null && link.getColors().getSpecificLineStroke() != null) {
UStroke stroke = linkType.getStroke3(skinParam.getThickness(LineParam.arrow, null));
if (link.getColors() != null && link.getColors().getSpecificLineStroke() != null)
stroke = link.getColors().getSpecificLineStroke();
}
ug = ug.apply(stroke).apply(color);
final List<ElkEdgeSection> sections = edge.getSections();
@ -195,15 +208,15 @@ public class ElkPath implements UDrawable {
final TextBlock labelLink;
// Nasty trick: we store the type of label (center/head/tail) in the text
final String type = label.getText();
if ("X".equals(type)) {
if ("X".equals(type))
labelLink = centerLabel;
} else if ("1".equals(type)) {
else if ("1".equals(type))
labelLink = tailLabel;
} else if ("2".equals(type)) {
else if ("2".equals(type))
labelLink = headLabel;
} else {
else
continue;
}
labelLink.drawU(ug.apply(new UTranslate(x, y)));
}
}

View File

@ -54,41 +54,39 @@ public class PSystemErrorUtils {
}
public static PSystemError merge(Collection<PSystemError> ps) {
if (ps.size() == 0) {
if (ps.size() == 0)
throw new IllegalStateException();
}
UmlSource source = null;
final List<ErrorUml> errors = new ArrayList<>();
// final List<String> debugs = new ArrayList<>();
final List<PSystemErrorV2> errorsV2 = new ArrayList<>();
for (PSystemError system : ps) {
if (system == null) {
if (system == null)
continue;
}
if (system.getSource() != null && source == null) {
if (system.getSource() != null && source == null)
source = system.getSource();
}
errors.addAll(system.getErrorsUml());
if (system instanceof PSystemErrorV2) {
if (system instanceof PSystemErrorV2)
errorsV2.add((PSystemErrorV2) system);
}
}
if (source == null) {
if (source == null)
throw new IllegalStateException();
}
if (errorsV2.size() > 0) {
if (errorsV2.size() > 0)
return mergeV2(errorsV2);
}
throw new IllegalStateException();
}
private static PSystemErrorV2 mergeV2(List<PSystemErrorV2> errorsV2) {
PSystemErrorV2 result = null;
for (PSystemErrorV2 err : errorsV2) {
if (result == null || result.score() < err.score()) {
for (PSystemErrorV2 err : errorsV2)
if (result == null || result.score() < err.score())
result = err;
}
}
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.EncodeHintType;
import ext.plantuml.com.google.zxing.WriterException;
import ext.plantuml.com.google.zxing.client.j2se.MatrixToImageWriter;
import ext.plantuml.com.google.zxing.common.BitMatrix;
import ext.plantuml.com.google.zxing.qrcode.QRCodeWriter;
@ -64,7 +63,7 @@ public class FlashCodeUtilsZxing implements FlashCodeUtils {
final int multiple = 1;
final BitMatrix bit = writer.encode(s, BarcodeFormat.QR_CODE, multiple, hints);
return MatrixToImageWriter.toBufferedImage(bit, fore.getRGB() | 0xFF000000, back.getRGB() | 0xFF000000);
} catch (WriterException e) {
} catch (Exception e) {
Log.debug("Cannot create qrcode " + e);
} finally {
lock.unlock();

View File

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

View File

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

View File

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

View File

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

View File

@ -39,6 +39,7 @@ import java.util.Iterator;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemAbstractFactory;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType;
@ -51,19 +52,19 @@ public class GitDiagramFactory extends PSystemAbstractFactory {
}
@Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) {
public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
final GitTextArea textArea = new GitTextArea();
final Iterator<StringLocated> it = source.iterator2();
it.next();
while (true) {
final String line = it.next().getString();
if (it.hasNext() == false) {
if (it.hasNext() == false)
break;
}
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.TextBlock;
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.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public class MagicBox {
private final ISkinParam skinParam;
private final GNode node;
private final HColor fontColor;
public MagicBox(ISkinParam skinParam, GNode node) {
this.skinParam = skinParam;
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() {
final FontConfiguration mono = new FontConfiguration(UFont.monospaced(15).bold(), HColorUtils.BLACK,
HColorUtils.BLACK, false);
final TextBlock big = node.getDisplay().create(mono, HorizontalAlignment.CENTER, skinParam);
return big;
final FontConfiguration fc = new FontConfiguration(UFont.monospaced(15).bold(), fontColor, fontColor, false);
return node.getDisplay().create(fc, HorizontalAlignment.CENTER, skinParam);
}
private TextBlock getCommentBlock() {
if (node.getComment() != null && node.isTop()) {
final FontConfiguration tag = new FontConfiguration(UFont.sansSerif(13), HColorUtils.BLACK,
HColorUtils.BLACK, false);
final FontConfiguration tag = new FontConfiguration(UFont.sansSerif(13), fontColor, fontColor, false);
return Display.create(node.getComment()).create(tag, HorizontalAlignment.CENTER, skinParam);
}
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.graphic.StringBounder;
import net.sourceforge.plantuml.jsondiagram.Mirror;
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.UGraphic;
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.Macro;
import smetana.core.Z;
@ -92,6 +93,10 @@ public class SmetanaForGit {
.getMergedStyle(skinParam.getCurrentStyleBuilder());
}
private HColor arrowColor() {
return getStyle().value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
}
public void drawMe(Collection<GNode> gnodes) {
initGraph(gnodes);
@ -101,12 +106,11 @@ public class SmetanaForGit {
final MagicBox magicBox = new MagicBox(skinParam, ent.getKey());
magicBox.drawBorder(ug.apply(pos), getSize(node));
}
for (ST_Agedge_s edge : edges) {
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) {
if (g != null) {
if (g != null)
return;
}
Z.open();
try {
g = agopen(new CString("g"), Z.z().Agdirected, null);
@ -142,9 +146,9 @@ public class SmetanaForGit {
for (GNode gnode : nodes.keySet()) {
for (GNode parent : gnode.getDowns()) {
final ST_Agedge_s edge = createEdge(gnode, parent);
if (edge != null) {
if (edge != null)
edges.add(edge);
}
}
}

View File

@ -35,7 +35,7 @@
*/
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.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;

View File

@ -35,7 +35,7 @@
*/
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.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;

View File

@ -81,7 +81,7 @@ public class FontConfiguration {
}
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) {

View File

@ -37,10 +37,10 @@ package net.sourceforge.plantuml.graphic;
import java.util.EnumSet;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
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.Pattern2;

View File

@ -42,8 +42,8 @@ import java.util.Objects;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;

View File

@ -42,7 +42,7 @@ import java.util.EnumSet;
import java.util.List;
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.MyPattern;
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)));
final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
final double posTitle;
if (labelAlignment == HorizontalAlignment.LEFT) {
if (labelAlignment == HorizontalAlignment.LEFT)
posTitle = 3;
} else if (labelAlignment == HorizontalAlignment.RIGHT) {
else if (labelAlignment == HorizontalAlignment.RIGHT)
posTitle = width - dimTitle.getWidth() - 3;
} else {
else
posTitle = (width - dimTitle.getWidth()) / 2;
}
title.drawU(ug.apply(new UTranslate(posTitle, 2 + dimStereo.getHeight())));
}

View File

@ -35,7 +35,7 @@
*/
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.RegexResult;
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.SkinParamColors;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.cucadiagram.LinkStyle;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
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.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemAbstractFactory;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType;
@ -56,7 +57,7 @@ public class HclDiagramFactory extends PSystemAbstractFactory {
}
@Override
public Diagram createSystem(UmlSource source, ISkinSimple skinParam) {
public Diagram createSystem(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
final List<String> highlighted = new ArrayList<>();
JsonValue data = null;
StyleExtractor styleExtractor = null;
@ -77,7 +78,7 @@ public class HclDiagramFactory extends PSystemAbstractFactory {
} catch (Exception e) {
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) {
// styleExtractor.applyStyles(result.getSkinParam());
// 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.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
@ -65,14 +66,13 @@ public class Help extends UmlDiagram {
return new DiagramDescription("(Help)");
}
public Help(UmlSource source) {
super(source, UmlDiagramType.HELP);
public Help(ThemeStyle style, UmlSource source) {
super(style, source, UmlDiagramType.HELP);
}
@Override
public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException {
return super.createImageBuilder(fileFormatOption)
.annotations(false);
return super.createImageBuilder(fileFormatOption).annotations(false);
}
@Override
@ -84,9 +84,7 @@ public class Help extends UmlDiagram {
final Sheet sheet = Parser.build(fontConfiguration, HorizontalAlignment.LEFT, getSkinParam(), CreoleMode.FULL)
.createSheet(display);
final SheetBlock1 sheetBlock = new SheetBlock1(sheet, LineBreakStrategy.NONE, 0);
return createImageBuilder(fileFormat)
.drawable(sheetBlock)
.write(os);
return createImageBuilder(fileFormat).drawable(sheetBlock).write(os);
}
public void add(CharSequence line) {

View File

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

View File

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

View File

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

View File

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

View File

@ -35,19 +35,19 @@
*/
package net.sourceforge.plantuml.logo;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.PSystemBasicFactory;
import net.sourceforge.plantuml.core.UmlSource;
public class PSystemLogoFactory extends PSystemBasicFactory<PSystemLogo> {
@Override
public PSystemLogo initDiagram(UmlSource source, String startLine) {
public PSystemLogo initDiagram(ThemeStyle style, UmlSource source, String startLine) {
return null;
}
@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")) {
return new PSystemLogo(source);
}

View File

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

View File

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

View File

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

View File

@ -39,6 +39,7 @@ import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.CommonCommands;
@ -67,8 +68,8 @@ public class MindMapDiagramFactory extends PSystemCommandFactory {
}
@Override
public MindMapDiagram createEmptyDiagram(UmlSource source, ISkinSimple skinParam) {
return new MindMapDiagram(source);
public MindMapDiagram createEmptyDiagram(ThemeStyle style, UmlSource source, ISkinSimple skinParam) {
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.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ThemeStyle;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
@ -96,8 +97,8 @@ public class NwDiagram extends UmlDiagram {
return new DiagramDescription("(Nwdiag)");
}
public NwDiagram(UmlSource source) {
super(source, UmlDiagramType.NWDIAG);
public NwDiagram(ThemeStyle style, UmlSource source) {
super(style, source, UmlDiagramType.NWDIAG);
}
public void init() {

View File

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

View File

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

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