mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
version 8035
This commit is contained in:
parent
703a77ee1c
commit
94542f7760
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18790 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -43,6 +43,9 @@ import net.sourceforge.plantuml.command.ProtectedCommand;
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
import net.sourceforge.plantuml.version.License;
|
||||
import net.sourceforge.plantuml.version.Version;
|
||||
|
||||
@ -87,11 +90,11 @@ public abstract class AbstractPSystem implements Diagram {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public Display getTitle() {
|
||||
public DisplayPositionned getTitle() {
|
||||
if (source == null) {
|
||||
return Display.empty();
|
||||
return new DisplayPositionned(Display.empty(), HorizontalAlignment.CENTER, VerticalAlignment.TOP);
|
||||
}
|
||||
return source.getTitle();
|
||||
return new DisplayPositionned(source.getTitle(), HorizontalAlignment.CENTER, VerticalAlignment.TOP);
|
||||
}
|
||||
|
||||
public String getWarningOrError() {
|
||||
@ -109,7 +112,7 @@ public abstract class AbstractPSystem implements Diagram {
|
||||
cmd = new ProtectedCommand(cmd);
|
||||
return cmd.execute(this, lines);
|
||||
}
|
||||
|
||||
|
||||
public boolean hasUrl() {
|
||||
return false;
|
||||
}
|
||||
|
50
src/net/sourceforge/plantuml/Annotated.java
Normal file
50
src/net/sourceforge/plantuml/Annotated.java
Normal file
@ -0,0 +1,50 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, 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: 18790 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
|
||||
public interface Annotated {
|
||||
|
||||
public DisplayPositionned getTitle();
|
||||
|
||||
public DisplayPositionned getCaption();
|
||||
|
||||
public DisplayPositionned getLegend();
|
||||
|
||||
public DisplayPositionned getHeader();
|
||||
|
||||
public DisplayPositionned getFooter();
|
||||
|
||||
}
|
134
src/net/sourceforge/plantuml/AnnotatedWorker.java
Normal file
134
src/net/sourceforge/plantuml/AnnotatedWorker.java
Normal file
@ -0,0 +1,134 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, 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: 18790 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.EntityImageLegend;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.svek.DecorateEntityImage;
|
||||
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
|
||||
|
||||
public class AnnotatedWorker {
|
||||
|
||||
private final Annotated annotated;
|
||||
private final ISkinParam skinParam;
|
||||
|
||||
public AnnotatedWorker(Annotated annotated, ISkinParam skinParam) {
|
||||
this.annotated = annotated;
|
||||
this.skinParam = skinParam;
|
||||
|
||||
}
|
||||
|
||||
public TextBlockBackcolored addAdd(TextBlock result) {
|
||||
result = addLegend(result);
|
||||
result = addTitle(result);
|
||||
result = addCaption(result);
|
||||
result = addHeaderAndFooter(result);
|
||||
return (TextBlockBackcolored) result;
|
||||
}
|
||||
|
||||
private TextBlock addLegend(TextBlock original) {
|
||||
if (DisplayPositionned.isNull(annotated.getLegend())) {
|
||||
return original;
|
||||
}
|
||||
final TextBlock text = EntityImageLegend.create(annotated.getLegend().getDisplay(), getSkinParam());
|
||||
|
||||
return DecorateEntityImage.add(original, text, annotated.getLegend().getHorizontalAlignment(), annotated
|
||||
.getLegend().getVerticalAlignment());
|
||||
}
|
||||
|
||||
private ISkinParam getSkinParam() {
|
||||
return skinParam;
|
||||
}
|
||||
|
||||
private TextBlock addCaption(TextBlock original) {
|
||||
if (DisplayPositionned.isNull(annotated.getCaption())) {
|
||||
return original;
|
||||
}
|
||||
final TextBlock text = getCaption();
|
||||
|
||||
return DecorateEntityImage.addBottom(original, text, HorizontalAlignment.CENTER);
|
||||
}
|
||||
|
||||
public TextBlock getCaption() {
|
||||
if (DisplayPositionned.isNull(annotated.getCaption())) {
|
||||
return TextBlockUtils.empty(0, 0);
|
||||
}
|
||||
return annotated
|
||||
.getCaption()
|
||||
.getDisplay()
|
||||
.create(new FontConfiguration(getSkinParam(), FontParam.CAPTION, null), HorizontalAlignment.CENTER,
|
||||
getSkinParam());
|
||||
}
|
||||
|
||||
private TextBlock addTitle(TextBlock original) {
|
||||
if (DisplayPositionned.isNull(annotated.getTitle())) {
|
||||
return original;
|
||||
}
|
||||
final TextBlock text = annotated
|
||||
.getTitle()
|
||||
.getDisplay()
|
||||
.create(new FontConfiguration(getSkinParam(), FontParam.TITLE, null), HorizontalAlignment.CENTER,
|
||||
getSkinParam());
|
||||
|
||||
return DecorateEntityImage.addTop(original, text, HorizontalAlignment.CENTER);
|
||||
// return new DecorateTextBlock(original, text, HorizontalAlignment.CENTER);
|
||||
}
|
||||
|
||||
private TextBlock addHeaderAndFooter(TextBlock original) {
|
||||
if (DisplayPositionned.isNull(annotated.getFooter()) && DisplayPositionned.isNull(annotated.getHeader())) {
|
||||
return original;
|
||||
}
|
||||
final TextBlock textFooter = DisplayPositionned.isNull(annotated.getFooter()) ? null : annotated
|
||||
.getFooter()
|
||||
.getDisplay()
|
||||
.create(new FontConfiguration(getSkinParam(), FontParam.FOOTER, null),
|
||||
annotated.getFooter().getHorizontalAlignment(), getSkinParam());
|
||||
final TextBlock textHeader = DisplayPositionned.isNull(annotated.getHeader()) ? null : annotated
|
||||
.getHeader()
|
||||
.getDisplay()
|
||||
.create(new FontConfiguration(getSkinParam(), FontParam.HEADER, null),
|
||||
annotated.getHeader().getHorizontalAlignment(), getSkinParam());
|
||||
|
||||
// return new DecorateTextBlock(original, textHeader, annotated.getHeader().getHorizontalAlignment(),
|
||||
// textFooter,
|
||||
// annotated.getFooter().getHorizontalAlignment());
|
||||
return new DecorateEntityImage(original, textHeader, annotated.getHeader().getHorizontalAlignment(),
|
||||
textFooter, annotated.getFooter().getHorizontalAlignment());
|
||||
}
|
||||
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18802 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -88,6 +88,7 @@ public enum FontParam {
|
||||
STATE_ATTRIBUTE(12, Font.PLAIN), //
|
||||
LEGEND(14, Font.PLAIN), //
|
||||
TITLE(18, Font.PLAIN), //
|
||||
CAPTION(14, Font.PLAIN), //
|
||||
SWIMLANE_TITLE(18, Font.PLAIN), //
|
||||
FOOTER(10, Font.PLAIN, "#888888", FontParamConstant.FAMILY), //
|
||||
HEADER(10, Font.PLAIN, "#888888", FontParamConstant.FAMILY), //
|
||||
|
@ -118,8 +118,6 @@ public interface ISkinParam extends ISkinSimple {
|
||||
|
||||
public boolean useOctagonForActivity(Stereotype stereotype);
|
||||
|
||||
public IHtmlColorSet getIHtmlColorSet();
|
||||
|
||||
public int groupInheritance();
|
||||
|
||||
public boolean useGuillemet();
|
||||
|
@ -33,6 +33,8 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
|
||||
|
||||
public interface ISkinSimple extends SpriteContainer {
|
||||
|
||||
public String getValue(String key);
|
||||
@ -42,5 +44,7 @@ public interface ISkinSimple extends SpriteContainer {
|
||||
public String getMonospacedFamily();
|
||||
|
||||
public int getTabSize();
|
||||
|
||||
public IHtmlColorSet getIHtmlColorSet();
|
||||
|
||||
}
|
@ -36,6 +36,7 @@ package net.sourceforge.plantuml;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.command.BlocLines;
|
||||
@ -136,4 +137,8 @@ public class NewpagedDiagram extends AbstractPSystem {
|
||||
}
|
||||
}
|
||||
|
||||
public final List<Diagram> getDiagrams() {
|
||||
return Collections.unmodifiableList(diagrams);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory;
|
||||
import net.sourceforge.plantuml.statediagram.StateDiagramFactory;
|
||||
import net.sourceforge.plantuml.sudoku.PSystemSudokuFactory;
|
||||
import net.sourceforge.plantuml.turing.PSystemTuringFactory;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.PSystemListInternalSpritesFactory;
|
||||
import net.sourceforge.plantuml.version.License;
|
||||
import net.sourceforge.plantuml.version.PSystemLicenseFactory;
|
||||
import net.sourceforge.plantuml.version.PSystemVersionFactory;
|
||||
@ -129,6 +130,7 @@ public class PSystemBuilder {
|
||||
factories.add(new PSystemListFontsFactory());
|
||||
factories.add(new PSystemOpenIconicFactory());
|
||||
factories.add(new PSystemListOpenIconicFactory());
|
||||
factories.add(new PSystemListInternalSpritesFactory());
|
||||
factories.add(new PSystemSaltFactory(DiagramType.SALT));
|
||||
factories.add(new PSystemSaltFactory(DiagramType.UML));
|
||||
factories.add(new PSystemDotFactory(DiagramType.DOT));
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18790 $
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
@ -323,7 +323,7 @@ public class PSystemError extends AbstractPSystem {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(getDescription());
|
||||
sb.append('\n');
|
||||
for (CharSequence t : getTitle()) {
|
||||
for (CharSequence t : getTitle().getDisplay()) {
|
||||
sb.append(t);
|
||||
sb.append('\n');
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18309 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -64,8 +64,8 @@ import net.sourceforge.plantuml.preproc.Defines;
|
||||
import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory;
|
||||
import net.sourceforge.plantuml.statediagram.StateDiagramFactory;
|
||||
import net.sourceforge.plantuml.swing.MainWindow2;
|
||||
import net.sourceforge.plantuml.ugraphic.SpriteGrayLevel;
|
||||
import net.sourceforge.plantuml.ugraphic.SpriteUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.SpriteGrayLevel;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.SpriteUtils;
|
||||
import net.sourceforge.plantuml.version.Version;
|
||||
|
||||
public class Run {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18291 $
|
||||
* Revision $Revision: 18309 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -62,10 +62,10 @@ import net.sourceforge.plantuml.svek.PackageStyle;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapper;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapperMonochrome;
|
||||
import net.sourceforge.plantuml.ugraphic.Sprite;
|
||||
import net.sourceforge.plantuml.ugraphic.SpriteImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.SpriteImage;
|
||||
|
||||
public class SkinParam implements ISkinParam {
|
||||
|
||||
|
@ -45,9 +45,9 @@ 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;
|
||||
import net.sourceforge.plantuml.ugraphic.Sprite;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
|
||||
|
||||
public class SkinParamDelegator implements ISkinParam {
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
import net.sourceforge.plantuml.ugraphic.Sprite;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
|
||||
|
||||
public interface SpriteContainer {
|
||||
|
||||
|
@ -34,12 +34,15 @@
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
import net.sourceforge.plantuml.creole.CommandCreoleMonospaced;
|
||||
import net.sourceforge.plantuml.ugraphic.Sprite;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorSetSimple;
|
||||
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.SpriteImage;
|
||||
|
||||
public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
|
||||
|
||||
public Sprite getSprite(String name) {
|
||||
return null;
|
||||
return SpriteImage.fromInternal(name);
|
||||
}
|
||||
|
||||
public String getValue(String key) {
|
||||
@ -62,4 +65,8 @@ public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public IHtmlColorSet getIHtmlColorSet() {
|
||||
return new HtmlColorSetSimple();
|
||||
}
|
||||
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18801 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -59,7 +59,7 @@ import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.core.UmlSource;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.cucadiagram.UnparsableGraphvizException;
|
||||
import net.sourceforge.plantuml.flashcode.FlashCodeFactory;
|
||||
import net.sourceforge.plantuml.flashcode.FlashCodeUtils;
|
||||
@ -77,41 +77,47 @@ import net.sourceforge.plantuml.svek.EmptySvgException;
|
||||
import net.sourceforge.plantuml.svek.GraphvizCrash;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
|
||||
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||
import net.sourceforge.plantuml.ugraphic.Sprite;
|
||||
import net.sourceforge.plantuml.ugraphic.UAntiAliasing;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
|
||||
import net.sourceforge.plantuml.version.Version;
|
||||
|
||||
public abstract class UmlDiagram extends AbstractPSystem implements Diagram {
|
||||
public abstract class UmlDiagram extends AbstractPSystem implements Diagram, Annotated {
|
||||
|
||||
private boolean rotation;
|
||||
private boolean hideUnlinkedData;
|
||||
|
||||
private int minwidth = Integer.MAX_VALUE;
|
||||
|
||||
private Display title = Display.NULL;
|
||||
private Display header = Display.NULL;
|
||||
private Display footer = Display.NULL;
|
||||
private Display legend = Display.NULL;
|
||||
private HorizontalAlignment legendAlignment = HorizontalAlignment.CENTER;
|
||||
private VerticalAlignment legendVerticalAlignment = VerticalAlignment.BOTTOM;
|
||||
private DisplayPositionned title = DisplayPositionned.none(HorizontalAlignment.CENTER, VerticalAlignment.TOP);
|
||||
private DisplayPositionned caption = DisplayPositionned.none(HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM);
|
||||
private DisplayPositionned header = DisplayPositionned.none(HorizontalAlignment.RIGHT, VerticalAlignment.TOP);
|
||||
private DisplayPositionned footer = DisplayPositionned.none(HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM);
|
||||
private DisplayPositionned legend = DisplayPositionned.none(HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM);
|
||||
|
||||
private HorizontalAlignment headerAlignment = HorizontalAlignment.RIGHT;
|
||||
private HorizontalAlignment footerAlignment = HorizontalAlignment.CENTER;
|
||||
private final Pragma pragma = new Pragma();
|
||||
private Scale scale;
|
||||
private Animation animation;
|
||||
|
||||
private final SkinParam skinParam = new SkinParam();
|
||||
|
||||
final public void setTitle(Display strings) {
|
||||
this.title = strings;
|
||||
final public void setTitle(DisplayPositionned title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
final public Display getTitle() {
|
||||
final public void setCaption(DisplayPositionned caption) {
|
||||
this.caption = caption;
|
||||
}
|
||||
|
||||
final public DisplayPositionned getCaption() {
|
||||
return caption;
|
||||
}
|
||||
|
||||
@Override
|
||||
final public DisplayPositionned getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@ -139,45 +145,23 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram {
|
||||
skinParam.setParam(StringUtils.goLowerCase(key), value);
|
||||
}
|
||||
|
||||
public final Display getHeader() {
|
||||
public final DisplayPositionned getHeader() {
|
||||
return header;
|
||||
}
|
||||
|
||||
public final void setHeader(Display header) {
|
||||
public final void setHeader(DisplayPositionned header) {
|
||||
this.header = header;
|
||||
}
|
||||
|
||||
public final Display getFooter() {
|
||||
public final DisplayPositionned getFooter() {
|
||||
return footer;
|
||||
}
|
||||
|
||||
public final void setFooter(Display footer) {
|
||||
public final void setFooter(DisplayPositionned footer) {
|
||||
this.footer = footer;
|
||||
}
|
||||
|
||||
public final HorizontalAlignment getHeaderAlignment() {
|
||||
return headerAlignment;
|
||||
}
|
||||
|
||||
public final void setHeaderAlignment(HorizontalAlignment headerAlignment) {
|
||||
this.headerAlignment = headerAlignment;
|
||||
}
|
||||
|
||||
public final HorizontalAlignment getFooterAlignment() {
|
||||
return footerAlignment;
|
||||
}
|
||||
|
||||
public final HorizontalAlignment getAlignmentTeoz(FontParam param) {
|
||||
if (param == FontParam.FOOTER) {
|
||||
return getFooterAlignment();
|
||||
}
|
||||
if (param == FontParam.HEADER) {
|
||||
return getHeaderAlignment();
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
public final Display getFooterOrHeaderTeoz(FontParam param) {
|
||||
public final DisplayPositionned getFooterOrHeaderTeoz(FontParam param) {
|
||||
if (param == FontParam.FOOTER) {
|
||||
return getFooter();
|
||||
}
|
||||
@ -187,10 +171,6 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
public final void setFooterAlignment(HorizontalAlignment footerAlignment) {
|
||||
this.footerAlignment = footerAlignment;
|
||||
}
|
||||
|
||||
abstract public UmlDiagramType getUmlDiagramType();
|
||||
|
||||
public Pragma getPragma() {
|
||||
@ -431,21 +411,11 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram {
|
||||
skinParam.addSprite(name, sprite);
|
||||
}
|
||||
|
||||
public final Display getLegend() {
|
||||
public final DisplayPositionned getLegend() {
|
||||
return legend;
|
||||
}
|
||||
|
||||
public final HorizontalAlignment getLegendAlignment() {
|
||||
return legendAlignment;
|
||||
}
|
||||
|
||||
public final VerticalAlignment getLegendVerticalAlignment() {
|
||||
return legendVerticalAlignment;
|
||||
}
|
||||
|
||||
public final void setLegend(Display legend, HorizontalAlignment horizontalAlignment, VerticalAlignment valignment) {
|
||||
public final void setLegend(DisplayPositionned legend) {
|
||||
this.legend = legend;
|
||||
this.legendAlignment = horizontalAlignment;
|
||||
this.legendVerticalAlignment = valignment;
|
||||
}
|
||||
}
|
||||
|
@ -37,26 +37,22 @@ import java.awt.geom.Dimension2D;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import net.sourceforge.plantuml.AnnotatedWorker;
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.Scale;
|
||||
import net.sourceforge.plantuml.UmlDiagram;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.EntityImageLegend;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlanes;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.core.DiagramDescription;
|
||||
import net.sourceforge.plantuml.core.DiagramDescriptionImpl;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockCompressed;
|
||||
@ -65,10 +61,7 @@ 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;
|
||||
import net.sourceforge.plantuml.svek.DecorateTextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
|
||||
public class ActivityDiagram3 extends UmlDiagram {
|
||||
|
||||
@ -160,16 +153,6 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
return UmlDiagramType.ACTIVITY;
|
||||
}
|
||||
|
||||
private TextBlock addLegend(TextBlock original) {
|
||||
final Display legend = getLegend();
|
||||
if (Display.isNull(legend)) {
|
||||
return original;
|
||||
}
|
||||
final TextBlock text = EntityImageLegend.create(legend, getSkinParam());
|
||||
|
||||
return DecorateEntityImage.add(original, text, getLegendAlignment(), getLegendVerticalAlignment());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
|
||||
throws IOException {
|
||||
@ -178,10 +161,8 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
// TextBlock result = swinlanes;
|
||||
TextBlock result = new TextBlockCompressed(swinlanes);
|
||||
result = new TextBlockRecentred(result);
|
||||
result = addLegend(result);
|
||||
result = addTitle(result);
|
||||
result = addHeaderAndFooter(result);
|
||||
final ISkinParam skinParam = getSkinParam();
|
||||
result = new AnnotatedWorker(this, skinParam).addAdd(result);
|
||||
final Dimension2D dim = TextBlockUtils.getMinMax(result).getDimension();
|
||||
final double margin = 10;
|
||||
final double dpiFactor = getDpiFactor(fileFormatOption, Dimension2DDouble.delta(dim, 2 * margin, 0));
|
||||
@ -206,40 +187,15 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
return dpiFactor;
|
||||
}
|
||||
|
||||
private TextBlock addTitle(TextBlock original) {
|
||||
final Display title = getTitle();
|
||||
if (Display.isNull(title)) {
|
||||
return original;
|
||||
}
|
||||
final TextBlock text = title.create(new FontConfiguration(getSkinParam(), FontParam.TITLE, null),
|
||||
HorizontalAlignment.CENTER, getSkinParam());
|
||||
|
||||
return new DecorateTextBlock(original, text, HorizontalAlignment.CENTER);
|
||||
}
|
||||
|
||||
private TextBlock addHeaderAndFooter(TextBlock original) {
|
||||
final Display footer = getFooter();
|
||||
final Display header = getHeader();
|
||||
if (Display.isNull(footer) && Display.isNull(header)) {
|
||||
return original;
|
||||
}
|
||||
final TextBlock textFooter = Display.isNull(footer) ? null : footer.create(new FontConfiguration(
|
||||
getSkinParam(), FontParam.FOOTER, null), getFooterAlignment(), getSkinParam());
|
||||
final TextBlock textHeader = Display.isNull(header) ? null : header.create(new FontConfiguration(
|
||||
getSkinParam(), FontParam.HEADER, null), getHeaderAlignment(), getSkinParam());
|
||||
|
||||
return new DecorateTextBlock(original, textHeader, getHeaderAlignment(), textFooter, getFooterAlignment());
|
||||
}
|
||||
|
||||
private final UFont getFont(FontParam fontParam) {
|
||||
final ISkinParam skinParam = getSkinParam();
|
||||
return skinParam.getFont(null, false, fontParam);
|
||||
}
|
||||
|
||||
private final HtmlColor getFontColor(FontParam fontParam, Stereotype stereotype2) {
|
||||
final ISkinParam skinParam = getSkinParam();
|
||||
return skinParam.getFontHtmlColor(stereotype2, fontParam);
|
||||
}
|
||||
// private final UFont getFont(FontParam fontParam) {
|
||||
// final ISkinParam skinParam = getSkinParam();
|
||||
// return skinParam.getFont(null, false, fontParam);
|
||||
// }
|
||||
//
|
||||
// private final HtmlColor getFontColor(FontParam fontParam, Stereotype stereotype2) {
|
||||
// final ISkinParam skinParam = getSkinParam();
|
||||
// return skinParam.getFontHtmlColor(stereotype2, fontParam);
|
||||
// }
|
||||
|
||||
public void fork() {
|
||||
final InstructionFork instructionFork = new InstructionFork(current(), nextLinkRenderer());
|
||||
@ -307,7 +263,10 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
|
||||
public CommandExecutionResult elseIf(Display test, Display whenThen, HtmlColor color) {
|
||||
if (current() instanceof InstructionIf) {
|
||||
((InstructionIf) current()).elseIf(test, whenThen, nextLinkRenderer(), color);
|
||||
final boolean ok = ((InstructionIf) current()).elseIf(test, whenThen, nextLinkRenderer(), color);
|
||||
if (ok == false) {
|
||||
return CommandExecutionResult.error("You cannot put an elseIf here");
|
||||
}
|
||||
setNextLinkRendererInternal(null);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -108,13 +108,14 @@ public class InstructionIf implements Instruction, InstructionCollection {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void elseIf(Display test, Display whenThen, LinkRendering nextLinkRenderer, HtmlColor color) {
|
||||
public boolean elseIf(Display test, Display whenThen, LinkRendering nextLinkRenderer, HtmlColor color) {
|
||||
if (elseBranch != null) {
|
||||
throw new IllegalStateException();
|
||||
return false;
|
||||
}
|
||||
this.current.setInlinkRendering(nextLinkRenderer);
|
||||
this.current = new Branch(swimlane, whenThen, test, color);
|
||||
this.thens.add(current);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
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;
|
||||
|
||||
|
@ -42,6 +42,8 @@ import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
public class InstructionStop extends MonoSwimable implements Instruction {
|
||||
|
||||
private final LinkRendering inlinkRendering;
|
||||
private Display note;
|
||||
private NotePosition notePosition;
|
||||
|
||||
public InstructionStop(Swimlane swimlane, LinkRendering inlinkRendering) {
|
||||
super(swimlane);
|
||||
@ -49,7 +51,11 @@ public class InstructionStop extends MonoSwimable implements Instruction {
|
||||
}
|
||||
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
return factory.stop(getSwimlaneIn());
|
||||
Ftile result = factory.stop(getSwimlaneIn());
|
||||
if (note != null) {
|
||||
result = factory.addNote(result, note, notePosition);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void add(Instruction other) {
|
||||
@ -65,7 +71,9 @@ public class InstructionStop extends MonoSwimable implements Instruction {
|
||||
}
|
||||
|
||||
public boolean addNote(Display note, NotePosition position) {
|
||||
throw new UnsupportedOperationException();
|
||||
this.note = note;
|
||||
this.notePosition = position;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -46,12 +46,13 @@ 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.IHtmlColorSet;
|
||||
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.sprite.Sprite;
|
||||
|
||||
public class FtileFactoryDelegator implements FtileFactory {
|
||||
|
||||
@ -200,4 +201,8 @@ public class FtileFactoryDelegator implements FtileFactory {
|
||||
return skinParam.getTabSize();
|
||||
}
|
||||
|
||||
public IHtmlColorSet getIHtmlColorSet() {
|
||||
return skinParam.getIHtmlColorSet();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -55,12 +55,13 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateIn;
|
||||
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.IHtmlColorSet;
|
||||
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;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
|
||||
|
||||
public class VCompactFactory implements FtileFactory {
|
||||
|
||||
@ -187,4 +188,8 @@ public class VCompactFactory implements FtileFactory {
|
||||
return skinParam.getTabSize();
|
||||
}
|
||||
|
||||
public IHtmlColorSet getIHtmlColorSet() {
|
||||
return skinParam.getIHtmlColorSet();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.AbstractPSystem;
|
||||
import net.sourceforge.plantuml.NewpagedDiagram;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.classdiagram.command.CommandAddMethod;
|
||||
import net.sourceforge.plantuml.classdiagram.command.CommandAllowMixing;
|
||||
@ -67,8 +68,9 @@ import net.sourceforge.plantuml.command.note.FactoryNoteOnEntityCommand;
|
||||
import net.sourceforge.plantuml.command.note.FactoryNoteOnLinkCommand;
|
||||
import net.sourceforge.plantuml.command.note.FactoryTipOnEntityCommand;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.objectdiagram.command.CommandAddData;
|
||||
import net.sourceforge.plantuml.descdiagram.command.CommandNewpage;
|
||||
import net.sourceforge.plantuml.objectdiagram.command.CommandCreateEntityObject;
|
||||
import net.sourceforge.plantuml.objectdiagram.command.CommandCreateEntityObjectMultilines;
|
||||
|
||||
@ -87,6 +89,7 @@ public class ClassDiagramFactory extends UmlDiagramFactory {
|
||||
addCommonCommands(cmds);
|
||||
|
||||
cmds.add(new CommandRankDir());
|
||||
cmds.add(new CommandNewpage(this));
|
||||
cmds.add(new CommandPage());
|
||||
cmds.add(new CommandAddMethod());
|
||||
|
||||
@ -145,8 +148,18 @@ public class ClassDiagramFactory extends UmlDiagramFactory {
|
||||
|
||||
@Override
|
||||
public String checkFinalError(AbstractPSystem sys) {
|
||||
final ClassDiagram system = (ClassDiagram) sys;
|
||||
if (sys instanceof NewpagedDiagram) {
|
||||
for (Diagram p : ((NewpagedDiagram) sys).getDiagrams()) {
|
||||
checkFinal((ClassDiagram) p);
|
||||
}
|
||||
} else {
|
||||
final ClassDiagram system = (ClassDiagram) sys;
|
||||
checkFinal(system);
|
||||
}
|
||||
return super.checkFinalError(sys);
|
||||
}
|
||||
|
||||
private void checkFinal(final ClassDiagram system) {
|
||||
for (Link link : system.getLinks()) {
|
||||
final int len = link.getLength();
|
||||
if (len == 1) {
|
||||
@ -157,23 +170,7 @@ public class ClassDiagramFactory extends UmlDiagramFactory {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
system.applySingleStrategy();
|
||||
|
||||
// for (IGroup g : system.getGroups(true)) {
|
||||
// final List<ILeaf> standalones = new ArrayList<ILeaf>();
|
||||
// for (ILeaf ent : g.getLeafsDirect()) {
|
||||
// if (system.isStandalone(ent)) {
|
||||
// standalones.add(ent);
|
||||
// }
|
||||
// }
|
||||
// if (standalones.size() < 3) {
|
||||
// continue;
|
||||
// }
|
||||
// final Magma magma = new Magma(system, standalones);
|
||||
// magma.putInSquare();
|
||||
// }
|
||||
return super.checkFinalError(system);
|
||||
}
|
||||
|
||||
}
|
||||
|
57
src/net/sourceforge/plantuml/command/CommandCaption.java
Normal file
57
src/net/sourceforge/plantuml/command/CommandCaption.java
Normal file
@ -0,0 +1,57 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, 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: 18788 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.UmlDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
|
||||
public class CommandCaption extends SingleLineCommand<UmlDiagram> {
|
||||
|
||||
public CommandCaption() {
|
||||
super("(?i)^caption(?:[%s]*:[%s]*|[%s]+)(.*[\\p{L}0-9_.].*)$");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(UmlDiagram diagram, List<String> arg) {
|
||||
diagram.setCaption(new DisplayPositionned(Display.getWithNewlines(arg.get(0)), HorizontalAlignment.CENTER,
|
||||
VerticalAlignment.BOTTOM));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18789 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.command;
|
||||
@ -38,7 +38,9 @@ import java.util.List;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.UmlDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
|
||||
public class CommandFooter extends SingleLineCommand<UmlDiagram> {
|
||||
|
||||
@ -49,11 +51,8 @@ public class CommandFooter extends SingleLineCommand<UmlDiagram> {
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(UmlDiagram diagram, List<String> arg) {
|
||||
final String align = arg.get(0);
|
||||
if (align != null) {
|
||||
diagram.setFooterAlignment(HorizontalAlignment.valueOf(StringUtils.goUpperCase(align)));
|
||||
}
|
||||
diagram.setFooter(Display.getWithNewlines(arg.get(1)));
|
||||
diagram.setFooter(new DisplayPositionned(Display.getWithNewlines(arg.get(1)), HorizontalAlignment.fromString(
|
||||
align, HorizontalAlignment.CENTER), VerticalAlignment.BOTTOM));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,17 +28,18 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18789 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.command;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.UmlDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
|
||||
public class CommandHeader extends SingleLineCommand<UmlDiagram> {
|
||||
|
||||
@ -49,11 +50,8 @@ public class CommandHeader extends SingleLineCommand<UmlDiagram> {
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(UmlDiagram diagram, List<String> arg) {
|
||||
final String align = arg.get(0);
|
||||
if (align != null) {
|
||||
diagram.setHeaderAlignment(HorizontalAlignment.valueOf(StringUtils.goUpperCase(align)));
|
||||
}
|
||||
diagram.setHeader(Display.getWithNewlines(arg.get(1)));
|
||||
diagram.setHeader(new DisplayPositionned(Display.getWithNewlines(arg.get(1)), HorizontalAlignment.fromString(
|
||||
align, HorizontalAlignment.RIGHT), VerticalAlignment.TOP));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18789 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.command;
|
||||
@ -38,7 +38,9 @@ import java.util.regex.Matcher;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.UmlDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
|
||||
public class CommandMultilinesFooter extends CommandMultilines<UmlDiagram> {
|
||||
|
||||
@ -58,13 +60,11 @@ public class CommandMultilinesFooter extends CommandMultilines<UmlDiagram> {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
final String align = m.group(1);
|
||||
if (align != null) {
|
||||
diagram.setFooterAlignment(HorizontalAlignment.valueOf(StringUtils.goUpperCase(align)));
|
||||
}
|
||||
lines = lines.subExtract(1, 1);
|
||||
final Display strings = lines.toDisplay();
|
||||
if (strings.size() > 0) {
|
||||
diagram.setFooter(strings);
|
||||
diagram.setFooter(new DisplayPositionned(strings, HorizontalAlignment.fromString(align,
|
||||
HorizontalAlignment.CENTER), VerticalAlignment.BOTTOM));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
return CommandExecutionResult.error("Empty footer");
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18789 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.command;
|
||||
@ -38,20 +38,21 @@ import java.util.regex.Matcher;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.UmlDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
|
||||
public class CommandMultilinesHeader extends CommandMultilines<UmlDiagram> {
|
||||
|
||||
public CommandMultilinesHeader() {
|
||||
super("(?i)^(?:(left|right|center)?[%s]*)header$");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPatternEnd() {
|
||||
return "(?i)^end[%s]?header$";
|
||||
}
|
||||
|
||||
|
||||
public CommandExecutionResult execute(final UmlDiagram diagram, BlocLines lines) {
|
||||
lines = lines.trim(false);
|
||||
final Matcher m = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
|
||||
@ -59,13 +60,11 @@ public class CommandMultilinesHeader extends CommandMultilines<UmlDiagram> {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
final String align = m.group(1);
|
||||
if (align != null) {
|
||||
diagram.setHeaderAlignment(HorizontalAlignment.valueOf(StringUtils.goUpperCase(align)));
|
||||
}
|
||||
lines = lines.subExtract(1, 1);
|
||||
final Display strings = lines.toDisplay();
|
||||
if (strings.size() > 0) {
|
||||
diagram.setHeader(strings);
|
||||
diagram.setHeader(new DisplayPositionned(strings, HorizontalAlignment.fromString(align,
|
||||
HorizontalAlignment.RIGHT), VerticalAlignment.TOP));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
return CommandExecutionResult.error("Empty header");
|
||||
|
@ -39,6 +39,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.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
|
||||
@ -76,7 +77,7 @@ public class CommandMultilinesLegend extends CommandMultilines2<UmlDiagram> {
|
||||
if (alignment == null) {
|
||||
alignment = HorizontalAlignment.CENTER;
|
||||
}
|
||||
diagram.setLegend(strings, alignment, valignment);
|
||||
diagram.setLegend(new DisplayPositionned(strings, alignment, valignment));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
return CommandExecutionResult.error("No legend defined");
|
||||
|
@ -28,13 +28,16 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18788 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.command;
|
||||
|
||||
import net.sourceforge.plantuml.UmlDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
|
||||
public class CommandMultilinesTitle extends CommandMultilines<UmlDiagram> {
|
||||
|
||||
@ -52,7 +55,7 @@ public class CommandMultilinesTitle extends CommandMultilines<UmlDiagram> {
|
||||
lines = lines.removeEmptyColumns();
|
||||
final Display strings = lines.toDisplay();
|
||||
if (strings.size() > 0) {
|
||||
diagram.setTitle(strings);
|
||||
diagram.setTitle(new DisplayPositionned(strings, HorizontalAlignment.CENTER, VerticalAlignment.TOP));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
return CommandExecutionResult.error("No title defined");
|
||||
|
@ -46,7 +46,7 @@ import net.sourceforge.plantuml.UmlDiagram;
|
||||
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.ugraphic.SpriteImage;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.SpriteImage;
|
||||
import net.sourceforge.plantuml.version.PSystemVersion;
|
||||
|
||||
public class CommandSpriteFile extends SingleLineCommand2<UmlDiagram> {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18788 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.command;
|
||||
@ -37,6 +37,9 @@ import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.UmlDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
|
||||
public class CommandTitle extends SingleLineCommand<UmlDiagram> {
|
||||
|
||||
@ -46,7 +49,8 @@ public class CommandTitle extends SingleLineCommand<UmlDiagram> {
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(UmlDiagram diagram, List<String> arg) {
|
||||
diagram.setTitle(Display.getWithNewlines(arg.get(0)));
|
||||
diagram.setTitle(new DisplayPositionned(Display.getWithNewlines(arg.get(0)), HorizontalAlignment.CENTER,
|
||||
VerticalAlignment.TOP));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
|
@ -43,8 +43,8 @@ import net.sourceforge.plantuml.command.note.SingleMultiFactoryCommand;
|
||||
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.ugraphic.Sprite;
|
||||
import net.sourceforge.plantuml.ugraphic.SpriteGrayLevel;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.SpriteGrayLevel;
|
||||
|
||||
public final class FactorySpriteCommand implements SingleMultiFactoryCommand<UmlDiagram> {
|
||||
|
||||
|
@ -264,6 +264,7 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory {
|
||||
cmds.add(new CommandMultilinesComment());
|
||||
cmds.add(new CommandPragma());
|
||||
cmds.add(new CommandTitle());
|
||||
cmds.add(new CommandCaption());
|
||||
cmds.add(new CommandMultilinesTitle());
|
||||
cmds.add(new CommandMultilinesLegend());
|
||||
|
||||
|
@ -46,5 +46,5 @@ interface Atom extends UShape {
|
||||
public double getStartingAltitude(StringBounder stringBounder);
|
||||
|
||||
public void drawU(UGraphic ug);
|
||||
|
||||
|
||||
}
|
||||
|
@ -109,6 +109,6 @@ class AtomEmbededSystem implements Atom {
|
||||
private Diagram getSystem() throws IOException, InterruptedException {
|
||||
final BlockUml blockUml = new BlockUml(lines2, 0);
|
||||
return blockUml.getDiagram();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -50,7 +50,6 @@ 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;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
@ -149,5 +148,6 @@ public class AtomImg implements Atom {
|
||||
ug.draw(new UImage(image));
|
||||
// tileImage.drawU(ug.apply(new UTranslate(0, -h)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -69,5 +69,5 @@ public class AtomOpenIcon implements Atom {
|
||||
public void drawU(UGraphic ug) {
|
||||
asTextBlock().drawU(ug);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -61,5 +61,5 @@ public class AtomSprite implements Atom {
|
||||
public void drawU(UGraphic ug) {
|
||||
sprite.drawU(ug);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -42,18 +42,27 @@ import java.util.Map;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
|
||||
import net.sourceforge.plantuml.ugraphic.UChangeColor;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.ULine;
|
||||
import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class AtomTable implements Atom {
|
||||
|
||||
class Line {
|
||||
private final List<Atom> cells = new ArrayList<Atom>();
|
||||
private final List<HtmlColor> cellsBackColor = new ArrayList<HtmlColor>();
|
||||
private final HtmlColor lineBackColor;
|
||||
|
||||
public void add(Atom cell) {
|
||||
private Line(HtmlColor lineBackColor) {
|
||||
this.lineBackColor = lineBackColor;
|
||||
}
|
||||
|
||||
public void add(Atom cell, HtmlColor cellBackColor) {
|
||||
cells.add(cell);
|
||||
cellsBackColor.add(cellBackColor);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
@ -87,8 +96,27 @@ public class AtomTable implements Atom {
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
initMap(ug.getStringBounder());
|
||||
for (Line line : lines) {
|
||||
for (Atom cell : line.cells) {
|
||||
for (int i = 0; i < getNbLines(); i++) {
|
||||
final Line line = lines.get(i);
|
||||
if (line.lineBackColor != null) {
|
||||
final double y1 = getStartingY(i);
|
||||
final double y2 = getStartingY(i + 1);
|
||||
final double x1 = getStartingX(0);
|
||||
final double x2 = getStartingX(getNbCols());
|
||||
ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(line.lineBackColor))
|
||||
.apply(new UTranslate(x1, y1)).draw(new URectangle(x2 - x1, y2 - y1));
|
||||
}
|
||||
for (int j = 0; j < getNbCols(); j++) {
|
||||
final Atom cell = line.cells.get(j);
|
||||
final HtmlColor cellBackColor = line.cellsBackColor.get(j);
|
||||
if (cellBackColor != null) {
|
||||
final double y1 = getStartingY(i);
|
||||
final double y2 = getStartingY(i + 1);
|
||||
final double x1 = getStartingX(j);
|
||||
final double x2 = getStartingX(j + 1);
|
||||
ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(cellBackColor))
|
||||
.apply(new UTranslate(x1, y1)).draw(new URectangle(x2 - x1, y2 - y1));
|
||||
}
|
||||
final Position pos = positions.get(cell);
|
||||
cell.drawU(ug.apply(pos.getTranslate()));
|
||||
}
|
||||
@ -210,13 +238,12 @@ public class AtomTable implements Atom {
|
||||
return lines.get(lines.size() - 1);
|
||||
}
|
||||
|
||||
public void addCell(Atom cell) {
|
||||
lastLine().add(cell);
|
||||
public void addCell(Atom cell, HtmlColor cellBackColor) {
|
||||
lastLine().add(cell, cellBackColor);
|
||||
positions.clear();
|
||||
}
|
||||
|
||||
public void newLine() {
|
||||
lines.add(new Line());
|
||||
public void newLine(HtmlColor lineBackColor) {
|
||||
lines.add(new Line(lineBackColor));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -255,4 +255,5 @@ public class AtomText implements Atom {
|
||||
public final String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -98,5 +98,5 @@ public class AtomTree implements Atom {
|
||||
this.cells.add(cell);
|
||||
this.levels.put(cell, level);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -63,5 +63,5 @@ class AtomWithMargin implements Atom {
|
||||
public void drawU(UGraphic ug) {
|
||||
atom.drawU(ug.apply(new UTranslate(0, marginY1)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -104,6 +104,6 @@ public class Bullet implements Atom {
|
||||
private Dimension2D calculateDimension1(StringBounder stringBounder) {
|
||||
return new Dimension2DDouble(getWidth(stringBounder), 3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -102,5 +102,5 @@ public class CreoleHorizontalLine implements Atom {
|
||||
public double getStartingAltitude(StringBounder stringBounder) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class CreoleParser {
|
||||
}
|
||||
|
||||
private Stripe createStripe(String line, CreoleContext context, Stripe lastStripe) {
|
||||
if (lastStripe instanceof StripeTable && line.startsWith("|") && line.endsWith("|")) {
|
||||
if (lastStripe instanceof StripeTable && isTableLine(line)) {
|
||||
final StripeTable table = (StripeTable) lastStripe;
|
||||
table.analyzeAndAddNormal(line);
|
||||
return null;
|
||||
@ -70,7 +70,7 @@ public class CreoleParser {
|
||||
final StripeTree tree = (StripeTree) lastStripe;
|
||||
tree.analyzeAndAdd(line);
|
||||
return null;
|
||||
} else if (line.startsWith("|=") && line.endsWith("|")) {
|
||||
} else if (isTableLine(line)) {
|
||||
return new StripeTable(fontConfiguration, skinParam, line);
|
||||
} else if (isTreeStart(line)) {
|
||||
return new StripeTree(fontConfiguration, skinParam, line);
|
||||
@ -79,6 +79,14 @@ public class CreoleParser {
|
||||
.createStripe(context);
|
||||
}
|
||||
|
||||
private static boolean isTableLine(String line) {
|
||||
return line.matches("^(\\<#\\w+\\>)?\\|(\\=)?.*\\|$");
|
||||
}
|
||||
|
||||
public static boolean doesStartByColor(String line) {
|
||||
return line.matches("^(\\<#\\w+\\>).*");
|
||||
}
|
||||
|
||||
public static boolean isTreeStart(String line) {
|
||||
// return false;
|
||||
return line.startsWith("|_");
|
||||
|
@ -162,4 +162,5 @@ public class SheetBlock1 extends AbstractTextBlock implements TextBlock, Atom, S
|
||||
public double getEndingX(StringBounder stringBounder, double y) {
|
||||
return calculateDimension(stringBounder).getWidth();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -77,4 +77,5 @@ public class SheetBlock2 extends AbstractTextBlock implements TextBlock, Atom {
|
||||
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) {
|
||||
return block.getInnerPosition(member, stringBounder);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -44,13 +44,13 @@ import net.sourceforge.plantuml.graphic.FontPosition;
|
||||
import net.sourceforge.plantuml.graphic.FontStyle;
|
||||
import net.sourceforge.plantuml.graphic.ImgValign;
|
||||
import net.sourceforge.plantuml.openiconic.OpenIcon;
|
||||
import net.sourceforge.plantuml.ugraphic.Sprite;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
|
||||
import net.sourceforge.plantuml.utils.CharHidder;
|
||||
|
||||
public class StripeSimple implements Stripe {
|
||||
|
||||
final private List<Atom> atoms = new ArrayList<Atom>();
|
||||
private final List<Command> commands = new ArrayList<Command>();
|
||||
final private List<Command> commands = new ArrayList<Command>();
|
||||
|
||||
private FontConfiguration fontConfiguration;
|
||||
|
||||
|
@ -41,6 +41,7 @@ import java.util.StringTokenizer;
|
||||
import net.sourceforge.plantuml.ISkinSimple;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
|
||||
public class StripeTable implements Stripe {
|
||||
|
||||
@ -74,10 +75,39 @@ public class StripeTable implements Stripe {
|
||||
return new SheetBlock1(sheet, 0, padding);
|
||||
}
|
||||
|
||||
private HtmlColor getBackColor(String line) {
|
||||
if (CreoleParser.doesStartByColor(line)) {
|
||||
final int idx1 = line.indexOf('#');
|
||||
final int idx2 = line.indexOf('>');
|
||||
if (idx2 == -1) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
final String color = line.substring(idx1, idx2);
|
||||
return skinParam.getIHtmlColorSet().getColorIfValid(color);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String withouBackColor(String line) {
|
||||
final int idx2 = line.indexOf('>');
|
||||
if (idx2 == -1) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return line.substring(idx2 + 1);
|
||||
}
|
||||
|
||||
private void analyzeAndAddInternal(String line, Mode mode) {
|
||||
table.newLine();
|
||||
HtmlColor lineBackColor = getBackColor(line);
|
||||
if (lineBackColor != null) {
|
||||
line = withouBackColor(line);
|
||||
}
|
||||
table.newLine(lineBackColor);
|
||||
for (final StringTokenizer st = new StringTokenizer(line, "|"); st.hasMoreTokens();) {
|
||||
String v = st.nextToken();
|
||||
HtmlColor cellBackColor = getBackColor(v);
|
||||
if (cellBackColor != null) {
|
||||
v = withouBackColor(v);
|
||||
}
|
||||
if (mode == Mode.HEADER && v.startsWith("=")) {
|
||||
v = v.substring(1);
|
||||
}
|
||||
@ -89,7 +119,7 @@ public class StripeTable implements Stripe {
|
||||
cell.analyzeAndAdd(s);
|
||||
cells.add(cell);
|
||||
}
|
||||
table.addCell(asAtom(cells, skinParam.getPadding()));
|
||||
table.addCell(asAtom(cells, skinParam.getPadding()), cellBackColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,76 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, 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: 8218 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
|
||||
public class DisplayPositionned {
|
||||
|
||||
private final Display display;
|
||||
private final HorizontalAlignment horizontalAlignment;
|
||||
private final VerticalAlignment verticalAlignment;
|
||||
|
||||
public DisplayPositionned(Display display, HorizontalAlignment horizontalAlignment,
|
||||
VerticalAlignment verticalAlignment) {
|
||||
this.display = display;
|
||||
this.horizontalAlignment = horizontalAlignment;
|
||||
this.verticalAlignment = verticalAlignment;
|
||||
}
|
||||
|
||||
public static DisplayPositionned none(HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment) {
|
||||
return new DisplayPositionned(Display.NULL, horizontalAlignment, verticalAlignment);
|
||||
}
|
||||
|
||||
public final Display getDisplay() {
|
||||
return display;
|
||||
}
|
||||
|
||||
public final HorizontalAlignment getHorizontalAlignment() {
|
||||
return horizontalAlignment;
|
||||
}
|
||||
|
||||
public final VerticalAlignment getVerticalAlignment() {
|
||||
return verticalAlignment;
|
||||
}
|
||||
|
||||
public static boolean isNull(DisplayPositionned data) {
|
||||
return data == null || Display.isNull(data.display);
|
||||
}
|
||||
|
||||
public boolean hasUrl() {
|
||||
return display.hasUrl();
|
||||
}
|
||||
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18823 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram;
|
||||
@ -245,6 +245,25 @@ public class Link implements Hideable, Removeable {
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isReallyGroup(IEntity ent) {
|
||||
if (ent.isGroup() == false) {
|
||||
return false;
|
||||
}
|
||||
final IGroup group = (IGroup) ent;
|
||||
return group.getChildren().size() + group.getLeafsDirect().size() > 0;
|
||||
}
|
||||
|
||||
public LinkType getTypePatchCluster() {
|
||||
LinkType result = getType();
|
||||
if (isReallyGroup(getEntity1())) {
|
||||
result = result.withoutDecors2();
|
||||
}
|
||||
if (isReallyGroup(getEntity2())) {
|
||||
result = result.withoutDecors1();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private LinkType getTypeSpecialForPrinting() {
|
||||
if (opale) {
|
||||
return new LinkType(LinkDecor.NONE, LinkDecor.NONE);
|
||||
|
@ -52,6 +52,14 @@ public class LinkType {
|
||||
this(hat1, decor1, LinkStyle.NORMAL, LinkMiddleDecor.NONE, decor2, hat2);
|
||||
}
|
||||
|
||||
public LinkType withoutDecors1() {
|
||||
return new LinkType(hat1, LinkDecor.NONE, style, middleDecor, decor2, hat2);
|
||||
}
|
||||
|
||||
public LinkType withoutDecors2() {
|
||||
return new LinkType(hat1, decor1, style, middleDecor, LinkDecor.NONE, hat2);
|
||||
}
|
||||
|
||||
// public boolean contains(LinkDecor decors) {
|
||||
// return decor1 == decors || decor2 == decors;
|
||||
// }
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18291 $
|
||||
* Revision $Revision: 18317 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram;
|
||||
@ -48,12 +48,13 @@ import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
|
||||
import net.sourceforge.plantuml.svek.PackageStyle;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.SpriteUtils;
|
||||
|
||||
public class Stereotype implements CharSequence, Hideable {
|
||||
private final static Pattern circleChar = MyPattern
|
||||
.cmpile("\\<\\<[%s]*\\(?(\\S)[%s]*,[%s]*(#[0-9a-fA-F]{6}|\\w+)[%s]*(?:[),](.*?))?\\>\\>");
|
||||
private final static Pattern circleSprite = MyPattern
|
||||
.cmpile("\\<\\<[%s]*\\(?\\$([-\\p{L}0-9_/]+)[%s]*(?:,[%s]*(#[0-9a-fA-F]{6}|\\w+))?[%s]*(?:[),](.*?))?\\>\\>");
|
||||
private final static Pattern circleSprite = MyPattern.cmpile("\\<\\<[%s]*\\(?\\$(" + SpriteUtils.SPRITE_NAME
|
||||
+ ")[%s]*(?:,[%s]*(#[0-9a-fA-F]{6}|\\w+))?[%s]*(?:[),](.*?))?\\>\\>");
|
||||
|
||||
private final String label;
|
||||
private final HtmlColor htmlColor;
|
||||
|
@ -59,8 +59,8 @@ public class CommandNewpage extends SingleLineCommand2<AbstractPSystem> {
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(AbstractPSystem diagram, RegexResult arg) {
|
||||
// NewpagedDiagram result = NewpagedDiagram.newpage(diagram, factory.createEmptyDiagram());
|
||||
NewpagedDiagram result = new NewpagedDiagram(diagram, factory.createEmptyDiagram());
|
||||
// NewpagedDiagram result = NewpagedDiagram.newpage(diagram, factory.createEmptyDiagram());
|
||||
return CommandExecutionResult.newDiagram(result);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ import net.sourceforge.plantuml.version.PSystemVersion;
|
||||
|
||||
public class PSystemDonors extends AbstractPSystem {
|
||||
|
||||
public static final String DONORS = "UDfTKa5osp0ClECLF6lIHoXMwuvi9ncxxI4tM48is3IXa9HRwMszzME5qigYZHDtW0LsGUGs-n_auOKYUPExA8wnWc-KpI5dMCiCVO1yek8UbdvEKGyxscE8ZCuyIUCWTxLuinIA0utFjpUjcChHmHgJGIv2mHDW2_dSMYwmwsO9FImvkmqdK4ugkm2xI6r3pYn4MlLNJ7CemEfyHnKF2x7ip5QwG51sT_diA6fa0Yt39b6DvnJggDpIBtIrhdFHi7OzeE_LwVPgsntWALKV1tYsV552mTL9bLypxE1pkBPsYOYCBb0CPuw-Dsjif4OenwM_DgZjaxgCxFnT6gTUr-GmQftgKrtbF_5qkd7bwXlumMHjP9Nsx2CFy7LErm8RhXgovX7Pzga3EwHYGhYNLXAwJoLMxnq5KtHxZ_grThR_GuwHgiQiF0QS9Hr8BpRvm9_ZeMc9MSc5qxlvk9plitz6s2QtF8wuyNbKTfjScPp6HJsAHuUsVJ2l557Q05lrYxusAnv_6hvOyUFwDtz-MwluBytvuOe0";
|
||||
public static final String DONORS = "UDfTKa6MsZ0CtUiKNkTD3v4XBNq1PlgWxM9sWcY8m5YfxT26itNNYrMX3JPePJtfI__BlxJ5_o0FNoYIDwMBuXXty9MA57A2fQJK1oWdA6vXxbE91jZG5aDaTEP5MWUbQyIRkL2yqFXyVzUEgHqTB35Rv29KF2LieKoZvGoRFb4OOCx5VJY1UcBP1zX4wbfoPYRIgRvgsaC15gS7g7YOYMLdrj87Whf_g1S7KI5JqZ6iCjPuobDTLLhwXQxHSyvQrgbxz8CgNTzakpsyvEpZ1LujdnLGyUwep6yLTl0nt4QxZ4H1PwWk9uv-C4jifK6enwE_jQZZixw2RFekZUEWPt8OjK_vAQ_w7tawtgbopLrwHR8EiWfxzP4ly3cL6u4LxrgovXdP3ha2Uyd9XF18hIPq7shS_UWfcAhVUjIljKd-Tpb4shLcuJ5WehGdTMpsWJz7escBMSYPSzzSdVCjwMU4TURbSSMTpeEYkynbSXmFzImU7ThkoRnHHEa2h5Kl-iOiUFnf-6J5Z-TV_VbjxTK3oHysywgwwo_hGETg";
|
||||
|
||||
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
|
||||
final GraphicStrings result = getGraphicStrings();
|
||||
|
@ -517,6 +517,9 @@ public class EpsGraphics {
|
||||
}
|
||||
|
||||
protected void appendColor(Color c) {
|
||||
if (c == null) {
|
||||
return;
|
||||
}
|
||||
final double r = c.getRed() / 255.0;
|
||||
final double g = c.getGreen() / 255.0;
|
||||
final double b = c.getBlue() / 255.0;
|
||||
@ -524,6 +527,9 @@ public class EpsGraphics {
|
||||
}
|
||||
|
||||
protected void appendColorShort(Color c) {
|
||||
if (c == null) {
|
||||
return;
|
||||
}
|
||||
final double r = c.getRed() / 255.0;
|
||||
final double g = c.getGreen() / 255.0;
|
||||
final double b = c.getBlue() / 255.0;
|
||||
|
@ -73,7 +73,7 @@ public class DateEventUtils {
|
||||
"a character on a keyboard and seen it show up on their",
|
||||
"own computer's screen right in front of them.\"", "\t\t\t\t\t\t\t\t\t\t<i>Steve Wozniak");
|
||||
return TextBlockUtils.mergeTB(textBlock, getComment(asList, color), HorizontalAlignment.LEFT);
|
||||
} else if ("01-07".equals(today) || "01-08".equals(today)) {
|
||||
} else if ("01-07".equals(today)) {
|
||||
return addCharlie(textBlock);
|
||||
}
|
||||
|
||||
|
@ -28,15 +28,17 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18789 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
|
||||
public enum HorizontalAlignment {
|
||||
|
||||
LEFT, CENTER, RIGHT;
|
||||
|
||||
|
||||
public static HorizontalAlignment fromString(String s) {
|
||||
if (LEFT.name().equalsIgnoreCase(s)) {
|
||||
return LEFT;
|
||||
@ -50,4 +52,19 @@ public enum HorizontalAlignment {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static HorizontalAlignment fromString(String s, HorizontalAlignment defaultValue) {
|
||||
if (defaultValue == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (s == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
s = StringUtils.goUpperCase(s);
|
||||
final HorizontalAlignment result = fromString(s);
|
||||
if (result == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -162,13 +162,13 @@ public class QuoteUtils {
|
||||
"Take it easy, don't push the little button on the joystick!", //
|
||||
"I'm a very private person.", //
|
||||
"To sculpt an elephant from a big block of marble, just knock away all the bits that don't look like an elephant.", //
|
||||
"Who said you could talk to me? Have I got something on my face ?"
|
||||
"Who said you could talk to me? Have I got something on my face ?", //
|
||||
"We've been through worst", //
|
||||
"United we stand", //
|
||||
"We shall never surrender", //
|
||||
"Absolute honesty isn't always the most diplomatic nor the safest form of communication with emotional beings.", //
|
||||
"Humor: seventy-five percent. [Confirmed] Self destruct sequence in T minus 10, 9... " //
|
||||
);
|
||||
// We've been through worst
|
||||
// United we stand
|
||||
// We shall never surrender
|
||||
// Absolute honesty isn't always the most diplomatic nor the safest form of communication with emotional beings.
|
||||
// Humor: seventy-five percent. [Confirmed] Self destruct sequence in T minus 10, 9...
|
||||
private QuoteUtils() {
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18309 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
@ -40,9 +40,9 @@ import java.util.List;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.SpriteContainer;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.ugraphic.Sprite;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
|
||||
|
||||
class SingleLine extends AbstractTextBlock implements Line {
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18317 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
@ -41,8 +41,9 @@ import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.sourceforge.plantuml.command.regex.MyPattern;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.command.regex.MyPattern;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.SpriteUtils;
|
||||
|
||||
public class Splitter {
|
||||
|
||||
@ -58,8 +59,8 @@ public class Splitter {
|
||||
public static final String fontFamilyPattern = "\\<font[\\s:]+([^>]+)/?\\>";
|
||||
public static final String svgAttributePattern = "\\<text[\\s:]+([^>]+)/?\\>";
|
||||
public static final String openiconPattern = "\\<&([-\\w]+)\\>";
|
||||
public static final String spritePattern = "\\<\\$[\\p{L}0-9_]+\\>";
|
||||
public static final String spritePattern2 = "\\<\\$([\\p{L}0-9_]+)\\>";
|
||||
public static final String spritePattern = "\\<\\$" + SpriteUtils.SPRITE_NAME + "\\>";
|
||||
public static final String spritePattern2 = "\\<\\$(" + SpriteUtils.SPRITE_NAME + ")\\>";
|
||||
static final String htmlTag;
|
||||
|
||||
static final String linkPattern = "\\[\\[([^\\[\\]]+)\\]\\]";
|
||||
|
@ -35,11 +35,12 @@ package net.sourceforge.plantuml.graphic;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
|
||||
import net.sourceforge.plantuml.ugraphic.MinMax;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class TextBlockRecentred extends AbstractTextBlock implements TextBlock {
|
||||
public class TextBlockRecentred extends AbstractTextBlock implements TextBlockBackcolored {
|
||||
|
||||
private final TextBlock textBlock;
|
||||
|
||||
@ -57,4 +58,8 @@ public class TextBlockRecentred extends AbstractTextBlock implements TextBlock {
|
||||
return minMax.getDimension();
|
||||
}
|
||||
|
||||
public HtmlColor getBackcolor() {
|
||||
return ((TextBlockBackcolored) textBlock).getBackcolor();
|
||||
}
|
||||
|
||||
}
|
@ -543,60 +543,21 @@ public class DotPath implements UShape, Moveable {
|
||||
if (tail != null) {
|
||||
// System.err.println("beziers1=" + this.toString());
|
||||
final ClusterPosition clusterPosition = tail.getClusterPosition();
|
||||
if (clusterPosition.contains(getStartPoint()) == false) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
final DotPath result = new DotPath();
|
||||
int idx = 0;
|
||||
while (idx + 1 < this.beziers.size() && clusterPosition.contains(this.beziers.get(idx).getP2())) {
|
||||
if (clusterPosition.contains(this.beziers.get(idx).getP1()) == false) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
if (clusterPosition.contains(this.beziers.get(idx).getP2())) {
|
||||
// System.err.println("strange1");
|
||||
} else {
|
||||
assert clusterPosition.contains(this.beziers.get(idx).getP1());
|
||||
assert clusterPosition.contains(this.beziers.get(idx).getP2()) == false;
|
||||
CubicCurve2D current = this.beziers.get(idx);
|
||||
for (int k = 0; k < 8; k++) {
|
||||
// System.err.println("length=" + length(current));
|
||||
final CubicCurve2D.Double part1 = new CubicCurve2D.Double();
|
||||
final CubicCurve2D.Double part2 = new CubicCurve2D.Double();
|
||||
current.subdivide(part1, part2);
|
||||
assert part1.getP2().equals(part2.getP1());
|
||||
if (clusterPosition.contains(part1.getP2())) {
|
||||
current = part2;
|
||||
} else {
|
||||
result.beziers.add(0, part2);
|
||||
current = part1;
|
||||
if (clusterPosition.contains(getStartPoint())) {
|
||||
final DotPath result = new DotPath();
|
||||
int idx = 0;
|
||||
while (idx + 1 < this.beziers.size() && clusterPosition.contains(this.beziers.get(idx).getP2())) {
|
||||
if (clusterPosition.contains(this.beziers.get(idx).getP1()) == false) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
for (int i = idx + 1; i < this.beziers.size(); i++) {
|
||||
result.beziers.add(this.beziers.get(i));
|
||||
}
|
||||
me = result;
|
||||
}
|
||||
}
|
||||
if (head != null) {
|
||||
// System.err.println("beziers2=" + me.toString());
|
||||
final DotPath result = new DotPath();
|
||||
final ClusterPosition clusterPosition = head.getClusterPosition();
|
||||
if (clusterPosition.contains(getEndPoint()) == false) {
|
||||
// System.err.println("strange3");
|
||||
return me;
|
||||
}
|
||||
for (CubicCurve2D.Double current : me.beziers) {
|
||||
if (clusterPosition.contains(current.getP2()) == false) {
|
||||
result.beziers.add(current);
|
||||
if (clusterPosition.contains(this.beziers.get(idx).getP2())) {
|
||||
// System.err.println("strange1");
|
||||
} else {
|
||||
if (clusterPosition.contains(current.getP1())) {
|
||||
// System.err.println("strange2");
|
||||
return me;
|
||||
}
|
||||
assert clusterPosition.contains(current.getP1()) == false;
|
||||
assert clusterPosition.contains(current.getP2());
|
||||
assert clusterPosition.contains(this.beziers.get(idx).getP1());
|
||||
assert clusterPosition.contains(this.beziers.get(idx).getP2()) == false;
|
||||
CubicCurve2D current = this.beziers.get(idx);
|
||||
for (int k = 0; k < 8; k++) {
|
||||
// System.err.println("length=" + length(current));
|
||||
final CubicCurve2D.Double part1 = new CubicCurve2D.Double();
|
||||
@ -604,15 +565,51 @@ public class DotPath implements UShape, Moveable {
|
||||
current.subdivide(part1, part2);
|
||||
assert part1.getP2().equals(part2.getP1());
|
||||
if (clusterPosition.contains(part1.getP2())) {
|
||||
current = part1;
|
||||
} else {
|
||||
result.beziers.add(part1);
|
||||
current = part2;
|
||||
// System.err.println("k=" + k + " result=" + result.toString());
|
||||
} else {
|
||||
result.beziers.add(0, part2);
|
||||
current = part1;
|
||||
}
|
||||
}
|
||||
// System.err.println("Final Result=" + result.toString());
|
||||
return result;
|
||||
for (int i = idx + 1; i < this.beziers.size(); i++) {
|
||||
result.beziers.add(this.beziers.get(i));
|
||||
}
|
||||
me = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (head != null) {
|
||||
// System.err.println("beziers2=" + me.toString());
|
||||
final DotPath result = new DotPath();
|
||||
final ClusterPosition clusterPosition = head.getClusterPosition();
|
||||
if (clusterPosition.contains(getEndPoint())) {
|
||||
for (CubicCurve2D.Double current : me.beziers) {
|
||||
if (clusterPosition.contains(current.getP2()) == false) {
|
||||
result.beziers.add(current);
|
||||
} else {
|
||||
if (clusterPosition.contains(current.getP1())) {
|
||||
// System.err.println("strange2");
|
||||
return me;
|
||||
}
|
||||
assert clusterPosition.contains(current.getP1()) == false;
|
||||
assert clusterPosition.contains(current.getP2());
|
||||
for (int k = 0; k < 8; k++) {
|
||||
// System.err.println("length=" + length(current));
|
||||
final CubicCurve2D.Double part1 = new CubicCurve2D.Double();
|
||||
final CubicCurve2D.Double part2 = new CubicCurve2D.Double();
|
||||
current.subdivide(part1, part2);
|
||||
assert part1.getP2().equals(part2.getP1());
|
||||
if (clusterPosition.contains(part1.getP2())) {
|
||||
current = part1;
|
||||
} else {
|
||||
result.beziers.add(part1);
|
||||
current = part2;
|
||||
// System.err.println("k=" + k + " result=" + result.toString());
|
||||
}
|
||||
}
|
||||
// System.err.println("Final Result=" + result.toString());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,9 +39,11 @@ import java.util.Map;
|
||||
import net.sourceforge.plantuml.ISkinSimple;
|
||||
import net.sourceforge.plantuml.SpriteContainer;
|
||||
import net.sourceforge.plantuml.creole.CommandCreoleMonospaced;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorSetSimple;
|
||||
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
|
||||
import net.sourceforge.plantuml.salt.element.Element;
|
||||
import net.sourceforge.plantuml.salt.element.WrappedElement;
|
||||
import net.sourceforge.plantuml.ugraphic.Sprite;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
|
||||
|
||||
public class Dictionary implements SpriteContainer, ISkinSimple {
|
||||
|
||||
@ -83,4 +85,8 @@ public class Dictionary implements SpriteContainer, ISkinSimple {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public IHtmlColorSet getIHtmlColorSet() {
|
||||
return new HtmlColorSetSimple();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ import net.sourceforge.plantuml.core.DiagramDescription;
|
||||
import net.sourceforge.plantuml.core.DiagramDescriptionImpl;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.SymbolContext;
|
||||
import net.sourceforge.plantuml.sequencediagram.graphic.FileMaker;
|
||||
@ -473,7 +474,7 @@ public class SequenceDiagram extends UmlDiagram {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (Display.isNull(getLegend()) == false && getLegend().hasUrl()) {
|
||||
if (DisplayPositionned.isNull(getLegend()) == false && getLegend().hasUrl()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -28,12 +28,17 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18280 $
|
||||
* Revision $Revision: 18806 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.png.PngTitler;
|
||||
import net.sourceforge.plantuml.utils.MathUtils;
|
||||
|
||||
public class SequenceDiagramArea {
|
||||
|
||||
@ -47,6 +52,9 @@ public class SequenceDiagramArea {
|
||||
private double titleWidth;
|
||||
private double titleHeight;
|
||||
|
||||
private double captionWidth;
|
||||
private double captionHeight;
|
||||
|
||||
private double footerWidth;
|
||||
private double footerHeight;
|
||||
private double footerMargin;
|
||||
@ -56,9 +64,18 @@ public class SequenceDiagramArea {
|
||||
this.sequenceHeight = height;
|
||||
}
|
||||
|
||||
public void setTitleArea(double titleWidth, double titleHeight) {
|
||||
this.titleWidth = titleWidth;
|
||||
this.titleHeight = titleHeight;
|
||||
public void setTitleArea(double width, double height) {
|
||||
this.titleWidth = width;
|
||||
this.titleHeight = height;
|
||||
}
|
||||
|
||||
private void setCaptionArea(double width, double height) {
|
||||
this.captionWidth = width;
|
||||
this.captionHeight = height;
|
||||
}
|
||||
|
||||
public void setCaptionArea(Dimension2D dim) {
|
||||
setCaptionArea(dim.getWidth(), dim.getHeight());
|
||||
}
|
||||
|
||||
public void setHeaderArea(double headerWidth, double headerHeight, double headerMargin) {
|
||||
@ -74,21 +91,11 @@ public class SequenceDiagramArea {
|
||||
}
|
||||
|
||||
public double getWidth() {
|
||||
double result = sequenceWidth;
|
||||
if (headerWidth > result) {
|
||||
result = headerWidth;
|
||||
}
|
||||
if (titleWidth > result) {
|
||||
result = titleWidth;
|
||||
}
|
||||
if (footerWidth > result) {
|
||||
result = footerWidth;
|
||||
}
|
||||
return result;
|
||||
return MathUtils.max(sequenceWidth, headerWidth, titleWidth, footerWidth, captionWidth);
|
||||
}
|
||||
|
||||
public double getHeight() {
|
||||
return sequenceHeight + headerHeight + headerMargin + titleHeight + footerMargin + footerHeight;
|
||||
return sequenceHeight + headerHeight + headerMargin + titleHeight + footerMargin + footerHeight + captionHeight;
|
||||
}
|
||||
|
||||
public double getTitleX() {
|
||||
@ -99,6 +106,14 @@ public class SequenceDiagramArea {
|
||||
return headerHeight + headerMargin;
|
||||
}
|
||||
|
||||
public double getCaptionX() {
|
||||
return (getWidth() - captionWidth) / 2;
|
||||
}
|
||||
|
||||
public double getCaptionY() {
|
||||
return sequenceHeight + headerHeight + headerMargin + titleHeight;
|
||||
}
|
||||
|
||||
public double getSequenceAreaX() {
|
||||
return (getWidth() - sequenceWidth) / 2;
|
||||
}
|
||||
@ -112,7 +127,7 @@ public class SequenceDiagramArea {
|
||||
}
|
||||
|
||||
public double getFooterY() {
|
||||
return sequenceHeight + headerHeight + headerMargin + titleHeight + footerMargin;
|
||||
return sequenceHeight + headerHeight + headerMargin + titleHeight + footerMargin + captionHeight;
|
||||
}
|
||||
|
||||
public double getFooterX(HorizontalAlignment align) {
|
||||
@ -141,4 +156,18 @@ public class SequenceDiagramArea {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public void initFooter(PngTitler pngTitler) {
|
||||
final Dimension2D dim = pngTitler.getTextDimension(TextBlockUtils.getDummyStringBounder());
|
||||
if (dim != null) {
|
||||
setFooterArea(dim.getWidth(), dim.getHeight(), 3);
|
||||
}
|
||||
}
|
||||
|
||||
public void initHeader(PngTitler pngTitler) {
|
||||
final Dimension2D dim = pngTitler.getTextDimension(TextBlockUtils.getDummyStringBounder());
|
||||
if (dim != null) {
|
||||
setHeaderArea(dim.getWidth(), dim.getHeight(), 3);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,12 +41,14 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.AnnotatedWorker;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.EntityImageLegend;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
@ -117,7 +119,8 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker {
|
||||
for (Newpage n : newpages) {
|
||||
positions.put(n, initializer.getYposition(dummyStringBounder, n));
|
||||
}
|
||||
pages = create(drawableSet, positions, sequenceDiagram.isShowFootbox(), sequenceDiagram.getTitle()).getPages();
|
||||
pages = create(drawableSet, positions, sequenceDiagram.isShowFootbox(), sequenceDiagram.getTitle().getDisplay())
|
||||
.getPages();
|
||||
}
|
||||
|
||||
public int getNbPages() {
|
||||
@ -144,6 +147,9 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker {
|
||||
final SequenceDiagramArea area = new SequenceDiagramArea(fullDimension.getWidth(), page.getHeight());
|
||||
|
||||
final Component compTitle;
|
||||
final TextBlock caption = new AnnotatedWorker(diagram, diagram.getSkinParam()).getCaption();
|
||||
area.setCaptionArea(caption.calculateDimension(dummyStringBounder));
|
||||
|
||||
if (Display.isNull(page.getTitle())) {
|
||||
compTitle = null;
|
||||
} else {
|
||||
@ -152,17 +158,15 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker {
|
||||
area.setTitleArea(compTitle.getPreferredWidth(dummyStringBounder),
|
||||
compTitle.getPreferredHeight(dummyStringBounder));
|
||||
}
|
||||
addFooter2(area);
|
||||
addHeader2(area);
|
||||
area.initFooter(getPngTitler(FontParam.FOOTER));
|
||||
area.initHeader(getPngTitler(FontParam.HEADER));
|
||||
|
||||
// final FileFormat fileFormat = fileFormatOption.getFileFormat();
|
||||
|
||||
final Display legend = diagram.getLegend();
|
||||
final DisplayPositionned legend = diagram.getLegend();
|
||||
final TextBlock legendBlock;
|
||||
if (Display.isNull(legend)) {
|
||||
if (DisplayPositionned.isNull(legend)) {
|
||||
legendBlock = TextBlockUtils.empty(0, 0);
|
||||
} else {
|
||||
legendBlock = EntityImageLegend.create(legend, diagram.getSkinParam());
|
||||
legendBlock = EntityImageLegend.create(legend.getDisplay(), diagram.getSkinParam());
|
||||
}
|
||||
final Dimension2D dimLegend = TextBlockUtils.getDimension(legendBlock);
|
||||
|
||||
@ -198,11 +202,12 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker {
|
||||
compTitle.drawU(ug.apply(new UTranslate(area.getTitleX(), area.getTitleY())), new Area(
|
||||
new Dimension2DDouble(w, h)), new SimpleContext2D(false));
|
||||
}
|
||||
caption.drawU(ug.apply(new UTranslate(area.getCaptionX(), area.getCaptionY())));
|
||||
|
||||
final double delta1 = Math.max(0, dimLegend.getWidth() - area.getWidth());
|
||||
|
||||
final boolean legendTop = Display.isNull(legend) == false
|
||||
&& diagram.getLegendVerticalAlignment() == VerticalAlignment.TOP;
|
||||
final boolean legendTop = DisplayPositionned.isNull(legend) == false
|
||||
&& legend.getVerticalAlignment() == VerticalAlignment.TOP;
|
||||
|
||||
double sequenceAreaY = area.getSequenceAreaY();
|
||||
if (legendTop) {
|
||||
@ -211,14 +216,14 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker {
|
||||
drawableSet.drawU22(ug.apply(new UTranslate(area.getSequenceAreaX() + delta1 / 2, sequenceAreaY)),
|
||||
delta, fullDimension.getWidth(), page, diagram.isShowFootbox());
|
||||
|
||||
addHeader3(area, ug);
|
||||
addFooter3(area, ug);
|
||||
drawHeader(area, ug);
|
||||
drawFooter(area, ug);
|
||||
|
||||
if (Display.isNull(legend) == false) {
|
||||
if (DisplayPositionned.isNull(legend) == false) {
|
||||
final double delta2;
|
||||
if (diagram.getLegendAlignment() == HorizontalAlignment.LEFT) {
|
||||
if (legend.getHorizontalAlignment() == HorizontalAlignment.LEFT) {
|
||||
delta2 = 0;
|
||||
} else if (diagram.getLegendAlignment() == HorizontalAlignment.RIGHT) {
|
||||
} else if (legend.getHorizontalAlignment() == HorizontalAlignment.RIGHT) {
|
||||
delta2 = Math.max(0, area.getWidth() - dimLegend.getWidth());
|
||||
} else {
|
||||
delta2 = Math.max(0, area.getWidth() - dimLegend.getWidth()) / 2;
|
||||
@ -232,6 +237,26 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker {
|
||||
return imageBuilder.writeImageTOBEMOVED(fileFormatOption, os);
|
||||
}
|
||||
|
||||
private void drawFooter(SequenceDiagramArea area, UGraphic ug) {
|
||||
final PngTitler pngTitler = getPngTitler(FontParam.FOOTER);
|
||||
final TextBlock text = pngTitler.getTextBlock();
|
||||
if (text == null) {
|
||||
return;
|
||||
}
|
||||
text.drawU(ug.apply(new UTranslate(area.getFooterX(diagram.getFooter().getHorizontalAlignment()), area
|
||||
.getFooterY())));
|
||||
}
|
||||
|
||||
private void drawHeader(SequenceDiagramArea area, UGraphic ug) {
|
||||
final PngTitler pngTitler = getPngTitler(FontParam.HEADER);
|
||||
final TextBlock text = pngTitler.getTextBlock();
|
||||
if (text == null) {
|
||||
return;
|
||||
}
|
||||
text.drawU(ug.apply(new UTranslate(area.getHeaderX(diagram.getHeader().getHorizontalAlignment()), area
|
||||
.getHeaderY())));
|
||||
}
|
||||
|
||||
private double oneOf(double a, double b) {
|
||||
if (a == 1) {
|
||||
return b;
|
||||
@ -259,58 +284,14 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker {
|
||||
return diagram.getScale().getScale(width, height);
|
||||
}
|
||||
|
||||
private void addFooter2(SequenceDiagramArea area) {
|
||||
private PngTitler getPngTitler(final FontParam fontParam) {
|
||||
final HtmlColor hyperlinkColor = diagram.getSkinParam().getHyperlinkColor();
|
||||
final HtmlColor titleColor = diagram.getSkinParam().getFontHtmlColor(null, FontParam.FOOTER);
|
||||
final String fontFamily = diagram.getSkinParam().getFont(null, false, FontParam.FOOTER).getFamily(null);
|
||||
final int fontSize = diagram.getSkinParam().getFont(null, false, FontParam.FOOTER).getSize();
|
||||
final PngTitler pngTitler = new PngTitler(titleColor, diagram.getFooter(), fontSize, fontFamily,
|
||||
diagram.getFooterAlignment(), hyperlinkColor, diagram.getSkinParam().useUnderlineForHyperlink());
|
||||
final Dimension2D dim = pngTitler.getTextDimension(dummyStringBounder);
|
||||
if (dim != null) {
|
||||
area.setFooterArea(dim.getWidth(), dim.getHeight(), 3);
|
||||
}
|
||||
}
|
||||
|
||||
private void addHeader2(SequenceDiagramArea area) {
|
||||
final HtmlColor hyperlinkColor = diagram.getSkinParam().getHyperlinkColor();
|
||||
final HtmlColor titleColor = diagram.getSkinParam().getFontHtmlColor(null, FontParam.HEADER);
|
||||
final String fontFamily = diagram.getSkinParam().getFont(null, false, FontParam.HEADER).getFamily(null);
|
||||
final int fontSize = diagram.getSkinParam().getFont(null, false, FontParam.HEADER).getSize();
|
||||
final PngTitler pngTitler = new PngTitler(titleColor, diagram.getHeader(), fontSize, fontFamily,
|
||||
diagram.getHeaderAlignment(), hyperlinkColor, diagram.getSkinParam().useUnderlineForHyperlink());
|
||||
final Dimension2D dim = pngTitler.getTextDimension(dummyStringBounder);
|
||||
if (dim != null) {
|
||||
area.setHeaderArea(dim.getWidth(), dim.getHeight(), 3);
|
||||
}
|
||||
}
|
||||
|
||||
private void addFooter3(SequenceDiagramArea area, UGraphic ug) {
|
||||
final HtmlColor hyperlinkColor = diagram.getSkinParam().getHyperlinkColor();
|
||||
final HtmlColor titleColor = diagram.getSkinParam().getFontHtmlColor(null, FontParam.FOOTER);
|
||||
final String fontFamily = diagram.getSkinParam().getFont(null, false, FontParam.FOOTER).getFamily(null);
|
||||
final int fontSize = diagram.getSkinParam().getFont(null, false, FontParam.FOOTER).getSize();
|
||||
final PngTitler pngTitler = new PngTitler(titleColor, diagram.getFooter(), fontSize, fontFamily,
|
||||
diagram.getFooterAlignment(), hyperlinkColor, diagram.getSkinParam().useUnderlineForHyperlink());
|
||||
final TextBlock text = pngTitler.getTextBlock();
|
||||
if (text == null) {
|
||||
return;
|
||||
}
|
||||
text.drawU(ug.apply(new UTranslate(area.getFooterX(diagram.getFooterAlignment()), area.getFooterY())));
|
||||
}
|
||||
|
||||
private void addHeader3(SequenceDiagramArea area, UGraphic ug) {
|
||||
final HtmlColor hyperlinkColor = diagram.getSkinParam().getHyperlinkColor();
|
||||
final HtmlColor titleColor = diagram.getSkinParam().getFontHtmlColor(null, FontParam.HEADER);
|
||||
final String fontFamily = diagram.getSkinParam().getFont(null, false, FontParam.HEADER).getFamily(null);
|
||||
final int fontSize = diagram.getSkinParam().getFont(null, false, FontParam.HEADER).getSize();
|
||||
final PngTitler pngTitler = new PngTitler(titleColor, diagram.getHeader(), fontSize, fontFamily,
|
||||
diagram.getHeaderAlignment(), hyperlinkColor, diagram.getSkinParam().useUnderlineForHyperlink());
|
||||
final TextBlock text = pngTitler.getTextBlock();
|
||||
if (text == null) {
|
||||
return;
|
||||
}
|
||||
text.drawU(ug.apply(new UTranslate(area.getHeaderX(diagram.getHeaderAlignment()), area.getHeaderY())));
|
||||
final HtmlColor titleColor = diagram.getSkinParam().getFontHtmlColor(null, fontParam);
|
||||
final String fontFamily = diagram.getSkinParam().getFont(null, false, fontParam).getFamily(null);
|
||||
final int fontSize = diagram.getSkinParam().getFont(null, false, fontParam).getSize();
|
||||
return new PngTitler(titleColor, diagram.getFooterOrHeaderTeoz(fontParam).getDisplay(), fontSize, fontFamily,
|
||||
diagram.getFooterOrHeaderTeoz(fontParam).getHorizontalAlignment(), hyperlinkColor, diagram
|
||||
.getSkinParam().useUnderlineForHyperlink());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,11 +41,11 @@ import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.Scale;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.EntityImageLegend;
|
||||
import net.sourceforge.plantuml.api.ImageDataSimple;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
@ -131,14 +131,14 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker {
|
||||
englobers.drawEnglobers(goDownForEnglobers(ug), main.calculateDimension(stringBounder).getHeight()
|
||||
+ this.heightEnglober1 + this.heightEnglober2 / 2, new SimpleContext2D(true));
|
||||
|
||||
printAligned(ug, diagram.getAlignmentTeoz(FontParam.HEADER), header);
|
||||
printAligned(ug, diagram.getFooterOrHeaderTeoz(FontParam.HEADER).getHorizontalAlignment(), header);
|
||||
ug = goDown(ug, header);
|
||||
|
||||
printAligned(ug, HorizontalAlignment.CENTER, title);
|
||||
ug = goDown(ug, title);
|
||||
|
||||
if (diagram.getLegendVerticalAlignment() == VerticalAlignment.TOP) {
|
||||
printAligned(ug, diagram.getLegendAlignment(), legend);
|
||||
if (diagram.getLegend().getVerticalAlignment() == VerticalAlignment.TOP) {
|
||||
printAligned(ug, diagram.getLegend().getHorizontalAlignment(), legend);
|
||||
ug = goDown(ug, legend);
|
||||
}
|
||||
|
||||
@ -147,12 +147,12 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker {
|
||||
ug = goDown(ug, main);
|
||||
ug = ug.apply(new UTranslate(0, this.heightEnglober2));
|
||||
|
||||
if (diagram.getLegendVerticalAlignment() == VerticalAlignment.BOTTOM) {
|
||||
printAligned(ug, diagram.getLegendAlignment(), legend);
|
||||
if (diagram.getLegend().getVerticalAlignment() == VerticalAlignment.BOTTOM) {
|
||||
printAligned(ug, diagram.getLegend().getHorizontalAlignment(), legend);
|
||||
ug = goDown(ug, legend);
|
||||
}
|
||||
|
||||
printAligned(ug, diagram.getAlignmentTeoz(FontParam.FOOTER), footer);
|
||||
printAligned(ug, diagram.getFooterOrHeaderTeoz(FontParam.FOOTER).getHorizontalAlignment(), footer);
|
||||
|
||||
ug2.writeImageTOBEMOVED(os, isWithMetadata ? diagram.getMetadata() : null, diagram.getDpi(fileFormatOption));
|
||||
|
||||
@ -162,7 +162,7 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker {
|
||||
private UGraphic goDownForEnglobers(UGraphic ug) {
|
||||
ug = goDown(ug, title);
|
||||
ug = goDown(ug, header);
|
||||
if (diagram.getLegendVerticalAlignment() == VerticalAlignment.TOP) {
|
||||
if (diagram.getLegend().getVerticalAlignment() == VerticalAlignment.TOP) {
|
||||
ug = goDown(ug, legend);
|
||||
}
|
||||
return ug;
|
||||
@ -210,16 +210,16 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker {
|
||||
}
|
||||
|
||||
private TextBlock getTitle() {
|
||||
final Display title = diagram.getTitle();
|
||||
if (Display.isNull(title)) {
|
||||
if (DisplayPositionned.isNull(diagram.getTitle())) {
|
||||
return new ComponentAdapter(null);
|
||||
}
|
||||
final Component compTitle = skin.createComponent(ComponentType.TITLE, null, getSkinParam(), title);
|
||||
final Component compTitle = skin.createComponent(ComponentType.TITLE, null, getSkinParam(), diagram.getTitle()
|
||||
.getDisplay());
|
||||
return new ComponentAdapter(compTitle);
|
||||
}
|
||||
|
||||
private TextBlock getLegend() {
|
||||
final Display legend = diagram.getLegend();
|
||||
final Display legend = diagram.getLegend().getDisplay();
|
||||
if (Display.isNull(legend)) {
|
||||
return TextBlockUtils.empty(0, 0);
|
||||
}
|
||||
@ -227,16 +227,17 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker {
|
||||
}
|
||||
|
||||
public TextBlock getFooterOrHeader(final FontParam param) {
|
||||
final Display display = diagram.getFooterOrHeaderTeoz(param);
|
||||
if (Display.isNull(display)) {
|
||||
if (DisplayPositionned.isNull(diagram.getFooterOrHeaderTeoz(param))) {
|
||||
return new TeozLayer(null, stringBounder, param);
|
||||
}
|
||||
final Display display = diagram.getFooterOrHeaderTeoz(param).getDisplay();
|
||||
final HtmlColor hyperlinkColor = getSkinParam().getHyperlinkColor();
|
||||
final HtmlColor titleColor = getSkinParam().getFontHtmlColor(null, param);
|
||||
final String fontFamily = getSkinParam().getFont(null, false, param).getFamily(null);
|
||||
final int fontSize = getSkinParam().getFont(null, false, param).getSize();
|
||||
final PngTitler pngTitler = new PngTitler(titleColor, display, fontSize, fontFamily,
|
||||
diagram.getAlignmentTeoz(param), hyperlinkColor, getSkinParam().useUnderlineForHyperlink());
|
||||
final PngTitler pngTitler = new PngTitler(titleColor, display, fontSize, fontFamily, diagram
|
||||
.getFooterOrHeaderTeoz(param).getHorizontalAlignment(), hyperlinkColor, getSkinParam()
|
||||
.useUnderlineForHyperlink());
|
||||
return new TeozLayer(pngTitler, stringBounder, param);
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class CommandLinkState extends SingleLineCommand2<StateDiagram> {
|
||||
new RegexLeaf("[%s]*"), //
|
||||
getStatePattern("ENT2"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
new RegexLeaf("LABEL", "(?::[%s]*([^%g]+))?"), //
|
||||
new RegexLeaf("LABEL", "(?::[%s]*(.+))?"), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
|
@ -40,29 +40,23 @@ import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.AnnotatedWorker;
|
||||
import net.sourceforge.plantuml.EmptyImageBuilder;
|
||||
import net.sourceforge.plantuml.FileFormat;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.Scale;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.EntityImageLegend;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.CucaDiagramSimplifierActivity;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.CucaDiagramSimplifierState;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.DotData;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
|
||||
@ -116,9 +110,7 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker {
|
||||
svek2 = buildCucaDiagramFileMakerSvek2(DotMode.NO_LEFT_RIGHT);
|
||||
result = svek2.createFile(diagram.getDotStringSkek());
|
||||
}
|
||||
result = addLegend(result);
|
||||
result = addTitle(result);
|
||||
result = addHeaderAndFooter(result);
|
||||
result = new AnnotatedWorker(diagram, diagram.getSkinParam()).addAdd(result);
|
||||
|
||||
final String widthwarning = diagram.getSkinParam().getValue("widthwarning");
|
||||
if (widthwarning != null && widthwarning.matches("\\d+")) {
|
||||
@ -169,45 +161,6 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker {
|
||||
return warningOrError;
|
||||
}
|
||||
|
||||
private TextBlockBackcolored addHeaderAndFooter(TextBlockBackcolored original) {
|
||||
final Display footer = diagram.getFooter();
|
||||
final Display header = diagram.getHeader();
|
||||
if (Display.isNull(footer) && Display.isNull(header)) {
|
||||
return original;
|
||||
}
|
||||
final TextBlock textFooter = Display.isNull(footer) ? null : footer.create(
|
||||
new FontConfiguration(diagram.getSkinParam(), FontParam.FOOTER, null), diagram.getFooterAlignment(),
|
||||
diagram.getSkinParam());
|
||||
final TextBlock textHeader = Display.isNull(header) ? null : header.create(
|
||||
new FontConfiguration(diagram.getSkinParam(), FontParam.HEADER, null), diagram.getHeaderAlignment(),
|
||||
diagram.getSkinParam());
|
||||
|
||||
return new DecorateEntityImage(original, textHeader, diagram.getHeaderAlignment(), textFooter,
|
||||
diagram.getFooterAlignment());
|
||||
}
|
||||
|
||||
private TextBlockBackcolored addTitle(TextBlockBackcolored original) {
|
||||
final Display title = diagram.getTitle();
|
||||
if (Display.isNull(title)) {
|
||||
return original;
|
||||
}
|
||||
final TextBlock text = title.create(new FontConfiguration(diagram.getSkinParam(), FontParam.TITLE, null),
|
||||
HorizontalAlignment.CENTER, diagram.getSkinParam());
|
||||
|
||||
return DecorateEntityImage.addTop(original, text, HorizontalAlignment.CENTER);
|
||||
}
|
||||
|
||||
private TextBlockBackcolored addLegend(TextBlockBackcolored original) {
|
||||
final Display legend = diagram.getLegend();
|
||||
if (Display.isNull(legend)) {
|
||||
return original;
|
||||
}
|
||||
final TextBlock text = EntityImageLegend.create(legend, diagram.getSkinParam());
|
||||
|
||||
return DecorateEntityImage.add(original, text, diagram.getLegendAlignment(),
|
||||
diagram.getLegendVerticalAlignment());
|
||||
}
|
||||
|
||||
private final UFont getFont(FontParam fontParam) {
|
||||
final ISkinParam skinParam = diagram.getSkinParam();
|
||||
return skinParam.getFont(null, false, fontParam);
|
||||
|
@ -1,136 +0,0 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, 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: 4236 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.svek;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class DecorateTextBlock extends AbstractTextBlock implements TextBlock {
|
||||
|
||||
private final TextBlock original;
|
||||
private final HorizontalAlignment horizontal1;
|
||||
private final TextBlock text1;
|
||||
private final HorizontalAlignment horizontal2;
|
||||
private final TextBlock text2;
|
||||
|
||||
private double deltaX;
|
||||
private double deltaY;
|
||||
|
||||
public DecorateTextBlock(TextBlock original, TextBlock text, HorizontalAlignment horizontal) {
|
||||
this(original, text, horizontal, null, null);
|
||||
}
|
||||
|
||||
public DecorateTextBlock(TextBlock original, TextBlock text1, HorizontalAlignment horizontal1, TextBlock text2,
|
||||
HorizontalAlignment horizontal2) {
|
||||
this.original = original;
|
||||
this.horizontal1 = horizontal1;
|
||||
this.text1 = text1;
|
||||
this.horizontal2 = horizontal2;
|
||||
this.text2 = text2;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final Dimension2D dimOriginal = original.calculateDimension(stringBounder);
|
||||
final Dimension2D dimText1 = getTextDim(text1, stringBounder);
|
||||
final Dimension2D dimText2 = getTextDim(text2, stringBounder);
|
||||
final Dimension2D dimTotal = calculateDimension(stringBounder);
|
||||
|
||||
final double yText1 = 0;
|
||||
final double yImage = yText1 + dimText1.getHeight();
|
||||
final double yText2 = yImage + dimOriginal.getHeight();
|
||||
|
||||
final double xImage = (dimTotal.getWidth() - dimOriginal.getWidth()) / 2;
|
||||
|
||||
if (text1 != null) {
|
||||
final double xText1 = getTextX(dimText1, dimTotal, horizontal1);
|
||||
text1.drawU(ug.apply(new UTranslate(xText1, yText1)));
|
||||
}
|
||||
original.drawU(ug.apply(new UTranslate(xImage, yImage)));
|
||||
deltaX = xImage;
|
||||
deltaY = yImage;
|
||||
if (text2 != null) {
|
||||
final double xText2 = getTextX(dimText2, dimTotal, horizontal2);
|
||||
text2.drawU(ug.apply(new UTranslate(xText2, yText2)));
|
||||
}
|
||||
}
|
||||
|
||||
private Dimension2D getTextDim(TextBlock text, StringBounder stringBounder) {
|
||||
if (text == null) {
|
||||
return new Dimension2DDouble(0, 0);
|
||||
}
|
||||
return text.calculateDimension(stringBounder);
|
||||
}
|
||||
|
||||
private double getTextX(final Dimension2D dimText, final Dimension2D dimTotal, HorizontalAlignment h) {
|
||||
if (h == HorizontalAlignment.CENTER) {
|
||||
return (dimTotal.getWidth() - dimText.getWidth()) / 2;
|
||||
} else if (h == HorizontalAlignment.LEFT) {
|
||||
return 0;
|
||||
} else if (h == HorizontalAlignment.RIGHT) {
|
||||
return dimTotal.getWidth() - dimText.getWidth();
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
final Dimension2D dimOriginal = original.calculateDimension(stringBounder);
|
||||
final Dimension2D dimText = Dimension2DDouble.mergeTB(getTextDim(text1, stringBounder),
|
||||
getTextDim(text2, stringBounder));
|
||||
return Dimension2DDouble.mergeTB(dimOriginal, dimText);
|
||||
}
|
||||
|
||||
private double getDeltaX() {
|
||||
if (original instanceof DecorateTextBlock) {
|
||||
return deltaX + ((DecorateTextBlock) original).deltaX;
|
||||
}
|
||||
return deltaX;
|
||||
}
|
||||
|
||||
private double getDeltaY() {
|
||||
if (original instanceof DecorateTextBlock) {
|
||||
return deltaY + ((DecorateTextBlock) original).deltaY;
|
||||
}
|
||||
return deltaY;
|
||||
}
|
||||
|
||||
}
|
@ -50,6 +50,7 @@ import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||
import net.sourceforge.plantuml.cucadiagram.Rankdir;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.DotData;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.Graphviz;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion;
|
||||
@ -165,7 +166,16 @@ public class DotStringFactory implements Moveable {
|
||||
sb.append("compound=true;");
|
||||
SvekUtils.println(sb);
|
||||
}
|
||||
|
||||
|
||||
final DotSplines dotSplines = dotData.getSkinParam().getDotSplines();
|
||||
if (dotSplines == DotSplines.POLYLINE) {
|
||||
sb.append("splines=polyline;");
|
||||
SvekUtils.println(sb);
|
||||
} else if (dotSplines == DotSplines.ORTHO) {
|
||||
sb.append("splines=ortho;");
|
||||
SvekUtils.println(sb);
|
||||
}
|
||||
|
||||
if (dotData.getSkinParam().getRankdir() == Rankdir.LEFT_TO_RIGHT) {
|
||||
sb.append("rankdir=LR;");
|
||||
SvekUtils.println(sb);
|
||||
|
@ -85,7 +85,6 @@ import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
import net.sourceforge.plantuml.ugraphic.UShape;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.utils.MathUtils;
|
||||
|
||||
public class Line implements Moveable, Hideable {
|
||||
|
||||
@ -323,7 +322,7 @@ public class Line implements Moveable, Hideable {
|
||||
sb.append(endUid);
|
||||
// }
|
||||
sb.append("[");
|
||||
final LinkType linkType = link.getType();
|
||||
final LinkType linkType = link.getTypePatchCluster();
|
||||
String decoration = linkType.getSpecificDecorationSvek();
|
||||
if (decoration.endsWith(",") == false) {
|
||||
decoration += ",";
|
||||
@ -435,7 +434,7 @@ public class Line implements Moveable, Hideable {
|
||||
}
|
||||
|
||||
private UDrawable getExtremity(LinkHat hat, LinkDecor decor, PointListIterator pointListIterator, Point2D center,
|
||||
double angle, Cluster cluster) {
|
||||
double angle, Cluster cluster, boolean isGroup) {
|
||||
final ExtremityFactory extremityFactory = decor.getExtremityFactory();
|
||||
|
||||
if (OptionFlags.USE_COMPOUND == false && cluster != null) {
|
||||
@ -480,6 +479,7 @@ public class Line implements Moveable, Hideable {
|
||||
}
|
||||
final int end = svg.indexOf("\"", idx + 3);
|
||||
final String path = svg.substring(idx + 3, end);
|
||||
|
||||
dotPath = new DotPath(path, fullHeight);
|
||||
if (OptionFlags.USE_COMPOUND == false) {
|
||||
if (projectionCluster != null) {
|
||||
@ -498,9 +498,9 @@ public class Line implements Moveable, Hideable {
|
||||
|
||||
final LinkType linkType = link.getType();
|
||||
this.extremity2 = getExtremity(linkType.getHat2(), linkType.getDecor2(), pointListIterator,
|
||||
dotPath.getStartPoint(), dotPath.getStartAngle() + Math.PI, ltail);
|
||||
dotPath.getStartPoint(), dotPath.getStartAngle() + Math.PI, ltail, link.getEntity1().isGroup());
|
||||
this.extremity1 = getExtremity(linkType.getHat1(), linkType.getDecor1(), pointListIterator,
|
||||
dotPath.getEndPoint(), dotPath.getEndAngle(), lhead);
|
||||
dotPath.getEndPoint(), dotPath.getEndAngle(), lhead, link.getEntity2().isGroup());
|
||||
|
||||
if (this.labelText != null) {
|
||||
final Point2D pos = getXY(svg, this.noteLabelColor, fullHeight);
|
||||
|
@ -35,6 +35,7 @@ package net.sourceforge.plantuml.svek.extremity;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
@ -61,6 +62,8 @@ class ExtremityDiamond extends Extremity {
|
||||
public void drawU(UGraphic ug) {
|
||||
if (fill) {
|
||||
ug = ug.apply(new UChangeBackColor(ug.getParam().getColor()));
|
||||
} else {
|
||||
ug = ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE));
|
||||
}
|
||||
ug.draw(polygon);
|
||||
}
|
||||
|
@ -42,9 +42,15 @@ public class ExtremityFactoryDiamond extends AbstractExtremityFactory implements
|
||||
|
||||
private final boolean fill;
|
||||
|
||||
@Override
|
||||
public UDrawable createUDrawable(Point2D p0, double angle) {
|
||||
return new ExtremityDiamond(p0, angle - Math.PI / 2, fill);
|
||||
}
|
||||
|
||||
public ExtremityFactoryDiamond(boolean fill) {
|
||||
this.fill = fill;
|
||||
}
|
||||
|
||||
public UDrawable createUDrawable(Point2D p0, Point2D p1, Point2D p2) {
|
||||
final double ortho = atan2(p0, p2);
|
||||
return new ExtremityDiamond(p1, ortho, fill);
|
||||
|
@ -40,8 +40,9 @@ import net.sourceforge.plantuml.svek.AbstractExtremityFactory;
|
||||
|
||||
public class ExtremityFactoryPlus extends AbstractExtremityFactory implements ExtremityFactory {
|
||||
|
||||
@Override
|
||||
public UDrawable createUDrawable(Point2D center, double angle) {
|
||||
return ExtremityPlus.create(center, angle + Math.PI / 2);
|
||||
return ExtremityPlus.create(center, angle - Math.PI / 2);
|
||||
}
|
||||
|
||||
public UDrawable createUDrawable(Point2D p0, Point2D p1, Point2D p2) {
|
||||
|
@ -138,6 +138,9 @@ public class EntityImageTips extends AbstractEntityImage {
|
||||
} else {
|
||||
x += 4;
|
||||
}
|
||||
if (memberPosition == null) {
|
||||
return;
|
||||
}
|
||||
final double y = positionOther.getY() - positionMe.getY() - height + memberPosition.getCenterY();
|
||||
final Point2D pp2 = new Point2D.Double(x, y);
|
||||
opale.setOpale(position.reverseDirection(), pp1, pp2);
|
||||
|
@ -51,8 +51,8 @@ import javax.swing.SwingUtilities;
|
||||
import javax.swing.Timer;
|
||||
|
||||
import net.sourceforge.plantuml.Log;
|
||||
import net.sourceforge.plantuml.ugraphic.SpriteGrayLevel;
|
||||
import net.sourceforge.plantuml.ugraphic.SpriteUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.SpriteGrayLevel;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.SpriteUtils;
|
||||
import net.sourceforge.plantuml.version.PSystemVersion;
|
||||
|
||||
public class SpriteWindow extends JFrame {
|
||||
|
@ -78,6 +78,7 @@ public class LanguageDescriptor {
|
||||
keyword.add("as");
|
||||
keyword.add("also");
|
||||
keyword.add("autonumber");
|
||||
keyword.add("caption");
|
||||
keyword.add("title");
|
||||
keyword.add("newpage");
|
||||
keyword.add("box");
|
||||
|
@ -0,0 +1,93 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, 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: 4041 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic.sprite;
|
||||
|
||||
import java.awt.Font;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.AbstractPSystem;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.core.DiagramDescription;
|
||||
import net.sourceforge.plantuml.core.DiagramDescriptionImpl;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.graphic.GraphicStrings;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
|
||||
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
||||
import net.sourceforge.plantuml.ugraphic.UAntiAliasing;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
|
||||
public class PSystemListInternalSprites extends AbstractPSystem {
|
||||
|
||||
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
|
||||
final GraphicStrings result = getGraphicStrings();
|
||||
final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, result.getBackcolor(),
|
||||
getMetadata(), null, 0, 0, null, false);
|
||||
imageBuilder.addUDrawable(result);
|
||||
return imageBuilder.writeImageTOBEMOVED(fileFormat, os);
|
||||
}
|
||||
|
||||
private GraphicStrings getGraphicStrings() throws IOException {
|
||||
final List<String> lines = new ArrayList<String>();
|
||||
lines.add("<b>List Current Sprits");
|
||||
lines.add("<i>Credit to");
|
||||
lines.add("http://www.archimatetool.com");
|
||||
lines.add(" ");
|
||||
for (String folder : RessourcesUtils.getJarFile("sprites", true)) {
|
||||
lines.add("<u>" + folder + "</u> :");
|
||||
lines.add(" ");
|
||||
for (String png : RessourcesUtils.getJarFile("sprites/" + folder, false)) {
|
||||
if (png.endsWith(".png")) {
|
||||
final String spriteName = png.substring(0, png.length() - 4);
|
||||
lines.add("<$archimate/" + spriteName + "> " + spriteName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final UFont font = new UFont("SansSerif", Font.PLAIN, 12);
|
||||
final GraphicStrings graphicStrings = new GraphicStrings(lines, font, HtmlColorUtils.BLACK,
|
||||
HtmlColorUtils.WHITE, UAntiAliasing.ANTI_ALIASING_ON);
|
||||
graphicStrings.setMaxLine(35);
|
||||
return graphicStrings;
|
||||
}
|
||||
|
||||
public DiagramDescription getDescription() {
|
||||
return new DiagramDescriptionImpl("(Sprites)", getClass());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, 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: 3830 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic.sprite;
|
||||
|
||||
import net.sourceforge.plantuml.AbstractPSystem;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.command.PSystemSingleLineFactory;
|
||||
|
||||
public class PSystemListInternalSpritesFactory extends PSystemSingleLineFactory {
|
||||
|
||||
@Override
|
||||
protected AbstractPSystem executeLine(String line) {
|
||||
final String lineLower = StringUtils.goLowerCase(line);
|
||||
if (lineLower.startsWith("listsprite")) {
|
||||
return new PSystemListInternalSprites();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, 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: 3837 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic.sprite;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
import net.sourceforge.plantuml.version.Version;
|
||||
|
||||
public class RessourcesUtils {
|
||||
|
||||
public static Set<String> getJarFile(String path, boolean folder) throws IOException {
|
||||
if (path.startsWith("/") || path.endsWith("/")) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
final URL resource = Version.class.getClassLoader().getResource("net/sourceforge/plantuml/version/logo.png");
|
||||
final String protocol = resource.getProtocol();
|
||||
if ("file".equals(protocol)) {
|
||||
final URL local = Version.class.getClassLoader().getResource(path);
|
||||
try {
|
||||
return listEntry(new File(local.toURI()));
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if ("jar".equals(protocol)) {
|
||||
final String classFile = Version.class.getName().replace(".", "/") + ".class";
|
||||
final URL versionURL = Version.class.getClassLoader().getResource(classFile);
|
||||
final String jarPath = versionURL.getPath().substring(5, versionURL.getPath().indexOf("!"));
|
||||
if (folder) {
|
||||
return listFolders(new JarFile(URLDecoder.decode(jarPath, "UTF-8")), path + "/");
|
||||
} else {
|
||||
return listFiles(new JarFile(URLDecoder.decode(jarPath, "UTF-8")), path + "/");
|
||||
|
||||
}
|
||||
}
|
||||
return Collections.<String> emptySet();
|
||||
}
|
||||
|
||||
private static Set<String> listFiles(JarFile jarFile, String path) {
|
||||
final Enumeration<JarEntry> entries = jarFile.entries();
|
||||
final Set<String> result = new TreeSet<String>();
|
||||
while (entries.hasMoreElements()) {
|
||||
final String name = entries.nextElement().getName();
|
||||
if (name.startsWith(path)) {
|
||||
result.add(name.substring(path.length()));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Set<String> listFolders(JarFile jarFile, String path) {
|
||||
final Enumeration<JarEntry> entries = jarFile.entries();
|
||||
final Set<String> result = new TreeSet<String>();
|
||||
while (entries.hasMoreElements()) {
|
||||
final String name = entries.nextElement().getName();
|
||||
if (name.startsWith(path)) {
|
||||
final String folder = name.substring(path.length());
|
||||
final int x = folder.indexOf('/');
|
||||
if (x != -1) {
|
||||
result.add(folder.substring(0, x));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static Set<String> listEntry(File dir) {
|
||||
final Set<String> result = new TreeSet<String>();
|
||||
for (String n : dir.list()) {
|
||||
result.add(n);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -31,7 +31,7 @@
|
||||
* Revision $Revision: 3837 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
package net.sourceforge.plantuml.ugraphic.sprite;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
@ -31,7 +31,7 @@
|
||||
* Revision $Revision: 3837 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
package net.sourceforge.plantuml.ugraphic.sprite;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
@ -43,6 +43,7 @@ import java.util.List;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.code.AsciiEncoder;
|
||||
import net.sourceforge.plantuml.code.CompressionZlib;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorChangerMonochrome;
|
||||
|
||||
public enum SpriteGrayLevel {
|
||||
|
@ -31,7 +31,7 @@
|
||||
* Revision $Revision: 3837 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
package net.sourceforge.plantuml.ugraphic.sprite;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
@ -45,6 +45,8 @@ import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
|
||||
public class SpriteImage implements Sprite {
|
||||
|
@ -31,7 +31,7 @@
|
||||
* Revision $Revision: 3837 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
package net.sourceforge.plantuml.ugraphic.sprite;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.geom.Dimension2D;
|
||||
@ -44,6 +44,9 @@ import net.sourceforge.plantuml.graphic.HtmlColorGradient;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.ugraphic.ColorMapper;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UImage;
|
||||
|
||||
public class SpriteMonochrome implements Sprite {
|
||||
|
@ -31,13 +31,15 @@
|
||||
* Revision $Revision: 3837 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
package net.sourceforge.plantuml.ugraphic.sprite;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.List;
|
||||
|
||||
public class SpriteUtils {
|
||||
|
||||
public static final String SPRITE_NAME = "[-\\p{L}0-9_/]+";
|
||||
|
||||
private SpriteUtils() {
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ public enum License {
|
||||
text.add("");
|
||||
text.add("(C) Copyright 2009-2017, Arnaud Roques");
|
||||
text.add("");
|
||||
text.add("Project Info: http://plantuml.sourceforge.net");
|
||||
text.add("Project Info: http://plantuml.com");
|
||||
text.add("");
|
||||
return text;
|
||||
}
|
||||
@ -225,7 +225,7 @@ public enum License {
|
||||
h.add(" *");
|
||||
h.add(" * (C) Copyright 2009-2017, Arnaud Roques");
|
||||
h.add(" *");
|
||||
h.add(" * Project Info: http://plantuml.sourceforge.net");
|
||||
h.add(" * Project Info: http://plantuml.com");
|
||||
h.add(" * ");
|
||||
h.add(" * This file is part of PlantUML.");
|
||||
h.add(" *");
|
||||
@ -320,7 +320,8 @@ public enum License {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
text.add("");
|
||||
text.add("Icon provided by OpenIconic : https://useiconic.com/open/");
|
||||
text.add("Icons provided by OpenIconic : https://useiconic.com/open");
|
||||
text.add("Archimate sprites provided by Archi : http://www.archimatetool.com");
|
||||
text.add("");
|
||||
return text;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 18306 $
|
||||
* Revision $Revision: 18828 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.version;
|
||||
@ -39,7 +39,7 @@ import java.util.Date;
|
||||
public class Version {
|
||||
|
||||
public static int version() {
|
||||
return 8034;
|
||||
return 8035;
|
||||
}
|
||||
|
||||
public static String versionString() {
|
||||
@ -63,7 +63,7 @@ public class Version {
|
||||
}
|
||||
|
||||
private static long compileTime() {
|
||||
return 1452334079157L;
|
||||
return 1454151644150L;
|
||||
}
|
||||
|
||||
public static String compileTimeString() {
|
||||
|
Loading…
Reference in New Issue
Block a user