mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 02:49:06 +00:00
Version 6035
This commit is contained in:
parent
581798f94d
commit
5ddc03f92d
187
pom.xml
Normal file
187
pom.xml
Normal file
@ -0,0 +1,187 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
========================================================================
|
||||
PlantUML : a free UML diagram generator
|
||||
========================================================================
|
||||
(C) Copyright 2009, Arnaud Roques
|
||||
|
||||
Project Info: http://plantuml.sourceforge.net
|
||||
|
||||
This file is part of PlantUML.
|
||||
|
||||
PlantUML is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
PlantUML distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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.]
|
||||
|
||||
Script Author: Julien Eluard
|
||||
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>net.sourceforge.plantuml</groupId>
|
||||
<artifactId>plantuml</artifactId>
|
||||
<version>1.0.6035-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>PlantUML</name>
|
||||
<description>
|
||||
PlantUML is a component that allows to quickly write :
|
||||
* sequence diagram,
|
||||
* use case diagram,
|
||||
* class diagram,
|
||||
* activity diagram,
|
||||
* component diagram,
|
||||
* state diagram
|
||||
* object diagram
|
||||
</description>
|
||||
<url>http://plantuml.sourceforge.net</url>
|
||||
|
||||
<parent>
|
||||
<groupId>org.sonatype.oss</groupId>
|
||||
<artifactId>oss-parent</artifactId>
|
||||
<version>5</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
<version>1.8.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The GNU General Public License</name>
|
||||
<url>http://www.gnu.org/licenses/gpl.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<scm>
|
||||
<url>http://plantuml.svn.sourceforge.net/viewvc/plantuml</url>
|
||||
<connection>https://plantuml.svn.sourceforge.net/svnroot/plantuml</connection>
|
||||
</scm>
|
||||
|
||||
<issueManagement>
|
||||
<system>Sourceforge</system>
|
||||
<url>http://sourceforge.net/tracker/?group_id=259736</url>
|
||||
</issueManagement>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>arnaud.roques</id>
|
||||
<name>Arnaud Roques</name>
|
||||
<email>plantuml@gmail.com</email>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>${project.basedir}/src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${project.basedir}/src</directory>
|
||||
<includes>
|
||||
<include>net/sourceforge/plantuml/version/logo.png</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<debug>false</debug>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>net.sourceforge.plantuml.Run</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
<configuration>
|
||||
<mavenExecutorId>forked-path</mavenExecutorId>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release-sign-artifacts</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>performRelease</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5520 $
|
||||
* Revision $Revision: 6002 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -77,5 +77,5 @@ public abstract class AbstractPSystem implements PSystem {
|
||||
public int getNbImages() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -60,12 +60,12 @@ class ErrorUml {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return error.hashCode() + type.hashCode() + position;
|
||||
return error.hashCode() + type.hashCode() + position + (suggest == null ? 0 : suggest.hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return type.toString() + " " + position + " " + error;
|
||||
return type.toString() + " " + position + " " + error + " " + suggest;
|
||||
}
|
||||
|
||||
public final String getError() {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5974 $
|
||||
* Revision $Revision: 5977 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -36,7 +36,7 @@ package net.sourceforge.plantuml;
|
||||
public class OptionFlags {
|
||||
|
||||
static public final boolean PBBACK = false;
|
||||
static public final boolean SUGGEST = false;
|
||||
static public final boolean SUGGEST = true;
|
||||
|
||||
void reset() {
|
||||
keepTmpFiles = false;
|
||||
|
@ -28,17 +28,14 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5211 $
|
||||
* Revision $Revision: 6007 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
|
||||
@ -47,53 +44,12 @@ import net.sourceforge.plantuml.version.Version;
|
||||
public class OptionPrint {
|
||||
|
||||
static public void printTestDot() throws InterruptedException {
|
||||
for (String s : getTestDotStrings()) {
|
||||
for (String s : GraphvizUtils.getTestDotStrings(false)) {
|
||||
System.err.println(s);
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
||||
static public List<String> getTestDotStrings() {
|
||||
final List<String> result = new ArrayList<String>();
|
||||
final String ent = GraphvizUtils.getenvGraphvizDot();
|
||||
if (ent == null) {
|
||||
result.add("The environment variable GRAPHVIZ_DOT has not been set");
|
||||
} else {
|
||||
result.add("The environment variable GRAPHVIZ_DOT has been set to " + ent);
|
||||
}
|
||||
final File dotExe = GraphvizUtils.getDotExe();
|
||||
result.add("Dot executable is " + dotExe);
|
||||
|
||||
boolean ok = true;
|
||||
if (dotExe == null) {
|
||||
result.add("Error: No dot executable found");
|
||||
ok = false;
|
||||
} else if (dotExe.exists() == false) {
|
||||
result.add("Error: file does not exist");
|
||||
ok = false;
|
||||
} else if (dotExe.isFile() == false) {
|
||||
result.add("Error: not a valid file");
|
||||
ok = false;
|
||||
} else if (dotExe.canRead() == false) {
|
||||
result.add("Error: cannot be read");
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (ok) {
|
||||
try {
|
||||
final String version = GraphvizUtils.dotVersion();
|
||||
result.add("Dot version: " + version);
|
||||
result.add("Installation seems OK");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
result.add("Error: only sequence diagrams will be generated");
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(result);
|
||||
}
|
||||
|
||||
static public void printHelp() throws InterruptedException {
|
||||
|
||||
final String charset = Charset.defaultCharset().displayName();
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5971 $
|
||||
* Revision $Revision: 5999 $
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
@ -132,9 +132,13 @@ public class PSystemError extends AbstractPSystem {
|
||||
underscore.append("^");
|
||||
}
|
||||
plainStrings.add(underscore.toString());
|
||||
final Collection<String> textErrors = new LinkedHashSet<String>();
|
||||
for (ErrorUml er : printedErrors) {
|
||||
htmlStrings.add(" <color:red>" + er.getError());
|
||||
plainStrings.add(" " + er.getError());
|
||||
textErrors.add(er.getError());
|
||||
}
|
||||
for (String er : textErrors) {
|
||||
htmlStrings.add(" <color:red>" + er);
|
||||
plainStrings.add(" " + er);
|
||||
}
|
||||
boolean suggested = false;
|
||||
for (ErrorUml er : printedErrors) {
|
||||
|
@ -39,6 +39,7 @@ import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.command.AbstractUmlSystemCommandFactory;
|
||||
import net.sourceforge.plantuml.command.Command;
|
||||
import net.sourceforge.plantuml.command.CommandControl;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
@ -76,7 +77,9 @@ final public class PSystemSingleBuilder {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
if (systemFactory instanceof PSystemCommandFactory) {
|
||||
if (s.isEmpty()) {
|
||||
sys = buildEmptyError();
|
||||
} else if (systemFactory instanceof PSystemCommandFactory) {
|
||||
executeUmlCommand((PSystemCommandFactory) systemFactory);
|
||||
} else if (systemFactory instanceof PSystemBasicFactory) {
|
||||
executeUmlBasic((PSystemBasicFactory) systemFactory);
|
||||
@ -89,7 +92,8 @@ final public class PSystemSingleBuilder {
|
||||
final String s = next();
|
||||
if (BlockUmlBuilder.isArobaseEnduml(s)) {
|
||||
if (source.getSize() == 2) {
|
||||
sys = buildEmptyError(source);
|
||||
assert false;
|
||||
sys = buildEmptyError();
|
||||
} else {
|
||||
sys = (AbstractPSystem) systemFactory.getSystem();
|
||||
}
|
||||
@ -109,9 +113,16 @@ final public class PSystemSingleBuilder {
|
||||
sys.setSource(source);
|
||||
}
|
||||
|
||||
private PSystemError buildEmptyError(UmlSource source) {
|
||||
private PSystemError buildEmptyError() {
|
||||
final PSystemError result = new PSystemError(source, new ErrorUml(ErrorUmlType.SYNTAX_ERROR,
|
||||
"Empty description", 1));
|
||||
result.setSource(source);
|
||||
return result;
|
||||
}
|
||||
|
||||
private PSystemError buildEmptyError(String err) {
|
||||
final PSystemError result = new PSystemError(source, new ErrorUml(ErrorUmlType.EXECUTION_ERROR, err, 1));
|
||||
result.setSource(source);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -120,8 +131,13 @@ final public class PSystemSingleBuilder {
|
||||
while (hasNext()) {
|
||||
final String s = next();
|
||||
if (BlockUmlBuilder.isArobaseEnduml(s)) {
|
||||
final String err = ((AbstractUmlSystemCommandFactory) systemFactory).checkFinalError();
|
||||
if (err != null) {
|
||||
sys = buildEmptyError(err);
|
||||
}
|
||||
if (source.getSize() == 2) {
|
||||
sys = buildEmptyError(source);
|
||||
assert false;
|
||||
sys = buildEmptyError();
|
||||
} else {
|
||||
sys = (AbstractPSystem) systemFactory.getSystem();
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5845 $
|
||||
* Revision $Revision: 5983 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
@ -72,7 +72,7 @@ public class SkinParam implements ISkinParam {
|
||||
public HtmlColor getBackgroundColor() {
|
||||
final HtmlColor result = getHtmlColor(ColorParam.background, null);
|
||||
if (result == null) {
|
||||
return new HtmlColor("white");
|
||||
return HtmlColor.getColorIfValid("white");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -101,14 +101,14 @@ public class SkinParam implements ISkinParam {
|
||||
checkStereotype(stereotype);
|
||||
final String value2 = getValue(param.name() + "color" + stereotype);
|
||||
if (value2 != null && HtmlColor.isValid(value2)) {
|
||||
return new HtmlColor(value2);
|
||||
return HtmlColor.getColorIfValid(value2);
|
||||
}
|
||||
}
|
||||
final String value = getValue(param.name() + "color");
|
||||
if (value == null || HtmlColor.isValid(value) == false) {
|
||||
return null;
|
||||
}
|
||||
return new HtmlColor(value);
|
||||
return HtmlColor.getColorIfValid(value);
|
||||
}
|
||||
|
||||
private void checkStereotype(String stereotype) {
|
||||
@ -172,7 +172,7 @@ public class SkinParam implements ISkinParam {
|
||||
if (value == null || HtmlColor.isValid(value) == false) {
|
||||
value = param.getDefaultColor();
|
||||
}
|
||||
return new HtmlColor(value);
|
||||
return HtmlColor.getColorIfValid(value);
|
||||
}
|
||||
|
||||
public int getFontStyle(FontParam param, String stereotype) {
|
||||
|
@ -80,4 +80,19 @@ final public class UmlSource {
|
||||
return source.size();
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
for (String s : source) {
|
||||
if (BlockUmlBuilder.isArobaseStartuml(s)) {
|
||||
continue;
|
||||
}
|
||||
if (BlockUmlBuilder.isArobaseEnduml(s)) {
|
||||
continue;
|
||||
}
|
||||
if (s.trim().length() != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ import net.sourceforge.plantuml.command.SingleLineCommand;
|
||||
public class CommandEndif extends SingleLineCommand<ActivityDiagram> {
|
||||
|
||||
public CommandEndif(ActivityDiagram diagram) {
|
||||
super(diagram, "(?i)^endif$");
|
||||
super(diagram, "(?i)^end ?if$");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5048 $
|
||||
* Revision $Revision: 5983 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram.command;
|
||||
@ -57,7 +57,7 @@ public class CommandPartition extends SingleLineCommand<ActivityDiagram> {
|
||||
p.setBold(true);
|
||||
final String color = arg.get(1);
|
||||
if (color != null) {
|
||||
p.setBackColor(new HtmlColor(color));
|
||||
p.setBackColor(HtmlColor.getColorIfValid(color));
|
||||
}
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -36,7 +36,11 @@ package net.sourceforge.plantuml.activitydiagram2;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.Direction;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
@ -51,10 +55,13 @@ import net.sourceforge.plantuml.cucadiagram.LinkType;
|
||||
|
||||
public class ActivityDiagram2 extends CucaDiagram {
|
||||
|
||||
private Collection<IEntity> last2 = new ArrayList<IEntity>();
|
||||
private Collection<IEntity> waitings = new ArrayList<IEntity>();
|
||||
private ConditionalContext2 currentContext;
|
||||
private int futureLength = 2;
|
||||
|
||||
private final Collection<String> pendingLabels = new HashSet<String>();
|
||||
private final Map<String, IEntity> labels = new HashMap<String, IEntity>();
|
||||
|
||||
final protected List<String> getDotStrings() {
|
||||
return Arrays.asList("nodesep=.20;", "ranksep=0.4;", "edge [fontsize=11,labelfontsize=11];",
|
||||
"node [fontsize=11];");
|
||||
@ -69,16 +76,26 @@ public class ActivityDiagram2 extends CucaDiagram {
|
||||
return UmlDiagramType.ACTIVITY;
|
||||
}
|
||||
|
||||
public boolean isReachable() {
|
||||
return waitings.size() > 0;
|
||||
}
|
||||
|
||||
public void newActivity(String display) {
|
||||
if (last2.size() == 0) {
|
||||
if (waitings.size() == 0) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
final Entity act = createEntity(getAutoCode(), display, EntityType.ACTIVITY);
|
||||
for (IEntity last : this.last2) {
|
||||
for (IEntity last : this.waitings) {
|
||||
this.addLink(new Link(last, act, new LinkType(LinkDecor.ARROW, LinkDecor.NONE), null, futureLength));
|
||||
}
|
||||
this.last2.clear();
|
||||
this.last2.add(act);
|
||||
|
||||
for (String p : pendingLabels) {
|
||||
labels.put(p, act);
|
||||
}
|
||||
pendingLabels.clear();
|
||||
|
||||
this.waitings.clear();
|
||||
this.waitings.add(act);
|
||||
this.futureLength = 2;
|
||||
|
||||
}
|
||||
@ -88,36 +105,61 @@ public class ActivityDiagram2 extends CucaDiagram {
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if (last2.size() != 0) {
|
||||
if (waitings.size() != 0) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
this.last2.add(createEntity("start", "start", EntityType.CIRCLE_START));
|
||||
this.waitings.add(createEntity("start", "start", EntityType.CIRCLE_START));
|
||||
}
|
||||
|
||||
public void startIf(String test) {
|
||||
final IEntity br = createEntity(getAutoCode(), "", EntityType.BRANCH);
|
||||
currentContext = new ConditionalContext2(currentContext, br, Direction.DOWN);
|
||||
for (IEntity last : this.last2) {
|
||||
for (IEntity last : this.waitings) {
|
||||
this.addLink(new Link(last, br, new LinkType(LinkDecor.ARROW, LinkDecor.NONE), null, futureLength));
|
||||
}
|
||||
this.last2.clear();
|
||||
this.last2.add(br);
|
||||
this.futureLength = 1;
|
||||
this.waitings.clear();
|
||||
this.waitings.add(br);
|
||||
this.futureLength = 2;
|
||||
}
|
||||
|
||||
public Collection<IEntity> getLastEntityConsulted2() {
|
||||
return this.last2;
|
||||
return this.waitings;
|
||||
}
|
||||
|
||||
public void endif() {
|
||||
this.last2.add(currentContext.getPending());
|
||||
this.waitings.add(currentContext.getPending());
|
||||
currentContext = currentContext.getParent();
|
||||
}
|
||||
|
||||
public void else2() {
|
||||
this.currentContext.setPending(this.last2.iterator().next());
|
||||
this.last2.clear();
|
||||
this.last2.add(currentContext.getBranch());
|
||||
this.currentContext.setPending(this.waitings.iterator().next());
|
||||
this.waitings.clear();
|
||||
this.waitings.add(currentContext.getBranch());
|
||||
}
|
||||
|
||||
public void label(String label) {
|
||||
pendingLabels.add(label);
|
||||
for (final Iterator<PendingLink> it = pendingLinks.iterator(); it.hasNext();) {
|
||||
final PendingLink pending = it.next();
|
||||
if (pending.getLabel().equals(label)) {
|
||||
waitings.add(pending.getEntityFrom());
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final Collection<PendingLink> pendingLinks = new ArrayList<PendingLink>();
|
||||
|
||||
public void callGoto(String label) {
|
||||
final IEntity dest = labels.get(label);
|
||||
for (IEntity last : this.waitings) {
|
||||
if (dest == null) {
|
||||
this.pendingLinks.add(new PendingLink(last, label));
|
||||
|
||||
} else {
|
||||
this.addLink(new Link(last, dest, new LinkType(LinkDecor.ARROW, LinkDecor.NONE), null, futureLength));
|
||||
}
|
||||
}
|
||||
this.waitings.clear();
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,11 @@ package net.sourceforge.plantuml.activitydiagram2;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram2.command.CommandElse2;
|
||||
import net.sourceforge.plantuml.activitydiagram2.command.CommandEndif2;
|
||||
import net.sourceforge.plantuml.activitydiagram2.command.CommandGoto2;
|
||||
import net.sourceforge.plantuml.activitydiagram2.command.CommandIf2;
|
||||
import net.sourceforge.plantuml.activitydiagram2.command.CommandNewActivity;
|
||||
import net.sourceforge.plantuml.activitydiagram2.command.CommandStart;
|
||||
import net.sourceforge.plantuml.activitydiagram2.command.CommandLabel2;
|
||||
import net.sourceforge.plantuml.activitydiagram2.command.CommandNewActivity2;
|
||||
import net.sourceforge.plantuml.activitydiagram2.command.CommandStart2;
|
||||
import net.sourceforge.plantuml.command.AbstractUmlSystemCommandFactory;
|
||||
|
||||
public class ActivityDiagramFactory2 extends AbstractUmlSystemCommandFactory {
|
||||
@ -53,11 +55,13 @@ public class ActivityDiagramFactory2 extends AbstractUmlSystemCommandFactory {
|
||||
system = new ActivityDiagram2();
|
||||
|
||||
addCommonCommands(system);
|
||||
addCommand(new CommandStart(system));
|
||||
addCommand(new CommandNewActivity(system));
|
||||
addCommand(new CommandStart2(system));
|
||||
addCommand(new CommandNewActivity2(system));
|
||||
addCommand(new CommandIf2(system));
|
||||
addCommand(new CommandEndif2(system));
|
||||
addCommand(new CommandElse2(system));
|
||||
addCommand(new CommandLabel2(system));
|
||||
addCommand(new CommandGoto2(system));
|
||||
|
||||
// addCommand(new CommandLinkActivity(system));
|
||||
// addCommand(new CommandPartition(system));
|
||||
|
@ -33,10 +33,6 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.sourceforge.plantuml.Direction;
|
||||
import net.sourceforge.plantuml.cucadiagram.EntityType;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
@ -47,7 +43,7 @@ public class ConditionalContext2 {
|
||||
private final IEntity branch;
|
||||
private final Direction direction;
|
||||
private final ConditionalContext2 parent;
|
||||
|
||||
|
||||
public ConditionalContext2(ConditionalContext2 parent, IEntity branch, Direction direction) {
|
||||
if (branch.getType() != EntityType.BRANCH) {
|
||||
throw new IllegalArgumentException();
|
||||
|
@ -0,0 +1,56 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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: 5721 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram2;
|
||||
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
|
||||
public class PendingLink {
|
||||
|
||||
private final IEntity entityFrom;
|
||||
private final String label;
|
||||
|
||||
public PendingLink(IEntity entityFrom, String label) {
|
||||
this.entityFrom = entityFrom;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public final IEntity getEntityFrom() {
|
||||
return entityFrom;
|
||||
}
|
||||
|
||||
public final String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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: 4762 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram2.command;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram2.ActivityDiagram2;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand2;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexPartialMatch;
|
||||
|
||||
public class CommandGoto2 extends SingleLineCommand2<ActivityDiagram2> {
|
||||
|
||||
public CommandGoto2(ActivityDiagram2 diagram) {
|
||||
super(diagram, getRegexConcat());
|
||||
}
|
||||
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"), //
|
||||
new RegexLeaf("goto\\s+"), //
|
||||
new RegexLeaf("LABEL", "([\\p{L}0-9_.]+)"), //
|
||||
new RegexLeaf(":?"), //
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(Map<String, RegexPartialMatch> arg) {
|
||||
getSystem().callGoto(arg.get("LABEL").get(0));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
}
|
@ -52,7 +52,7 @@ public class CommandIf2 extends SingleLineCommand2<ActivityDiagram2> {
|
||||
return new RegexConcat(new RegexLeaf("^"),
|
||||
new RegexLeaf("if"),
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexLeaf("TEST", "\"([^\"]+)\""),
|
||||
new RegexLeaf("TEST", "[\"(](.+)[\")]"),
|
||||
new RegexLeaf("\\s*"),
|
||||
new RegexLeaf("(then)?"),
|
||||
new RegexLeaf("$"));
|
||||
|
@ -0,0 +1,65 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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: 4762 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.activitydiagram2.command;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.activitydiagram2.ActivityDiagram2;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand2;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexPartialMatch;
|
||||
|
||||
public class CommandLabel2 extends SingleLineCommand2<ActivityDiagram2> {
|
||||
|
||||
public CommandLabel2(ActivityDiagram2 diagram) {
|
||||
super(diagram, getRegexConcat());
|
||||
}
|
||||
|
||||
static RegexConcat getRegexConcat() {
|
||||
return new RegexConcat(new RegexLeaf("^"),
|
||||
new RegexLeaf("LABEL", "([\\p{L}0-9_.]+)"),
|
||||
new RegexLeaf(":"),
|
||||
new RegexLeaf("$"));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(Map<String, RegexPartialMatch> arg) {
|
||||
getSystem().label(arg.get("LABEL").get(0));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
}
|
@ -39,10 +39,10 @@ import net.sourceforge.plantuml.activitydiagram2.ActivityDiagram2;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand;
|
||||
|
||||
public class CommandNewActivity extends SingleLineCommand<ActivityDiagram2> {
|
||||
public class CommandNewActivity2 extends SingleLineCommand<ActivityDiagram2> {
|
||||
|
||||
public CommandNewActivity(ActivityDiagram2 diagram) {
|
||||
super(diagram, "(?i)^\"([^\"]+)\"$");
|
||||
public CommandNewActivity2(ActivityDiagram2 diagram) {
|
||||
super(diagram, "(?i)^[\"<](.+)[\">]$");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -50,6 +50,11 @@ public class CommandNewActivity extends SingleLineCommand<ActivityDiagram2> {
|
||||
if (getSystem().entities().size() == 0) {
|
||||
return CommandExecutionResult.error("Missing start keyword");
|
||||
}
|
||||
|
||||
if (getSystem().isReachable() == false) {
|
||||
return CommandExecutionResult.error("Unreachable statement");
|
||||
}
|
||||
|
||||
getSystem().newActivity(arg.get(0));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
@ -39,9 +39,9 @@ import net.sourceforge.plantuml.activitydiagram2.ActivityDiagram2;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand;
|
||||
|
||||
public class CommandStart extends SingleLineCommand<ActivityDiagram2> {
|
||||
public class CommandStart2 extends SingleLineCommand<ActivityDiagram2> {
|
||||
|
||||
public CommandStart(ActivityDiagram2 diagram) {
|
||||
public CommandStart2(ActivityDiagram2 diagram) {
|
||||
super(diagram, "(?i)^start$");
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5941 $
|
||||
* Revision $Revision: 6008 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.asciiart;
|
||||
@ -64,7 +64,10 @@ public class TextSkin implements Skin {
|
||||
if (type.isArrow() && type.getArrowConfiguration().isSelfArrow()) {
|
||||
return new ComponentTextSelfArrow(type, stringsToDisplay, fileFormat);
|
||||
}
|
||||
if (type == ComponentType.PARTICIPANT_LINE || type == ComponentType.ACTOR_LINE) {
|
||||
if (type == ComponentType.PARTICIPANT_LINE) {
|
||||
return new ComponentTextLine(fileFormat);
|
||||
}
|
||||
if (type == ComponentType.CONTINUE_LINE) {
|
||||
return new ComponentTextLine(fileFormat);
|
||||
}
|
||||
if (type == ComponentType.DELAY_LINE) {
|
||||
|
@ -39,7 +39,6 @@ import net.sourceforge.plantuml.Direction;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.UmlDiagramType;
|
||||
import net.sourceforge.plantuml.UniqueSequence;
|
||||
import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.command.SingleLineCommand2;
|
||||
import net.sourceforge.plantuml.command.regex.RegexConcat;
|
||||
|
@ -56,7 +56,7 @@ public class CommandNamespace extends SingleLineCommand<ClassDiagram> {
|
||||
p.setBold(true);
|
||||
final String color = arg.get(1);
|
||||
if (color != null) {
|
||||
p.setBackColor(new HtmlColor(color));
|
||||
p.setBackColor(HtmlColor.getColorIfValid(color));
|
||||
}
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 3827 $
|
||||
* Revision $Revision: 5980 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.code;
|
||||
@ -44,13 +44,31 @@ public class ArobaseStringCompressor implements StringCompressor {
|
||||
public String compress(String s) throws IOException {
|
||||
final Matcher m = p.matcher(s);
|
||||
if (m.find()) {
|
||||
return m.group(2);
|
||||
return clean(m.group(2));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String decompress(String stringAnnoted) throws IOException {
|
||||
return stringAnnoted;
|
||||
public String decompress(String s) throws IOException {
|
||||
return clean(s);
|
||||
}
|
||||
|
||||
private String clean(String s) {
|
||||
s = s.trim();
|
||||
s = clean1(s);
|
||||
s = s.replaceAll("@enduml[^\\n\\r]*", "");
|
||||
s = s.replaceAll("@startuml[^\\n\\r]*", "");
|
||||
s = s.trim();
|
||||
return s;
|
||||
}
|
||||
|
||||
private String clean1(String s) {
|
||||
final Matcher m = p.matcher(s);
|
||||
if (m.matches()) {
|
||||
return m.group(2);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5764 $
|
||||
* Revision $Revision: 6002 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.command;
|
||||
@ -44,6 +44,10 @@ public abstract class AbstractUmlSystemCommandFactory implements PSystemCommandF
|
||||
reset();
|
||||
}
|
||||
|
||||
public String checkFinalError() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<Command> cmds = new ArrayList<Command>();
|
||||
|
||||
final public CommandControl isValid(List<String> lines) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5536 $
|
||||
* Revision $Revision: 5983 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.command;
|
||||
@ -67,7 +67,7 @@ public class CommandPackage extends SingleLineCommand<AbstractEntityDiagram> {
|
||||
p.setBold(true);
|
||||
final String color = arg.get(2);
|
||||
if (color != null) {
|
||||
p.setBackColor(new HtmlColor(color));
|
||||
p.setBackColor(HtmlColor.getColorIfValid(color));
|
||||
}
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 3828 $
|
||||
* Revision $Revision: 6002 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.command;
|
||||
@ -42,4 +42,5 @@ public interface PSystemCommandFactory extends PSystemFactory {
|
||||
CommandControl isValid(List<String> lines);
|
||||
|
||||
Command createCommand(List<String> lines);
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5908 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram;
|
||||
@ -40,6 +40,7 @@ import java.util.Arrays;
|
||||
|
||||
import net.sourceforge.plantuml.UniqueSequence;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.DrawFile;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -272,8 +273,8 @@ public class Link implements Imaged {
|
||||
|
||||
private double getQualifierMargin(StringBounder stringBounder, Font fontQualif, String qualif) {
|
||||
if (qualif != null) {
|
||||
final TextBlock b = TextBlockUtils.create(Arrays.asList(qualif), fontQualif, Color.BLACK,
|
||||
HorizontalAlignement.LEFT);
|
||||
final TextBlock b = TextBlockUtils.create(Arrays.asList(qualif), new FontConfiguration(fontQualif,
|
||||
Color.BLACK), HorizontalAlignement.LEFT);
|
||||
final Dimension2D dim = b.calculateDimension(stringBounder);
|
||||
return Math.max(dim.getWidth(), dim.getHeight());
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5771 $
|
||||
* Revision $Revision: 5982 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram;
|
||||
@ -68,7 +68,8 @@ public class Stereotype implements CharSequence {
|
||||
} else {
|
||||
this.label = null;
|
||||
}
|
||||
this.htmlColor = new HtmlColor(m.group(2));
|
||||
final String colName = m.group(2);
|
||||
this.htmlColor = HtmlColor.getColorIfValid(colName);
|
||||
this.character = m.group(1).charAt(0);
|
||||
} else {
|
||||
this.label = label;
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5794 $
|
||||
* Revision $Revision: 6005 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram.dot;
|
||||
@ -148,7 +148,15 @@ abstract class AbstractGraphviz implements Graphviz {
|
||||
msg.add("File cannot be read");
|
||||
}
|
||||
}
|
||||
msg.add("Cannot find Graphviz: try 'java -jar plantuml.jar -testdot'");
|
||||
msg.add("Cannot find Graphviz. You should try");
|
||||
msg.add(" ");
|
||||
msg.add("@startuml");
|
||||
msg.add("testdot");
|
||||
msg.add("@enduml");
|
||||
msg.add(" ");
|
||||
msg.add(" or ");
|
||||
msg.add(" ");
|
||||
msg.add("java -jar plantuml.jar -testdot");
|
||||
final GraphicStrings errorResult = new GraphicStrings(msg);
|
||||
errorResult.writeImage(os, format);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5972 $
|
||||
* Revision $Revision: 6035 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram.dot;
|
||||
@ -63,9 +63,11 @@ import net.sourceforge.plantuml.cucadiagram.Group;
|
||||
import net.sourceforge.plantuml.cucadiagram.GroupType;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Member;
|
||||
import net.sourceforge.plantuml.cucadiagram.Rankdir;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -92,6 +94,11 @@ final public class DotMaker implements GraphvizMaker {
|
||||
|
||||
private final boolean isVisibilityModifierPresent;
|
||||
|
||||
// http://www.graphviz.org/bugs/b2114.html
|
||||
private static final boolean TURN_AROUND_B2114 = false;
|
||||
|
||||
private final Set<String> hasAlreadyOneIncommingArrowLenghtOne;
|
||||
|
||||
public static void goJunit() {
|
||||
isJunit = true;
|
||||
}
|
||||
@ -105,6 +112,7 @@ final public class DotMaker implements GraphvizMaker {
|
||||
} else {
|
||||
this.isVisibilityModifierPresent = false;
|
||||
}
|
||||
this.hasAlreadyOneIncommingArrowLenghtOne = TURN_AROUND_B2114 ? new HashSet<String>() : null;
|
||||
}
|
||||
|
||||
public String createDotString() throws IOException {
|
||||
@ -130,10 +138,10 @@ final public class DotMaker implements GraphvizMaker {
|
||||
final boolean huge = data.getEntities().size() > 800;
|
||||
|
||||
sb.append("digraph unix {");
|
||||
//if (isJunit == false) {
|
||||
for (String s : dotStrings) {
|
||||
sb.append(s);
|
||||
}
|
||||
// if (isJunit == false) {
|
||||
for (String s : dotStrings) {
|
||||
sb.append(s);
|
||||
}
|
||||
// }
|
||||
sb.append("bgcolor=\"" + data.getSkinParam().getBackgroundColor().getAsHtml() + "\";");
|
||||
if (huge) {
|
||||
@ -142,6 +150,7 @@ final public class DotMaker implements GraphvizMaker {
|
||||
sb.append("ratio=auto;");
|
||||
// sb.append("concentrate=true;");
|
||||
}
|
||||
// sb.append("ordering=out;");
|
||||
sb.append("compound=true;");
|
||||
sb.append("remincross=true;");
|
||||
sb.append("searchsize=500;");
|
||||
@ -500,11 +509,15 @@ final public class DotMaker implements GraphvizMaker {
|
||||
|
||||
final DrawFile noteLink = link.getImageFile();
|
||||
|
||||
boolean hasLabel = false;
|
||||
|
||||
if (link.getLabel() != null) {
|
||||
decoration.append("label=<" + manageHtmlIB(link.getLabel(), getArrowFontParam(), null) + ">,");
|
||||
hasLabel = true;
|
||||
} else if (noteLink != null) {
|
||||
decoration
|
||||
.append("label=<" + getHtmlForLinkNote(noteLink.getPngOrEps(fileFormat == FileFormat.EPS)) + ">,");
|
||||
hasLabel = true;
|
||||
}
|
||||
|
||||
if (link.getQualifier1() != null) {
|
||||
@ -513,16 +526,26 @@ final public class DotMaker implements GraphvizMaker {
|
||||
if (link.getQualifier2() != null) {
|
||||
decoration.append("headlabel=<" + manageHtmlIB(link.getQualifier2(), getArrowFontParam(), null) + ">,");
|
||||
}
|
||||
decoration.append(link.getType().getSpecificDecoration());
|
||||
final int len = link.getLength();
|
||||
String uid1 = link.getEntity1().getUid();
|
||||
String uid2 = link.getEntity2().getUid();
|
||||
LinkType typeToDraw = link.getType();
|
||||
if (TURN_AROUND_B2114 && len == 1 && hasAlreadyOneIncommingArrowLenghtOne.contains(uid2) && hasLabel) {
|
||||
typeToDraw = typeToDraw.getInv();
|
||||
}
|
||||
if (TURN_AROUND_B2114 && len == 1) {
|
||||
hasAlreadyOneIncommingArrowLenghtOne.add(uid2);
|
||||
}
|
||||
decoration.append(typeToDraw.getSpecificDecoration());
|
||||
if (link.isInvis()) {
|
||||
decoration.append(",style=invis");
|
||||
}
|
||||
|
||||
final int len = link.getLength();
|
||||
// if (len == 1) {
|
||||
// decoration.append(",constraint=false");
|
||||
// }
|
||||
final String lenString = len >= 3 ? ",minlen=" + (len - 1) : "";
|
||||
|
||||
String uid1 = link.getEntity1().getUid();
|
||||
String uid2 = link.getEntity2().getUid();
|
||||
if (link.getEntity1().getType() == EntityType.GROUP) {
|
||||
uid1 = getHiddenNodeUid(link.getEntity1().getParent(), link);
|
||||
decoration.append(",ltail=" + link.getEntity1().getParent().getUid() + "v");
|
||||
@ -594,7 +617,7 @@ final public class DotMaker implements GraphvizMaker {
|
||||
if (noteLink == null) {
|
||||
continue;
|
||||
}
|
||||
final Link phantom = new Link(link.getEntity1(), link.getEntity2(), link.getType(), "", link.getLength());
|
||||
final Link phantom = new Link(link.getEntity1(), link.getEntity2(), link.getType(), null, link.getLength());
|
||||
phantom.setInvis(true);
|
||||
result.add(phantom);
|
||||
}
|
||||
@ -657,10 +680,6 @@ final public class DotMaker implements GraphvizMaker {
|
||||
}
|
||||
|
||||
private void eventuallySameRank(StringBuilder sb, Group entityPackage, Link link) {
|
||||
// if (workAroundDotBug()) {
|
||||
// throw new UnsupportedOperationException("workAroundDotBug");
|
||||
// // return;
|
||||
// }
|
||||
final int len = link.getLength();
|
||||
if (len == 1 && link.getEntity1().getParent() == entityPackage
|
||||
&& link.getEntity2().getParent() == entityPackage) {
|
||||
@ -1258,7 +1277,8 @@ final public class DotMaker implements GraphvizMaker {
|
||||
}
|
||||
final Font font = data.getSkinParam().getFont(FontParam.CLASS_ATTRIBUTE, null);
|
||||
final Color color = getFontHtmlColor(FontParam.CLASS_ATTRIBUTE, null).getColor();
|
||||
final TextBlock text = TextBlockUtils.create(texts, font, color, HorizontalAlignement.LEFT);
|
||||
final TextBlock text = TextBlockUtils.create(texts, new FontConfiguration(font, color),
|
||||
HorizontalAlignement.LEFT);
|
||||
final File feps = FileUtils.createTempFile("member", ".eps");
|
||||
UGraphicEps.copyEpsToFile(new UDrawable() {
|
||||
public void drawU(UGraphic ug) {
|
||||
@ -1542,8 +1562,8 @@ final public class DotMaker implements GraphvizMaker {
|
||||
}
|
||||
|
||||
private String manageSpace(int size) {
|
||||
final DotExpression dotExpression = new DotExpression(" ", size, new HtmlColor("white"), null, Font.PLAIN,
|
||||
fileFormat);
|
||||
final DotExpression dotExpression = new DotExpression(" ", size, HtmlColor.getColorIfValid("white"), null,
|
||||
Font.PLAIN, fileFormat);
|
||||
final String result = dotExpression.getDotHtml();
|
||||
return result;
|
||||
}
|
||||
|
@ -28,16 +28,25 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4826 $
|
||||
* Revision $Revision: 6007 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.cucadiagram.dot;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
|
||||
public class GraphvizUtils {
|
||||
|
||||
private static int DOT_VERSION_LIMIT = 226;
|
||||
|
||||
private static boolean isWindows() {
|
||||
return File.separatorChar == '\\';
|
||||
}
|
||||
@ -55,7 +64,7 @@ public class GraphvizUtils {
|
||||
|
||||
public static String getenvGraphvizDot() {
|
||||
final String env = System.getProperty("GRAPHVIZ_DOT");
|
||||
if (env != null) {
|
||||
if (StringUtils.isNotEmpty(env)) {
|
||||
return env;
|
||||
}
|
||||
return System.getenv("GRAPHVIZ_DOT");
|
||||
@ -79,4 +88,78 @@ public class GraphvizUtils {
|
||||
}
|
||||
return dotVersion;
|
||||
}
|
||||
|
||||
static int retrieveVersion(String s) {
|
||||
if (s == null) {
|
||||
return -1;
|
||||
}
|
||||
final Pattern p = Pattern.compile("\\s([12].\\d\\d)\\D");
|
||||
final Matcher m = p.matcher(s);
|
||||
if (m.find() == false) {
|
||||
return -1;
|
||||
}
|
||||
return Integer.parseInt(m.group(1).replaceAll("\\.", ""));
|
||||
}
|
||||
|
||||
public static int getDotVersion() throws IOException, InterruptedException {
|
||||
return retrieveVersion(dotVersion());
|
||||
}
|
||||
|
||||
static public List<String> getTestDotStrings(boolean withRichText) {
|
||||
String red = "";
|
||||
String bold = "";
|
||||
if (withRichText) {
|
||||
red = "<b><color:red>";
|
||||
bold = "<b>";
|
||||
}
|
||||
final List<String> result = new ArrayList<String>();
|
||||
final String ent = GraphvizUtils.getenvGraphvizDot();
|
||||
if (ent == null) {
|
||||
result.add("The environment variable GRAPHVIZ_DOT has not been set");
|
||||
} else {
|
||||
result.add("The environment variable GRAPHVIZ_DOT has been set to " + ent);
|
||||
}
|
||||
final File dotExe = GraphvizUtils.getDotExe();
|
||||
result.add("Dot executable is " + dotExe);
|
||||
|
||||
boolean ok = true;
|
||||
if (dotExe == null) {
|
||||
result.add(red + "Error: No dot executable found");
|
||||
ok = false;
|
||||
} else if (dotExe.exists() == false) {
|
||||
result.add(red + "Error: file does not exist");
|
||||
ok = false;
|
||||
} else if (dotExe.isFile() == false) {
|
||||
result.add(red + "Error: not a valid file");
|
||||
ok = false;
|
||||
} else if (dotExe.canRead() == false) {
|
||||
result.add(red + "Error: cannot be read");
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (ok) {
|
||||
try {
|
||||
final String version = GraphvizUtils.dotVersion();
|
||||
result.add("Dot version: " + version);
|
||||
final int v = GraphvizUtils.getDotVersion();
|
||||
if (v == -1) {
|
||||
result.add("Warning : cannot determine dot version");
|
||||
} else {
|
||||
if (v < DOT_VERSION_LIMIT) {
|
||||
result.add(bold + "Warning : Your dot installation seems old");
|
||||
result.add(bold + "Some diagrams may have issues");
|
||||
} else {
|
||||
result.add(bold + "Installation seems OK");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
result.add("Error: only sequence diagrams will be generated");
|
||||
}
|
||||
|
||||
return Collections.unmodifiableList(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ import net.sourceforge.plantuml.cucadiagram.Group;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkType;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -144,7 +145,8 @@ public final class PlayField {
|
||||
// entityImageBlock.getDimension(stringBounder);
|
||||
// final Block b = new Block(uid++, d.getWidth() + 2 *
|
||||
// marginDecorator, d.getHeight() + 2 * marginDecorator);
|
||||
final MargedBlock b = new MargedBlock(stringBounder, entityImageBlock, getMargin(stringBounder, ent, links), parentCluster);
|
||||
final MargedBlock b = new MargedBlock(stringBounder, entityImageBlock,
|
||||
getMargin(stringBounder, ent, links), parentCluster);
|
||||
|
||||
blocks.put(ent, b);
|
||||
// images.put(ent, entityImageBlock);
|
||||
@ -258,16 +260,16 @@ public final class PlayField {
|
||||
|
||||
final String qual1 = link.getQualifier1();
|
||||
if (qual1 != null) {
|
||||
final TextBlock b = TextBlockUtils.create(Arrays.asList(qual1), fontQualif,
|
||||
skinParam.getFontHtmlColor(FontParam.CLASS_ARROW, null).getColor(), HorizontalAlignement.LEFT);
|
||||
final TextBlock b = TextBlockUtils.create(Arrays.asList(qual1), new FontConfiguration(fontQualif,
|
||||
skinParam.getFontHtmlColor(FontParam.CLASS_ARROW, null).getColor()), HorizontalAlignement.LEFT);
|
||||
final Point2D pos = p.getDotPath().getStartPoint();
|
||||
b.drawU(ug, pos.getX(), pos.getY());
|
||||
}
|
||||
|
||||
final String qual2 = link.getQualifier2();
|
||||
if (qual2 != null) {
|
||||
final TextBlock b = TextBlockUtils.create(Arrays.asList(qual2), fontQualif,
|
||||
skinParam.getFontHtmlColor(FontParam.CLASS_ARROW, null).getColor(), HorizontalAlignement.LEFT);
|
||||
final TextBlock b = TextBlockUtils.create(Arrays.asList(qual2), new FontConfiguration(fontQualif,
|
||||
skinParam.getFontHtmlColor(FontParam.CLASS_ARROW, null).getColor()), HorizontalAlignement.LEFT);
|
||||
final Point2D pos = p.getDotPath().getEndPoint();
|
||||
b.drawU(ug, pos.getX(), pos.getY());
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4626 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -57,6 +57,7 @@ import net.sourceforge.plantuml.geom.CollectionUtils;
|
||||
import net.sourceforge.plantuml.geom.Point2DInt;
|
||||
import net.sourceforge.plantuml.geom.PolylineBreakeable;
|
||||
import net.sourceforge.plantuml.geom.XMoveable;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -264,10 +265,11 @@ public class Elastane {
|
||||
final String label = l.getLabel();
|
||||
if (label != null) {
|
||||
final Point2DInt center = polyline.getFirst().getCenter();
|
||||
final TextBlock textBlock = TextBlockUtils.create(Arrays.asList(label), g2d.getFont(), Color.BLACK,
|
||||
HorizontalAlignement.LEFT);
|
||||
final TextBlock textBlock = TextBlockUtils.create(Arrays.asList(label),
|
||||
new FontConfiguration(g2d.getFont(), Color.BLACK), HorizontalAlignement.LEFT);
|
||||
final Dimension2D dim = textBlock.calculateDimension(StringBounderUtils.asStringBounder(g2d));
|
||||
textBlock.drawTOBEREMOVED(g2d, center.getXint() - dim.getWidth() / 2, center.getYint() - dim.getHeight() / 2);
|
||||
textBlock.drawTOBEREMOVED(g2d, center.getXint() - dim.getWidth() / 2,
|
||||
center.getYint() - dim.getHeight() / 2);
|
||||
}
|
||||
|
||||
g2d.setColor(red);
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4959 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -41,6 +41,7 @@ import java.awt.geom.Dimension2D;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.cucadiagram.Entity;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
@ -56,14 +57,14 @@ class EntityImageActivity extends AbstractEntityImage {
|
||||
|
||||
public EntityImageActivity(Entity entity) {
|
||||
super(entity);
|
||||
this.text = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), getFont14(), Color.BLACK,
|
||||
HorizontalAlignement.CENTER);
|
||||
this.text = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), new FontConfiguration(
|
||||
getFont14(), Color.BLACK), HorizontalAlignement.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension2D getDimension(StringBounder stringBounder) {
|
||||
final Dimension2D dim = text.calculateDimension(stringBounder);
|
||||
return Dimension2DDouble.delta(dim, 2*xMargin, 2*yMargin);
|
||||
return Dimension2DDouble.delta(dim, 2 * xMargin, 2 * yMargin);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4189 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -41,6 +41,7 @@ import java.awt.geom.Rectangle2D;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.cucadiagram.Entity;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
@ -55,8 +56,8 @@ class EntityImageActor extends AbstractEntityImage {
|
||||
|
||||
public EntityImageActor(Entity entity) {
|
||||
super(entity);
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), getFont14(), Color.BLACK,
|
||||
HorizontalAlignement.CENTER);
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), new FontConfiguration(
|
||||
getFont14(), Color.BLACK), HorizontalAlignement.CENTER);
|
||||
this.stickman = new StickMan(getYellow(), getRed());
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5343 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -40,6 +40,7 @@ import java.awt.geom.Dimension2D;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.cucadiagram.Entity;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -53,8 +54,8 @@ class EntityImageCircleInterface extends AbstractEntityImage {
|
||||
|
||||
public EntityImageCircleInterface(Entity entity) {
|
||||
super(entity);
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), getFont14(), Color.BLACK,
|
||||
HorizontalAlignement.CENTER);
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), new FontConfiguration(
|
||||
getFont14(), Color.BLACK), HorizontalAlignement.CENTER);
|
||||
this.circleInterface = new CircleInterface(getYellow(), getRed());
|
||||
}
|
||||
|
||||
@ -69,22 +70,22 @@ class EntityImageCircleInterface extends AbstractEntityImage {
|
||||
@Override
|
||||
public void draw(Graphics2D g2d) {
|
||||
throw new UnsupportedOperationException();
|
||||
// final Dimension2D dimTotal = getDimension(StringBounderUtils.asStringBounder(g2d));
|
||||
// final Dimension2D nameDim = name.calculateDimension(StringBounderUtils.asStringBounder(g2d));
|
||||
//
|
||||
// final double manWidth = circleInterface.getPreferredWidth(StringBounderUtils.asStringBounder(g2d));
|
||||
// final double manHeight = circleInterface.getPreferredHeight(StringBounderUtils.asStringBounder(g2d));
|
||||
//
|
||||
// final double manX = (dimTotal.getWidth() - manWidth) / 2;
|
||||
//
|
||||
// g2d.setColor(Color.WHITE);
|
||||
// g2d.fill(new Rectangle2D.Double(0, 0, dimTotal.getWidth(), dimTotal.getHeight()));
|
||||
//
|
||||
// g2d.translate(manX, 0);
|
||||
// circleInterface.draw(g2d);
|
||||
// g2d.translate(-manX, 0);
|
||||
//
|
||||
// g2d.setColor(Color.BLACK);
|
||||
// name.drawTOBEREMOVED(g2d, (dimTotal.getWidth() - nameDim.getWidth()) / 2, manHeight);
|
||||
// final Dimension2D dimTotal = getDimension(StringBounderUtils.asStringBounder(g2d));
|
||||
// final Dimension2D nameDim = name.calculateDimension(StringBounderUtils.asStringBounder(g2d));
|
||||
//
|
||||
// final double manWidth = circleInterface.getPreferredWidth(StringBounderUtils.asStringBounder(g2d));
|
||||
// final double manHeight = circleInterface.getPreferredHeight(StringBounderUtils.asStringBounder(g2d));
|
||||
//
|
||||
// final double manX = (dimTotal.getWidth() - manWidth) / 2;
|
||||
//
|
||||
// g2d.setColor(Color.WHITE);
|
||||
// g2d.fill(new Rectangle2D.Double(0, 0, dimTotal.getWidth(), dimTotal.getHeight()));
|
||||
//
|
||||
// g2d.translate(manX, 0);
|
||||
// circleInterface.draw(g2d);
|
||||
// g2d.translate(-manX, 0);
|
||||
//
|
||||
// g2d.setColor(Color.BLACK);
|
||||
// name.drawTOBEREMOVED(g2d, (dimTotal.getWidth() - nameDim.getWidth()) / 2, manHeight);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5798 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -42,6 +42,7 @@ import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.cucadiagram.Entity;
|
||||
import net.sourceforge.plantuml.cucadiagram.EntityType;
|
||||
import net.sourceforge.plantuml.graphic.CircledCharacter;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
@ -60,8 +61,8 @@ class EntityImageClass extends AbstractEntityImage {
|
||||
|
||||
public EntityImageClass(Entity entity) {
|
||||
super(entity);
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), getFont14(), Color.BLACK,
|
||||
HorizontalAlignement.CENTER);
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), new FontConfiguration(
|
||||
getFont14(), Color.BLACK), HorizontalAlignement.CENTER);
|
||||
this.methods = new MethodsOrFieldsArea(entity.methods2(), getFont14());
|
||||
this.fields = new MethodsOrFieldsArea(entity.fields2(), getFont14());
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4959 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -43,6 +43,7 @@ import java.awt.geom.Rectangle2D;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.cucadiagram.Entity;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
@ -56,8 +57,8 @@ class EntityImageComponent extends AbstractEntityImage {
|
||||
|
||||
public EntityImageComponent(Entity entity) {
|
||||
super(entity);
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), getFont14(), Color.BLACK,
|
||||
HorizontalAlignement.CENTER);
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), new FontConfiguration(
|
||||
getFont14(), Color.BLACK), HorizontalAlignement.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4125 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -40,6 +40,7 @@ import java.util.Arrays;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.cucadiagram.Entity;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
@ -52,8 +53,8 @@ class EntityImageDefault extends AbstractEntityImage {
|
||||
|
||||
public EntityImageDefault(Entity entity) {
|
||||
super(entity);
|
||||
this.textBlock = TextBlockUtils.create(Arrays.asList(entity.getDisplay()), getFont14(), Color.BLACK,
|
||||
HorizontalAlignement.CENTER);
|
||||
this.textBlock = TextBlockUtils.create(Arrays.asList(entity.getDisplay()), new FontConfiguration(getFont14(),
|
||||
Color.BLACK), HorizontalAlignement.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4959 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -41,6 +41,7 @@ import java.awt.geom.Dimension2D;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.cucadiagram.Entity;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
@ -56,8 +57,8 @@ class EntityImageNote extends AbstractEntityImage {
|
||||
|
||||
public EntityImageNote(Entity entity) {
|
||||
super(entity);
|
||||
this.text = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), getFont14(), Color.BLACK,
|
||||
HorizontalAlignement.CENTER);
|
||||
this.text = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), new FontConfiguration(
|
||||
getFont14(), Color.BLACK), HorizontalAlignement.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4125 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -44,6 +44,7 @@ import java.awt.geom.Rectangle2D;
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.cucadiagram.Entity;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
@ -56,8 +57,8 @@ class EntityImageUsecase extends AbstractEntityImage {
|
||||
|
||||
public EntityImageUsecase(Entity entity) {
|
||||
super(entity);
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), getFont14(), Color.BLACK,
|
||||
HorizontalAlignement.CENTER);
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), new FontConfiguration(
|
||||
getFont14(), Color.BLACK), HorizontalAlignement.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5609 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graph;
|
||||
@ -43,6 +43,7 @@ import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.cucadiagram.Member;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
@ -80,7 +81,8 @@ public class MethodsOrFieldsArea {
|
||||
}
|
||||
|
||||
private TextBlock createTextBlock(String s) {
|
||||
return TextBlockUtils.create(Arrays.asList(s), font, Color.BLACK, HorizontalAlignement.LEFT);
|
||||
return TextBlockUtils.create(Arrays.asList(s), new FontConfiguration(font, Color.BLACK),
|
||||
HorizontalAlignement.LEFT);
|
||||
}
|
||||
|
||||
public void drawTOBEREMOVED(Graphics2D g2d, double x, double y) {
|
||||
|
@ -45,6 +45,7 @@ import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.cucadiagram.Member;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -98,7 +99,7 @@ public class MethodsOrFieldsArea2 {
|
||||
}
|
||||
|
||||
private TextBlock createTextBlock(String s) {
|
||||
return TextBlockUtils.create(Arrays.asList(s), font, color, HorizontalAlignement.LEFT);
|
||||
return TextBlockUtils.create(Arrays.asList(s), new FontConfiguration(font, color), HorizontalAlignement.LEFT);
|
||||
}
|
||||
|
||||
public void drawTOBEREMOVED(Graphics2D g2d, double x, double y) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 3834 $
|
||||
* Revision $Revision: 5983 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
@ -48,7 +48,7 @@ class ColorAndSizeChange implements FontChange {
|
||||
ColorAndSizeChange(String s) {
|
||||
final Matcher matcherColor = colorPattern.matcher(s);
|
||||
if (matcherColor.find()) {
|
||||
color = new HtmlColor(matcherColor.group(1));
|
||||
color = HtmlColor.getColorIfValid(matcherColor.group(1));
|
||||
} else {
|
||||
color = null;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class ColorChange implements FontChange {
|
||||
if (matcherColor.find() == false) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.color = new HtmlColor(matcherColor.group(1));
|
||||
this.color = HtmlColor.getColorIfValid(matcherColor.group(1));
|
||||
}
|
||||
|
||||
HtmlColor getColor() {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5507 $
|
||||
* Revision $Revision: 6000 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
@ -40,7 +40,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public enum FontStyle {
|
||||
PLAIN, ITALIC, BOLD, UNDERLINE, STRIKE, WAVE;
|
||||
PLAIN, ITALIC, BOLD, UNDERLINE, STRIKE, WAVE, BACKCOLOR;
|
||||
|
||||
public Font mutateFont(Font font) {
|
||||
if (this == ITALIC) {
|
||||
@ -65,6 +65,9 @@ public enum FontStyle {
|
||||
if (this == WAVE) {
|
||||
return "\\<[wW](?::(#[0-9a-fA-F]{6}|\\w+))?\\>";
|
||||
}
|
||||
if (this == BACKCOLOR) {
|
||||
return "\\<[bB][aA][cC][kK](?::(#[0-9a-fA-F]{6}|\\w+))?\\>";
|
||||
}
|
||||
if (this == STRIKE) {
|
||||
return "\\<(?:s|S|strike|STRIKE|del|DEL)(?::(#[0-9a-fA-F]{6}|\\w+))?\\>";
|
||||
}
|
||||
@ -78,7 +81,7 @@ public enum FontStyle {
|
||||
}
|
||||
final String color = m.group(1);
|
||||
if (color!= null && HtmlColor.isValid(color)) {
|
||||
return new HtmlColor(color).getColor();
|
||||
return HtmlColor.getColorIfValid(color).getColor();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -96,6 +99,9 @@ public enum FontStyle {
|
||||
if (this == WAVE) {
|
||||
return "\\</[wW]\\>";
|
||||
}
|
||||
if (this == BACKCOLOR) {
|
||||
return "\\</[bB][aA][cC][kK]\\>";
|
||||
}
|
||||
if (this == STRIKE) {
|
||||
return "\\</(?:s|S|strike|STRIKE|del|DEL)\\>";
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5872 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
@ -138,7 +138,8 @@ public class GraphicStrings {
|
||||
}
|
||||
|
||||
public Dimension2D drawU(final UGraphic ug) {
|
||||
final TextBlock textBlock = TextBlockUtils.create(strings, font, green, HorizontalAlignement.LEFT);
|
||||
final TextBlock textBlock = TextBlockUtils.create(strings, new FontConfiguration(font, green),
|
||||
HorizontalAlignement.LEFT);
|
||||
Dimension2D size = textBlock.calculateDimension(ug.getStringBounder());
|
||||
textBlock.drawU(ug, 0, 0);
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5204 $
|
||||
* Revision $Revision: 5983 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
@ -77,6 +77,7 @@ public class HtmlColor {
|
||||
register("DarkCyan", "#008B8B");
|
||||
register("DarkGoldenRod", "#B8860B");
|
||||
register("DarkGray", "#A9A9A9");
|
||||
register("DarkGrey", "#A9A9A9");
|
||||
register("DarkGreen", "#006400");
|
||||
register("DarkKhaki", "#BDB76B");
|
||||
register("DarkMagenta", "#8B008B");
|
||||
@ -88,11 +89,13 @@ public class HtmlColor {
|
||||
register("DarkSeaGreen", "#8FBC8F");
|
||||
register("DarkSlateBlue", "#483D8B");
|
||||
register("DarkSlateGray", "#2F4F4F");
|
||||
register("DarkSlateGrey", "#2F4F4F");
|
||||
register("DarkTurquoise", "#00CED1");
|
||||
register("DarkViolet", "#9400D3");
|
||||
register("DeepPink", "#FF1493");
|
||||
register("DeepSkyBlue", "#00BFFF");
|
||||
register("DimGray", "#696969");
|
||||
register("DimGrey", "#696969");
|
||||
register("DodgerBlue", "#1E90FF");
|
||||
register("FireBrick", "#B22222");
|
||||
register("FloralWhite", "#FFFAF0");
|
||||
@ -103,6 +106,7 @@ public class HtmlColor {
|
||||
register("Gold", "#FFD700");
|
||||
register("GoldenRod", "#DAA520");
|
||||
register("Gray", "#808080");
|
||||
register("Grey", "#808080");
|
||||
register("Green", "#008000");
|
||||
register("GreenYellow", "#ADFF2F");
|
||||
register("HoneyDew", "#F0FFF0");
|
||||
@ -119,6 +123,7 @@ public class HtmlColor {
|
||||
register("LightCoral", "#F08080");
|
||||
register("LightCyan", "#E0FFFF");
|
||||
register("LightGoldenRodYellow", "#FAFAD2");
|
||||
register("LightGray", "#D3D3D3");
|
||||
register("LightGrey", "#D3D3D3");
|
||||
register("LightGreen", "#90EE90");
|
||||
register("LightPink", "#FFB6C1");
|
||||
@ -126,6 +131,7 @@ public class HtmlColor {
|
||||
register("LightSeaGreen", "#20B2AA");
|
||||
register("LightSkyBlue", "#87CEFA");
|
||||
register("LightSlateGray", "#778899");
|
||||
register("LightSlateGrey", "#778899");
|
||||
register("LightSteelBlue", "#B0C4DE");
|
||||
register("LightYellow", "#FFFFE0");
|
||||
register("Lime", "#00FF00");
|
||||
@ -178,6 +184,7 @@ public class HtmlColor {
|
||||
register("SkyBlue", "#87CEEB");
|
||||
register("SlateBlue", "#6A5ACD");
|
||||
register("SlateGray", "#708090");
|
||||
register("SlateGrey", "#708090");
|
||||
register("Snow", "#FFFAFA");
|
||||
register("SpringGreen", "#00FF7F");
|
||||
register("SteelBlue", "#4682B4");
|
||||
@ -201,7 +208,7 @@ public class HtmlColor {
|
||||
|
||||
private final Color color;
|
||||
|
||||
public HtmlColor(String s) {
|
||||
private HtmlColor(String s) {
|
||||
if (s.matches("#[0-9A-Fa-f]{6}")) {
|
||||
color = new Color(Integer.parseInt(s.substring(1), 16));
|
||||
} else {
|
||||
@ -215,9 +222,9 @@ public class HtmlColor {
|
||||
assert isValid(s);
|
||||
}
|
||||
|
||||
private HtmlColor(Color c) {
|
||||
this.color = c;
|
||||
}
|
||||
// private HtmlColor(Color c) {
|
||||
// this.color = c;
|
||||
// }
|
||||
|
||||
static public boolean isValid(String s) {
|
||||
if (s.matches("#[0-9A-Fa-f]{6}")) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5741 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
@ -48,15 +48,13 @@ class SingleLine implements Line {
|
||||
private final List<Tile> blocs = new ArrayList<Tile>();
|
||||
private final HorizontalAlignement horizontalAlignement;
|
||||
|
||||
public SingleLine(String text, Font font, Color paint, HorizontalAlignement horizontalAlignement) {
|
||||
public SingleLine(String text, FontConfiguration fontConfiguration, HorizontalAlignement horizontalAlignement) {
|
||||
if (text.length() == 0) {
|
||||
text = " ";
|
||||
}
|
||||
this.horizontalAlignement = horizontalAlignement;
|
||||
final Splitter lineSplitter = new Splitter(text);
|
||||
|
||||
FontConfiguration fontConfiguration = new FontConfiguration(font, paint);
|
||||
|
||||
for (HtmlCommand cmd : lineSplitter.getHtmlCommands(false)) {
|
||||
if (cmd instanceof Text) {
|
||||
final String s = ((Text) cmd).getText();
|
||||
|
@ -28,13 +28,11 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4125 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.ArrayList;
|
||||
@ -48,21 +46,21 @@ class TextBlockSimple implements TextBlock {
|
||||
|
||||
private final List<Line> lines = new ArrayList<Line>();
|
||||
|
||||
protected TextBlockSimple(List<? extends CharSequence> texts, Font font, Color paint,
|
||||
protected TextBlockSimple(List<? extends CharSequence> texts, FontConfiguration fontConfiguration,
|
||||
HorizontalAlignement horizontalAlignement) {
|
||||
for (CharSequence s : texts) {
|
||||
if (s instanceof Stereotype) {
|
||||
lines.add(createLineForStereotype(font, paint, (Stereotype) s, horizontalAlignement));
|
||||
lines.add(createLineForStereotype(fontConfiguration, (Stereotype) s, horizontalAlignement));
|
||||
} else {
|
||||
lines.add(new SingleLine(s.toString(), font, paint, horizontalAlignement));
|
||||
lines.add(new SingleLine(s.toString(), fontConfiguration, horizontalAlignement));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private SingleLine createLineForStereotype(Font font, Color paint, Stereotype s,
|
||||
private SingleLine createLineForStereotype(FontConfiguration fontConfiguration, Stereotype s,
|
||||
HorizontalAlignement horizontalAlignement) {
|
||||
assert s.getLabel() != null;
|
||||
return new SingleLine(s.getLabel(), font.deriveFont(Font.ITALIC), paint, horizontalAlignement);
|
||||
return new SingleLine(s.getLabel(), fontConfiguration.add(FontStyle.ITALIC), horizontalAlignement);
|
||||
}
|
||||
|
||||
public Dimension2D calculateDimension(StringBounder stringBounder) {
|
||||
@ -95,7 +93,7 @@ class TextBlockSimple implements TextBlock {
|
||||
y += line.calculateDimension(StringBounderUtils.asStringBounder(g2d)).getHeight();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void drawU(UGraphic ug, double x, double y) {
|
||||
final Dimension2D dimText = getTextDimension(ug.getStringBounder());
|
||||
|
||||
@ -103,8 +101,7 @@ class TextBlockSimple implements TextBlock {
|
||||
final HorizontalAlignement lineHorizontalAlignement = line.getHorizontalAlignement();
|
||||
double deltaX = 0;
|
||||
if (lineHorizontalAlignement == HorizontalAlignement.CENTER) {
|
||||
final double diff = dimText.getWidth()
|
||||
- line.calculateDimension(ug.getStringBounder()).getWidth();
|
||||
final double diff = dimText.getWidth() - line.calculateDimension(ug.getStringBounder()).getWidth();
|
||||
deltaX = diff / 2.0;
|
||||
}
|
||||
line.drawU(ug, x + deltaX, y);
|
||||
|
@ -28,13 +28,11 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4169 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.List;
|
||||
@ -46,9 +44,9 @@ class TextBlockSpotted extends TextBlockSimple {
|
||||
|
||||
private final CircledCharacter circledCharacter;
|
||||
|
||||
public TextBlockSpotted(CircledCharacter circledCharacter, List<? extends CharSequence> texts, Font font,
|
||||
Color paint, HorizontalAlignement horizontalAlignement) {
|
||||
super(texts, font, paint, horizontalAlignement);
|
||||
public TextBlockSpotted(CircledCharacter circledCharacter, List<? extends CharSequence> texts,
|
||||
FontConfiguration fontConfiguration, HorizontalAlignement horizontalAlignement) {
|
||||
super(texts, fontConfiguration, horizontalAlignement);
|
||||
this.circledCharacter = circledCharacter;
|
||||
}
|
||||
|
||||
@ -58,8 +56,8 @@ class TextBlockSpotted extends TextBlockSimple {
|
||||
final double heightCircledCharacter = circledCharacter.getPreferredHeight(stringBounder);
|
||||
|
||||
final Dimension2D dim = super.calculateDimension(stringBounder);
|
||||
return new Dimension2DDouble(dim.getWidth() + widthCircledCharacter, Math.max(heightCircledCharacter, dim
|
||||
.getHeight()));
|
||||
return new Dimension2DDouble(dim.getWidth() + widthCircledCharacter, Math.max(heightCircledCharacter,
|
||||
dim.getHeight()));
|
||||
}
|
||||
|
||||
private double getCircledCharacterWithAndMargin(StringBounder stringBounder) {
|
||||
@ -68,36 +66,36 @@ class TextBlockSpotted extends TextBlockSimple {
|
||||
|
||||
@Override
|
||||
public void drawTOBEREMOVED(Graphics2D g2d, double x, double y) {
|
||||
// final AffineTransform at = g2d.getTransform();
|
||||
// final StringBounder stringBounder = StringBounderUtils.asStringBounder(g2d);
|
||||
//
|
||||
// final double deltaY = calculateDimension(StringBounderUtils.asStringBounder(g2d)).getHeight()
|
||||
// - circledCharacter.getPreferredHeight(stringBounder);
|
||||
//
|
||||
// // g2d.translate(x, y + deltaY / 2.0);
|
||||
// circledCharacter.draw(g2d, (int) x, (int) (y + deltaY / 2.0));
|
||||
// // circledCharacter.draw(g2d);
|
||||
//
|
||||
// g2d.setTransform(at);
|
||||
// final double widthCircledCharacter = getCircledCharacterWithAndMargin(stringBounder);
|
||||
// g2d.translate(widthCircledCharacter, 0);
|
||||
//
|
||||
// super.drawTOBEREMOVED(g2d, x, y);
|
||||
//
|
||||
// g2d.setTransform(at);
|
||||
// final AffineTransform at = g2d.getTransform();
|
||||
// final StringBounder stringBounder = StringBounderUtils.asStringBounder(g2d);
|
||||
//
|
||||
// final double deltaY = calculateDimension(StringBounderUtils.asStringBounder(g2d)).getHeight()
|
||||
// - circledCharacter.getPreferredHeight(stringBounder);
|
||||
//
|
||||
// // g2d.translate(x, y + deltaY / 2.0);
|
||||
// circledCharacter.draw(g2d, (int) x, (int) (y + deltaY / 2.0));
|
||||
// // circledCharacter.draw(g2d);
|
||||
//
|
||||
// g2d.setTransform(at);
|
||||
// final double widthCircledCharacter = getCircledCharacterWithAndMargin(stringBounder);
|
||||
// g2d.translate(widthCircledCharacter, 0);
|
||||
//
|
||||
// super.drawTOBEREMOVED(g2d, x, y);
|
||||
//
|
||||
// g2d.setTransform(at);
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug, double x, double y) {
|
||||
final double atX = ug.getTranslateX();
|
||||
final double atY = ug.getTranslateY();
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
||||
// final double deltaY = calculateDimension(stringBounder).getHeight()
|
||||
// - circledCharacter.getPreferredHeight(stringBounder);
|
||||
// final double deltaY = calculateDimension(stringBounder).getHeight()
|
||||
// - circledCharacter.getPreferredHeight(stringBounder);
|
||||
|
||||
//circledCharacter.drawU(ug, (int) x, (int) (y + deltaY / 2.0));
|
||||
// circledCharacter.drawU(ug, (int) x, (int) (y + deltaY / 2.0));
|
||||
circledCharacter.drawU(ug, x, y);
|
||||
|
||||
ug.setTranslate(atX, atY);
|
||||
|
@ -28,13 +28,11 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4111 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
@ -42,38 +40,39 @@ import net.sourceforge.plantuml.sequencediagram.MessageNumber;
|
||||
|
||||
public class TextBlockUtils {
|
||||
|
||||
public static TextBlock create(List<? extends CharSequence> texts, Font font, Color paint,
|
||||
public static TextBlock create(List<? extends CharSequence> texts, FontConfiguration fontConfiguration,
|
||||
HorizontalAlignement horizontalAlignement) {
|
||||
if (texts.size() > 0 && texts.get(0) instanceof Stereotype) {
|
||||
return createStereotype(texts, font, paint, horizontalAlignement);
|
||||
return createStereotype(texts, fontConfiguration, horizontalAlignement);
|
||||
}
|
||||
if (texts.size() > 0 && texts.get(0) instanceof MessageNumber) {
|
||||
return createMessageNumber(texts, font, paint, horizontalAlignement);
|
||||
return createMessageNumber(texts, fontConfiguration, horizontalAlignement);
|
||||
}
|
||||
return new TextBlockSimple(texts, font, paint, horizontalAlignement);
|
||||
return new TextBlockSimple(texts, fontConfiguration, horizontalAlignement);
|
||||
}
|
||||
|
||||
private static TextBlock createMessageNumber(List<? extends CharSequence> texts, Font font, Color paint,
|
||||
HorizontalAlignement horizontalAlignement) {
|
||||
private static TextBlock createMessageNumber(List<? extends CharSequence> texts,
|
||||
FontConfiguration fontConfiguration, HorizontalAlignement horizontalAlignement) {
|
||||
final MessageNumber number = (MessageNumber) texts.get(0);
|
||||
return new TextBlockWithNumber(number.getNumber(), texts.subList(1, texts.size()), font, paint,
|
||||
return new TextBlockWithNumber(number.getNumber(), texts.subList(1, texts.size()), fontConfiguration,
|
||||
horizontalAlignement);
|
||||
|
||||
}
|
||||
|
||||
private static TextBlock createStereotype(List<? extends CharSequence> texts, Font font, Color paint,
|
||||
private static TextBlock createStereotype(List<? extends CharSequence> texts, FontConfiguration fontConfiguration,
|
||||
HorizontalAlignement horizontalAlignement) {
|
||||
final Stereotype stereotype = (Stereotype) texts.get(0);
|
||||
if (stereotype.isSpotted()) {
|
||||
final CircledCharacter circledCharacter = new CircledCharacter(stereotype.getCharacter(), stereotype
|
||||
.getRadius(), stereotype.getCircledFont(), stereotype.getColor(), null, paint);
|
||||
final CircledCharacter circledCharacter = new CircledCharacter(stereotype.getCharacter(),
|
||||
stereotype.getRadius(), stereotype.getCircledFont(), stereotype.getColor(), null,
|
||||
fontConfiguration.getColor());
|
||||
if (stereotype.getLabel() == null) {
|
||||
return new TextBlockSpotted(circledCharacter, texts.subList(1, texts.size()), font, paint,
|
||||
return new TextBlockSpotted(circledCharacter, texts.subList(1, texts.size()), fontConfiguration,
|
||||
horizontalAlignement);
|
||||
}
|
||||
return new TextBlockSpotted(circledCharacter, texts, font, paint, horizontalAlignement);
|
||||
return new TextBlockSpotted(circledCharacter, texts, fontConfiguration, horizontalAlignement);
|
||||
}
|
||||
return new TextBlockSimple(texts, font, paint, horizontalAlignement);
|
||||
return new TextBlockSimple(texts, fontConfiguration, horizontalAlignement);
|
||||
}
|
||||
|
||||
// static private Font deriveForCircleCharacter(Font font) {
|
||||
|
@ -28,13 +28,11 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4125 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.graphic;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Dimension2D;
|
||||
import java.util.Arrays;
|
||||
@ -47,10 +45,10 @@ class TextBlockWithNumber extends TextBlockSimple {
|
||||
|
||||
private final TextBlock numText;
|
||||
|
||||
public TextBlockWithNumber(String number, List<? extends CharSequence> texts, Font font, Color paint,
|
||||
public TextBlockWithNumber(String number, List<? extends CharSequence> texts, FontConfiguration fontConfiguration,
|
||||
HorizontalAlignement horizontalAlignement) {
|
||||
super(texts, font, paint, horizontalAlignement);
|
||||
this.numText = TextBlockUtils.create(Arrays.asList(number), font, paint, HorizontalAlignement.LEFT);
|
||||
super(texts, fontConfiguration, horizontalAlignement);
|
||||
this.numText = TextBlockUtils.create(Arrays.asList(number), fontConfiguration, HorizontalAlignement.LEFT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -77,7 +75,7 @@ class TextBlockWithNumber extends TextBlockSimple {
|
||||
numText.drawTOBEREMOVED(g2d, x, y + deltaY / 2.0);
|
||||
super.drawTOBEREMOVED(g2d, x + getNumberWithAndMargin(stringBounder), y);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void drawU(UGraphic ug, double x, double y) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5793 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.png;
|
||||
@ -41,6 +41,7 @@ import java.awt.geom.Dimension2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderUtils;
|
||||
@ -91,7 +92,7 @@ public class PngTitler {
|
||||
return null;
|
||||
}
|
||||
final Font normalFont = new Font(fontFamily, Font.PLAIN, fontSize);
|
||||
return TextBlockUtils.create(text, normalFont, textColor, horizontalAlignement);
|
||||
return TextBlockUtils.create(text, new FontConfiguration(normalFont, textColor), horizontalAlignement);
|
||||
}
|
||||
|
||||
static private BufferedImage addTitle(BufferedImage im, Color background, Color textColor, List<String> text,
|
||||
@ -100,7 +101,8 @@ public class PngTitler {
|
||||
|
||||
final Font normalFont = new Font(fontFamily, Font.PLAIN, fontSize);
|
||||
final Graphics2D oldg2d = im.createGraphics();
|
||||
final TextBlock textBloc = TextBlockUtils.create(text, normalFont, textColor, horizontalAlignement);
|
||||
final TextBlock textBloc = TextBlockUtils.create(text, new FontConfiguration(normalFont, textColor),
|
||||
horizontalAlignement);
|
||||
final Dimension2D dimText = textBloc.calculateDimension(StringBounderUtils.asStringBounder(oldg2d));
|
||||
oldg2d.dispose();
|
||||
|
||||
|
@ -48,6 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.EntityType;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.PlayField;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -77,8 +78,8 @@ public class EntityImageBlock implements IEntityImageBlock {
|
||||
this.links = links;
|
||||
|
||||
if (StringUtils.isNotEmpty(entity.getDisplay())) {
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()),
|
||||
param.getFont(titleParam, null), Color.BLACK, HorizontalAlignement.CENTER);
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), new FontConfiguration(
|
||||
param.getFont(titleParam, null), Color.BLACK), HorizontalAlignement.CENTER);
|
||||
} else {
|
||||
this.name = null;
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graph.MethodsOrFieldsArea2;
|
||||
import net.sourceforge.plantuml.graphic.CircledCharacter;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -70,15 +71,16 @@ public class EntityImageClass2 extends AbstractEntityImage2 {
|
||||
|
||||
public EntityImageClass2(IEntity entity, ISkinParam skinParam, Collection<Link> links) {
|
||||
super(entity, skinParam);
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), getFont(FontParam.CLASS),
|
||||
Color.BLACK, HorizontalAlignement.CENTER);
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(entity.getDisplay()), new FontConfiguration(
|
||||
getFont(FontParam.CLASS), Color.BLACK), HorizontalAlignement.CENTER);
|
||||
final Stereotype stereotype = entity.getStereotype();
|
||||
if (stereotype == null || stereotype.getLabel() == null) {
|
||||
this.stereo = null;
|
||||
} else {
|
||||
this.stereo = TextBlockUtils.create(StringUtils.getWithNewlines(stereotype.getLabel()),
|
||||
getFont(FontParam.CLASS_STEREOTYPE), getFontColor(FontParam.CLASS_STEREOTYPE),
|
||||
HorizontalAlignement.CENTER);
|
||||
this.stereo = TextBlockUtils
|
||||
.create(StringUtils.getWithNewlines(stereotype.getLabel()), new FontConfiguration(
|
||||
getFont(FontParam.CLASS_STEREOTYPE), getFontColor(FontParam.CLASS_STEREOTYPE)),
|
||||
HorizontalAlignement.CENTER);
|
||||
}
|
||||
this.methods = new MethodsOrFieldsArea2(entity.methods2(), FontParam.CLASS_ATTRIBUTE, skinParam);
|
||||
this.fields = new MethodsOrFieldsArea2(entity.fields2(), FontParam.CLASS_ATTRIBUTE, skinParam);
|
||||
|
@ -41,6 +41,7 @@ import java.util.List;
|
||||
import net.sourceforge.plantuml.ColorParam;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -116,7 +117,8 @@ public class Frame implements Component {
|
||||
private TextBlock createTextBloc() {
|
||||
final Font font = skinParam.getFont(FontParam.PACKAGE, null);
|
||||
final Color textColor = skinParam.getFontHtmlColor(FontParam.PACKAGE, null).getColor();
|
||||
final TextBlock bloc = TextBlockUtils.create(name, font, textColor, HorizontalAlignement.LEFT);
|
||||
final TextBlock bloc = TextBlockUtils.create(name, new FontConfiguration(font, textColor),
|
||||
HorizontalAlignement.LEFT);
|
||||
return bloc;
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@ import net.sourceforge.plantuml.FontParam;
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -61,14 +62,14 @@ public class LabelImage {
|
||||
// this.entity = entity;
|
||||
this.param = param;
|
||||
this.rose = rose;
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(link.getLabel()), param.getFont(FontParam.CLASS, null),
|
||||
Color.BLACK, HorizontalAlignement.CENTER);
|
||||
this.name = TextBlockUtils.create(StringUtils.getWithNewlines(link.getLabel()),
|
||||
new FontConfiguration(param.getFont(FontParam.CLASS, null), Color.BLACK), HorizontalAlignement.CENTER);
|
||||
}
|
||||
|
||||
public Dimension2D getDimension(StringBounder stringBounder) {
|
||||
final Dimension2D dim = name.calculateDimension(stringBounder);
|
||||
return dim;
|
||||
//return Dimension2DDouble.delta(dim, 2 * margin);
|
||||
// return Dimension2DDouble.delta(dim, 2 * margin);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug, double x, double y) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5924 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.printskin;
|
||||
@ -41,7 +41,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.AbstractPSystem;
|
||||
@ -49,6 +48,7 @@ import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.EmptyImageBuilder;
|
||||
import net.sourceforge.plantuml.FileFormatOption;
|
||||
import net.sourceforge.plantuml.SkinParam;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
@ -73,7 +73,8 @@ class PrintSkin extends AbstractPSystem {
|
||||
private float ypos = 0;
|
||||
private float maxYpos = 0;
|
||||
|
||||
public List<File> createFiles(File suggestedFile, FileFormatOption fileFormat) throws IOException, InterruptedException {
|
||||
public List<File> createFiles(File suggestedFile, FileFormatOption fileFormat) throws IOException,
|
||||
InterruptedException {
|
||||
final List<File> result = Arrays.asList(suggestedFile);
|
||||
final BufferedImage im = createImage();
|
||||
|
||||
@ -92,10 +93,10 @@ class PrintSkin extends AbstractPSystem {
|
||||
|
||||
final BufferedImage im = builder.getBufferedImage();
|
||||
final Graphics2D g2d = builder.getGraphics2D();
|
||||
|
||||
|
||||
ug = new UGraphicG2d(g2d, null, 1.0);
|
||||
|
||||
for (ComponentType type : ComponentType.all() ) {
|
||||
for (ComponentType type : ComponentType.all()) {
|
||||
printComponent(type);
|
||||
ypos += 10;
|
||||
maxYpos = Math.max(maxYpos, ypos);
|
||||
@ -128,22 +129,22 @@ class PrintSkin extends AbstractPSystem {
|
||||
}
|
||||
ug.getParam().setColor(Color.LIGHT_GRAY);
|
||||
ug.getParam().setBackcolor(Color.LIGHT_GRAY);
|
||||
ug.draw(xpos-1, ypos-1, new URectangle(width+2, height+2));
|
||||
//g2d.drawRect((int) xpos - 1, (int) ypos - 1, (int) width + 2, (int) height + 2);
|
||||
ug.draw(xpos - 1, ypos - 1, new URectangle(width + 2, height + 2));
|
||||
// g2d.drawRect((int) xpos - 1, (int) ypos - 1, (int) width + 2, (int) height + 2);
|
||||
|
||||
//final AffineTransform at = g2d.getTransform();
|
||||
//g2d.translate(xpos, ypos);
|
||||
// final AffineTransform at = g2d.getTransform();
|
||||
// g2d.translate(xpos, ypos);
|
||||
ug.translate(xpos, ypos);
|
||||
ug.getParam().reset();
|
||||
comp.drawU(ug, new Dimension2DDouble(width, height), new SimpleContext2D(false));
|
||||
ug.translate(-xpos, -ypos);
|
||||
//g2d.setTransform(at);
|
||||
// g2d.setTransform(at);
|
||||
|
||||
ypos += height;
|
||||
}
|
||||
|
||||
private void println(String s) {
|
||||
final TextBlock textBlock = TextBlockUtils.create(Arrays.asList(s), FONT1, Color.BLACK,
|
||||
final TextBlock textBlock = TextBlockUtils.create(Arrays.asList(s), new FontConfiguration(FONT1, Color.BLACK),
|
||||
HorizontalAlignement.LEFT);
|
||||
textBlock.drawU(ug, xpos, ypos);
|
||||
ypos += textBlock.calculateDimension(ug.getStringBounder()).getHeight();
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5942 $
|
||||
* Revision $Revision: 6016 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
@ -64,17 +64,15 @@ import net.sourceforge.plantuml.skin.Skin;
|
||||
|
||||
class DrawableSetInitializer {
|
||||
|
||||
private ComponentType defaultLineType;
|
||||
private final DrawableSet drawableSet;
|
||||
private final boolean showTail;
|
||||
|
||||
private double freeX = 0;
|
||||
private double freeY = 0;
|
||||
|
||||
// private final double groupingMargin = 10;
|
||||
private final double autonewpage;
|
||||
|
||||
// private int maxGrouping = 0;
|
||||
|
||||
private ConstraintSet constraintSet;
|
||||
|
||||
public DrawableSetInitializer(Skin skin, ISkinParam skinParam, boolean showTail, double autonewpage) {
|
||||
@ -86,11 +84,22 @@ class DrawableSetInitializer {
|
||||
|
||||
private double lastFreeY = 0;
|
||||
|
||||
private boolean hasDelay() {
|
||||
for (Event ev : drawableSet.getAllEvents()) {
|
||||
if (ev instanceof Delay) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public DrawableSet createDrawableSet(StringBounder stringBounder) {
|
||||
if (freeY != 0) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
this.defaultLineType = hasDelay() ? ComponentType.CONTINUE_LINE : ComponentType.PARTICIPANT_LINE;
|
||||
|
||||
for (Participant p : drawableSet.getAllParticipants()) {
|
||||
prepareParticipant(stringBounder, p);
|
||||
}
|
||||
@ -271,11 +280,11 @@ class DrawableSetInitializer {
|
||||
if (m.getType() != GroupingType.START) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
final ISkinParam skinParam = new SkinParamBackcolored(drawableSet.getSkinParam(), m.getBackColorElement(), m
|
||||
.getBackColorGeneral());
|
||||
final ISkinParam skinParam = new SkinParamBackcolored(drawableSet.getSkinParam(), m.getBackColorElement(),
|
||||
m.getBackColorGeneral());
|
||||
// this.maxGrouping++;
|
||||
final List<String> strings = m.getTitle().equals("group") ? Arrays.asList(m.getComment()) : Arrays.asList(m
|
||||
.getTitle(), m.getComment());
|
||||
final List<String> strings = m.getTitle().equals("group") ? Arrays.asList(m.getComment()) : Arrays.asList(
|
||||
m.getTitle(), m.getComment());
|
||||
final Component header = drawableSet.getSkin().createComponent(ComponentType.GROUPING_HEADER, skinParam,
|
||||
strings);
|
||||
final InGroupableList inGroupableList = new InGroupableList(m, freeY);
|
||||
@ -387,7 +396,7 @@ class DrawableSetInitializer {
|
||||
p.getDisplay());
|
||||
final Component tail = drawableSet.getSkin().createComponent(ComponentType.PARTICIPANT_TAIL, skinParam,
|
||||
p.getDisplay());
|
||||
final Component line = drawableSet.getSkin().createComponent(ComponentType.PARTICIPANT_LINE,
|
||||
final Component line = drawableSet.getSkin().createComponent(this.defaultLineType,
|
||||
drawableSet.getSkinParam(), p.getDisplay());
|
||||
final Component delayLine = drawableSet.getSkin().createComponent(ComponentType.DELAY_LINE,
|
||||
drawableSet.getSkinParam(), p.getDisplay());
|
||||
@ -398,7 +407,7 @@ class DrawableSetInitializer {
|
||||
p.getDisplay());
|
||||
final Component tail = drawableSet.getSkin().createComponent(ComponentType.ACTOR_TAIL, skinParam,
|
||||
p.getDisplay());
|
||||
final Component line = drawableSet.getSkin().createComponent(ComponentType.ACTOR_LINE,
|
||||
final Component line = drawableSet.getSkin().createComponent(this.defaultLineType,
|
||||
drawableSet.getSkinParam(), p.getDisplay());
|
||||
final Component delayLine = drawableSet.getSkin().createComponent(ComponentType.DELAY_LINE,
|
||||
drawableSet.getSkinParam(), p.getDisplay());
|
||||
|
@ -28,13 +28,14 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5636 $
|
||||
* Revision $Revision: 6026 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
@ -167,18 +168,22 @@ class LifeLine {
|
||||
return delta;
|
||||
}
|
||||
|
||||
Collection<Segment> getSegments() {
|
||||
final Collection<Segment> result = new ArrayList<Segment>();
|
||||
Collection<SegmentColored> getSegments() {
|
||||
final Collection<SegmentColored> result = new ArrayList<SegmentColored>();
|
||||
for (int i = 0; i < events.size(); i++) {
|
||||
final Segment seg = getSegment(i);
|
||||
final SegmentColored seg = getSegment(i);
|
||||
if (seg != null) {
|
||||
result.add(seg);
|
||||
result.addAll(cutSegmentIfNeed(seg, participant.getDelays()));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Segment getSegment(int i) {
|
||||
static Collection<SegmentColored> cutSegmentIfNeed(SegmentColored seg, Collection<GraphicalDelayText> delays) {
|
||||
return Collections.singleton(seg);
|
||||
}
|
||||
|
||||
private SegmentColored getSegment(int i) {
|
||||
if (events.get(i).type != LifeSegmentVariation.LARGER) {
|
||||
return null;
|
||||
}
|
||||
@ -190,10 +195,10 @@ class LifeLine {
|
||||
level--;
|
||||
}
|
||||
if (level == 0) {
|
||||
return new Segment(events.get(i).y, events.get(j).y, events.get(i).backcolor);
|
||||
return new SegmentColored(events.get(i).y, events.get(j).y, events.get(i).backcolor);
|
||||
}
|
||||
}
|
||||
return new Segment(events.get(i).y, events.get(events.size() - 1).y, events.get(i).backcolor);
|
||||
return new SegmentColored(events.get(i).y, events.get(events.size() - 1).y, events.get(i).backcolor);
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug, Skin skin, ISkinParam skinParam) {
|
||||
@ -204,10 +209,10 @@ class LifeLine {
|
||||
|
||||
ug.translate(getStartingX(stringBounder), 0);
|
||||
|
||||
for (Segment seg : getSegments()) {
|
||||
for (SegmentColored seg : getSegments()) {
|
||||
final ISkinParam skinParam2 = new SkinParamBackcolored(skinParam, seg.getSpecificBackColor());
|
||||
final Component comp = skin.createComponent(ComponentType.ALIVE_LINE, skinParam2, null);
|
||||
final int currentLevel = getLevel(seg.getPos1());
|
||||
final int currentLevel = getLevel(seg.getSegment().getPos1());
|
||||
seg.drawU(ug, comp, currentLevel);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5870 $
|
||||
* Revision $Revision: 6024 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
@ -61,14 +61,14 @@ public class LivingParticipantBox implements InGroupable {
|
||||
return lifeLine;
|
||||
}
|
||||
|
||||
public Segment getLiveThicknessAt(StringBounder stringBounder, double y) {
|
||||
public SegmentColored getLiveThicknessAt(StringBounder stringBounder, double y) {
|
||||
final double left = lifeLine.getLeftShift(y);
|
||||
assert left >= 0;
|
||||
final double right = lifeLine.getRightShift(y);
|
||||
assert right >= 0 : "right=" + right;
|
||||
final double centerX = participantBox.getCenterX(stringBounder);
|
||||
// System.err.println("Attention, null for segment");
|
||||
return new Segment(centerX - left, centerX + right, null);
|
||||
return new SegmentColored(centerX - left, centerX + right, null);
|
||||
}
|
||||
|
||||
public void drawLineU(UGraphic ug, double startingY, double endingY, boolean showTail) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5870 $
|
||||
* Revision $Revision: 6026 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
@ -71,12 +71,12 @@ class MessageArrow extends Arrow {
|
||||
|
||||
private double getLeftStartInternal(StringBounder stringBounder) {
|
||||
return getParticipantAt(stringBounder, NotePosition.LEFT).getLiveThicknessAt(stringBounder,
|
||||
getArrowYStartLevel(stringBounder)).getPos2();
|
||||
getArrowYStartLevel(stringBounder)).getSegment().getPos2();
|
||||
}
|
||||
|
||||
private double getRightEndInternal(StringBounder stringBounder) {
|
||||
return getParticipantAt(stringBounder, NotePosition.RIGHT).getLiveThicknessAt(stringBounder,
|
||||
getArrowYStartLevel(stringBounder)).getPos1();
|
||||
getArrowYStartLevel(stringBounder)).getSegment().getPos1();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,12 +70,12 @@ public class MessageExoArrow extends Arrow {
|
||||
// - getPreferredWidth(stringBounder));
|
||||
return 0;
|
||||
}
|
||||
return p.getLiveThicknessAt(stringBounder, getArrowYStartLevel(stringBounder)).getPos2();
|
||||
return p.getLiveThicknessAt(stringBounder, getArrowYStartLevel(stringBounder)).getSegment().getPos2();
|
||||
}
|
||||
|
||||
private double getRightEndInternal(StringBounder stringBounder, double maxX) {
|
||||
if (type == MessageExoType.FROM_LEFT || type == MessageExoType.TO_LEFT) {
|
||||
return p.getLiveThicknessAt(stringBounder, getArrowYStartLevel(stringBounder)).getPos1();
|
||||
return p.getLiveThicknessAt(stringBounder, getArrowYStartLevel(stringBounder)).getSegment().getPos1();
|
||||
}
|
||||
return Math.max(maxX, getLeftStartInternal(stringBounder) + getPreferredWidth(stringBounder));
|
||||
}
|
||||
@ -159,5 +159,5 @@ public class MessageExoArrow extends Arrow {
|
||||
public double getActualWidth(StringBounder stringBounder) {
|
||||
return getActualWidth(stringBounder, getMaxX());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5870 $
|
||||
* Revision $Revision: 6026 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
@ -73,7 +73,7 @@ class MessageSelfArrow extends Arrow {
|
||||
|
||||
@Override
|
||||
public double getStartingX(StringBounder stringBounder) {
|
||||
return p1.getLiveThicknessAt(stringBounder, getArrowYStartLevel(stringBounder)).getPos2();
|
||||
return p1.getLiveThicknessAt(stringBounder, getArrowYStartLevel(stringBounder)).getSegment().getPos2();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5870 $
|
||||
* Revision $Revision: 6026 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
@ -91,12 +91,12 @@ class NoteBox extends GraphicalElement implements InGroupable {
|
||||
|
||||
@Override
|
||||
public double getStartingX(StringBounder stringBounder) {
|
||||
final Segment segment = getSegment(stringBounder);
|
||||
final SegmentColored segment = getSegment(stringBounder);
|
||||
final int xStart;
|
||||
if (position == NotePosition.LEFT) {
|
||||
xStart = (int) (segment.getPos1() - getPreferredWidth(stringBounder));
|
||||
xStart = (int) (segment.getSegment().getPos1() - getPreferredWidth(stringBounder));
|
||||
} else if (position == NotePosition.RIGHT) {
|
||||
xStart = (int) (segment.getPos2());
|
||||
xStart = (int) (segment.getSegment().getPos2());
|
||||
} else if (position == NotePosition.OVER) {
|
||||
xStart = (int) (p1.getParticipantBox().getCenterX(stringBounder) - getPreferredWidth(stringBounder) / 2);
|
||||
} else if (position == NotePosition.OVER_SEVERAL) {
|
||||
@ -106,15 +106,16 @@ class NoteBox extends GraphicalElement implements InGroupable {
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
// if (InGroupableList.NEW_METHOD) {
|
||||
// System.err.println("GET STARTING X OF " + this + " " + (xStart + delta));
|
||||
// }
|
||||
// if (InGroupableList.NEW_METHOD) {
|
||||
// System.err.println("GET STARTING X OF " + this + " " + (xStart +
|
||||
// delta));
|
||||
// }
|
||||
return xStart + delta;
|
||||
}
|
||||
|
||||
private Segment getSegment(StringBounder stringBounder) {
|
||||
final Segment segment = p1.getLiveThicknessAt(stringBounder, getStartingY());
|
||||
final Segment segment2 = p1.getLiveThicknessAt(stringBounder, getStartingY()
|
||||
private SegmentColored getSegment(StringBounder stringBounder) {
|
||||
final SegmentColored segment = p1.getLiveThicknessAt(stringBounder, getStartingY());
|
||||
final SegmentColored segment2 = p1.getLiveThicknessAt(stringBounder, getStartingY()
|
||||
+ comp.getPreferredHeight(stringBounder));
|
||||
return segment.merge(segment2);
|
||||
}
|
||||
@ -135,5 +136,4 @@ class NoteBox extends GraphicalElement implements InGroupable {
|
||||
return toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -28,12 +28,14 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5942 $
|
||||
* Revision $Revision: 6016 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
@ -106,8 +108,10 @@ public class ParticipantBox implements Pushable {
|
||||
final double y1 = topStartingY - head.getPreferredHeight(stringBounder)
|
||||
- line.getPreferredHeight(stringBounder) / 2;
|
||||
ug.translate(startingX + outMargin, y1);
|
||||
head.drawU(ug, new Dimension2DDouble(head.getPreferredWidth(stringBounder), head
|
||||
.getPreferredHeight(stringBounder)), new SimpleContext2D(false));
|
||||
head.drawU(
|
||||
ug,
|
||||
new Dimension2DDouble(head.getPreferredWidth(stringBounder), head.getPreferredHeight(stringBounder)),
|
||||
new SimpleContext2D(false));
|
||||
ug.setTranslate(atX, atY);
|
||||
}
|
||||
|
||||
@ -119,8 +123,10 @@ public class ParticipantBox implements Pushable {
|
||||
// throw new IllegalStateException();
|
||||
// }
|
||||
ug.translate(startingX + outMargin, positionTail);
|
||||
tail.drawU(ug, new Dimension2DDouble(tail.getPreferredWidth(stringBounder), tail
|
||||
.getPreferredHeight(stringBounder)), new SimpleContext2D(false));
|
||||
tail.drawU(
|
||||
ug,
|
||||
new Dimension2DDouble(tail.getPreferredWidth(stringBounder), tail.getPreferredHeight(stringBounder)),
|
||||
new SimpleContext2D(false));
|
||||
ug.setTranslate(atX, atY);
|
||||
}
|
||||
}
|
||||
@ -128,8 +134,9 @@ public class ParticipantBox implements Pushable {
|
||||
public void drawParticipantHead(UGraphic ug) {
|
||||
ug.translate(outMargin, 0);
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
head.drawU(ug, new Dimension2DDouble(head.getPreferredWidth(stringBounder), head
|
||||
.getPreferredHeight(stringBounder)), new SimpleContext2D(false));
|
||||
head.drawU(ug,
|
||||
new Dimension2DDouble(head.getPreferredWidth(stringBounder), head.getPreferredHeight(stringBounder)),
|
||||
new SimpleContext2D(false));
|
||||
ug.translate(-outMargin, 0);
|
||||
}
|
||||
|
||||
@ -175,7 +182,10 @@ public class ParticipantBox implements Pushable {
|
||||
|
||||
public void addDelay(GraphicalDelayText delay) {
|
||||
this.delays.add(delay);
|
||||
}
|
||||
|
||||
public Collection<GraphicalDelayText> getDelays() {
|
||||
return Collections.unmodifiableCollection(delays);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,11 +28,13 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5249 $
|
||||
* Revision $Revision: 6016 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
|
||||
class ParticipantBoxSimple implements Pushable {
|
||||
@ -66,5 +68,9 @@ class ParticipantBoxSimple implements Pushable {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Collection<GraphicalDelayText> getDelays() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -28,11 +28,13 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5249 $
|
||||
* Revision $Revision: 6016 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
|
||||
interface Pushable {
|
||||
@ -42,5 +44,8 @@ interface Pushable {
|
||||
double getCenterX(StringBounder stringBounder);
|
||||
|
||||
void pushToLeft(double deltaX);
|
||||
|
||||
public Collection<GraphicalDelayText> getDelays();
|
||||
|
||||
|
||||
}
|
@ -33,33 +33,25 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.skin.Component;
|
||||
import net.sourceforge.plantuml.skin.SimpleContext2D;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
class Segment {
|
||||
|
||||
final private double pos1;
|
||||
final private double pos2;
|
||||
final private HtmlColor backcolor;
|
||||
|
||||
Segment(double pos1, double pos2, HtmlColor backcolor) {
|
||||
Segment(double pos1, double pos2) {
|
||||
this.pos1 = pos1;
|
||||
this.pos2 = pos2;
|
||||
this.backcolor = backcolor;
|
||||
if (pos2 < pos1) {
|
||||
throw new IllegalArgumentException("pos1=" + pos1 + " pos2=" + pos2);
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
public HtmlColor getSpecificBackColor() {
|
||||
return backcolor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
@ -72,40 +64,53 @@ class Segment {
|
||||
return new Double(pos1).hashCode() + new Double(pos2).hashCode();
|
||||
}
|
||||
|
||||
public boolean contains(double y) {
|
||||
final public boolean contains(double y) {
|
||||
return y >= pos1 && y <= pos2;
|
||||
}
|
||||
|
||||
final public boolean contains(Segment other) {
|
||||
return contains(other.pos1) && contains(other.pos2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "" + pos1 + " - " + pos2;
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug, Component comp, int level) {
|
||||
final double atX = ug.getTranslateX();
|
||||
final double atY = ug.getTranslateY();
|
||||
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
ug.translate((level - 1) * comp.getPreferredWidth(stringBounder) / 2, pos1);
|
||||
final Dimension2D dim = new Dimension2DDouble(comp.getPreferredWidth(stringBounder), pos2 - pos1);
|
||||
comp.drawU(ug, dim, new SimpleContext2D(false));
|
||||
ug.setTranslate(atX, atY);
|
||||
}
|
||||
|
||||
public double getLength() {
|
||||
final public double getLength() {
|
||||
return pos2 - pos1;
|
||||
}
|
||||
|
||||
public double getPos1() {
|
||||
final public double getPos1() {
|
||||
return pos1;
|
||||
}
|
||||
|
||||
public double getPos2() {
|
||||
final public double getPos2() {
|
||||
return pos2;
|
||||
}
|
||||
|
||||
public Segment merge(Segment this2) {
|
||||
return new Segment(Math.min(this.pos1, this2.pos1), Math.max(this.pos2, this2.pos2), backcolor);
|
||||
return new Segment(Math.min(this.pos1, this2.pos1), Math.max(this.pos2, this2.pos2));
|
||||
}
|
||||
|
||||
public Collection<Segment> cutSegmentIfNeed(Collection<Segment> delays) {
|
||||
final List<Segment> result = new ArrayList<Segment>(delays);
|
||||
Collections.sort(result, new SortPos1());
|
||||
result.add(this);
|
||||
return Collections.unmodifiableCollection(result);
|
||||
}
|
||||
|
||||
private Collection<Segment> cutSegmentIfNeed(Segment other) {
|
||||
if (this.contains(other) == false) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
return Arrays.asList(new Segment(this.pos1, other.pos1), new Segment(this.pos2, other.pos2));
|
||||
}
|
||||
|
||||
static class SortPos1 implements Comparator<Segment> {
|
||||
public int compare(Segment segA, Segment segB) {
|
||||
return (int) Math.signum(segB.pos1 - segA.pos1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,99 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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: 6026 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.graphic.HtmlColor;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.skin.Component;
|
||||
import net.sourceforge.plantuml.skin.SimpleContext2D;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
|
||||
class SegmentColored {
|
||||
|
||||
final private Segment segment;
|
||||
final private HtmlColor backcolor;
|
||||
|
||||
SegmentColored(double pos1, double pos2, HtmlColor backcolor) {
|
||||
this(new Segment(pos1, pos2), backcolor);
|
||||
}
|
||||
|
||||
private SegmentColored(Segment segment, HtmlColor backcolor) {
|
||||
this.segment = segment;
|
||||
this.backcolor = backcolor;
|
||||
}
|
||||
|
||||
public HtmlColor getSpecificBackColor() {
|
||||
return backcolor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
final SegmentColored this2 = (SegmentColored) obj;
|
||||
return this.segment.equals(this2.segment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.segment.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.segment.toString();
|
||||
}
|
||||
|
||||
public void drawU(UGraphic ug, Component comp, int level) {
|
||||
final double atX = ug.getTranslateX();
|
||||
final double atY = ug.getTranslateY();
|
||||
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
ug.translate((level - 1) * comp.getPreferredWidth(stringBounder) / 2, segment.getPos1());
|
||||
final Dimension2D dim = new Dimension2DDouble(comp.getPreferredWidth(stringBounder), segment.getPos2()
|
||||
- segment.getPos1());
|
||||
comp.drawU(ug, dim, new SimpleContext2D(false));
|
||||
ug.setTranslate(atX, atY);
|
||||
}
|
||||
|
||||
public SegmentColored merge(SegmentColored this2) {
|
||||
return new SegmentColored(this.segment.merge(this2.segment), backcolor);
|
||||
}
|
||||
|
||||
public final Segment getSegment() {
|
||||
return segment;
|
||||
}
|
||||
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5928 $
|
||||
* Revision $Revision: 6026 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sequencediagram.graphic;
|
||||
@ -90,7 +90,8 @@ class Step1Message extends Step1Abstract {
|
||||
final double length;
|
||||
if (isSelfMessage()) {
|
||||
length = graphic.getArrowOnlyWidth(getStringBounder())
|
||||
+ getLivingParticipantBox1().getLiveThicknessAt(getStringBounder(), arrowYStartLevel).getLength();
|
||||
+ getLivingParticipantBox1().getLiveThicknessAt(getStringBounder(), arrowYStartLevel)
|
||||
.getSegment().getLength();
|
||||
} else {
|
||||
length = graphic.getArrowOnlyWidth(getStringBounder())
|
||||
+ getLivingParticipantBox(NotePosition.LEFT).getLifeLine().getRightShift(arrowYStartLevel)
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5741 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin;
|
||||
@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -76,7 +77,7 @@ public abstract class AbstractTextualComponent extends AbstractComponent {
|
||||
if (strings.size() == 1 && strings.get(0).length() == 0) {
|
||||
textBlock = new TextBlockEmpty();
|
||||
} else {
|
||||
textBlock = TextBlockUtils.create(strings, font, fontColor, horizontalAlignement);
|
||||
textBlock = TextBlockUtils.create(strings, new FontConfiguration(font, fontColor), horizontalAlignement);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,15 +46,17 @@ public class ComponentType {
|
||||
private static final List<ComponentType> nonArrows = new ArrayList<ComponentType>();
|
||||
|
||||
static public final ComponentType ACTOR_HEAD = new ComponentType("ACTOR_HEAD");
|
||||
static public final ComponentType ACTOR_LINE = new ComponentType("ACTOR_LINE");
|
||||
static public final ComponentType ACTOR_TAIL = new ComponentType("ACTOR_TAIL");
|
||||
|
||||
//
|
||||
static public final ComponentType ALIVE_LINE = new ComponentType("ALIVE_LINE");
|
||||
static public final ComponentType DELAY_LINE = new ComponentType("DELAY_LINE");
|
||||
static public final ComponentType DELAY_TEXT = new ComponentType("DELAY_TEXT");
|
||||
static public final ComponentType DESTROY = new ComponentType("DESTROY");
|
||||
|
||||
static public final ComponentType DELAY_LINE = new ComponentType("DELAY_LINE");
|
||||
static public final ComponentType PARTICIPANT_LINE = new ComponentType("PARTICIPANT_LINE");
|
||||
static public final ComponentType CONTINUE_LINE = new ComponentType("CONTINUE_LINE");
|
||||
|
||||
//
|
||||
static public final ComponentType GROUPING_BODY = new ComponentType("GROUPING_BODY");
|
||||
static public final ComponentType GROUPING_ELSE = new ComponentType("GROUPING_ELSE");
|
||||
@ -68,7 +70,6 @@ public class ComponentType {
|
||||
|
||||
//
|
||||
static public final ComponentType PARTICIPANT_HEAD = new ComponentType("PARTICIPANT_HEAD");
|
||||
static public final ComponentType PARTICIPANT_LINE = new ComponentType("PARTICIPANT_LINE");
|
||||
static public final ComponentType PARTICIPANT_TAIL = new ComponentType("PARTICIPANT_TAIL");
|
||||
|
||||
//
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4167 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin;
|
||||
@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -70,7 +71,8 @@ class GrayComponent extends AbstractComponent {
|
||||
strings.add(n.substring(i, Math.min(i + split, n.length())));
|
||||
}
|
||||
|
||||
final TextBlock textBlock = TextBlockUtils.create(strings, NORMAL, Color.BLACK, HorizontalAlignement.LEFT);
|
||||
final TextBlock textBlock = TextBlockUtils.create(strings, new FontConfiguration(NORMAL, Color.BLACK),
|
||||
HorizontalAlignement.LEFT);
|
||||
textBlock.drawU(ug, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5944 $
|
||||
* Revision $Revision: 6008 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin.bluemodern;
|
||||
@ -82,15 +82,15 @@ public class BlueModern implements Skin {
|
||||
if (type == ComponentType.PARTICIPANT_LINE) {
|
||||
return new ComponentBlueModernLine(lineColor);
|
||||
}
|
||||
if (type == ComponentType.CONTINUE_LINE) {
|
||||
return new ComponentBlueModernLine(lineColor);
|
||||
}
|
||||
if (type == ComponentType.ACTOR_HEAD) {
|
||||
return new ComponentBlueModernActor(blue2, blue1, blue1, participantFont, stringsToDisplay, true);
|
||||
}
|
||||
if (type == ComponentType.ACTOR_TAIL) {
|
||||
return new ComponentBlueModernActor(blue2, blue1, blue1, participantFont, stringsToDisplay, false);
|
||||
}
|
||||
if (type == ComponentType.ACTOR_LINE) {
|
||||
return new ComponentBlueModernLine(lineColor);
|
||||
}
|
||||
if (type == ComponentType.NOTE) {
|
||||
return new ComponentBlueModernNote(Color.WHITE, Color.BLACK, Color.BLACK, normalFont, stringsToDisplay);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5889 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin.bluemodern;
|
||||
@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -71,8 +72,8 @@ public class ComponentBlueModernGroupingHeader extends AbstractTextualComponent
|
||||
if (strings.size() == 1 || strings.get(1) == null) {
|
||||
this.commentTextBlock = null;
|
||||
} else {
|
||||
this.commentTextBlock = TextBlockUtils.create(Arrays.asList("[" + strings.get(1) + "]"), smallFont,
|
||||
fontColor2, HorizontalAlignement.LEFT);
|
||||
this.commentTextBlock = TextBlockUtils.create(Arrays.asList("[" + strings.get(1) + "]"),
|
||||
new FontConfiguration(smallFont, fontColor2), HorizontalAlignement.LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +107,6 @@ public class ComponentBlueModernGroupingHeader extends AbstractTextualComponent
|
||||
ug.draw(0, 0, new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawInternalU(UGraphic ug, Dimension2D dimensionToUse) {
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
@ -128,7 +128,7 @@ public class ComponentBlueModernGroupingHeader extends AbstractTextualComponent
|
||||
ug.getParam().setColor(borderColor);
|
||||
ug.draw(0, 0, polygon);
|
||||
ug.draw(0, 0, new ULine(dimensionToUse.getWidth(), 0));
|
||||
|
||||
|
||||
final double heightWithoutPadding = dimensionToUse.getHeight() - getPaddingY();
|
||||
|
||||
ug.draw(dimensionToUse.getWidth(), 0, new ULine(0, heightWithoutPadding));
|
||||
@ -138,11 +138,11 @@ public class ComponentBlueModernGroupingHeader extends AbstractTextualComponent
|
||||
getTextBlock().drawU(ug, getMarginX1(), getMarginY());
|
||||
|
||||
if (commentTextBlock != null) {
|
||||
//final Dimension2D size = commentTextBlock.calculateDimension(stringBounder);
|
||||
// final Dimension2D size = commentTextBlock.calculateDimension(stringBounder);
|
||||
ug.getParam().setColor(generalBackgroundColor);
|
||||
final int x1 = getMarginX1() + textWidth;
|
||||
final int y2 = getMarginY() + 1;
|
||||
//ug.draw(x1, y2, new URectangle(size.getWidth() + 2 * commentMargin, size.getHeight()));
|
||||
// ug.draw(x1, y2, new URectangle(size.getWidth() + 2 * commentMargin, size.getHeight()));
|
||||
|
||||
commentTextBlock.drawU(ug, x1 + commentMargin, y2);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5945 $
|
||||
* Revision $Revision: 5977 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin.bluemodern;
|
||||
@ -107,12 +107,12 @@ public class ComponentBlueModernSelfArrow extends AbstractComponentBlueModernArr
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight - getArrowDeltaY() + delta);
|
||||
polygon.addPoint(0, textHeight + delta);
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight + delta);
|
||||
} else if (getArrowConfiguration().getPart() == ArrowPart.TOP_PART) {
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight - getArrowDeltaY() + delta);
|
||||
} else if (getArrowConfiguration().getPart() == ArrowPart.BOTTOM_PART) {
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight + delta);
|
||||
polygon.addPoint(0, textHeight + delta);
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight + getArrowDeltaY() + delta);
|
||||
} else {
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight + delta);
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight - getArrowDeltaY() + delta);
|
||||
polygon.addPoint(0, textHeight + delta);
|
||||
polygon.addPoint(getArrowDeltaX(), textHeight + getArrowDeltaY() + delta);
|
||||
}
|
||||
|
@ -53,10 +53,19 @@ public class ComponentRoseDelayLine extends AbstractComponent {
|
||||
@Override
|
||||
protected void drawInternalU(UGraphic ug, Dimension2D dimensionToUse) {
|
||||
ug.getParam().setColor(color);
|
||||
//stroke(ug, 0.4, 2.5);
|
||||
stroke(ug, 0.2, 1.5);
|
||||
// stroke(ug, 0.4, 2.5);
|
||||
stroke(ug, 1, 4);
|
||||
final int x = (int) (dimensionToUse.getWidth() / 2);
|
||||
ug.setAntiAliasing(false);
|
||||
ug.draw(x, 0, new ULine(0, dimensionToUse.getHeight()));
|
||||
ug.setAntiAliasing(true);
|
||||
final double dx = 5;
|
||||
final double dy = 1.5;
|
||||
final double space = 1.5;
|
||||
final double middle = dimensionToUse.getHeight() / 2;
|
||||
ug.getParam().setStroke(new UStroke(1));
|
||||
// ug.draw(x - dx, middle + dy - space, new ULine(2 * dx, -2 * dy));
|
||||
// ug.draw(x - dx, middle + dy + space, new ULine(2 * dx, -2 * dy));
|
||||
ug.getParam().setStroke(new UStroke());
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5889 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin.rose;
|
||||
@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
@ -60,19 +61,16 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent {
|
||||
private final Color groupBackground;
|
||||
private final Color background;
|
||||
|
||||
public ComponentRoseGroupingHeader(Color fontColor, Color background,
|
||||
Color groupBackground, Font bigFont, Font smallFont,
|
||||
List<? extends CharSequence> strings) {
|
||||
super(strings.get(0), fontColor, bigFont, HorizontalAlignement.LEFT,
|
||||
15, 30, 1);
|
||||
public ComponentRoseGroupingHeader(Color fontColor, Color background, Color groupBackground, Font bigFont,
|
||||
Font smallFont, List<? extends CharSequence> strings) {
|
||||
super(strings.get(0), fontColor, bigFont, HorizontalAlignement.LEFT, 15, 30, 1);
|
||||
this.groupBackground = groupBackground;
|
||||
this.background = background;
|
||||
if (strings.size() == 1 || strings.get(1) == null) {
|
||||
this.commentTextBlock = null;
|
||||
} else {
|
||||
this.commentTextBlock = TextBlockUtils.create(Arrays.asList("["
|
||||
+ strings.get(1) + "]"), smallFont, fontColor,
|
||||
HorizontalAlignement.LEFT);
|
||||
this.commentTextBlock = TextBlockUtils.create(Arrays.asList("[" + strings.get(1) + "]"),
|
||||
new FontConfiguration(smallFont, fontColor), HorizontalAlignement.LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,8 +85,7 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent {
|
||||
if (commentTextBlock == null) {
|
||||
sup = commentMargin * 2;
|
||||
} else {
|
||||
final Dimension2D size = commentTextBlock
|
||||
.calculateDimension(stringBounder);
|
||||
final Dimension2D size = commentTextBlock.calculateDimension(stringBounder);
|
||||
sup = getMarginX1() + commentMargin + size.getWidth();
|
||||
|
||||
}
|
||||
@ -101,15 +98,13 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackgroundInternalU(UGraphic ug,
|
||||
Dimension2D dimensionToUse) {
|
||||
protected void drawBackgroundInternalU(UGraphic ug, Dimension2D dimensionToUse) {
|
||||
if (this.background == null) {
|
||||
return;
|
||||
}
|
||||
ug.getParam().setColor(null);
|
||||
ug.getParam().setBackcolor(background);
|
||||
ug.draw(0, 0, new URectangle(dimensionToUse.getWidth(), dimensionToUse
|
||||
.getHeight()));
|
||||
ug.draw(0, 0, new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -134,10 +129,10 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent {
|
||||
ug.draw(0, 0, polygon);
|
||||
|
||||
final double heightWithoutPadding = dimensionToUse.getHeight() - getPaddingY();
|
||||
|
||||
|
||||
ug.draw(0, 0, new ULine(dimensionToUse.getWidth(), 0));
|
||||
ug.draw(dimensionToUse.getWidth(), 0, new ULine(0, heightWithoutPadding));
|
||||
ug.draw(0, textHeight, new ULine(0, heightWithoutPadding-textHeight));
|
||||
ug.draw(0, textHeight, new ULine(0, heightWithoutPadding - textHeight));
|
||||
ug.getParam().setStroke(new UStroke());
|
||||
|
||||
getTextBlock().drawU(ug, getMarginX1(), getMarginY());
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5937 $
|
||||
* Revision $Revision: 6008 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin.rose;
|
||||
@ -45,15 +45,21 @@ import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
public class ComponentRoseLine extends AbstractComponent {
|
||||
|
||||
private final Color color;
|
||||
private final boolean continueLine;
|
||||
|
||||
public ComponentRoseLine(Color color) {
|
||||
public ComponentRoseLine(Color color, boolean continueLine) {
|
||||
this.color = color;
|
||||
this.continueLine = continueLine;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawInternalU(UGraphic ug, Dimension2D dimensionToUse) {
|
||||
ug.getParam().setColor(color);
|
||||
stroke(ug, 5, 5);
|
||||
if (continueLine) {
|
||||
ug.getParam().setStroke(new UStroke());
|
||||
} else {
|
||||
stroke(ug, 5, 5);
|
||||
}
|
||||
final int x = (int) (dimensionToUse.getWidth() / 2);
|
||||
ug.draw(x, 0, new ULine(0, dimensionToUse.getHeight()));
|
||||
ug.getParam().setStroke(new UStroke());
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5943 $
|
||||
* Revision $Revision: 6008 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.skin.rose;
|
||||
@ -53,72 +53,72 @@ public class Rose implements Skin {
|
||||
private final Map<ColorParam, HtmlColor> defaultsColor = new EnumMap<ColorParam, HtmlColor>(ColorParam.class);
|
||||
|
||||
public Rose() {
|
||||
defaultsColor.put(ColorParam.background, new HtmlColor("white"));
|
||||
defaultsColor.put(ColorParam.background, HtmlColor.getColorIfValid("white"));
|
||||
|
||||
defaultsColor.put(ColorParam.sequenceArrow, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.usecaseArrow, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.classArrow, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.objectArrow, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.activityArrow, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.componentArrow, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.stateArrow, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.sequenceArrow, HtmlColor.getColorIfValid("#A80036"));
|
||||
defaultsColor.put(ColorParam.usecaseArrow, HtmlColor.getColorIfValid("#A80036"));
|
||||
defaultsColor.put(ColorParam.classArrow, HtmlColor.getColorIfValid("#A80036"));
|
||||
defaultsColor.put(ColorParam.objectArrow, HtmlColor.getColorIfValid("#A80036"));
|
||||
defaultsColor.put(ColorParam.activityArrow, HtmlColor.getColorIfValid("#A80036"));
|
||||
defaultsColor.put(ColorParam.componentArrow, HtmlColor.getColorIfValid("#A80036"));
|
||||
defaultsColor.put(ColorParam.stateArrow, HtmlColor.getColorIfValid("#A80036"));
|
||||
|
||||
defaultsColor.put(ColorParam.sequenceLifeLineBackground, new HtmlColor("white"));
|
||||
defaultsColor.put(ColorParam.sequenceLifeLineBorder, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.sequenceGroupBackground, new HtmlColor("#EEEEEE"));
|
||||
defaultsColor.put(ColorParam.sequenceDividerBackground, new HtmlColor("#EEEEEE"));
|
||||
defaultsColor.put(ColorParam.sequenceEngloberLine, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.sequenceEngloberBackground, new HtmlColor("#DDDDDD"));
|
||||
defaultsColor.put(ColorParam.sequenceLifeLineBackground, HtmlColor.getColorIfValid("white"));
|
||||
defaultsColor.put(ColorParam.sequenceLifeLineBorder, HtmlColor.getColorIfValid("#A80036"));
|
||||
defaultsColor.put(ColorParam.sequenceGroupBackground, HtmlColor.getColorIfValid("#EEEEEE"));
|
||||
defaultsColor.put(ColorParam.sequenceDividerBackground, HtmlColor.getColorIfValid("#EEEEEE"));
|
||||
defaultsColor.put(ColorParam.sequenceEngloberLine, HtmlColor.getColorIfValid("#A80036"));
|
||||
defaultsColor.put(ColorParam.sequenceEngloberBackground, HtmlColor.getColorIfValid("#DDDDDD"));
|
||||
|
||||
defaultsColor.put(ColorParam.noteBackground, new HtmlColor("#FBFB77"));
|
||||
defaultsColor.put(ColorParam.noteBorder, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.noteBackground, HtmlColor.getColorIfValid("#FBFB77"));
|
||||
defaultsColor.put(ColorParam.noteBorder, HtmlColor.getColorIfValid("#A80036"));
|
||||
|
||||
defaultsColor.put(ColorParam.activityBackground, new HtmlColor("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.activityBorder, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.activityStart, new HtmlColor("black"));
|
||||
defaultsColor.put(ColorParam.activityEnd, new HtmlColor("black"));
|
||||
defaultsColor.put(ColorParam.activityBar, new HtmlColor("black"));
|
||||
defaultsColor.put(ColorParam.activityBackground, HtmlColor.getColorIfValid("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.activityBorder, HtmlColor.getColorIfValid("#A80036"));
|
||||
defaultsColor.put(ColorParam.activityStart, HtmlColor.getColorIfValid("black"));
|
||||
defaultsColor.put(ColorParam.activityEnd, HtmlColor.getColorIfValid("black"));
|
||||
defaultsColor.put(ColorParam.activityBar, HtmlColor.getColorIfValid("black"));
|
||||
|
||||
defaultsColor.put(ColorParam.stateBackground, new HtmlColor("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.stateBorder, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.stateStart, new HtmlColor("black"));
|
||||
defaultsColor.put(ColorParam.stateEnd, new HtmlColor("black"));
|
||||
defaultsColor.put(ColorParam.stateBackground, HtmlColor.getColorIfValid("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.stateBorder, HtmlColor.getColorIfValid("#A80036"));
|
||||
defaultsColor.put(ColorParam.stateStart, HtmlColor.getColorIfValid("black"));
|
||||
defaultsColor.put(ColorParam.stateEnd, HtmlColor.getColorIfValid("black"));
|
||||
|
||||
defaultsColor.put(ColorParam.usecaseBackground, new HtmlColor("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.usecaseBorder, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.componentBackground, new HtmlColor("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.componentBorder, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.componentInterfaceBackground, new HtmlColor("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.componentInterfaceBorder, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.usecaseActorBackground, new HtmlColor("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.usecaseActorBorder, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.usecaseBackground, HtmlColor.getColorIfValid("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.usecaseBorder, HtmlColor.getColorIfValid("#A80036"));
|
||||
defaultsColor.put(ColorParam.componentBackground, HtmlColor.getColorIfValid("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.componentBorder, HtmlColor.getColorIfValid("#A80036"));
|
||||
defaultsColor.put(ColorParam.componentInterfaceBackground, HtmlColor.getColorIfValid("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.componentInterfaceBorder, HtmlColor.getColorIfValid("#A80036"));
|
||||
defaultsColor.put(ColorParam.usecaseActorBackground, HtmlColor.getColorIfValid("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.usecaseActorBorder, HtmlColor.getColorIfValid("#A80036"));
|
||||
|
||||
defaultsColor.put(ColorParam.sequenceActorBackground, new HtmlColor("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.sequenceActorBorder, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.sequenceParticipantBackground, new HtmlColor("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.sequenceParticipantBorder, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.classBackground, new HtmlColor("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.classBorder, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.sequenceActorBackground, HtmlColor.getColorIfValid("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.sequenceActorBorder, HtmlColor.getColorIfValid("#A80036"));
|
||||
defaultsColor.put(ColorParam.sequenceParticipantBackground, HtmlColor.getColorIfValid("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.sequenceParticipantBorder, HtmlColor.getColorIfValid("#A80036"));
|
||||
defaultsColor.put(ColorParam.classBackground, HtmlColor.getColorIfValid("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.classBorder, HtmlColor.getColorIfValid("#A80036"));
|
||||
|
||||
defaultsColor.put(ColorParam.objectBackground, new HtmlColor("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.objectBorder, new HtmlColor("#A80036"));
|
||||
defaultsColor.put(ColorParam.objectBackground, HtmlColor.getColorIfValid("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.objectBorder, HtmlColor.getColorIfValid("#A80036"));
|
||||
|
||||
defaultsColor.put(ColorParam.stereotypeCBackground, new HtmlColor("#ADD1B2"));
|
||||
defaultsColor.put(ColorParam.stereotypeABackground, new HtmlColor("#A9DCDF"));
|
||||
defaultsColor.put(ColorParam.stereotypeIBackground, new HtmlColor("#B4A7E5"));
|
||||
defaultsColor.put(ColorParam.stereotypeEBackground, new HtmlColor("#EB937F"));
|
||||
defaultsColor.put(ColorParam.stereotypeCBackground, HtmlColor.getColorIfValid("#ADD1B2"));
|
||||
defaultsColor.put(ColorParam.stereotypeABackground, HtmlColor.getColorIfValid("#A9DCDF"));
|
||||
defaultsColor.put(ColorParam.stereotypeIBackground, HtmlColor.getColorIfValid("#B4A7E5"));
|
||||
defaultsColor.put(ColorParam.stereotypeEBackground, HtmlColor.getColorIfValid("#EB937F"));
|
||||
|
||||
defaultsColor.put(ColorParam.packageBackground, new HtmlColor("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.packageBorder, new HtmlColor("black"));
|
||||
defaultsColor.put(ColorParam.packageBackground, HtmlColor.getColorIfValid("#FEFECE"));
|
||||
defaultsColor.put(ColorParam.packageBorder, HtmlColor.getColorIfValid("black"));
|
||||
|
||||
defaultsColor.put(ColorParam.iconPrivate, new HtmlColor("#C82930"));
|
||||
defaultsColor.put(ColorParam.iconPrivateBackground, new HtmlColor("#F24D5C"));
|
||||
defaultsColor.put(ColorParam.iconProtected, new HtmlColor("#B38D22"));
|
||||
defaultsColor.put(ColorParam.iconProtectedBackground, new HtmlColor("#FFFF44"));
|
||||
defaultsColor.put(ColorParam.iconPackage, new HtmlColor("#1963A0"));
|
||||
defaultsColor.put(ColorParam.iconPackageBackground, new HtmlColor("#4177AF"));
|
||||
defaultsColor.put(ColorParam.iconPublic, new HtmlColor("#038048"));
|
||||
defaultsColor.put(ColorParam.iconPublicBackground, new HtmlColor("#84BE84"));
|
||||
defaultsColor.put(ColorParam.iconPrivate, HtmlColor.getColorIfValid("#C82930"));
|
||||
defaultsColor.put(ColorParam.iconPrivateBackground, HtmlColor.getColorIfValid("#F24D5C"));
|
||||
defaultsColor.put(ColorParam.iconProtected, HtmlColor.getColorIfValid("#B38D22"));
|
||||
defaultsColor.put(ColorParam.iconProtectedBackground, HtmlColor.getColorIfValid("#FFFF44"));
|
||||
defaultsColor.put(ColorParam.iconPackage, HtmlColor.getColorIfValid("#1963A0"));
|
||||
defaultsColor.put(ColorParam.iconPackageBackground, HtmlColor.getColorIfValid("#4177AF"));
|
||||
defaultsColor.put(ColorParam.iconPublic, HtmlColor.getColorIfValid("#038048"));
|
||||
defaultsColor.put(ColorParam.iconPublicBackground, HtmlColor.getColorIfValid("#84BE84"));
|
||||
}
|
||||
|
||||
public Color getFontColor(ISkinParam skin, FontParam fontParam) {
|
||||
@ -178,7 +178,11 @@ public class Rose implements Skin {
|
||||
}
|
||||
if (type == ComponentType.PARTICIPANT_LINE) {
|
||||
final Color borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder).getColor();
|
||||
return new ComponentRoseLine(borderColor);
|
||||
return new ComponentRoseLine(borderColor, false);
|
||||
}
|
||||
if (type == ComponentType.CONTINUE_LINE) {
|
||||
final Color borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder).getColor();
|
||||
return new ComponentRoseLine(borderColor, true);
|
||||
}
|
||||
if (type == ComponentType.ACTOR_HEAD) {
|
||||
final Color borderColor = getHtmlColor(param, ColorParam.sequenceActorBorder).getColor();
|
||||
@ -190,10 +194,6 @@ public class Rose implements Skin {
|
||||
return new ComponentRoseActor(sequenceActorBackground, borderColor, getFontColor(param,
|
||||
FontParam.SEQUENCE_ACTOR), fontActor, stringsToDisplay, false);
|
||||
}
|
||||
if (type == ComponentType.ACTOR_LINE) {
|
||||
final Color borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder).getColor();
|
||||
return new ComponentRoseLine(borderColor);
|
||||
}
|
||||
if (type == ComponentType.NOTE) {
|
||||
final Color noteBackgroundColor = getHtmlColor(param, ColorParam.noteBackground).getColor();
|
||||
final Color borderColor = getHtmlColor(param, ColorParam.noteBorder).getColor();
|
||||
@ -221,8 +221,8 @@ public class Rose implements Skin {
|
||||
return new ComponentRoseActiveLine(borderColor, lifeLineBackgroundColor);
|
||||
}
|
||||
if (type == ComponentType.DELAY_LINE) {
|
||||
// final Color borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder).getColor();
|
||||
final Color borderColor = getFontColor(param, FontParam.SEQUENCE_DELAY);
|
||||
final Color borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder).getColor();
|
||||
// final Color borderColor = getFontColor(param, FontParam.SEQUENCE_DELAY);
|
||||
return new ComponentRoseDelayLine(borderColor);
|
||||
}
|
||||
if (type == ComponentType.DELAY_TEXT) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5742 $
|
||||
* Revision $Revision: 5983 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.statediagram.command;
|
||||
@ -63,7 +63,7 @@ public class CommandCreatePackageState extends SingleLineCommand<StateDiagram> {
|
||||
p.setStereotype(stereotype);
|
||||
}
|
||||
if (arg.get(3) != null && HtmlColor.isValid(arg.get(3))) {
|
||||
p.setBackColor(new HtmlColor(arg.get(3)));
|
||||
p.setBackColor(HtmlColor.getColorIfValid(arg.get(3)));
|
||||
}
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class CommandCreatePackageState2 extends SingleLineCommand<StateDiagram>
|
||||
p.setStereotype(stereotype);
|
||||
}
|
||||
if (arg.get(3) != null && HtmlColor.isValid(arg.get(3))) {
|
||||
p.setBackColor(new HtmlColor(arg.get(3)));
|
||||
p.setBackColor(HtmlColor.getColorIfValid(arg.get(3)));
|
||||
}
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 5872 $
|
||||
* Revision $Revision: 6009 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.sudoku;
|
||||
@ -44,6 +44,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.EmptyImageBuilder;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
@ -90,8 +91,8 @@ public class GraphicsSudoku {
|
||||
for (int y = 0; y < 9; y++) {
|
||||
final int num = sudoku.getGiven(x, y);
|
||||
if (num > 0) {
|
||||
final TextBlock text = TextBlockUtils.create(Arrays.asList("" + num), numberFont, Color.BLACK,
|
||||
HorizontalAlignement.CENTER);
|
||||
final TextBlock text = TextBlockUtils.create(Arrays.asList("" + num), new FontConfiguration(
|
||||
numberFont, Color.BLACK), HorizontalAlignement.CENTER);
|
||||
text.drawTOBEREMOVED(g2d, numberxOffset + x * cellWidth, numberyOffset + y * cellHeight);
|
||||
}
|
||||
}
|
||||
@ -113,7 +114,8 @@ public class GraphicsSudoku {
|
||||
texts.add("http://plantuml.sourceforge.net");
|
||||
texts.add("Seed " + Long.toString(sudoku.getSeed(), 36));
|
||||
texts.add("Difficulty " + sudoku.getRatting());
|
||||
final TextBlock textBlock = TextBlockUtils.create(texts, font, Color.BLACK, HorizontalAlignement.LEFT);
|
||||
final TextBlock textBlock = TextBlockUtils.create(texts, new FontConfiguration(font, Color.BLACK),
|
||||
HorizontalAlignement.LEFT);
|
||||
textBlock.drawTOBEREMOVED(g2d, 0, 0);
|
||||
|
||||
g2d.dispose();
|
||||
|
@ -36,6 +36,7 @@ package net.sourceforge.plantuml.suggest;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@ -49,13 +50,13 @@ import net.sourceforge.plantuml.command.ProtectedCommand;
|
||||
|
||||
final public class SuggestEngine {
|
||||
|
||||
// private final UmlSource source;
|
||||
private final PSystemCommandFactory systemFactory;
|
||||
private final Iterator<String> it;
|
||||
private int nb = 0;
|
||||
// private int nb = 0;
|
||||
private String current = "";
|
||||
private String previous = "";
|
||||
|
||||
public SuggestEngine(UmlSource source, PSystemCommandFactory systemFactory) {
|
||||
// this.source = source;
|
||||
this.systemFactory = systemFactory;
|
||||
this.it = source.iterator();
|
||||
if (BlockUmlBuilder.isArobaseStartuml(next()) == false) {
|
||||
@ -68,8 +69,10 @@ final public class SuggestEngine {
|
||||
}
|
||||
|
||||
private String next() {
|
||||
nb++;
|
||||
return it.next();
|
||||
// nb++;
|
||||
this.previous = this.current;
|
||||
this.current = it.next();
|
||||
return current;
|
||||
}
|
||||
|
||||
public SuggestEngineResult tryToSuggest() throws IOException {
|
||||
@ -129,31 +132,46 @@ final public class SuggestEngine {
|
||||
|
||||
}
|
||||
|
||||
SuggestEngineResult checkAndCorrect(String incorrectLine) {
|
||||
CommandControl commandControl = systemFactory.isValid(Arrays.asList(incorrectLine));
|
||||
SuggestEngineResult checkAndCorrect(final String incorrectLine) {
|
||||
final CommandControl commandControl = systemFactory.isValid(Arrays.asList(incorrectLine));
|
||||
if (commandControl != CommandControl.NOT_OK) {
|
||||
return SuggestEngineResult.SYNTAX_OK;
|
||||
}
|
||||
|
||||
// Remove one
|
||||
for (int i = 0; i < incorrectLine.length(); i++) {
|
||||
final String newS = incorrectLine.substring(0, i) + incorrectLine.substring(i + 1);
|
||||
commandControl = systemFactory.isValid(Arrays.asList(newS));
|
||||
if (commandControl != CommandControl.NOT_OK) {
|
||||
return new SuggestEngineResult(newS, nb);
|
||||
}
|
||||
if (incorrectLine.trim().startsWith("{")
|
||||
&& systemFactory.isValid(Arrays.asList(previous + " {")) != CommandControl.NOT_OK) {
|
||||
return new SuggestEngineResult(previous + " {");
|
||||
}
|
||||
|
||||
// Inverse
|
||||
for (int i = 0; i < incorrectLine.length() - 1; i++) {
|
||||
final String newS = incorrectLine.substring(0, i) + incorrectLine.charAt(i + 1) + incorrectLine.charAt(i)
|
||||
+ incorrectLine.substring(i + 2);
|
||||
commandControl = systemFactory.isValid(Arrays.asList(newS));
|
||||
if (commandControl != CommandControl.NOT_OK) {
|
||||
return new SuggestEngineResult(newS, nb);
|
||||
final Collection<Iterator<String>> all = new ArrayList<Iterator<String>>();
|
||||
all.add(new VariatorRemoveOneChar(incorrectLine));
|
||||
all.add(new VariatorSwapLetter(incorrectLine));
|
||||
// all.add(new VariatorAddOneCharBetweenWords(incorrectLine, ':'));
|
||||
all.add(new VariatorAddOneCharBetweenWords(incorrectLine, '-'));
|
||||
all.add(new VariatorAddOneCharBetweenWords(incorrectLine, ' '));
|
||||
// all.add(new VariatorAddTwoChar(incorrectLine, '\"'));
|
||||
|
||||
for (Iterator<String> it : all) {
|
||||
final SuggestEngineResult result = tryThis(it);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return SuggestEngineResult.CANNOT_CORRECT;
|
||||
}
|
||||
|
||||
private SuggestEngineResult tryThis(Iterator<String> it) {
|
||||
while (it.hasNext()) {
|
||||
final String newS = it.next();
|
||||
if (newS.trim().length() == 0) {
|
||||
continue;
|
||||
}
|
||||
final CommandControl commandControl = systemFactory.isValid(Arrays.asList(newS));
|
||||
if (commandControl != CommandControl.NOT_OK) {
|
||||
return new SuggestEngineResult(newS);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -33,11 +33,11 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.suggest;
|
||||
|
||||
|
||||
public class SuggestEngineResult {
|
||||
|
||||
private final SuggestEngineStatus status;
|
||||
private final String suggestedLine;
|
||||
private final int numLine;
|
||||
|
||||
public static final SuggestEngineResult CANNOT_CORRECT = new SuggestEngineResult(SuggestEngineStatus.CANNOT_CORRECT);
|
||||
public static final SuggestEngineResult SYNTAX_OK = new SuggestEngineResult(SuggestEngineStatus.SYNTAX_OK);
|
||||
@ -48,13 +48,40 @@ public class SuggestEngineResult {
|
||||
}
|
||||
this.status = status;
|
||||
this.suggestedLine = null;
|
||||
this.numLine = -1;
|
||||
}
|
||||
|
||||
public SuggestEngineResult(String suggestedLine, int numLine) {
|
||||
@Override
|
||||
public String toString() {
|
||||
return status + " " + suggestedLine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return status.hashCode() + (suggestedLine == null ? 0 : suggestedLine.hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
final SuggestEngineResult this2 = (SuggestEngineResult) obj;
|
||||
return status.equals(this2.status) && sameString(suggestedLine, this2.suggestedLine);
|
||||
}
|
||||
|
||||
private static boolean sameString(String a, String b) {
|
||||
if (a == null && b == null) {
|
||||
return true;
|
||||
}
|
||||
if (a != null || b != null) {
|
||||
return false;
|
||||
}
|
||||
return a.equals(b);
|
||||
}
|
||||
|
||||
public SuggestEngineResult(String suggestedLine) {
|
||||
if (suggestedLine.trim().length() == 0) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.status = SuggestEngineStatus.ONE_SUGGESTION;
|
||||
this.suggestedLine = suggestedLine;
|
||||
this.numLine = numLine;
|
||||
}
|
||||
|
||||
public final SuggestEngineStatus getStatus() {
|
||||
@ -65,8 +92,4 @@ public class SuggestEngineResult {
|
||||
return suggestedLine;
|
||||
}
|
||||
|
||||
public final int getNumLine() {
|
||||
return numLine;
|
||||
}
|
||||
|
||||
}
|
||||
|
41
src/net/sourceforge/plantuml/suggest/Variator.java
Normal file
41
src/net/sourceforge/plantuml/suggest/Variator.java
Normal file
@ -0,0 +1,41 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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: 4975 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.suggest;
|
||||
|
||||
public interface Variator {
|
||||
|
||||
String getData();
|
||||
void nextStep();
|
||||
|
||||
}
|
62
src/net/sourceforge/plantuml/suggest/VariatorAddOneChar.java
Normal file
62
src/net/sourceforge/plantuml/suggest/VariatorAddOneChar.java
Normal file
@ -0,0 +1,62 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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: 4975 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.suggest;
|
||||
|
||||
public class VariatorAddOneChar extends VariatorIteratorAdaptor {
|
||||
|
||||
private final String data;
|
||||
private final char toAdd;
|
||||
private int i;
|
||||
|
||||
public VariatorAddOneChar(String data, char toAdd) {
|
||||
this.data = data;
|
||||
this.toAdd = toAdd;
|
||||
}
|
||||
|
||||
@Override
|
||||
Variator getVariator() {
|
||||
return new Variator() {
|
||||
public String getData() {
|
||||
if (i > data.length()) {
|
||||
return null;
|
||||
}
|
||||
return data.substring(0, i) + toAdd + data.substring(i);
|
||||
}
|
||||
|
||||
public void nextStep() {
|
||||
i++;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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: 4975 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.suggest;
|
||||
|
||||
public class VariatorAddOneCharBetweenWords extends VariatorIteratorAdaptor {
|
||||
|
||||
private final String data;
|
||||
private final char toAdd;
|
||||
private int i;
|
||||
|
||||
public VariatorAddOneCharBetweenWords(String data, char toAdd) {
|
||||
this.data = data;
|
||||
this.toAdd = toAdd;
|
||||
i++;
|
||||
ensureBetweenWords();
|
||||
}
|
||||
|
||||
private void ensureBetweenWords() {
|
||||
while (i < data.length() && inWord()) {
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean inWord() {
|
||||
return Character.isLetterOrDigit(data.charAt(i - 1)) && Character.isLetterOrDigit(data.charAt(i));
|
||||
}
|
||||
|
||||
@Override
|
||||
Variator getVariator() {
|
||||
return new Variator() {
|
||||
public String getData() {
|
||||
if (i > data.length() - 1) {
|
||||
return null;
|
||||
}
|
||||
return data.substring(0, i) + toAdd + data.substring(i);
|
||||
}
|
||||
|
||||
public void nextStep() {
|
||||
i++;
|
||||
ensureBetweenWords();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
67
src/net/sourceforge/plantuml/suggest/VariatorAddTwoChar.java
Normal file
67
src/net/sourceforge/plantuml/suggest/VariatorAddTwoChar.java
Normal file
@ -0,0 +1,67 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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: 4975 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.suggest;
|
||||
|
||||
public class VariatorAddTwoChar extends VariatorIteratorAdaptor {
|
||||
|
||||
private final String data;
|
||||
private final char toAdd;
|
||||
private int i;
|
||||
private int j = 1;
|
||||
|
||||
public VariatorAddTwoChar(String data, char toAdd) {
|
||||
this.data = data;
|
||||
this.toAdd = toAdd;
|
||||
}
|
||||
|
||||
@Override
|
||||
Variator getVariator() {
|
||||
return new Variator() {
|
||||
public String getData() {
|
||||
if (i >= data.length()) {
|
||||
return null;
|
||||
}
|
||||
return data.substring(0, i) + toAdd + data.substring(i, j) + toAdd + data.substring(j);
|
||||
}
|
||||
|
||||
public void nextStep() {
|
||||
j++;
|
||||
if (j > data.length()) {
|
||||
i++;
|
||||
j = i + 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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: 4975 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.suggest;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
public abstract class VariatorIteratorAdaptor implements Iterator<String> {
|
||||
|
||||
private final Variator variator;
|
||||
|
||||
abstract Variator getVariator();
|
||||
|
||||
public VariatorIteratorAdaptor() {
|
||||
this.variator = getVariator();
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
return variator.getData() != null;
|
||||
}
|
||||
|
||||
public String next() {
|
||||
final String result = variator.getData();
|
||||
if (result == null) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
this.variator.nextStep();
|
||||
return result;
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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: 4975 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.suggest;
|
||||
|
||||
public class VariatorRemoveOneChar extends VariatorIteratorAdaptor {
|
||||
|
||||
private final String data;
|
||||
private int i;
|
||||
|
||||
public VariatorRemoveOneChar(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
Variator getVariator() {
|
||||
return new Variator() {
|
||||
public String getData() {
|
||||
if (i >= data.length()) {
|
||||
return null;
|
||||
}
|
||||
return data.substring(0, i) + data.substring(i + 1);
|
||||
}
|
||||
|
||||
public void nextStep() {
|
||||
i++;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
60
src/net/sourceforge/plantuml/suggest/VariatorSwapChar.java
Normal file
60
src/net/sourceforge/plantuml/suggest/VariatorSwapChar.java
Normal file
@ -0,0 +1,60 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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: 4975 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.suggest;
|
||||
|
||||
public class VariatorSwapChar extends VariatorIteratorAdaptor {
|
||||
|
||||
private final String data;
|
||||
private int i;
|
||||
|
||||
public VariatorSwapChar(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
Variator getVariator() {
|
||||
return new Variator() {
|
||||
public String getData() {
|
||||
if (i >= data.length() - 1) {
|
||||
return null;
|
||||
}
|
||||
return data.substring(0, i) + data.charAt(i + 1) + data.charAt(i) + data.substring(i + 2);
|
||||
}
|
||||
|
||||
public void nextStep() {
|
||||
i++;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
74
src/net/sourceforge/plantuml/suggest/VariatorSwapLetter.java
Normal file
74
src/net/sourceforge/plantuml/suggest/VariatorSwapLetter.java
Normal file
@ -0,0 +1,74 @@
|
||||
/* ========================================================================
|
||||
* PlantUML : a free UML diagram generator
|
||||
* ========================================================================
|
||||
*
|
||||
* (C) Copyright 2009, Arnaud Roques
|
||||
*
|
||||
* Project Info: http://plantuml.sourceforge.net
|
||||
*
|
||||
* This file is part of PlantUML.
|
||||
*
|
||||
* PlantUML is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* PlantUML distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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: 4975 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.suggest;
|
||||
|
||||
public class VariatorSwapLetter extends VariatorIteratorAdaptor {
|
||||
|
||||
private final String data;
|
||||
private int i;
|
||||
|
||||
public VariatorSwapLetter(String data) {
|
||||
this.data = data;
|
||||
ensureTwoLetters();
|
||||
}
|
||||
|
||||
private void ensureTwoLetters() {
|
||||
while (i < data.length() - 1 && areTwoLetters() == false) {
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean areTwoLetters() {
|
||||
return Character.isLetter(data.charAt(i)) && Character.isLetter(data.charAt(i + 1));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
Variator getVariator() {
|
||||
return new Variator() {
|
||||
public String getData() {
|
||||
if (i >= data.length() - 1) {
|
||||
return null;
|
||||
}
|
||||
return data.substring(0, i) + data.charAt(i + 1) + data.charAt(i) + data.substring(i + 2);
|
||||
}
|
||||
|
||||
public void nextStep() {
|
||||
i++;
|
||||
ensureTwoLetters();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -42,6 +42,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.sourceforge.plantuml.cucadiagram.dot.CucaDiagramFileMaker;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||
import net.sourceforge.plantuml.graphic.TextBlockUtils;
|
||||
@ -72,7 +73,8 @@ public final class SvgTitler {
|
||||
textBloc = null;
|
||||
} else {
|
||||
final Font normalFont = new Font(fontFamily, Font.PLAIN, fontSize);
|
||||
textBloc = TextBlockUtils.create(text, normalFont, textColor, HorizontalAlignement.LEFT);
|
||||
textBloc = TextBlockUtils.create(text, new FontConfiguration(normalFont, textColor),
|
||||
HorizontalAlignement.LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
* Original Author: Arnaud Roques
|
||||
*
|
||||
* Revision $Revision: 4129 $
|
||||
* Revision $Revision: 5988 $
|
||||
*
|
||||
*/
|
||||
package net.sourceforge.plantuml.ugraphic;
|
||||
@ -44,9 +44,11 @@ public interface UGraphic {
|
||||
public UParam getParam();
|
||||
|
||||
public void draw(double x, double y, UShape shape);
|
||||
|
||||
public void centerChar(double x, double y, char c, Font font);
|
||||
|
||||
public void translate(double dx, double dy);
|
||||
|
||||
public void setTranslate(double dx, double dy);
|
||||
|
||||
public double getTranslateX();
|
||||
@ -55,4 +57,6 @@ public interface UGraphic {
|
||||
|
||||
public void setClip(UClip clip);
|
||||
|
||||
public void setAntiAliasing(boolean trueForOn);
|
||||
|
||||
}
|
||||
|
@ -77,6 +77,10 @@ public abstract class UGraphicUtils {
|
||||
public void translate(double dx, double dy) {
|
||||
g.translate(dx, dy);
|
||||
}
|
||||
|
||||
public void setAntiAliasing(boolean trueForOn) {
|
||||
g.setAntiAliasing(trueForOn);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -127,4 +127,7 @@ public class UGraphicEps extends AbstractUGraphic<EpsGraphics> implements ClipCo
|
||||
pw.close();
|
||||
}
|
||||
|
||||
public void setAntiAliasing(boolean trueForOn) {
|
||||
}
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user