1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-23 03:19:06 +00:00

version 8031

This commit is contained in:
Arnaud Roques 2015-09-28 22:42:17 +02:00
parent 9ca0fe659d
commit 902ab3e908
183 changed files with 2292 additions and 1067 deletions

View File

@ -124,4 +124,8 @@ public class BlockUml {
return startLine;
}
public final List<CharSequence2> getData() {
return data;
}
}

View File

@ -44,6 +44,7 @@ import java.util.List;
import java.util.Set;
import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.preproc.FileWithSuffix;
import net.sourceforge.plantuml.preproc.Preprocessor;
import net.sourceforge.plantuml.preproc.ReadLineReader;
import net.sourceforge.plantuml.preproc.UncommentReadLine;
@ -52,7 +53,7 @@ import net.sourceforge.plantuml.utils.StartUtils;
final public class BlockUmlBuilder {
private final List<BlockUml> blocks = new ArrayList<BlockUml>();
private Set<File> usedFiles = new HashSet<File>();
private Set<FileWithSuffix> usedFiles = new HashSet<FileWithSuffix>();
private final UncommentReadLine reader2;
public BlockUmlBuilder(List<String> config, String charset, Defines defines, Reader reader, File newCurrentDir,
@ -70,8 +71,7 @@ final public class BlockUmlBuilder {
}
}
public BlockUmlBuilder(List<String> config, String charset, Defines defines, Reader reader)
throws IOException {
public BlockUmlBuilder(List<String> config, String charset, Defines defines, Reader reader) throws IOException {
this(config, charset, defines, reader, null, null);
}
@ -124,7 +124,7 @@ final public class BlockUmlBuilder {
return Collections.unmodifiableList(blocks);
}
public final Set<File> getIncludedFiles() {
public final Set<FileWithSuffix> getIncludedFiles() {
return Collections.unmodifiableSet(usedFiles);
}

View File

@ -28,110 +28,111 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16778 $
* Revision $Revision: 17054 $
*
*/
package net.sourceforge.plantuml;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.color.ColorType;
public enum ColorParam {
background(HtmlColorUtils.WHITE),
background(HtmlColorUtils.WHITE, ColorType.BACK),
hyperlink(HtmlColorUtils.BLUE),
activityBackground(HtmlColorUtils.MY_YELLOW),
activityBorder(HtmlColorUtils.MY_RED),
activityBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
activityBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
activityStart(HtmlColorUtils.BLACK),
activityEnd(HtmlColorUtils.BLACK),
activityBar(HtmlColorUtils.BLACK),
activityArrow(HtmlColorUtils.MY_RED),
activityArrow(HtmlColorUtils.MY_RED, ColorType.ARROW),
usecaseBorder(HtmlColorUtils.MY_RED),
usecaseBackground(HtmlColorUtils.MY_YELLOW),
usecaseArrow(HtmlColorUtils.MY_RED),
usecaseBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
usecaseBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
usecaseArrow(HtmlColorUtils.MY_RED, ColorType.ARROW),
objectBackground(HtmlColorUtils.MY_YELLOW),
objectBorder(HtmlColorUtils.MY_RED),
objectArrow(HtmlColorUtils.MY_RED),
objectBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
objectBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
objectArrow(HtmlColorUtils.MY_RED, ColorType.ARROW),
classHeaderBackground(null),
classBackground(HtmlColorUtils.MY_YELLOW),
classBorder(HtmlColorUtils.MY_RED),
classHeaderBackground(null, ColorType.BACK),
classBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
classBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
stereotypeCBackground(HtmlColorUtils.COL_ADD1B2),
stereotypeABackground(HtmlColorUtils.COL_A9DCDF),
stereotypeIBackground(HtmlColorUtils.COL_B4A7E5),
stereotypeEBackground(HtmlColorUtils.COL_EB937F),
classArrow(HtmlColorUtils.MY_RED),
classArrow(HtmlColorUtils.MY_RED, ColorType.ARROW),
packageBackground(HtmlColorUtils.MY_YELLOW),
packageBorder(HtmlColorUtils.BLACK),
packageBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
packageBorder(HtmlColorUtils.BLACK, ColorType.LINE),
partitionBackground(HtmlColorUtils.MY_YELLOW),
partitionBorder(HtmlColorUtils.BLACK),
partitionBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
partitionBorder(HtmlColorUtils.BLACK, ColorType.LINE),
componentBackground(HtmlColorUtils.MY_YELLOW),
componentBorder(HtmlColorUtils.MY_RED),
interfaceBackground(HtmlColorUtils.MY_YELLOW),
interfaceBorder(HtmlColorUtils.MY_RED),
// componentArrow,
componentBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
componentBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
interfaceBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
interfaceBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
componentArrow(HtmlColorUtils.MY_RED, ColorType.ARROW),
stateBackground(HtmlColorUtils.MY_YELLOW),
stateBorder(HtmlColorUtils.MY_RED),
stateArrow(HtmlColorUtils.MY_RED),
stateBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
stateBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
stateArrow(HtmlColorUtils.MY_RED, ColorType.ARROW),
stateStart(HtmlColorUtils.BLACK),
stateEnd(HtmlColorUtils.BLACK),
noteBackground(HtmlColorUtils.COL_FBFB77, true),
noteBorder(HtmlColorUtils.MY_RED),
noteBackground(HtmlColorUtils.COL_FBFB77, true, ColorType.BACK),
noteBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
legendBackground(HtmlColorUtils.COL_DDDDDD, true),
legendBorder(HtmlColorUtils.BLACK),
legendBackground(HtmlColorUtils.COL_DDDDDD, true, ColorType.BACK),
legendBorder(HtmlColorUtils.BLACK, ColorType.LINE),
actorBackground(HtmlColorUtils.MY_YELLOW, true),
actorBorder(HtmlColorUtils.MY_RED),
participantBackground(HtmlColorUtils.MY_YELLOW, true),
participantBorder(HtmlColorUtils.MY_RED),
sequenceGroupBorder(HtmlColorUtils.BLACK),
sequenceGroupBackground(HtmlColorUtils.COL_EEEEEE, true),
sequenceReferenceBorder(HtmlColorUtils.BLACK),
sequenceReferenceHeaderBackground(HtmlColorUtils.COL_EEEEEE, true),
sequenceReferenceBackground(HtmlColorUtils.WHITE, true),
sequenceDividerBackground(HtmlColorUtils.COL_EEEEEE, true),
sequenceDividerBorder(HtmlColorUtils.BLACK),
sequenceLifeLineBackground(HtmlColorUtils.WHITE, true),
sequenceLifeLineBorder(HtmlColorUtils.MY_RED),
actorBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
actorBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
participantBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK),
participantBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
sequenceGroupBorder(HtmlColorUtils.BLACK, ColorType.LINE),
sequenceGroupBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK),
sequenceReferenceBorder(HtmlColorUtils.BLACK, ColorType.LINE),
sequenceReferenceHeaderBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK),
sequenceReferenceBackground(HtmlColorUtils.WHITE, true, ColorType.BACK),
sequenceDividerBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK),
sequenceDividerBorder(HtmlColorUtils.BLACK, ColorType.LINE),
sequenceLifeLineBackground(HtmlColorUtils.WHITE, true, ColorType.BACK),
sequenceLifeLineBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
sequenceArrow(HtmlColorUtils.MY_RED),
sequenceBoxBorder(HtmlColorUtils.MY_RED),
sequenceBoxBackground(HtmlColorUtils.COL_DDDDDD, true),
sequenceBoxBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
sequenceBoxBackground(HtmlColorUtils.COL_DDDDDD, true, ColorType.BACK),
artifactBackground(HtmlColorUtils.MY_YELLOW),
artifactBorder(HtmlColorUtils.BLACK),
cloudBackground(HtmlColorUtils.MY_YELLOW),
cloudBorder(HtmlColorUtils.BLACK),
queueBackground(HtmlColorUtils.MY_YELLOW),
queueBorder(HtmlColorUtils.MY_RED),
databaseBackground(HtmlColorUtils.MY_YELLOW),
databaseBorder(HtmlColorUtils.BLACK),
folderBackground(HtmlColorUtils.MY_YELLOW),
folderBorder(HtmlColorUtils.BLACK),
frameBackground(HtmlColorUtils.MY_YELLOW),
frameBorder(HtmlColorUtils.BLACK),
nodeBackground(HtmlColorUtils.MY_YELLOW),
nodeBorder(HtmlColorUtils.BLACK),
rectangleBackground(HtmlColorUtils.MY_YELLOW),
rectangleBorder(HtmlColorUtils.BLACK),
agentBackground(HtmlColorUtils.MY_YELLOW),
agentBorder(HtmlColorUtils.MY_RED),
storageBackground(HtmlColorUtils.MY_YELLOW),
storageBorder(HtmlColorUtils.BLACK),
boundaryBackground(HtmlColorUtils.MY_YELLOW),
boundaryBorder(HtmlColorUtils.MY_RED),
controlBackground(HtmlColorUtils.MY_YELLOW),
controlBorder(HtmlColorUtils.MY_RED),
entityBackground(HtmlColorUtils.MY_YELLOW),
entityBorder(HtmlColorUtils.MY_RED),
artifactBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
artifactBorder(HtmlColorUtils.BLACK, ColorType.LINE),
cloudBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
cloudBorder(HtmlColorUtils.BLACK, ColorType.LINE),
queueBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
queueBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
databaseBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
databaseBorder(HtmlColorUtils.BLACK, ColorType.LINE),
folderBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
folderBorder(HtmlColorUtils.BLACK, ColorType.LINE),
frameBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
frameBorder(HtmlColorUtils.BLACK, ColorType.LINE),
nodeBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
nodeBorder(HtmlColorUtils.BLACK, ColorType.LINE),
rectangleBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
rectangleBorder(HtmlColorUtils.BLACK, ColorType.LINE),
agentBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
agentBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
storageBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
storageBorder(HtmlColorUtils.BLACK, ColorType.LINE),
boundaryBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
boundaryBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
controlBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
controlBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
entityBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK),
entityBorder(HtmlColorUtils.MY_RED, ColorType.LINE),
iconPrivate(HtmlColorUtils.COL_C82930),
@ -145,22 +146,28 @@ public enum ColorParam {
private final boolean isBackground;
private final HtmlColor defaultValue;
private final ColorType colorType;
private ColorParam(HtmlColor defaultValue, ColorType colorType) {
this(defaultValue, false, colorType);
}
private ColorParam(HtmlColor defaultValue) {
this(defaultValue, false);
this(defaultValue, false, null);
}
private ColorParam() {
this(null, false);
this(null, false, null);
}
private ColorParam(boolean isBackground) {
this(null, isBackground);
this(null, isBackground, null);
}
private ColorParam(HtmlColor defaultValue, boolean isBackground) {
private ColorParam(HtmlColor defaultValue, boolean isBackground, ColorType colorType) {
this.isBackground = isBackground;
this.defaultValue = defaultValue;
this.colorType = colorType;
}
protected boolean isBackground() {
@ -170,4 +177,8 @@ public enum ColorParam {
public final HtmlColor getDefaultValue() {
return defaultValue;
}
public ColorType getColorType() {
return colorType;
}
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 12866 $
* Revision $Revision: 17341 $
*
*/
package net.sourceforge.plantuml;
@ -38,12 +38,12 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.preproc.FileWithSuffix;
@Deprecated
public class DirWatcher {
@ -78,7 +78,7 @@ public class DirWatcher {
if (watcher == null || watcher.hasChanged()) {
final SourceFileReader sourceFileReader = new SourceFileReader(new Defines(), f, option.getOutputDir(),
option.getConfig(), option.getCharset(), option.getFileFormatOption());
final Set<File> files = new HashSet<File>(sourceFileReader.getIncludedFiles());
final Set<File> files = FileWithSuffix.convert(sourceFileReader.getIncludedFiles());
files.add(f);
for (GeneratedImage g : sourceFileReader.getGeneratedImages()) {
result.add(g);

View File

@ -36,7 +36,6 @@ package net.sourceforge.plantuml;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -49,6 +48,7 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.preproc.FileWithSuffix;
public class DirWatcher2 {
@ -90,7 +90,7 @@ public class DirWatcher2 {
try {
final List<GeneratedImage> generatedImages = sourceFileReader
.getGeneratedImages();
final Set<File> files = new HashSet<File>(sourceFileReader.getIncludedFiles());
final Set<File> files = FileWithSuffix.convert(sourceFileReader.getIncludedFiles());
files.add(f);
modifieds.put(f, new FileWatcher(files));
return Collections.unmodifiableList(generatedImages);

View File

@ -38,6 +38,7 @@ import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D;
import java.awt.image.BufferedImage;
import java.io.Serializable;
import net.sourceforge.plantuml.eps.EpsStrategy;
import net.sourceforge.plantuml.graphic.HtmlColor;
@ -64,7 +65,7 @@ import net.sourceforge.plantuml.StringUtils;
* @author Arnaud Roques
*
*/
public class FileFormatOption {
public class FileFormatOption implements Serializable {
private final FileFormat fileFormat;
private final AffineTransform affineTransform;
@ -75,7 +76,7 @@ public class FileFormatOption {
public FileFormatOption(FileFormat fileFormat) {
this(fileFormat, null, true, false, "_top");
}
public String getSvgLinkTarget() {
return svgLinkTarget;
}
@ -88,7 +89,8 @@ public class FileFormatOption {
this(fileFormat, null, false, false, "_top");
}
private FileFormatOption(FileFormat fileFormat, AffineTransform at, boolean withMetadata, boolean useRedForError, String svgLinkTarget) {
private FileFormatOption(FileFormat fileFormat, AffineTransform at, boolean withMetadata, boolean useRedForError,
String svgLinkTarget) {
this.fileFormat = fileFormat;
this.affineTransform = at;
this.withMetadata = withMetadata;

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16629 $
* Revision $Revision: 17071 $
*
*/
package net.sourceforge.plantuml;
@ -36,9 +36,6 @@ package net.sourceforge.plantuml;
import java.awt.Font;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UFont;
interface FontParamConstant {
String FAMILY = "SansSerif";
@ -153,11 +150,7 @@ public enum FontParam {
}
public FontConfiguration getFontConfiguration(ISkinParam skinParam) {
final UFont font = skinParam.getFont(this, null, false);
final HtmlColor color = new Rose().getFontColor(skinParam, this);
final HtmlColor hyperlinkColor = skinParam.getHyperlinkColor();
final boolean useUnderlineForHyperlink = skinParam.useUnderlineForHyperlink();
return new FontConfiguration(font, color, hyperlinkColor, useUnderlineForHyperlink);
return new FontConfiguration(skinParam, this, null);
}
}

View File

@ -28,65 +28,19 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 12869 $
* Revision $Revision: 17137 $
*
*/
package net.sourceforge.plantuml;
import java.io.File;
import net.sourceforge.plantuml.core.Diagram;
public interface GeneratedImage extends Comparable<GeneratedImage> {
public class GeneratedImage implements Comparable<GeneratedImage> {
public File getPngFile();
private final File pngFile;
private final String description;
private final BlockUml blockUml;
public String getDescription();
public GeneratedImage(File pngFile, String description, BlockUml blockUml) {
this.blockUml = blockUml;
this.pngFile = pngFile;
this.description = description;
}
public File getPngFile() {
return pngFile;
}
public String getDescription() {
return description;
}
public int lineErrorRaw() {
final Diagram system = blockUml.getDiagram();
if (system instanceof PSystemError) {
return ((PSystemError) system).getHigherErrorPosition() + blockUml.getStartLine();
}
return -1;
}
@Override
public String toString() {
return pngFile.getAbsolutePath() + " " + description;
}
public int compareTo(GeneratedImage this2) {
final int cmp = this.pngFile.compareTo(this2.pngFile);
if (cmp != 0) {
return cmp;
}
return this.description.compareTo(this2.description);
}
@Override
public int hashCode() {
return pngFile.hashCode() + description.hashCode();
}
@Override
public boolean equals(Object obj) {
final GeneratedImage this2 = (GeneratedImage) obj;
return this2.pngFile.equals(this.pngFile) && this2.description.equals(this.description);
}
public int lineErrorRaw();
}

View File

@ -0,0 +1,92 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2014, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 12869 $
*
*/
package net.sourceforge.plantuml;
import java.io.File;
import net.sourceforge.plantuml.core.Diagram;
public class GeneratedImageImpl implements GeneratedImage {
private final File pngFile;
private final String description;
private final BlockUml blockUml;
public GeneratedImageImpl(File pngFile, String description, BlockUml blockUml) {
this.blockUml = blockUml;
this.pngFile = pngFile;
this.description = description;
}
public File getPngFile() {
return pngFile;
}
public String getDescription() {
return description;
}
public int lineErrorRaw() {
final Diagram system = blockUml.getDiagram();
if (system instanceof PSystemError) {
return ((PSystemError) system).getHigherErrorPosition() + blockUml.getStartLine();
}
return -1;
}
@Override
public String toString() {
return pngFile.getAbsolutePath() + " " + description;
}
public int compareTo(GeneratedImage this2) {
final int cmp = this.pngFile.compareTo(this2.getPngFile());
if (cmp != 0) {
return cmp;
}
return this.description.compareTo(this2.getDescription());
}
@Override
public int hashCode() {
return pngFile.hashCode() + description.hashCode();
}
@Override
public boolean equals(Object obj) {
final GeneratedImageImpl this2 = (GeneratedImageImpl) obj;
return this2.pngFile.equals(this.pngFile) && this2.description.equals(this.description);
}
}

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.ColorMapper;
@ -57,6 +58,8 @@ public interface ISkinParam extends ISkinSimple {
public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable);
public Colors getColors(ColorParam param, Stereotype stereotype);
public HtmlColor getFontHtmlColor(FontParam param, Stereotype stereotype);
public UStroke getThickness(LineParam param, Stereotype stereotype);
@ -116,11 +119,13 @@ public interface ISkinParam extends ISkinSimple {
public IHtmlColorSet getIHtmlColorSet();
public int groupInheritance();
public boolean useGuillemet();
public boolean handwritten();
public String getSvgLinkTarget();
public int getTabSize();
}

View File

@ -41,5 +41,6 @@ public interface ISkinSimple extends SpriteContainer {
public String getMonospacedFamily();
public int getTabSize();
}

View File

@ -43,5 +43,8 @@ public interface ISourceFileReader {
public List<String> getEncodedUrl() throws IOException;
public boolean hasError();
public void setFileFormatOption(FileFormatOption fileFormatOption);
}

View File

@ -34,16 +34,18 @@
package net.sourceforge.plantuml;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.UStroke;
public interface LineConfigurable {
public HtmlColor getSpecificLineColor();
public Colors getColors(ISkinParam skinParam);
public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color);
public void setSpecificLineColor(HtmlColor specificLinecolor);
// public void setSpecificLineStroke(UStroke specificLineStroke);
public UStroke getSpecificLineStroke();
public void setSpecificLineStroke(UStroke specificLineStoke);
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16732 $
* Revision $Revision: 17125 $
*
*/
package net.sourceforge.plantuml;
@ -56,6 +56,7 @@ import net.sourceforge.plantuml.graphic.HtmlColorSetSimple;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.ColorMapper;
@ -169,13 +170,28 @@ public class SkinParam implements ISkinParam {
}
}
final String value = getValue(getParamName(param, clickable));
final boolean acceptTransparent = param == ColorParam.background;
if (value == null) {
return null;
}
final boolean acceptTransparent = param == ColorParam.background;
return getIHtmlColorSet().getColorIfValid(value, acceptTransparent);
}
public Colors getColors(ColorParam param, Stereotype stereotype) {
if (stereotype != null) {
checkStereotype(stereotype);
final String value2 = getValue(param.name() + "color" + stereotype.getLabel(false));
if (value2 != null && getIHtmlColorSet().getColorIfValid(value2) != null) {
return new Colors(value2, getIHtmlColorSet(), param.getColorType());
}
}
final String value = getValue(getParamName(param, false));
if (value == null) {
return Colors.empty();
}
return new Colors(value, getIHtmlColorSet(), param.getColorType());
}
private String getParamName(ColorParam param, boolean clickable) {
String n = param.name();
if (clickable && n.endsWith("Background")) {
@ -681,4 +697,12 @@ public class SkinParam implements ISkinParam {
return value;
}
public int getTabSize() {
final String value = getValue("tabsize");
if (value != null && value.matches("\\d+")) {
return Integer.parseInt(value);
}
return 8;
}
}

View File

@ -0,0 +1,76 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2014, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 4246 $
*
*/
package net.sourceforge.plantuml;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
public class SkinParamColors extends SkinParamDelegator {
final private Colors colors;
public SkinParamColors(ISkinParam skinParam, Colors colors) {
super(skinParam);
this.colors = colors;
}
@Override
public String toString() {
return super.toString() + colors;
}
public HtmlColor getFontHtmlColor(FontParam param, Stereotype stereotype) {
final HtmlColor value = colors.getColor(ColorType.TEXT);
if (value == null) {
return super.getFontHtmlColor(param, stereotype);
}
return value;
}
public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) {
final ColorType type = param.getColorType();
if (type == null) {
return super.getHtmlColor(param, stereotype, clickable);
}
final HtmlColor value = colors.getColor(type);
if (value != null) {
return value;
}
assert value == null;
return super.getHtmlColor(param, stereotype, clickable);
}
}

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.ColorMapper;
@ -179,7 +180,7 @@ public class SkinParamDelegator implements ISkinParam {
public Rankdir getRankdir() {
return skinParam.getRankdir();
}
public boolean useOctagonForActivity(Stereotype stereotype) {
return skinParam.useOctagonForActivity(stereotype);
}
@ -220,5 +221,12 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getMonospacedFamily();
}
public Colors getColors(ColorParam param, Stereotype stereotype) {
return skinParam.getColors(param, stereotype);
}
public int getTabSize() {
return skinParam.getTabSize();
}
}

View File

@ -48,7 +48,6 @@ public class SkinParamForceColor extends SkinParamDelegator {
}
public HtmlColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable) {
System.err.println("param=" + param);
if (colorParam == param) {
return color;
}

View File

@ -53,5 +53,5 @@ public class SkinParamUtils {
public static HtmlColor getColor(ISkinParam skinParam, ColorParam colorParam, Stereotype stereo) {
return rose.getHtmlColor(skinParam, colorParam, stereo);
}
}

View File

@ -53,6 +53,7 @@ import net.sourceforge.plantuml.code.Transcoder;
import net.sourceforge.plantuml.code.TranscoderUtil;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.preproc.FileWithSuffix;
public class SourceFileReader implements ISourceFileReader {
@ -191,7 +192,7 @@ public class SourceFileReader implements ISourceFileReader {
try {
system = blockUml.getDiagram();
} catch (Throwable t) {
final GeneratedImage image = new GeneratedImage(suggested, "Crash Error", blockUml);
final GeneratedImage image = new GeneratedImageImpl(suggested, "Crash Error", blockUml);
OutputStream os = null;
try {
os = new BufferedOutputStream(new FileOutputStream(suggested));
@ -221,7 +222,7 @@ public class SourceFileReader implements ISourceFileReader {
ps.close();
}
}
final GeneratedImage generatedImage = new GeneratedImage(f, desc, blockUml);
final GeneratedImage generatedImage = new GeneratedImageImpl(f, desc, blockUml);
result.add(generatedImage);
}
@ -260,7 +261,7 @@ public class SourceFileReader implements ISourceFileReader {
this.fileFormatOption = fileFormatOption;
}
public final Set<File> getIncludedFiles() {
public final Set<FileWithSuffix> getIncludedFiles() {
return builder.getIncludedFiles();
}

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.code.Transcoder;
import net.sourceforge.plantuml.code.TranscoderUtil;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.preproc.FileWithSuffix;
public class SourceFileReader2 implements ISourceFileReader {
@ -94,7 +95,7 @@ public class SourceFileReader2 implements ISourceFileReader {
for (File f : PSystemUtils.exportDiagrams(system, suggested, fileFormatOption)) {
final String desc = "[" + file.getName() + "] " + system.getDescription();
final GeneratedImage generatedImage = new GeneratedImage(f, desc, blockUml);
final GeneratedImage generatedImage = new GeneratedImageImpl(f, desc, blockUml);
result.add(generatedImage);
}
@ -129,7 +130,7 @@ public class SourceFileReader2 implements ISourceFileReader {
this.fileFormatOption = fileFormatOption;
}
public final Set<File> getIncludedFiles() {
public final Set<FileWithSuffix> getIncludedFiles2() {
return builder.getIncludedFiles();
}

View File

@ -34,11 +34,15 @@
package net.sourceforge.plantuml;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
public interface SpecificBackcolorable {
public HtmlColor getSpecificBackColor();
public Colors getColors(ISkinParam skinParam);
public void setSpecificBackcolor(HtmlColor specificBackcolor);
public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color);
public void setColors(Colors colors);
}

View File

@ -58,4 +58,8 @@ public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
return CommandCreoleMonospaced.MONOSPACED;
}
public int getTabSize() {
return 8;
}
}

View File

@ -57,8 +57,8 @@ import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
@ -118,7 +118,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
entity1.setStereotype(new Stereotype(arg.get("STEREOTYPE", 0)));
}
if (arg.get("BACKCOLOR", 0) != null) {
entity1.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet()
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet()
.getColorIfValid(arg.get("BACKCOLOR", 0)));
}
@ -127,7 +127,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
return CommandExecutionResult.error("No such activity");
}
if (arg.get("BACKCOLOR2", 0) != null) {
entity2.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet()
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet()
.getColorIfValid(arg.get("BACKCOLOR2", 0)));
}
if (arg.get("STEREOTYPE2", 0) != null) {

View File

@ -61,6 +61,7 @@ import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorType;
public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram> {
@ -114,7 +115,7 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
entity1.setStereotype(new Stereotype(line0.get("STEREOTYPE", 0)));
}
if (line0.get("BACKCOLOR", 0) != null) {
entity1.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet()
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet()
.getColorIfValid(line0.get("BACKCOLOR", 0)));
}
final StringBuilder sb = new StringBuilder();
@ -175,7 +176,7 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
entity2.setStereotype(new Stereotype(lineLast.get(2)));
}
if (lineLast.get(4) != null) {
entity2.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(lineLast.get(4)));
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(lineLast.get(4)));
}
if (entity1 == null || entity2 == null) {

View File

@ -28,13 +28,14 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 14661 $
* Revision $Revision: 17003 $
*
*/
package net.sourceforge.plantuml.activitydiagram.command;
import java.util.List;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand;
@ -43,8 +44,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.graphic.HtmlColorSet;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.graphic.color.ColorType;
public class CommandPartition extends SingleLineCommand<ActivityDiagram> {
@ -60,7 +60,7 @@ public class CommandPartition extends SingleLineCommand<ActivityDiagram> {
currentPackage);
final String color = arg.get(1);
if (color != null) {
p.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
p.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
}
return CommandExecutionResult.ok();
}

View File

@ -62,6 +62,7 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockCompressed;
import net.sourceforge.plantuml.graphic.TextBlockRecentred;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.svek.DecorateEntityImage;
@ -109,10 +110,10 @@ public class ActivityDiagram3 extends UmlDiagram {
return swinlanes.nextLinkRenderer();
}
public void addActivity(Display activity, HtmlColor color, BoxStyle style, Url url) {
public void addActivity(Display activity, BoxStyle style, Url url, Colors colors) {
manageSwimlaneStrategy();
final InstructionSimple ins = new InstructionSimple(activity, color, nextLinkRenderer(),
swinlanes.getCurrentSwimlane(), style, url);
final InstructionSimple ins = new InstructionSimple(activity, nextLinkRenderer(),
swinlanes.getCurrentSwimlane(), style, url, colors);
current().add(ins);
setNextLinkRendererInternal(null);
manageHasUrl(activity);
@ -210,10 +211,8 @@ public class ActivityDiagram3 extends UmlDiagram {
if (Display.isNull(title)) {
return original;
}
final TextBlock text = title.create(
new FontConfiguration(getFont(FontParam.TITLE), getFontColor(FontParam.TITLE, null), getSkinParam()
.getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink()), HorizontalAlignment.CENTER,
getSkinParam());
final TextBlock text = title.create(new FontConfiguration(getSkinParam(), FontParam.TITLE, null),
HorizontalAlignment.CENTER, getSkinParam());
return new DecorateTextBlock(original, text, HorizontalAlignment.CENTER);
}
@ -225,11 +224,9 @@ public class ActivityDiagram3 extends UmlDiagram {
return original;
}
final TextBlock textFooter = Display.isNull(footer) ? null : footer.create(new FontConfiguration(
getFont(FontParam.FOOTER), getFontColor(FontParam.FOOTER, null), getSkinParam().getHyperlinkColor(),
getSkinParam().useUnderlineForHyperlink()), getFooterAlignment(), getSkinParam());
getSkinParam(), FontParam.FOOTER, null), getFooterAlignment(), getSkinParam());
final TextBlock textHeader = Display.isNull(header) ? null : header.create(new FontConfiguration(
getFont(FontParam.HEADER), getFontColor(FontParam.HEADER, null), getSkinParam().getHyperlinkColor(),
getSkinParam().useUnderlineForHyperlink()), getHeaderAlignment(), getSkinParam());
getSkinParam(), FontParam.HEADER, null), getHeaderAlignment(), getSkinParam());
return new DecorateTextBlock(original, textHeader, getHeaderAlignment(), textFooter, getFooterAlignment());
}
@ -330,6 +327,7 @@ public class ActivityDiagram3 extends UmlDiagram {
}
public CommandExecutionResult endif() {
// System.err.println("Activity3::endif");
if (current() instanceof InstructionIf) {
((InstructionIf) current()).endif(nextLinkRenderer());
setNextLinkRendererInternal(null);
@ -407,14 +405,18 @@ public class ActivityDiagram3 extends UmlDiagram {
}
private void setNextLinkRendererInternal(LinkRendering link) {
// System.err.println("setNextLinkRendererInternal=" + link);
swinlanes.setNextLinkRenderer(link);
}
private void setNextLink(LinkRendering linkRenderer) {
// System.err.println("setNextLink=" + linkRenderer);
if (current() instanceof InstructionCollection) {
final Instruction last = ((InstructionCollection) current()).getLast();
if (last instanceof InstructionWhile) {
((InstructionWhile) last).afterEndwhile(linkRenderer);
} else if (last instanceof InstructionIf) {
((InstructionIf) last).afterEndwhile(linkRenderer);
}
}
this.setNextLinkRendererInternal(linkRenderer);

View File

@ -48,7 +48,6 @@ public class Branch {
private final Display labelTest;
private final Display labelPositive;
private final HtmlColor color;
private LinkRendering inlinkRendering;
private Ftile ftile;

View File

@ -57,7 +57,8 @@ public class InstructionIf implements Instruction, InstructionCollection {
private final Instruction parent;
private Branch current;
private final LinkRendering inlinkRendering;
private final LinkRendering topInlinkRendering;
private LinkRendering afterEndwhile;
private final Swimlane swimlane;
@ -65,8 +66,7 @@ public class InstructionIf implements Instruction, InstructionCollection {
LinkRendering inlinkRendering, HtmlColor color, ISkinParam skinParam) {
this.parent = parent;
this.skinParam = skinParam;
this.inlinkRendering = inlinkRendering;
this.topInlinkRendering = inlinkRendering;
this.swimlane = swimlane;
this.thens.add(new Branch(swimlane, whenThen, labelTest, color));
this.current = this.thens.get(0);
@ -87,7 +87,7 @@ public class InstructionIf implements Instruction, InstructionCollection {
this.elseBranch = new Branch(swimlane, Display.NULL, Display.NULL, null);
}
elseBranch.updateFtile(factory);
Ftile result = factory.createIf(swimlane, thens, elseBranch);
Ftile result = factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering);
if (note != null) {
result = new FtileWithNoteOpale(result, note, position, skinParam, false);
}
@ -130,7 +130,7 @@ public class InstructionIf implements Instruction, InstructionCollection {
}
public LinkRendering getInLinkRendering() {
return inlinkRendering;
return topInlinkRendering;
}
public boolean addNote(Display note, NotePosition position) {
@ -165,9 +165,13 @@ public class InstructionIf implements Instruction, InstructionCollection {
public Instruction getLast() {
if (elseBranch == null) {
return thens.get(thens.size()-1).getLast();
return thens.get(thens.size() - 1).getLast();
}
return elseBranch.getLast();
}
public void afterEndwhile(LinkRendering linkRenderer) {
this.afterEndwhile = linkRenderer;
}
}

View File

@ -41,31 +41,35 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileKilled;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
public class InstructionSimple extends MonoSwimable implements Instruction {
private boolean killed = false;
private final Display label;
private final HtmlColor color;
private final Colors colors;
private final LinkRendering inlinkRendering;
private Display note;
private NotePosition notePosition;
private final BoxStyle style;
private final Url url;
public InstructionSimple(Display label, HtmlColor color, LinkRendering inlinkRendering, Swimlane swimlane,
BoxStyle style, Url url) {
public InstructionSimple(Display label, LinkRendering inlinkRendering, Swimlane swimlane,
BoxStyle style, Url url, Colors colors) {
super(swimlane);
if (colors == null) {
throw new IllegalArgumentException();
}
this.url = url;
this.style = style;
this.label = label;
this.color = color;
this.inlinkRendering = inlinkRendering;
this.colors = colors;
}
public Ftile createFtile(FtileFactory factory) {
Ftile result = factory.activity(label, color, getSwimlaneIn(), style);
Ftile result = factory.activity(label, getSwimlaneIn(), style, colors);
if (url != null) {
result = factory.addUrl(result, url);
}

View File

@ -93,7 +93,6 @@ public class InstructionWhile implements Instruction, InstructionCollection {
if (note != null) {
tmp = new FtileWithNoteOpale(tmp, note, position, skinParam, false);
}
// tmp = factory.decorateOut(tmp, afterEndwhile);
return tmp;
}

View File

@ -46,6 +46,8 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
@ -58,13 +60,18 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
ColorParser.exp5(), //
color().getRegex(), //
new RegexLeaf("[%s]*"), //
new RegexLeaf(":"), //
new RegexLeaf("LABEL", "(.*)"), //
new RegexLeaf("STYLE", ENDING_GROUP), //
new RegexLeaf("$"));
}
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
@ -76,9 +83,9 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
url = urlBuilder.getUrl(arg.get("URL", 0));
}
final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final BoxStyle style = BoxStyle.fromChar(arg.get("STYLE", 0).charAt(0));
diagram.addActivity(Display.getWithNewlines(arg.get("LABEL", 0)), color, style, url);
diagram.addActivity(Display.getWithNewlines(arg.get("LABEL", 0)), style, url, colors);
return CommandExecutionResult.ok();
}

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.color.Colors;
public class CommandActivityLegacy1 extends SingleLineCommand2<ActivityDiagram3> {
@ -57,7 +58,7 @@ public class CommandActivityLegacy1 extends SingleLineCommand2<ActivityDiagram3>
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
diagram.addActivity(Display.getWithNewlines(arg.get("LABEL", 0)), null, BoxStyle.PLAIN, null);
diagram.addActivity(Display.getWithNewlines(arg.get("LABEL", 0)), BoxStyle.PLAIN, null, Colors.empty());
return CommandExecutionResult.ok();
}

View File

@ -43,8 +43,9 @@ import net.sourceforge.plantuml.command.MultilinesStrategy;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
public class CommandActivityLong3 extends CommandMultilines2<ActivityDiagram3> {
@ -57,9 +58,13 @@ public class CommandActivityLong3 extends CommandMultilines2<ActivityDiagram3> {
return "^(.*)" + CommandActivity3.ENDING_GROUP + "$";
}
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
ColorParser.exp5(), //
color().getRegex(), //
new RegexLeaf(":"), //
new RegexLeaf("DATA", "(.*)"), //
new RegexLeaf("$"));
@ -68,10 +73,11 @@ public class CommandActivityLong3 extends CommandMultilines2<ActivityDiagram3> {
public CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) {
lines = lines.removeEmptyColumns();
final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
// final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
final BoxStyle style = BoxStyle.fromChar(lines.getLastChar());
lines = lines.removeStartingAndEnding2(line0.get("DATA", 0));
diagram.addActivity(lines.toDisplay(), color, style, null);
diagram.addActivity(lines.toDisplay(), style, null, colors);
return CommandExecutionResult.ok();
}
}

View File

@ -50,7 +50,6 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -71,13 +70,10 @@ public class EntityImageLegend extends AbstractTextBlock implements TextBlock {
final Rose rose = new Rose();
noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.legendBackground);
borderColor = rose.getHtmlColor(skinParam, ColorParam.legendBorder);
final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.LEGEND);
final UFont fontNote = skinParam.getFont(FontParam.LEGEND, null, false);
this.textBlock = note.create(new FontConfiguration(fontNote, fontColor,
skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink()), HorizontalAlignment.LEFT, skinParam);
this.textBlock = note.create(new FontConfiguration(skinParam, FontParam.LEGEND, null),
HorizontalAlignment.LEFT, skinParam);
}
public static TextBlock create(Display legend, ISkinParam skinParam) {

View File

@ -42,6 +42,7 @@ import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
public interface FtileFactory extends ISkinSimple {
@ -56,7 +57,7 @@ public interface FtileFactory extends ISkinSimple {
public Ftile end(Swimlane swimlane);
public Ftile activity(Display label, HtmlColor color, Swimlane swimlane, BoxStyle style);
public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors);
public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition);
@ -68,12 +69,14 @@ public interface FtileFactory extends ISkinSimple {
public Ftile assembly(Ftile tile1, Ftile tile2);
public Ftile repeat(Swimlane swimlane, Ftile repeat, Display test, Display yes, Display out, HtmlColor color, LinkRendering backRepeatLinkRendering);
public Ftile repeat(Swimlane swimlane, Ftile repeat, Display test, Display yes, Display out, HtmlColor color,
LinkRendering backRepeatLinkRendering);
public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out,
LinkRendering afterEndwhile, HtmlColor color);
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch);
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering);
public Ftile createFork(Swimlane swimlane, List<Ftile> all);

View File

@ -48,10 +48,10 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.Sprite;
import net.sourceforge.plantuml.ugraphic.UFont;
public class FtileFactoryDelegator implements FtileFactory {
@ -69,20 +69,16 @@ public class FtileFactoryDelegator implements FtileFactory {
}
return color;
}
protected final TextBlock getTextBlock(Display display) {
if (Display.isNull(display)) {
return null;
}
final ISkinParam skinParam = getSkinParam();
final UFont font = skinParam.getFont(FontParam.ACTIVITY_ARROW, null, false);
final HtmlColor color = rose.getFontColor(skinParam, FontParam.ACTIVITY_ARROW);
final FontConfiguration fontConfiguration = new FontConfiguration(font, color, skinParam.getHyperlinkColor(),
skinParam.useUnderlineForHyperlink());
final FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.ACTIVITY_ARROW, null);
return display.create(fontConfiguration, HorizontalAlignment.LEFT, this, CreoleMode.SIMPLE_LINE);
}
protected Display getInLinkRenderingDisplay(Ftile tile) {
final LinkRendering linkRendering = tile.getInLinkRendering();
if (linkRendering == null) {
@ -108,8 +104,8 @@ public class FtileFactoryDelegator implements FtileFactory {
return factory.stop(swimlane);
}
public Ftile activity(Display label, HtmlColor color, Swimlane swimlane, BoxStyle style) {
return factory.activity(label, color, swimlane, style);
public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors) {
return factory.activity(label, swimlane, style, colors);
}
public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition) {
@ -132,7 +128,8 @@ public class FtileFactoryDelegator implements FtileFactory {
return factory.assembly(tile1, tile2);
}
public Ftile repeat(Swimlane swimlane, Ftile repeat, Display test, Display yes, Display out, HtmlColor color, LinkRendering backRepeatLinkRendering) {
public Ftile repeat(Swimlane swimlane, Ftile repeat, Display test, Display yes, Display out, HtmlColor color,
LinkRendering backRepeatLinkRendering) {
return factory.repeat(swimlane, repeat, test, yes, out, color, backRepeatLinkRendering);
}
@ -141,8 +138,8 @@ public class FtileFactoryDelegator implements FtileFactory {
return factory.createWhile(swimlane, whileBlock, test, yes, out, afterEndwhile, color);
}
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch) {
return factory.createIf(swimlane, thens, elseBranch);
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile, LinkRendering topInlinkRendering) {
return factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering);
}
public Ftile createFork(Swimlane swimlane, List<Ftile> all) {
@ -197,4 +194,8 @@ public class FtileFactoryDelegator implements FtileFactory {
return skinParam.getMonospacedFamily();
}
public int getTabSize() {
return skinParam.getTabSize();
}
}

View File

@ -33,15 +33,17 @@
*/
package net.sourceforge.plantuml.activitydiagram3.ftile;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SpecificBackcolorable;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.UTranslate;
public class Swimlane implements SpecificBackcolorable {
private final String name;
private HtmlColor color;
private Display display;
private UTranslate translate = new UTranslate();
@ -79,16 +81,24 @@ public class Swimlane implements SpecificBackcolorable {
this.totalWidth = totalWidth;
}
public HtmlColor getSpecificBackColor() {
return color;
public Colors getColors(ISkinParam skinParam) {
return colors;
}
public void setSpecificBackcolor(HtmlColor specificBackcolor) {
this.color = specificBackcolor;
public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) {
if (color != null) {
this.colors = colors.add(type, color);
}
}
private Colors colors = Colors.empty();
public final double getTotalWidth() {
return totalWidth;
}
public void setColors(Colors colors) {
this.colors = colors;
}
}

View File

@ -64,6 +64,7 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.UGraphicDelegator;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.svek.UGraphicForSnake;
import net.sourceforge.plantuml.ugraphic.CompressionTransform;
import net.sourceforge.plantuml.ugraphic.LimitFinder;
@ -73,7 +74,6 @@ import net.sourceforge.plantuml.ugraphic.SlotSet;
import net.sourceforge.plantuml.ugraphic.UChange;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.URectangle;
@ -98,9 +98,7 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock {
}
private FontConfiguration getFontConfiguration() {
final UFont font = skinParam.getFont(FontParam.TITLE, null, false);
return new FontConfiguration(font, HtmlColorUtils.BLACK, skinParam.getHyperlinkColor(),
skinParam.useUnderlineForHyperlink());
return new FontConfiguration(skinParam, FontParam.TITLE, null);
}
private FtileFactory getFtileFactory() {
@ -120,7 +118,7 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock {
public void swimlane(String name, HtmlColor color, Display label) {
currentSwimlane = getOrCreate(name);
if (color != null) {
currentSwimlane.setSpecificBackcolor(color);
currentSwimlane.setSpecificColorTOBEREMOVED(ColorType.BACK, color);
}
if (Display.isNull(label) == false) {
currentSwimlane.setDisplay(label);
@ -242,15 +240,17 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock {
double x2 = 0;
for (Swimlane swimlane : swimlanes) {
if (swimlane.getSpecificBackColor() != null) {
final UGraphic background = ug.apply(new UChangeBackColor(swimlane.getSpecificBackColor()))
.apply(new UChangeColor(swimlane.getSpecificBackColor())).apply(new UTranslate(x2, 0));
final HtmlColor back = swimlane.getColors(skinParam).getColor(ColorType.BACK);
if (back != null) {
final UGraphic background = ug.apply(new UChangeBackColor(back)).apply(new UChangeColor(back))
.apply(new UTranslate(x2, 0));
background.draw(new URectangle(swimlane.getTotalWidth(), dimensionFull.getHeight()
+ titleHeightTranslate.getDy()));
}
if (OptionFlags.SWI2 == false) {
final TextBlock swTitle = swimlane.getDisplay().create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam);
final TextBlock swTitle = swimlane.getDisplay().create(getFontConfiguration(),
HorizontalAlignment.LEFT, skinParam);
final double titleWidth = swTitle.calculateDimension(stringBounder).getWidth();
final double posTitle = x2 + (swimlane.getTotalWidth() - titleWidth) / 2;
swTitle.drawU(ug.apply(new UTranslate(posTitle, 0)));
@ -282,7 +282,8 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock {
final MinMax minMax = limitFinder.getMinMax();
final double drawingWidth = minMax.getWidth() + 2 * separationMargin;
final TextBlock swTitle = swimlane.getDisplay().create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam);
final TextBlock swTitle = swimlane.getDisplay().create(getFontConfiguration(), HorizontalAlignment.LEFT,
skinParam);
final double titleWidth = swTitle.calculateDimension(stringBounder).getWidth();
final double totalWidth = Math.max(drawingWidth, titleWidth + 2 * separationMargin);
@ -297,7 +298,8 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock {
private UTranslate getTitleHeightTranslate(final StringBounder stringBounder) {
double titlesHeight = 0;
for (Swimlane swimlane : swimlanes) {
final TextBlock swTitle = swimlane.getDisplay().create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam);
final TextBlock swTitle = swimlane.getDisplay().create(getFontConfiguration(), HorizontalAlignment.LEFT,
skinParam);
titlesHeight = Math.max(titlesHeight, swTitle.calculateDimension(stringBounder).getHeight());
}

View File

@ -64,17 +64,17 @@ public class FloatingNote extends AbstractTextBlock implements Stencil, TextBloc
public FloatingNote(Display note, ISkinParam skinParam) {
final Rose rose = new Rose();
final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE);
final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false);
final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground);
final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder);
final FontConfiguration fc = new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink());
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(note);
final SheetBlock2 sheetBlock2 = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, new UStroke(1));
this.opale = new Opale(borderColor, noteBackgroundColor, sheetBlock2, skinParam.shadowing(), false);
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
.createSheet(note);
final SheetBlock2 sheetBlock2 = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this,
new UStroke(1));
this.opale = new Opale(borderColor, noteBackgroundColor, sheetBlock2, skinParam.shadowing(), false);
// this.text = sheetBlock2;

View File

@ -40,14 +40,15 @@ import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.OptionFlags;
import net.sourceforge.plantuml.activitydiagram3.Branch;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.ConditionalBuilder;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.ugraphic.UFont;
public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
@ -56,13 +57,10 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
}
@Override
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch) {
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering) {
final ConditionStyle conditionStyle = getSkinParam().getConditionStyle();
final UFont fontArrow = getSkinParam().getFont(FontParam.ACTIVITY_ARROW, null, false);
final UFont fontTest = getSkinParam().getFont(
conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ACTIVITY_ARROW, null,
false);
final Branch branch0 = thens.get(0);
final HtmlColor borderColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityBorder);
@ -70,17 +68,20 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
ColorParam.activityBackground) : branch0.getColor();
final HtmlColor arrowColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityArrow);
final FontConfiguration fcArrow = new FontConfiguration(getSkinParam(), FontParam.ACTIVITY_ARROW, null);
if (thens.size() > 1) {
return FtileIfLong2.create(swimlane, borderColor, backColor, fontArrow, arrowColor, getFactory(),
conditionStyle, thens, elseBranch, getSkinParam().getHyperlinkColor(), getSkinParam()
.useUnderlineForHyperlink());
return FtileIfLong2.create(swimlane, borderColor, backColor, arrowColor, getFactory(), conditionStyle,
thens, elseBranch, fcArrow, topInlinkRendering, afterEndwhile);
}
final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND
: FontParam.ACTIVITY_ARROW;
final FontConfiguration fcTest = new FontConfiguration(getSkinParam(), testParam, null);
if (OptionFlags.USE_NEW_IF) {
return ConditionalBuilder.create(swimlane, borderColor, backColor, fontArrow, fontTest, arrowColor,
getFactory(), conditionStyle, thens.get(0), elseBranch, getSkinParam(), getStringBounder());
return ConditionalBuilder.create(swimlane, borderColor, backColor, arrowColor, getFactory(),
conditionStyle, thens.get(0), elseBranch, getSkinParam(), getStringBounder(), fcArrow, fcTest);
} else {
return FtileIfOrigin.create(swimlane, borderColor, backColor, fontArrow, fontTest, arrowColor,
getFactory(), conditionStyle, thens.get(0), elseBranch, getSkinParam(), getStringBounder());
return FtileIfOrigin.create(swimlane, borderColor, backColor, arrowColor, getFactory(), conditionStyle,
thens.get(0), elseBranch, getSkinParam(), getStringBounder(), fcArrow, fcTest);
}
}

View File

@ -42,9 +42,9 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.ugraphic.UFont;
public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator {
@ -56,9 +56,6 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator {
public Ftile repeat(Swimlane swimlane, Ftile repeat, Display test, Display yes, Display out, HtmlColor color,
LinkRendering backRepeatLinkRendering) {
final ConditionStyle conditionStyle = getSkinParam().getConditionStyle();
final UFont font = getSkinParam().getFont(
conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ACTIVITY_ARROW, null,
false);
final HtmlColor borderColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityBorder);
final HtmlColor backColor = color == null ? getRose().getHtmlColor(getSkinParam(),
@ -68,9 +65,11 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator {
final LinkRendering endRepeatLinkRendering = repeat.getOutLinkRendering();
final HtmlColor endRepeatLinkColor = endRepeatLinkRendering == null ? null : endRepeatLinkRendering.getColor();
return FtileRepeat.create(backRepeatLinkRendering, swimlane, repeat, test, yes, out, borderColor, backColor, font, arrowColor,
endRepeatLinkColor, conditionStyle, this, getSkinParam().getHyperlinkColor(), getSkinParam()
.useUnderlineForHyperlink());
}
final FontParam fontParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND
: FontParam.ACTIVITY_ARROW;
final FontConfiguration fc = new FontConfiguration(getSkinParam(), fontParam, null);
return FtileRepeat.create(backRepeatLinkRendering, swimlane, repeat, test, yes, out, borderColor, backColor,
arrowColor, endRepeatLinkColor, conditionStyle, this, fc);
}
}

View File

@ -42,9 +42,9 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.ugraphic.UFont;
public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
@ -61,14 +61,17 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
final HtmlColor arrowColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityArrow);
final ConditionStyle conditionStyle = getSkinParam().getConditionStyle();
final UFont fontArrow = getSkinParam().getFont(FontParam.ACTIVITY_ARROW, null, false);
final UFont fontTest = getSkinParam().getFont(
conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ACTIVITY_ARROW, null, false);
final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND
: FontParam.ACTIVITY_ARROW;
final FontConfiguration fcTest = new FontConfiguration(getSkinParam(), testParam, null);
final LinkRendering endInlinkRendering = whileBlock.getOutLinkRendering();
final HtmlColor endInlinkColor = endInlinkRendering == null ? arrowColor : endInlinkRendering.getColor();
final FontConfiguration fontArrow = new FontConfiguration(getSkinParam(), FontParam.ACTIVITY_ARROW, null);
return FtileWhile.create(swimlane, whileBlock, test, borderColor, backColor, arrowColor, yes, out,
fontArrow, endInlinkColor, afterEndwhile, getFactory(), conditionStyle, fontTest, getSkinParam().getHyperlinkColor(), getSkinParam().useUnderlineForHyperlink());
endInlinkColor, afterEndwhile, fontArrow, getFactory(), conditionStyle, fcTest);
}
}

View File

@ -84,7 +84,7 @@ public class FtileGroup extends AbstractFtile {
this.titleColor = titleColor;
final UFont font = new UFont("Serif", Font.PLAIN, 14);
final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, skinParam.getHyperlinkColor(),
skinParam.useUnderlineForHyperlink());
skinParam.useUnderlineForHyperlink(), skinParam.getTabSize());
if (title == null) {
this.name = TextBlockUtils.empty(0, 0);
} else {

View File

@ -66,11 +66,9 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -110,21 +108,16 @@ class FtileIfAndStop extends AbstractFtile {
return getSwimlaneIn();
}
static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont fontArrow, UFont fontTest,
HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch nonStop,
ISkinParam skinParam, StringBounder stringBounder, Display labelTest) {
static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, HtmlColor arrowColor,
FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch nonStop, ISkinParam skinParam,
StringBounder stringBounder, Display labelTest) {
backColor = HtmlColorUtils.BLUE;
// backColor = HtmlColorUtils.BLUE;
// final Ftile tileNonStop = new FtileMinWidth(nonStop.getFtile(), 30);
final Ftile tileNonStop = nonStop.getFtile();
final HtmlColor fontColor = skinParam.getFontHtmlColor(FontParam.ACTIVITY_DIAMOND, null);
final FontConfiguration fcArrow = new FontConfiguration(fontArrow, fontColor, skinParam.getHyperlinkColor(),
skinParam.useUnderlineForHyperlink());
final FontConfiguration fcTest = new FontConfiguration(fontTest, fontColor, skinParam.getHyperlinkColor(),
skinParam.useUnderlineForHyperlink());
final FontConfiguration fcTest = new FontConfiguration(skinParam, FontParam.ACTIVITY_DIAMOND, null);
final Ftile stopFtile = ftileFactory.stop(swimlane);
@ -133,7 +126,8 @@ class FtileIfAndStop extends AbstractFtile {
// final TextBlock tb2 = Display.create(branch2.getLabelPositive(), fcArrow, HorizontalAlignment.LEFT,
// ftileFactory);
final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(labelTest);
final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
.createSheet(labelTest);
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding());
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), new UStroke(1.5));

View File

@ -43,6 +43,7 @@ import java.util.Set;
import net.sourceforge.plantuml.Dimension2DDouble;
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.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
@ -55,16 +56,14 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileMinWidth;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileIfWithLinks;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside2;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -131,10 +130,9 @@ class FtileIfLong2 extends AbstractFtile {
return getSwimlaneIn();
}
static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont font,
HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, List<Branch> thens,
Branch branch2, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) {
static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, HtmlColor arrowColor,
FtileFactory ftileFactory, ConditionStyle conditionStyle, List<Branch> thens, Branch branch2,
FontConfiguration fc, LinkRendering topInlinkRendering, LinkRendering afterEndwhile) {
final List<Ftile> tiles = new ArrayList<Ftile>();
for (Branch branch : thens) {
@ -143,9 +141,6 @@ class FtileIfLong2 extends AbstractFtile {
final Ftile tile2 = new FtileMinWidth(branch2.getFtile(), 30);
final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, hyperlinkColor,
useUnderlineForHyperlink);
List<Ftile> diamonds = new ArrayList<Ftile>();
final List<Connection> conns = new ArrayList<Connection>();
for (Branch branch : thens) {
@ -169,20 +164,22 @@ class FtileIfLong2 extends AbstractFtile {
final Ftile ftile = tiles.get(i);
final Ftile diam = diamonds.get(i);
final HtmlColor color = thens.get(i).getInlinkRenderingColor();
final HtmlColor color = FtileIfWithLinks.getInColor(thens.get(i), arrowColor);
conns.add(result.new ConnectionVerticalIn(diam, ftile, color == null ? arrowColor : color));
conns.add(result.new ConnectionVerticalOut(ftile, arrowColor));
}
final HtmlColor topInColor = LinkRendering.getColor(topInlinkRendering, arrowColor);
for (int i = 0; i < diamonds.size() - 1; i++) {
final Ftile diam1 = diamonds.get(i);
final Ftile diam2 = diamonds.get(i + 1);
conns.add(result.new ConnectionHorizontal(diam1, diam2, arrowColor));
conns.add(result.new ConnectionHorizontal(diam1, diam2, topInColor));
}
conns.add(result.new ConnectionIn(arrowColor));
conns.add(result.new ConnectionLastElseIn(arrowColor));
conns.add(result.new ConnectionIn(topInColor));
conns.add(result.new ConnectionLastElseIn(FtileIfWithLinks.getInColor(branch2, arrowColor)));
conns.add(result.new ConnectionLastElseOut(arrowColor));
conns.add(result.new ConnectionHline(arrowColor));
final HtmlColor horizontalOutColor = LinkRendering.getColor(afterEndwhile, arrowColor);
conns.add(result.new ConnectionHline(horizontalOutColor));
return FtileUtils.addConnection(result, conns);
}
@ -503,5 +500,4 @@ class FtileIfLong2 extends AbstractFtile {
}
}

View File

@ -55,11 +55,9 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils;
import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.svek.ConditionStyle;
@ -119,8 +117,8 @@ class FtileIfLongUnused extends AbstractFtile {
final Ftile tile2 = new FtileMinWidth(branch2.getFtile(), 30);
final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, hyperlinkColor,
useUnderlineForHyperlink);
final FontConfiguration fc = null;
// new FontConfiguration(font, HtmlColorUtils.BLACK, hyperlinkColor, useUnderlineForHyperlink);
final List<Ftile> diamonds = new ArrayList<Ftile>();
final List<Connection> conns = new ArrayList<Connection>();

View File

@ -120,9 +120,9 @@ class FtileIfOrigin extends AbstractFtile {
return getSwimlaneIn();
}
static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont fontArrow, UFont fontTest,
HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1,
Branch branch2, ISkinParam skinParam, StringBounder stringBounder) {
static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, HtmlColor arrowColor,
FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1, Branch branch2,
ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fcArrow, FontConfiguration fcTest) {
final Display labelTest = branch1.getLabelTest();
// if (branch1.isOnlySingleStop() || branch2.isOnlySingleStop()) {
@ -134,17 +134,18 @@ class FtileIfOrigin extends AbstractFtile {
final Ftile tile1 = new FtileMinWidth(branch1.getFtile(), 30);
final Ftile tile2 = new FtileMinWidth(branch2.getFtile(), 30);
final HtmlColor fontColor = skinParam.getFontHtmlColor(FontParam.ACTIVITY_DIAMOND, null);
// final FontConfiguration fcArrow = new FontConfiguration(fontArrow, fontColor, skinParam.getHyperlinkColor(),
// skinParam.useUnderlineForHyperlink());
// final FontConfiguration fcTest = new FontConfiguration(fontTest, fontColor, skinParam.getHyperlinkColor(),
// skinParam.useUnderlineForHyperlink());
final FontConfiguration fcArrow = new FontConfiguration(fontArrow, fontColor, skinParam.getHyperlinkColor(),
skinParam.useUnderlineForHyperlink());
final FontConfiguration fcTest = new FontConfiguration(fontTest, fontColor, skinParam.getHyperlinkColor(),
skinParam.useUnderlineForHyperlink());
final TextBlock tb1 = branch1.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory,
CreoleMode.SIMPLE_LINE);
final TextBlock tb2 = branch2.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory,
CreoleMode.SIMPLE_LINE);
final TextBlock tb1 = branch1.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, CreoleMode.SIMPLE_LINE);
final TextBlock tb2 = branch2.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, CreoleMode.SIMPLE_LINE);
final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(labelTest);
final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
.createSheet(labelTest);
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding());
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), new UStroke(1.5));
@ -163,9 +164,11 @@ class FtileIfOrigin extends AbstractFtile {
if (tile1.calculateDimension(stringBounder).hasPointOut()
&& tile2.calculateDimension(stringBounder).hasPointOut()) {
final Display out1 = LinkRendering.getDisplay(branch1.getFtile().getOutLinkRendering());
final TextBlock tbout1 = out1 == null ? null : out1.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, CreoleMode.SIMPLE_LINE);
final TextBlock tbout1 = out1 == null ? null : out1.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory,
CreoleMode.SIMPLE_LINE);
final Display out2 = LinkRendering.getDisplay(branch2.getFtile().getOutLinkRendering());
final TextBlock tbout2 = out2 == null ? null : out2.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory, CreoleMode.SIMPLE_LINE);
final TextBlock tbout2 = out2 == null ? null : out2.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory,
CreoleMode.SIMPLE_LINE);
diamond2 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, swimlane).withWest(tbout1).withEast(
tbout2);
} else {
@ -216,7 +219,7 @@ class FtileIfOrigin extends AbstractFtile {
color = getInColor(branch);
usingArrow = branch.isEmpty() ? null : Arrows.asToDown();
}
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final Point2D p1 = getP1(stringBounder);
@ -299,7 +302,7 @@ class FtileIfOrigin extends AbstractFtile {
this.myArrowColor = myArrowColor == null ? arrowColor : myArrowColor;
this.branchEmpty = branchEmpty;
}
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();

View File

@ -62,12 +62,10 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -99,16 +97,16 @@ class FtileRepeat extends AbstractFtile {
}
public static Ftile create(LinkRendering backRepeatLinkRendering, Swimlane swimlane, Ftile repeat, Display test,
Display yes, Display out, HtmlColor borderColor, HtmlColor backColor, UFont fontTest, HtmlColor arrowColor,
Display yes, Display out, HtmlColor borderColor, HtmlColor backColor, HtmlColor arrowColor,
HtmlColor endRepeatLinkColor, ConditionStyle conditionStyle, ISkinSimple spriteContainer,
HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) {
FontConfiguration fontConfiguration) {
final FontConfiguration fc = new FontConfiguration(fontTest, HtmlColorUtils.BLACK, hyperlinkColor,
useUnderlineForHyperlink);
// final FontConfiguration fc = new FontConfiguration(fontTest, HtmlColorUtils.BLACK, hyperlinkColor,
// useUnderlineForHyperlink);
final TextBlock tbTest = (Display.isNull(test) || test.isWhite()) ? TextBlockUtils.empty(0, 0) : test.create(
fc, HorizontalAlignment.LEFT, spriteContainer);
final TextBlock yesTb = yes.create(fc, HorizontalAlignment.LEFT, spriteContainer);
final TextBlock outTb = out.create(fc, HorizontalAlignment.LEFT, spriteContainer);
fontConfiguration, HorizontalAlignment.LEFT, spriteContainer);
final TextBlock yesTb = yes.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer);
final TextBlock outTb = out.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer);
final Ftile diamond1 = new FtileDiamond(repeat.shadowing(), backColor, borderColor, swimlane);
final FtileRepeat result;
@ -129,17 +127,17 @@ class FtileRepeat extends AbstractFtile {
final List<Connection> conns = new ArrayList<Connection>();
final Display in1 = LinkRendering.getDisplay(repeat.getInLinkRendering());
final TextBlock tbin1 = in1 == null ? null : in1.create(fc, HorizontalAlignment.LEFT, spriteContainer,
final TextBlock tbin1 = in1 == null ? null : in1.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer,
CreoleMode.SIMPLE_LINE);
conns.add(result.new ConnectionIn(LinkRendering.getColor(repeat.getInLinkRendering(), arrowColor), tbin1));
final Display backLink1 = LinkRendering.getDisplay(backRepeatLinkRendering);
final TextBlock tbbackLink1 = backLink1 == null ? null : backLink1.create(fc, HorizontalAlignment.LEFT,
final TextBlock tbbackLink1 = backLink1 == null ? null : backLink1.create(fontConfiguration, HorizontalAlignment.LEFT,
spriteContainer, CreoleMode.SIMPLE_LINE);
conns.add(result.new ConnectionBack(LinkRendering.getColor(backRepeatLinkRendering, arrowColor), tbbackLink1));
final Display out1 = LinkRendering.getDisplay(repeat.getOutLinkRendering());
final TextBlock tbout1 = out1 == null ? null : out1.create(fc, HorizontalAlignment.LEFT, spriteContainer,
final TextBlock tbout1 = out1 == null ? null : out1.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer,
CreoleMode.SIMPLE_LINE);
conns.add(result.new ConnectionOut(LinkRendering.getColor(endRepeatLinkColor, arrowColor), tbout1));

View File

@ -41,7 +41,6 @@ import java.util.List;
import java.util.Set;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.FileGroup;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection;
@ -63,7 +62,6 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
@ -71,7 +69,6 @@ import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEmpty;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@ -102,10 +99,7 @@ class FtileWhile extends AbstractFtile {
this.supplementarySouthText = supplementarySouthText;
}
private static TextBlock createLabel1(Display test, Display yes, UFont font, ISkinSimple spriteContainer,
HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) {
final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, hyperlinkColor,
useUnderlineForHyperlink);
private static TextBlock createLabel1(Display test, Display yes, ISkinSimple spriteContainer, FontConfiguration fc) {
final TextBlock tmpb = yes.create(fc, HorizontalAlignment.LEFT, spriteContainer);
if (test == null) {
return tmpb;
@ -115,17 +109,13 @@ class FtileWhile extends AbstractFtile {
}
public static Ftile create(Swimlane swimlane, Ftile whileBlock, Display test, HtmlColor borderColor,
HtmlColor backColor, HtmlColor arrowColor, Display yes, Display out2, UFont fontArrow,
HtmlColor endInlinkColor, LinkRendering afterEndwhile, FtileFactory ftileFactory,
ConditionStyle conditionStyle, UFont fontTest, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) {
HtmlColor backColor, HtmlColor arrowColor, Display yes, Display out2, HtmlColor endInlinkColor,
LinkRendering afterEndwhile, FontConfiguration fontArrow, FtileFactory ftileFactory,
ConditionStyle conditionStyle, FontConfiguration fcTest) {
final FontConfiguration fcArrow = new FontConfiguration(fontArrow, HtmlColorUtils.BLACK, hyperlinkColor,
useUnderlineForHyperlink);
final FontConfiguration fcTest = new FontConfiguration(fontTest, HtmlColorUtils.BLACK, hyperlinkColor,
useUnderlineForHyperlink);
final TextBlock yesTb = yes.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory);
final TextBlock yesTb = yes.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory);
final TextBlock testTb = test.create(fcTest, HorizontalAlignment.LEFT, ftileFactory);
final TextBlock out = out2.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory);
final TextBlock out = out2.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory);
final Ftile diamond1;
final TextBlock supplementarySouthText;
@ -138,8 +128,7 @@ class FtileWhile extends AbstractFtile {
diamond1 = new FtileDiamondFoo1(whileBlock.shadowing(), backColor, borderColor, swimlane, testTb)
.withNorth(yesTb).withWest(out);
} else if (conditionStyle == ConditionStyle.DIAMOND) {
supplementarySouthText = createLabel1(test, yes, fontArrow, ftileFactory, hyperlinkColor,
useUnderlineForHyperlink);
supplementarySouthText = createLabel1(test, yes, ftileFactory, fontArrow);
diamond1 = new FtileDiamond(whileBlock.shadowing(), backColor, borderColor, swimlane).withWest(out)
.withSouth(supplementarySouthText);
} else {

View File

@ -95,15 +95,18 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
// this.arrowColor = arrowColor;
final Rose rose = new Rose();
final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE);
final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false);
// final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE);
// final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false);
final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground);
final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder);
final FontConfiguration fc = new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink());
// final FontConfiguration fc = new FontConfiguration(fontNote, fontColor, skinParam.getHyperlinkColor(),
// skinParam.useUnderlineForHyperlink());
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(note);
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
.createSheet(note);
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, new UStroke(1));
opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(), withLink);

View File

@ -56,6 +56,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateOut
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.Sprite;
@ -91,12 +92,13 @@ public class VCompactFactory implements FtileFactory {
return new FtileCircleEnd(shadowing(), color, swimlane);
}
public Ftile activity(Display label, final HtmlColor color, Swimlane swimlane, BoxStyle style) {
final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.activityBorder);
final HtmlColor backColor = color == null ? rose.getHtmlColor(skinParam, ColorParam.activityBackground) : color;
public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors) {
// final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.activityBorder);
// final HtmlColor backColor = color == null ? rose.getHtmlColor(skinParam, ColorParam.activityBackground) :
// color;
final UFont font = skinParam.getFont(FontParam.ACTIVITY, null, false);
final HtmlColor arrowColor = rose.getHtmlColor(skinParam, ColorParam.activityArrow);
return new FtileBox(shadowing(), label, borderColor, backColor, font, arrowColor, swimlane, style, skinParam);
return new FtileBox(shadowing(), label, font, arrowColor, swimlane, style, colors.mute(skinParam));
}
public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition) {
@ -121,7 +123,8 @@ public class VCompactFactory implements FtileFactory {
return whileBlock;
}
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch) {
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering) {
final List<Ftile> ftiles = new ArrayList<Ftile>();
for (Branch branch : thens) {
ftiles.add(branch.getFtile());
@ -180,4 +183,8 @@ public class VCompactFactory implements FtileFactory {
return skinParam.getMonospacedFamily();
}
public int getTabSize() {
return skinParam.getTabSize();
}
}

View File

@ -60,7 +60,6 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke;
public class ConditionalBuilder {
@ -68,8 +67,6 @@ public class ConditionalBuilder {
private final Swimlane swimlane;
private final HtmlColor borderColor;
private final HtmlColor backColor;
private final UFont fontArrow;
private final UFont fontTest;
private final HtmlColor arrowColor;
private final FtileFactory ftileFactory;
private final ConditionStyle conditionStyle;
@ -77,18 +74,18 @@ public class ConditionalBuilder {
private final Branch branch2;
private final ISkinParam skinParam;
private final StringBounder stringBounder;
private final FontConfiguration fontArrow;
private final FontConfiguration fontTest;
private final Ftile tile1;
private final Ftile tile2;
public ConditionalBuilder(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont fontArrow,
UFont fontTest, HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle,
Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder) {
public ConditionalBuilder(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, HtmlColor arrowColor,
FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1, Branch branch2,
ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fontArrow, FontConfiguration fontTest) {
this.swimlane = swimlane;
this.borderColor = borderColor;
this.backColor = backColor;
this.fontArrow = fontArrow;
this.fontTest = fontTest;
this.arrowColor = arrowColor;
this.ftileFactory = ftileFactory;
this.conditionStyle = conditionStyle;
@ -96,17 +93,19 @@ public class ConditionalBuilder {
this.branch2 = branch2;
this.skinParam = skinParam;
this.stringBounder = stringBounder;
this.fontArrow = fontArrow.changeColor(fontColor());
this.fontTest = fontTest.changeColor(fontColor());
this.tile1 = new FtileMinWidth(branch1.getFtile(), 30);
this.tile2 = new FtileMinWidth(branch2.getFtile(), 30);
}
static public Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, UFont fontArrow,
UFont fontTest, HtmlColor arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle,
Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder) {
final ConditionalBuilder builder = new ConditionalBuilder(swimlane, borderColor, backColor, fontArrow,
fontTest, arrowColor, ftileFactory, conditionStyle, branch1, branch2, skinParam, stringBounder);
static public Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, HtmlColor arrowColor,
FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1, Branch branch2,
ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fcArrow, FontConfiguration fcTest) {
final ConditionalBuilder builder = new ConditionalBuilder(swimlane, borderColor, backColor, arrowColor,
ftileFactory, conditionStyle, branch1, branch2, skinParam, stringBounder, fcArrow, fcTest);
return builder.createWithLinks();
// return builder.createWithDiamonds();
// return builder.createNude();
@ -156,9 +155,7 @@ public class ConditionalBuilder {
final TextBlock tb1 = getLabelBranch1();
final TextBlock tb2 = getLabelBranch2();
final FontConfiguration fcTest = new FontConfiguration(fontTest, fontColor(), skinParam.getHyperlinkColor(),
skinParam.useUnderlineForHyperlink());
final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
final Sheet sheet = new CreoleParser(fontTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
.createSheet(labelTest);
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding());
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), new UStroke(1.5));
@ -177,28 +174,26 @@ public class ConditionalBuilder {
}
private TextBlock getLabelBranch2() {
final TextBlock tb2 = branch2.getLabelPositive().create(fcArrow(), HorizontalAlignment.LEFT, ftileFactory,
final TextBlock tb2 = branch2.getLabelPositive().create(fontArrow, HorizontalAlignment.LEFT, ftileFactory,
CreoleMode.SIMPLE_LINE);
return tb2;
}
private TextBlock getLabelBranch1() {
final TextBlock tb1 = branch1.getLabelPositive().create(fcArrow(), HorizontalAlignment.LEFT, ftileFactory,
final TextBlock tb1 = branch1.getLabelPositive().create(fontArrow, HorizontalAlignment.LEFT, ftileFactory,
CreoleMode.SIMPLE_LINE);
return tb1;
}
private Ftile getDiamond2() {
final FontConfiguration fcArrow = fcArrow();
final Ftile diamond2;
if (hasTwoBranches()) {
final Display out1 = LinkRendering.getDisplay(branch1.getFtile().getOutLinkRendering());
final TextBlock tbout1 = out1 == null ? null : out1.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory,
CreoleMode.SIMPLE_LINE);
final TextBlock tbout1 = out1 == null ? null : out1.create(fontArrow, HorizontalAlignment.LEFT,
ftileFactory, CreoleMode.SIMPLE_LINE);
final Display out2 = LinkRendering.getDisplay(branch2.getFtile().getOutLinkRendering());
final TextBlock tbout2 = out2 == null ? null : out2.create(fcArrow, HorizontalAlignment.LEFT, ftileFactory,
CreoleMode.SIMPLE_LINE);
final TextBlock tbout2 = out2 == null ? null : out2.create(fontArrow, HorizontalAlignment.LEFT,
ftileFactory, CreoleMode.SIMPLE_LINE);
diamond2 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, swimlane).withWest(tbout1).withEast(
tbout2);
} else {
@ -214,11 +209,6 @@ public class ConditionalBuilder {
&& tile2.calculateDimension(stringBounder).hasPointOut();
}
private FontConfiguration fcArrow() {
return new FontConfiguration(fontArrow, fontColor(), skinParam.getHyperlinkColor(),
skinParam.useUnderlineForHyperlink());
}
private HtmlColor fontColor() {
return skinParam.getFontHtmlColor(FontParam.ACTIVITY_DIAMOND, null);
}

View File

@ -67,7 +67,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
this.arrowColor = arrowColor;
}
private HtmlColor getInColor(Branch branch) {
public static HtmlColor getInColor(Branch branch, HtmlColor arrowColor) {
if (branch.isEmpty()) {
return LinkRendering.getColor(branch.getFtile().getOutLinkRendering(), arrowColor);
}
@ -84,7 +84,7 @@ public class FtileIfWithLinks extends FtileIfWithDiamonds {
public ConnectionHorizontalThenVertical(Ftile tile, Branch branch) {
super(diamond1, tile);
color = getInColor(branch);
color = getInColor(branch, arrowColor);
usingArrow = branch.isEmpty() ? null : Arrows.asToDown();
}

View File

@ -37,14 +37,14 @@ import java.awt.geom.Dimension2D;
import java.util.Collections;
import java.util.Set;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.creole.CreoleMode;
@ -73,11 +73,10 @@ public class FtileBox extends AbstractFtile {
private final TextBlock tb;
private final HtmlColor borderColor;
private final HtmlColor backColor;
private final LinkRendering inRenreding;
private final Swimlane swimlane;
private final BoxStyle style;
private final ISkinParam skinParam;
final public LinkRendering getInLinkRendering() {
return inRenreding;
@ -111,19 +110,16 @@ public class FtileBox extends AbstractFtile {
}
public FtileBox(boolean shadowing, Display label, HtmlColor color, HtmlColor backColor, UFont font,
HtmlColor arrowColor, Swimlane swimlane, BoxStyle style, ISkinParam skinParam) {
public FtileBox(boolean shadowing, Display label, UFont font, HtmlColor arrowColor, Swimlane swimlane,
BoxStyle style, ISkinParam skinParam) {
super(shadowing);
this.style = style;
this.borderColor = color;
this.skinParam = skinParam;
this.swimlane = swimlane;
this.backColor = backColor;
this.inRenreding = new LinkRendering(arrowColor);
final HtmlColor fontColor = skinParam.getFontHtmlColor(FontParam.ACTIVITY, null);
final FontConfiguration fc = new FontConfiguration(font, fontColor, skinParam.getHyperlinkColor(),
skinParam.useUnderlineForHyperlink());
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(label);
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.ACTIVITY, null);
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
.createSheet(label);
this.tb = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), new MyStencil(), new UStroke(1));
this.print = label.toString();
}
@ -141,6 +137,9 @@ public class FtileBox extends AbstractFtile {
final double heightTotal = dimTotal.getHeight();
final UDrawable rect = style.getUDrawable(widthTotal, heightTotal, shadowing());
final HtmlColor borderColor = SkinParamUtils.getColor(skinParam, ColorParam.activityBorder, null);
final HtmlColor backColor = SkinParamUtils.getColor(skinParam, ColorParam.activityBackground, null);
ug = ug.apply(new UChangeColor(borderColor)).apply(new UChangeBackColor(backColor)).apply(new UStroke(1.5));
rect.drawU(ug);

View File

@ -49,8 +49,12 @@ import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.LinkStyle;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.graphic.color.ColorType;
public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
@ -94,8 +98,8 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
new RegexLeaf("$"));
}
public static ColorParser color() {
return ColorParser.simpleColor();
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}
@Override
@ -129,9 +133,27 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
entity.addUrl(url);
}
entity.setSpecificBackcolor(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()));
entity.setSpecificLineColor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)));
CommandCreateClassMultilines.applyStroke(entity, arg.get("LINECOLOR", 0));
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1));
if (lineColor != null) {
colors = colors.add(ColorType.LINE, lineColor);
}
if (arg.get("LINECOLOR", 0) != null) {
colors = colors.addLegacyStroke(arg.get("LINECOLOR", 0));
}
entity.setColors(colors);
// entity.setSpecificColorTOBEREMOVED(ColorType.LINE, lineColor);
// entity.setSpecificColorTOBEREMOVED(ColorType.HEADER, colors.getColor(ColorType.HEADER));
//
// if (colors.getLineStyle() != null) {
// entity.setSpecificLineStroke(LinkStyle.getStroke(colors.getLineStyle()));
// }
//
// if (arg.get("LINECOLOR", 0) != null) {
// entity.applyStroke(arg.get("LINECOLOR", 0));
// }
// manageExtends(diagram, arg, entity);
CommandCreateClassMultilines.manageExtends("EXTENDS", diagram, arg, entity);
@ -139,7 +161,6 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
return CommandExecutionResult.ok();
}
// public static void manageExtends(ClassDiagram system, RegexResult arg, final IEntity entity) {
// if (arg.get("EXTENDS", 1) != null) {
// final Mode mode = arg.get("EXTENDS", 1).equalsIgnoreCase("extends") ? Mode.EXTENDS : Mode.IMPLEMENTS;

View File

@ -54,12 +54,13 @@ import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkStyle;
import net.sourceforge.plantuml.cucadiagram.LinkType;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.ugraphic.UStroke;
public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagram> {
@ -99,7 +100,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
new RegexLeaf("[%s]*"), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
new RegexLeaf("[%s]*"), //
ColorParser.exp1(), //
color().getRegex(), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("LINECOLOR", "(?:##(?:\\[(dotted|dashed|bold)\\])?(\\w+)?)?"), //
new RegexLeaf("EXTENDS", "([%s]+(extends)[%s]+(" + CODES + "))?"), //
@ -107,6 +108,10 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
new RegexLeaf("[%s]*\\{[%s]*$"));
}
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}
public CommandExecutionResult executeNow(ClassDiagram diagram, BlocLines lines) {
lines = lines.trimSmart(1);
lines = lines.removeComments();
@ -199,9 +204,22 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
result.addUrl(url);
}
result.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
result.setSpecificLineColor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)));
applyStroke(result, arg.get("LINECOLOR", 0));
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1));
if (lineColor != null) {
colors = colors.add(ColorType.LINE, lineColor);
}
if (arg.get("LINECOLOR", 0) != null) {
colors = colors.addLegacyStroke(arg.get("LINECOLOR", 0));
}
result.setColors(colors);
// result.setSpecificColorTOBEREMOVED(ColorType.BACK,
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
// result.setSpecificColorTOBEREMOVED(ColorType.LINE,
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)));
// result.applyStroke(arg.get("LINECOLOR", 0));
if (generic != null) {
result.setGeneric(generic);
@ -209,26 +227,4 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
return result;
}
public static UStroke getStroke(LinkStyle style) {
if (style == LinkStyle.DASHED) {
return new UStroke(6, 6, 1);
}
if (style == LinkStyle.DOTTED) {
return new UStroke(1, 3, 1);
}
if (style == LinkStyle.BOLD) {
return new UStroke(2.5);
}
return new UStroke();
}
public static void applyStroke(IEntity entity, String s) {
if (s == null) {
return;
}
final LinkStyle style = LinkStyle.valueOf(StringUtils.goUpperCase(s));
entity.setSpecificLineStroke(getStroke(style));
}
}

View File

@ -52,6 +52,7 @@ import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram> {
@ -213,7 +214,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
entity.addUrl(url);
}
entity.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
return CommandExecutionResult.ok();
}

View File

@ -58,6 +58,10 @@ import net.sourceforge.plantuml.cucadiagram.LinkArrow;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.HtmlColorSet;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrObjectDiagram> {
@ -100,13 +104,18 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
new RegexLeaf("COUPLE2",
"\\([%s]*(\\.?[\\p{L}0-9_]+(?:\\.[\\p{L}0-9_]+)*)[%s]*,[%s]*(\\.?[\\p{L}0-9_]+(?:\\.[\\p{L}0-9_]+)*)[%s]*\\)")),
new RegexLeaf("[%s]*"), //
color().getRegex(), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("LABEL_LINK", "(?::[%s]*(.+))?"), //
new RegexLeaf("$"));
}
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.LINE);
}
private static String getClassIdentifier() {
return "(" + getSeparator() + "?[\\p{L}0-9_$]+(?:" + getSeparator()
+ "[\\p{L}0-9_$]+)*|[%g][^%g]+[%g])[%s]*(\\<\\<.*\\>\\>)?";
return "(" + getSeparator() + "?[\\p{L}0-9_$]+(?:" + getSeparator() + "[\\p{L}0-9_$]+)*|[%g][^%g]+[%g])";
}
private static String getSeparator() {
@ -158,16 +167,18 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
((ILeaf) cl2).muteToType(type, null);
}
}
if (arg.get("ENT1", 2) != null) {
cl1.setStereotype(new Stereotype(arg.get("ENT1", 2), diagram.getSkinParam().getCircledCharacterRadius(),
diagram.getSkinParam().getFont(FontParam.CIRCLED_CHARACTER, null, false), diagram.getSkinParam()
.getIHtmlColorSet()));
}
if (arg.get("ENT2", 2) != null) {
cl2.setStereotype(new Stereotype(arg.get("ENT2", 2), diagram.getSkinParam().getCircledCharacterRadius(),
diagram.getSkinParam().getFont(FontParam.CIRCLED_CHARACTER, null, false), diagram.getSkinParam()
.getIHtmlColorSet()));
}
// if (arg.get("ENT1", 2) != null) {
// cl1.setStereotype(new Stereotype(arg.get("ENT1", 2), diagram.getSkinParam().getCircledCharacterRadius(),
// diagram.getSkinParam().getFont(FontParam.CIRCLED_CHARACTER, null, false), diagram.getSkinParam()
// .getIHtmlColorSet()));
// }
// if (arg.get("ENT2", 2) != null) {
// cl2.setStereotype(new Stereotype(arg.get("ENT2", 2), diagram.getSkinParam().getCircledCharacterRadius(),
// diagram.getSkinParam().getFont(FontParam.CIRCLED_CHARACTER, null, false), diagram.getSkinParam()
// .getIHtmlColorSet()));
// }
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final LinkType linkType = getLinkType(arg);
final Direction dir = getDirection(arg);
@ -244,7 +255,8 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
link = link.getInv();
}
link.setLinkArrow(linkArrow);
applyStyle(arg.getLazzy("ARROW_STYLE", 0), link);
colors = applyStyle(arg.getLazzy("ARROW_STYLE", 0), link, colors);
link.setColors(colors);
addLink(diagram, link, arg.get("HEADER", 0));
@ -288,6 +300,8 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
queue = getQueueLength(arg);
}
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final Display labelLink = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
final String firstLabel = arg.get("FIRST_LABEL", 0);
final String secondLabel = arg.get("SECOND_LABEL", 0);
@ -295,7 +309,10 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
diagram.getLabeldistance(), diagram.getLabelangle());
diagram.resetPragmaLabel();
applyStyle(arg.getLazzy("ARROW_STYLE", 0), link);
colors = applyStyle(arg.getLazzy("ARROW_STYLE", 0), link, colors);
link.setColors(colors);
addLink(diagram, link, arg.get("HEADER", 0));
return CommandExecutionResult.ok();
}
@ -471,9 +488,14 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
return s;
}
public static void applyStyle(String arrowStyle, Link link) {
@Deprecated
public static Colors applyStyle(String arrowStyle, Link link) {
return applyStyle(arrowStyle, link, null);
}
public static Colors applyStyle(String arrowStyle, Link link, Colors colors) {
if (arrowStyle == null) {
return;
return colors;
}
final StringTokenizer st = new StringTokenizer(arrowStyle, ",");
while (st.hasMoreTokens()) {
@ -490,8 +512,12 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
link.goNorank();
} else {
link.setSpecificColor(s);
if (colors != null) {
colors = colors.add(ColorType.LINE, HtmlColorSet.getInstance().getColorIfValid(s));
}
}
}
return colors;
}
private boolean isInversed(LinkDecor decors1, LinkDecor decors2) {

View File

@ -44,6 +44,7 @@ import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
@ -73,7 +74,7 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
}
final String color = arg.get("COLOR", 0);
if (color != null) {
p.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
p.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
}
return CommandExecutionResult.ok();
}

View File

@ -49,6 +49,8 @@ import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.utils.UniqueSequence;
public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
@ -66,9 +68,13 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
new RegexLeaf("[%s]*"), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
new RegexLeaf("[%s]*"), //
ColorParser.exp1(), //
color().getRegex(), //
new RegexLeaf("[%s]*\\{$"));
}
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}
@Override
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, RegexResult arg) {
@ -107,10 +113,13 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
p.addUrl(url);
}
final String color = arg.get("COLOR", 0);
if (color != null) {
p.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
}
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
p.setColors(colors);
// final String color = arg.get("COLOR", 0);
// if (color != null) {
// p.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
// }
return CommandExecutionResult.ok();
}

View File

@ -35,13 +35,14 @@ package net.sourceforge.plantuml.command;
import java.util.List;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.utils.UniqueSequence;
public class CommandPackageEmpty extends SingleLineCommand<AbstractEntityDiagram> {
@ -72,7 +73,7 @@ public class CommandPackageEmpty extends SingleLineCommand<AbstractEntityDiagram
currentPackage);
final String color = arg.get(2);
if (color != null) {
p.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
p.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
}
diagram.endGroup();
return CommandExecutionResult.ok();

View File

@ -55,6 +55,7 @@ import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.utils.UniqueSequence;
public final class FactoryNoteActivityCommand implements SingleMultiFactoryCommand<ActivityDiagram> {
@ -128,7 +129,7 @@ public final class FactoryNoteActivityCommand implements SingleMultiFactoryComma
private CommandExecutionResult executeInternal(ActivityDiagram diagram, RegexResult arg, IEntity note) {
note.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
note.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
IEntity activity = diagram.getLastEntityConsulted();
if (activity == null) {

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
public final class FactoryNoteCommand implements SingleMultiFactoryCommand<AbstractEntityDiagram> {
@ -108,7 +109,7 @@ public final class FactoryNoteCommand implements SingleMultiFactoryCommand<Abstr
}
final IEntity entity = diagram.createLeaf(code, display.toDisplay(), LeafType.NOTE, null);
assert entity != null;
entity.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
return CommandExecutionResult.ok();
}

View File

@ -58,6 +58,8 @@ import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.utils.UniqueSequence;
public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryCommand<AbstractEntityDiagram> {
@ -78,13 +80,17 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma
new RegexConcat(new RegexLeaf("[%s]+of[%s]+"), partialPattern), //
new RegexLeaf("")), //
new RegexLeaf("[%s]*"), //
ColorParser.exp1(), //
color().getRegex(), //
new RegexLeaf("[%s]*:[%s]*"), //
new RegexLeaf("NOTE", "(.*)"), //
new RegexLeaf("$") //
);
}
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}
private RegexConcat getRegexConcatMultiLine(IRegex partialPattern, final boolean withBracket) {
return new RegexConcat(new RegexLeaf("^note[%s]+"), //
new RegexLeaf("POSITION", "(right|left|top|bottom)"), //
@ -92,7 +98,7 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma
new RegexConcat(new RegexLeaf("[%s]+of[%s]+"), partialPattern), //
new RegexLeaf("")), //
new RegexLeaf("[%s]*"), //
ColorParser.exp1(), //
color().getRegex(), //
new RegexLeaf(withBracket ? "[%s]*\\{" : "[%s]*"), //
new RegexLeaf("$") //
);
@ -160,7 +166,12 @@ public final class FactoryNoteOnEntityCommand implements SingleMultiFactoryComma
final IEntity note = diagram
.createLeaf(UniqueSequence.getCode("GMN"), strings.toDisplay(), LeafType.NOTE, null);
note.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
// System.err.println("colors=" + colors);
// note.setSpecificColorTOBEREMOVED(ColorType.BACK,
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
note.setColors(colors);
if (url != null) {
note.addUrl(url);
}

View File

@ -50,6 +50,8 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
public final class FactoryNoteOnLinkCommand implements SingleMultiFactoryCommand<CucaDiagram> {
@ -57,7 +59,7 @@ public final class FactoryNoteOnLinkCommand implements SingleMultiFactoryCommand
return new RegexConcat(new RegexLeaf("^note[%s]+"), //
new RegexLeaf("POSITION", "(right|left|top|bottom)?[%s]*on[%s]+link"), //
new RegexLeaf("[%s]*"), //
ColorParser.exp1(), //
color().getRegex(), //
new RegexLeaf("[%s]*:[%s]*"), //
new RegexLeaf("NOTE", "(.*)"), //
new RegexLeaf("$"));
@ -67,10 +69,14 @@ public final class FactoryNoteOnLinkCommand implements SingleMultiFactoryCommand
return new RegexConcat(new RegexLeaf("^note[%s]+"), //
new RegexLeaf("POSITION", "(right|left|top|bottom)?[%s]*on[%s]+link"), //
new RegexLeaf("[%s]*"), //
ColorParser.exp1(), //
color().getRegex(), //
new RegexLeaf("$"));
}
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}
public Command<CucaDiagram> createMultiLine(boolean withBracket) {
return new CommandMultilines2<CucaDiagram>(getRegexConcatMultiLine(), MultilinesStrategy.KEEP_STARTING_QUOTE) {
@ -121,8 +127,8 @@ public final class FactoryNoteOnLinkCommand implements SingleMultiFactoryCommand
if (url != null) {
note = note.subExtract(1, 0);
}
link.addNote(note.toDisplay(), position,
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
link.addNote(note.toDisplay(), position, colors);
return CommandExecutionResult.ok();
}

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.sequencediagram.Note;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteStyle;
@ -115,7 +116,7 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
if (strings.size() > 0) {
final boolean tryMerge = arg.get("VMERGE", 0) != null;
final Note note = new Note(p, position, strings.toDisplay());
note.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
note.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
note.setStyle(NoteStyle.getNoteStyle(arg.get("STYLE", 0)));
diagram.addNote(note, tryMerge);
}

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.sequencediagram.Note;
import net.sourceforge.plantuml.sequencediagram.NoteStyle;
import net.sourceforge.plantuml.sequencediagram.Participant;
@ -118,7 +119,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
if (lines.size() > 0) {
final boolean tryMerge = line0.get("VMERGE", 0) != null;
final Note note = new Note(p1, p2, lines.toDisplay());
note.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
note.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
note.setStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0)));
diagram.addNote(note, tryMerge);
}

View File

@ -54,6 +54,11 @@ public class RegexLeaf implements IRegex {
this.name = name;
}
@Override
public String toString() {
return super.toString() + " " + name + " " + pattern;
}
public String getName() {
return name;
}

View File

@ -48,6 +48,7 @@ import javax.imageio.ImageIO;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.FileSystem;
import net.sourceforge.plantuml.code.Base64Coder;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.ImgValign;
@ -58,6 +59,7 @@ import net.sourceforge.plantuml.ugraphic.UImage;
public class AtomImg implements Atom {
private static final String DATA_IMAGE_PNG_BASE64 = "data:image/png;base64,";
private final BufferedImage image;
private AtomImg(BufferedImage image) {
@ -66,18 +68,25 @@ public class AtomImg implements Atom {
public static Atom create(String src, final ImgValign valign, final int vspace) {
final UFont font = new UFont("Monospaced", Font.PLAIN, 14);
final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true);
final FontConfiguration fc = FontConfiguration.blackBlueTrue(font);
if (src.startsWith(DATA_IMAGE_PNG_BASE64)) {
final String data = src.substring(DATA_IMAGE_PNG_BASE64.length(), src.length());
try {
final byte bytes[] = Base64Coder.decode(data);
return build(src, fc, bytes);
} catch (Exception e) {
return AtomText.create("ERROR " + e.toString(), fc);
}
}
try {
final File f = FileSystem.getInstance().getFile(src);
if (f.exists() == false) {
// Check if valid URL
if (src.startsWith("http:") || src.startsWith("https:")) {
final byte image[] = getFile(src);
final BufferedImage read = ImageIO.read(new ByteArrayInputStream(image));
if (read == null) {
return AtomText.create("(Cannot decode: " + src + ")", fc);
}
return new AtomImg(read);
return build(src, fc, image);
}
return AtomText.create("(File not found: " + f + ")", fc);
}
@ -95,6 +104,14 @@ public class AtomImg implements Atom {
}
}
private static Atom build(String source, final FontConfiguration fc, final byte[] data) throws IOException {
final BufferedImage read = ImageIO.read(new ByteArrayInputStream(data));
if (read == null) {
return AtomText.create("(Cannot decode: " + source + ")", fc);
}
return new AtomImg(read);
}
// Added by Alain Corbiere
static byte[] getFile(String host) throws IOException {
final ByteArrayOutputStream image = new ByteArrayOutputStream();

View File

@ -158,7 +158,15 @@ public class AtomText implements Atom {
}
private double getTabSize(StringBounder stringBounder) {
return stringBounder.calculateDimension(fontConfiguration.getFont(), " ").getWidth();
return stringBounder.calculateDimension(fontConfiguration.getFont(), tabString()).getWidth();
}
private String tabString() {
final int nb = fontConfiguration.getTabSize();
if (nb >= 1 && nb < 7) {
return " ".substring(0, nb);
}
return " ";
}
public void drawU(UGraphic ug) {

View File

@ -47,7 +47,6 @@ import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.UFont;
@ -70,13 +69,13 @@ public class PSystemCreole extends AbstractPSystem {
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
final Display display = Display.create(lines);
final UFont font = new UFont("Serif", Font.PLAIN, 14);
final FontConfiguration fontConfiguration = new FontConfiguration(font, HtmlColorUtils.BLACK,
HtmlColorUtils.BLUE, true);
final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(font);
final Sheet sheet = new CreoleParser(fontConfiguration, HorizontalAlignment.LEFT, null, CreoleMode.FULL)
.createSheet(display);
final SheetBlock1 sheetBlock = new SheetBlock1(sheet, 0, 0);
final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), 1.0, null, null, null, 0, 0, null, false);
final ImageBuilder builder = new ImageBuilder(new ColorMapperIdentity(), 1.0, null, null, null, 0, 0, null,
false);
builder.addUDrawable(sheetBlock);
return builder.writeImageTOBEMOVED(fileFormat, os);

View File

@ -77,8 +77,7 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock {
this.skinParam = skinParam;
this.manageUrl = true;
this.titleConfig = new FontConfiguration(skinParam.getFont(fontParam, null, false), new Rose().getFontColor(
skinParam, fontParam), skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink());
this.titleConfig = new FontConfiguration(skinParam, fontParam, null);
this.lineFirst = true;
this.align = HorizontalAlignment.LEFT;
this.manageHorizontalLine = true;
@ -145,7 +144,8 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock {
}
members = new ArrayList<Member>();
final List<String> allTree = buildAllTree(s, it);
final TextBlock bloc = Display.create(allTree).create(fontParam.getFontConfiguration(skinParam), align, skinParam, CreoleMode.FULL);
final TextBlock bloc = Display.create(allTree).create(fontParam.getFontConfiguration(skinParam), align,
skinParam, CreoleMode.FULL);
blocks.add(bloc);
} else {
final Member m = new MemberImpl(s, MemberImpl.isMethod(s), manageModifier, manageUrl);

View File

@ -46,6 +46,8 @@ import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.svek.SingleStrategy;
@ -126,16 +128,6 @@ public class GroupRoot implements IGroup {
}
public HtmlColor getSpecificBackColor() {
throw new UnsupportedOperationException();
}
public void setSpecificBackcolor(HtmlColor specificBackcolor) {
throw new UnsupportedOperationException();
}
public IGroup getParentContainer() {
return null;
}
@ -212,22 +204,6 @@ public class GroupRoot implements IGroup {
return false;
}
public HtmlColor getSpecificLineColor() {
return null;
}
public void setSpecificLineColor(HtmlColor specificLinecolor) {
throw new UnsupportedOperationException();
}
public UStroke getSpecificLineStroke() {
return null;
}
public void setSpecificLineStroke(UStroke specificLineStoke) {
throw new UnsupportedOperationException();
}
public boolean hasUrl() {
return false;
}
@ -268,4 +244,28 @@ public class GroupRoot implements IGroup {
throw new UnsupportedOperationException();
}
public Colors getColors(ISkinParam skinParam) {
return Colors.empty();
}
public void setColors(Colors colors) {
throw new UnsupportedOperationException();
}
public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) {
throw new UnsupportedOperationException();
}
public void setSpecificLineStroke(UStroke specificLineStroke) {
throw new UnsupportedOperationException();
}
public void applyStroke(String s) {
throw new UnsupportedOperationException();
}
public void applyStroke(Colors colors) {
throw new UnsupportedOperationException();
}
}

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.Removeable;
import net.sourceforge.plantuml.SpecificBackcolorable;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.Colors;
public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, LineConfigurable {
@ -86,4 +87,7 @@ public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, Li
public Map<String, Display> getTips();
@Deprecated
public void applyStroke(String s);
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16541 $
* Revision $Revision: 17068 $
*
*/
package net.sourceforge.plantuml.cucadiagram;
@ -45,11 +45,10 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorSet;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.USymbolInterface;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.utils.UniqueSequence;
@ -67,7 +66,7 @@ public class Link implements Hideable, Removeable {
private Display note;
private Position notePosition;
private HtmlColor noteColor;
private Colors noteColors;
private boolean invis = false;
private double weight = 1.0;
@ -298,25 +297,25 @@ public class Link implements Hideable, Removeable {
return note;
}
public final HtmlColor getNoteColor() {
return noteColor;
public final Colors getNoteColors() {
return noteColors;
}
public final Position getNotePosition() {
return notePosition;
}
public final void addNote(Display note, Position position, HtmlColor noteColor) {
public final void addNote(Display note, Position position, Colors colors) {
this.note = note;
this.notePosition = position;
this.noteColor = noteColor;
this.noteColors = colors;
}
public final void addNote(String n, Position position, HtmlColor noteColor) {
this.note = Display.getWithNewlines(n);
this.notePosition = position;
this.noteColor = noteColor;
}
// public final void addNote(String n, Position position, Colors colors) {
// this.note = Display.getWithNewlines(n);
// this.notePosition = position;
// this.noteColors = colors;
// }
public boolean isAutoLinkOfAGroup() {
if (getEntity1().isGroup() == false) {
@ -370,8 +369,7 @@ public class Link implements Hideable, Removeable {
private double getQualifierMargin(StringBounder stringBounder, UFont fontQualif, String qualif,
ISkinSimple spriteContainer) {
if (qualif != null) {
final TextBlock b = Display.create(qualif).create(
new FontConfiguration(fontQualif, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true),
final TextBlock b = Display.create(qualif).create(FontConfiguration.blackBlueTrue(fontQualif),
HorizontalAlignment.LEFT, spriteContainer);
final Dimension2D dim = b.calculateDimension(stringBounder);
return Math.max(dim.getWidth(), dim.getHeight());
@ -495,4 +493,14 @@ public class Link implements Hideable, Removeable {
this.sametail = sametail;
}
private Colors colors;
public void setColors(Colors colors) {
this.colors = colors;
}
public final Colors getColors() {
return colors;
}
}

View File

@ -33,10 +33,27 @@
*/
package net.sourceforge.plantuml.cucadiagram;
import net.sourceforge.plantuml.ugraphic.UStroke;
public enum LinkStyle {
NORMAL, DASHED, DOTTED, BOLD, INVISIBLE,
DOUBLE_tobedone, __toremove_INTERFACE_PROVIDER, __toremove_INTERFACE_USER;
public static UStroke getStroke(LinkStyle style) {
if (style == LinkStyle.DASHED) {
return new UStroke(6, 6, 1);
}
if (style == LinkStyle.DOTTED) {
return new UStroke(1, 3, 1);
}
if (style == LinkStyle.BOLD) {
return new UStroke(2.5);
}
return new UStroke();
}
}

View File

@ -69,7 +69,7 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
return new TextBlockLineBefore(TextBlockUtils.withMargin(this, 6, 4));
}
private final UFont font;
private final FontParam fontParam;
private final ISkinParam skinParam;
private final HtmlColor color;
private final HtmlColor hyperlinkColor;
@ -86,7 +86,7 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
HorizontalAlignment align) {
this.align = align;
this.skinParam = skinParam;
this.font = skinParam.getFont(fontParam, null, false);
this.fontParam = fontParam;
this.color = rose.getFontColor(skinParam, fontParam);
this.hyperlinkColor = skinParam.getHyperlinkColor();
this.useUnderlineForHyperlink = skinParam.useUnderlineForHyperlink();
@ -128,7 +128,7 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
if (withVisibilityChar && s.startsWith("#")) {
s = CharHidder.addTileAtBegin(s);
}
FontConfiguration config = new FontConfiguration(font, color, hyperlinkColor, useUnderlineForHyperlink);
FontConfiguration config = new FontConfiguration(skinParam, fontParam, null);
if (m.isAbstract()) {
config = config.italic();
}
@ -164,7 +164,7 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
final Dimension2D dim = bloc.calculateDimension(stringBounder);
return dim;
}
@Override
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) {
return bloc.getInnerPosition(member, stringBounder);

View File

@ -41,6 +41,7 @@ import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.cucadiagram.Bodier;
@ -59,10 +60,11 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.svek.SingleStrategy;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.utils.UniqueSequence;
final class EntityImpl implements ILeaf, IGroup {
@ -94,15 +96,11 @@ final class EntityImpl implements ILeaf, IGroup {
private boolean autonom = true;
// Other
private HtmlColor specificBackcolor;
private boolean nearDecoration = false;
private int xposition;
private IEntityImage svekImage;
private boolean removed = false;
private HtmlColor specificLineColor;
private UStroke specificStroke;
private USymbol symbol;
private final int rawLayout;
private char concurrentSeparator;
@ -211,14 +209,6 @@ final class EntityImpl implements ILeaf, IGroup {
return code + " " + display + "(" + leafType + ") " + xposition + " " + getUid();
}
public HtmlColor getSpecificBackColor() {
return specificBackcolor;
}
public void setSpecificBackcolor(HtmlColor color) {
this.specificBackcolor = color;
}
public final Url getUrl99() {
return url;
}
@ -512,22 +502,6 @@ final class EntityImpl implements ILeaf, IGroup {
this.removed = removed;
}
public HtmlColor getSpecificLineColor() {
return specificLineColor;
}
public void setSpecificLineColor(HtmlColor specificLinecolor) {
this.specificLineColor = specificLinecolor;
}
public UStroke getSpecificLineStroke() {
return specificStroke;
}
public void setSpecificLineStroke(UStroke specificLineStroke) {
this.specificStroke = specificLineStroke;
}
private int layer;
public int getHectorLayer() {
@ -584,4 +558,35 @@ final class EntityImpl implements ILeaf, IGroup {
return Collections.unmodifiableMap(tips);
}
private Colors colors = Colors.empty();
public Colors getColors(ISkinParam skinParam) {
return colors;
}
public void setColors(Colors colors) {
this.colors = colors;
}
public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) {
if (color != null) {
this.colors = colors.add(type, color);
}
}
// public void setSpecificLineStroke(UStroke specificLineStroke) {
// colors = colors.addSpecificLineStroke(specificLineStroke);
// }
@Deprecated
public void applyStroke(String s) {
throw new UnsupportedOperationException();
// if (s == null) {
// return;
// }
// final LinkStyle style = LinkStyle.valueOf(StringUtils.goUpperCase(s));
// colors = colors.addSpecificLineStroke(style);
// // setSpecificLineStroke(LinkStyle.getStroke(style));
}
}

View File

@ -50,8 +50,11 @@ import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.descdiagram.DescriptionDiagram;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiagram> {
@ -87,9 +90,14 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
new RegexLeaf("[%s]*"), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
new RegexLeaf("[%s]*"), //
ColorParser.exp1(), //
color().getRegex(), //
new RegexLeaf("$"));
}
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.BACK);
}
private static final String CODE_CORE = "[\\p{L}0-9_.]+|\\(\\)[%s]*[\\p{L}0-9_.]+|\\(\\)[%s]*[%g][^%g]+[%g]|:[^:]+:|\\([^()]+\\)|\\[[^\\[\\]]+\\]";
private static final String CODE = "(" + CODE_CORE + ")";
@ -217,7 +225,15 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
entity.addUrl(url);
}
entity.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final HtmlColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1));
if (lineColor != null) {
colors = colors.add(ColorType.LINE, lineColor);
}
entity.setColors(colors);
//entity.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
return CommandExecutionResult.ok();
}

View File

@ -53,6 +53,7 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.descdiagram.DescriptionDiagram;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
public class CommandCreateElementMultilines extends CommandMultilines2<DescriptionDiagram> {
@ -151,7 +152,7 @@ public class CommandCreateElementMultilines extends CommandMultilines2<Descripti
.getIHtmlColorSet()));
}
result.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
result.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
return CommandExecutionResult.ok();
}

View File

@ -34,7 +34,9 @@ package net.sourceforge.plantuml.descdiagram.command;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@ -53,7 +55,9 @@ import net.sourceforge.plantuml.cucadiagram.LinkType;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.descdiagram.DescriptionDiagram;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
@ -83,9 +87,17 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
new RegexLeaf("[%s]*"), //
getGroup("ENT2"), //
new RegexLeaf("[%s]*"), //
color().getRegex(), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("LABEL_LINK", "(?::[%s]*(.+))?$"));
}
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.LINE);
}
private LinkType getLinkType(RegexResult arg) {
final String head1 = trimAndLowerCase(arg.get("HEAD1", 0));
final String head2 = trimAndLowerCase(arg.get("HEAD2", 0));
@ -186,7 +198,7 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
private static RegexLeaf getGroup(String name) {
return new RegexLeaf(
name,
"([\\p{L}0-9_.]+|\\(\\)[%s]*[\\p{L}0-9_.]+|\\(\\)[%s]*[%g][^%g]+[%g]|:[^:]+:|(?!\\[\\*\\])\\[[^\\[\\]]+\\]|\\((?!\\*\\))[^)]+\\))(?:[%s]*(\\<\\<.*\\>\\>))?");
"([\\p{L}0-9_.]+|\\(\\)[%s]*[\\p{L}0-9_.]+|\\(\\)[%s]*[%g][^%g]+[%g]|:[^:]+:|(?!\\[\\*\\])\\[[^\\[\\]]+\\]|\\((?!\\*\\))[^)]+\\))");
}
static class Labels {
@ -213,7 +225,8 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
final Matcher m1 = p1.matcher(labelLink);
if (m1.matches()) {
firstLabel = m1.group(1);
labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils.trin(m1.group(2))));
labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils
.trin(m1.group(2))));
secondLabel = m1.group(3);
return;
}
@ -221,7 +234,8 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
final Matcher m2 = p2.matcher(labelLink);
if (m2.matches()) {
firstLabel = m2.group(1);
labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils.trin(m2.group(2))));
labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils
.trin(m2.group(2))));
secondLabel = null;
return;
}
@ -229,7 +243,8 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
final Matcher m3 = p3.matcher(labelLink);
if (m3.matches()) {
firstLabel = null;
labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils.trin(m3.group(1))));
labelLink = StringUtils.trin(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils
.trin(m3.group(1))));
secondLabel = m3.group(2);
}
}
@ -244,21 +259,18 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
if (diagram.isGroup(ent1) && diagram.isGroup(ent2)) {
return executePackageLink(diagram, arg);
}
// if (diagram.isGroup(ent1) || diagram.isGroup(ent2)) {
// return CommandExecutionResult.error("Package can be only linked to other package");
// }
final IEntity cl1 = diagram.isGroup(ent1) ? diagram.getGroup(Code.of(arg.get("ENT1", 0))) : getOrCreateLeaf(
diagram, ent1);
final IEntity cl2 = diagram.isGroup(ent2) ? diagram.getGroup(Code.of(arg.get("ENT2", 0))) : getOrCreateLeaf(
diagram, ent2);
if (arg.get("ENT1", 1) != null) {
cl1.setStereotype(new Stereotype(arg.get("ENT1", 1)));
}
if (arg.get("ENT2", 1) != null) {
cl2.setStereotype(new Stereotype(arg.get("ENT2", 1)));
}
// if (arg.get("ENT1", 1) != null) {
// cl1.setStereotype(new Stereotype(arg.get("ENT1", 1)));
// }
// if (arg.get("ENT2", 1) != null) {
// cl2.setStereotype(new Stereotype(arg.get("ENT2", 1)));
// }
final LinkType linkType = getLinkType(arg);
final Direction dir = getDirection(arg);
@ -277,7 +289,14 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
if (dir == Direction.LEFT || dir == Direction.UP) {
link = link.getInv();
}
CommandLinkClass.applyStyle(arg.getLazzy("ARROW_STYLE", 0), link);
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
colors = CommandLinkClass.applyStyle(arg.getLazzy("ARROW_STYLE", 0), link, colors);
if (arg.get("STEREOTYPE", 0) != null) {
final Stereotype stereotype = new Stereotype(arg.get("STEREOTYPE", 0));
colors = colors.applyStereotype(stereotype, diagram.getSkinParam(), ColorParam.componentArrow);
}
link.setColors(colors);
diagram.addLink(link);
return CommandExecutionResult.ok();
}
@ -285,9 +304,8 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
private ILeaf getOrCreateLeaf(DescriptionDiagram diagram, final Code code2) {
final String code = code2.getFullName();
if (code.startsWith("()")) {
return diagram.getOrCreateLeaf(
Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils.trin(code.substring(2)))),
LeafType.DESCRIPTION, USymbol.INTERFACE);
return diagram.getOrCreateLeaf(Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(StringUtils
.trin(code.substring(2)))), LeafType.DESCRIPTION, USymbol.INTERFACE);
}
final char codeChar = code.length() > 2 ? code.charAt(0) : 0;
if (codeChar == '(') {

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.utils.UniqueSequence;
public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntityDiagram> {
@ -99,7 +100,7 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
}
final String color = arg.get("COLOR", 0);
if (color != null) {
p.setSpecificBackcolor(diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
p.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
}
return CommandExecutionResult.ok();
}

View File

@ -58,7 +58,7 @@ import net.sourceforge.plantuml.version.PSystemVersion;
public class PSystemDonors extends AbstractPSystem {
public static final String DONORS = "UDfTaijIwp0CXlTw2gypmqE4XYcJbikqm8ATceX6rBMAxHIIfpygXzHkjR96j--NLThYpyZ3CqNofdHH76C3BrGaapqi9Ra-G3cLuWRcFeLeW3LjC4H6PnwbSr2wLhoP2yMHJi-F3ysOqj714hD1BaB5ayCMojHQZh3k4y80SoukpGdK4sKVO1tfq94pCv63wgkcEHHWiRyg5GypiUpCIlf0KFTNyU9JLCZa71WUCchSvwwEAYtze6jrdREEjUiM_Q1ALsVPRWkFENqSuSdoKGigRdPAVewmWxjmRkqoY8AEK8rxZdumI-oaHQXFIt_lKDjdUGNPz5rgkq7Nv31gdl8fL_qVddONgbnxuVvMiZQoMlRa8uzmdyAjm0Ct7LbpYso7N84TSvWGhj5gGdTJO_FLKp1Ll_6eNskJ_3VvZDHqPk4nO4BQabvize7VfqFJ5BEG8-Ttytivhqa_8wooMpwD-0UUmSRE";
public static final String DONORS = "UDfTKi6IsZ0ClUihVCwq7v4b7Jg1tUr0syFUHA8b0cEbjaERV7sLROCDEbaZFUaz-PMs-1_auHj5ygPqKHnZ0z-fI24Ns4fAVO1oWU81rZwLQ8Gz7J14HcTUf7DGkbQyMGl5YURd-xjsBEteO8lP8XUXuYLX2sKQBLVO3ud226ikxiC9r0lB8S0-Kj-HCokHNlLLonuAiBayGCN3IYmxivCX4DJ3GxquYGfPafxXEMEDbppLLQMbF-XQFUUgOvrwH3-gqjrDjZl2Iyu-Jl1g-Qg0YfkpChzLsC6NS1ljCX85NQ6QBXpzQBROIOjGpqT_wr37Ptq5sVHT6kTHp-GmQf_oKrxrF_9qlbFbshlq0yawo2hirKUUu6igjmBFt7HapHEo7NC5Tih9XF18hIPqdsjiVWqKJ3KSFEhNsYJ_fvmYDPtPU0oOA1r97PjzuE_PQDfYDdBbt3SVplcHz3F2BlFolE9EvqdHVUOoES-7UXAF3ct_oRnHHEa3_0KmFDNM";
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
final GraphicStrings result = getGraphicStrings();

View File

@ -46,7 +46,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.ugraphic.Shadowable;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
@ -71,7 +70,7 @@ public class ActivityBox extends AbstractTextBlock {
this.id = id;
this.label = label;
final UFont font = new UFont("Serif", Font.PLAIN, 14);
final FontConfiguration fc = new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true);
final FontConfiguration fc = FontConfiguration.blackBlueTrue(font);
tb = Display.create(label).create(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty());
}
@ -90,14 +89,14 @@ public class ActivityBox extends AbstractTextBlock {
public void drawU(UGraphic ug) {
final Dimension2D dimTotal = calculateDimension(ug.getStringBounder());
// final Dimension2D dimDesc = tb.calculateDimension(ug.getStringBounder());
final double widthTotal = dimTotal.getWidth();
final double heightTotal = dimTotal.getHeight();
final Shadowable rect = new URectangle(widthTotal, heightTotal, CORNER, CORNER);
ug = ug.apply(new UChangeColor(HtmlColorUtils.MY_RED));
ug = ug.apply(new UChangeBackColor(HtmlColorUtils.MY_YELLOW));
ug.apply(new UStroke(1.5)).draw(rect);
tb.drawU(ug.apply(new UTranslate(MARGIN, MARGIN)));
}

View File

@ -48,7 +48,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UFont;
@ -62,7 +61,7 @@ public class Tile extends AbstractTextBlock implements TextBlock {
private final int num;
private final UFont numberFont = new UFont("Monospaced", Font.PLAIN, 11);
private final FontConfiguration fc = new FontConfiguration(numberFont, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true);
private final FontConfiguration fc = FontConfiguration.blackBlueTrue(numberFont);
private final Map<TileGeometry, TileArea> geometries;
Tile(int num) {

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16528 $
* Revision $Revision: 17068 $
*
*/
package net.sourceforge.plantuml.graph;
@ -269,7 +269,9 @@ public class Elastane {
final String label = l.getLabel().get(0).toString();
if (label != null) {
// polyline.getFirst().getCenter();
final TextBlock textBlock = Display.create(label).create(new FontConfiguration(UFont.getCurrentFont(g2d), HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.LEFT, new SpriteContainerEmpty());
final TextBlock textBlock = Display.create(label).create(
FontConfiguration.blackBlueTrue(UFont.getCurrentFont(g2d)), HorizontalAlignment.LEFT,
new SpriteContainerEmpty());
textBlock.calculateDimension(StringBounderUtils.asStringBounder(g2d));
// textBlock.drawTOBEREMOVED(new ColorMapperIdentity(), g2d, center.getXint() - dim.getWidth() / 2,
// center.getYint() - dim.getHeight() / 2);

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16528 $
* Revision $Revision: 17068 $
*
*/
package net.sourceforge.plantuml.graph;
@ -59,8 +59,8 @@ class EntityImageActivity extends AbstractEntityImage {
public EntityImageActivity(IEntity entity) {
super(entity);
this.text = entity.getDisplay().create(new FontConfiguration(getFont14(),
HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty());
this.text = entity.getDisplay().create(FontConfiguration.blackBlueTrue(getFont14()),
HorizontalAlignment.CENTER, new SpriteContainerEmpty());
}
@Override
@ -97,7 +97,7 @@ class EntityImageActivity extends AbstractEntityImage {
g2d.draw(p);
// g2d.drawRect(0, 0, width - 1, height - 1);
g2d.setColor(Color.BLACK);
// text.drawTOBEREMOVED(colorMapper, g2d, xMargin, yMargin);
// text.drawTOBEREMOVED(colorMapper, g2d, xMargin, yMargin);
}
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16528 $
* Revision $Revision: 17068 $
*
*/
package net.sourceforge.plantuml.graph;
@ -38,11 +38,9 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.SpriteContainerEmpty;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.skin.CircleInterface;
@ -55,8 +53,8 @@ class EntityImageCircleInterface extends AbstractEntityImage {
public EntityImageCircleInterface(IEntity entity) {
super(entity);
this.name = entity.getDisplay().create(new FontConfiguration(getFont14(),
HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty());
this.name = entity.getDisplay().create(FontConfiguration.blackBlueTrue(getFont14()),
HorizontalAlignment.CENTER, new SpriteContainerEmpty());
this.circleInterface = new CircleInterface(getYellow(), getRed());
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16528 $
* Revision $Revision: 17068 $
*
*/
package net.sourceforge.plantuml.graph;
@ -39,11 +39,9 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.SpriteContainerEmpty;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.StringBounderUtils;
import net.sourceforge.plantuml.graphic.TextBlock;
@ -55,8 +53,8 @@ class EntityImageDefault extends AbstractEntityImage {
public EntityImageDefault(IEntity entity) {
super(entity);
this.textBlock = entity.getDisplay().create(new FontConfiguration(getFont14(), HtmlColorUtils.BLACK,
HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty());
this.textBlock = entity.getDisplay().create(FontConfiguration.blackBlueTrue(getFont14()),
HorizontalAlignment.CENTER, new SpriteContainerEmpty());
}
@Override
@ -72,6 +70,6 @@ class EntityImageDefault extends AbstractEntityImage {
final int height = (int) dim.getHeight();
g2d.setColor(Color.BLACK);
g2d.drawRect(0, 0, width, height);
// textBlock.drawTOBEREMOVED(colorMapper, g2d, 0, 0);
// textBlock.drawTOBEREMOVED(colorMapper, g2d, 0, 0);
}
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16528 $
* Revision $Revision: 17128 $
*
*/
package net.sourceforge.plantuml.graph;
@ -40,11 +40,9 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.SpriteContainerEmpty;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.StringBounderUtils;
import net.sourceforge.plantuml.graphic.TextBlock;
@ -59,8 +57,8 @@ class EntityImageNote extends AbstractEntityImage {
public EntityImageNote(IEntity entity) {
super(entity);
this.text = entity.getDisplay().create(new FontConfiguration(getFont14(),
HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty());
this.text = entity.getDisplay().create(FontConfiguration.blackBlueTrue(getFont14()),
HorizontalAlignment.CENTER, new SpriteContainerEmpty());
}
@Override
@ -92,7 +90,7 @@ class EntityImageNote extends AbstractEntityImage {
g2d.drawLine(width - xMargin, yMargin, width, yMargin);
g2d.setColor(Color.BLACK);
// text.drawTOBEREMOVED(colorMapper, g2d, xMargin, yMargin);
// text.drawTOBEREMOVED(colorMapper, g2d, xMargin, yMargin);
}
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16528 $
* Revision $Revision: 17068 $
*
*/
package net.sourceforge.plantuml.graph;
@ -57,8 +57,8 @@ class EntityImageUsecase extends AbstractEntityImage {
public EntityImageUsecase(IEntity entity) {
super(entity);
this.name = entity.getDisplay().create(new FontConfiguration(getFont14(),
HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.CENTER, new SpriteContainerEmpty());
this.name = entity.getDisplay().create(FontConfiguration.blackBlueTrue(getFont14()),
HorizontalAlignment.CENTER, new SpriteContainerEmpty());
}
@Override
@ -93,9 +93,9 @@ class EntityImageUsecase extends AbstractEntityImage {
g2d.setColor(colorMapper.getMappedColor(getRed()));
g2d.draw(ellipse);
// final Dimension2D nameDim = name.calculateDimension(StringBounderUtils.asStringBounder(g2d));
// final double posx = (w - nameDim.getWidth()) / 2;
// final double posy = (h - nameDim.getHeight()) / 2;
// final Dimension2D nameDim = name.calculateDimension(StringBounderUtils.asStringBounder(g2d));
// final double posx = (w - nameDim.getWidth()) / 2;
// final double posy = (h - nameDim.getHeight()) / 2;
// final Shape rect = new Rectangle2D.Double(posx, posy, nameDim.getWidth(), nameDim.getHeight());
// g2d.draw(rect);

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16528 $
* Revision $Revision: 17068 $
*
*/
package net.sourceforge.plantuml.graph;
@ -81,7 +81,8 @@ public class MethodsOrFieldsArea {
}
private TextBlock createTextBlock(String s) {
return Display.create(s).create(new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true), HorizontalAlignment.LEFT, new SpriteContainerEmpty());
return Display.create(s).create(FontConfiguration.blackBlueTrue(font), HorizontalAlignment.LEFT,
new SpriteContainerEmpty());
}
public void draw(UGraphic ug, double x, double y) {

View File

@ -96,8 +96,9 @@ public class DateEventUtils {
private static TextBlock getComment(final List<String> asList, HtmlColor color) {
final UFont font = new UFont("SansSerif", Font.BOLD, 14);
TextBlock comment = Display.create(asList).create(new FontConfiguration(font, color,
HtmlColorUtils.BLUE, true), HorizontalAlignment.LEFT, new SpriteContainerEmpty());
TextBlock comment = Display.create(asList).create(
new FontConfiguration(font, color, HtmlColorUtils.BLUE, true), HorizontalAlignment.LEFT,
new SpriteContainerEmpty());
comment = TextBlockUtils.withMargin(comment, 4, 4);
comment = new TextBlockBordered(comment, color);
comment = TextBlockUtils.withMargin(comment, 10, 10);

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 15932 $
* Revision $Revision: 17124 $
*
*/
package net.sourceforge.plantuml.graphic;
@ -40,6 +40,8 @@ import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.UFont;
public class FontConfiguration {
@ -55,19 +57,29 @@ public class FontConfiguration {
private final SvgAttributes svgAttributes;
private final boolean hyperlink;
private final boolean useUnderlineForHyperlink;
private final int tabSize;
public FontConfiguration(UFont font, HtmlColor color, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) {
this(font, color, hyperlinkColor, useUnderlineForHyperlink, 8);
}
public FontConfiguration(UFont font, HtmlColor color, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink,
int tabSize) {
this(getStyles(font), font, color, font, color, null, FontPosition.NORMAL, new SvgAttributes(), false,
hyperlinkColor, useUnderlineForHyperlink);
hyperlinkColor, useUnderlineForHyperlink, tabSize);
}
public static FontConfiguration blackBlueTrue(UFont font) {
return new FontConfiguration(font, HtmlColorUtils.BLACK, HtmlColorUtils.BLUE, true, 8);
}
public FontConfiguration(ISkinParam skinParam, FontParam fontParam, Stereotype stereo) {
this(SkinParamUtils.getFont(skinParam, fontParam, stereo), SkinParamUtils.getFontColor(skinParam, fontParam,
stereo), skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink());
stereo), skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink(), skinParam.getTabSize());
}
//---
// ---
public final boolean useUnderlineForHyperlink() {
return useUnderlineForHyperlink;
}
@ -76,7 +88,7 @@ public class FontConfiguration {
return hyperlinkColor;
}
//---
// ---
private static EnumSet<FontStyle> getStyles(UFont font) {
final boolean bold = font.isBold();
@ -100,7 +112,7 @@ public class FontConfiguration {
private FontConfiguration(EnumSet<FontStyle> styles, UFont motherFont, HtmlColor motherColor, UFont currentFont,
HtmlColor currentColor, HtmlColor extendedColor, FontPosition fontPosition, SvgAttributes svgAttributes,
boolean hyperlink, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink) {
boolean hyperlink, HtmlColor hyperlinkColor, boolean useUnderlineForHyperlink, int tabSize) {
this.styles = styles;
this.currentFont = currentFont;
this.motherFont = motherFont;
@ -112,6 +124,7 @@ public class FontConfiguration {
this.hyperlink = hyperlink;
this.hyperlinkColor = hyperlinkColor;
this.useUnderlineForHyperlink = useUnderlineForHyperlink;
this.tabSize = tabSize;
}
public FontConfiguration forceFont(UFont newFont, HtmlColor htmlColorForStereotype) {
@ -119,7 +132,8 @@ public class FontConfiguration {
return add(FontStyle.ITALIC);
}
FontConfiguration result = new FontConfiguration(styles, newFont, motherColor, newFont, currentColor,
extendedColor, fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink);
extendedColor, fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink,
tabSize);
if (htmlColorForStereotype != null) {
result = result.changeColor(htmlColorForStereotype);
}
@ -128,27 +142,40 @@ public class FontConfiguration {
public FontConfiguration changeAttributes(SvgAttributes toBeAdded) {
return new FontConfiguration(styles, motherFont, motherColor, currentFont, currentColor, extendedColor,
fontPosition, svgAttributes.add(toBeAdded), hyperlink, hyperlinkColor, useUnderlineForHyperlink);
fontPosition, svgAttributes.add(toBeAdded), hyperlink, hyperlinkColor, useUnderlineForHyperlink,
tabSize);
}
private FontConfiguration withHyperlink() {
return new FontConfiguration(styles, motherFont, motherColor, currentFont, currentColor, extendedColor,
fontPosition, svgAttributes, true, hyperlinkColor, useUnderlineForHyperlink);
fontPosition, svgAttributes, true, hyperlinkColor, useUnderlineForHyperlink, tabSize);
}
public FontConfiguration changeColor(HtmlColor htmlColor) {
return new FontConfiguration(styles, motherFont, motherColor, currentFont, htmlColor, extendedColor,
fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink);
fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize);
}
public FontConfiguration mute(Colors colors) {
if (colors == null) {
throw new IllegalArgumentException();
}
final HtmlColor color = colors.getColor(ColorType.TEXT);
if (color == null) {
return this;
}
return changeColor(color);
}
FontConfiguration changeExtendedColor(HtmlColor newExtendedColor) {
return new FontConfiguration(styles, motherFont, motherColor, currentFont, currentColor, newExtendedColor,
fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink);
fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize);
}
public FontConfiguration changeSize(float size) {
return new FontConfiguration(styles, motherFont, motherColor, currentFont.deriveSize(size), currentColor,
extendedColor, fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink);
extendedColor, fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink,
tabSize);
}
public FontConfiguration bigger(double delta) {
@ -157,25 +184,25 @@ public class FontConfiguration {
public FontConfiguration changeFontPosition(FontPosition fontPosition) {
return new FontConfiguration(styles, motherFont, motherColor, currentFont, currentColor, extendedColor,
fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink);
fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize);
}
public FontConfiguration changeFamily(String family) {
return new FontConfiguration(styles, motherFont, motherColor, new UFont(family, currentFont.getStyle(),
currentFont.getSize()), currentColor, extendedColor, fontPosition, svgAttributes, hyperlink,
hyperlinkColor, useUnderlineForHyperlink);
hyperlinkColor, useUnderlineForHyperlink, tabSize);
}
public FontConfiguration resetFont() {
return new FontConfiguration(styles, motherFont, motherColor, motherFont, motherColor, null,
FontPosition.NORMAL, new SvgAttributes(), hyperlink, hyperlinkColor, useUnderlineForHyperlink);
FontPosition.NORMAL, new SvgAttributes(), hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize);
}
FontConfiguration add(FontStyle style) {
final EnumSet<FontStyle> r = styles.clone();
r.add(style);
return new FontConfiguration(r, motherFont, motherColor, currentFont, currentColor, extendedColor,
fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink);
fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize);
}
public FontConfiguration italic() {
@ -201,7 +228,7 @@ public class FontConfiguration {
final EnumSet<FontStyle> r = styles.clone();
r.remove(style);
return new FontConfiguration(r, motherFont, motherColor, currentFont, currentColor, extendedColor,
fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink);
fontPosition, svgAttributes, hyperlink, hyperlinkColor, useUnderlineForHyperlink, tabSize);
}
public UFont getFont() {
@ -239,4 +266,8 @@ public class FontConfiguration {
return currentFont.getSize2D();
}
public int getTabSize() {
return tabSize;
}
}

View File

@ -28,7 +28,7 @@
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 16528 $
* Revision $Revision: 17072 $
*
*/
package net.sourceforge.plantuml.graphic;
@ -61,7 +61,7 @@ public class GraphicStrings extends AbstractTextBlock implements IEntityImage {
private final HtmlColor green;
private final HtmlColor hyperlinkColor = HtmlColorUtils.BLUE;
private final boolean useUnderlineForHyperlink = true;
private final List<String> strings;
@ -110,11 +110,15 @@ public class GraphicStrings extends AbstractTextBlock implements IEntityImage {
private TextBlock getTextBlock() {
TextBlock result = null;
if (maxLine == 0) {
result = Display.create(strings).create(new FontConfiguration(font, green, hyperlinkColor, useUnderlineForHyperlink), HorizontalAlignment.LEFT, new SpriteContainerEmpty());
result = Display.create(strings).create(
new FontConfiguration(font, green, hyperlinkColor, useUnderlineForHyperlink),
HorizontalAlignment.LEFT, new SpriteContainerEmpty());
} else {
for (int i = 0; i < strings.size(); i += maxLine) {
final int n = Math.min(i + maxLine, strings.size());
final TextBlock textBlock1 = Display.create(strings.subList(i, n)).create(new FontConfiguration(font, green, hyperlinkColor, useUnderlineForHyperlink), HorizontalAlignment.LEFT, new SpriteContainerEmpty());
final TextBlock textBlock1 = Display.create(strings.subList(i, n)).create(
new FontConfiguration(font, green, hyperlinkColor, useUnderlineForHyperlink),
HorizontalAlignment.LEFT, new SpriteContainerEmpty());
if (result == null) {
result = textBlock1;
} else {

View File

@ -245,6 +245,9 @@ public class HtmlColorSetSimple implements IHtmlColorSet {
final Color color;
if (s.equalsIgnoreCase("transparent")) {
return new HtmlColorTransparent();
} else if (s.matches("[0-9A-Fa-f]{3}")) {
s = "" + s.charAt(0) + s.charAt(0) + s.charAt(1) + s.charAt(1) + s.charAt(2) + s.charAt(2);
color = new Color(Integer.parseInt(s, 16));
} else if (s.matches("[0-9A-Fa-f]{6}")) {
color = new Color(Integer.parseInt(s, 16));
} else {
@ -259,6 +262,9 @@ public class HtmlColorSetSimple implements IHtmlColorSet {
private boolean isValid(String s, boolean acceptTransparent) {
s = removeFirstDieseAndgoLowerCase(s);
if (s.matches("[0-9A-Fa-f]{3}")) {
return true;
}
if (s.matches("[0-9A-Fa-f]{6}")) {
return true;
}

View File

@ -36,6 +36,7 @@ package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.graphic.USymbol.Margin;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UShape;
@ -48,7 +49,6 @@ class USymbolComponent2 extends USymbol {
return SkinParameter.COMPONENT2;
}
private void drawNode(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing) {
final URectangle form = new URectangle(widthTotal, heightTotal);
@ -72,7 +72,8 @@ class USymbolComponent2 extends USymbol {
return new Margin(10 + 5, 20 + 5, 15 + 5, 5 + 5);
}
public TextBlock asSmall(TextBlock name, final TextBlock label, TextBlock stereotype, final SymbolContext symbolContext) {
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
final SymbolContext symbolContext) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {
@ -80,12 +81,16 @@ class USymbolComponent2 extends USymbol {
ug = symbolContext.apply(ug);
drawNode(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing());
final Margin margin = getMargin();
label.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1())));
final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER);
tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1())));
// label.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1())));
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
final Dimension2D dim = label.calculateDimension(stringBounder);
return getMargin().addDimension(dim);
final Dimension2D dimLabel = label.calculateDimension(stringBounder);
final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder);
return getMargin().addDimension(Dimension2DDouble.mergeTB(dimStereo, dimLabel));
}
};
}

View File

@ -42,24 +42,57 @@ public class ColorParser {
private static final String COLOR_REGEXP = "#\\w+[-\\\\|/]?\\w+";
private static final String PART2 = "#(?:\\w+[-\\\\|/]?\\w+;)?(?:(?:text|back|header|line|line\\.dashed|line\\.dotted|line\\.bold)(?::\\w+[-\\\\|/]?\\w+)?(?:;|(?![\\w;:.])))+";
private static final String COLORS_REGEXP = "(?:" + COLOR_REGEXP + ")|(?:" + PART2 + ")";
private final RegexLeaf regex;
private final String name;
private final ColorType mainType;
private ColorParser(String name, RegexLeaf regex) {
private ColorParser(String name, RegexLeaf regex, ColorType mainType) {
this.regex = regex;
this.name = name;
this.mainType = mainType;
}
public HtmlColor getColor(RegexResult arg, IHtmlColorSet set) {
return set.getColorIfValid(arg.get("COLOR", 0));
public HtmlColor getLegacyColoe(RegexResult arg, IHtmlColorSet set) {
if (mainType != null) {
throw new IllegalStateException();
}
final String data = arg.get("COLOR", 0);
if (data != null && data.matches(PART2)) {
throw new IllegalStateException();
}
final HtmlColor result = set.getColorIfValid(data);
return result;
}
public Colors getColor(RegexResult arg, IHtmlColorSet set) {
if (mainType == null) {
throw new IllegalStateException();
}
final String data = arg.get(name, 0);
if (data == null) {
return Colors.empty();
}
return new Colors(data, set, mainType);
// return result.getColor(type);
}
// New Parsers
public static ColorParser simpleColor(ColorType mainType) {
return new ColorParser("COLOR", new RegexLeaf("COLOR", "(" + COLORS_REGEXP + ")?"), mainType);
}
public static ColorParser simpleColor(String optPrefix, ColorType mainType) {
return new ColorParser("COLOR", new RegexLeaf("COLOR", "(?:" + optPrefix + " (" + COLORS_REGEXP + "))?"),
mainType);
}
// Old Parsers
public static RegexLeaf exp1() {
return simpleColor().regex;
}
public static ColorParser simpleColor() {
return new ColorParser("COLOR", new RegexLeaf("COLOR", "(" + COLOR_REGEXP + ")?"));
return simpleColor(null).regex;
}
public static RegexLeaf exp2() {

View File

@ -0,0 +1,47 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2014, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 7946 $
*
*/
package net.sourceforge.plantuml.graphic.color;
public enum ColorType {
TEXT, LINE, BACK, HEADER, ARROW;
public static ColorType getType(String s) {
final int x = s.indexOf('.');
if (x != -1) {
s = s.substring(0, x);
}
final ColorType key = ColorType.valueOf(s.toUpperCase());
return key;
}
}

View File

@ -0,0 +1,189 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2014, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 7946 $
*
*/
package net.sourceforge.plantuml.graphic.color;
import java.util.EnumMap;
import java.util.Map;
import java.util.StringTokenizer;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParamColors;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.cucadiagram.LinkStyle;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke;
public class Colors {
private final Map<ColorType, HtmlColor> map = new EnumMap<ColorType, HtmlColor>(ColorType.class);
private LinkStyle lineStyle = null;
@Override
public String toString() {
return map.toString() + " " + lineStyle;
}
public static Colors empty() {
return new Colors();
}
private Colors copy() {
final Colors result = new Colors();
result.map.putAll(this.map);
result.lineStyle = this.lineStyle;
return result;
}
private Colors() {
}
public Colors(String data, IHtmlColorSet set, ColorType mainType) {
data = StringUtils.goLowerCase(data);
for (final StringTokenizer st = new StringTokenizer(data, "#;"); st.hasMoreTokens();) {
final String s = st.nextToken();
final int x = s.indexOf(':');
if (x == -1) {
if (s.contains(".") == false) {
map.put(mainType, set.getColorIfValid(s));
}
} else {
final ColorType key = ColorType.getType(s.substring(0, x));
final HtmlColor color = set.getColorIfValid(s.substring(x + 1));
map.put(key, color);
}
}
if (data.contains("line.dashed")) {
lineStyle = LinkStyle.DASHED;
} else if (data.contains("line.dotted")) {
lineStyle = LinkStyle.DOTTED;
} else if (data.contains("line.bold")) {
lineStyle = LinkStyle.BOLD;
}
}
public HtmlColor getColor(ColorType key) {
if (key == null) {
throw new IllegalArgumentException();
}
return map.get(key);
}
public HtmlColor getColor(ColorType key1, ColorType key2) {
final HtmlColor result = getColor(key1);
if (result != null) {
return result;
}
return getColor(key2);
}
public UStroke getSpecificLineStroke() {
if (lineStyle == null) {
return null;
}
return LinkStyle.getStroke(lineStyle);
}
// public Colors addSpecificLineStroke(UStroke specificStroke) {
// final Colors result = copy();
// result.specificStroke = specificStroke;
// return result;
// }
public Colors add(ColorType type, HtmlColor color) {
final Colors result = copy();
result.map.put(type, color);
return result;
}
private Colors add(ColorType colorType, Colors other) {
final Colors result = copy();
result.map.putAll(other.map);
if (other.lineStyle != null) {
result.lineStyle = other.lineStyle;
}
return result;
}
public final LinkStyle getLineStyle() {
return lineStyle;
}
public ISkinParam mute(ISkinParam skinParam) {
return new SkinParamColors(skinParam, this);
}
public Colors addLegacyStroke(String s) {
if (s == null) {
throw new IllegalArgumentException();
}
final Colors result = copy();
result.lineStyle = LinkStyle.valueOf(StringUtils.goUpperCase(s));
return result;
}
public static UGraphic applyStroke(UGraphic ug, Colors colors) {
if (colors == null) {
return ug;
}
if (colors.lineStyle == null) {
return ug;
}
return ug.apply(LinkStyle.getStroke(colors.lineStyle));
}
public Colors applyStereotype(Stereotype stereotype, ISkinParam skinParam, ColorParam param) {
if (stereotype == null) {
throw new IllegalArgumentException();
}
if (param == null) {
throw new IllegalArgumentException();
}
final ColorType colorType = param.getColorType();
if (colorType == null) {
throw new IllegalArgumentException();
}
if (getColor(colorType) != null) {
return this;
}
final Colors colors = skinParam.getColors(param, stereotype);
return add(colorType, colors);
}
}

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