mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
version 8045
This commit is contained in:
parent
446f3d9a18
commit
dccc859954
2
pom.xml
2
pom.xml
@ -116,7 +116,7 @@
|
||||
<include>net/sourceforge/plantuml/openiconic/data/*.txt</include>
|
||||
<include>net/sourceforge/plantuml/openiconic/data/*.svg</include>
|
||||
<include>net/sourceforge/plantuml/fun/*.png</include>
|
||||
<include>sprite/archimate/*.png</include>
|
||||
<include>sprites/archimate/*.png</include>
|
||||
<include>net/sourceforge/plantuml/dedication/*.png</include>
|
||||
</includes>
|
||||
</resource>
|
||||
|
@ -66,7 +66,7 @@ public interface ISkinParam extends ISkinSimple {
|
||||
|
||||
public HorizontalAlignment getHorizontalAlignment(AlignParam param);
|
||||
|
||||
public HorizontalAlignment getDefaultTextAlignment();
|
||||
public HorizontalAlignment getDefaultTextAlignment(HorizontalAlignment defaultValue);
|
||||
|
||||
public int getCircledCharacterRadius();
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19870 $
|
||||
* Revision $Revision: 20057 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -61,6 +61,7 @@ public class OptionFlags {
|
||||
static public final boolean SWI2 = false;
|
||||
// static public final boolean USE_COMPOUND = false;
|
||||
static public final boolean OMEGA_CROSSING = false;
|
||||
// static public final boolean LINK_BETWEEN_FIELDS = true;
|
||||
|
||||
// static public final boolean USE_JDOT = false;
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class PSystemBuilder {
|
||||
factories.add(new PSystemSaltFactory(DiagramType.UML));
|
||||
factories.add(new PSystemDotFactory(DiagramType.DOT));
|
||||
factories.add(new PSystemDotFactory(DiagramType.UML));
|
||||
if (License.getCurrent() == License.GPL) {
|
||||
if (License.getCurrent() == License.GPL || License.getCurrent() == License.GPLV2) {
|
||||
factories.add(new PSystemDitaaFactory(DiagramType.DITAA));
|
||||
factories.add(new PSystemDitaaFactory(DiagramType.UML));
|
||||
factories.add(new PSystemJcckitFactory(DiagramType.JCCKIT));
|
||||
@ -153,7 +153,7 @@ public class PSystemBuilder {
|
||||
factories.add(new PSystemOregonFactory());
|
||||
factories.add(new PSystemCharlieFactory());
|
||||
factories.add(new PSystemMemorialFactory());
|
||||
if (License.getCurrent() == License.GPL) {
|
||||
if (License.getCurrent() == License.GPL || License.getCurrent() == License.GPLV2) {
|
||||
factories.add(new PSystemXearthFactory());
|
||||
}
|
||||
factories.add(new PSystemProjectFactory2());
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19880 $
|
||||
* Revision $Revision: 20003 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -96,7 +96,7 @@ public class SkinParam implements ISkinParam {
|
||||
static String cleanForKey(String key) {
|
||||
key = StringUtils.trin(StringUtils.goLowerCase(key));
|
||||
key = key.replaceAll("_|\\.|\\s", "");
|
||||
key = replaceSmart(key, "partition", "package");
|
||||
// key = replaceSmart(key, "partition", "package");
|
||||
key = replaceSmart(key, "sequenceparticipant", "participant");
|
||||
key = replaceSmart(key, "sequenceactor", "actor");
|
||||
if (key.contains("arrow")) {
|
||||
@ -405,11 +405,11 @@ public class SkinParam implements ISkinParam {
|
||||
return result;
|
||||
}
|
||||
|
||||
public HorizontalAlignment getDefaultTextAlignment() {
|
||||
public HorizontalAlignment getDefaultTextAlignment(HorizontalAlignment defaultValue) {
|
||||
final String value = getValue("defaulttextalignment");
|
||||
final HorizontalAlignment result = HorizontalAlignment.fromString(value);
|
||||
if (result == null) {
|
||||
return HorizontalAlignment.CENTER;
|
||||
return defaultValue;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -192,8 +192,8 @@ public class SkinParamDelegator implements ISkinParam {
|
||||
return skinParam.useUnderlineForHyperlink();
|
||||
}
|
||||
|
||||
public HorizontalAlignment getDefaultTextAlignment() {
|
||||
return skinParam.getDefaultTextAlignment();
|
||||
public HorizontalAlignment getDefaultTextAlignment(HorizontalAlignment defaultValue) {
|
||||
return skinParam.getDefaultTextAlignment(defaultValue);
|
||||
}
|
||||
|
||||
public double getPadding() {
|
||||
|
@ -198,7 +198,7 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
// }
|
||||
|
||||
public void fork() {
|
||||
final InstructionFork instructionFork = new InstructionFork(current(), nextLinkRenderer());
|
||||
final InstructionFork instructionFork = new InstructionFork(current(), nextLinkRenderer(), getSkinParam());
|
||||
current().add(instructionFork);
|
||||
setNextLinkRendererInternal(LinkRendering.none());
|
||||
setCurrent(instructionFork);
|
||||
@ -207,7 +207,7 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
public CommandExecutionResult forkAgain() {
|
||||
if (current() instanceof InstructionFork) {
|
||||
final InstructionFork currentFork = (InstructionFork) current();
|
||||
currentFork.manageOutRendering(nextLinkRenderer());
|
||||
currentFork.manageOutRendering(nextLinkRenderer(), false);
|
||||
setNextLinkRendererInternal(LinkRendering.none());
|
||||
currentFork.forkAgain();
|
||||
return CommandExecutionResult.ok();
|
||||
@ -218,7 +218,7 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
public CommandExecutionResult endFork() {
|
||||
if (current() instanceof InstructionFork) {
|
||||
final InstructionFork currentFork = (InstructionFork) current();
|
||||
currentFork.manageOutRendering(nextLinkRenderer());
|
||||
currentFork.manageOutRendering(nextLinkRenderer(), true);
|
||||
setNextLinkRendererInternal(LinkRendering.none());
|
||||
setCurrent(currentFork.getParent());
|
||||
return CommandExecutionResult.ok();
|
||||
@ -349,7 +349,7 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
public void startGroup(Display name, HtmlColor backColor, HtmlColor titleColor, HtmlColor borderColor) {
|
||||
manageSwimlaneStrategy();
|
||||
final InstructionGroup instructionGroup = new InstructionGroup(current(), name, backColor, titleColor,
|
||||
swinlanes.getCurrentSwimlane(), borderColor);
|
||||
swinlanes.getCurrentSwimlane(), borderColor, nextLinkRenderer());
|
||||
current().add(instructionGroup);
|
||||
setCurrent(instructionGroup);
|
||||
}
|
||||
@ -403,8 +403,8 @@ public class ActivityDiagram3 extends UmlDiagram {
|
||||
setNextLink(link);
|
||||
}
|
||||
|
||||
public CommandExecutionResult addNote(Display note, NotePosition position, NoteType type) {
|
||||
final boolean ok = current().addNote(note, position, type);
|
||||
public CommandExecutionResult addNote(Display note, NotePosition position, NoteType type, Colors colors) {
|
||||
final boolean ok = current().addNote(note, position, type, colors);
|
||||
if (ok == false) {
|
||||
return CommandExecutionResult.error("Cannot add note here");
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
@ -80,8 +81,8 @@ public class Branch {
|
||||
return list.kill();
|
||||
}
|
||||
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type) {
|
||||
return list.addNote(note, position, type);
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
|
||||
return list.addNote(note, position, type, colors);
|
||||
}
|
||||
|
||||
public final void setInlinkRendering(LinkRendering inlinkRendering) {
|
||||
|
@ -37,6 +37,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimable;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
@ -50,6 +51,6 @@ public interface Instruction extends Swimable {
|
||||
|
||||
public LinkRendering getInLinkRendering();
|
||||
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type);
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors);
|
||||
|
||||
}
|
||||
|
@ -37,22 +37,28 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNoteOpale;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
public class InstructionFork implements Instruction {
|
||||
public class InstructionFork extends WithNote implements Instruction {
|
||||
|
||||
private final List<InstructionList> forks = new ArrayList<InstructionList>();
|
||||
private final Instruction parent;
|
||||
private final LinkRendering inlinkRendering;
|
||||
private final ISkinParam skinParam;
|
||||
boolean finished = false;
|
||||
|
||||
public InstructionFork(Instruction parent, LinkRendering inlinkRendering) {
|
||||
public InstructionFork(Instruction parent, LinkRendering inlinkRendering, ISkinParam skinParam) {
|
||||
this.parent = parent;
|
||||
this.inlinkRendering = inlinkRendering;
|
||||
this.skinParam = skinParam;
|
||||
this.forks.add(new InstructionList());
|
||||
if (inlinkRendering == null) {
|
||||
throw new IllegalArgumentException();
|
||||
@ -72,7 +78,11 @@ public class InstructionFork implements Instruction {
|
||||
for (InstructionList list : forks) {
|
||||
all.add(list.createFtile(factory));
|
||||
}
|
||||
return factory.createFork(getSwimlaneIn(), all);
|
||||
Ftile result = factory.createFork(getSwimlaneIn(), all);
|
||||
if (getPositionedNotes().size() > 0) {
|
||||
result = FtileWithNoteOpale.create(result, getPositionedNotes(), skinParam, false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Instruction getParent() {
|
||||
@ -91,11 +101,15 @@ public class InstructionFork implements Instruction {
|
||||
return inlinkRendering;
|
||||
}
|
||||
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type) {
|
||||
if (getLastList().getLast() == null) {
|
||||
return getLastList().addNote(note, position, type);
|
||||
@Override
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
|
||||
if (finished) {
|
||||
return super.addNote(note, position, type, colors);
|
||||
}
|
||||
return getLastList().addNote(note, position, type);
|
||||
if (getLastList().getLast() == null) {
|
||||
return getLastList().addNote(note, position, type, colors);
|
||||
}
|
||||
return getLastList().addNote(note, position, type, colors);
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
@ -111,7 +125,10 @@ public class InstructionFork implements Instruction {
|
||||
return getLastList().getSwimlaneOut();
|
||||
}
|
||||
|
||||
public void manageOutRendering(LinkRendering nextLinkRenderer) {
|
||||
public void manageOutRendering(LinkRendering nextLinkRenderer, boolean endFork) {
|
||||
if (endFork) {
|
||||
this.finished = true;
|
||||
}
|
||||
if (nextLinkRenderer == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
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;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
@ -50,13 +51,15 @@ public class InstructionGroup implements Instruction, InstructionCollection {
|
||||
private final HtmlColor backColor;
|
||||
private final HtmlColor borderColor;
|
||||
private final HtmlColor titleColor;
|
||||
private final LinkRendering linkRendering;
|
||||
|
||||
private final Display test;
|
||||
private Display headerNote = Display.NULL;
|
||||
|
||||
public InstructionGroup(Instruction parent, Display test, HtmlColor backColor, HtmlColor titleColor,
|
||||
Swimlane swimlane, HtmlColor borderColor) {
|
||||
Swimlane swimlane, HtmlColor borderColor, LinkRendering linkRendering) {
|
||||
this.list = new InstructionList(swimlane);
|
||||
this.linkRendering = linkRendering;
|
||||
this.parent = parent;
|
||||
this.test = test;
|
||||
this.borderColor = borderColor;
|
||||
@ -81,15 +84,15 @@ public class InstructionGroup implements Instruction, InstructionCollection {
|
||||
}
|
||||
|
||||
public LinkRendering getInLinkRendering() {
|
||||
return LinkRendering.none();
|
||||
return linkRendering;
|
||||
}
|
||||
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type) {
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
|
||||
if (list.isEmpty()) {
|
||||
this.headerNote = note;
|
||||
return true;
|
||||
}
|
||||
return list.addNote(note, position, type);
|
||||
return list.addNote(note, position, type, colors);
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
|
@ -46,10 +46,11 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNoteOpale;
|
||||
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;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
public class InstructionIf implements Instruction, InstructionCollection {
|
||||
public class InstructionIf extends WithNote implements Instruction, InstructionCollection {
|
||||
|
||||
private final List<Branch> thens = new ArrayList<Branch>();
|
||||
private Branch elseBranch;
|
||||
@ -81,10 +82,6 @@ public class InstructionIf implements Instruction, InstructionCollection {
|
||||
current.add(ins);
|
||||
}
|
||||
|
||||
private Display note;
|
||||
private NotePosition position;
|
||||
private NoteType type;
|
||||
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
for (Branch branch : thens) {
|
||||
branch.updateFtile(factory);
|
||||
@ -94,8 +91,8 @@ public class InstructionIf implements Instruction, InstructionCollection {
|
||||
}
|
||||
elseBranch.updateFtile(factory);
|
||||
Ftile result = factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering);
|
||||
if (note != null) {
|
||||
result = new FtileWithNoteOpale(result, note, position, type, skinParam, false);
|
||||
if (getPositionedNotes().size() > 0) {
|
||||
result = FtileWithNoteOpale.create(result, getPositionedNotes(), skinParam, false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -152,14 +149,12 @@ public class InstructionIf implements Instruction, InstructionCollection {
|
||||
return topInlinkRendering;
|
||||
}
|
||||
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type) {
|
||||
if (current.isEmpty()) {
|
||||
this.note = note;
|
||||
this.position = position;
|
||||
this.type = type;
|
||||
return true;
|
||||
@Override
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
|
||||
if (endifCalled || current.isEmpty()) {
|
||||
return super.addNote(note, position, type, colors);
|
||||
} else {
|
||||
return current.addNote(note, position, type);
|
||||
return current.addNote(note, position, type, colors);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileEmpty;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
@ -120,11 +121,11 @@ public class InstructionList extends WithNote implements Instruction, Instructio
|
||||
return all.get(all.size() - 1);
|
||||
}
|
||||
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type) {
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
|
||||
if (getLast() == null) {
|
||||
return super.addNote(note, position, type);
|
||||
return super.addNote(note, position, type, colors);
|
||||
}
|
||||
return getLast().addNote(note, position, type);
|
||||
return getLast().addNote(note, position, type, colors);
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
|
@ -39,6 +39,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
@ -83,7 +84,7 @@ public class InstructionPartition implements Instruction {
|
||||
return list.getInLinkRendering();
|
||||
}
|
||||
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type) {
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ 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;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
@ -119,8 +120,8 @@ public class InstructionRepeat implements Instruction {
|
||||
return nextLinkRenderer;
|
||||
}
|
||||
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type) {
|
||||
return repeatList.addNote(note, position, type);
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
|
||||
return repeatList.addNote(note, position, type, colors);
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
|
@ -41,6 +41,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
@ -102,8 +103,8 @@ public class InstructionSplit implements Instruction {
|
||||
return inlinkRendering;
|
||||
}
|
||||
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type) {
|
||||
return getLast().addNote(note, position, type);
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
|
||||
return getLast().addNote(note, position, type, colors);
|
||||
}
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
|
@ -43,10 +43,11 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNoteOpale;
|
||||
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;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
public class InstructionWhile implements Instruction, InstructionCollection {
|
||||
public class InstructionWhile extends WithNote implements Instruction, InstructionCollection {
|
||||
|
||||
private final InstructionList repeatList = new InstructionList();
|
||||
private final Instruction parent;
|
||||
@ -91,15 +92,11 @@ public class InstructionWhile implements Instruction, InstructionCollection {
|
||||
repeatList.add(ins);
|
||||
}
|
||||
|
||||
private Display note;
|
||||
private NotePosition position;
|
||||
private NoteType type;
|
||||
|
||||
public Ftile createFtile(FtileFactory factory) {
|
||||
Ftile tmp = factory.decorateOut(repeatList.createFtile(factory), endInlinkRendering);
|
||||
tmp = factory.createWhile(swimlane, tmp, test, yes, out, afterEndwhile, color);
|
||||
if (note != null) {
|
||||
tmp = new FtileWithNoteOpale(tmp, note, position, type, skinParam, false);
|
||||
if (getPositionedNotes().size() > 0) {
|
||||
tmp = FtileWithNoteOpale.create(tmp, getPositionedNotes(), skinParam, false);
|
||||
}
|
||||
if (killed) {
|
||||
return new FtileKilled(tmp);
|
||||
@ -136,14 +133,12 @@ public class InstructionWhile implements Instruction, InstructionCollection {
|
||||
this.afterEndwhile = linkRenderer;
|
||||
}
|
||||
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type) {
|
||||
@Override
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
|
||||
if (repeatList.isEmpty()) {
|
||||
this.note = note;
|
||||
this.position = position;
|
||||
this.type = type;
|
||||
return true;
|
||||
return super.addNote(note, position, type, colors);
|
||||
} else {
|
||||
return repeatList.addNote(note, position, type);
|
||||
return repeatList.addNote(note, position, type, colors);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,75 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* 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: 9786 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3;
|
||||
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
public class PositionedNote {
|
||||
|
||||
private final Display display;
|
||||
private final NotePosition notePosition;
|
||||
private final NoteType type;
|
||||
private final Colors colors;
|
||||
|
||||
public PositionedNote(Display display, NotePosition position, NoteType type, Colors colors) {
|
||||
this.display = display;
|
||||
this.notePosition = position;
|
||||
this.type = type;
|
||||
this.colors = colors;
|
||||
}
|
||||
|
||||
public PositionedNote(Display note, NotePosition position, NoteType type) {
|
||||
this(note, position, type, null);
|
||||
}
|
||||
|
||||
public Display getDisplay() {
|
||||
return display;
|
||||
}
|
||||
|
||||
public NotePosition getNotePosition() {
|
||||
return notePosition;
|
||||
}
|
||||
|
||||
public NoteType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public Colors getColors() {
|
||||
return colors;
|
||||
}
|
||||
|
||||
}
|
@ -33,31 +33,36 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
public class WithNote {
|
||||
|
||||
private Display note;
|
||||
private NotePosition notePosition;
|
||||
private NoteType type;
|
||||
private final Collection<PositionedNote> notes = new ArrayList<PositionedNote>();
|
||||
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type) {
|
||||
this.note = note;
|
||||
this.notePosition = position;
|
||||
this.type = type;
|
||||
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
|
||||
this.notes.add(new PositionedNote(note, position, type, colors));
|
||||
return true;
|
||||
}
|
||||
|
||||
final protected Ftile eventuallyAddNote(FtileFactory factory, Ftile ftile, Swimlane swimlane) {
|
||||
if (note != null) {
|
||||
return factory.addNote(ftile, note, notePosition, type, swimlane);
|
||||
}
|
||||
if (notes.size() == 0) {
|
||||
return ftile;
|
||||
}
|
||||
return factory.addNote(ftile, swimlane, notes);
|
||||
}
|
||||
|
||||
public Collection<PositionedNote> getPositionedNotes() {
|
||||
return Collections.unmodifiableCollection(notes);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
|
||||
public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
public static final String ENDING_GROUP = "(;|(?<![/|<>}\\]])(?:[/<}\\]])|(?<!\\</?\\w{1,5})(?<!\\<img[^>]{1,999})(?<!\\<\\$\\w{1,999})(?<!\\>)(?:\\>)|(?<!\\|.{1,999})(?:\\|))";
|
||||
public static final String ENDING_GROUP = "(;|\\\\\\\\|(?<![/|<>}\\]])(?:[/<}\\]])|(?<!\\</?\\w{1,5})(?<!\\<img[^>]{1,999})(?<!\\<\\$\\w{1,999})(?<!\\>)(?:\\>)|(?<!\\|.{1,999})(?:\\|))";
|
||||
|
||||
public CommandActivity3() {
|
||||
super(getRegexConcat());
|
||||
|
@ -40,6 +40,9 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
@ -49,10 +52,17 @@ public class CommandNote3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
super(getRegexConcat());
|
||||
}
|
||||
|
||||
private static ColorParser color() {
|
||||
return ColorParser.simpleColor(ColorType.BACK);
|
||||
}
|
||||
|
||||
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("TYPE", "(note|floating note)"), //
|
||||
new RegexLeaf("POSITION", "[%s]*(left|right)?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
color().getRegex(), //
|
||||
new RegexLeaf("[%s]*:[%s]*"), //
|
||||
new RegexLeaf("NOTE", "(.*)"), //
|
||||
new RegexLeaf("$"));
|
||||
@ -60,10 +70,11 @@ public class CommandNote3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) {
|
||||
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
|
||||
final Display note = Display.getWithNewlines(arg.get("NOTE", 0));
|
||||
final NotePosition position = NotePosition.defaultLeft(arg.get("POSITION", 0));
|
||||
final NoteType type = NoteType.defaultType(arg.get("TYPE", 0));
|
||||
return diagram.addNote(note, position, type);
|
||||
return diagram.addNote(note, position, type, colors);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,6 +43,9 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
@ -52,6 +55,11 @@ public class CommandNoteLong3 extends CommandMultilines2<ActivityDiagram3> {
|
||||
super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE);
|
||||
}
|
||||
|
||||
private static ColorParser color() {
|
||||
return ColorParser.simpleColor(ColorType.BACK);
|
||||
}
|
||||
|
||||
|
||||
public String getPatternEnd() {
|
||||
return "(?i)^end[%s]?note$";
|
||||
}
|
||||
@ -64,13 +72,16 @@ public class CommandNoteLong3 extends CommandMultilines2<ActivityDiagram3> {
|
||||
final NotePosition position = NotePosition.defaultLeft(line0.get("POSITION", 0));
|
||||
final NoteType type = NoteType.defaultType(line0.get("TYPE", 0));
|
||||
final Display note = lines.toDisplay();
|
||||
return diagram.addNote(note, position, type);
|
||||
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
|
||||
return diagram.addNote(note, position, type, colors);
|
||||
}
|
||||
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("TYPE", "(note|floating note)"), //
|
||||
new RegexLeaf("POSITION", "[%s]*(left|right)?"), //
|
||||
new RegexLeaf("[%s]*"), //
|
||||
color().getRegex(), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ public enum BoxStyle {
|
||||
ug.apply(new UTranslate(width - PADDING, 0)).draw(vline);
|
||||
}
|
||||
},
|
||||
SDL_SAVE('/') {
|
||||
SDL_SAVE('\\') {
|
||||
@Override
|
||||
protected Shadowable getShape(double width, double height) {
|
||||
final UPolygon result = new UPolygon();
|
||||
@ -99,6 +99,17 @@ public enum BoxStyle {
|
||||
return result;
|
||||
}
|
||||
},
|
||||
SDL_ANTISAVE('/') {
|
||||
@Override
|
||||
protected Shadowable getShape(double width, double height) {
|
||||
final UPolygon result = new UPolygon();
|
||||
result.addPoint(DELTA_INPUT_OUTPUT, 0.0);
|
||||
result.addPoint(width, 0.0);
|
||||
result.addPoint(width - DELTA_INPUT_OUTPUT, height);
|
||||
result.addPoint(0, height);
|
||||
return result;
|
||||
}
|
||||
},
|
||||
SDL_CONTINUOUS('}') {
|
||||
@Override
|
||||
protected Shadowable getShape(double width, double height) {
|
||||
|
@ -33,18 +33,18 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
public interface FtileFactory {
|
||||
|
||||
@ -60,7 +60,7 @@ public interface FtileFactory {
|
||||
|
||||
public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors);
|
||||
|
||||
public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition, NoteType type, Swimlane swimlane);
|
||||
public Ftile addNote(Ftile ftile, Swimlane swimlane, Collection<PositionedNote> notes);
|
||||
|
||||
public Ftile addUrl(Ftile ftile, Url url);
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
@ -40,6 +41,7 @@ import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
@ -50,8 +52,6 @@ import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
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.sequencediagram.NoteType;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
|
||||
public class FtileFactoryDelegator implements FtileFactory {
|
||||
@ -110,8 +110,8 @@ public class FtileFactoryDelegator implements FtileFactory {
|
||||
return factory.activity(label, swimlane, style, colors);
|
||||
}
|
||||
|
||||
public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition, NoteType type, Swimlane swimlane) {
|
||||
return factory.addNote(ftile, note, notePosition, type, swimlane);
|
||||
public Ftile addNote(Ftile ftile, Swimlane swimlane, Collection<PositionedNote> notes) {
|
||||
return factory.addNote(ftile, swimlane, notes);
|
||||
}
|
||||
|
||||
public Ftile addUrl(Ftile ftile, Url url) {
|
||||
|
@ -33,12 +33,14 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
|
||||
public class FtileFactoryDelegatorAddNote extends FtileFactoryDelegator {
|
||||
@ -48,13 +50,22 @@ public class FtileFactoryDelegatorAddNote extends FtileFactoryDelegator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition, NoteType type, Swimlane swimlane) {
|
||||
if (note == null) {
|
||||
public Ftile addNote(Ftile ftile, Swimlane swimlane, Collection<PositionedNote> notes) {
|
||||
if (notes.size() == 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (notes.size() > 1) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
ISkinParam skinParam = skinParam();
|
||||
final PositionedNote note = notes.iterator().next();
|
||||
if (note.getColors() != null) {
|
||||
skinParam = note.getColors().mute(skinParam);
|
||||
}
|
||||
if (ftile == null) {
|
||||
return new FtileNoteAlone(skinParam().shadowing(), note, skinParam(), type == NoteType.NOTE, swimlane);
|
||||
return new FtileNoteAlone(skinParam.shadowing(), note.getDisplay(), skinParam,
|
||||
note.getType() == NoteType.NOTE, swimlane);
|
||||
}
|
||||
return new FtileWithNoteOpale(ftile, note, notePosition, type, skinParam(), true);
|
||||
return FtileWithNoteOpale.create(ftile, notes, skinParam, true);
|
||||
}
|
||||
}
|
||||
|
@ -66,11 +66,10 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator {
|
||||
final LinkRendering endRepeatLinkRendering = repeat.getOutLinkRendering();
|
||||
final Rainbow endRepeatLinkColor = endRepeatLinkRendering == null ? null : endRepeatLinkRendering.getRainbow();
|
||||
|
||||
final FontParam fontParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND
|
||||
: FontParam.ACTIVITY_ARROW;
|
||||
final FontConfiguration fc = new FontConfiguration(skinParam(), fontParam, null);
|
||||
final FontConfiguration fcDiamond = new FontConfiguration(skinParam(), FontParam.ACTIVITY_DIAMOND, null);
|
||||
final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ACTIVITY_ARROW, null);
|
||||
|
||||
return FtileRepeat.create(backRepeatLinkRendering, swimlane, swimlaneOut, repeat, test, yes, out, borderColor,
|
||||
backColor, arrowColor, endRepeatLinkColor, conditionStyle, this.skinParam(), fc);
|
||||
backColor, arrowColor, endRepeatLinkColor, conditionStyle, this.skinParam(), fcDiamond, fcArrow);
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,6 @@ import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.svek.ConditionStyle;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class FtileIfAndStop extends AbstractFtile {
|
||||
|
@ -180,7 +180,7 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
||||
for (int i = 0; i < diamonds.size() - 1; i++) {
|
||||
final Ftile diam1 = diamonds.get(i);
|
||||
final Ftile diam2 = diamonds.get(i + 1);
|
||||
conns.add(result.new ConnectionHorizontal(diam1, diam2, topInColor));
|
||||
conns.add(result.new ConnectionHorizontal(diam1, diam2, arrowColor));
|
||||
}
|
||||
conns.add(result.new ConnectionIn(topInColor));
|
||||
conns.add(result.new ConnectionLastElseIn(FtileIfWithLinks.getInColor(branch2, arrowColor)));
|
||||
|
@ -101,20 +101,20 @@ class FtileRepeat extends AbstractFtile {
|
||||
public static Ftile create(LinkRendering backRepeatLinkRendering, Swimlane swimlane, Swimlane swimlaneOut,
|
||||
Ftile repeat, Display test, Display yes, Display out, HtmlColor borderColor, HtmlColor backColor,
|
||||
Rainbow arrowColor, Rainbow endRepeatLinkColor, ConditionStyle conditionStyle, ISkinSimple spriteContainer,
|
||||
FontConfiguration fontConfiguration) {
|
||||
FontConfiguration fcDiamond, FontConfiguration fcArrow) {
|
||||
|
||||
final FontConfiguration fontConfiguration1 = conditionStyle == ConditionStyle.INSIDE ? fcDiamond : fcArrow;
|
||||
|
||||
final TextBlock tbTest = (Display.isNull(test) || test.isWhite()) ? TextBlockUtils.empty(0, 0) : test.create(
|
||||
fontConfiguration, HorizontalAlignment.LEFT, spriteContainer);
|
||||
final TextBlock yesTb = yes.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer);
|
||||
final TextBlock outTb = out.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer);
|
||||
fontConfiguration1, HorizontalAlignment.LEFT, spriteContainer);
|
||||
final TextBlock yesTb = yes.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer);
|
||||
final TextBlock outTb = out.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer);
|
||||
|
||||
final Ftile diamond1 = new FtileDiamond(repeat.skinParam(), backColor, borderColor, swimlane);
|
||||
final FtileRepeat result;
|
||||
if (conditionStyle == ConditionStyle.INSIDE) {
|
||||
final Ftile diamond2 = new FtileDiamondInside(repeat.skinParam(), backColor, borderColor, swimlaneOut,
|
||||
tbTest).withEast(yesTb).withSouth(outTb);
|
||||
// final Ftile diamond2 = new FtileDiamondInside(repeat.shadowing(), backColor, borderColor, swimlane,
|
||||
// tbTest).withEast(yesTb).withSouth(outTb);
|
||||
result = new FtileRepeat(repeat, diamond1, diamond2, TextBlockUtils.empty(0, 0));
|
||||
} else if (conditionStyle == ConditionStyle.DIAMOND) {
|
||||
final Ftile diamond2 = new FtileDiamond(repeat.skinParam(), backColor, borderColor, swimlane)
|
||||
@ -129,13 +129,13 @@ class FtileRepeat extends AbstractFtile {
|
||||
|
||||
final List<Connection> conns = new ArrayList<Connection>();
|
||||
final Display in1 = repeat.getInLinkRendering().getDisplay();
|
||||
final TextBlock tbin1 = in1 == null ? null : in1.create(fontConfiguration, HorizontalAlignment.LEFT,
|
||||
spriteContainer, CreoleMode.SIMPLE_LINE);
|
||||
final TextBlock tbin1 = in1 == null ? null : in1.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer,
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
conns.add(result.new ConnectionIn(repeat.getInLinkRendering().getRainbow(arrowColor), tbin1));
|
||||
|
||||
final Display backLink1 = backRepeatLinkRendering.getDisplay();
|
||||
final TextBlock tbbackLink1 = backLink1 == null ? null : backLink1.create(fontConfiguration,
|
||||
HorizontalAlignment.LEFT, spriteContainer, CreoleMode.SIMPLE_LINE);
|
||||
final TextBlock tbbackLink1 = backLink1 == null ? null : backLink1.create(fcArrow, HorizontalAlignment.LEFT,
|
||||
spriteContainer, CreoleMode.SIMPLE_LINE);
|
||||
if (repeat.getSwimlaneIn() == repeat.getSwimlaneOut()) {
|
||||
conns.add(result.new ConnectionBackSimple(backRepeatLinkRendering.getRainbow(arrowColor), tbbackLink1));
|
||||
} else {
|
||||
@ -145,8 +145,8 @@ class FtileRepeat extends AbstractFtile {
|
||||
}
|
||||
|
||||
final Display out1 = repeat.getOutLinkRendering().getDisplay();
|
||||
final TextBlock tbout1 = out1 == null ? null : out1.create(fontConfiguration, HorizontalAlignment.LEFT,
|
||||
spriteContainer, CreoleMode.SIMPLE_LINE);
|
||||
final TextBlock tbout1 = out1 == null ? null : out1.create(fcArrow, HorizontalAlignment.LEFT, spriteContainer,
|
||||
CreoleMode.SIMPLE_LINE);
|
||||
|
||||
final Rainbow tmpColor = endRepeatLinkColor.withDefault(arrowColor);
|
||||
conns.add(result.new ConnectionOut(tmpColor, tbout1));
|
||||
|
@ -35,6 +35,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
@ -42,6 +43,7 @@ import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.Direction;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
@ -52,7 +54,6 @@ import net.sourceforge.plantuml.creole.Sheet;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock2;
|
||||
import net.sourceforge.plantuml.creole.Stencil;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
@ -87,12 +88,24 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
|
||||
return tile.getSwimlaneOut();
|
||||
}
|
||||
|
||||
public FtileWithNoteOpale(Ftile tile, Display note, NotePosition notePosition, NoteType type, ISkinParam skinParam,
|
||||
boolean withLink) {
|
||||
public static Ftile create(Ftile tile, Collection<PositionedNote> notes, ISkinParam skinParam, boolean withLink) {
|
||||
if (notes.size() > 1) {
|
||||
return new FtileWithNotes(tile, notes, skinParam);
|
||||
}
|
||||
if (notes.size() == 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
return new FtileWithNoteOpale(tile, notes.iterator().next(), skinParam, withLink);
|
||||
}
|
||||
|
||||
private FtileWithNoteOpale(Ftile tile, PositionedNote note, ISkinParam skinParam, boolean withLink) {
|
||||
super(tile.skinParam());
|
||||
if (note.getColors() != null) {
|
||||
skinParam = note.getColors().mute(skinParam);
|
||||
}
|
||||
this.tile = tile;
|
||||
this.notePosition = notePosition;
|
||||
if (type == NoteType.FLOATING_NOTE) {
|
||||
this.notePosition = note.getNotePosition();
|
||||
if (note.getType() == NoteType.FLOATING_NOTE) {
|
||||
withLink = false;
|
||||
}
|
||||
|
||||
@ -103,8 +116,8 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil {
|
||||
|
||||
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
|
||||
|
||||
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
|
||||
.createSheet(note);
|
||||
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL).createSheet(note
|
||||
.getDisplay());
|
||||
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), this, new UStroke(1));
|
||||
opale = new Opale(borderColor, noteBackgroundColor, text, skinParam.shadowing(), withLink);
|
||||
|
||||
|
@ -0,0 +1,190 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* 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: 8475 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.creole.CreoleMode;
|
||||
import net.sourceforge.plantuml.creole.CreoleParser;
|
||||
import net.sourceforge.plantuml.creole.Sheet;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
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.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.svek.image.Opale;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.utils.MathUtils;
|
||||
|
||||
public class FtileWithNotes extends AbstractFtile /* implements Stencil */{
|
||||
|
||||
private final Ftile tile;
|
||||
|
||||
private TextBlock left;
|
||||
private TextBlock right;
|
||||
|
||||
private final double suppSpace = 20;
|
||||
|
||||
public Set<Swimlane> getSwimlanes() {
|
||||
return tile.getSwimlanes();
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneIn() {
|
||||
return tile.getSwimlaneIn();
|
||||
}
|
||||
|
||||
public Swimlane getSwimlaneOut() {
|
||||
return tile.getSwimlaneOut();
|
||||
}
|
||||
|
||||
public FtileWithNotes(Ftile tile, Collection<PositionedNote> notes, ISkinParam skinParam) {
|
||||
super(tile.skinParam());
|
||||
// if (note.getColors() != null) {
|
||||
// skinParam = note.getColors().mute(skinParam);
|
||||
// }
|
||||
this.tile = tile;
|
||||
|
||||
final Rose rose = new Rose();
|
||||
|
||||
final HtmlColor noteBackgroundColor = rose.getHtmlColor(skinParam, ColorParam.noteBackground);
|
||||
final HtmlColor borderColor = rose.getHtmlColor(skinParam, ColorParam.noteBorder);
|
||||
|
||||
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
|
||||
|
||||
for (PositionedNote note : notes) {
|
||||
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
|
||||
.createSheet(note.getDisplay());
|
||||
final SheetBlock1 sheet1 = new SheetBlock1(sheet, 0, skinParam.getPadding());
|
||||
|
||||
final TextBlock opale = TextBlockUtils.withMargin(new Opale(borderColor, noteBackgroundColor, sheet1,
|
||||
skinParam.shadowing(), false), 10, 10);
|
||||
if (note.getNotePosition() == NotePosition.LEFT) {
|
||||
if (left == null) {
|
||||
left = opale;
|
||||
} else {
|
||||
left = TextBlockUtils.mergeTB(left, opale, HorizontalAlignment.CENTER);
|
||||
}
|
||||
} else {
|
||||
if (right == null) {
|
||||
right = opale;
|
||||
} else {
|
||||
right = TextBlockUtils.mergeTB(right, opale, HorizontalAlignment.CENTER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (left == null) {
|
||||
left = TextBlockUtils.empty(0, 0);
|
||||
}
|
||||
if (right == null) {
|
||||
right = TextBlockUtils.empty(0, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private UTranslate getTranslate(StringBounder stringBounder) {
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final Dimension2D dimTile = tile.calculateDimension(stringBounder);
|
||||
final double xDelta = left.calculateDimension(stringBounder).getWidth();
|
||||
final double yDelta = (dimTotal.getHeight() - dimTile.getHeight()) / 2;
|
||||
return new UTranslate(xDelta, yDelta);
|
||||
}
|
||||
|
||||
private UTranslate getTranslateForLeft(StringBounder stringBounder) {
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final Dimension2D dimLeft = left.calculateDimension(stringBounder);
|
||||
final double xDelta = 0;
|
||||
final double yDelta = (dimTotal.getHeight() - dimLeft.getHeight()) / 2;
|
||||
return new UTranslate(xDelta, yDelta);
|
||||
}
|
||||
|
||||
private UTranslate getTranslateForRight(StringBounder stringBounder) {
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final Dimension2D dimRight = right.calculateDimension(stringBounder);
|
||||
final double xDelta = dimTotal.getWidth() - dimRight.getWidth();
|
||||
final double yDelta = (dimTotal.getHeight() - dimRight.getHeight()) / 2;
|
||||
return new UTranslate(xDelta, yDelta);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
ug.apply(getTranslateForLeft(stringBounder)).draw(left);
|
||||
ug.apply(getTranslateForRight(stringBounder)).draw(right);
|
||||
ug.apply(getTranslate(stringBounder)).draw(tile);
|
||||
}
|
||||
|
||||
public FtileGeometry calculateDimension(StringBounder stringBounder) {
|
||||
final Dimension2D dimTotal = calculateDimensionInternal(stringBounder);
|
||||
final FtileGeometry orig = tile.calculateDimension(stringBounder);
|
||||
final UTranslate translate = getTranslate(stringBounder);
|
||||
if (orig.hasPointOut()) {
|
||||
return new FtileGeometry(dimTotal, orig.getLeft() + translate.getDx(), orig.getInY() + translate.getDy(),
|
||||
orig.getOutY() + translate.getDy());
|
||||
}
|
||||
return new FtileGeometry(dimTotal, orig.getLeft() + translate.getDx(), orig.getInY() + translate.getDy());
|
||||
}
|
||||
|
||||
private Dimension2D calculateDimensionInternal(StringBounder stringBounder) {
|
||||
final Dimension2D dimTile = tile.calculateDimension(stringBounder);
|
||||
final Dimension2D dimLeft = left.calculateDimension(stringBounder);
|
||||
final Dimension2D dimRight = right.calculateDimension(stringBounder);
|
||||
final double height = MathUtils.max(dimLeft.getHeight(), dimRight.getHeight(), dimTile.getHeight());
|
||||
return new Dimension2DDouble(dimTile.getWidth() + dimLeft.getWidth() + dimRight.getWidth(), height);
|
||||
}
|
||||
|
||||
// public double getStartingX(StringBounder stringBounder, double y) {
|
||||
// return -opale.getMarginX1();
|
||||
// }
|
||||
//
|
||||
// public double getEndingX(StringBounder stringBounder, double y) {
|
||||
// return opale.calculateDimension(stringBounder).getWidth() - opale.getMarginX1();
|
||||
// }
|
||||
|
||||
}
|
@ -34,6 +34,7 @@
|
||||
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
@ -42,6 +43,7 @@ import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.activitydiagram3.Branch;
|
||||
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
|
||||
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileAssemblySimple;
|
||||
@ -57,8 +59,6 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
|
||||
@ -100,7 +100,7 @@ public class VCompactFactory implements FtileFactory {
|
||||
return new FtileBox(colors.mute(skinParam), label, font, swimlane, style);
|
||||
}
|
||||
|
||||
public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition, NoteType type, Swimlane swimlane) {
|
||||
public Ftile addNote(Ftile ftile, Swimlane swimlane, Collection<PositionedNote> notes) {
|
||||
return ftile;
|
||||
}
|
||||
|
||||
|
@ -118,8 +118,8 @@ public class FtileBox extends AbstractFtile {
|
||||
this.swimlane = swimlane;
|
||||
this.inRenreding = new LinkRendering(HtmlColorAndStyle.build(skinParam));
|
||||
final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.ACTIVITY, null);
|
||||
final Sheet sheet = new CreoleParser(fc, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL)
|
||||
.createSheet(label);
|
||||
final Sheet sheet = new CreoleParser(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||
skinParam, CreoleMode.FULL).createSheet(label);
|
||||
this.tb = new SheetBlock2(new SheetBlock1(sheet, 0, skinParam.getPadding()), new MyStencil(), new UStroke(1));
|
||||
this.print = label.toString();
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Code;
|
||||
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
|
||||
public class CommandHideShowSpecificClass extends SingleLineCommand2<CucaDiagram> {
|
||||
@ -67,11 +67,14 @@ public class CommandHideShowSpecificClass extends SingleLineCommand2<CucaDiagram
|
||||
diagram.hideOrShow(LeafType.INTERFACE, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
|
||||
} else {
|
||||
final Code code = Code.of(codeString);
|
||||
final ILeaf leaf = diagram.getEntityFactory().getLeafs().get(code);
|
||||
if (leaf == null) {
|
||||
return CommandExecutionResult.error("Class does not exist : " + code.getFullName());
|
||||
IEntity hidden = diagram.getEntityFactory().getLeafs().get(code);
|
||||
if (hidden == null) {
|
||||
hidden = diagram.getEntityFactory().getGroups().get(code);
|
||||
}
|
||||
diagram.hideOrShow(leaf, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
|
||||
if (hidden == null) {
|
||||
return CommandExecutionResult.error("Class/Package does not exist : " + code.getFullName());
|
||||
}
|
||||
diagram.hideOrShow(hidden, arg.get("COMMAND", 0).equalsIgnoreCase("show"));
|
||||
}
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -71,7 +71,8 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
||||
static private RegexConcat getRegexConcat(UmlDiagramType umlDiagramType) {
|
||||
return new RegexConcat(
|
||||
new RegexLeaf("HEADER", "^(?:@([\\d.]+)[%s]+)?"), //
|
||||
new RegexOr(//
|
||||
new RegexOr(
|
||||
//
|
||||
new RegexLeaf("ENT1", "(?:" + optionalKeywords(umlDiagramType) + "[%s]+)?"
|
||||
+ getClassIdentifier()),
|
||||
new RegexLeaf("COUPLE1",
|
||||
@ -139,6 +140,7 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
|
||||
|
||||
Code ent1 = Code.of(arg.get("ENT1", 1));
|
||||
Code ent2 = Code.of(arg.get("ENT2", 1));
|
||||
|
||||
@ -154,6 +156,18 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
||||
return executePackageLink(diagram, arg);
|
||||
}
|
||||
|
||||
String port1 = null;
|
||||
String port2 = null;
|
||||
|
||||
if (removeMemberPart(diagram, ent1) != null) {
|
||||
port1 = ent1.getPortMember();
|
||||
ent1 = removeMemberPart(diagram, ent1);
|
||||
}
|
||||
if (removeMemberPart(diagram, ent2) != null) {
|
||||
port2 = ent2.getPortMember();
|
||||
ent2 = removeMemberPart(diagram, ent2);
|
||||
}
|
||||
|
||||
final String type1 = arg.get("ENT1", 0);
|
||||
final LeafType typeIfObject1 = getTypeIfObject(type1);
|
||||
|
||||
@ -183,16 +197,6 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
||||
((ILeaf) cl2).muteToType(type, null);
|
||||
}
|
||||
}
|
||||
// if (arg.get("ENT1", 2) != null) {
|
||||
// cl1.setStereotype(new Stereotype(arg.get("ENT1", 2), diagram.getSkinParam().getCircledCharacterRadius(),
|
||||
// diagram.getSkinParam().getFont(FontParam.CIRCLED_CHARACTER, null, false), diagram.getSkinParam()
|
||||
// .getIHtmlColorSet()));
|
||||
// }
|
||||
// if (arg.get("ENT2", 2) != null) {
|
||||
// cl2.setStereotype(new Stereotype(arg.get("ENT2", 2), diagram.getSkinParam().getCircledCharacterRadius(),
|
||||
// diagram.getSkinParam().getFont(FontParam.CIRCLED_CHARACTER, null, false), diagram.getSkinParam()
|
||||
// .getIHtmlColorSet()));
|
||||
// }
|
||||
|
||||
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
|
||||
|
||||
@ -266,6 +270,7 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
||||
|
||||
Link link = new Link(cl1, cl2, linkType, Display.getWithNewlines(labelLink), queue, firstLabel, secondLabel,
|
||||
diagram.getLabeldistance(), diagram.getLabelangle());
|
||||
link.setPortMembers(port1, port2);
|
||||
|
||||
if (dir == Direction.LEFT || dir == Direction.UP) {
|
||||
link = link.getInv();
|
||||
@ -279,6 +284,26 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
private Code removeMemberPart(AbstractClassOrObjectDiagram diagram, Code code) {
|
||||
if (diagram.leafExist(code)) {
|
||||
return null;
|
||||
}
|
||||
final Code before = code.removeMemberPart();
|
||||
if (before == null) {
|
||||
return null;
|
||||
}
|
||||
if (diagram.leafExist(before) == false) {
|
||||
return null;
|
||||
}
|
||||
return before;
|
||||
}
|
||||
|
||||
// private CommandExecutionResult executeLinkFields(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
|
||||
// System.err.println("field1=" + arg.get("ENT1", 1));
|
||||
// System.err.println("field2=" + arg.get("ENT2", 1));
|
||||
// return CommandExecutionResult.error("not working yet");
|
||||
// }
|
||||
|
||||
private void addLink(AbstractClassOrObjectDiagram diagram, Link link, String weight) {
|
||||
diagram.addLink(link);
|
||||
if (weight == null) {
|
||||
|
@ -50,6 +50,22 @@ public class Code implements Comparable<Code> {
|
||||
this.separator = separator;
|
||||
}
|
||||
|
||||
public Code removeMemberPart() {
|
||||
final int x = fullName.lastIndexOf("::");
|
||||
if (x == -1) {
|
||||
return null;
|
||||
}
|
||||
return new Code(fullName.substring(0, x), separator);
|
||||
}
|
||||
|
||||
public String getPortMember() {
|
||||
final int x = fullName.lastIndexOf("::");
|
||||
if (x == -1) {
|
||||
return null;
|
||||
}
|
||||
return fullName.substring(x + 2);
|
||||
}
|
||||
|
||||
// public String getNamespaceSeparator() {
|
||||
// return separator;
|
||||
// }
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19540 $
|
||||
* Revision $Revision: 20028 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram;
|
||||
@ -482,7 +482,7 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
|
||||
}
|
||||
}
|
||||
|
||||
public void hideOrShow(ILeaf leaf, boolean show) {
|
||||
public void hideOrShow(IEntity leaf, boolean show) {
|
||||
leaf.setRemoved(!show);
|
||||
}
|
||||
|
||||
|
@ -63,12 +63,13 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockSimple;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockSpotted;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockSprited;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
import net.sourceforge.plantuml.sequencediagram.MessageNumber;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
|
||||
|
||||
public class Display implements Iterable<CharSequence> {
|
||||
|
||||
@ -413,15 +414,22 @@ public class Display implements Iterable<CharSequence> {
|
||||
private TextBlock createStereotype(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
|
||||
SpriteContainer spriteContainer, int position, UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
|
||||
final Stereotype stereotype = (Stereotype) get(position);
|
||||
TextBlock circledCharacter = null;
|
||||
if (stereotype.isSpotted()) {
|
||||
final CircledCharacter circledCharacter = new CircledCharacter(stereotype.getCharacter(),
|
||||
stereotype.getRadius(), stereotype.getCircledFont(), stereotype.getHtmlColor(), null,
|
||||
fontConfiguration.getColor());
|
||||
circledCharacter = new CircledCharacter(stereotype.getCharacter(), stereotype.getRadius(),
|
||||
stereotype.getCircledFont(), stereotype.getHtmlColor(), null, fontConfiguration.getColor());
|
||||
} else if (stereotype.getSprite() != null) {
|
||||
final Sprite tmp = spriteContainer.getSprite(stereotype.getSprite());
|
||||
if (tmp != null) {
|
||||
circledCharacter = tmp.asTextBlock(stereotype.getHtmlColor(), 1);
|
||||
}
|
||||
}
|
||||
if (circledCharacter != null) {
|
||||
if (stereotype.getLabel(false) == null) {
|
||||
return new TextBlockSpotted(circledCharacter, this.subList(1, this.size()), fontConfiguration,
|
||||
return new TextBlockSprited(circledCharacter, this.subList(1, this.size()), fontConfiguration,
|
||||
horizontalAlignment, spriteContainer);
|
||||
}
|
||||
return new TextBlockSpotted(circledCharacter, this, fontConfiguration, horizontalAlignment, spriteContainer);
|
||||
return new TextBlockSprited(circledCharacter, this, fontConfiguration, horizontalAlignment, spriteContainer);
|
||||
}
|
||||
return new TextBlockSimple(this, fontConfiguration, horizontalAlignment, spriteContainer, 0, fontForStereotype,
|
||||
htmlColorForStereotype);
|
||||
|
76
src/net/sourceforge/plantuml/cucadiagram/EntityPort.java
Normal file
76
src/net/sourceforge/plantuml/cucadiagram/EntityPort.java
Normal file
@ -0,0 +1,76 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* 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: 19635 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram;
|
||||
|
||||
public class EntityPort {
|
||||
|
||||
private final String uid;
|
||||
private final String portName;
|
||||
|
||||
public EntityPort(String uid, String portName) {
|
||||
this.uid = uid;
|
||||
this.portName = portName;
|
||||
}
|
||||
|
||||
public String getFullString() {
|
||||
if (portName != null) {
|
||||
return uid + ":" + portName;
|
||||
}
|
||||
return uid;
|
||||
}
|
||||
|
||||
private boolean isShielded() {
|
||||
return uid.endsWith(":h");
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
if (isShielded()) {
|
||||
return uid.substring(0, uid.length() - 2);
|
||||
}
|
||||
return uid;
|
||||
}
|
||||
|
||||
public boolean startsWith(String centerId) {
|
||||
return uid.startsWith(centerId);
|
||||
}
|
||||
|
||||
public boolean equalsId(EntityPort other) {
|
||||
return this.uid.equals(other.uid);
|
||||
}
|
||||
|
||||
public String getPortName() {
|
||||
return portName;
|
||||
}
|
||||
|
||||
}
|
@ -247,16 +247,12 @@ public class GroupRoot implements IGroup {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void applyStroke(String s) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void applyStroke(Colors colors) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public FontConfiguration getFontConfigurationForTitle(ISkinParam skinParam) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void setRemoved(boolean removed) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -86,7 +86,5 @@ public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, Li
|
||||
|
||||
public Map<String, Display> getTips();
|
||||
|
||||
@Deprecated
|
||||
public void applyStroke(String s);
|
||||
|
||||
public void setRemoved(boolean removed);
|
||||
}
|
||||
|
@ -65,10 +65,12 @@ public interface ILeaf extends IEntity {
|
||||
|
||||
public void setSvekImage(IEntityImage svekImage);
|
||||
|
||||
public void setRemoved(boolean removed);
|
||||
|
||||
public void setNeighborhood(Neighborhood neighborhood);
|
||||
|
||||
public Neighborhood getNeighborhood();
|
||||
|
||||
public boolean hasPort();
|
||||
|
||||
public void setHasPort(boolean hasPort);
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19635 $
|
||||
* Revision $Revision: 20057 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram;
|
||||
@ -49,6 +49,7 @@ import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.USymbolInterface;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.svek.Bibliotekon;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.utils.UniqueSequence;
|
||||
|
||||
@ -56,6 +57,10 @@ public class Link implements Hideable, Removeable {
|
||||
|
||||
final private IEntity cl1;
|
||||
final private IEntity cl2;
|
||||
|
||||
private String port1;
|
||||
private String port2;
|
||||
|
||||
private LinkType type;
|
||||
final private Display label;
|
||||
|
||||
@ -153,6 +158,8 @@ public class Link implements Hideable, Removeable {
|
||||
final Link result = new Link(cl2, cl1, getType().getInversed(), label, length, qualifier2, qualifier1,
|
||||
labeldistance, labelangle, specificColor);
|
||||
result.inverted = true;
|
||||
result.port1 = this.port2;
|
||||
result.port2 = this.port1;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -226,6 +233,14 @@ public class Link implements Hideable, Removeable {
|
||||
return cl2;
|
||||
}
|
||||
|
||||
public EntityPort getEntityPort1(Bibliotekon bibliotekon) {
|
||||
return new EntityPort(bibliotekon.getShapeUid((ILeaf) cl1), port1);
|
||||
}
|
||||
|
||||
public EntityPort getEntityPort2(Bibliotekon bibliotekon) {
|
||||
return new EntityPort(bibliotekon.getShapeUid((ILeaf) cl2), port2);
|
||||
}
|
||||
|
||||
public LinkType getType() {
|
||||
if (opale) {
|
||||
return new LinkType(LinkDecor.NONE, LinkDecor.NONE);
|
||||
@ -522,4 +537,15 @@ public class Link implements Hideable, Removeable {
|
||||
return colors;
|
||||
}
|
||||
|
||||
public void setPortMembers(String port1, String port2) {
|
||||
this.port1 = port1;
|
||||
this.port2 = port2;
|
||||
if (port1 != null) {
|
||||
((ILeaf) cl1).setHasPort(true);
|
||||
}
|
||||
if (port2 != null) {
|
||||
((ILeaf) cl2).setHasPort(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,4 +49,6 @@ public interface Member {
|
||||
public boolean isStatic();
|
||||
|
||||
public boolean isAbstract();
|
||||
|
||||
public String getPort();
|
||||
}
|
||||
|
@ -205,4 +205,13 @@ public class MemberImpl implements Member {
|
||||
return s.contains("(") || s.contains(")");
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
final Pattern2 pattern = MyPattern.cmpile("([\\p{L}0-9_.]+)");
|
||||
final Matcher2 matcher = pattern.matcher(display);
|
||||
if (matcher.find() == false) {
|
||||
return null;
|
||||
}
|
||||
return matcher.group(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,6 +54,8 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockWidth;
|
||||
import net.sourceforge.plantuml.skin.VisibilityModifier;
|
||||
import net.sourceforge.plantuml.skin.rose.Rose;
|
||||
import net.sourceforge.plantuml.svek.Ports;
|
||||
import net.sourceforge.plantuml.svek.WithPorts;
|
||||
import net.sourceforge.plantuml.ugraphic.PlacementStrategy;
|
||||
import net.sourceforge.plantuml.ugraphic.PlacementStrategyVisibility;
|
||||
import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2Center;
|
||||
@ -62,7 +64,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.ULayoutGroup;
|
||||
import net.sourceforge.plantuml.utils.CharHidder;
|
||||
|
||||
public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockWidth, TextBlock {
|
||||
public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockWidth, TextBlock, WithPorts {
|
||||
|
||||
public TextBlock asBlockMemberImpl() {
|
||||
return new TextBlockLineBefore(TextBlockUtils.withMargin(this, 6, 4));
|
||||
@ -123,6 +125,18 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
|
||||
return new Dimension2DDouble(x, y);
|
||||
}
|
||||
|
||||
public Ports getPorts(StringBounder stringBounder) {
|
||||
final Ports result = new Ports();
|
||||
double y = 0;
|
||||
for (Member m : members) {
|
||||
final TextBlock bloc = createTextBlock(m);
|
||||
final Dimension2D dim = bloc.calculateDimension(stringBounder);
|
||||
result.add(m.getPort(), y, dim.getHeight());
|
||||
y += dim.getHeight();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private TextBlock createTextBlock(Member m) {
|
||||
final boolean withVisibilityChar = skinParam.classAttributeIconSize() == 0;
|
||||
String s = m.getDisplay(withVisibilityChar);
|
||||
|
@ -98,6 +98,7 @@ final class EntityImpl implements ILeaf, IGroup {
|
||||
|
||||
// Other
|
||||
private boolean nearDecoration = false;
|
||||
private boolean hasPort = false;
|
||||
private int xposition;
|
||||
private IEntityImage svekImage;
|
||||
|
||||
@ -470,6 +471,9 @@ final class EntityImpl implements ILeaf, IGroup {
|
||||
|
||||
public boolean isRemoved() {
|
||||
if (isGroup()) {
|
||||
if (removed) {
|
||||
return true;
|
||||
}
|
||||
if (getLeafsDirect().size() == 0) {
|
||||
return false;
|
||||
}
|
||||
@ -577,15 +581,13 @@ final class EntityImpl implements ILeaf, IGroup {
|
||||
// colors = colors.addSpecificLineStroke(specificLineStroke);
|
||||
// }
|
||||
|
||||
@Deprecated
|
||||
public void applyStroke(String s) {
|
||||
throw new UnsupportedOperationException();
|
||||
// if (s == null) {
|
||||
// return;
|
||||
// }
|
||||
// final LinkStyle style = LinkStyle.valueOf(StringUtils.goUpperCase(s));
|
||||
// colors = colors.addSpecificLineStroke(style);
|
||||
// // setSpecificLineStroke(LinkStyle.getStroke(style));
|
||||
public boolean hasPort() {
|
||||
checkNotGroup();
|
||||
return hasPort;
|
||||
}
|
||||
|
||||
public void setHasPort(boolean hasPort) {
|
||||
this.hasPort = hasPort;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ import net.sourceforge.plantuml.version.PSystemVersion;
|
||||
|
||||
public class PSystemDonors extends AbstractPSystem {
|
||||
|
||||
public static final String DONORS = "UDfTayzosZ0Gnk_x53fxaeTmS4fh8Cb0cixajjWRB11QLv99pRFrrXVhcjP8HYVlQFzyt-hdt6J_3pbueK1EvJQmrLZ1AsNny16M74Fd8HzBSGjp5w-eXmrjqGUDLZrnOo6tDJirPmfd6Zu_FYHZJ4SBIqm6sG257WDj88-j-GIRBaheOQwpwR4CvQYoyx09r3ParOov5N_5E8SyB8utfUnWnaPRjURE4vJTpNssPp4o1gs6LQ8QZsaeet93lz3MiivPewNh3bqlJjTNstO7JwdwS8PdeqzIKEZg8CglDzh2ex-sjec8Z4vGd8ywk5ujiU4QeHoM_jwWj4_oCZBnkUGSUbcJnI1veazqbV_4qs7YojQJy5AffP6HicSNz1c-nkkQOQMhXenwG6twr84vfsAylvLM4jhx4gkV7NbLT5k7yhGcsd_ZVQ2gKGk77gEa7GcnoGD-3g19YbhmIQVSNCZv7lrhX7N2yZ1YudClrMr26H-6HJsmGukclLFl591R3slnYwvM2psyD7mnx8Rrh_xyDkR2GEJ39AmANSihNGx7vGyGD5D7FW5cMDGBZkoizKH-RhJQ8DRoNxaTgHzaT-Jkr2f__RR98_SPMvZJv7zAzs0huUUetiH38KJ_1SHA3uG0";
|
||||
public static final String DONORS = "UDfTaq5osp0CHVSu1TUQv12AbRgLxIHZf-bCTh24MBHfGYKff_BPkkl52hcLIPahOGY0_mDFkSd-7tBmGe6SocrWgx62LyhYuICiEOREGpwMuXRcBbvH3nlQeWyQhNhYna9kQtPgpXJED7n-V4Z6c8uMbfWyP0CKUWoqWJosvXDikYYXXxdEfiSobAFApiCcKDkGLJFcLlmLuplaON6yAMK7CpRQgZLtdg3iRkwpFOkHCMWrh1BLU4n3UIetz0jjBUESDLgwxj3rudHzjMrty9Ig3sTuDlea1OMk3gByUgCjFFfhQvk8oEW4nVceW-lL4Xkk4SfXwEyDIliaBoCJroNdqCkOB0R94tsYg_mddWuJLxQUX9TABOsCb3sxeC_mDLxN32jTDMJK0shJfmxCEHNZ_Qsqaj3UbrZzxCYhejiwbDMQQF-Dzu6gHYqSUeoITYJ49Wly742J5BNWaqwvkP3pFVhN2Ek4vU69YS-zLBS9PNmO1lN03YsQzawzKq1kFQp5BxfQBVImQVXYs0tZN_tvRSo5WSY7ILWLkfPNkXoEmnyWQAQEV0BCCAWN7DbPwudyt6YrGQpblt8xKZ_8xiZTgLN--csJH-upjZ2doV-Kpi5MmizHlOc7GeXUn4n7mzhbJreImL-1InMx";
|
||||
|
||||
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
|
||||
final GraphicStrings result = getGraphicStrings();
|
||||
|
@ -88,6 +88,9 @@ public class EpsGraphicsMacro extends EpsGraphics {
|
||||
|
||||
@Override
|
||||
public void fill(int windingRule) {
|
||||
if (macroInProgress != null) {
|
||||
closeMacro();
|
||||
}
|
||||
if (windingRule == PathIterator.WIND_EVEN_ODD) {
|
||||
append("eofill", true);
|
||||
} else if (windingRule == PathIterator.WIND_NON_ZERO) {
|
||||
|
@ -37,11 +37,13 @@ import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.svek.Ports;
|
||||
import net.sourceforge.plantuml.svek.WithPorts;
|
||||
import net.sourceforge.plantuml.ugraphic.UChangeColor;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UHorizontalLine;
|
||||
|
||||
public class TextBlockLineBefore extends AbstractTextBlock implements TextBlock {
|
||||
public class TextBlockLineBefore extends AbstractTextBlock implements TextBlock, WithPorts {
|
||||
|
||||
private final TextBlock textBlock;
|
||||
private final char separator;
|
||||
@ -87,4 +89,8 @@ public class TextBlockLineBefore extends AbstractTextBlock implements TextBlock
|
||||
return textBlock.getInnerPosition(member, stringBounder);
|
||||
}
|
||||
|
||||
public Ports getPorts(StringBounder stringBounder) {
|
||||
return ((WithPorts) textBlock).getPorts(stringBounder);
|
||||
}
|
||||
|
||||
}
|
@ -37,10 +37,12 @@ import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.svek.Ports;
|
||||
import net.sourceforge.plantuml.svek.WithPorts;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
class TextBlockMarged extends AbstractTextBlock implements TextBlock {
|
||||
class TextBlockMarged extends AbstractTextBlock implements TextBlock, WithPorts {
|
||||
|
||||
private final TextBlock textBlock;
|
||||
private final double x1;
|
||||
@ -76,4 +78,8 @@ class TextBlockMarged extends AbstractTextBlock implements TextBlock {
|
||||
return translate.apply(parent);
|
||||
}
|
||||
|
||||
public Ports getPorts(StringBounder stringBounder) {
|
||||
return ((WithPorts) textBlock).getPorts(stringBounder).translateY(y1);
|
||||
}
|
||||
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19109 $
|
||||
* Revision $Revision: 19999 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
@ -66,9 +66,9 @@ public class TextBlockSimple extends AbstractTextBlock implements TextBlock {
|
||||
this(texts, fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, null, null);
|
||||
}
|
||||
|
||||
public TextBlockSimple(Display texts, FontConfiguration fontConfiguration,
|
||||
HorizontalAlignment horizontalAlignment, SpriteContainer spriteContainer, double maxMessageSize,
|
||||
UFont fontForStereotype, HtmlColor htmlColorForStereotype) {
|
||||
public TextBlockSimple(Display texts, FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
|
||||
SpriteContainer spriteContainer, double maxMessageSize, UFont fontForStereotype,
|
||||
HtmlColor htmlColorForStereotype) {
|
||||
this.texts = texts;
|
||||
this.fontConfiguration = fontConfiguration;
|
||||
this.horizontalAlignment = horizontalAlignment;
|
||||
@ -159,7 +159,6 @@ public class TextBlockSimple extends AbstractTextBlock implements TextBlock {
|
||||
assert s.getLabel(false) != null;
|
||||
final List<SingleLine> result = new ArrayList<SingleLine>();
|
||||
for (String st : s.getLabels(spriteContainer.useGuillemet())) {
|
||||
// st = Stereotype.manageGuillemet(st);
|
||||
result.add(new SingleLine(st, fontConfiguration, horizontalAlignment, spriteContainer));
|
||||
}
|
||||
return Collections.unmodifiableList(result);
|
||||
|
@ -41,20 +41,20 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class TextBlockSpotted extends TextBlockSimple {
|
||||
public class TextBlockSprited extends TextBlockSimple {
|
||||
|
||||
private final CircledCharacter circledCharacter;
|
||||
private final TextBlock sprite;
|
||||
|
||||
public TextBlockSpotted(CircledCharacter circledCharacter, Display texts, FontConfiguration fontConfiguration,
|
||||
public TextBlockSprited(TextBlock sprite, Display texts, FontConfiguration fontConfiguration,
|
||||
HorizontalAlignment horizontalAlignment, SpriteContainer spriteContainer) {
|
||||
super(texts, fontConfiguration, horizontalAlignment, spriteContainer, 0);
|
||||
this.circledCharacter = circledCharacter;
|
||||
this.sprite = sprite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
final double widthCircledCharacter = getCircledCharacterWithAndMargin(stringBounder);
|
||||
final double heightCircledCharacter = circledCharacter.getPreferredHeight(stringBounder);
|
||||
final double heightCircledCharacter = sprite.calculateDimension(stringBounder).getHeight();
|
||||
|
||||
final Dimension2D dim = super.calculateDimension(stringBounder);
|
||||
return new Dimension2DDouble(dim.getWidth() + widthCircledCharacter, Math.max(heightCircledCharacter,
|
||||
@ -62,19 +62,18 @@ public class TextBlockSpotted extends TextBlockSimple {
|
||||
}
|
||||
|
||||
private double getCircledCharacterWithAndMargin(StringBounder stringBounder) {
|
||||
return circledCharacter.getPreferredWidth(stringBounder) + 6.0;
|
||||
return sprite.calculateDimension(stringBounder).getWidth() + 6.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
circledCharacter.drawU(ug);
|
||||
sprite.drawU(ug);
|
||||
|
||||
final double widthCircledCharacter = getCircledCharacterWithAndMargin(stringBounder);
|
||||
|
||||
super.drawU(ug.apply(new UTranslate(widthCircledCharacter, 0)));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -39,10 +39,12 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.svek.Ports;
|
||||
import net.sourceforge.plantuml.svek.WithPorts;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class TextBlockVertical2 extends AbstractTextBlock implements TextBlock {
|
||||
public class TextBlockVertical2 extends AbstractTextBlock implements TextBlock, WithPorts {
|
||||
|
||||
private final List<TextBlock> blocks = new ArrayList<TextBlock>();
|
||||
private final HorizontalAlignment horizontalAlignment;
|
||||
@ -89,6 +91,18 @@ public class TextBlockVertical2 extends AbstractTextBlock implements TextBlock {
|
||||
}
|
||||
}
|
||||
|
||||
public Ports getPorts(StringBounder stringBounder) {
|
||||
double y = 0;
|
||||
// final Dimension2D dimtotal = calculateDimension(stringBounder);
|
||||
final Ports result = new Ports();
|
||||
for (TextBlock block : blocks) {
|
||||
final Dimension2D dimb = block.calculateDimension(stringBounder);
|
||||
y += dimb.getHeight();
|
||||
result.addThis(((WithPorts) block).getPorts(stringBounder));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) {
|
||||
double y = 0;
|
||||
|
@ -483,7 +483,8 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
|
||||
final double marginLabel = 1; // startUid.equals(endUid) ? 6 : 1;
|
||||
ISkinParam skinParam = diagram.getSkinParam();
|
||||
final FontConfiguration labelFont = new FontConfiguration(skinParam, FontParam.GENERIC_ARROW, null);
|
||||
final TextBlock label = link.getLabel().create(labelFont, skinParam.getDefaultTextAlignment(), skinParam);
|
||||
final TextBlock label = link.getLabel().create(labelFont,
|
||||
skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER), skinParam);
|
||||
if (TextBlockUtils.isEmpty(label)) {
|
||||
return label;
|
||||
}
|
||||
|
@ -41,11 +41,10 @@ import net.sourceforge.plantuml.CharSequence2;
|
||||
import net.sourceforge.plantuml.CharSequence2Impl;
|
||||
import net.sourceforge.plantuml.LineLocation;
|
||||
import net.sourceforge.plantuml.LineLocationImpl;
|
||||
import net.sourceforge.plantuml.Log;
|
||||
|
||||
public class ReadLineReader implements ReadLine {
|
||||
|
||||
private static final int LIMIT = 700;
|
||||
// private static final int LIMIT = 850;
|
||||
private final BufferedReader br;
|
||||
private LineLocationImpl location;
|
||||
|
||||
@ -64,10 +63,10 @@ public class ReadLineReader implements ReadLine {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
if (s.length() > LIMIT) {
|
||||
Log.debug("Line truncated from " + s.length() + " to " + LIMIT);
|
||||
s = s.substring(0, LIMIT);
|
||||
}
|
||||
// if (s.length() > LIMIT) {
|
||||
// Log.debug("Line truncated from " + s.length() + " to " + LIMIT);
|
||||
// s = s.substring(0, LIMIT);
|
||||
// }
|
||||
if (s.startsWith("\uFEFF")) {
|
||||
s = s.substring(1);
|
||||
}
|
||||
|
@ -28,19 +28,16 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19945 $
|
||||
* Revision $Revision: 20080 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public abstract class AbstractComponent implements Component {
|
||||
|
@ -52,6 +52,8 @@ import net.sourceforge.plantuml.version.IteratorCounter2Impl;
|
||||
|
||||
final public class SuggestEngine {
|
||||
|
||||
private static final int LIMIT = 500;
|
||||
|
||||
private final UmlDiagramFactory systemFactory;
|
||||
|
||||
private final IteratorCounter2 it99;
|
||||
@ -100,13 +102,15 @@ final public class SuggestEngine {
|
||||
}
|
||||
|
||||
SuggestEngineResult checkAndCorrect() {
|
||||
final String incorrectLine = it99.peek().toString();
|
||||
if (incorrectLine.length() > LIMIT) {
|
||||
return SuggestEngineResult.CANNOT_CORRECT;
|
||||
}
|
||||
final CommandControl commandControl = systemFactory.isValid2(it99);
|
||||
if (commandControl != CommandControl.NOT_OK) {
|
||||
return SuggestEngineResult.SYNTAX_OK;
|
||||
}
|
||||
|
||||
final String incorrectLine = it99.peek().toString();
|
||||
|
||||
if (StringUtils.trin(incorrectLine).startsWith("{")
|
||||
&& systemFactory.isValid(BlocLines.single(it99.peekPrevious() + " {")) != CommandControl.NOT_OK) {
|
||||
return new SuggestEngineResult(it99.peekPrevious() + " {");
|
||||
|
@ -181,15 +181,15 @@ public class Cluster implements Moveable {
|
||||
}
|
||||
|
||||
for (Line l : lines) {
|
||||
if (tops.contains(l.getStartUid())) {
|
||||
final Shape sh = shs.get(l.getEndUid());
|
||||
if (tops.contains(l.getStartUidPrefix())) {
|
||||
final Shape sh = shs.get(l.getEndUidPrefix());
|
||||
if (sh != null && sh.getEntityPosition() == EntityPosition.NORMAL) {
|
||||
firsts.add(0, sh);
|
||||
}
|
||||
}
|
||||
|
||||
if (l.isInverted()) {
|
||||
final Shape sh = shs.get(l.getStartUid());
|
||||
final Shape sh = shs.get(l.getStartUidPrefix());
|
||||
if (sh != null && sh.getEntityPosition() == EntityPosition.NORMAL) {
|
||||
firsts.add(0, sh);
|
||||
}
|
||||
@ -230,15 +230,15 @@ public class Cluster implements Moveable {
|
||||
}
|
||||
|
||||
for (Line l : lines) {
|
||||
if (tops.contains(l.getStartUid())) {
|
||||
final Shape sh = shs.get(l.getEndUid());
|
||||
if (tops.contains(l.getStartUidPrefix())) {
|
||||
final Shape sh = shs.get(l.getEndUidPrefix());
|
||||
if (sh != null) {
|
||||
all.remove(sh);
|
||||
}
|
||||
}
|
||||
|
||||
if (l.isInverted()) {
|
||||
final Shape sh = shs.get(l.getStartUid());
|
||||
final Shape sh = shs.get(l.getStartUidPrefix());
|
||||
if (sh != null) {
|
||||
all.remove(sh);
|
||||
}
|
||||
@ -302,6 +302,8 @@ public class Cluster implements Moveable {
|
||||
HtmlColor borderColor;
|
||||
if (umlDiagramType == UmlDiagramType.STATE) {
|
||||
borderColor = getColor(ColorParam.stateBorder, skinParam, stereotype);
|
||||
} else if (umlDiagramType == UmlDiagramType.ACTIVITY) {
|
||||
borderColor = getColor(ColorParam.packageBorder, skinParam, stereotype);
|
||||
} else {
|
||||
borderColor = getColor(ColorParam.packageBorder, skinParam, stereotype);
|
||||
}
|
||||
@ -326,7 +328,7 @@ public class Cluster implements Moveable {
|
||||
if (group.getColors(skinParam).getColor(ColorType.LINE) != null) {
|
||||
borderColor = group.getColors(skinParam).getColor(ColorType.LINE);
|
||||
}
|
||||
drawUState(ug, borderColor, skinParam2, stroke);
|
||||
drawUState(ug, borderColor, skinParam2, stroke, umlDiagramType);
|
||||
return;
|
||||
}
|
||||
PackageStyle style = group.getPackageStyle();
|
||||
@ -341,7 +343,7 @@ public class Cluster implements Moveable {
|
||||
}
|
||||
|
||||
if (ztitle != null || zstereo != null) {
|
||||
final HtmlColor back = getBackColor(getBackColor(), skinParam2, group.getStereotype());
|
||||
final HtmlColor back = getBackColor(getBackColor(umlDiagramType), skinParam2, group.getStereotype());
|
||||
final ClusterDecoration decoration = new ClusterDecoration(style, group.getUSymbol(), ztitle, zstereo,
|
||||
minX, minY, maxX, maxY, getStroke(skinParam2, group.getStereotype()));
|
||||
decoration.drawU(ug, back, borderColor, skinParam2.shadowing());
|
||||
@ -351,7 +353,7 @@ public class Cluster implements Moveable {
|
||||
if (skinParam2.shadowing()) {
|
||||
rect.setDeltaShadow(3.0);
|
||||
}
|
||||
final HtmlColor backColor = getBackColor(getBackColor(), skinParam2, group.getStereotype());
|
||||
final HtmlColor backColor = getBackColor(getBackColor(umlDiagramType), skinParam2, group.getStereotype());
|
||||
ug = ug.apply(new UChangeBackColor(backColor)).apply(new UChangeColor(borderColor));
|
||||
ug.apply(new UStroke(2)).apply(new UTranslate(minX, minY)).draw(rect);
|
||||
|
||||
@ -414,7 +416,8 @@ public class Cluster implements Moveable {
|
||||
return new Rose().getHtmlColor(skinParam, colorParam, stereo);
|
||||
}
|
||||
|
||||
private void drawUState(UGraphic ug, HtmlColor borderColor, ISkinParam skinParam2, UStroke stroke) {
|
||||
private void drawUState(UGraphic ug, HtmlColor borderColor, ISkinParam skinParam2, UStroke stroke,
|
||||
UmlDiagramType umlDiagramType) {
|
||||
final Dimension2D total = new Dimension2DDouble(maxX - minX, maxY - minY);
|
||||
final double suppY;
|
||||
if (ztitle == null) {
|
||||
@ -424,7 +427,7 @@ public class Cluster implements Moveable {
|
||||
+ IEntityImage.MARGIN_LINE;
|
||||
}
|
||||
|
||||
HtmlColor stateBack = getBackColor();
|
||||
HtmlColor stateBack = getBackColor(umlDiagramType);
|
||||
if (stateBack == null) {
|
||||
stateBack = getColor(skinParam2, ColorParam.stateBackground, group.getStereotype());
|
||||
}
|
||||
@ -578,8 +581,8 @@ public class Cluster implements Moveable {
|
||||
if (l.hasEntryPoint()) {
|
||||
continue;
|
||||
}
|
||||
final String startUid = l.getStartUid();
|
||||
final String endUid = l.getEndUid();
|
||||
final String startUid = l.getStartUidPrefix();
|
||||
final String endUid = l.getEndUidPrefix();
|
||||
if (isInCluster(startUid) && isInCluster(endUid)) {
|
||||
final String same = l.rankSame();
|
||||
if (same != null) {
|
||||
@ -796,7 +799,7 @@ public class Cluster implements Moveable {
|
||||
return colorTitle;
|
||||
}
|
||||
|
||||
private final HtmlColor getBackColor() {
|
||||
private final HtmlColor getBackColor(final UmlDiagramType umlDiagramType) {
|
||||
if (EntityUtils.groupRoot(group)) {
|
||||
return null;
|
||||
}
|
||||
@ -806,7 +809,8 @@ public class Cluster implements Moveable {
|
||||
}
|
||||
final Stereotype stereo = group.getStereotype();
|
||||
final USymbol sym = group.getUSymbol() == null ? USymbol.PACKAGE : group.getUSymbol();
|
||||
final ColorParam backparam = sym.getColorParamBack();
|
||||
final ColorParam backparam = umlDiagramType == UmlDiagramType.ACTIVITY ? ColorParam.partitionBackground : sym
|
||||
.getColorParamBack();
|
||||
final HtmlColor c1 = skinParam.getHtmlColor(backparam, stereo, false);
|
||||
if (c1 != null) {
|
||||
return c1;
|
||||
@ -814,7 +818,7 @@ public class Cluster implements Moveable {
|
||||
if (parent == null) {
|
||||
return null;
|
||||
}
|
||||
return parent.getBackColor();
|
||||
return parent.getBackColor(umlDiagramType);
|
||||
}
|
||||
|
||||
public boolean isClusterOf(IEntity ent) {
|
||||
|
@ -159,26 +159,11 @@ public final class CucaDiagramFileMakerSvek2 {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
final String shapeUid1 = getBibliotekon().getShapeUid((ILeaf) link.getEntity1());
|
||||
final String shapeUid2 = getBibliotekon().getShapeUid((ILeaf) link.getEntity2());
|
||||
|
||||
Cluster ltail = null;
|
||||
if (shapeUid1.startsWith(Cluster.CENTER_ID)) {
|
||||
// final Group g1 = ((IEntityMutable)
|
||||
// link.getEntity1()).getContainerOrEquivalent();
|
||||
ltail = getCluster2((IEntity) link.getEntity1());
|
||||
}
|
||||
Cluster lhead = null;
|
||||
if (shapeUid2.startsWith(Cluster.CENTER_ID)) {
|
||||
// final Group g2 = ((IEntityMutable)
|
||||
// link.getEntity2()).getContainerOrEquivalent();
|
||||
lhead = getCluster2((IEntity) link.getEntity2());
|
||||
}
|
||||
final ISkinParam skinParam = dotData.getSkinParam();
|
||||
final FontConfiguration labelFont = new FontConfiguration(skinParam, FontParam.GENERIC_ARROW, null);
|
||||
|
||||
final Line line = new Line(shapeUid1, shapeUid2, link, colorSequence, ltail, lhead, skinParam,
|
||||
stringBounder, labelFont, getBibliotekon(), dotData.getPragma());
|
||||
final Line line = new Line(link, colorSequence, skinParam, stringBounder, labelFont, getBibliotekon(),
|
||||
dotData.getPragma());
|
||||
|
||||
getBibliotekon().addLine(line);
|
||||
|
||||
@ -272,24 +257,6 @@ public final class CucaDiagramFileMakerSvek2 {
|
||||
return nb == 1;
|
||||
}
|
||||
|
||||
// private Cluster getCluster(IEntity g) {
|
||||
// for (Cluster cl : getBibliotekon().allCluster()) {
|
||||
// if (cl.getGroup() == g) {
|
||||
// return cl;
|
||||
// }
|
||||
// }
|
||||
// throw new IllegalArgumentException(g.toString());
|
||||
// }
|
||||
|
||||
private Cluster getCluster2(IEntity entityMutable) {
|
||||
for (Cluster cl : getBibliotekon().allCluster()) {
|
||||
if (entityMutable == cl.getGroup()) {
|
||||
return cl;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
private IEntityImage error(File dotExe) {
|
||||
|
||||
final List<String> msg = new ArrayList<String>();
|
||||
|
@ -358,8 +358,8 @@ public class DotStringFactory implements Moveable {
|
||||
|
||||
for (Shape sh : bibliotekon.allShapes()) {
|
||||
int idx = svg.indexOf("<title>" + sh.getUid() + "</title>");
|
||||
if (sh.getType() == ShapeType.RECTANGLE || sh.getType() == ShapeType.FOLDER
|
||||
|| sh.getType() == ShapeType.DIAMOND) {
|
||||
if (sh.getType() == ShapeType.RECTANGLE || sh.getType() == ShapeType.RECTANGLE_HTML_FOR_PORTS
|
||||
|| sh.getType() == ShapeType.FOLDER || sh.getType() == ShapeType.DIAMOND) {
|
||||
final List<Point2D.Double> points = SvekUtils.extractPointsList(svg, idx, fullHeight);
|
||||
final double minX = SvekUtils.getMinX(points);
|
||||
final double minY = SvekUtils.getMinY(points);
|
||||
|
@ -47,6 +47,7 @@ import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.Url;
|
||||
import net.sourceforge.plantuml.command.Position;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.EntityPort;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
@ -90,8 +91,8 @@ public class Line implements Moveable, Hideable {
|
||||
private final Cluster lhead;
|
||||
private final Link link;
|
||||
|
||||
private final String startUid;
|
||||
private final String endUid;
|
||||
private final EntityPort startUid;
|
||||
private final EntityPort endUid;
|
||||
|
||||
private final TextBlock startTailText;
|
||||
private final TextBlock endHeadText;
|
||||
@ -188,16 +189,33 @@ public class Line implements Moveable, Hideable {
|
||||
|
||||
}
|
||||
|
||||
// private boolean projectionStart() {
|
||||
// return startUid.startsWith(Cluster.CENTER_ID);
|
||||
// }
|
||||
|
||||
public Line(String startUid, String endUid, Link link, ColorSequence colorSequence, Cluster ltail, Cluster lhead,
|
||||
ISkinParam skinParam, StringBounder stringBounder, FontConfiguration labelFont, Bibliotekon bibliotekon,
|
||||
Pragma pragma) {
|
||||
if (startUid == null || endUid == null || link == null) {
|
||||
private Cluster getCluster2(Bibliotekon bibliotekon, IEntity entityMutable) {
|
||||
for (Cluster cl : bibliotekon.allCluster()) {
|
||||
if (entityMutable == cl.getGroup()) {
|
||||
return cl;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
public Line(Link link, ColorSequence colorSequence, ISkinParam skinParam, StringBounder stringBounder,
|
||||
FontConfiguration labelFont, Bibliotekon bibliotekon, Pragma pragma) {
|
||||
|
||||
if (link == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.startUid = link.getEntityPort1(bibliotekon);
|
||||
this.endUid = link.getEntityPort2(bibliotekon);
|
||||
|
||||
Cluster ltail = null;
|
||||
if (startUid.startsWith(Cluster.CENTER_ID)) {
|
||||
ltail = getCluster2(bibliotekon, link.getEntity1());
|
||||
}
|
||||
Cluster lhead = null;
|
||||
if (endUid.startsWith(Cluster.CENTER_ID)) {
|
||||
lhead = getCluster2(bibliotekon, link.getEntity2());
|
||||
}
|
||||
|
||||
if (link.getColors() != null) {
|
||||
skinParam = link.getColors().mute(skinParam);
|
||||
labelFont = labelFont.mute(link.getColors());
|
||||
@ -207,8 +225,6 @@ public class Line implements Moveable, Hideable {
|
||||
this.bibliotekon = bibliotekon;
|
||||
this.stringBounder = stringBounder;
|
||||
this.link = link;
|
||||
this.startUid = startUid;
|
||||
this.endUid = endUid;
|
||||
this.ltail = ltail;
|
||||
this.lhead = lhead;
|
||||
|
||||
@ -229,10 +245,10 @@ public class Line implements Moveable, Hideable {
|
||||
labelOnly = new DirectionalTextBlock(right, left, up, down);
|
||||
}
|
||||
} else {
|
||||
final double marginLabel = startUid.equals(endUid) ? 6 : 1;
|
||||
final double marginLabel = startUid.equalsId(endUid) ? 6 : 1;
|
||||
final TextBlock label = TextBlockUtils.withMargin(
|
||||
link.getLabel().create(labelFont, skinParam.getDefaultTextAlignment(), skinParam), marginLabel,
|
||||
marginLabel);
|
||||
link.getLabel().create(labelFont, skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER),
|
||||
skinParam), marginLabel, marginLabel);
|
||||
if (getLinkArrow() == LinkArrow.NONE) {
|
||||
labelOnly = label;
|
||||
} else {
|
||||
@ -304,9 +320,9 @@ public class Line implements Moveable, Hideable {
|
||||
// sb.append("->");
|
||||
// sb.append(startUid);
|
||||
// } else {
|
||||
sb.append(startUid);
|
||||
sb.append(startUid.getFullString());
|
||||
sb.append("->");
|
||||
sb.append(endUid);
|
||||
sb.append(endUid.getFullString());
|
||||
// }
|
||||
sb.append("[");
|
||||
final LinkType linkType = link.getTypePatchCluster();
|
||||
@ -377,7 +393,7 @@ public class Line implements Moveable, Hideable {
|
||||
// }
|
||||
if (pragma.horizontalLineBetweenDifferentPackageAllowed() == false && link.getLength() == 1
|
||||
/* && graphvizVersion.isJs() == false */) {
|
||||
return "{rank=same; " + getStartUid() + "; " + getEndUid() + "}";
|
||||
return "{rank=same; " + getStartUidPrefix() + "; " + getEndUidPrefix() + "}";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -403,18 +419,12 @@ public class Line implements Moveable, Hideable {
|
||||
sb.append("</TABLE>");
|
||||
}
|
||||
|
||||
public final String getStartUid() {
|
||||
if (startUid.endsWith(":h")) {
|
||||
return startUid.substring(0, startUid.length() - 2);
|
||||
}
|
||||
return startUid;
|
||||
public final String getStartUidPrefix() {
|
||||
return startUid.getPrefix();
|
||||
}
|
||||
|
||||
public final String getEndUid() {
|
||||
if (endUid.endsWith(":h")) {
|
||||
return endUid.substring(0, endUid.length() - 2);
|
||||
}
|
||||
return endUid;
|
||||
public final String getEndUidPrefix() {
|
||||
return endUid.getPrefix();
|
||||
}
|
||||
|
||||
private UDrawable getExtremity(LinkDecor decor, PointListIterator pointListIterator, Point2D center, double angle,
|
||||
@ -693,7 +703,7 @@ public class Line implements Moveable, Hideable {
|
||||
}
|
||||
|
||||
public double getHorizontalDzeta(StringBounder stringBounder) {
|
||||
if (startUid.equals(endUid)) {
|
||||
if (startUid.equalsId(endUid)) {
|
||||
return getDecorDzeta();
|
||||
}
|
||||
final ArithmeticStrategy strategy;
|
||||
@ -719,7 +729,7 @@ public class Line implements Moveable, Hideable {
|
||||
}
|
||||
|
||||
public double getVerticalDzeta(StringBounder stringBounder) {
|
||||
if (startUid.equals(endUid)) {
|
||||
if (startUid.equalsId(endUid)) {
|
||||
return getDecorDzeta();
|
||||
}
|
||||
if (isHorizontal()) {
|
||||
|
67
src/net/sourceforge/plantuml/svek/PortGeometry.java
Normal file
67
src/net/sourceforge/plantuml/svek/PortGeometry.java
Normal file
@ -0,0 +1,67 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
public class PortGeometry {
|
||||
|
||||
private final double position;
|
||||
private final double height;
|
||||
|
||||
public PortGeometry(double position, double height) {
|
||||
this.position = position;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public PortGeometry translateY(double deltaY) {
|
||||
return new PortGeometry(position + deltaY, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "pos=" + position + " height=" + height;
|
||||
}
|
||||
|
||||
public double getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public double getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public double getLastY() {
|
||||
return position + height;
|
||||
}
|
||||
|
||||
}
|
63
src/net/sourceforge/plantuml/svek/Ports.java
Normal file
63
src/net/sourceforge/plantuml/svek/Ports.java
Normal file
@ -0,0 +1,63 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* 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.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Ports {
|
||||
|
||||
private final Map<String, PortGeometry> all = new LinkedHashMap<String, PortGeometry>();
|
||||
|
||||
public void addThis(Ports other) {
|
||||
all.putAll(other.all);
|
||||
}
|
||||
|
||||
public Ports translateY(double deltaY) {
|
||||
final Ports result = new Ports();
|
||||
for (Map.Entry<String, PortGeometry> ent : all.entrySet()) {
|
||||
result.all.put(ent.getKey(), ent.getValue().translateY(deltaY));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void add(String portName, double position, double height) {
|
||||
all.put(portName, new PortGeometry(position, height));
|
||||
}
|
||||
|
||||
public Map<String, PortGeometry> getAll() {
|
||||
return all;
|
||||
}
|
||||
|
||||
}
|
@ -36,12 +36,14 @@ package net.sourceforge.plantuml.svek;
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.Hideable;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.cucadiagram.EntityPosition;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
import net.sourceforge.plantuml.posimo.Positionable;
|
||||
import net.sourceforge.plantuml.svek.image.EntityImageDescription;
|
||||
import net.sourceforge.plantuml.svek.image.EntityImageStateBorder;
|
||||
@ -96,7 +98,7 @@ public class Shape implements Positionable, IShapePseudo, Hideable {
|
||||
this.color = colorSequence.getValue();
|
||||
this.uid = String.format("sh%04d", color);
|
||||
this.shield = shield;
|
||||
if (shield > 0 && type != ShapeType.RECTANGLE) {
|
||||
if (shield > 0 && type != ShapeType.RECTANGLE && type != ShapeType.RECTANGLE_HTML_FOR_PORTS) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
@ -114,6 +116,10 @@ public class Shape implements Positionable, IShapePseudo, Hideable {
|
||||
}
|
||||
|
||||
public void appendShape(StringBuilder sb) {
|
||||
if (type == ShapeType.RECTANGLE_HTML_FOR_PORTS) {
|
||||
appendLabelHtmlSpecialForLink(sb);
|
||||
return;
|
||||
}
|
||||
if (type == ShapeType.RECTANGLE && shield > 0) {
|
||||
appendHtml(sb);
|
||||
return;
|
||||
@ -169,6 +175,47 @@ public class Shape implements Positionable, IShapePseudo, Hideable {
|
||||
sb.append("</TABLE>");
|
||||
}
|
||||
|
||||
private void appendLabelHtmlSpecialForLink(StringBuilder sb) {
|
||||
final Ports ports = ((WithPorts) this.image).getPorts(StringBounderUtils.asStringBounder());
|
||||
|
||||
sb.append(uid);
|
||||
sb.append(" [");
|
||||
sb.append("shape=plaintext,");
|
||||
// sb.append("color=\"" + StringUtils.getAsHtml(color) + "\",");
|
||||
sb.append("label=<");
|
||||
sb.append("<TABLE BGCOLOR=\"" + StringUtils.getAsHtml(color)
|
||||
+ "\" BORDER=\"0\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">");
|
||||
double position = 0;
|
||||
for (Map.Entry<String, PortGeometry> ent : ports.getAll().entrySet()) {
|
||||
final String portName = ent.getKey();
|
||||
final PortGeometry geom = ent.getValue();
|
||||
final double missing = geom.getPosition() - position;
|
||||
appendTr(sb, null, missing);
|
||||
appendTr(sb, portName, geom.getHeight());
|
||||
position = geom.getLastY();
|
||||
}
|
||||
appendTr(sb, null, getHeight() - position);
|
||||
sb.append("</TABLE>");
|
||||
sb.append(">");
|
||||
sb.append("];");
|
||||
SvekUtils.println(sb);
|
||||
}
|
||||
|
||||
private void appendTr(StringBuilder sb, final String portName, final double height) {
|
||||
if (height <= 0) {
|
||||
return;
|
||||
}
|
||||
sb.append("<TR>");
|
||||
sb.append("<TD ");
|
||||
sb.append(" FIXEDSIZE=\"TRUE\" WIDTH=\"" + getWidth() + "\" HEIGHT=\"" + height + "\"");
|
||||
if (portName != null) {
|
||||
sb.append(" PORT=\"" + portName + "\"");
|
||||
}
|
||||
sb.append(">");
|
||||
sb.append("</TD>");
|
||||
sb.append("</TR>");
|
||||
}
|
||||
|
||||
private void appendTd(StringBuilder sb, int w, int h) {
|
||||
sb.append("<TD");
|
||||
sb.append(" FIXEDSIZE=\"TRUE\" WIDTH=\"" + w + "\" HEIGHT=\"" + h + "\"");
|
||||
@ -186,6 +233,8 @@ public class Shape implements Positionable, IShapePseudo, Hideable {
|
||||
throw new UnsupportedOperationException();
|
||||
} else if (type == ShapeType.RECTANGLE || type == ShapeType.FOLDER) {
|
||||
sb.append("shape=rect");
|
||||
} else if (type == ShapeType.RECTANGLE_HTML_FOR_PORTS) {
|
||||
throw new UnsupportedOperationException();
|
||||
} else if (type == ShapeType.OCTAGON) {
|
||||
sb.append("shape=octagon");
|
||||
} else if (type == ShapeType.DIAMOND) {
|
||||
|
@ -35,6 +35,6 @@ package net.sourceforge.plantuml.svek;
|
||||
|
||||
public enum ShapeType {
|
||||
|
||||
RECTANGLE, ROUND_RECTANGLE, CIRCLE, CIRCLE_IN_RECT, OVAL, DIAMOND, OCTAGON, FOLDER
|
||||
RECTANGLE, RECTANGLE_HTML_FOR_PORTS, ROUND_RECTANGLE, CIRCLE, CIRCLE_IN_RECT, OVAL, DIAMOND, OCTAGON, FOLDER
|
||||
|
||||
}
|
||||
|
42
src/net/sourceforge/plantuml/svek/WithPorts.java
Normal file
42
src/net/sourceforge/plantuml/svek/WithPorts.java
Normal file
@ -0,0 +1,42 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* 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 net.sourceforge.plantuml.graphic.StringBounder;
|
||||
|
||||
public interface WithPorts {
|
||||
|
||||
Ports getPorts(StringBounder stringBounder);
|
||||
|
||||
}
|
@ -36,7 +36,6 @@ package net.sourceforge.plantuml.svek.extremity;
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UPolygon;
|
||||
|
@ -54,7 +54,9 @@ import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.svek.AbstractEntityImage;
|
||||
import net.sourceforge.plantuml.svek.Ports;
|
||||
import net.sourceforge.plantuml.svek.ShapeType;
|
||||
import net.sourceforge.plantuml.svek.WithPorts;
|
||||
import net.sourceforge.plantuml.ugraphic.Shadowable;
|
||||
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
|
||||
import net.sourceforge.plantuml.ugraphic.UChangeColor;
|
||||
@ -64,7 +66,7 @@ import net.sourceforge.plantuml.ugraphic.URectangle;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
|
||||
public class EntityImageClass extends AbstractEntityImage implements Stencil {
|
||||
public class EntityImageClass extends AbstractEntityImage implements Stencil, WithPorts {
|
||||
|
||||
final private TextBlock body;
|
||||
final private int shield;
|
||||
@ -81,7 +83,8 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil {
|
||||
this.shield = version != null && version.useShield() && entity.hasNearDecoration() ? 16 : 0;
|
||||
final boolean showMethods = portionShower.showPortion(EntityPortion.METHOD, entity);
|
||||
final boolean showFields = portionShower.showPortion(EntityPortion.FIELD, entity);
|
||||
this.body = entity.getBodier().getBody(FontParam.CLASS_ATTRIBUTE, getSkinParam(), showMethods, showFields, entity.getStereotype());
|
||||
this.body = entity.getBodier().getBody(FontParam.CLASS_ATTRIBUTE, getSkinParam(), showMethods, showFields,
|
||||
entity.getStereotype());
|
||||
|
||||
header = new EntityImageClassHeader2(entity, getSkinParam(), portionShower);
|
||||
this.url = entity.getUrl99();
|
||||
@ -165,6 +168,11 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil {
|
||||
}
|
||||
}
|
||||
|
||||
public Ports getPorts(StringBounder stringBounder) {
|
||||
final Dimension2D dimHeader = header.calculateDimension(stringBounder);
|
||||
return ((WithPorts) body).getPorts(stringBounder).translateY(dimHeader.getHeight());
|
||||
}
|
||||
|
||||
private UStroke getStroke() {
|
||||
UStroke stroke = lineConfig.getColors(getSkinParam()).getSpecificLineStroke();
|
||||
if (stroke == null) {
|
||||
@ -177,6 +185,9 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil {
|
||||
}
|
||||
|
||||
public ShapeType getShapeType() {
|
||||
if (((ILeaf) getEntity()).hasPort()) {
|
||||
return ShapeType.RECTANGLE_HTML_FOR_PORTS;
|
||||
}
|
||||
return ShapeType.RECTANGLE;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19109 $
|
||||
* Revision $Revision: 20096 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.svg;
|
||||
@ -42,6 +42,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
@ -97,6 +98,8 @@ public class SvgGraphics {
|
||||
private int maxY = 10;
|
||||
|
||||
private final double scale;
|
||||
private final String filterUid;
|
||||
private final String shadowId;
|
||||
|
||||
final protected void ensureVisible(double x, double y) {
|
||||
if (x > maxX) {
|
||||
@ -124,6 +127,9 @@ public class SvgGraphics {
|
||||
defs = simpleElement("defs");
|
||||
gRoot = simpleElement("g");
|
||||
strokeWidth = "" + scale;
|
||||
final Random rnd = new Random();
|
||||
this.filterUid = "b" + Integer.toString(Math.abs(rnd.nextInt()), 36);
|
||||
this.shadowId = "f" + Integer.toString(Math.abs(rnd.nextInt()), 36);
|
||||
} catch (ParserConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
throw new IllegalStateException(e);
|
||||
@ -188,9 +194,7 @@ public class SvgGraphics {
|
||||
elt.setAttribute("ry", format(yRadius));
|
||||
elt.setAttribute("fill", fill);
|
||||
elt.setAttribute("style", getStyle());
|
||||
if (deltaShadow > 0) {
|
||||
elt.setAttribute("filter", "url(#f1)");
|
||||
}
|
||||
addFilterShadowId(elt, deltaShadow);
|
||||
getG().appendChild(elt);
|
||||
}
|
||||
ensureVisible(x + xRadius + deltaShadow * 2, y + yRadius + deltaShadow * 2);
|
||||
@ -313,9 +317,7 @@ public class SvgGraphics {
|
||||
manageShadow(deltaShadow);
|
||||
if (hidden == false) {
|
||||
final Element elt = createRectangleInternal(x, y, width, height);
|
||||
if (deltaShadow > 0) {
|
||||
elt.setAttribute("filter", "url(#f1)");
|
||||
}
|
||||
addFilterShadowId(elt, deltaShadow);
|
||||
if (rx > 0 && ry > 0) {
|
||||
elt.setAttribute("rx", format(rx));
|
||||
elt.setAttribute("ry", format(ry));
|
||||
@ -346,9 +348,7 @@ public class SvgGraphics {
|
||||
elt.setAttribute("x2", format(x2));
|
||||
elt.setAttribute("y2", format(y2));
|
||||
elt.setAttribute("style", getStyle());
|
||||
if (deltaShadow > 0) {
|
||||
elt.setAttribute("filter", "url(#f1)");
|
||||
}
|
||||
addFilterShadowId(elt, deltaShadow);
|
||||
getG().appendChild(elt);
|
||||
}
|
||||
ensureVisible(x1 + 2 * deltaShadow, y1 + 2 * deltaShadow);
|
||||
@ -381,9 +381,7 @@ public class SvgGraphics {
|
||||
elt.setAttribute("points", sb.toString());
|
||||
elt.setAttribute("fill", fill);
|
||||
elt.setAttribute("style", getStyle());
|
||||
if (deltaShadow > 0) {
|
||||
elt.setAttribute("filter", "url(#f1)");
|
||||
}
|
||||
addFilterShadowId(elt, deltaShadow);
|
||||
getG().appendChild(elt);
|
||||
}
|
||||
|
||||
@ -448,7 +446,7 @@ public class SvgGraphics {
|
||||
private String getIdFilterBackColor(String color) {
|
||||
String result = filterBackColor.get(color);
|
||||
if (result == null) {
|
||||
result = "b" + filterBackColor.size();
|
||||
result = filterUid + filterBackColor.size();
|
||||
filterBackColor.put(color, result);
|
||||
}
|
||||
return result;
|
||||
@ -591,13 +589,17 @@ public class SvgGraphics {
|
||||
elt.setAttribute("d", sb.toString());
|
||||
elt.setAttribute("style", getStyle());
|
||||
elt.setAttribute("fill", fill);
|
||||
if (deltaShadow > 0) {
|
||||
elt.setAttribute("filter", "url(#f1)");
|
||||
}
|
||||
addFilterShadowId(elt, deltaShadow);
|
||||
getG().appendChild(elt);
|
||||
}
|
||||
}
|
||||
|
||||
private void addFilterShadowId(final Element elt, double deltaShadow) {
|
||||
if (deltaShadow > 0) {
|
||||
elt.setAttribute("filter", "url(#" + shadowId + ")");
|
||||
}
|
||||
}
|
||||
|
||||
private StringBuilder currentPath = null;
|
||||
|
||||
public void newpath() {
|
||||
@ -701,7 +703,7 @@ public class SvgGraphics {
|
||||
if (withShadow == false) {
|
||||
// <filter id="f1" x="0" y="0" width="120%" height="120%">
|
||||
final Element filter = (Element) document.createElement("filter");
|
||||
filter.setAttribute("id", "f1");
|
||||
filter.setAttribute("id", shadowId);
|
||||
filter.setAttribute("x", "-1");
|
||||
filter.setAttribute("y", "-1");
|
||||
filter.setAttribute("width", "300%");
|
||||
|
@ -56,7 +56,7 @@ public class DriverCenteredCharacterEps implements UDriver<EpsGraphics> {
|
||||
|
||||
final TextLayout t = new TextLayout("" + c, font.getFont(), TextBlockUtils.getFontRenderContext());
|
||||
eps.setStrokeColor(mapper.getMappedColor(param.getColor()));
|
||||
DriverTextEps.drawPathIterator(eps, xpos, ypos, t.getOutline(null).getPathIterator(null));
|
||||
DriverTextEps.drawPathIterator(eps, xpos, ypos, t.getOutline(null));
|
||||
|
||||
}
|
||||
|
||||
|
@ -32,9 +32,12 @@
|
||||
package net.sourceforge.plantuml.ugraphic.eps;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Shape;
|
||||
import java.awt.font.FontRenderContext;
|
||||
import java.awt.font.TextLayout;
|
||||
import java.awt.geom.PathIterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.eps.EpsGraphics;
|
||||
import net.sourceforge.plantuml.eps.EpsGraphicsMacroAndText;
|
||||
@ -85,7 +88,8 @@ public class DriverTextEps implements UDriver<EpsGraphics> {
|
||||
final FontConfiguration fontConfiguration = shape.getFontConfiguration();
|
||||
final UFont font = fontConfiguration.getFont();
|
||||
|
||||
final TextLayout t = new TextLayout(shape.getText(), font.getFont(), fontRenderContext);
|
||||
final TextLayout textLayout = new TextLayout(shape.getText(), font.getFont(), fontRenderContext);
|
||||
// System.err.println("text=" + shape.getText());
|
||||
|
||||
MinMax dim = null;
|
||||
|
||||
@ -96,14 +100,14 @@ public class DriverTextEps implements UDriver<EpsGraphics> {
|
||||
eps.setFillColor(extended);
|
||||
eps.setStrokeWidth("1", 0, 0);
|
||||
if (dim == null) {
|
||||
dim = getMinMax(x, y, t.getOutline(null).getPathIterator(null));
|
||||
dim = getMinMax(x, y, getOutline(textLayout).getPathIterator(null));
|
||||
}
|
||||
eps.epsRectangle(dim.getMinX() - 1, dim.getMinY() - 1, dim.getWidth() + 2, dim.getHeight() + 2, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
eps.setStrokeColor(mapper.getMappedColor(fontConfiguration.getColor()));
|
||||
drawPathIterator(eps, x, y, t.getOutline(null).getPathIterator(null));
|
||||
drawPathIterator(eps, x, y, getOutline(textLayout));
|
||||
|
||||
if (fontConfiguration.containsStyle(FontStyle.UNDERLINE)) {
|
||||
final HtmlColor extended = fontConfiguration.getExtendedColor();
|
||||
@ -111,7 +115,7 @@ public class DriverTextEps implements UDriver<EpsGraphics> {
|
||||
eps.setStrokeColor(mapper.getMappedColor(extended));
|
||||
}
|
||||
if (dim == null) {
|
||||
dim = getMinMax(x, y, t.getOutline(null).getPathIterator(null));
|
||||
dim = getMinMax(x, y, getOutline(textLayout).getPathIterator(null));
|
||||
}
|
||||
eps.setStrokeWidth("1.1", 0, 0);
|
||||
eps.epsLine(x, y + 1.5, x + dim.getWidth(), y + 1.5);
|
||||
@ -119,7 +123,7 @@ public class DriverTextEps implements UDriver<EpsGraphics> {
|
||||
}
|
||||
if (fontConfiguration.containsStyle(FontStyle.WAVE)) {
|
||||
if (dim == null) {
|
||||
dim = getMinMax(x, y, t.getOutline(null).getPathIterator(null));
|
||||
dim = getMinMax(x, y, getOutline(textLayout).getPathIterator(null));
|
||||
}
|
||||
final int ypos = (int) (y + 2.5) - 1;
|
||||
final HtmlColor extended = fontConfiguration.getExtendedColor();
|
||||
@ -139,7 +143,7 @@ public class DriverTextEps implements UDriver<EpsGraphics> {
|
||||
eps.setStrokeColor(mapper.getMappedColor(extended));
|
||||
}
|
||||
if (dim == null) {
|
||||
dim = getMinMax(x, y, t.getOutline(null).getPathIterator(null));
|
||||
dim = getMinMax(x, y, getOutline(textLayout).getPathIterator(null));
|
||||
}
|
||||
// final FontMetrics fm = font.getFontMetrics();
|
||||
final double ypos = (dim.getMinY() + dim.getMaxY() * 2) / 3;
|
||||
@ -150,6 +154,10 @@ public class DriverTextEps implements UDriver<EpsGraphics> {
|
||||
|
||||
}
|
||||
|
||||
private Shape getOutline(final TextLayout textLayout) {
|
||||
return textLayout.getOutline(null);
|
||||
}
|
||||
|
||||
private void drawAsText(UText shape, double x, double y, UParam param, EpsGraphics eps, ColorMapper mapper) {
|
||||
final FontConfiguration fontConfiguration = shape.getFontConfiguration();
|
||||
// final FontMetrics fm = g2dummy.getFontMetrics(fontConfiguration.getFont().getFont());
|
||||
@ -161,8 +169,26 @@ public class DriverTextEps implements UDriver<EpsGraphics> {
|
||||
|
||||
}
|
||||
|
||||
static void drawPathIterator(EpsGraphics eps, double x, double y, PathIterator path) {
|
||||
static void drawPathIterator(EpsGraphics eps, double x, double y, Shape shape) {
|
||||
final List<Integer> breaks = analyze(shape);
|
||||
if (breaks.size() == 0) {
|
||||
final PathIterator path = shape.getPathIterator(null);
|
||||
drawSingle(eps, x, y, path);
|
||||
return;
|
||||
}
|
||||
// System.err.println("breaks=" + breaks);
|
||||
final PathIterator path = new PathIteratorLimited(shape, 0, breaks.get(0));
|
||||
drawSingle(eps, x, y, path);
|
||||
for (int i = 0; i < breaks.size() - 1; i++) {
|
||||
final PathIterator path2 = new PathIteratorLimited(shape, breaks.get(i) + 1, breaks.get(i + 1));
|
||||
drawSingle(eps, x, y, path2);
|
||||
}
|
||||
final PathIterator path3 = new PathIteratorLimited(shape, breaks.get(breaks.size() - 1) + 1, Integer.MAX_VALUE);
|
||||
drawSingle(eps, x, y, path3);
|
||||
|
||||
}
|
||||
|
||||
private static void drawSingle(EpsGraphics eps, double x, double y, final PathIterator path) {
|
||||
eps.newpath();
|
||||
final double coord[] = new double[6];
|
||||
while (path.isDone() == false) {
|
||||
@ -185,7 +211,40 @@ public class DriverTextEps implements UDriver<EpsGraphics> {
|
||||
}
|
||||
|
||||
eps.fill(path.getWindingRule());
|
||||
}
|
||||
|
||||
private static List<Integer> analyze(Shape shape) {
|
||||
int count = PathIteratorLimited.count(shape);
|
||||
final List<Integer> closings = getClosings(shape.getPathIterator(null));
|
||||
final List<Integer> result = new ArrayList<Integer>();
|
||||
for (Integer cl : closings) {
|
||||
if (cl + 2 >= count) {
|
||||
break;
|
||||
}
|
||||
final PathIterator path1 = new PathIteratorLimited(shape, 0, cl);
|
||||
final PathIterator path2 = new PathIteratorLimited(shape, cl + 1, Integer.MAX_VALUE);
|
||||
final double max1 = getMinMax(0, 0, path1).getMaxX();
|
||||
final double min2 = getMinMax(0, 0, path2).getMinX();
|
||||
if (min2 > max1) {
|
||||
result.add(cl);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static List<Integer> getClosings(PathIterator path) {
|
||||
final List<Integer> result = new ArrayList<Integer>();
|
||||
int current = 0;
|
||||
final double coord[] = new double[6];
|
||||
while (path.isDone() == false) {
|
||||
final int code = path.currentSegment(coord);
|
||||
if (code == PathIterator.SEG_CLOSE) {
|
||||
result.add(current);
|
||||
}
|
||||
current++;
|
||||
path.next();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static private MinMax getMinMax(double x, double y, PathIterator path) {
|
||||
@ -216,4 +275,5 @@ public class DriverTextEps implements UDriver<EpsGraphics> {
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,85 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009-2017, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.com
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic.eps;
|
||||
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.PathIterator;
|
||||
|
||||
public class PathIteratorLimited implements PathIterator {
|
||||
|
||||
private final PathIterator path;
|
||||
private final int limit;
|
||||
private int current = 0;
|
||||
|
||||
public static int count(Shape source) {
|
||||
int result = 0;
|
||||
final PathIterator path = source.getPathIterator(null);
|
||||
while (path.isDone() == false) {
|
||||
result++;
|
||||
path.next();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public PathIteratorLimited(Shape source, int start, int limit) {
|
||||
this.path = source.getPathIterator(null);
|
||||
this.limit = limit;
|
||||
for (int i = 0; i < start; i++) {
|
||||
this.next();
|
||||
}
|
||||
}
|
||||
|
||||
public int currentSegment(float[] arg0) {
|
||||
return path.currentSegment(arg0);
|
||||
}
|
||||
|
||||
public int currentSegment(double[] arg0) {
|
||||
return path.currentSegment(arg0);
|
||||
}
|
||||
|
||||
public int getWindingRule() {
|
||||
return path.getWindingRule();
|
||||
}
|
||||
|
||||
public boolean isDone() {
|
||||
if (current >= limit) {
|
||||
return true;
|
||||
}
|
||||
return path.isDone();
|
||||
}
|
||||
|
||||
public void next() {
|
||||
path.next();
|
||||
current++;
|
||||
}
|
||||
|
||||
}
|
@ -37,7 +37,7 @@ import java.util.List;
|
||||
|
||||
public enum License {
|
||||
|
||||
GPL, LGPL, APACHE, EPL, MIT, BSD;
|
||||
GPL, GPLV2, LGPL, APACHE, EPL, MIT, BSD;
|
||||
|
||||
public static License getCurrent() {
|
||||
return GPL;
|
||||
@ -216,6 +216,36 @@ public enum License {
|
||||
text.add("by the very same license.");
|
||||
}
|
||||
|
||||
private void addGplV2(final List<String> text) {
|
||||
text.add("PlantUML is free software; you can redistribute it and/or modify it");
|
||||
text.add("under the terms of the GNU General Public License as published by");
|
||||
text.add("the Free Software Foundation, either version 2 of the License, or");
|
||||
text.add("(at your option) any later version.");
|
||||
text.add("");
|
||||
text.add("PlantUML distributed in the hope that it will be useful, but");
|
||||
text.add("WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY");
|
||||
text.add("or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public");
|
||||
text.add("License for more details.");
|
||||
text.add("");
|
||||
text.add("You should have received a copy of the GNU General Public");
|
||||
text.add("License along with this library; if not, write to the Free Software");
|
||||
text.add("Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,");
|
||||
text.add("USA.");
|
||||
text.add("");
|
||||
text.add("Note that images (whatever their format : PNG, SVG...) generated by running PlantUML");
|
||||
text.add("are owned by the author of their corresponding sources code (that is, their");
|
||||
text.add("textual description in PlantUML language). Those images are not covered by");
|
||||
text.add("the GPL license.");
|
||||
text.add("");
|
||||
text.add("The generated images can then be used without any reference to the GPL license.");
|
||||
text.add("It is not even necessary to stipulate that they have been generated with PlantUML,");
|
||||
text.add("also this will be appreciate by PlantUML team.");
|
||||
text.add("");
|
||||
text.add("There is an exception : if the textual description in PlantUML language is also covered");
|
||||
text.add("by a license (like the GPL), then the generated images are logically covered");
|
||||
text.add("by the very same license.");
|
||||
}
|
||||
|
||||
private void addLgpl(final List<String> text) {
|
||||
text.add("PlantUML is free software; you can redistribute it and/or modify it");
|
||||
text.add("under the terms of the GNU Lesser General Public License as published by");
|
||||
@ -287,6 +317,22 @@ public enum License {
|
||||
h.add(" * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,");
|
||||
h.add(" * USA.");
|
||||
h.add(" *");
|
||||
} else if (this == License.GPLV2) {
|
||||
h.add(" * PlantUML is free software; you can redistribute it and/or modify it");
|
||||
h.add(" * under the terms of the GNU General Public License as published by");
|
||||
h.add(" * the Free Software Foundation, either version 2 of the License, or");
|
||||
h.add(" * (at your option) any later version.");
|
||||
h.add(" *");
|
||||
h.add(" * PlantUML distributed in the hope that it will be useful, but");
|
||||
h.add(" * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY");
|
||||
h.add(" * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public");
|
||||
h.add(" * License for more details.");
|
||||
h.add(" *");
|
||||
h.add(" * You should have received a copy of the GNU General Public");
|
||||
h.add(" * License along with this library; if not, write to the Free Software");
|
||||
h.add(" * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,");
|
||||
h.add(" * USA.");
|
||||
h.add(" *");
|
||||
} else if (this == License.APACHE) {
|
||||
h.add(" * Licensed under the Apache License, Version 2.0 (the \"License\");");
|
||||
h.add(" * you may not use this file except in compliance with the License.");
|
||||
@ -376,6 +422,8 @@ public enum License {
|
||||
final List<String> text = getHeaderStart();
|
||||
if (this == License.GPL) {
|
||||
addGpl(text);
|
||||
} else if (this == License.GPLV2) {
|
||||
addGplV2(text);
|
||||
} else if (this == License.MIT) {
|
||||
addMit(text);
|
||||
} else if (this == License.EPL) {
|
||||
|
@ -189,8 +189,8 @@ public class PSystemVersion extends AbstractPSystem {
|
||||
|
||||
int lim = 7;
|
||||
if (lastversion == -1) {
|
||||
strings.add("<b><color:red>Error</b>");
|
||||
strings.add("<color:red>Cannot connect to http://plantuml.com/</b>");
|
||||
strings.add("<b><color:red>Error");
|
||||
strings.add("<color:red>Cannot connect to http://plantuml.com/");
|
||||
strings.add("Maybe you should set your proxy ?");
|
||||
strings.add("@startuml");
|
||||
strings.add("checkversion(proxy=myproxy.com,port=8080)");
|
||||
@ -198,14 +198,14 @@ public class PSystemVersion extends AbstractPSystem {
|
||||
lim = 9;
|
||||
} else if (lastversion == 0) {
|
||||
strings.add("<b><color:red>Error</b>");
|
||||
strings.add("Cannot retrieve last version from http://plantuml.com/</b>");
|
||||
strings.add("Cannot retrieve last version from http://plantuml.com/");
|
||||
} else {
|
||||
strings.add("<b>Last available version for download</b> : " + lastversion);
|
||||
strings.add(" ");
|
||||
if (Version.version() >= lastversion) {
|
||||
strings.add("<b><color:green>Your version is up to date.</b>");
|
||||
strings.add("<b><color:green>Your version is up to date.");
|
||||
} else {
|
||||
strings.add("<b><color:red>A newer version is available for download.</b>");
|
||||
strings.add("<b><color:red>A newer version is available for download.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 19980 $
|
||||
* Revision $Revision: 20097 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.version;
|
||||
@ -39,7 +39,7 @@ import java.util.Date;
|
||||
public class Version {
|
||||
|
||||
public static int version() {
|
||||
return 8043;
|
||||
return 8045;
|
||||
}
|
||||
|
||||
public static String versionString() {
|
||||
@ -71,7 +71,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static long compileTime() {
|
||||
return 1466340806152L;
|
||||
return 1467650874144L;
|
||||
}
|
||||
|
||||
public static String compileTimeString() {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 1.8 KiB |
Loading…
Reference in New Issue
Block a user