1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-01 09:14:01 +00:00

Version 7988

This commit is contained in:
Arnaud 2013-12-10 20:36:50 +01:00
parent 82d650bdf6
commit cace20326f
1515 changed files with 74145 additions and 26778 deletions

View File

@ -3,10 +3,6 @@ package com.ctreber.acearth.plugins.markers;
import java.awt.Color; import java.awt.Color;
import java.awt.Font; import java.awt.Font;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.ctreber.acearth.gui.PixelCanvas; import com.ctreber.acearth.gui.PixelCanvas;

View File

@ -1,10 +1,8 @@
package com.ctreber.acearth.plugins.markers; package com.ctreber.acearth.plugins.markers;
import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import com.ctreber.acearth.ACearth;
import com.ctreber.acearth.plugins.Plugin; import com.ctreber.acearth.plugins.Plugin;
/** /**

View File

@ -1,6 +1,9 @@
package com.ctreber.acearth.projection; package com.ctreber.acearth.projection;
import com.ctreber.acearth.util.*; import com.ctreber.acearth.util.Coordinate;
import com.ctreber.acearth.util.Point2D;
import com.ctreber.acearth.util.Point3D;
import com.ctreber.acearth.util.Toolkit;
/** /**
* <p>A projection for a globe on a flat surface (must be subclassed). * <p>A projection for a globe on a flat surface (must be subclassed).

View File

@ -1,7 +1,8 @@
package com.ctreber.acearth.renderer; package com.ctreber.acearth.renderer;
import java.awt.*; import java.awt.Color;
import java.util.*; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import com.ctreber.acearth.shader.Shader; import com.ctreber.acearth.shader.Shader;

View File

@ -1,7 +1,7 @@
package com.ctreber.acearth.renderer; package com.ctreber.acearth.renderer;
import com.ctreber.acearth.scanbit.ScanBit;
import com.ctreber.acearth.scanbit.BitGeneratorMap; import com.ctreber.acearth.scanbit.BitGeneratorMap;
import com.ctreber.acearth.scanbit.ScanBit;
/** /**
* <p>Renders a row of ScanBits to pixel types.</p> * <p>Renders a row of ScanBits to pixel types.</p>

View File

@ -1,9 +1,14 @@
package com.ctreber.acearth.scanbit; package com.ctreber.acearth.scanbit;
import java.util.*; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import com.ctreber.acearth.projection.Projection; import com.ctreber.acearth.projection.Projection;
import com.ctreber.acearth.util.*; import com.ctreber.acearth.util.EdgeCrossing;
import com.ctreber.acearth.util.Point2D;
import com.ctreber.acearth.util.Point3D;
import com.ctreber.acearth.util.Polygon;
import com.ctreber.aclib.sort.CTSort; import com.ctreber.aclib.sort.CTSort;
import com.ctreber.aclib.sort.QuickSort; import com.ctreber.aclib.sort.QuickSort;

View File

@ -3,7 +3,9 @@ package com.ctreber.acearth.scanbit;
import java.util.Comparator; import java.util.Comparator;
import com.ctreber.acearth.projection.Projection; import com.ctreber.acearth.projection.Projection;
import com.ctreber.acearth.util.*; import com.ctreber.acearth.util.EdgeCrossing;
import com.ctreber.acearth.util.Point2D;
import com.ctreber.acearth.util.Point3D;
/** /**
* <p>Map scanner for mercator and cylindrical projections. * <p>Map scanner for mercator and cylindrical projections.

View File

@ -3,7 +3,9 @@ package com.ctreber.acearth.scanbit;
import java.util.Comparator; import java.util.Comparator;
import com.ctreber.acearth.projection.Projection; import com.ctreber.acearth.projection.Projection;
import com.ctreber.acearth.util.*; import com.ctreber.acearth.util.EdgeCrossing;
import com.ctreber.acearth.util.Point2D;
import com.ctreber.acearth.util.Point3D;
/** /**
* <p>Map scanner for orthographic projection. * <p>Map scanner for orthographic projection.

View File

@ -1,7 +1,9 @@
package com.ctreber.acearth.scandot; package com.ctreber.acearth.scandot;
import com.ctreber.acearth.projection.Projection; import com.ctreber.acearth.projection.Projection;
import com.ctreber.acearth.util.*; import com.ctreber.acearth.util.Coordinate;
import com.ctreber.acearth.util.Point2D;
import com.ctreber.acearth.util.Point3D;
/** /**
* <p>Generate latitude and longitude grid as dots. * <p>Generate latitude and longitude grid as dots.

View File

@ -1,6 +1,6 @@
package com.ctreber.acearth.shader; package com.ctreber.acearth.shader;
import java.awt.*; import java.awt.Color;
import com.ctreber.acearth.projection.Projection; import com.ctreber.acearth.projection.Projection;
import com.ctreber.acearth.scanbit.BitGeneratorMap; import com.ctreber.acearth.scanbit.BitGeneratorMap;

View File

@ -1,6 +1,6 @@
package com.ctreber.acearth.shader; package com.ctreber.acearth.shader;
import java.awt.*; import java.awt.Color;
/** /**
* <p>Shader for projections which display the whole surface.</p> * <p>Shader for projections which display the whole surface.</p>

View File

@ -1,6 +1,6 @@
package com.ctreber.acearth.shader; package com.ctreber.acearth.shader;
import java.awt.*; import java.awt.Color;
/** /**
* <p>Flat shader (does not care for Projection).</p> * <p>Flat shader (does not care for Projection).</p>

View File

@ -1,6 +1,6 @@
package com.ctreber.acearth.shader; package com.ctreber.acearth.shader;
import java.awt.*; import java.awt.Color;
/** /**
* <p>Shader for the orthographic projection.</p> * <p>Shader for the orthographic projection.</p>

View File

@ -1,6 +1,8 @@
package com.ctreber.acearth.util; package com.ctreber.acearth.util;
import java.util.*; import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
/** /**
* <p>Calculates the position of the point on Earth which is directly * <p>Calculates the position of the point on Earth which is directly

40
src/doc-files/umls.html Normal file
View File

@ -0,0 +1,40 @@
<!--
========================================================================
PlantUML : a free UML diagram generator
========================================================================
(C) Copyright 2009-2013, Arnaud Roques
Project Info: http://plantuml.sourceforge.net
This file is part of PlantUML.
PlantUML is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PlantUML distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
[Java is a trademark or registered trademark of Sun Microsystems, Inc.
in the United States and other countries.]
Original Author: Arnaud Roques
-->
@startuml img1.png
title foo2
component PlantUML
@enduml
</body>

View File

@ -18,8 +18,8 @@
*/ */
package jcckit.data; package jcckit.data;
import java.text.*; import java.text.MessageFormat;
import java.util.*; import java.util.Vector;
/** /**
* Abstract superclass of all data containers. A data container holds an * Abstract superclass of all data containers. A data container holds an

View File

@ -18,10 +18,10 @@
*/ */
package jcckit.data; package jcckit.data;
import jcckit.util.ConfigParameters;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import jcckit.util.ConfigParameters;
/** /**
* A plot is a {@link DataContainer} of {@link DataCurve DataCurves}. * A plot is a {@link DataContainer} of {@link DataCurve DataCurves}.
* *

View File

@ -18,10 +18,10 @@
*/ */
package jcckit.graphic; package jcckit.graphic;
import jcckit.util.ConfigParameters;
import java.awt.Color; import java.awt.Color;
import jcckit.util.ConfigParameters;
/** /**
* The basic attributes of any {@link BasicGraphicalElement}. This is an * The basic attributes of any {@link BasicGraphicalElement}. This is an
* extension of {@link ShapeAttributes} implementing {@link TextAttributes}. * extension of {@link ShapeAttributes} implementing {@link TextAttributes}.

View File

@ -18,11 +18,11 @@
*/ */
package jcckit.graphic; package jcckit.graphic;
import java.util.Hashtable;
import jcckit.util.ConfigParameters; import jcckit.util.ConfigParameters;
import jcckit.util.FactoryException; import jcckit.util.FactoryException;
import java.util.Hashtable;
/** /**
* Font style constants. * Font style constants.
* This class is based on the typesafe enumeration pattern. * This class is based on the typesafe enumeration pattern.

View File

@ -18,10 +18,10 @@
*/ */
package jcckit.graphic; package jcckit.graphic;
import jcckit.util.ConfigParameters;
import java.awt.Color; import java.awt.Color;
import jcckit.util.ConfigParameters;
/** /**
* Basic attributes for shapes. * Basic attributes for shapes.
* *

View File

@ -18,6 +18,7 @@
*/ */
package jcckit.plot; package jcckit.plot;
import jcckit.graphic.ClippingShape;
import jcckit.graphic.GraphPoint; import jcckit.graphic.GraphPoint;
import jcckit.graphic.GraphicAttributes; import jcckit.graphic.GraphicAttributes;
import jcckit.graphic.GraphicalElement; import jcckit.graphic.GraphicalElement;

View File

@ -21,10 +21,10 @@ package jcckit.plot;
import jcckit.data.DataPoint; import jcckit.data.DataPoint;
import jcckit.graphic.ClippingRectangle; import jcckit.graphic.ClippingRectangle;
import jcckit.graphic.ClippingShape; import jcckit.graphic.ClippingShape;
import jcckit.graphic.GraphPoint;
import jcckit.graphic.GraphicAttributes;
import jcckit.graphic.GraphicalComposite; import jcckit.graphic.GraphicalComposite;
import jcckit.graphic.GraphicalElement; import jcckit.graphic.GraphicalElement;
import jcckit.graphic.GraphicAttributes;
import jcckit.graphic.GraphPoint;
import jcckit.graphic.LineAttributes; import jcckit.graphic.LineAttributes;
import jcckit.graphic.Polygon; import jcckit.graphic.Polygon;
import jcckit.graphic.Text; import jcckit.graphic.Text;

View File

@ -18,9 +18,9 @@
*/ */
package jcckit.plot; package jcckit.plot;
import jcckit.graphic.GraphPoint;
import jcckit.graphic.GraphicAttributes; import jcckit.graphic.GraphicAttributes;
import jcckit.graphic.GraphicalElement; import jcckit.graphic.GraphicalElement;
import jcckit.graphic.GraphPoint;
import jcckit.graphic.Oval; import jcckit.graphic.Oval;
import jcckit.util.ConfigParameters; import jcckit.util.ConfigParameters;

View File

@ -18,8 +18,8 @@
*/ */
package jcckit.plot; package jcckit.plot;
import jcckit.graphic.GraphicalElement;
import jcckit.graphic.ClippingShape; import jcckit.graphic.ClippingShape;
import jcckit.graphic.GraphicalElement;
import jcckit.transformation.Transformation; import jcckit.transformation.Transformation;
/** /**

View File

@ -18,8 +18,8 @@
*/ */
package jcckit.plot; package jcckit.plot;
import jcckit.graphic.GraphicalElement;
import jcckit.graphic.GraphPoint; import jcckit.graphic.GraphPoint;
import jcckit.graphic.GraphicalElement;
/** /**
* A curve is defined by a sequence of points in device-independent * A curve is defined by a sequence of points in device-independent

View File

@ -18,11 +18,13 @@
*/ */
package jcckit.plot; package jcckit.plot;
import java.util.Properties;
import jcckit.graphic.BasicGraphicAttributes; import jcckit.graphic.BasicGraphicAttributes;
import jcckit.graphic.GraphicalElement;
import jcckit.graphic.GraphicalComposite;
import jcckit.graphic.GraphicAttributes;
import jcckit.graphic.GraphPoint; import jcckit.graphic.GraphPoint;
import jcckit.graphic.GraphicAttributes;
import jcckit.graphic.GraphicalComposite;
import jcckit.graphic.GraphicalElement;
import jcckit.graphic.Polygon; import jcckit.graphic.Polygon;
import jcckit.graphic.Rectangle; import jcckit.graphic.Rectangle;
import jcckit.graphic.ShapeAttributes; import jcckit.graphic.ShapeAttributes;
@ -34,8 +36,6 @@ import jcckit.util.ConfigParametersBasedConfigData;
import jcckit.util.Factory; import jcckit.util.Factory;
import jcckit.util.PropertiesBasedConfigData; import jcckit.util.PropertiesBasedConfigData;
import java.util.Properties;
/** /**
* Helper class for creating the legend of a {@link Plot}. * Helper class for creating the legend of a {@link Plot}.

View File

@ -18,9 +18,9 @@
*/ */
package jcckit.plot; package jcckit.plot;
import jcckit.graphic.GraphPoint;
import jcckit.graphic.GraphicAttributes; import jcckit.graphic.GraphicAttributes;
import jcckit.graphic.GraphicalElement; import jcckit.graphic.GraphicalElement;
import jcckit.graphic.GraphPoint;
import jcckit.graphic.Rectangle; import jcckit.graphic.Rectangle;
import jcckit.util.ConfigParameters; import jcckit.util.ConfigParameters;

View File

@ -18,8 +18,8 @@
*/ */
package jcckit.plot; package jcckit.plot;
import jcckit.graphic.GraphicalElement;
import jcckit.graphic.GraphPoint; import jcckit.graphic.GraphPoint;
import jcckit.graphic.GraphicalElement;
/** /**
* Interface of a symbol factory. A symbol is a {@link GraphicalElement} * Interface of a symbol factory. A symbol is a {@link GraphicalElement}

View File

@ -21,8 +21,8 @@ package jcckit.renderer;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import jcckit.graphic.Anchor; import jcckit.graphic.Anchor;
import jcckit.graphic.GraphPoint;
import jcckit.graphic.ClippingRectangle; import jcckit.graphic.ClippingRectangle;
import jcckit.graphic.GraphPoint;
/** /**
* Transformation between device-independent coordinates * Transformation between device-independent coordinates

View File

@ -22,6 +22,7 @@ import java.awt.Color;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
/** /**
@ -300,8 +301,8 @@ public class ConfigParameters {
} }
private Color decodeInternal(String value) { private Color decodeInternal(String value) {
if (HtmlColor.isValid(value)) { if (HtmlColorUtils.getColorIfValid(value)!=null) {
return new ColorMapperIdentity().getMappedColor(HtmlColor.getColorIfValid(value)); return new ColorMapperIdentity().getMappedColor(HtmlColorUtils.getColorIfValid(value));
} }
return Color.decode(value); return Color.decode(value);
} }

View File

@ -18,7 +18,7 @@
*/ */
package jcckit.util; package jcckit.util;
import java.lang.reflect.*; import java.lang.reflect.Constructor;
/** /**
* General purpose factory method based on {@link ConfigParameters} * General purpose factory method based on {@link ConfigParameters}

View File

@ -18,7 +18,7 @@
*/ */
package jcckit.util; package jcckit.util;
import java.lang.reflect.*; import java.lang.reflect.InvocationTargetException;
/** /**
* Exception thrown in the case of an error during creation of a new * Exception thrown in the case of an error during creation of a new

View File

@ -18,7 +18,8 @@
*/ */
package jcckit.util; package jcckit.util;
import java.io.*; import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties; import java.util.Properties;
/** /**

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,33 +28,34 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 6922 $ * Revision $Revision: 11351 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.ProtectedCommand;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.version.License;
import net.sourceforge.plantuml.version.Version; import net.sourceforge.plantuml.version.Version;
public abstract class AbstractPSystem implements PSystem { public abstract class AbstractPSystem implements Diagram {
private UmlSource source; private UmlSource source;
private String getVersion() { private String getVersion() {
final StringBuilder toAppend = new StringBuilder(); final StringBuilder toAppend = new StringBuilder();
toAppend.append("PlantUML version "); toAppend.append("PlantUML version ");
toAppend.append(Version.version()); toAppend.append(Version.versionString());
toAppend.append("(" + new Date(Version.compileTime()) + ")\n"); toAppend.append("(" + new Date(Version.compileTime()) + ")\n");
toAppend.append("(" + License.getCurrent() + " source distribution)\n");
final Properties p = System.getProperties(); final Properties p = System.getProperties();
toAppend.append(p.getProperty("java.runtime.name")); toAppend.append(p.getProperty("java.runtime.name"));
toAppend.append('\n'); toAppend.append('\n');
@ -86,28 +87,31 @@ public abstract class AbstractPSystem implements PSystem {
return 1; return 1;
} }
public List<File> exportDiagrams(File suggestedFile, FileFormatOption fileFormat) throws IOException, public Display getTitle() {
InterruptedException {
if (suggestedFile.exists() && suggestedFile.isDirectory()) {
throw new IllegalArgumentException("File is a directory " + suggestedFile);
}
OutputStream os = null;
try {
os = new BufferedOutputStream(new FileOutputStream(suggestedFile));
this.exportDiagram(os, null, 0, fileFormat);
} finally {
if (os != null) {
os.close();
}
}
return Arrays.asList(suggestedFile);
}
public List<? extends CharSequence> getTitle() {
if (source == null) { if (source == null) {
return Collections.emptyList(); return Display.emptyList();
} }
return source.getTitle(); return source.getTitle();
} }
public String getWarningOrError() {
return null;
}
public void makeDiagramReady() {
}
public boolean isOk() {
return true;
}
public CommandExecutionResult executeCommand(Command cmd, List<String> lines) {
cmd = new ProtectedCommand(cmd);
return cmd.execute(this, lines);
}
public boolean hasUrl() {
return false;
}
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -33,21 +33,22 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import net.sourceforge.plantuml.graphic.HorizontalAlignement; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
public enum AlignParam { public enum AlignParam {
SEQUENCE_MESSAGE_ALIGN(HorizontalAlignement.LEFT), SEQUENCE_MESSAGE_ALIGN(HorizontalAlignment.LEFT),
SEQUENCE_REFERENCE_ALIGN(HorizontalAlignement.CENTER); SEQUENCE_MESSAGETEXT_ALIGN(HorizontalAlignment.LEFT),
SEQUENCE_REFERENCE_ALIGN(HorizontalAlignment.CENTER);
private final HorizontalAlignement defaultValue; private final HorizontalAlignment defaultValue;
private AlignParam(HorizontalAlignement defaultValue) { private AlignParam(HorizontalAlignment defaultValue) {
this.defaultValue = defaultValue; this.defaultValue = defaultValue;
} }
public final HorizontalAlignement getDefaultValue() { public final HorizontalAlignment getDefaultValue() {
return defaultValue; return defaultValue;
} }
} }

View File

@ -0,0 +1,76 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2013, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 7903 $
*
*/
package net.sourceforge.plantuml;
public class BasicEnsureVisible implements EnsureVisible {
private double minX = Double.MAX_VALUE;
private double maxX = -Double.MAX_VALUE;
private double minY = Double.MAX_VALUE;
private double maxY = -Double.MAX_VALUE;
public void ensureVisible(double x, double y) {
if (x > maxX) {
maxX = x;
}
if (x < minX) {
minX = x;
}
if (y > maxY) {
maxY = y;
}
if (y < minY) {
minY = y;
}
}
public String getCoords(double scale) {
if (minX == Double.MAX_VALUE) {
return "0,0,0,0";
}
final int x1 = (int) (minX * scale);
final int y1 = (int) (minY * scale);
final int x2 = (int) (maxX * scale);
final int y2 = (int) (maxY * scale);
return "" + x1 + "," + y1 + "," + x2 + "," + y2;
}
public double getSurface() {
if (minX == Double.MAX_VALUE) {
return 0;
}
return (maxX - minX) * (maxY - minY);
}
}

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -33,37 +33,41 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import net.sourceforge.plantuml.core.Diagram;
public class BlockUml { public class BlockUml {
private final List<String> data; private final List<? extends CharSequence> data;
private PSystem system; private Diagram system;
private static final Pattern patternFilename = Pattern.compile("^@start\\S+\\s+\"?(.*?)\"?$"); // private static final Pattern patternFilename =
// Pattern.compile("^@start\\S+\\s+\"?(.*?)\"?$");
private static final Pattern patternFilename = Pattern
.compile("^@start[^\\s{}\"]+[\\s{][\\s\"]*([^\"]*?)[\\s}\"]*$");
BlockUml(String... strings) { BlockUml(String... strings) {
this(Arrays.asList(strings)); this(Arrays.asList(strings));
} }
public BlockUml(List<String> strings) { public BlockUml(List<? extends CharSequence> strings) {
final String s0 = strings.get(0).trim(); final String s0 = strings.get(0).toString().trim();
if (s0.startsWith("@start") == false) { if (s0.startsWith("@start") == false) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
this.data = new ArrayList<String>(strings); this.data = new ArrayList<CharSequence>(strings);
} }
public String getFilename() { public String getFilename() {
if (OptionFlags.getInstance().isWord()) { if (OptionFlags.getInstance().isWord()) {
return null; return null;
} }
final Matcher m = patternFilename.matcher(data.get(0).trim()); final Matcher m = patternFilename.matcher(data.get(0).toString().trim());
final boolean ok = m.find(); final boolean ok = m.find();
if (ok == false) { if (ok == false) {
return null; return null;
@ -78,16 +82,19 @@ public class BlockUml {
return result; return result;
} }
public PSystem getSystem() throws IOException, InterruptedException { private Diagram getSystem() {
if (system == null) { if (system == null) {
createSystem(); createSystem();
} }
return system; return system;
} }
private void createSystem() throws IOException, InterruptedException { public Diagram getDiagram() {
system = new PSystemBuilder().createPSystem(data); return getSystem();
}
private void createSystem() {
system = new PSystemBuilder().createPSystem(data);
} }
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -52,10 +52,10 @@ final public class BlockUmlBuilder {
private final List<BlockUml> blocks = new ArrayList<BlockUml>(); private final List<BlockUml> blocks = new ArrayList<BlockUml>();
private final Set<File> usedFiles = new HashSet<File>(); private final Set<File> usedFiles = new HashSet<File>();
public BlockUmlBuilder(List<String> config, Defines defines, Reader reader, File newCurrentDir) throws IOException { public BlockUmlBuilder(List<String> config, String charset, Defines defines, Reader reader, File newCurrentDir) throws IOException {
Preprocessor includer = null; Preprocessor includer = null;
try { try {
includer = new Preprocessor(new UncommentReadLine(new ReadLineReader(reader)), defines, usedFiles, newCurrentDir); includer = new Preprocessor(new UncommentReadLine(new ReadLineReader(reader)), charset, defines, usedFiles, newCurrentDir);
init(includer, config); init(includer, config);
} finally { } finally {
if (includer != null) { if (includer != null) {

View File

@ -0,0 +1,92 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2013, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 8368 $
*
*/
package net.sourceforge.plantuml;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
public class CMapData {
private final StringBuilder stringBuilder = new StringBuilder();
public String asString(String nameId) {
return "<map id=\"" + nameId + "_map\" name=\"" + nameId + "_map\">\n" + stringBuilder.toString() + "</map>\n";
}
public boolean containsData() {
return stringBuilder.length() > 0;
}
public void appendString(String s) {
stringBuilder.append(s);
}
public void appendLong(long s) {
stringBuilder.append(s);
}
public void appendUrl(int seq, Url url, double scale) {
appendString("<area shape=\"rect\" id=\"id");
appendLong(seq);
appendString("\" href=\"");
appendString(url.getUrl());
appendString("\" title=\"");
appendString(url.getTooltip());
appendString("\" alt=\"\" coords=\"");
appendString(url.getCoords(scale));
appendString("\"/>");
appendString("\n");
}
// private CMapData() {
// }
public static CMapData cmapString(Set<Url> allUrlEncountered, double scale) {
final CMapData cmapdata = new CMapData();
final List<Url> all = new ArrayList<Url>(allUrlEncountered);
Collections.sort(all, Url.SURFACE_COMPARATOR);
int seq = 1;
for (Url u : all) {
cmapdata.appendUrl(seq, u, scale);
seq++;
}
return cmapdata;
}
}

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 6549 $ * Revision $Revision: 11149 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
@ -65,11 +65,14 @@ public enum ColorParam {
packageBackground, packageBackground,
packageBorder, packageBorder,
partitionBackground,
partitionBorder,
componentBackground, componentBackground,
componentBorder, componentBorder,
componentInterfaceBackground, componentInterfaceBackground,
componentInterfaceBorder, componentInterfaceBorder,
componentArrow, // componentArrow,
stateBackground, stateBackground,
stateBorder, stateBorder,
@ -80,6 +83,9 @@ public enum ColorParam {
noteBackground(true), noteBackground(true),
noteBorder, noteBorder,
legendBackground(true),
legendBorder,
sequenceActorBackground(true), sequenceActorBackground(true),
sequenceActorBorder, sequenceActorBorder,
sequenceGroupBorder, sequenceGroupBorder,
@ -118,6 +124,4 @@ public enum ColorParam {
protected boolean isBackground() { protected boolean isBackground() {
return isBackground; return isBackground;
} }
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 7157 $ * Revision $Revision: 11564 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
@ -79,18 +79,28 @@ public class Dimension2DDouble extends Dimension2D {
return new Dimension2DDouble(width, height); return new Dimension2DDouble(width, height);
} }
public static Dimension2D mergeTB(Dimension2D a, Dimension2D b, Dimension2D c) {
final double width = MathUtils.max(a.getWidth(), b.getWidth(), c.getWidth());
final double height = a.getHeight() + b.getHeight() + c.getHeight();
return new Dimension2DDouble(width, height);
}
public static Dimension2D mergeLR(Dimension2D left, Dimension2D right) { public static Dimension2D mergeLR(Dimension2D left, Dimension2D right) {
final double height = Math.max(left.getHeight(), right.getHeight()); final double height = Math.max(left.getHeight(), right.getHeight());
final double width = left.getWidth() + right.getWidth(); final double width = left.getWidth() + right.getWidth();
return new Dimension2DDouble(width, height); return new Dimension2DDouble(width, height);
} }
public static Dimension2D mergeTB(Dimension2D top1, Dimension2D top2, Dimension2D bottom) { public static Dimension2D mergeLayoutT12B3(Dimension2D top1, Dimension2D top2, Dimension2D bottom) {
final double width = MathUtils.max(top1.getWidth(), top2.getWidth(), bottom.getWidth()); final double width = MathUtils.max(top1.getWidth(), top2.getWidth(), bottom.getWidth());
final double height = top1.getHeight() + top2.getHeight() + bottom.getHeight(); final double height = top1.getHeight() + top2.getHeight() + bottom.getHeight();
return new Dimension2DDouble(width, height); return new Dimension2DDouble(width, height);
} }
public static Dimension2D max(Dimension2D dim1, Dimension2D dim2) {
return atLeast(dim1, dim2.getWidth(), dim2.getHeight());
}
public static Dimension2D atLeast(Dimension2D dim, double minWidth, double minHeight) { public static Dimension2D atLeast(Dimension2D dim, double minWidth, double minHeight) {
double h = dim.getHeight(); double h = dim.getHeight();
double w = dim.getWidth(); double w = dim.getWidth();

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 6616 $ * Revision $Revision: 9786 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
@ -45,6 +45,7 @@ import java.util.Set;
import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.Defines;
@Deprecated
public class DirWatcher { public class DirWatcher {
final private File dir; final private File dir;

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -69,34 +69,39 @@ public class DirWatcher2 {
public Map<File, Future<List<GeneratedImage>>> buildCreatedFiles() throws IOException, InterruptedException { public Map<File, Future<List<GeneratedImage>>> buildCreatedFiles() throws IOException, InterruptedException {
final Map<File, Future<List<GeneratedImage>>> result = new TreeMap<File, Future<List<GeneratedImage>>>(); final Map<File, Future<List<GeneratedImage>>> result = new TreeMap<File, Future<List<GeneratedImage>>>();
for (final File f : dir.listFiles()) { if (dir.listFiles() != null) {
if (f.isFile() == false) { for (final File f : dir.listFiles()) {
continue; if (f.isFile() == false) {
} continue;
if (fileToProcess(f.getName()) == false) { }
continue; if (fileToProcess(f.getName()) == false) {
} continue;
final FileWatcher watcher = modifieds.get(f); }
final FileWatcher watcher = modifieds.get(f);
if (watcher == null || watcher.hasChanged()) { if (watcher == null || watcher.hasChanged()) {
final SourceFileReader sourceFileReader = new SourceFileReader(new Defines(), f, option.getOutputDir(), final SourceFileReader sourceFileReader = new SourceFileReader(new Defines(), f,
option.getConfig(), option.getCharset(), option.getFileFormatOption()); option.getOutputDir(), option.getConfig(), option.getCharset(),
modifieds.put(f, new FileWatcher(Collections.singleton(f))); option.getFileFormatOption());
final Future<List<GeneratedImage>> value = executorService.submit(new Callable<List<GeneratedImage>>() { modifieds.put(f, new FileWatcher(Collections.singleton(f)));
public List<GeneratedImage> call() throws Exception { final Future<List<GeneratedImage>> value = executorService
try { .submit(new Callable<List<GeneratedImage>>() {
final List<GeneratedImage> generatedImages = sourceFileReader.getGeneratedImages(); public List<GeneratedImage> call() throws Exception {
final Set<File> files = new HashSet<File>(sourceFileReader.getIncludedFiles()); try {
files.add(f); final List<GeneratedImage> generatedImages = sourceFileReader
modifieds.put(f, new FileWatcher(files)); .getGeneratedImages();
return Collections.unmodifiableList(generatedImages); final Set<File> files = new HashSet<File>(sourceFileReader.getIncludedFiles());
} catch (Exception e) { files.add(f);
e.printStackTrace(); modifieds.put(f, new FileWatcher(files));
return Collections.emptyList(); return Collections.unmodifiableList(generatedImages);
} } catch (Exception e) {
} e.printStackTrace();
}); return Collections.emptyList();
result.put(f, value); }
}
});
result.put(f, value);
}
} }
} }
return Collections.unmodifiableMap(result); return Collections.unmodifiableMap(result);

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -33,6 +33,8 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import java.awt.geom.Point2D;
public enum Direction { public enum Direction {
RIGHT, LEFT, DOWN, UP; RIGHT, LEFT, DOWN, UP;
@ -64,4 +66,30 @@ public enum Direction {
} }
return Direction.DOWN; return Direction.DOWN;
} }
public Direction clockwise() {
if (this == RIGHT) {
return DOWN;
}
if (this == LEFT) {
return UP;
}
if (this == DOWN) {
return LEFT;
}
if (this == UP) {
return RIGHT;
}
throw new IllegalStateException();
}
public static Direction leftOrRight(Point2D p1, Point2D p2) {
if (p1.getX() < p2.getX()) {
return Direction.LEFT;
}
if (p1.getX() > p2.getX()) {
return Direction.RIGHT;
}
throw new IllegalArgumentException();
}
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -33,16 +33,14 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import java.util.ArrayList; import net.sourceforge.plantuml.cucadiagram.Display;
import java.util.Collections;
import java.util.List;
public class EmbededDiagram implements CharSequence { public class EmbededDiagram implements CharSequence {
private final List<String> system; private final Display system;
public EmbededDiagram(List<String> system) { public EmbededDiagram(Display system) {
this.system = new ArrayList<String>(system); this.system = system;
} }
public int length() { public int length() {
@ -57,7 +55,7 @@ public class EmbededDiagram implements CharSequence {
return toString().subSequence(start, end); return toString().subSequence(start, end);
} }
public final List<String> getLines() { public final Display getLines() {
return Collections.unmodifiableList(system); return system;
} }
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,17 +28,20 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 5810 $ * Revision $Revision: 10103 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform; import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.UAntiAliasing;
import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d;
public class EmptyImageBuilder { public class EmptyImageBuilder {
private final BufferedImage im; private final BufferedImage im;
@ -50,11 +53,14 @@ public class EmptyImageBuilder {
public EmptyImageBuilder(int width, int height, Color background) { public EmptyImageBuilder(int width, int height, Color background) {
Log.info("Creating image " + width + "x" + height); Log.info("Creating image " + width + "x" + height);
im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); im = new BufferedImage(width, height, background == null ? BufferedImage.TYPE_INT_ARGB
: BufferedImage.TYPE_INT_RGB);
g2d = im.createGraphics(); g2d = im.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); UAntiAliasing.ANTI_ALIASING_ON.apply(g2d);
g2d.setColor(background); if (background != null) {
g2d.fillRect(0, 0, width, height); g2d.setColor(background);
g2d.fillRect(0, 0, width, height);
}
} }
public EmptyImageBuilder(int width, int height, Color background, double dpiFactor) { public EmptyImageBuilder(int width, int height, Color background, double dpiFactor) {
@ -72,4 +78,10 @@ public class EmptyImageBuilder {
return g2d; return g2d;
} }
public UGraphicG2d getUGraphicG2d() {
final UGraphicG2d result = new UGraphicG2d(new ColorMapperIdentity(), g2d, 1.0);
result.setBufferedImage(im);
return result;
}
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,11 +28,13 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 3824 $ * Revision $Revision: 7903 $
*
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
public interface PSystemBasicFactory extends PSystemFactory { public interface EnsureVisible {
public void ensureVisible(double x, double y);
boolean executeLine(String line);
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -36,14 +36,14 @@ package net.sourceforge.plantuml;
import net.sourceforge.plantuml.suggest.SuggestEngineResult; import net.sourceforge.plantuml.suggest.SuggestEngineResult;
import net.sourceforge.plantuml.suggest.SuggestEngineStatus; import net.sourceforge.plantuml.suggest.SuggestEngineStatus;
class ErrorUml { public class ErrorUml {
private final String error; private final String error;
private final int position; private final int position;
private final ErrorUmlType type; private final ErrorUmlType type;
private SuggestEngineResult suggest; private SuggestEngineResult suggest;
ErrorUml(ErrorUmlType type, String error, int position) { public ErrorUml(ErrorUmlType type, String error, int position) {
if (error == null || type == null || StringUtils.isEmpty(error)) { if (error == null || type == null || StringUtils.isEmpty(error)) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -33,7 +33,7 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
enum ErrorUmlType { public enum ErrorUmlType {
SYNTAX_ERROR, EXECUTION_ERROR SYNTAX_ERROR, EXECUTION_ERROR
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,17 +28,30 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 6671 $ * Revision $Revision: 9786 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
public enum FileFormat { import java.io.File;
PNG, SVG, EPS, EPS_TEXT, ATXT, UTXT, DOT, XMI_STANDARD, XMI_STAR, XMI_ARGO, PDF;
/**
* Format for output files generated by PlantUML.
*
* @author Arnaud Roques
*
*/
public enum FileFormat {
PNG, SVG, EPS, EPS_TEXT, ATXT, UTXT, XMI_STANDARD, XMI_STAR, XMI_ARGO, PDF, MJPEG, HTML, HTML5, VDX;
/**
* Returns the file format to be used for that format.
*
* @return a string starting by a point.
*/
public String getFileSuffix() { public String getFileSuffix() {
if (name().startsWith("XMI")) { if (name().startsWith("XMI")) {
return ".XMI"; return ".xmi";
} }
if (this == EPS_TEXT) { if (this == EPS_TEXT) {
return EPS.getFileSuffix(); return EPS.getFileSuffix();
@ -46,6 +59,11 @@ public enum FileFormat {
return "." + name().toLowerCase(); return "." + name().toLowerCase();
} }
/**
* Check if this file format is Encapsulated PostScript.
*
* @return <code>true</code> for EPS.
*/
public boolean isEps() { public boolean isEps() {
if (this == EPS) { if (this == EPS) {
return true; return true;
@ -58,9 +76,36 @@ public enum FileFormat {
public String changeName(String fileName, int cpt) { public String changeName(String fileName, int cpt) {
if (cpt == 0) { if (cpt == 0) {
return fileName.replaceAll("\\.\\w+$", getFileSuffix()); return changeName(fileName, getFileSuffix());
} }
return fileName.replaceAll("\\.\\w+$", "_" + String.format("%03d", cpt) + getFileSuffix()); return changeName(fileName, "_" + String.format("%03d", cpt) + getFileSuffix());
}
private String changeName(String fileName, String replacement) {
String result = fileName.replaceAll("\\.\\w+$", replacement);
if (result.equals(fileName)) {
result = fileName + replacement;
}
return result;
}
public File computeFilename(File pngFile, int i) {
if (i == 0) {
return pngFile;
}
final File dir = pngFile.getParentFile();
return new File(dir, computeFilename(pngFile.getName(), i));
// String name = pngFile.getName();
// name = name.replaceAll("\\" + getFileSuffix() + "$", "_" + String.format("%03d", i) + getFileSuffix());
// return new File(dir, name);
}
public String computeFilename(String name, int i) {
if (i == 0) {
return name;
}
return name.replaceAll("\\" + getFileSuffix() + "$", "_" + String.format("%03d", i) + getFileSuffix());
} }
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -33,32 +33,160 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D;
import java.awt.image.BufferedImage;
import net.sourceforge.plantuml.eps.EpsStrategy;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorGradient;
import net.sourceforge.plantuml.graphic.HtmlColorSimple;
import net.sourceforge.plantuml.graphic.HtmlColorTransparent;
import net.sourceforge.plantuml.ugraphic.ColorMapper;
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.eps.UGraphicEps;
import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d;
import net.sourceforge.plantuml.ugraphic.html5.UGraphicHtml5;
import net.sourceforge.plantuml.ugraphic.svg.UGraphicSvg;
import net.sourceforge.plantuml.ugraphic.visio.UGraphicVdx;
/**
* A FileFormat with some parameters.
*
*
* @author Arnaud Roques
*
*/
public class FileFormatOption { public class FileFormatOption {
private final FileFormat fileFormat; private final FileFormat fileFormat;
private final int dpi; private final AffineTransform affineTransform;
private final boolean withMetadata;
public FileFormatOption(FileFormat fileFormat, int dpi) {
this.fileFormat = fileFormat;
this.dpi = dpi;
}
public FileFormatOption(FileFormat fileFormat) { public FileFormatOption(FileFormat fileFormat) {
this(fileFormat, 96); this(fileFormat, null, true);
}
public final boolean isWithMetadata() {
return withMetadata;
}
public FileFormatOption(FileFormat fileFormat, boolean withMetadata) {
this(fileFormat, null, false);
}
public FileFormatOption(FileFormat fileFormat, AffineTransform at) {
this(fileFormat, at, true);
}
public FileFormatOption(FileFormat fileFormat, AffineTransform at, boolean withMetadata) {
this.fileFormat = fileFormat;
this.affineTransform = at;
this.withMetadata = withMetadata;
}
@Override
public String toString() {
return fileFormat.toString() + " " + affineTransform;
} }
public final FileFormat getFileFormat() { public final FileFormat getFileFormat() {
return fileFormat; return fileFormat;
} }
// public final int getDpi() { public AffineTransform getAffineTransform() {
// return dpi; return affineTransform;
// } }
//
// public double getDpiFactor() { /**
// if (dpi == 96) { * Create a UGraphic corresponding to this FileFormatOption
// return 1.0; *
// } * @param colorMapper
// return dpi / 96.0; * @param dpiFactor
// } * 1.0 for a standard dot per inch
* @param dim
* @param mybackcolor
* @param rotation
* @return
*/
public UGraphic createUGraphic(ColorMapper colorMapper, double dpiFactor, final Dimension2D dim,
HtmlColor mybackcolor, boolean rotation) {
switch (fileFormat) {
case PNG:
return createUGraphicPNG(colorMapper, dpiFactor, dim, mybackcolor, rotation);
case SVG:
return createUGraphicSVG(colorMapper, dpiFactor, dim, mybackcolor, rotation);
case EPS:
return new UGraphicEps(colorMapper, EpsStrategy.getDefault2());
case EPS_TEXT:
return new UGraphicEps(colorMapper, EpsStrategy.WITH_MACRO_AND_TEXT);
case HTML5:
return new UGraphicHtml5(colorMapper);
case VDX:
return new UGraphicVdx(colorMapper);
default:
throw new UnsupportedOperationException(fileFormat.toString());
}
}
public UGraphic createUGraphic(final Dimension2D dim) {
return createUGraphic(new ColorMapperIdentity(), 1.0, dim, null, false);
}
private UGraphic createUGraphicSVG(ColorMapper colorMapper, double scale, Dimension2D dim, HtmlColor mybackcolor,
boolean rotation) {
Color backColor = Color.WHITE;
if (mybackcolor instanceof HtmlColorSimple) {
backColor = colorMapper.getMappedColor(mybackcolor);
}
final UGraphicSvg ug;
if (mybackcolor instanceof HtmlColorGradient) {
ug = new UGraphicSvg(colorMapper, (HtmlColorGradient) mybackcolor, false, scale);
} else if (backColor == null || backColor.equals(Color.WHITE)) {
ug = new UGraphicSvg(colorMapper, false, scale);
} else {
ug = new UGraphicSvg(colorMapper, StringUtils.getAsHtml(backColor), false, scale);
}
return ug;
}
private UGraphic createUGraphicPNG(ColorMapper colorMapper, double dpiFactor, final Dimension2D dim,
HtmlColor mybackcolor, boolean rotation) {
Color backColor = Color.WHITE;
if (mybackcolor instanceof HtmlColorSimple) {
backColor = colorMapper.getMappedColor(mybackcolor);
} else if (mybackcolor instanceof HtmlColorTransparent) {
backColor = null;
}
final EmptyImageBuilder builder;
final Graphics2D graphics2D;
if (rotation) {
builder = new EmptyImageBuilder((int) (dim.getHeight() * dpiFactor), (int) (dim.getWidth() * dpiFactor),
backColor);
graphics2D = builder.getGraphics2D();
graphics2D.rotate(-Math.PI / 2);
graphics2D.translate(-builder.getBufferedImage().getHeight(), 0);
} else {
builder = new EmptyImageBuilder((int) (dim.getWidth() * dpiFactor), (int) (dim.getHeight() * dpiFactor),
backColor);
graphics2D = builder.getGraphics2D();
}
final UGraphicG2d ug = new UGraphicG2d(colorMapper, graphics2D, dpiFactor);
ug.setBufferedImage(builder.getBufferedImage());
final BufferedImage im = ((UGraphicG2d) ug).getBufferedImage();
if (mybackcolor instanceof HtmlColorGradient) {
ug.apply(new UChangeBackColor(mybackcolor)).draw(new URectangle(im.getWidth(), im.getHeight()));
}
return ug;
}
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 3824 $ * Revision $Revision: 9786 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,13 +28,16 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 6908 $ * Revision $Revision: 9786 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class FileSystem { public class FileSystem {
@ -64,10 +67,47 @@ public class FileSystem {
public File getFile(String nameOrPath) throws IOException { public File getFile(String nameOrPath) throws IOException {
final File dir = currentDir.get(); final File dir = currentDir.get();
if (dir == null) { if (dir == null || isAbsolute(nameOrPath)) {
return new File(nameOrPath).getCanonicalFile(); return new File(nameOrPath).getCanonicalFile();
} }
return new File(dir.getAbsoluteFile(), nameOrPath).getCanonicalFile(); final File filecurrent = new File(dir.getAbsoluteFile(), nameOrPath);
if (filecurrent.exists()) {
return filecurrent.getCanonicalFile();
}
for (File d : getPath("plantuml.include.path")) {
final File file = new File(d, nameOrPath);
if (file.exists()) {
return file.getCanonicalFile();
}
}
for (File d : getPath("java.class.path")) {
final File file = new File(d, nameOrPath);
if (file.exists()) {
return file.getCanonicalFile();
}
}
return filecurrent;
}
private List<File> getPath(String prop) {
final List<File> result = new ArrayList<File>();
final String paths = System.getProperty(prop);
if (paths == null) {
return result;
}
final StringTokenizer st = new StringTokenizer(paths, System.getProperty("path.separator"));
while (st.hasMoreTokens()) {
final File f = new File(st.nextToken());
if (f.exists() && f.isDirectory()) {
result.add(f);
}
}
return result;
}
private boolean isAbsolute(String nameOrPath) {
final File f = new File(nameOrPath);
return f.isAbsolute();
} }
public void reset() { public void reset() {

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -51,26 +51,6 @@ public class FileUtils {
counter = new AtomicInteger(0); counter = new AtomicInteger(0);
} }
public static File getTmpDir() {
final File tmpDir = new File(System.getProperty("java.io.tmpdir"));
if (tmpDir.exists() == false || tmpDir.isDirectory() == false) {
throw new IllegalStateException();
}
return tmpDir;
}
public static void delete(File f) {
if (f == null) {
return;
}
Thread.yield();
Log.info("Deleting temporary file " + f);
final boolean ok = f.delete();
if (ok == false) {
Log.error("Cannot delete: " + f);
}
}
static public File createTempFile(String prefix, String suffix) throws IOException { static public File createTempFile(String prefix, String suffix) throws IOException {
if (suffix.startsWith(".") == false) { if (suffix.startsWith(".") == false) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
@ -92,40 +72,41 @@ public class FileUtils {
return f; return f;
} }
private static void copyInternal(final InputStream fis, final OutputStream fos) throws IOException {
final byte[] buf = new byte[10240];
int len;
while ((len = fis.read(buf)) > 0) {
fos.write(buf, 0, len);
}
fos.close();
fis.close();
}
static public void copyToFile(File src, File dest) throws IOException { static public void copyToFile(File src, File dest) throws IOException {
if (dest.isDirectory()) { if (dest.isDirectory()) {
dest = new File(dest, src.getName()); dest = new File(dest, src.getName());
} }
final InputStream fis = new BufferedInputStream(new FileInputStream(src)); final InputStream fis = new BufferedInputStream(new FileInputStream(src));
final OutputStream fos = new BufferedOutputStream(new FileOutputStream(dest)); final OutputStream fos = new BufferedOutputStream(new FileOutputStream(dest));
int lu; copyInternal(fis, fos);
while ((lu = fis.read()) != -1) {
fos.write(lu);
}
fos.close();
fis.close();
} }
static public void copyToStream(File src, OutputStream os) throws IOException { static public void copyToStream(File src, OutputStream os) throws IOException {
final InputStream fis = new BufferedInputStream(new FileInputStream(src)); final InputStream fis = new BufferedInputStream(new FileInputStream(src));
final OutputStream fos = new BufferedOutputStream(os); final OutputStream fos = new BufferedOutputStream(os);
int lu; copyInternal(fis, fos);
while ((lu = fis.read()) != -1) {
fos.write(lu);
}
fos.close();
fis.close();
} }
static public void copyToStream(InputStream is, OutputStream os) throws IOException { static public void copyToStream(InputStream is, OutputStream os) throws IOException {
final InputStream fis = new BufferedInputStream(is); final InputStream fis = new BufferedInputStream(is);
final OutputStream fos = new BufferedOutputStream(os); final OutputStream fos = new BufferedOutputStream(os);
int lu; copyInternal(fis, fos);
while ((lu = fis.read()) != -1) { }
fos.write(lu);
} static public void copyToFile(byte[] src, File dest) throws IOException {
final OutputStream fos = new BufferedOutputStream(new FileOutputStream(dest));
fos.write(src);
fos.close(); fos.close();
fis.close();
} }
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,52 +28,60 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 7130 $ * Revision $Revision: 11985 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import java.awt.Font; import java.awt.Font;
public enum FontParam { interface FontParamConstant {
String FAMILY = "SansSerif";
String COLOR = "black";
}
ACTIVITY(14, Font.PLAIN, "black", null), public enum FontParam {
ACTIVITY_ARROW(13, Font.PLAIN, "black", null), ACTIVITY(14, Font.PLAIN), //
CIRCLED_CHARACTER(17, Font.BOLD, "black", "Courier"), // ACTIVITY_ARROW(13, Font.PLAIN), //
OBJECT_ARROW(10, Font.PLAIN, "black", null), GENERIC_ARROW(13, Font.PLAIN), //
OBJECT_ATTRIBUTE(10, Font.PLAIN, "black", null), ACTIVITY2(12, Font.PLAIN), //
OBJECT(12, Font.PLAIN, "black", null), ACTIVITY_ARROW2(11, Font.PLAIN), //
OBJECT_STEREOTYPE(12, Font.ITALIC, "black", null), CIRCLED_CHARACTER(17, Font.BOLD, FontParamConstant.COLOR, "Monospaced"), //
CLASS_ARROW(10, Font.PLAIN, "black", null), // OBJECT_ARROW(10, Font.PLAIN), //
CLASS_ATTRIBUTE(10, Font.PLAIN, "black", null), OBJECT_ATTRIBUTE(10, Font.PLAIN), //
CLASS(12, Font.PLAIN, "black", null), OBJECT(12, Font.PLAIN), //
CLASS_STEREOTYPE(12, Font.ITALIC, "black", null), OBJECT_STEREOTYPE(12, Font.ITALIC), //
COMPONENT(14, Font.PLAIN, "black", null), // CLASS_ARROW(10, Font.PLAIN), //
COMPONENT_STEREOTYPE(14, Font.ITALIC, "black", null), CLASS_ATTRIBUTE(10, Font.PLAIN), //
COMPONENT_ARROW(13, Font.PLAIN, "black", null), CLASS(12, Font.PLAIN), //
NOTE(13, Font.PLAIN, "black", null), CLASS_STEREOTYPE(12, Font.ITALIC), //
PACKAGE(14, Font.PLAIN, "black", null), COMPONENT(14, Font.PLAIN), //
SEQUENCE_ACTOR(13, Font.PLAIN, "black", null), COMPONENT_STEREOTYPE(14, Font.ITALIC), //
SEQUENCE_ARROW(13, Font.PLAIN, "black", null), // COMPONENT_ARROW(13, Font.PLAIN), //
SEQUENCE_BOX(13, Font.BOLD, "black", null), NOTE(13, Font.PLAIN), //
SEQUENCE_DIVIDER(13, Font.BOLD, "black", null), PACKAGE(14, Font.PLAIN), //
SEQUENCE_REFERENCE(13, Font.PLAIN, "black", null), SEQUENCE_ACTOR(13, Font.PLAIN), //
SEQUENCE_DELAY(11, Font.PLAIN, "black", null), SEQUENCE_ARROW(13, Font.PLAIN), //
SEQUENCE_GROUP(11, Font.BOLD, "black", null), SEQUENCE_BOX(13, Font.BOLD), //
SEQUENCE_GROUP_HEADER(13, Font.BOLD, "black", null), SEQUENCE_DIVIDER(13, Font.BOLD), //
SEQUENCE_PARTICIPANT(13, Font.PLAIN, "black", null), SEQUENCE_REFERENCE(13, Font.PLAIN), //
SEQUENCE_TITLE(13, Font.BOLD, "black", null), SEQUENCE_DELAY(11, Font.PLAIN), //
STATE(14, Font.PLAIN, "black", null), SEQUENCE_GROUP(11, Font.BOLD), //
STATE_ARROW(13, Font.PLAIN, "black", null), SEQUENCE_GROUP_HEADER(13, Font.BOLD), //
STATE_ATTRIBUTE(12, Font.PLAIN, "black", null), SEQUENCE_PARTICIPANT(13, Font.PLAIN), //
TITLE(18, Font.PLAIN, "black", null), SEQUENCE_TITLE(13, Font.BOLD), //
FOOTER(10, Font.PLAIN, "#888888", null), STATE(14, Font.PLAIN), //
HEADER(10, Font.PLAIN, "#888888", null), // STATE_ARROW(13, Font.PLAIN), //
USECASE(14, Font.PLAIN, "black", null), STATE_ATTRIBUTE(12, Font.PLAIN), //
USECASE_STEREOTYPE(14, Font.ITALIC, "black", null), LEGEND(14, Font.PLAIN), //
USECASE_ACTOR(14, Font.PLAIN, "black", null), TITLE(18, Font.PLAIN), //
USECASE_ACTOR_STEREOTYPE(14, Font.ITALIC, "black", null), FOOTER(10, Font.PLAIN, "#888888", FontParamConstant.FAMILY), //
USECASE_ARROW(13, Font.PLAIN, "black", null); HEADER(10, Font.PLAIN, "#888888", FontParamConstant.FAMILY), //
USECASE(14, Font.PLAIN), //
USECASE_STEREOTYPE(14, Font.ITALIC), //
USECASE_ACTOR(14, Font.PLAIN), //
USECASE_ACTOR_STEREOTYPE(14, Font.ITALIC); //
// USECASE_ARROW(13, Font.PLAIN, FontParamConstant.COLOR, FontParamConstant.FAMILY);
private final int defaultSize; private final int defaultSize;
private final int fontStyle; private final int fontStyle;
@ -87,15 +95,19 @@ public enum FontParam {
this.defaultFamily = defaultFamily; this.defaultFamily = defaultFamily;
} }
private FontParam(int defaultSize, int fontStyle) {
this(defaultSize, fontStyle, FontParamConstant.COLOR, FontParamConstant.FAMILY);
}
public final int getDefaultSize(ISkinParam skinParam) { public final int getDefaultSize(ISkinParam skinParam) {
if (skinParam.isSvek() && this==CLASS_ATTRIBUTE) { if (this == CLASS_ATTRIBUTE) {
return 11; return 11;
} }
return defaultSize; return defaultSize;
} }
public final int getDefaultFontStyle(ISkinParam skinParam) { public final int getDefaultFontStyle(ISkinParam skinParam) {
if (skinParam.isSvek() && this==PACKAGE) { if (this == PACKAGE) {
return Font.BOLD; return Font.BOLD;
} }
return fontStyle; return fontStyle;
@ -109,5 +121,4 @@ public enum FontParam {
return defaultFamily; return defaultFamily;
} }
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,20 +28,22 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 6615 $ * Revision $Revision: 10298 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import java.io.File; import java.io.File;
import net.sourceforge.plantuml.core.Diagram;
public class GeneratedImage implements Comparable<GeneratedImage> { public class GeneratedImage implements Comparable<GeneratedImage> {
private final File pngFile; private final File pngFile;
private final String description; private final String description;
private final PSystem system; private final Diagram system;
public GeneratedImage(File pngFile, String description, PSystem system) { public GeneratedImage(File pngFile, String description, Diagram system) {
this.system = system; this.system = system;
this.pngFile = pngFile; this.pngFile = pngFile;
this.description = description; this.description = description;

View File

@ -0,0 +1,40 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2013, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 3835 $
*
*/
package net.sourceforge.plantuml;
public interface Hideable {
public boolean isHidden();
}

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -35,43 +35,68 @@ package net.sourceforge.plantuml;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines; import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizLayoutStrategy; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizLayoutStrategy;
import net.sourceforge.plantuml.graphic.HorizontalAlignement; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.ColorMapper;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke;
public interface ISkinParam { public interface ISkinParam extends SpriteContainer {
public HtmlColor getBackgroundColor(); public HtmlColor getBackgroundColor();
public String getValue(String key); public String getValue(String key);
public HtmlColor getHtmlColor(ColorParam param, String stereotype); public HtmlColor getHtmlColor(ColorParam param, String stereotype, boolean clickable);
public HtmlColor getFontHtmlColor(FontParam param, String stereotype); public HtmlColor getFontHtmlColor(FontParam param, String stereotype);
public UStroke getThickness(LineParam param);
public UFont getFont(FontParam fontParam, String stereotype); public UFont getFont(FontParam fontParam, String stereotype);
public HorizontalAlignement getHorizontalAlignement(AlignParam param); public HorizontalAlignment getHorizontalAlignment(AlignParam param);
public int getCircledCharacterRadius(); public int getCircledCharacterRadius();
public boolean isClassCollapse();
public int classAttributeIconSize(); public int classAttributeIconSize();
public ColorMapper getColorMapper(); public ColorMapper getColorMapper();
public int getDpi(); public int getDpi();
public boolean useOctagonForActivity();
public DotSplines getDotSplines(); public DotSplines getDotSplines();
public GraphvizLayoutStrategy getStrategy(); public GraphvizLayoutStrategy getStrategy();
public boolean isSvek();
public boolean shadowing(); public boolean shadowing();
public PackageStyle getPackageStyle();
public boolean useUml2ForComponent();
public boolean stereotypePositionTop();
public boolean useSwimlanes();
public double getNodesep();
public double getRanksep();
public double getRoundCorner();
public double maxMessageSize();
public boolean strictUmlStyle();
public boolean forceSequenceParticipantUnderlined();
public ConditionStyle getConditionStyle();
public double minClassWidth();
public boolean sameClassWidth();
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public

View File

@ -0,0 +1,49 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2013, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 3835 $
*
*/
package net.sourceforge.plantuml;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.ugraphic.UStroke;
public interface LineConfigurable {
public HtmlColor getSpecificLineColor();
public void setSpecificLineColor(HtmlColor specificLinecolor);
public UStroke getSpecificLineStroke();
public void setSpecificLineStroke(UStroke specificLineStoke);
}

View File

@ -0,0 +1,47 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2013, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 7715 $
*
*/
package net.sourceforge.plantuml;
public enum LineParam {
// sequenceBoundaryBorder,
sequenceActorBorder,
sequenceDividerBorder,
// sequenceGroupBorder(0.1),
// sequenceReferenceBorder(0.1),
sequenceLifeLineBorder,
sequenceParticipantBorder, noteBorder, sequenceGroupBorder, sequenceReferenceBorder;
// sequenceBoxBorder(0.1);
}

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 6528 $ * Revision $Revision: 9786 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
@ -68,4 +68,18 @@ public abstract class Log {
return sb.toString(); return sb.toString();
} }
public static void println(Object s) {
if (header == null) {
System.err.println("L = " + s);
} else {
System.err.println(header + " " + s);
}
}
private static String header;
public static void header(String s) {
header = s;
}
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -45,7 +45,9 @@ public class MathUtils {
public static double limitation(double v, double min, double max) { public static double limitation(double v, double min, double max) {
if (min >= max) { if (min >= max) {
throw new IllegalArgumentException(); assert false : "min="+min+" max="+max+" v="+v;
return v;
// throw new IllegalArgumentException("min="+min+" max="+max+" v="+v);
} }
if (v < min) { if (v < min) {
return min; return min;

View File

@ -0,0 +1,111 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2013, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 10459 $
*
*/
package net.sourceforge.plantuml;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.DiagramDescriptionImpl;
import net.sourceforge.plantuml.core.ImageData;
public class NewpagedDiagram extends AbstractPSystem {
private final List<Diagram> diagrams = new ArrayList<Diagram>();
private NewpagedDiagram(Diagram diag1, Diagram diag2) {
if (diag1 instanceof NewpagedDiagram) {
throw new IllegalArgumentException();
}
if (diag2 instanceof NewpagedDiagram) {
throw new IllegalArgumentException();
}
this.diagrams.add(diag1);
this.diagrams.add(diag2);
}
public static NewpagedDiagram newpage(AbstractPSystem diagram, AbstractPSystem empty) {
if (diagram instanceof NewpagedDiagram) {
final NewpagedDiagram other = (NewpagedDiagram) diagram;
other.diagrams.add(empty);
return other;
}
return new NewpagedDiagram(diagram, empty);
}
public CommandExecutionResult executeCommand(Command cmd, List<String> lines) {
final int nb = diagrams.size();
return cmd.execute(diagrams.get(nb - 1), lines);
}
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
return diagrams.get(num).exportDiagram(os, 0, fileFormat);
}
public int getNbImages() {
int nb = 0;
for (Diagram d : diagrams) {
nb += d.getNbImages();
}
return nb;
}
public DiagramDescription getDescription() {
final StringBuilder sb = new StringBuilder();
for (Diagram d : diagrams) {
if (sb.length() > 0) {
sb.append(" ");
}
sb.append(d.getDescription());
}
return new DiagramDescriptionImpl(sb.toString(), getClass());
}
public String getWarningOrError() {
final StringBuilder sb = new StringBuilder();
for (Diagram d : diagrams) {
if (sb.length() > 0) {
sb.append(" ");
}
sb.append(d.getWarningOrError());
}
return sb.toString();
}
}

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,31 +28,39 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 5890 $ * Revision $Revision: 4780 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import net.sourceforge.plantuml.command.AbstractUmlSystemCommandFactory; import java.io.IOException;
import net.sourceforge.plantuml.command.CommandComment; import java.io.OutputStream;
import net.sourceforge.plantuml.command.CommandMultilinesComment;
import net.sourceforge.plantuml.command.CommandNope;
public class EmptyDiagramFactory extends AbstractUmlSystemCommandFactory { // Modified by Maxime Sinclair
public class NullOutputStream extends OutputStream {
private PSystemError system; /**
* Writes to nowhere
*/
@Override
public void write(int b) throws IOException {
// Do nothing silently
}
public PSystemError getSystem() { /**
return system; * Overridden for performance reason
} */
@Override
public void write(byte b[]) throws IOException {
// Do nothing silently
}
@Override /**
protected void initCommands() { * Overridden for performance reason
// system = new PSystemError(); */
@Override
addCommand(new CommandNope(null)); public void write(byte b[], int off, int len) throws IOException {
addCommand(new CommandComment(null)); // Do nothing silently
addCommand(new CommandMultilinesComment(null)); }
}
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 6702 $ * Revision $Revision: 12022 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
@ -89,6 +89,8 @@ public class Option {
String s = arg[i]; String s = arg[i];
if (s.equalsIgnoreCase("-tsvg") || s.equalsIgnoreCase("-svg")) { if (s.equalsIgnoreCase("-tsvg") || s.equalsIgnoreCase("-svg")) {
setFileFormat(FileFormat.SVG); setFileFormat(FileFormat.SVG);
} else if (s.equalsIgnoreCase("-thtml") || s.equalsIgnoreCase("-html")) {
setFileFormat(FileFormat.HTML);
} else if (s.equalsIgnoreCase("-txmi") || s.equalsIgnoreCase("-xmi")) { } else if (s.equalsIgnoreCase("-txmi") || s.equalsIgnoreCase("-xmi")) {
setFileFormat(FileFormat.XMI_STANDARD); setFileFormat(FileFormat.XMI_STANDARD);
} else if (s.equalsIgnoreCase("-txmi:argo") || s.equalsIgnoreCase("-xmi:argo")) { } else if (s.equalsIgnoreCase("-txmi:argo") || s.equalsIgnoreCase("-xmi:argo")) {
@ -99,15 +101,18 @@ public class Option {
setFileFormat(FileFormat.EPS); setFileFormat(FileFormat.EPS);
} else if (s.equalsIgnoreCase("-teps:text") || s.equalsIgnoreCase("-eps:text")) { } else if (s.equalsIgnoreCase("-teps:text") || s.equalsIgnoreCase("-eps:text")) {
setFileFormat(FileFormat.EPS_TEXT); setFileFormat(FileFormat.EPS_TEXT);
} else if (s.equalsIgnoreCase("-tdot") || s.equalsIgnoreCase("-dot")) {
setFileFormat(FileFormat.DOT);
OptionFlags.getInstance().setKeepTmpFiles(true);
} else if (s.equalsIgnoreCase("-ttxt") || s.equalsIgnoreCase("-txt")) { } else if (s.equalsIgnoreCase("-ttxt") || s.equalsIgnoreCase("-txt")) {
setFileFormat(FileFormat.ATXT); setFileFormat(FileFormat.ATXT);
} else if (s.equalsIgnoreCase("-tutxt") || s.equalsIgnoreCase("-utxt")) { } else if (s.equalsIgnoreCase("-tutxt") || s.equalsIgnoreCase("-utxt")) {
setFileFormat(FileFormat.UTXT); setFileFormat(FileFormat.UTXT);
} else if (s.equalsIgnoreCase("-png") || s.equalsIgnoreCase("-tpng")) {
setFileFormat(FileFormat.PNG);
} else if (s.equalsIgnoreCase("-vdx") || s.equalsIgnoreCase("-tvdx")) {
setFileFormat(FileFormat.VDX);
} else if (s.equalsIgnoreCase("-pdf") || s.equalsIgnoreCase("-tpdf")) { } else if (s.equalsIgnoreCase("-pdf") || s.equalsIgnoreCase("-tpdf")) {
setFileFormat(FileFormat.PDF); setFileFormat(FileFormat.PDF);
} else if (s.equalsIgnoreCase("-overwrite")) {
OptionFlags.getInstance().setOverwrite(true);
} else if (s.equalsIgnoreCase("-output") || s.equalsIgnoreCase("-o")) { } else if (s.equalsIgnoreCase("-output") || s.equalsIgnoreCase("-o")) {
i++; i++;
if (i == arg.length) { if (i == arg.length) {
@ -166,14 +171,9 @@ public class Option {
initConfig(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg[i])); initConfig(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg[i]));
} else if (s.equalsIgnoreCase("-computeurl") || s.equalsIgnoreCase("-encodeurl")) { } else if (s.equalsIgnoreCase("-computeurl") || s.equalsIgnoreCase("-encodeurl")) {
this.computeurl = true; this.computeurl = true;
} else if (s.startsWith("-c")) {
s = s.substring(2);
config.add(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(s));
} else if (s.startsWith("-x")) { } else if (s.startsWith("-x")) {
s = s.substring(2); s = s.substring(2);
excludes.add(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(s)); excludes.add(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(s));
} else if (s.equalsIgnoreCase("-debugdot")) {
OptionFlags.getInstance().setDebugDot(true);
} else if (s.equalsIgnoreCase("-verbose") || s.equalsIgnoreCase("-v")) { } else if (s.equalsIgnoreCase("-verbose") || s.equalsIgnoreCase("-v")) {
OptionFlags.getInstance().setVerbose(true); OptionFlags.getInstance().setVerbose(true);
} else if (s.equalsIgnoreCase("-pipe") || s.equalsIgnoreCase("-p")) { } else if (s.equalsIgnoreCase("-pipe") || s.equalsIgnoreCase("-p")) {
@ -199,16 +199,16 @@ public class Option {
} else if (s.equalsIgnoreCase("-word")) { } else if (s.equalsIgnoreCase("-word")) {
OptionFlags.getInstance().setWord(true); OptionFlags.getInstance().setWord(true);
OptionFlags.getInstance().setQuiet(true); OptionFlags.getInstance().setQuiet(true);
} else if (s.equalsIgnoreCase("-forcegd")) {
OptionFlags.getInstance().setForceGd(true);
} else if (s.equalsIgnoreCase("-forcecairo")) {
OptionFlags.getInstance().setForceCairo(true);
} else if (s.equalsIgnoreCase("-quiet")) { } else if (s.equalsIgnoreCase("-quiet")) {
OptionFlags.getInstance().setQuiet(true); OptionFlags.getInstance().setQuiet(true);
} else if (s.equalsIgnoreCase("-decodeurl")) { } else if (s.equalsIgnoreCase("-decodeurl")) {
this.decodeurl = true; this.decodeurl = true;
} else if (s.equalsIgnoreCase("-version")) { } else if (s.equalsIgnoreCase("-version")) {
OptionPrint.printVersion(); OptionPrint.printVersion();
} else if (s.matches("(?i)^-li[sc][ea]n[sc]e\\s*$")) {
OptionPrint.printLicense();
} else if (s.equalsIgnoreCase("-checkversion")) {
OptionPrint.checkVersion();
} else if (s.startsWith("-D")) { } else if (s.startsWith("-D")) {
manageDefine(s.substring(2)); manageDefine(s.substring(2));
} else if (s.startsWith("-S")) { } else if (s.startsWith("-S")) {
@ -223,6 +223,8 @@ public class Option {
OptionPrint.printLanguage(); OptionPrint.printLanguage();
} else if (s.equalsIgnoreCase("-gui")) { } else if (s.equalsIgnoreCase("-gui")) {
OptionFlags.getInstance().setGui(true); OptionFlags.getInstance().setGui(true);
} else if (s.equalsIgnoreCase("-encodesprite")) {
OptionFlags.getInstance().setEncodesprite(true);
} else if (s.equalsIgnoreCase("-nosuggestengine")) { } else if (s.equalsIgnoreCase("-nosuggestengine")) {
OptionFlags.getInstance().setUseSuggestEngine(false); OptionFlags.getInstance().setUseSuggestEngine(false);
} else if (s.equalsIgnoreCase("-failonerror")) { } else if (s.equalsIgnoreCase("-failonerror")) {
@ -236,6 +238,9 @@ public class Option {
} else { } else {
this.ftpPort = Integer.parseInt(s.substring(x + 1)); this.ftpPort = Integer.parseInt(s.substring(x + 1));
} }
} else if (s.startsWith("-c")) {
s = s.substring(2);
config.add(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(s));
} else { } else {
result.add(s); result.add(s);
} }
@ -289,7 +294,7 @@ public class Option {
} }
public final static String getPattern() { public final static String getPattern() {
return "(?i)^.*\\.(txt|tex|java|htm|html|c|h|cpp|apt)$"; return "(?i)^.*\\.(txt|tex|java|htm|html|c|h|cpp|apt|pu)$";
} }
public void setOutputDir(File f) { public void setOutputDir(File f) {

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 7231 $ * Revision $Revision: 11833 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
@ -39,13 +39,20 @@ import java.io.FileOutputStream;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
public class OptionFlags { public class OptionFlags {
static public final boolean PBBACK = false; // static public final boolean PBBACK = false;
static public final boolean GRAPHVIZCACHE = false; static public boolean GRAPHVIZCACHE = false;
static public final boolean SVEK = false; static public final boolean TRACE_DOT = false;
static public final boolean HORIZONTAL_LINE_BETWEEN_DIFFERENT_PACKAGE_ALLOWED = false;
static public boolean ALLOW_INCLUDE = true;
static public final boolean USE_HECTOR = false;
static public final boolean USE_CREOLE = true;
void reset() { void reset() {
reset(false); reset(false);
@ -57,9 +64,6 @@ public class OptionFlags {
metadata = false; metadata = false;
word = false; word = false;
systemExit = exit; systemExit = exit;
debugDot = false;
forceGd = false;
forceCairo = false;
dotExecutable = null; dotExecutable = null;
gui = false; gui = false;
quiet = false; quiet = false;
@ -67,6 +71,8 @@ public class OptionFlags {
printFonts = false; printFonts = false;
useSuggestEngine = true; useSuggestEngine = true;
failOnError = false; failOnError = false;
encodesprite = false;
// PIC_LINE = false;
} }
public boolean useJavaInsteadOfDot() { public boolean useJavaInsteadOfDot() {
@ -80,9 +86,6 @@ public class OptionFlags {
private boolean metadata; private boolean metadata;
private boolean word; private boolean word;
private boolean systemExit; private boolean systemExit;
private boolean debugDot;
private boolean forceGd;
private boolean forceCairo;
private String dotExecutable; private String dotExecutable;
private boolean gui; private boolean gui;
private boolean quiet; private boolean quiet;
@ -90,6 +93,8 @@ public class OptionFlags {
private boolean printFonts; private boolean printFonts;
private boolean useSuggestEngine; private boolean useSuggestEngine;
private boolean failOnError; private boolean failOnError;
private boolean encodesprite;
private boolean overwrite;
private File logData; private File logData;
private OptionFlags() { private OptionFlags() {
@ -140,14 +145,6 @@ public class OptionFlags {
this.systemExit = systemExit; this.systemExit = systemExit;
} }
public final boolean isDebugDot() {
return debugDot;
}
public final void setDebugDot(boolean debugDot) {
this.debugDot = debugDot;
}
public final String getDotExecutable() { public final String getDotExecutable() {
return dotExecutable; return dotExecutable;
} }
@ -164,22 +161,6 @@ public class OptionFlags {
this.gui = gui; this.gui = gui;
} }
public final boolean isForceGd() {
return forceGd;
}
public final void setForceGd(boolean forceGd) {
this.forceGd = forceGd;
}
public final boolean isForceCairo() {
return forceCairo;
}
public final void setForceCairo(boolean forceCairo) {
this.forceCairo = forceCairo;
}
public final boolean isQuiet() { public final boolean isQuiet() {
return quiet; return quiet;
} }
@ -198,8 +179,9 @@ public class OptionFlags {
private final AtomicBoolean logDataInitized = new AtomicBoolean(false); private final AtomicBoolean logDataInitized = new AtomicBoolean(false);
public void logData(File file, PSystem system) { public void logData(File file, Diagram system) {
if (system instanceof PSystemError == false) { final String warnOrError = system.getWarningOrError();
if (warnOrError == null) {
return; return;
} }
synchronized (logDataInitized) { synchronized (logDataInitized) {
@ -214,19 +196,12 @@ public class OptionFlags {
if (logData == null) { if (logData == null) {
return; return;
} }
final PSystemError systemError = (PSystemError) system; // final PSystemError systemError = (PSystemError) system;
PrintStream ps = null; PrintStream ps = null;
try { try {
ps = new PrintStream(new FileOutputStream(logData, true)); ps = new PrintStream(new FileOutputStream(logData, true));
ps.println("Start of " + file.getName()); ps.println("Start of " + file.getName());
ps.println(systemError.getDescription()); ps.println(warnOrError);
for (CharSequence t : systemError.getTitle()) {
ps.println(t);
}
systemError.print(ps);
for (String s : systemError.getSuggest()) {
ps.println(s);
}
ps.println("End of " + file.getName()); ps.println("End of " + file.getName());
ps.println(); ps.println();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
@ -240,6 +215,17 @@ public class OptionFlags {
} }
} }
// public static void logErrorFile(final PSystemError systemError, PrintStream ps) {
// ps.println(systemError.getDescription());
// for (CharSequence t : systemError.getTitle()) {
// ps.println(t);
// }
// systemError.print(ps);
// for (String s : systemError.getSuggest()) {
// ps.println(s);
// }
// }
public final void setLogData(File logData) { public final void setLogData(File logData) {
this.logData = logData; this.logData = logData;
logData.delete(); logData.delete();
@ -281,4 +267,20 @@ public class OptionFlags {
this.failOnError = failOnError; this.failOnError = failOnError;
} }
public final boolean isEncodesprite() {
return encodesprite;
}
public final void setEncodesprite(boolean encodesprite) {
this.encodesprite = encodesprite;
}
public final boolean isOverwrite() {
return overwrite;
}
public final void setOverwrite(boolean overwrite) {
this.overwrite = overwrite;
}
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 6626 $ * Revision $Revision: 11786 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
@ -39,13 +39,16 @@ import java.util.Date;
import java.util.Properties; import java.util.Properties;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
import net.sourceforge.plantuml.syntax.LanguageDescriptor;
import net.sourceforge.plantuml.version.License;
import net.sourceforge.plantuml.version.PSystemVersion;
import net.sourceforge.plantuml.version.Version; import net.sourceforge.plantuml.version.Version;
public class OptionPrint { public class OptionPrint {
static public void printTestDot() throws InterruptedException { static public void printTestDot() throws InterruptedException {
for (String s : GraphvizUtils.getTestDotStrings(false)) { for (String s : GraphvizUtils.getTestDotStrings(false)) {
System.err.println(s); System.out.println(s);
} }
exit(); exit();
} }
@ -54,54 +57,58 @@ public class OptionPrint {
final String charset = Charset.defaultCharset().displayName(); final String charset = Charset.defaultCharset().displayName();
System.err.println("Usage: java -jar plantuml.jar [options] -gui"); System.out.println("Usage: java -jar plantuml.jar [options] -gui");
System.err.println("\t(to execute the GUI)"); System.out.println("\t(to execute the GUI)");
System.err.println(" or java -jar plantuml.jar [options] [file/dir] [file/dir] [file/dir]"); System.out.println(" or java -jar plantuml.jar [options] [file/dir] [file/dir] [file/dir]");
System.err.println("\t(to process files or directories)"); System.out.println("\t(to process files or directories)");
System.err.println(); System.out.println();
System.err.println("You can use the following wildcards in files/dirs:"); System.out.println("You can use the following wildcards in files/dirs:");
System.err.println("\t*\tmeans any characters but '" + File.separator + "'"); System.out.println("\t*\tmeans any characters but '" + File.separator + "'");
System.err.println("\t?\tone and only one character but '" + File.separator + "'"); System.out.println("\t?\tone and only one character but '" + File.separator + "'");
System.err.println("\t**\tmeans any characters (used to recurse through directories)"); System.out.println("\t**\tmeans any characters (used to recurse through directories)");
System.err.println(); System.out.println();
System.err.println("where options include:"); System.out.println("where options include:");
System.err.println(" -gui\t\tTo run the graphical user interface"); System.out.println(" -gui\t\tTo run the graphical user interface");
System.err.println(" -tsvg\t\tTo generate images using SVG format"); System.out.println(" -tpng\t\tTo generate images using PNG format (default)");
System.err.println(" -teps\t\tTo generate images using EPS format"); System.out.println(" -tsvg\t\tTo generate images using SVG format");
System.err.println(" -txmi\t\tTo generate XMI file for classes diagrams"); System.out.println(" -teps\t\tTo generate images using EPS format");
System.err.println(" -tdot\t\tTo generate DOT intermediate file"); System.out.println(" -txmi\t\tTo generate XMI file for class diagram");
System.err.println(" -ttxt\t\tTo generate images with ASCII art"); System.out.println(" -thtml\t\tTo generate HTML files for class diagram");
System.err.println(" -tutxt\t\tTo generate images with ASCII art using Unicode characters"); System.out.println(" -ttxt\t\tTo generate images with ASCII art");
System.err.println(" -o[utput] \"dir\"\tTo generate images in the specified directory"); System.out.println(" -tutxt\t\tTo generate images with ASCII art using Unicode characters");
System.err.println(" -DVAR1=value\tTo set a preprocessing variable as if '!define VAR1 value' were used"); System.out.println(" -o[utput] \"dir\"\tTo generate images in the specified directory");
System.err.println(" -Sparam1=value\tTo set a skin parameter as if 'skinparam param1 value' were used"); System.out.println(" -DVAR1=value\tTo set a preprocessing variable as if '!define VAR1 value' were used");
System.err.println(" -config \"file\"\tTo read the provided config file before each diagram"); System.out.println(" -Sparam1=value\tTo set a skin parameter as if 'skinparam param1 value' were used");
System.err.println(" -charset xxx\tTo use a specific charset (default is " + charset + ")"); System.out.println(" -config \"file\"\tTo read the provided config file before each diagram");
System.err.println(" -e[x]clude pattern\tTo exclude files that match the provided pattern"); System.out.println(" -charset xxx\tTo use a specific charset (default is " + charset + ")");
System.err.println(" -metadata\t\tTo retrieve PlantUML sources from PNG images"); System.out.println(" -e[x]clude pattern\tTo exclude files that match the provided pattern");
System.err.println(" -version\t\tTo display information about PlantUML and Java versions"); System.out.println(" -metadata\t\tTo retrieve PlantUML sources from PNG images");
System.err.println(" -v[erbose]\t\tTo have log information"); System.out.println(" -version\t\tTo display information about PlantUML and Java versions");
System.err.println(" -quiet\t\tTo NOT print error message into the console"); System.out.println(" -checkversion\tTo check if a newer version is available for download");
System.err.println(" -forcegd\t\tTo force dot to use GD PNG library"); System.out.println(" -v[erbose]\t\tTo have log information");
System.err.println(" -forcecairo\t\tTo force dot to use Cairo PNG library"); System.out.println(" -quiet\t\tTo NOT print error message into the console");
System.err.println(" -keepfiles\t\tTo NOT delete temporary files after process"); // Log.println(" -forcegd\t\tTo force dot to use GD PNG library");
System.err.println(" -h[elp]\t\tTo display this help message"); // Log.println(" -forcecairo\t\tTo force dot to use Cairo PNG library");
System.err.println(" -testdot\t\tTo test the installation of graphviz"); System.out.println(" -keepfiles\t\tTo NOT delete temporary files after process");
System.err.println(" -graphvizdot \"exe\"\tTo specify dot executable"); System.out.println(" -h[elp]\t\tTo display this help message");
System.err.println(" -p[ipe]\t\tTo use stdin for PlantUML source and stdout for PNG/SVG/EPS generation"); System.out.println(" -testdot\t\tTo test the installation of graphviz");
System.err.println(" -computeurl\t\tTo compute the encoded URL of a PlantUML source file"); System.out.println(" -graphvizdot \"exe\"\tTo specify dot executable");
System.err.println(" -decodeurl\t\tTo retrieve the PlantUML source from an encoded URL"); System.out.println(" -p[ipe]\t\tTo use stdin for PlantUML source and stdout for PNG/SVG/EPS generation");
System.err.println(" -syntax\t\tTo report any syntax error from standard input without generating images"); System.out.println(" -computeurl\t\tTo compute the encoded URL of a PlantUML source file");
System.err.println(" -language\t\tTo print the list of PlantUML keywords"); System.out.println(" -decodeurl\t\tTo retrieve the PlantUML source from an encoded URL");
System.err.println(" -nosuggestengine\tTo disable the suggest engine when errors in diagrams"); System.out.println(" -syntax\t\tTo report any syntax error from standard input without generating images");
System.err.println(" -checkonly\t\tTo check the syntax of files without generating images"); System.out.println(" -language\t\tTo print the list of PlantUML keywords");
System.err.println(" -failonerror\tTo stop processing if syntax error in diagram occurs"); System.out.println(" -nosuggestengine\tTo disable the suggest engine when errors in diagrams");
System.err.println(" -pattern\t\tTo print the list of Regular Expression used by PlantUML"); System.out.println(" -checkonly\t\tTo check the syntax of files without generating images");
System.err.println(" -duration\t\tTo print the duration of complete diagrams processing"); System.out.println(" -failonerror\tTo stop processing if syntax error in diagram occurs");
System.err.println(" -nbthread N\tTo use (N) threads for processing"); System.out.println(" -pattern\t\tTo print the list of Regular Expression used by PlantUML");
System.err.println(" -nbthread auto\tTo use " + Option.defaultNbThreads() + " threads for processing"); System.out.println(" -duration\t\tTo print the duration of complete diagrams processing");
System.err.println(); System.out.println(" -nbthread N\t\tTo use (N) threads for processing");
System.err.println("If needed, you can setup the environment variable GRAPHVIZ_DOT."); System.out.println(" -nbthread auto\tTo use " + Option.defaultNbThreads() + " threads for processing");
System.out.println(" -author[s]\t\tTo print information about PlantUML authors");
System.out.println(" -overwrite\t\tTo all to overwrite read only files");
System.out.println();
System.out.println("If needed, you can setup the environment variable GRAPHVIZ_DOT.");
exit(); exit();
} }
@ -112,25 +119,66 @@ public class OptionPrint {
throw new InterruptedException("exit"); throw new InterruptedException("exit");
} }
public static void printLicense() throws InterruptedException {
for (String s : License.getCurrent().getText()) {
System.out.println(s);
}
exit();
}
public static void printVersion() throws InterruptedException { public static void printVersion() throws InterruptedException {
System.err.println("PlantUML version " + Version.version() + " (" + new Date(Version.compileTime()) + ")"); System.out
.println("PlantUML version " + Version.versionString() + " (" + new Date(Version.compileTime()) + ")");
System.out.println("(" + License.getCurrent() + " source distribution)");
final Properties p = System.getProperties(); final Properties p = System.getProperties();
System.err.println(p.getProperty("java.runtime.name")); System.out.println(p.getProperty("java.runtime.name"));
System.err.println(p.getProperty("java.vm.name")); System.out.println(p.getProperty("java.vm.name"));
System.err.println(p.getProperty("java.runtime.version")); System.out.println(p.getProperty("java.runtime.version"));
System.err.println(p.getProperty("os.name")); System.out.println(p.getProperty("os.name"));
System.out.println();
for (String s : GraphvizUtils.getTestDotStrings(false)) {
System.out.println(s);
}
exit();
}
public static void checkVersion() throws InterruptedException {
System.out
.println("PlantUML version " + Version.versionString() + " (" + new Date(Version.compileTime()) + ")");
System.out.println();
final int lastversion = PSystemVersion.extractDownloadableVersion(null, null);
if (lastversion == -1) {
System.out.println("Error");
System.out.println("Cannot connect to http://plantuml.sourceforge.net/");
System.out.println("Maybe you should set your proxy ?");
} else if (lastversion == 0) {
System.out.println("Error");
System.out.println("Cannot retrieve last version from http://plantuml.sourceforge.net/");
} else {
System.out.println("Last available version for download : " + lastversion);
System.out.println();
if (Version.version() >= lastversion) {
System.out.println("Your version is up to date.");
} else {
System.out.println("A newer version is available for download.");
}
}
exit(); exit();
} }
public static void printAbout() throws InterruptedException { public static void printAbout() throws InterruptedException {
System.err.println("PlantUML version " + Version.version() + " (" + new Date(Version.compileTime()) + ")"); // Duplicate in PSystemVersion
System.err.println(); System.out
System.err.println("Original idea: Arnaud Roques"); .println("PlantUML version " + Version.versionString() + " (" + new Date(Version.compileTime()) + ")");
System.err.println("Word Macro: Alain Bertucat & Matthieu Sabatier"); System.out.println();
System.err.println("Eclipse Plugin: Claude Durif & Anne Pecoil"); System.out.println("Original idea: Arnaud Roques");
System.err.println("Site design: Raphael Cotisson"); System.out.println("Word Macro: Alain Bertucat & Matthieu Sabatier");
System.err.println(); System.out.println("Eclipse Plugin: Claude Durif & Anne Pecoil");
System.err.println("http://plantuml.sourceforge.net"); System.out.println("Servlet & XWiki: Maxime Sinclair");
System.out.println("Site design: Raphael Cotisson");
System.out.println();
System.out.println("http://plantuml.sourceforge.net");
exit(); exit();
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -33,50 +33,63 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.acearth.PSystemXearthFactory; import net.sourceforge.plantuml.acearth.PSystemXearthFactory;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory; import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory;
import net.sourceforge.plantuml.activitydiagram2.ActivityDiagramFactory2; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagramFactory3;
import net.sourceforge.plantuml.api.PSystemFactory;
import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory; import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory;
import net.sourceforge.plantuml.componentdiagram.ComponentDiagramFactory;
import net.sourceforge.plantuml.compositediagram.CompositeDiagramFactory; import net.sourceforge.plantuml.compositediagram.CompositeDiagramFactory;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.creole.PSystemCreoleFactory;
import net.sourceforge.plantuml.descdiagram.DescriptionDiagramFactory;
import net.sourceforge.plantuml.directdot.PSystemDotFactory; import net.sourceforge.plantuml.directdot.PSystemDotFactory;
import net.sourceforge.plantuml.ditaa.PSystemDitaaFactory; import net.sourceforge.plantuml.ditaa.PSystemDitaaFactory;
import net.sourceforge.plantuml.donors.PSystemDonorsFactory;
import net.sourceforge.plantuml.eggs.PSystemAppleTwoFactory;
import net.sourceforge.plantuml.eggs.PSystemEggFactory; import net.sourceforge.plantuml.eggs.PSystemEggFactory;
import net.sourceforge.plantuml.eggs.PSystemLostFactory; import net.sourceforge.plantuml.eggs.PSystemLostFactory;
import net.sourceforge.plantuml.eggs.PSystemPathFactory; import net.sourceforge.plantuml.eggs.PSystemPathFactory;
import net.sourceforge.plantuml.eggs.PSystemRIPFactory; import net.sourceforge.plantuml.eggs.PSystemRIPFactory;
import net.sourceforge.plantuml.flowdiagram.FlowDiagramFactory;
import net.sourceforge.plantuml.font.PSystemListFontsFactory;
import net.sourceforge.plantuml.jcckit.PSystemJcckitFactory; import net.sourceforge.plantuml.jcckit.PSystemJcckitFactory;
import net.sourceforge.plantuml.logo.PSystemLogoFactory;
import net.sourceforge.plantuml.objectdiagram.ObjectDiagramFactory; import net.sourceforge.plantuml.objectdiagram.ObjectDiagramFactory;
import net.sourceforge.plantuml.oregon.PSystemOregonFactory; import net.sourceforge.plantuml.oregon.PSystemOregonFactory;
import net.sourceforge.plantuml.postit.PostIdDiagramFactory; import net.sourceforge.plantuml.postit.PostIdDiagramFactory;
import net.sourceforge.plantuml.printskin.PrintSkinFactory; import net.sourceforge.plantuml.printskin.PrintSkinFactory;
import net.sourceforge.plantuml.project.PSystemProjectFactory; import net.sourceforge.plantuml.project2.PSystemProjectFactory2;
import net.sourceforge.plantuml.salt.PSystemSaltFactory; import net.sourceforge.plantuml.salt.PSystemSaltFactory;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory; import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory;
import net.sourceforge.plantuml.statediagram.StateDiagramFactory; import net.sourceforge.plantuml.statediagram.StateDiagramFactory;
import net.sourceforge.plantuml.sudoku.PSystemSudokuFactory; import net.sourceforge.plantuml.sudoku.PSystemSudokuFactory;
import net.sourceforge.plantuml.usecasediagram.UsecaseDiagramFactory; import net.sourceforge.plantuml.turing.PSystemTuringFactory;
import net.sourceforge.plantuml.version.License;
import net.sourceforge.plantuml.version.PSystemLicenseFactory;
import net.sourceforge.plantuml.version.PSystemVersionFactory; import net.sourceforge.plantuml.version.PSystemVersionFactory;
public class PSystemBuilder { public class PSystemBuilder {
final public PSystem createPSystem(final List<String> strings) throws IOException, InterruptedException { final public Diagram createPSystem(final List<? extends CharSequence> strings) {
final List<PSystemFactory> factories = getAllFactories(); final List<PSystemFactory> factories = getAllFactories();
final UmlSource umlSource = new UmlSource(strings); final DiagramType type = DiagramType.getTypeFromArobaseStart(strings.get(0).toString());
final UmlSource umlSource = new UmlSource(strings, type == DiagramType.UML);
final DiagramType diagramType = umlSource.getDiagramType(); final DiagramType diagramType = umlSource.getDiagramType();
final List<PSystemError> errors = new ArrayList<PSystemError>(); final List<PSystemError> errors = new ArrayList<PSystemError>();
for (PSystemFactory systemFactory : factories) { for (PSystemFactory systemFactory : factories) {
if (diagramType != systemFactory.getDiagramType()) { if (diagramType != systemFactory.getDiagramType()) {
continue; continue;
} }
final PSystem sys = new PSystemSingleBuilder(umlSource, systemFactory).getPSystem(); final Diagram sys = systemFactory.createSystem(umlSource);
if (isOk(sys)) { if (isOk(sys)) {
return sys; return sys;
} }
@ -84,9 +97,9 @@ public class PSystemBuilder {
} }
final PSystemError err = merge(errors); final PSystemError err = merge(errors);
if (OptionFlags.getInstance().isQuiet() == false) { // if (OptionFlags.getInstance().isQuiet() == false) {
err.print(System.err); // err.print(System.err);
} // }
return err; return err;
} }
@ -96,32 +109,42 @@ public class PSystemBuilder {
factories.add(new SequenceDiagramFactory()); factories.add(new SequenceDiagramFactory());
factories.add(new ClassDiagramFactory()); factories.add(new ClassDiagramFactory());
factories.add(new ActivityDiagramFactory()); factories.add(new ActivityDiagramFactory());
factories.add(new ActivityDiagramFactory2()); factories.add(new DescriptionDiagramFactory());
factories.add(new UsecaseDiagramFactory());
factories.add(new ComponentDiagramFactory());
factories.add(new StateDiagramFactory()); factories.add(new StateDiagramFactory());
factories.add(new ActivityDiagramFactory2()); factories.add(new ActivityDiagramFactory3());
factories.add(new CompositeDiagramFactory()); factories.add(new CompositeDiagramFactory());
factories.add(new ObjectDiagramFactory()); factories.add(new ObjectDiagramFactory());
factories.add(new PostIdDiagramFactory()); factories.add(new PostIdDiagramFactory());
factories.add(new PrintSkinFactory()); factories.add(new PrintSkinFactory());
factories.add(new PSystemLicenseFactory());
factories.add(new PSystemVersionFactory()); factories.add(new PSystemVersionFactory());
factories.add(new PSystemDonorsFactory());
factories.add(new PSystemListFontsFactory());
factories.add(new PSystemSaltFactory(DiagramType.SALT)); factories.add(new PSystemSaltFactory(DiagramType.SALT));
factories.add(new PSystemSaltFactory(DiagramType.UML)); factories.add(new PSystemSaltFactory(DiagramType.UML));
factories.add(new PSystemDotFactory(DiagramType.DOT)); factories.add(new PSystemDotFactory(DiagramType.DOT));
factories.add(new PSystemDotFactory(DiagramType.UML)); factories.add(new PSystemDotFactory(DiagramType.UML));
factories.add(new PSystemDitaaFactory(DiagramType.DITAA)); if (License.getCurrent() == License.GPL) {
factories.add(new PSystemDitaaFactory(DiagramType.UML)); factories.add(new PSystemDitaaFactory(DiagramType.DITAA));
factories.add(new PSystemJcckitFactory(DiagramType.JCCKIT)); factories.add(new PSystemDitaaFactory(DiagramType.UML));
factories.add(new PSystemJcckitFactory(DiagramType.UML)); factories.add(new PSystemJcckitFactory(DiagramType.JCCKIT));
factories.add(new PSystemSudokuFactory()); factories.add(new PSystemJcckitFactory(DiagramType.UML));
factories.add(new PSystemLogoFactory());
factories.add(new PSystemSudokuFactory());
factories.add(new PSystemTuringFactory());
}
factories.add(new PSystemCreoleFactory());
factories.add(new PSystemEggFactory()); factories.add(new PSystemEggFactory());
factories.add(new PSystemAppleTwoFactory());
factories.add(new PSystemRIPFactory()); factories.add(new PSystemRIPFactory());
factories.add(new PSystemLostFactory()); factories.add(new PSystemLostFactory());
factories.add(new PSystemPathFactory()); factories.add(new PSystemPathFactory());
factories.add(new PSystemOregonFactory()); factories.add(new PSystemOregonFactory());
factories.add(new PSystemXearthFactory()); if (License.getCurrent() == License.GPL) {
factories.add(new PSystemProjectFactory()); factories.add(new PSystemXearthFactory());
}
factories.add(new PSystemProjectFactory2());
factories.add(new FlowDiagramFactory());
return factories; return factories;
} }
@ -140,7 +163,7 @@ public class PSystemBuilder {
return new PSystemError(source, errors); return new PSystemError(source, errors);
} }
private boolean isOk(PSystem ps) { private boolean isOk(Diagram ps) {
if (ps == null || ps instanceof PSystemError) { if (ps == null || ps instanceof PSystemError) {
return false; return false;
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 6622 $ * Revision $Revision: 12053 $
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
@ -41,6 +41,10 @@ import java.util.Collections;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.DiagramDescriptionImpl;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.GraphicStrings;
public class PSystemError extends AbstractPSystem { public class PSystemError extends AbstractPSystem {
@ -76,13 +80,9 @@ public class PSystemError extends AbstractPSystem {
this(source, Collections.singletonList(singleError)); this(source, Collections.singletonList(singleError));
} }
public void exportDiagram(OutputStream os, StringBuilder cmap, int index, FileFormatOption fileFormat) public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
throws IOException { final GraphicStrings result = new GraphicStrings(htmlStrings);
getPngError().writeImage(os, getMetadata(), fileFormat); return result.exportDiagram(os, getMetadata(), fileFormat);
}
public GraphicStrings getPngError() throws IOException {
return new GraphicStrings(htmlStrings);
} }
private void appendSource(int position) { private void appendSource(int position) {
@ -186,11 +186,11 @@ public class PSystemError extends AbstractPSystem {
return result; return result;
} }
public String getDescription() { public DiagramDescription getDescription() {
return "(Error)"; return new DiagramDescriptionImpl("(Error)", getClass());
} }
public void print(PrintStream ps) { private void print(PrintStream ps) {
synchronized (ps) { synchronized (ps) {
for (String s : plainStrings) { for (String s : plainStrings) {
ps.println(StringUtils.showComparatorCharacters(s)); ps.println(StringUtils.showComparatorCharacters(s));
@ -205,4 +205,21 @@ public class PSystemError extends AbstractPSystem {
public final Collection<ErrorUml> getErrorsUml() { public final Collection<ErrorUml> getErrorsUml() {
return Collections.unmodifiableCollection(printedErrors); return Collections.unmodifiableCollection(printedErrors);
} }
@Override
public String getWarningOrError() {
final StringBuilder sb = new StringBuilder();
sb.append(getDescription());
sb.append('\n');
for (CharSequence t : getTitle()) {
sb.append(t);
sb.append('\n');
}
sb.append('\n');
for (String s : getSuggest()) {
sb.append(s);
sb.append('\n');
}
return sb.toString();
}
} }

View File

@ -1,225 +0,0 @@
/* ========================================================================
* 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;
import java.io.IOException;
import java.util.ArrayList;
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;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.command.ProtectedCommand;
import net.sourceforge.plantuml.suggest.SuggestEngine;
import net.sourceforge.plantuml.suggest.SuggestEngineResult;
import net.sourceforge.plantuml.suggest.SuggestEngineStatus;
final public class PSystemSingleBuilder {
private final Iterator<String> it;
private final UmlSource source;
private final String startLine;
private int nb = 0;
private AbstractPSystem sys;
private boolean hasNext() {
return it.hasNext();
}
private String next() {
nb++;
return it.next();
}
public PSystem getPSystem() {
return sys;
}
public PSystemSingleBuilder(UmlSource s, PSystemFactory systemFactory) throws IOException {
this.source = s;
it = s.iterator();
startLine = next();
if (StartUtils.isArobaseStartDiagram(startLine) == false) {
throw new UnsupportedOperationException();
}
if (s.isEmpty()) {
sys = buildEmptyError();
} else if (systemFactory instanceof PSystemCommandFactory) {
executeUmlCommand((PSystemCommandFactory) systemFactory);
} else if (systemFactory instanceof PSystemBasicFactory) {
executeUmlBasic((PSystemBasicFactory) systemFactory);
}
}
private void executeUmlBasic(PSystemBasicFactory systemFactory) throws IOException {
systemFactory.init(startLine);
while (hasNext()) {
final String s = next();
if (StartUtils.isArobaseEndDiagram(s)) {
if (source.getSize() == 2) {
assert false;
sys = buildEmptyError();
} else {
sys = (AbstractPSystem) systemFactory.getSystem();
}
if (sys == null) {
return;
}
sys.setSource(source);
return;
}
final boolean ok = systemFactory.executeLine(s);
if (ok == false) {
sys = new PSystemError(source, new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", nb - 1));
return;
}
}
sys = (AbstractPSystem) systemFactory.getSystem();
sys.setSource(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;
}
private void executeUmlCommand(PSystemCommandFactory systemFactory) throws IOException {
systemFactory.init(startLine);
while (hasNext()) {
final String s = next();
if (StartUtils.isArobaseEndDiagram(s)) {
final String err = ((AbstractUmlSystemCommandFactory) systemFactory).checkFinalError();
if (err != null) {
sys = buildEmptyError(err);
}
if (source.getSize() == 2) {
assert false;
sys = buildEmptyError();
} else {
sys = (AbstractPSystem) systemFactory.getSystem();
}
if (sys == null) {
return;
}
sys.setSource(source);
return;
}
final CommandControl commandControl = systemFactory.isValid(Arrays.asList(s));
if (commandControl == CommandControl.NOT_OK) {
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", nb - 1);
if (OptionFlags.getInstance().isUseSuggestEngine()) {
final SuggestEngine engine = new SuggestEngine(source, systemFactory);
final SuggestEngineResult result = engine.tryToSuggest();
if (result.getStatus() == SuggestEngineStatus.ONE_SUGGESTION) {
err.setSuggest(result);
}
}
sys = new PSystemError(source, err);
return;
} else if (commandControl == CommandControl.OK_PARTIAL) {
final boolean ok = manageMultiline(systemFactory, s);
if (ok == false) {
sys = new PSystemError(source, new ErrorUml(ErrorUmlType.EXECUTION_ERROR, "Syntax Error?", nb - 1));
return;
}
} else if (commandControl == CommandControl.OK) {
final Command cmd = new ProtectedCommand(systemFactory.createCommand(Arrays.asList(s)));
final CommandExecutionResult result = cmd.execute(Arrays.asList(s));
if (result.isOk() == false) {
sys = new PSystemError(source,
new ErrorUml(ErrorUmlType.EXECUTION_ERROR, result.getError(), nb - 1));
return;
}
testDeprecated(Arrays.asList(s), cmd);
} else {
assert false;
}
}
sys = (AbstractPSystem) systemFactory.getSystem();
sys.setSource(source);
}
private void testDeprecated(final List<String> lines, final Command cmd) {
if (cmd.isDeprecated(lines)) {
Log.error("The following syntax is deprecated :");
for (String s : lines) {
Log.error(s);
}
final String msg = cmd.getHelpMessageForDeprecated(lines);
if (msg != null) {
Log.error("Use instead :");
Log.error(msg);
}
}
}
private boolean manageMultiline(PSystemCommandFactory systemFactory, final String init) throws IOException {
final List<String> lines = new ArrayList<String>();
lines.add(init);
while (hasNext()) {
final String s = next();
if (StartUtils.isArobaseEndDiagram(s)) {
return false;
}
lines.add(s);
final CommandControl commandControl = systemFactory.isValid(lines);
if (commandControl == CommandControl.NOT_OK) {
// throw new IllegalStateException();
return false;
}
if (commandControl == CommandControl.OK) {
final Command cmd = systemFactory.createCommand(lines);
testDeprecated(lines, cmd);
return cmd.execute(lines).isOk();
}
}
return false;
}
}

View File

@ -0,0 +1,230 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2013, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 9997 $
*
*/
package net.sourceforge.plantuml;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.html.CucaDiagramHtmlMaker;
import net.sourceforge.plantuml.png.PngSplitter;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
public class PSystemUtils {
public static List<File> exportDiagrams(Diagram system, File suggestedFile, FileFormatOption fileFormatOption)
throws IOException {
if (system instanceof NewpagedDiagram) {
return exportDiagramsNewpaged((NewpagedDiagram) system, suggestedFile, fileFormatOption);
}
if (system instanceof SequenceDiagram) {
return exportDiagramsSequence((SequenceDiagram) system, suggestedFile, fileFormatOption);
}
if (system instanceof CucaDiagram) {
return exportDiagramsCuca((CucaDiagram) system, suggestedFile, fileFormatOption);
}
if (system instanceof ActivityDiagram3) {
return exportDiagramsActivityDiagram3((ActivityDiagram3) system, suggestedFile, fileFormatOption);
}
return exportDiagramsDefault(system, suggestedFile, fileFormatOption);
}
private static List<File> exportDiagramsNewpaged(NewpagedDiagram system, File suggestedFile,
FileFormatOption fileFormat) throws IOException {
final List<File> result = new ArrayList<File>();
final int nbImages = system.getNbImages();
for (int i = 0; i < nbImages; i++) {
final File f = fileFormat.getFileFormat().computeFilename(suggestedFile, i);
if (canFileBeWritten(f) == false) {
return result;
}
final OutputStream fos = new BufferedOutputStream(new FileOutputStream(f));
// ImageData cmap = null;
try {
/* cmap = */system.exportDiagram(fos, i, fileFormat);
} finally {
fos.close();
}
// if (system.hasUrl() && cmap != null && cmap.containsCMapData()) {
// system.exportCmap(suggestedFile, cmap);
// }
Log.info("File size : " + f.length());
result.add(f);
}
return result;
}
public static boolean canFileBeWritten(final File f) {
Log.info("Creating file: " + f);
if (f.exists() && f.canWrite() == false) {
if (OptionFlags.getInstance().isOverwrite()) {
Log.info("Overwrite " + f);
f.setWritable(true);
f.delete();
return true;
}
Log.error("Cannot write to file " + f);
return false;
}
return true;
}
static private List<File> exportDiagramsDefault(Diagram system, File suggestedFile, FileFormatOption fileFormat)
throws IOException {
if (suggestedFile.exists() && suggestedFile.isDirectory()) {
throw new IllegalArgumentException("File is a directory " + suggestedFile);
}
OutputStream os = null;
try {
if (canFileBeWritten(suggestedFile) == false) {
return Collections.emptyList();
}
os = new BufferedOutputStream(new FileOutputStream(suggestedFile));
// system.exportDiagram(os, null, 0, fileFormat);
system.exportDiagram(os, 0, fileFormat);
} finally {
if (os != null) {
os.close();
}
}
return Arrays.asList(suggestedFile);
}
static private List<File> exportDiagramsActivityDiagram3(ActivityDiagram3 system, File suggestedFile,
FileFormatOption fileFormat) throws IOException {
if (suggestedFile.exists() && suggestedFile.isDirectory()) {
throw new IllegalArgumentException("File is a directory " + suggestedFile);
}
OutputStream os = null;
ImageData cmap = null;
try {
if (canFileBeWritten(suggestedFile) == false) {
return Collections.emptyList();
}
os = new BufferedOutputStream(new FileOutputStream(suggestedFile));
cmap = system.exportDiagram(os, 0, fileFormat);
} finally {
if (os != null) {
os.close();
}
}
if (system.hasUrl() && cmap != null && cmap.containsCMapData()) {
system.exportCmap(suggestedFile, cmap);
}
return Arrays.asList(suggestedFile);
}
private static List<File> exportDiagramsSequence(SequenceDiagram system, File suggestedFile,
FileFormatOption fileFormat) throws IOException {
final List<File> result = new ArrayList<File>();
final int nbImages = system.getNbImages();
for (int i = 0; i < nbImages; i++) {
final File f = fileFormat.getFileFormat().computeFilename(suggestedFile, i);
if (canFileBeWritten(suggestedFile) == false) {
return result;
}
final OutputStream fos = new BufferedOutputStream(new FileOutputStream(f));
ImageData cmap = null;
try {
cmap = system.exportDiagram(fos, i, fileFormat);
} finally {
fos.close();
}
if (system.hasUrl() && cmap != null && cmap.containsCMapData()) {
system.exportCmap(suggestedFile, cmap);
}
Log.info("File size : " + f.length());
result.add(f);
}
return result;
}
static public List<File> exportDiagramsCuca(CucaDiagram system, File suggestedFile, FileFormatOption fileFormat)
throws IOException {
if (suggestedFile.exists() && suggestedFile.isDirectory()) {
throw new IllegalArgumentException("File is a directory " + suggestedFile);
}
if (fileFormat.getFileFormat() == FileFormat.HTML) {
return createFilesHtml(system, suggestedFile);
}
ImageData cmap = null;
OutputStream os = null;
try {
if (canFileBeWritten(suggestedFile) == false) {
return Collections.emptyList();
}
os = new BufferedOutputStream(new FileOutputStream(suggestedFile));
cmap = system.exportDiagram(os, 0, fileFormat);
} finally {
if (os != null) {
os.close();
}
}
List<File> result = Arrays.asList(suggestedFile);
if (system.hasUrl() && cmap != null && cmap.containsCMapData()) {
system.exportCmap(suggestedFile, cmap);
}
if (fileFormat.getFileFormat() == FileFormat.PNG) {
result = new PngSplitter(suggestedFile, system.getHorizontalPages(), system.getVerticalPages(),
system.getMetadata(), system.getDpi(fileFormat), fileFormat.isWithMetadata()).getFiles();
}
return result;
}
private static List<File> createFilesHtml(CucaDiagram system, File suggestedFile) throws IOException {
final String name = suggestedFile.getName();
final int idx = name.lastIndexOf('.');
final File dir = new File(suggestedFile.getParentFile(), name.substring(0, idx));
final CucaDiagramHtmlMaker maker = new CucaDiagramHtmlMaker(system, dir);
return maker.create();
}
}

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -45,7 +45,7 @@ public class Pragma {
public void define(String name, String value) { public void define(String name, String value) {
values.put(name, value); values.put(name, value);
if (name.equalsIgnoreCase("graphviz_dot")) { if (name.equalsIgnoreCase("graphviz_dot")) {
OptionFlags.getInstance().setDotExecutable(value); OptionFlags.getInstance().setDotExecutable(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(value));
} }
} }
@ -58,11 +58,7 @@ public class Pragma {
} }
public String getValue(String name) { public String getValue(String name) {
final String result = values.get(name); return values.get(name);
if (result == null) {
throw new IllegalArgumentException();
}
return result;
} }
protected Set<Map.Entry<String, String>> entrySet() { protected Set<Map.Entry<String, String>> entrySet() {

View File

@ -0,0 +1,40 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2013, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 3835 $
*
*/
package net.sourceforge.plantuml;
public interface Removeable {
public boolean isRemoved();
}

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,13 +28,14 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 6750 $ * Revision $Revision: 12023 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import java.awt.Font; import java.awt.Font;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
import java.awt.image.BufferedImage;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -43,18 +44,19 @@ import java.io.PrintStream;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import javax.imageio.ImageIO;
import javax.swing.UIManager; import javax.swing.UIManager;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory; import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory;
import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory; import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory;
import net.sourceforge.plantuml.code.Transcoder; import net.sourceforge.plantuml.code.Transcoder;
import net.sourceforge.plantuml.code.TranscoderUtil; import net.sourceforge.plantuml.code.TranscoderUtil;
import net.sourceforge.plantuml.command.AbstractUmlSystemCommandFactory; import net.sourceforge.plantuml.command.UmlDiagramFactory;
import net.sourceforge.plantuml.componentdiagram.ComponentDiagramFactory; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.descdiagram.DescriptionDiagramFactory;
import net.sourceforge.plantuml.ftp.FtpServer; import net.sourceforge.plantuml.ftp.FtpServer;
import net.sourceforge.plantuml.objectdiagram.ObjectDiagramFactory; import net.sourceforge.plantuml.objectdiagram.ObjectDiagramFactory;
import net.sourceforge.plantuml.png.MetadataTag; import net.sourceforge.plantuml.png.MetadataTag;
@ -62,16 +64,29 @@ import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory; import net.sourceforge.plantuml.sequencediagram.SequenceDiagramFactory;
import net.sourceforge.plantuml.statediagram.StateDiagramFactory; import net.sourceforge.plantuml.statediagram.StateDiagramFactory;
import net.sourceforge.plantuml.swing.MainWindow2; import net.sourceforge.plantuml.swing.MainWindow2;
import net.sourceforge.plantuml.usecasediagram.UsecaseDiagramFactory; import net.sourceforge.plantuml.ugraphic.SpriteGrayLevel;
import net.sourceforge.plantuml.ugraphic.SpriteUtils;
import net.sourceforge.plantuml.version.Version;
public class Run { public class Run {
public static void main(String[] argsArray) throws IOException, InterruptedException { public static void main(String[] argsArray) throws IOException, InterruptedException {
final long start = System.currentTimeMillis(); final long start = System.currentTimeMillis();
final Option option = new Option(argsArray); final Option option = new Option(argsArray);
if (OptionFlags.getInstance().isEncodesprite()) {
encodeSprite(option.getResult());
return;
}
if (OptionFlags.getInstance().isVerbose()) { if (OptionFlags.getInstance().isVerbose()) {
Log.info("PlantUML Version " + Version.versionString());
Log.info("GraphicsEnvironment.isHeadless() " + GraphicsEnvironment.isHeadless()); Log.info("GraphicsEnvironment.isHeadless() " + GraphicsEnvironment.isHeadless());
} }
if (GraphicsEnvironment.isHeadless()) {
Log.info("Forcing -Djava.awt.headless=true");
System.setProperty("java.awt.headless", "true");
Log.info("java.awt.headless set as true");
}
if (OptionFlags.getInstance().isPrintFonts()) { if (OptionFlags.getInstance().isPrintFonts()) {
printFonts(); printFonts();
return; return;
@ -83,6 +98,7 @@ public class Run {
} }
boolean error = false; boolean error = false;
boolean forceQuit = false;
if (option.isPattern()) { if (option.isPattern()) {
managePattern(); managePattern();
} else if (OptionFlags.getInstance().isGui()) { } else if (OptionFlags.getInstance().isGui()) {
@ -93,8 +109,10 @@ public class Run {
new MainWindow2(option); new MainWindow2(option);
} else if (option.isPipe() || option.isSyntax()) { } else if (option.isPipe() || option.isSyntax()) {
managePipe(option); managePipe(option);
forceQuit = true;
} else { } else {
error = manageAllFiles(option); error = manageAllFiles(option);
forceQuit = true;
} }
if (option.isDuration()) { if (option.isDuration()) {
@ -106,6 +124,53 @@ public class Run {
Log.error("Some diagram description contains errors"); Log.error("Some diagram description contains errors");
System.exit(1); System.exit(1);
} }
if (forceQuit && OptionFlags.getInstance().isSystemExit()) {
System.exit(0);
}
}
private static void encodeSprite(List<String> result) throws IOException {
SpriteGrayLevel level = SpriteGrayLevel.GRAY_16;
boolean compressed = false;
final File f;
if (result.size() > 1 && result.get(0).matches("(4|8|16)z?")) {
if (result.get(0).startsWith("8")) {
level = SpriteGrayLevel.GRAY_8;
}
if (result.get(0).startsWith("4")) {
level = SpriteGrayLevel.GRAY_4;
}
compressed = result.get(0).toLowerCase().endsWith("z");
f = new File(result.get(1));
} else {
f = new File(result.get(0));
}
final BufferedImage im = ImageIO.read(f);
final String name = getSpriteName(f);
final String s = compressed ? SpriteUtils.encodeCompressed(im, name, level) : SpriteUtils.encode(im, name,
level);
System.out.println(s);
}
private static String getSpriteName(File f) {
final String s = getSpriteNameInternal(f);
if (s.length() == 0) {
return "test";
}
return s;
}
private static String getSpriteNameInternal(File f) {
final StringBuilder sb = new StringBuilder();
for (char c : f.getName().toCharArray()) {
if (("" + c).matches("[\\p{L}0-9_]")) {
sb.append(c);
} else {
return sb.toString();
}
}
return sb.toString();
} }
private static void goFtp(Option option) throws IOException { private static void goFtp(Option option) throws IOException {
@ -132,17 +197,17 @@ public class Run {
printPattern(new SequenceDiagramFactory()); printPattern(new SequenceDiagramFactory());
printPattern(new ClassDiagramFactory()); printPattern(new ClassDiagramFactory());
printPattern(new ActivityDiagramFactory()); printPattern(new ActivityDiagramFactory());
printPattern(new UsecaseDiagramFactory()); printPattern(new DescriptionDiagramFactory());
printPattern(new ComponentDiagramFactory()); // printPattern(new ComponentDiagramFactory());
printPattern(new StateDiagramFactory()); printPattern(new StateDiagramFactory());
printPattern(new ObjectDiagramFactory()); printPattern(new ObjectDiagramFactory());
} }
private static void printPattern(AbstractUmlSystemCommandFactory factory) { private static void printPattern(UmlDiagramFactory factory) {
factory.init(null);
System.out.println(); System.out.println();
System.out.println(factory.getClass().getSimpleName().replaceAll("Factory", "")); System.out.println(factory.getClass().getSimpleName().replaceAll("Factory", ""));
for (String s : factory.getDescription()) { final List<String> descriptions = factory.getDescription();
for (String s : descriptions) {
System.out.println(s); System.out.println(s);
} }
} }
@ -172,27 +237,23 @@ public class Run {
final SourceStringReader sourceStringReader = new SourceStringReader(new Defines(), source, option.getConfig()); final SourceStringReader sourceStringReader = new SourceStringReader(new Defines(), source, option.getConfig());
if (option.isSyntax()) { if (option.isSyntax()) {
try { final Diagram system = sourceStringReader.getBlocks().get(0).getDiagram();
final PSystem system = sourceStringReader.getBlocks().get(0).getSystem(); if (system instanceof UmlDiagram) {
if (system instanceof UmlDiagram) { ps.println(((UmlDiagram) system).getUmlDiagramType().name());
ps.println(((UmlDiagram) system).getUmlDiagramType().name()); ps.println(system.getDescription());
ps.println(system.getDescription()); } else if (system instanceof PSystemError) {
} else if (system instanceof PSystemError) { ps.println("ERROR");
ps.println("ERROR"); final PSystemError sys = (PSystemError) system;
final PSystemError sys = (PSystemError) system; ps.println(sys.getHigherErrorPosition());
ps.println(sys.getHigherErrorPosition()); for (ErrorUml er : sys.getErrorsUml()) {
for (ErrorUml er : sys.getErrorsUml()) { ps.println(er.getError());
ps.println(er.getError());
}
} else {
ps.println("OTHER");
ps.println(system.getDescription());
} }
} catch (InterruptedException e) { } else {
Log.error("InterruptedException " + e); ps.println("OTHER");
ps.println(system.getDescription());
} }
} else if (option.isPipe()) { } else if (option.isPipe()) {
final String result = sourceStringReader.generateImage(ps, 0, option.getFileFormatOption()); sourceStringReader.generateImage(ps, 0, option.getFileFormatOption());
} }
} }
@ -250,7 +311,7 @@ public class Run {
for (String s : option.getResult()) { for (String s : option.getResult()) {
final FileGroup group = new FileGroup(s, option.getExcludes(), option); final FileGroup group = new FileGroup(s, option.getExcludes(), option);
for (final File f : group.getFiles()) { for (final File f : group.getFiles()) {
final Future<?> future = executor.submit(new Runnable() { executor.submit(new Runnable() {
public void run() { public void run() {
if (errors.get()) { if (errors.get()) {
return; return;
@ -286,11 +347,11 @@ public class Run {
} }
final ISourceFileReader sourceFileReader; final ISourceFileReader sourceFileReader;
if (option.getOutputFile() == null) { if (option.getOutputFile() == null) {
sourceFileReader = new SourceFileReader(option.getDefaultDefines(), f, option.getOutputDir(), option sourceFileReader = new SourceFileReader(option.getDefaultDefines(), f, option.getOutputDir(),
.getConfig(), option.getCharset(), option.getFileFormatOption()); option.getConfig(), option.getCharset(), option.getFileFormatOption());
} else { } else {
sourceFileReader = new SourceFileReader2(option.getDefaultDefines(), f, option.getOutputFile(), option sourceFileReader = new SourceFileReader2(option.getDefaultDefines(), f, option.getOutputFile(),
.getConfig(), option.getCharset(), option.getFileFormatOption()); option.getConfig(), option.getCharset(), option.getFileFormatOption());
} }
if (option.isComputeurl()) { if (option.isComputeurl()) {
final List<String> urls = sourceFileReader.getEncodedUrl(); final List<String> urls = sourceFileReader.getEncodedUrl();

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 5877 $ * Revision $Revision: 9786 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
@ -53,10 +53,10 @@ public class SignatureUtils {
return coder.encode(digest); return coder.encode(digest);
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
e.printStackTrace(); e.printStackTrace();
throw new IllegalStateException(); throw new UnsupportedOperationException(e);
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
e.printStackTrace(); e.printStackTrace();
throw new IllegalStateException(); throw new UnsupportedOperationException(e);
} }
} }
@ -87,10 +87,10 @@ public class SignatureUtils {
return coder.encode(digest); return coder.encode(digest);
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
e.printStackTrace(); e.printStackTrace();
throw new IllegalStateException(); throw new UnsupportedOperationException(e);
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
e.printStackTrace(); e.printStackTrace();
throw new IllegalStateException(); throw new UnsupportedOperationException(e);
} }
} }
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,12 +28,14 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 3824 $ * Revision $Revision: 10298 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import net.sourceforge.plantuml.core.Diagram;
public interface SingleLine { public interface SingleLine {
PSystem getSystemFromSingleLine(String singleLine); Diagram getSystemFromSingleLine(String singleLine);
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 7230 $ * Revision $Revision: 11707 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
@ -46,12 +46,17 @@ import java.util.regex.Pattern;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines; import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizLayoutStrategy; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizLayoutStrategy;
import net.sourceforge.plantuml.graphic.HorizontalAlignement; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.ColorMapper; import net.sourceforge.plantuml.ugraphic.ColorMapper;
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.ColorMapperMonochrome; import net.sourceforge.plantuml.ugraphic.ColorMapperMonochrome;
import net.sourceforge.plantuml.ugraphic.Sprite;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke;
public class SkinParam implements ISkinParam { public class SkinParam implements ISkinParam {
@ -68,11 +73,21 @@ public class SkinParam implements ISkinParam {
public SkinParam(UmlDiagramType type) { public SkinParam(UmlDiagramType type) {
this.type = type; this.type = type;
if (type == null) {
setParam("shadowing", "false");
}
} }
static String cleanForKey(String key) { static String cleanForKey(String key) {
key = key.toLowerCase().trim(); key = key.toLowerCase().trim();
key = key.replaceAll("_|\\.|\\s", ""); key = key.replaceAll("_|\\.|\\s", "");
key = key.replaceAll("partition", "package");
key = key.replaceAll("activityarrow", "genericarrow");
key = key.replaceAll("objectarrow", "genericarrow");
key = key.replaceAll("classarrow", "genericarrow");
key = key.replaceAll("componentarrow", "genericarrow");
key = key.replaceAll("statearrow", "genericarrow");
key = key.replaceAll("usecasearrow", "genericarrow");
final Matcher m = stereoPattern.matcher(key); final Matcher m = stereoPattern.matcher(key);
if (m.find()) { if (m.find()) {
final String s = m.group(1); final String s = m.group(1);
@ -83,9 +98,9 @@ public class SkinParam implements ISkinParam {
} }
public HtmlColor getBackgroundColor() { public HtmlColor getBackgroundColor() {
final HtmlColor result = getHtmlColor(ColorParam.background, null); final HtmlColor result = getHtmlColor(ColorParam.background, null, false);
if (result == null) { if (result == null) {
return HtmlColor.WHITE; return HtmlColorUtils.WHITE;
} }
return result; return result;
} }
@ -109,19 +124,30 @@ public class SkinParam implements ISkinParam {
return sb.toString(); return sb.toString();
} }
public HtmlColor getHtmlColor(ColorParam param, String stereotype) { public HtmlColor getHtmlColor(ColorParam param, String stereotype, boolean clickable) {
if (stereotype != null) { if (stereotype != null) {
checkStereotype(stereotype); checkStereotype(stereotype);
final String value2 = getValue(param.name() + "color" + stereotype); final String value2 = getValue(param.name() + "color" + stereotype);
if (value2 != null && HtmlColor.isValid(value2)) { if (value2 != null && HtmlColorUtils.getColorIfValid(value2) != null) {
return HtmlColor.getColorIfValid(value2); return HtmlColorUtils.getColorIfValid(value2);
} }
} }
final String value = getValue(param.name() + "color"); final String value = getValue(getParamName(param, clickable));
if (value == null || HtmlColor.isValid(value) == false) { final boolean acceptTransparent = param == ColorParam.background;
if (value == null) {
return null; return null;
} }
return HtmlColor.getColorIfValid(value); return HtmlColorUtils.getColorIfValid(value, acceptTransparent);
}
private String getParamName(ColorParam param, boolean clickable) {
String n = param.name();
if (clickable && n.endsWith("Background")) {
n = n.replaceAll("Background", "ClickableBackground");
} else if (clickable && n.endsWith("Border")) {
n = n.replaceAll("Border", "ClickableBorder");
}
return n + "color";
} }
private void checkStereotype(String stereotype) { private void checkStereotype(String stereotype) {
@ -176,16 +202,16 @@ public class SkinParam implements ISkinParam {
checkStereotype(stereotype); checkStereotype(stereotype);
value = getValue(param.name() + "fontcolor" + stereotype); value = getValue(param.name() + "fontcolor" + stereotype);
} }
if (value == null || HtmlColor.isValid(value) == false) { if (value == null || HtmlColorUtils.getColorIfValid(value) == null) {
value = getValue(param.name() + "fontcolor"); value = getValue(param.name() + "fontcolor");
} }
if (value == null || HtmlColor.isValid(value) == false) { if (value == null || HtmlColorUtils.getColorIfValid(value) == null) {
value = getValue("defaultfontcolor"); value = getValue("defaultfontcolor");
} }
if (value == null || HtmlColor.isValid(value) == false) { if (value == null || HtmlColorUtils.getColorIfValid(value) == null) {
value = param.getDefaultColor(); value = param.getDefaultColor();
} }
return HtmlColor.getColorIfValid(value); return HtmlColorUtils.getColorIfValid(value);
} }
private int getFontStyle(FontParam param, String stereotype) { private int getFontStyle(FontParam param, String stereotype) {
@ -217,8 +243,9 @@ public class SkinParam implements ISkinParam {
if (stereotype != null) { if (stereotype != null) {
checkStereotype(stereotype); checkStereotype(stereotype);
} }
return new UFont(getFontFamily(fontParam, stereotype), getFontStyle(fontParam, stereotype), getFontSize( final String fontFamily = getFontFamily(fontParam, stereotype);
fontParam, stereotype)); final int fontStyle = getFontStyle(fontParam, stereotype);
return new UFont(fontFamily, fontStyle, getFontSize(fontParam, stereotype));
} }
public int getCircledCharacterRadius() { public int getCircledCharacterRadius() {
@ -227,15 +254,11 @@ public class SkinParam implements ISkinParam {
return Integer.parseInt(value); return Integer.parseInt(value);
} }
// return 11; // return 11;
// System.err.println("SIZE1="+getFontSize(FontParam.CIRCLED_CHARACTER)); // Log.println("SIZE1="+getFontSize(FontParam.CIRCLED_CHARACTER));
// System.err.println("SIZE1="+getFontSize(FontParam.CIRCLED_CHARACTER)/3); // Log.println("SIZE1="+getFontSize(FontParam.CIRCLED_CHARACTER)/3);
return getFontSize(FontParam.CIRCLED_CHARACTER, null) / 3 + 6; return getFontSize(FontParam.CIRCLED_CHARACTER, null) / 3 + 6;
} }
public boolean isClassCollapse() {
return true;
}
public int classAttributeIconSize() { public int classAttributeIconSize() {
final String value = getValue("classAttributeIconSize"); final String value = getValue("classAttributeIconSize");
if (value != null && value.matches("\\d+")) { if (value != null && value.matches("\\d+")) {
@ -284,17 +307,6 @@ public class SkinParam implements ISkinParam {
return 96; return 96;
} }
public boolean useOctagonForActivity() {
final String value = getValue("activityshape");
if ("roundedbox".equalsIgnoreCase(value)) {
return false;
}
if ("octagon".equalsIgnoreCase(value)) {
return true;
}
return false;
}
public DotSplines getDotSplines() { public DotSplines getDotSplines() {
final String value = getValue("linetype"); final String value = getValue("linetype");
if ("polyline".equalsIgnoreCase(value)) { if ("polyline".equalsIgnoreCase(value)) {
@ -323,15 +335,36 @@ public class SkinParam implements ISkinParam {
return GraphvizLayoutStrategy.DOT; return GraphvizLayoutStrategy.DOT;
} }
public HorizontalAlignement getHorizontalAlignement(AlignParam param) { public HorizontalAlignment getHorizontalAlignment(AlignParam param) {
final String value = getValue(param.name()); final String value;
final HorizontalAlignement result = HorizontalAlignement.fromString(value); switch (param) {
case SEQUENCE_MESSAGE_ALIGN:
value = getArg(getValue(AlignParam.SEQUENCE_MESSAGE_ALIGN.name()), 0);
break;
case SEQUENCE_MESSAGETEXT_ALIGN:
value = getArg(getValue(AlignParam.SEQUENCE_MESSAGE_ALIGN.name()), 1);
break;
default:
value = getValue(param.name());
}
final HorizontalAlignment result = HorizontalAlignment.fromString(value);
if (result == null) { if (result == null) {
return param.getDefaultValue(); return param.getDefaultValue();
} }
return result; return result;
} }
private String getArg(String value, int i) {
if (value == null) {
return null;
}
final String[] split = value.split(":");
if (i >= split.length) {
return split[0];
}
return split[i];
}
public ColorMapper getColorMapper() { public ColorMapper getColorMapper() {
if (isMonochrome()) { if (isMonochrome()) {
return new ColorMapperMonochrome(); return new ColorMapperMonochrome();
@ -339,19 +372,10 @@ public class SkinParam implements ISkinParam {
return new ColorMapperIdentity(); return new ColorMapperIdentity();
} }
public boolean isSvek() {
boolean defaultValue = false;
if (OptionFlags.SVEK && type == UmlDiagramType.CLASS) {
defaultValue = true;
}
final String value = getValue("svek");
if (value == null) {
return defaultValue;
}
return "true".equalsIgnoreCase(value);
}
public boolean shadowing() { public boolean shadowing() {
if (strictUmlStyle()) {
return false;
}
final String value = getValue("shadowing"); final String value = getValue("shadowing");
if ("false".equalsIgnoreCase(value)) { if ("false".equalsIgnoreCase(value)) {
return false; return false;
@ -359,4 +383,129 @@ public class SkinParam implements ISkinParam {
return true; return true;
} }
public PackageStyle getPackageStyle() {
final String value = getValue("packageStyle");
final PackageStyle p = PackageStyle.fromString(value);
if (p == null) {
return PackageStyle.FOLDER;
}
return p;
}
private final Map<String, Sprite> sprites = new HashMap<String, Sprite>();
public void addSprite(String name, Sprite sprite) {
sprites.put(name, sprite);
}
public Sprite getSprite(String name) {
return sprites.get(name);
}
public boolean useUml2ForComponent() {
if (strictUmlStyle()) {
return true;
}
final String value = getValue("componentstyle");
return "uml2".equalsIgnoreCase(value);
}
public boolean stereotypePositionTop() {
final String value = getValue("stereotypePosition");
if ("bottom".equalsIgnoreCase(value)) {
return false;
}
return true;
}
public boolean useSwimlanes() {
if (type != UmlDiagramType.ACTIVITY) {
return false;
}
if ("true".equalsIgnoreCase(getValue("swimlane"))) {
return true;
}
if ("true".equalsIgnoreCase(getValue("swimlanes"))) {
return true;
}
return false;
}
public double getNodesep() {
final String value = getValue("nodesep");
if (value != null && value.matches("\\d+")) {
return Double.parseDouble(value);
}
return 0;
}
public double getRanksep() {
final String value = getValue("ranksep");
if (value != null && value.matches("\\d+")) {
return Double.parseDouble(value);
}
return 0;
}
public double getRoundCorner() {
final String value = getValue("roundcorner");
if (value != null && value.matches("\\d+")) {
return Double.parseDouble(value);
}
return 0;
}
public UStroke getThickness(LineParam param) {
final String value = getValue(param.name() + "thickness");
if (value != null && value.matches("[\\d.]+")) {
return new UStroke(Double.parseDouble(value));
}
return null;
}
public double maxMessageSize() {
final String value = getValue("maxmessagesize");
if (value != null && value.matches("-?\\d+")) {
return Double.parseDouble(value);
}
return 0;
}
public boolean strictUmlStyle() {
final String value = getValue("style");
if ("strictuml".equalsIgnoreCase(value)) {
return true;
}
return false;
}
public boolean forceSequenceParticipantUnderlined() {
final String value = getValue("sequenceParticipant");
if ("underline".equalsIgnoreCase(value)) {
return true;
}
return false;
}
public ConditionStyle getConditionStyle() {
final String value = getValue("conditionStyle");
final ConditionStyle p = ConditionStyle.fromString(value);
if (p == null) {
return ConditionStyle.INSIDE;
}
return p;
}
public double minClassWidth() {
final String value = getValue("minclasswidth");
if (value != null && value.matches("\\d+")) {
return Integer.parseInt(value);
}
return 0;
}
public boolean sameClassWidth() {
return "true".equals(getValue("sameclasswidth"));
}
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -33,26 +33,30 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizLayoutStrategy;
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.ugraphic.ColorMapper;
import net.sourceforge.plantuml.ugraphic.UFont;
public class SkinParamBackcolored implements ISkinParam { public class SkinParamBackcolored extends SkinParamDelegator {
final private ISkinParam skinParam;
final private HtmlColor backColorElement; final private HtmlColor backColorElement;
final private HtmlColor backColorGeneral; final private HtmlColor backColorGeneral;
final private boolean forceClickage;
public SkinParamBackcolored(ISkinParam skinParam, HtmlColor backColorElement) { public SkinParamBackcolored(ISkinParam skinParam, HtmlColor backColorElement) {
this(skinParam, backColorElement, null); this(skinParam, backColorElement, null, false);
} }
public SkinParamBackcolored(ISkinParam skinParam, public SkinParamBackcolored(ISkinParam skinParam, HtmlColor backColorElement, boolean forceClickage) {
HtmlColor backColorElement, HtmlColor backColorGeneral) { this(skinParam, backColorElement, null, forceClickage);
this.skinParam = skinParam; }
public SkinParamBackcolored(ISkinParam skinParam, HtmlColor backColorElement, HtmlColor backColorGeneral) {
this(skinParam, backColorElement, backColorGeneral, false);
}
public SkinParamBackcolored(ISkinParam skinParam, HtmlColor backColorElement, HtmlColor backColorGeneral,
boolean forceClickage) {
super(skinParam);
this.forceClickage = forceClickage;
this.backColorElement = backColorElement; this.backColorElement = backColorElement;
this.backColorGeneral = backColorGeneral; this.backColorGeneral = backColorGeneral;
} }
@ -61,70 +65,17 @@ public class SkinParamBackcolored implements ISkinParam {
if (backColorGeneral != null) { if (backColorGeneral != null) {
return backColorGeneral; return backColorGeneral;
} }
return skinParam.getBackgroundColor(); return super.getBackgroundColor();
} }
public int getCircledCharacterRadius() { public HtmlColor getHtmlColor(ColorParam param, String stereotype, boolean clickable) {
return skinParam.getCircledCharacterRadius();
}
public UFont getFont(FontParam fontParam, String stereotype) {
return skinParam.getFont(fontParam, stereotype);
}
public HtmlColor getFontHtmlColor(FontParam param, String stereotype) {
return skinParam.getFontHtmlColor(param, stereotype);
}
public HtmlColor getHtmlColor(ColorParam param, String stereotype) {
if (param.isBackground() && backColorElement != null) { if (param.isBackground() && backColorElement != null) {
return backColorElement; return backColorElement;
} }
return skinParam.getHtmlColor(param, stereotype); if (forceClickage) {
} clickable = true;
}
public String getValue(String key) { return super.getHtmlColor(param, stereotype, clickable);
return skinParam.getValue(key);
}
public boolean isClassCollapse() {
return skinParam.isClassCollapse();
}
public int classAttributeIconSize() {
return skinParam.classAttributeIconSize();
}
public int getDpi() {
return skinParam.getDpi();
}
public boolean useOctagonForActivity() {
return skinParam.useOctagonForActivity();
}
public DotSplines getDotSplines() {
return skinParam.getDotSplines();
}
public GraphvizLayoutStrategy getStrategy() {
return skinParam.getStrategy();
}
public HorizontalAlignement getHorizontalAlignement(AlignParam param) {
return skinParam.getHorizontalAlignement(param);
}
public ColorMapper getColorMapper() {
return skinParam.getColorMapper();
}
public boolean isSvek() {
return skinParam.isSvek();
}
public boolean shadowing() {
return skinParam.shadowing();
} }
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -33,94 +33,28 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizLayoutStrategy;
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.ugraphic.ColorMapper;
import net.sourceforge.plantuml.ugraphic.UFont;
public class SkinParamBackcoloredReference implements ISkinParam { public class SkinParamBackcoloredReference extends SkinParamDelegator {
final private ISkinParam skinParam;
final private HtmlColor sequenceReferenceHeaderBackground; final private HtmlColor sequenceReferenceHeaderBackground;
final private HtmlColor sequenceReferenceBackground; final private HtmlColor sequenceReferenceBackground;
public SkinParamBackcoloredReference(ISkinParam skinParam, HtmlColor sequenceReferenceHeaderBackground, public SkinParamBackcoloredReference(ISkinParam skinParam, HtmlColor sequenceReferenceHeaderBackground,
HtmlColor sequenceReferenceBackground) { HtmlColor sequenceReferenceBackground) {
this.skinParam = skinParam; super(skinParam);
this.sequenceReferenceBackground = sequenceReferenceBackground; this.sequenceReferenceBackground = sequenceReferenceBackground;
this.sequenceReferenceHeaderBackground = sequenceReferenceHeaderBackground; this.sequenceReferenceHeaderBackground = sequenceReferenceHeaderBackground;
} }
public HtmlColor getBackgroundColor() { public HtmlColor getHtmlColor(ColorParam param, String stereotype, boolean clickable) {
return skinParam.getBackgroundColor();
}
public int getCircledCharacterRadius() {
return skinParam.getCircledCharacterRadius();
}
public UFont getFont(FontParam fontParam, String stereotype) {
return skinParam.getFont(fontParam, stereotype);
}
public HtmlColor getFontHtmlColor(FontParam param, String stereotype) {
return skinParam.getFontHtmlColor(param, stereotype);
}
public HtmlColor getHtmlColor(ColorParam param, String stereotype) {
if (param == ColorParam.sequenceReferenceHeaderBackground && sequenceReferenceHeaderBackground != null) { if (param == ColorParam.sequenceReferenceHeaderBackground && sequenceReferenceHeaderBackground != null) {
return sequenceReferenceHeaderBackground; return sequenceReferenceHeaderBackground;
} }
if (param == ColorParam.sequenceReferenceBackground && sequenceReferenceBackground != null) { if (param == ColorParam.sequenceReferenceBackground && sequenceReferenceBackground != null) {
return sequenceReferenceBackground; return sequenceReferenceBackground;
} }
return skinParam.getHtmlColor(param, stereotype); return super.getHtmlColor(param, stereotype, clickable);
}
public String getValue(String key) {
return skinParam.getValue(key);
}
public boolean isClassCollapse() {
return skinParam.isClassCollapse();
}
public int classAttributeIconSize() {
return skinParam.classAttributeIconSize();
}
public int getDpi() {
return skinParam.getDpi();
}
public boolean useOctagonForActivity() {
return skinParam.useOctagonForActivity();
}
public DotSplines getDotSplines() {
return skinParam.getDotSplines();
}
public GraphvizLayoutStrategy getStrategy() {
return skinParam.getStrategy();
}
public HorizontalAlignement getHorizontalAlignement(AlignParam param) {
return skinParam.getHorizontalAlignement(param);
}
public ColorMapper getColorMapper() {
return skinParam.getColorMapper();
}
public boolean isSvek() {
return skinParam.isSvek();
}
public boolean shadowing() {
return skinParam.shadowing();
} }
} }

View File

@ -0,0 +1,167 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2013, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 4246 $
*
*/
package net.sourceforge.plantuml;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizLayoutStrategy;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.ColorMapper;
import net.sourceforge.plantuml.ugraphic.Sprite;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke;
public class SkinParamDelegator implements ISkinParam {
final private ISkinParam skinParam;
public SkinParamDelegator(ISkinParam skinParam) {
this.skinParam = skinParam;
}
public HtmlColor getBackgroundColor() {
return skinParam.getBackgroundColor();
}
public int getCircledCharacterRadius() {
return skinParam.getCircledCharacterRadius();
}
public UFont getFont(FontParam fontParam, String stereotype) {
return skinParam.getFont(fontParam, stereotype);
}
public HtmlColor getFontHtmlColor(FontParam param, String stereotype) {
return skinParam.getFontHtmlColor(param, stereotype);
}
public HtmlColor getHtmlColor(ColorParam param, String stereotype, boolean clickable) {
return skinParam.getHtmlColor(param, stereotype, clickable);
}
public String getValue(String key) {
return skinParam.getValue(key);
}
public int classAttributeIconSize() {
return skinParam.classAttributeIconSize();
}
public int getDpi() {
return skinParam.getDpi();
}
public DotSplines getDotSplines() {
return skinParam.getDotSplines();
}
public GraphvizLayoutStrategy getStrategy() {
return skinParam.getStrategy();
}
public HorizontalAlignment getHorizontalAlignment(AlignParam param) {
return skinParam.getHorizontalAlignment(param);
}
public ColorMapper getColorMapper() {
return skinParam.getColorMapper();
}
public boolean shadowing() {
return skinParam.shadowing();
}
public PackageStyle getPackageStyle() {
return skinParam.getPackageStyle();
}
public Sprite getSprite(String name) {
return skinParam.getSprite(name);
}
public boolean useUml2ForComponent() {
return skinParam.useUml2ForComponent();
}
public boolean stereotypePositionTop() {
return skinParam.stereotypePositionTop();
}
public boolean useSwimlanes() {
return skinParam.useSwimlanes();
}
public double getNodesep() {
return skinParam.getNodesep();
}
public double getRanksep() {
return skinParam.getRanksep();
}
public double getRoundCorner() {
return skinParam.getRoundCorner();
}
public UStroke getThickness(LineParam param) {
return skinParam.getThickness(param);
}
public double maxMessageSize() {
return skinParam.maxMessageSize();
}
public boolean strictUmlStyle() {
return skinParam.strictUmlStyle();
}
public boolean forceSequenceParticipantUnderlined() {
return skinParam.forceSequenceParticipantUnderlined();
}
public ConditionStyle getConditionStyle() {
return skinParam.getConditionStyle();
}
public double minClassWidth() {
return skinParam.minClassWidth();
}
public boolean sameClassWidth() {
return skinParam.sameClassWidth();
}
}

View File

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

View File

@ -0,0 +1,49 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2013, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 4246 $
*
*/
package net.sourceforge.plantuml;
public class SkinParamSameClassWidth extends SkinParamDelegator {
final private double width;
public SkinParamSameClassWidth(ISkinParam skinParam, double width) {
super(skinParam);
this.width = width;
}
public double minClassWidth() {
return width;
}
}

View File

@ -0,0 +1,60 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2013, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 9423 $
*
*/
package net.sourceforge.plantuml;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UFont;
public class SkinParamUtils {
private static final Rose rose = new Rose();
public static UFont getFont(ISkinParam skinParam, FontParam fontParam, Stereotype stereo) {
final String s = stereo == null ? null : stereo.getLabel();
return skinParam.getFont(fontParam, s);
}
public static HtmlColor getFontColor(ISkinParam skinParam, FontParam fontParam, Stereotype stereo) {
final String s = stereo == null ? null : stereo.getLabel();
return skinParam.getFontHtmlColor(fontParam, s);
}
public static HtmlColor getColor(ISkinParam skinParam, ColorParam colorParam, Stereotype stereo) {
final String s = stereo == null ? null : stereo.getLabel();
return rose.getHtmlColor(skinParam, colorParam, s);
}
}

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -36,8 +36,10 @@ package net.sourceforge.plantuml;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.Reader; import java.io.Reader;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
@ -47,6 +49,7 @@ import java.util.Set;
import net.sourceforge.plantuml.code.Transcoder; import net.sourceforge.plantuml.code.Transcoder;
import net.sourceforge.plantuml.code.TranscoderUtil; import net.sourceforge.plantuml.code.TranscoderUtil;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.Defines;
public class SourceFileReader implements ISourceFileReader { public class SourceFileReader implements ISourceFileReader {
@ -61,6 +64,11 @@ public class SourceFileReader implements ISourceFileReader {
this(file, file.getAbsoluteFile().getParentFile()); this(file, file.getAbsoluteFile().getParentFile());
} }
public SourceFileReader(File file, File outputDirectory, String charset) throws IOException {
this(new Defines(), file, outputDirectory, Collections.<String> emptyList(), charset, new FileFormatOption(
FileFormat.PNG));
}
public SourceFileReader(final File file, File outputDirectory) throws IOException { public SourceFileReader(final File file, File outputDirectory) throws IOException {
this(new Defines(), file, outputDirectory, Collections.<String> emptyList(), null, new FileFormatOption( this(new Defines(), file, outputDirectory, Collections.<String> emptyList(), null, new FileFormatOption(
FileFormat.PNG)); FileFormat.PNG));
@ -82,26 +90,27 @@ public class SourceFileReader implements ISourceFileReader {
if (outputDirectory == null) { if (outputDirectory == null) {
outputDirectory = file.getAbsoluteFile().getParentFile(); outputDirectory = file.getAbsoluteFile().getParentFile();
} else if (outputDirectory.isAbsolute() == false) { } else if (outputDirectory.isAbsolute() == false) {
outputDirectory = FileSystem.getInstance().getFile(outputDirectory.getName()); outputDirectory = FileSystem.getInstance().getFile(outputDirectory.getPath());
} }
if (outputDirectory.exists() == false) { if (outputDirectory.exists() == false) {
outputDirectory.mkdirs(); outputDirectory.mkdirs();
} }
this.outputDirectory = outputDirectory; this.outputDirectory = outputDirectory;
builder = new BlockUmlBuilder(config, defines, getReader(charset), file.getAbsoluteFile().getParentFile()); builder = new BlockUmlBuilder(config, charset, defines, getReader(charset), file.getAbsoluteFile()
.getParentFile());
} }
public boolean hasError() throws IOException, InterruptedException { public boolean hasError() throws IOException, InterruptedException {
for (final BlockUml b : builder.getBlockUmls()) { for (final BlockUml b : builder.getBlockUmls()) {
if (b.getSystem() instanceof PSystemError) { if (b.getDiagram() instanceof PSystemError) {
return true; return true;
} }
} }
return false; return false;
} }
public List<GeneratedImage> getGeneratedImages() throws IOException, InterruptedException { public List<GeneratedImage> getGeneratedImages() throws IOException {
Log.info("Reading file: " + file); Log.info("Reading file: " + file);
int cpt = 0; int cpt = 0;
@ -117,11 +126,22 @@ public class SourceFileReader implements ISourceFileReader {
final File suggested = new File(outputDirectory, newName); final File suggested = new File(outputDirectory, newName);
suggested.getParentFile().mkdirs(); suggested.getParentFile().mkdirs();
final PSystem system = blockUml.getSystem(); final Diagram system = blockUml.getDiagram();
final List<File> exportDiagrams = PSystemUtils.exportDiagrams(system, suggested, fileFormatOption);
OptionFlags.getInstance().logData(file, system); OptionFlags.getInstance().logData(file, system);
for (File f : system.exportDiagrams(suggested, fileFormatOption)) { for (File f : exportDiagrams) {
final String desc = "[" + file.getName() + "] " + system.getDescription(); final String desc = "[" + file.getName() + "] " + system.getDescription();
if (OptionFlags.getInstance().isWord()) {
final String warnOrError = system.getWarningOrError();
if (warnOrError != null) {
final String name = f.getName().substring(0, f.getName().length() - 4) + ".err";
final File errorFile = new File(f.getParentFile(), name);
final PrintStream ps = new PrintStream(new FileOutputStream(errorFile));
ps.print(warnOrError);
ps.close();
}
}
final GeneratedImage generatedImage = new GeneratedImage(f, desc, system); final GeneratedImage generatedImage = new GeneratedImage(f, desc, system);
result.add(generatedImage); result.add(generatedImage);
} }
@ -137,7 +157,7 @@ public class SourceFileReader implements ISourceFileReader {
final List<String> result = new ArrayList<String>(); final List<String> result = new ArrayList<String>();
final Transcoder transcoder = TranscoderUtil.getDefaultTranscoder(); final Transcoder transcoder = TranscoderUtil.getDefaultTranscoder();
for (BlockUml blockUml : builder.getBlockUmls()) { for (BlockUml blockUml : builder.getBlockUmls()) {
final String source = blockUml.getSystem().getSource().getPlainString(); final String source = blockUml.getDiagram().getSource().getPlainString();
final String encoded = transcoder.encode(source); final String encoded = transcoder.encode(source);
result.add(encoded); result.add(encoded);
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -47,6 +47,7 @@ import java.util.Set;
import net.sourceforge.plantuml.code.Transcoder; import net.sourceforge.plantuml.code.Transcoder;
import net.sourceforge.plantuml.code.TranscoderUtil; import net.sourceforge.plantuml.code.TranscoderUtil;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.Defines;
public class SourceFileReader2 implements ISourceFileReader { public class SourceFileReader2 implements ISourceFileReader {
@ -67,12 +68,12 @@ public class SourceFileReader2 implements ISourceFileReader {
} }
FileSystem.getInstance().setCurrentDir(file.getAbsoluteFile().getParentFile()); FileSystem.getInstance().setCurrentDir(file.getAbsoluteFile().getParentFile());
builder = new BlockUmlBuilder(config, defines, getReader(charset), file.getAbsoluteFile().getParentFile()); builder = new BlockUmlBuilder(config, charset, defines, getReader(charset), file.getAbsoluteFile().getParentFile());
} }
public boolean hasError() throws IOException, InterruptedException { public boolean hasError() throws IOException, InterruptedException {
for (final BlockUml b : builder.getBlockUmls()) { for (final BlockUml b : builder.getBlockUmls()) {
if (b.getSystem() instanceof PSystemError) { if (b.getDiagram() instanceof PSystemError) {
return true; return true;
} }
} }
@ -87,10 +88,10 @@ public class SourceFileReader2 implements ISourceFileReader {
for (BlockUml blockUml : builder.getBlockUmls()) { for (BlockUml blockUml : builder.getBlockUmls()) {
final File suggested = outputFile; final File suggested = outputFile;
final PSystem system = blockUml.getSystem(); final Diagram system = blockUml.getDiagram();
OptionFlags.getInstance().logData(file, system); OptionFlags.getInstance().logData(file, system);
for (File f : system.exportDiagrams(suggested, fileFormatOption)) { for (File f : PSystemUtils.exportDiagrams(system, suggested, fileFormatOption)) {
final String desc = "[" + file.getName() + "] " + system.getDescription(); final String desc = "[" + file.getName() + "] " + system.getDescription();
final GeneratedImage generatedImage = new GeneratedImage(f, desc, system); final GeneratedImage generatedImage = new GeneratedImage(f, desc, system);
result.add(generatedImage); result.add(generatedImage);
@ -107,7 +108,7 @@ public class SourceFileReader2 implements ISourceFileReader {
final List<String> result = new ArrayList<String>(); final List<String> result = new ArrayList<String>();
final Transcoder transcoder = TranscoderUtil.getDefaultTranscoder(); final Transcoder transcoder = TranscoderUtil.getDefaultTranscoder();
for (BlockUml blockUml : builder.getBlockUmls()) { for (BlockUml blockUml : builder.getBlockUmls()) {
final String source = blockUml.getSystem().getSource().getPlainString(); final String source = blockUml.getDiagram().getSource().getPlainString();
final String encoded = transcoder.encode(source); final String encoded = transcoder.encode(source);
result.add(encoded); result.add(encoded);
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -43,6 +43,10 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.DiagramDescriptionImpl;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.graphic.GraphicStrings; import net.sourceforge.plantuml.graphic.GraphicStrings;
import net.sourceforge.plantuml.preproc.Defines; import net.sourceforge.plantuml.preproc.Defines;
@ -54,12 +58,22 @@ public class SourceStringReader {
this(new Defines(), source, Collections.<String> emptyList()); this(new Defines(), source, Collections.<String> emptyList());
} }
public SourceStringReader(String source, String charset) {
this(new Defines(), source, "UTF-8", Collections.<String> emptyList());
}
public SourceStringReader(Defines defines, String source, List<String> config) { public SourceStringReader(Defines defines, String source, List<String> config) {
this(defines, source, "UTF-8", config);
}
public SourceStringReader(Defines defines, String source, String charset, List<String> config) {
try { try {
final BlockUmlBuilder builder = new BlockUmlBuilder(config, defines, new StringReader(source), null); final BlockUmlBuilder builder = new BlockUmlBuilder(config, charset, defines, new StringReader(source),
null);
this.blocks = builder.getBlockUmls(); this.blocks = builder.getBlockUmls();
} catch (IOException e) { } catch (IOException e) {
throw new IllegalStateException(); Log.error("error " + e);
throw new IllegalStateException(e);
} }
} }
@ -85,22 +99,68 @@ public class SourceStringReader {
public String generateImage(OutputStream os, int numImage, FileFormatOption fileFormatOption) throws IOException { public String generateImage(OutputStream os, int numImage, FileFormatOption fileFormatOption) throws IOException {
if (blocks.size() == 0) { if (blocks.size() == 0) {
final GraphicStrings error = new GraphicStrings(Arrays.asList("No @startuml found")); final GraphicStrings error = new GraphicStrings(Arrays.asList("No @startuml found"));
error.writeImage(os, fileFormatOption); error.writeImage(os, fileFormatOption, null);
return null; return null;
} }
try { for (BlockUml b : blocks) {
for (BlockUml b : blocks) { final Diagram system = b.getDiagram();
final PSystem system = b.getSystem(); final int nbInSystem = system.getNbImages();
final int nbInSystem = system.getNbImages(); if (numImage < nbInSystem) {
if (numImage < nbInSystem) { //final CMapData cmap = new CMapData();
system.exportDiagram(os, null, numImage, fileFormatOption); final ImageData imageData = system.exportDiagram(os, numImage, fileFormatOption);
return system.getDescription(); if (imageData.containsCMapData()) {
return system.getDescription().getDescription() + "\n" + imageData.getCMapData("plantuml");
} }
numImage -= nbInSystem; return system.getDescription().getDescription();
} }
} catch (InterruptedException e) { numImage -= nbInSystem;
}
Log.error("numImage is too big = " + numImage);
return null;
}
public DiagramDescription generateDiagramDescription(OutputStream os) throws IOException {
return generateDiagramDescription(os, 0);
}
public DiagramDescription generateDiagramDescription(File f) throws IOException {
final OutputStream os = new BufferedOutputStream(new FileOutputStream(f));
final DiagramDescription result = generateDiagramDescription(os, 0);
os.close();
return result;
}
public DiagramDescription generateDiagramDescription(OutputStream os, FileFormatOption fileFormatOption) throws IOException {
return generateDiagramDescription(os, 0, fileFormatOption);
}
public DiagramDescription generateDiagramDescription(OutputStream os, int numImage) throws IOException {
return generateDiagramDescription(os, numImage, new FileFormatOption(FileFormat.PNG));
}
public DiagramDescription generateDiagramDescription(OutputStream os, int numImage, FileFormatOption fileFormatOption)
throws IOException {
if (blocks.size() == 0) {
final GraphicStrings error = new GraphicStrings(Arrays.asList("No @startuml found"));
error.writeImage(os, fileFormatOption, null);
return null; return null;
} }
for (BlockUml b : blocks) {
final Diagram system = b.getDiagram();
final int nbInSystem = system.getNbImages();
if (numImage < nbInSystem) {
// final CMapData cmap = new CMapData();
final ImageData imageData = system.exportDiagram(os, numImage, fileFormatOption);
if (imageData.containsCMapData()) {
return ((DiagramDescriptionImpl) system.getDescription()).withCMapData(imageData
.getCMapData("plantuml"));
}
return system.getDescription();
}
numImage -= nbInSystem;
}
Log.error("numImage is too big = " + numImage); Log.error("numImage is too big = " + numImage);
return null; return null;

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public

View File

@ -0,0 +1,42 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2013, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 4236 $
*
*/
package net.sourceforge.plantuml;
import net.sourceforge.plantuml.ugraphic.Sprite;
public interface SpriteContainer {
public Sprite getSprite(String name);
}

View File

@ -0,0 +1,44 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2013, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 4236 $
*
*/
package net.sourceforge.plantuml;
import net.sourceforge.plantuml.ugraphic.Sprite;
public class SpriteContainerEmpty implements SpriteContainer {
public Sprite getSprite(String name) {
return null;
}
}

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,7 +28,7 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 7064 $ * Revision $Revision: 11949 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
@ -44,8 +44,13 @@ import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorTransparent;
import net.sourceforge.plantuml.preproc.ReadLineReader; import net.sourceforge.plantuml.preproc.ReadLineReader;
import net.sourceforge.plantuml.preproc.UncommentReadLine; import net.sourceforge.plantuml.preproc.UncommentReadLine;
import net.sourceforge.plantuml.ugraphic.ColorMapper;
public class StringUtils { public class StringUtils {
@ -53,15 +58,19 @@ public class StringUtils {
return file.getAbsolutePath(); return file.getAbsolutePath();
} }
public static List<String> getWithNewlines(String s) { public static List<String> getWithNewlines2(Code s) {
return getWithNewlines2(s.getCode());
}
public static List<String> getWithNewlines2(String s) {
if (s == null) { if (s == null) {
throw new IllegalArgumentException(); return null;
} }
final List<String> result = new ArrayList<String>(); final List<String> result = new ArrayList<String>();
final StringBuilder current = new StringBuilder(); final StringBuilder current = new StringBuilder();
for (int i = 0; i < s.length(); i++) { for (int i = 0; i < s.length(); i++) {
final char c = s.charAt(i); final char c = s.charAt(i);
if (c == '\\' && i < s.length() + 1) { if (c == '\\' && i < s.length() - 1) {
final char c2 = s.charAt(i + 1); final char c2 = s.charAt(i + 1);
i++; i++;
if (c2 == 'n') { if (c2 == 'n') {
@ -122,11 +131,52 @@ public class StringUtils {
return s; return s;
} }
public static String unicode(String s) {
final StringBuilder result = new StringBuilder();
for (char c : s.toCharArray()) {
if (c > 127 || c == '&' || c == '|') {
final int i = c;
result.append("&#" + i + ";");
} else {
result.append(c);
}
}
return result.toString();
}
public static String unicodeForHtml(String s) {
final StringBuilder result = new StringBuilder();
for (char c : s.toCharArray()) {
if (c > 127 || c == '&' || c == '|' || c == '<' || c == '>') {
final int i = c;
result.append("&#" + i + ";");
} else {
result.append(c);
}
}
return result.toString();
}
public static String unicodeForHtml(Display display) {
final StringBuilder result = new StringBuilder();
for (int i = 0; i < display.size(); i++) {
result.append(unicodeForHtml(display.get(i).toString()));
if (i < display.size() - 1) {
result.append("<br>");
}
}
return result.toString();
}
public static String manageArrowForSequence(String s) { public static String manageArrowForSequence(String s) {
s = s.replace('=', '-'); s = s.replace('=', '-').toLowerCase();
return s; return s;
} }
public static String capitalize(String s) {
return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
}
public static String manageArrowForCuca(String s) { public static String manageArrowForCuca(String s) {
final Direction dir = getArrowDirection(s); final Direction dir = getArrowDirection(s);
s = s.replace('=', '-'); s = s.replace('=', '-');
@ -201,6 +251,10 @@ public class StringUtils {
return Direction.DOWN; return Direction.DOWN;
} }
// public static Code eventuallyRemoveStartingAndEndingDoubleQuote(Code s) {
// return Code.of(eventuallyRemoveStartingAndEndingDoubleQuote(s.getCode()));
// }
public static String eventuallyRemoveStartingAndEndingDoubleQuote(String s) { public static String eventuallyRemoveStartingAndEndingDoubleQuote(String s) {
if (s.startsWith("\"") && s.endsWith("\"")) { if (s.startsWith("\"") && s.endsWith("\"")) {
return s.substring(1, s.length() - 1); return s.substring(1, s.length() - 1);
@ -219,7 +273,7 @@ public class StringUtils {
public static boolean isCJK(char c) { public static boolean isCJK(char c) {
final Character.UnicodeBlock block = Character.UnicodeBlock.of(c); final Character.UnicodeBlock block = Character.UnicodeBlock.of(c);
System.err.println(block); Log.println("block=" + block);
return false; return false;
} }
@ -253,10 +307,33 @@ public class StringUtils {
return result; return result;
} }
public static int getWidth(Display stringsToDisplay) {
int result = 1;
for (CharSequence s : stringsToDisplay) {
if (result < s.length()) {
result = s.length();
}
}
return result;
}
public static int getHeight(List<? extends CharSequence> stringsToDisplay) { public static int getHeight(List<? extends CharSequence> stringsToDisplay) {
return stringsToDisplay.size(); return stringsToDisplay.size();
} }
public static int getHeight(Display stringsToDisplay) {
return stringsToDisplay.size();
}
private static void removeFirstColumn(List<String> data) {
for (int i = 0; i < data.size(); i++) {
final String s = data.get(i);
if (s.length() > 0) {
data.set(i, s.substring(1));
}
}
}
private static boolean firstColumnRemovable(List<String> data) { private static boolean firstColumnRemovable(List<String> data) {
boolean allEmpty = true; boolean allEmpty = true;
for (String s : data) { for (String s : data) {
@ -272,15 +349,6 @@ public class StringUtils {
return allEmpty == false; return allEmpty == false;
} }
private static void removeFirstColumn(List<String> data) {
for (int i = 0; i < data.size(); i++) {
final String s = data.get(i);
if (s.length() > 0) {
data.set(i, s.substring(1));
}
}
}
public static List<String> removeEmptyColumns(List<String> data) { public static List<String> removeEmptyColumns(List<String> data) {
if (firstColumnRemovable(data) == false) { if (firstColumnRemovable(data) == false) {
return data; return data;
@ -289,7 +357,7 @@ public class StringUtils {
do { do {
removeFirstColumn(result); removeFirstColumn(result);
} while (firstColumnRemovable(result)); } while (firstColumnRemovable(result));
return Collections.unmodifiableList(result); return result;
} }
public static void trim(List<String> data, boolean removeEmptyLines) { public static void trim(List<String> data, boolean removeEmptyLines) {
@ -330,6 +398,9 @@ public class StringUtils {
if (uml.startsWith("@startuml\nversion\n")) { if (uml.startsWith("@startuml\nversion\n")) {
return false; return false;
} }
if (uml.startsWith("@startuml\ncheckversion")) {
return false;
}
if (uml.startsWith("@startuml\ntestdot\n")) { if (uml.startsWith("@startuml\ntestdot\n")) {
return false; return false;
} }
@ -360,6 +431,16 @@ public class StringUtils {
return getAsHtml(color.getRGB()); return getAsHtml(color.getRGB());
} }
public static String getAsSvg(ColorMapper mapper, HtmlColor color) {
if (color == null) {
return "none";
}
if (color instanceof HtmlColorTransparent) {
return "#FFFFFF";
}
return getAsHtml(mapper.getMappedColor(color));
}
public static String getAsHtml(int color) { public static String getAsHtml(int color) {
final int v = 0xFFFFFF & color; final int v = 0xFFFFFF & color;
String s = "000000" + Integer.toHexString(v).toUpperCase(); String s = "000000" + Integer.toHexString(v).toUpperCase();
@ -371,8 +452,30 @@ public class StringUtils {
return uid1 + String.format("%04d", uid2); return uid1 + String.format("%04d", uid2);
} }
public static Display manageEmbededDiagrams(final Display strings) {
Display result = new Display();
final Iterator<CharSequence> it = strings.iterator();
while (it.hasNext()) {
CharSequence s = it.next();
if (s.equals("{{")) {
Display other = new Display();
other = other.add("@startuml");
while (it.hasNext()) {
final CharSequence s2 = it.next();
if (s2.equals("}}")) {
break;
}
other = other.add(s2);
}
other = other.add("@enduml");
s = new EmbededDiagram(other);
}
result = result.add(s);
}
return result;
}
public static List<CharSequence> manageEmbededDiagrams(final List<String> strings) { public static List<CharSequence> manageEmbededDiagrams2(final List<String> strings) {
final List<CharSequence> result = new ArrayList<CharSequence>(); final List<CharSequence> result = new ArrayList<CharSequence>();
final Iterator<String> it = strings.iterator(); final Iterator<String> it = strings.iterator();
while (it.hasNext()) { while (it.hasNext()) {
@ -381,20 +484,28 @@ public class StringUtils {
final List<String> other = new ArrayList<String>(); final List<String> other = new ArrayList<String>();
other.add("@startuml"); other.add("@startuml");
while (it.hasNext()) { while (it.hasNext()) {
String s2 = it.next(); final String s2 = it.next();
if (s2.equals("}}")) { if (s2.equals("}}")) {
break; break;
} }
other.add(s2); other.add(s2);
} }
other.add("@enduml"); other.add("@enduml");
s = new EmbededDiagram(other); s = new EmbededDiagram(new Display(other));
} }
result.add(s); result.add(s);
} }
return result; return result;
} }
public static boolean isMethod(String s) {
return s.contains("(") || s.contains(")");
}
public static <O> List<O> merge(List<O> l1, List<O> l2) {
final List<O> result = new ArrayList<O>(l1);
result.addAll(l2);
return Collections.unmodifiableList(result);
}
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,13 +28,18 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 7173 $ * Revision $Revision: 11873 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import java.awt.Font;
import java.awt.geom.AffineTransform;
import java.awt.geom.Dimension2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -42,46 +47,54 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Hashtable;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.code.Compression; import javax.imageio.ImageIO;
import net.sourceforge.plantuml.code.CompressionZlib;
import net.sourceforge.plantuml.graphic.HorizontalAlignement; import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.UnparsableGraphvizException;
import net.sourceforge.plantuml.flashcode.FlashCodeFactory;
import net.sourceforge.plantuml.flashcode.FlashCodeUtils;
import net.sourceforge.plantuml.graphic.GraphicStrings;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.QuoteUtils;
import net.sourceforge.plantuml.mjpeg.MJPEGGenerator;
import net.sourceforge.plantuml.pdf.PdfConverter; import net.sourceforge.plantuml.pdf.PdfConverter;
import net.sourceforge.plantuml.svek.EmptySvgException;
import net.sourceforge.plantuml.ugraphic.Sprite;
import net.sourceforge.plantuml.ugraphic.UAntiAliasing;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.version.Version;
import com.google.zxing.BarcodeFormat; public abstract class UmlDiagram extends AbstractPSystem implements Diagram {
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
public abstract class UmlDiagram extends AbstractPSystem implements PSystem {
private boolean rotation; private boolean rotation;
private boolean hideUnlinkedData; private boolean hideUnlinkedData;
private int minwidth = Integer.MAX_VALUE; private int minwidth = Integer.MAX_VALUE;
private List<? extends CharSequence> title; private Display title;
private List<String> header; private Display header;
private List<String> footer; private Display footer;
private HorizontalAlignement headerAlignement = HorizontalAlignement.RIGHT; private Display legend = null;
private HorizontalAlignement footerAlignement = HorizontalAlignement.CENTER; private HorizontalAlignment legendAlignment = HorizontalAlignment.CENTER;
private HorizontalAlignment headerAlignment = HorizontalAlignment.RIGHT;
private HorizontalAlignment footerAlignment = HorizontalAlignment.CENTER;
private final Pragma pragma = new Pragma(); private final Pragma pragma = new Pragma();
private Scale scale; private Scale scale;
private final SkinParam skinParam = new SkinParam(getUmlDiagramType()); private final SkinParam skinParam = new SkinParam(getUmlDiagramType());
final public void setTitle(List<? extends CharSequence> strings) { final public void setTitle(Display strings) {
this.title = strings; this.title = strings;
} }
final public List<? extends CharSequence> getTitle() { final public Display getTitle() {
return title; return title;
} }
@ -109,36 +122,36 @@ public abstract class UmlDiagram extends AbstractPSystem implements PSystem {
skinParam.setParam(key.toLowerCase(), value); skinParam.setParam(key.toLowerCase(), value);
} }
public final List<String> getHeader() { public final Display getHeader() {
return header; return header;
} }
public final void setHeader(List<String> header) { public final void setHeader(Display header) {
this.header = header; this.header = header;
} }
public final List<String> getFooter() { public final Display getFooter() {
return footer; return footer;
} }
public final void setFooter(List<String> footer) { public final void setFooter(Display footer) {
this.footer = footer; this.footer = footer;
} }
public final HorizontalAlignement getHeaderAlignement() { public final HorizontalAlignment getHeaderAlignment() {
return headerAlignement; return headerAlignment;
} }
public final void setHeaderAlignement(HorizontalAlignement headerAlignement) { public final void setHeaderAlignment(HorizontalAlignment headerAlignment) {
this.headerAlignement = headerAlignement; this.headerAlignment = headerAlignment;
} }
public final HorizontalAlignement getFooterAlignement() { public final HorizontalAlignment getFooterAlignment() {
return footerAlignement; return footerAlignment;
} }
public final void setFooterAlignement(HorizontalAlignement footerAlignement) { public final void setFooterAlignment(HorizontalAlignment footerAlignment) {
this.footerAlignement = footerAlignement; this.footerAlignment = footerAlignment;
} }
abstract public UmlDiagramType getUmlDiagramType(); abstract public UmlDiagramType getUmlDiagramType();
@ -174,55 +187,137 @@ public abstract class UmlDiagram extends AbstractPSystem implements PSystem {
this.hideUnlinkedData = hideUnlinkedData; this.hideUnlinkedData = hideUnlinkedData;
} }
final public void exportDiagram(OutputStream os, StringBuilder cmap, int index, FileFormatOption fileFormatOption) final public ImageData exportDiagram(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException { throws IOException {
List<BufferedImage> flashcodes = null; List<BufferedImage> flashcodes = null;
try { try {
if ("split".equalsIgnoreCase(getSkinParam().getValue("flashcode")) if ("split".equalsIgnoreCase(getSkinParam().getValue("flashcode"))
&& fileFormatOption.getFileFormat() == FileFormat.PNG) { && fileFormatOption.getFileFormat() == FileFormat.PNG) {
final String s = getSource().getPlainString(); final String s = getSource().getPlainString();
flashcodes = exportSplitCompress(s); flashcodes = getFlashCodeUtils().exportSplitCompress(s);
} else if ("compress".equalsIgnoreCase(getSkinParam().getValue("flashcode")) } else if ("compress".equalsIgnoreCase(getSkinParam().getValue("flashcode"))
&& fileFormatOption.getFileFormat() == FileFormat.PNG) { && fileFormatOption.getFileFormat() == FileFormat.PNG) {
final String s = getSource().getPlainString(); final String s = getSource().getPlainString();
flashcodes = exportFlashcodeCompress(s); flashcodes = getFlashCodeUtils().exportFlashcodeCompress(s);
} else if (getSkinParam().getValue("flashcode") != null } else if (getSkinParam().getValue("flashcode") != null
&& fileFormatOption.getFileFormat() == FileFormat.PNG) { && fileFormatOption.getFileFormat() == FileFormat.PNG) {
final String s = getSource().getPlainString(); final String s = getSource().getPlainString();
flashcodes = exportFlashcodeSimple(s); flashcodes = getFlashCodeUtils().exportFlashcodeSimple(s);
} }
} catch (WriterException e) { } catch (IOException e) {
Log.error("Cannot generate flashcode"); Log.error("Cannot generate flashcode");
e.printStackTrace(); e.printStackTrace();
flashcodes = null; flashcodes = null;
} }
if (fileFormatOption.getFileFormat() == FileFormat.PDF) { if (fileFormatOption.getFileFormat() == FileFormat.PDF) {
exportDiagramInternalPdf(os, cmap, index, flashcodes); return exportDiagramInternalPdf(os, index, flashcodes);
return;
} }
exportDiagramInternal(os, cmap, index, fileFormatOption, flashcodes); if (fileFormatOption.getFileFormat() == FileFormat.MJPEG) {
// exportDiagramInternalMjpeg(os);
// return;*
throw new UnsupportedOperationException();
}
try {
final ImageData imageData = exportDiagramInternal(os, index, fileFormatOption, flashcodes);
this.lastInfo = new Dimension2DDouble(imageData.getWidth(), imageData.getHeight());
return imageData;
} catch (UnparsableGraphvizException e) {
e.printStackTrace();
exportDiagramError(os, e.getCause(), fileFormatOption, e.getGraphvizVersion(), e.getDebugData());
} catch (Exception e) {
e.printStackTrace();
exportDiagramError(os, e, fileFormatOption, null, null);
}
return new ImageDataSimple();
} }
private void exportDiagramInternalPdf(OutputStream os, StringBuilder cmap, int index, List<BufferedImage> flashcodes) private void exportDiagramError(OutputStream os, Throwable exception, FileFormatOption fileFormat,
String graphvizVersion, String svg) throws IOException {
final UFont font = new UFont("SansSerif", Font.PLAIN, 12);
final List<String> strings = new ArrayList<String>();
strings.add("An error has occured : " + exception);
final String quote = QuoteUtils.getSomeQuote();
strings.add("<i>" + quote);
strings.add(" ");
strings.add("PlantUML (" + Version.versionString() + ") cannot parse result from dot/GraphViz.");
if (exception instanceof EmptySvgException) {
strings.add("Because dot/GraphViz returns an empty string.");
}
if (graphvizVersion != null) {
strings.add(" ");
strings.add("GraphViz version used : " + graphvizVersion);
}
strings.add(" ");
strings.add("This may be caused by :");
strings.add(" - a bug in PlantUML");
strings.add(" - a problem in GraphViz");
strings.add(" ");
strings.add("You should send this diagram and this image to <b>plantuml@gmail.com</b> to solve this issue.");
strings.add("You can try to turn arround this issue by simplifing your diagram.");
strings.add(" ");
strings.add(exception.toString());
for (StackTraceElement ste : exception.getStackTrace()) {
strings.add(" " + ste.toString());
}
final GraphicStrings graphicStrings = new GraphicStrings(strings, font, HtmlColorUtils.BLACK,
HtmlColorUtils.WHITE, UAntiAliasing.ANTI_ALIASING_ON);
graphicStrings.writeImage(os, fileFormat, svg);
}
private FlashCodeUtils getFlashCodeUtils() {
return FlashCodeFactory.getFlashCodeUtils();
}
private void exportDiagramInternalMjpeg(OutputStream os) throws IOException {
final File f = new File("c:/test.avi");
final int nb = 150;
final double framerate = 30;
final MJPEGGenerator m = new MJPEGGenerator(f, 640, 480, framerate, nb);
for (int i = 0; i < nb; i++) {
final AffineTransform at = new AffineTransform();
final double coef = (nb - 1 - i) * 1.0 / nb;
at.setToShear(coef, coef);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
// exportDiagramTOxxBEREMOVED(baos, null, 0, new FileFormatOption(FileFormat.PNG, at));
baos.close();
final BufferedImage im = ImageIO.read(new ByteArrayInputStream(baos.toByteArray()));
m.addImage(im);
}
m.finishAVI();
}
private Dimension2D lastInfo;
private ImageData exportDiagramInternalPdf(OutputStream os, int index, List<BufferedImage> flashcodes)
throws IOException { throws IOException {
final File svg = FileUtils.createTempFile("pdf", ".svf"); final File svg = FileUtils.createTempFile("pdf", ".svf");
final File pdfFile = FileUtils.createTempFile("pdf", ".pdf"); final File pdfFile = FileUtils.createTempFile("pdf", ".pdf");
final OutputStream fos = new BufferedOutputStream(new FileOutputStream(svg)); final OutputStream fos = new BufferedOutputStream(new FileOutputStream(svg));
exportDiagram(fos, cmap, index, new FileFormatOption(FileFormat.SVG)); final ImageData result = exportDiagram(fos, index, new FileFormatOption(FileFormat.SVG));
fos.close(); fos.close();
PdfConverter.convert(svg, pdfFile); PdfConverter.convert(svg, pdfFile);
FileUtils.copyToStream(pdfFile, os); FileUtils.copyToStream(pdfFile, os);
return result;
} }
protected abstract void exportDiagramInternal(OutputStream os, StringBuilder cmap, int index, protected abstract ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption,
FileFormatOption fileFormatOption, List<BufferedImage> flashcodes) throws IOException; List<BufferedImage> flashcodes) throws IOException;
final protected void exportCmap(File suggestedFile, final StringBuilder cmap) throws FileNotFoundException { final protected void exportCmap(File suggestedFile, final ImageData cmapdata) throws FileNotFoundException {
final File cmapFile = new File(changeName(suggestedFile.getAbsolutePath())); final String name = changeName(suggestedFile.getAbsolutePath());
final File cmapFile = new File(name);
PrintWriter pw = null; PrintWriter pw = null;
try { try {
if (PSystemUtils.canFileBeWritten(cmapFile) == false) {
return;
}
pw = new PrintWriter(cmapFile); pw = new PrintWriter(cmapFile);
pw.print(cmap.toString()); pw.print(cmapdata.getCMapData(cmapFile.getName().substring(0, cmapFile.getName().length() - 6)));
pw.close(); pw.close();
} finally { } finally {
if (pw != null) { if (pw != null) {
@ -235,83 +330,43 @@ public abstract class UmlDiagram extends AbstractPSystem implements PSystem {
return name.replaceAll("(?i)\\.\\w{3}$", ".cmapx"); return name.replaceAll("(?i)\\.\\w{3}$", ".cmapx");
} }
private List<BufferedImage> exportFlashcodeSimple(String s) throws IOException, WriterException { @Override
final QRCodeWriter writer = new QRCodeWriter(); public String getWarningOrError() {
final int multiple = 1; if (lastInfo == null) {
final Hashtable hints = new Hashtable(); return null;
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
final BitMatrix bit = writer.encode(s, BarcodeFormat.QR_CODE, multiple);
final BufferedImage im = MatrixToImageWriter.toBufferedImage(bit);
return Arrays.asList(im);
}
private List<BufferedImage> exportFlashcodeCompress(String s) throws IOException, WriterException {
final QRCodeWriter writer = new QRCodeWriter();
final int multiple = 1;
final Hashtable hints = new Hashtable();
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
final Compression comp = new CompressionZlib();
final byte data[] = comp.compress(s.getBytes("UTF-8"));
// Encoder.DEFAULT_BYTE_MODE_ENCODING
final BitMatrix bit = writer.encode(new String(data, "ISO-8859-1"), BarcodeFormat.QR_CODE, multiple);
final BufferedImage im = MatrixToImageWriter.toBufferedImage(bit);
return Arrays.asList(im);
}
private List<BufferedImage> exportSplitCompress(String s) throws IOException, WriterException {
final QRCodeWriter writer = new QRCodeWriter();
final int multiple = 1;
final Hashtable hints = new Hashtable();
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
final Compression comp = new CompressionZlib();
final byte data[] = comp.compress(s.getBytes("UTF-8"));
final List<BufferedImage> result = new ArrayList<BufferedImage>();
final List<byte[]> blocs = new ArrayList<byte[]>();
for (int i = 0; i < 4; i++) {
blocs.add(getSplited(data, i, 4));
} }
final double actualWidth = lastInfo.getWidth();
blocs.add(xor(blocs)); if (actualWidth == 0) {
return null;
for (byte d[] : blocs) {
// Encoder.DEFAULT_BYTE_MODE_ENCODING
final BitMatrix bit = writer.encode(new String(d, "ISO-8859-1"), BarcodeFormat.QR_CODE, multiple);
result.add(MatrixToImageWriter.toBufferedImage(bit));
} }
final String value = getSkinParam().getValue("widthwarning");
return Collections.unmodifiableList(result); if (value == null) {
return null;
}
if (value.matches("\\d+") == false) {
return null;
}
final int widthwarning = Integer.parseInt(value);
if (actualWidth > widthwarning) {
return "The image is " + ((int) actualWidth) + " pixel width. (Warning limit is " + widthwarning + ")";
}
return null;
} }
static byte[] xor(List<byte[]> blocs) { public void addSprite(String name, Sprite sprite) {
final byte result[] = new byte[blocs.get(0).length]; skinParam.addSprite(name, sprite);
for (int i = 0; i < result.length; i++) {
result[i] = xor(blocs, i);
}
return result;
} }
static byte xor(List<byte[]> blocs, int nb) { public final Display getLegend() {
byte result = 0; return legend;
for (byte[] bloc : blocs) {
result = (byte) (result ^ bloc[nb]);
}
return result;
} }
static byte[] getSplited(byte[] data, int n, int total) { public final HorizontalAlignment getLegendAlignment() {
final int size = (data.length + total - 1) / total; return legendAlignment;
assert size * total >= data.length;
final byte result[] = new byte[size + 1];
result[0] = (byte) (1 << n);
for (int i = 0; (i < size) && (n * total + i < data.length); i++) {
result[i + 1] = data[n * total + i];
}
return result;
} }
public final void setLegend(Display legend, HorizontalAlignment horizontalAlignment) {
this.legend = legend;
this.legendAlignment = horizontalAlignment;
}
} }

View File

@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator * PlantUML : a free UML diagram generator
* ======================================================================== * ========================================================================
* *
* (C) Copyright 2009, Arnaud Roques * (C) Copyright 2009-2013, Arnaud Roques
* *
* Project Info: http://plantuml.sourceforge.net * Project Info: http://plantuml.sourceforge.net
* *
@ -15,7 +15,7 @@
* *
* PlantUML distributed in the hope that it will be useful, but * PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details. * License for more details.
* *
* You should have received a copy of the GNU General Public * You should have received a copy of the GNU General Public
@ -28,11 +28,11 @@
* *
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* *
* Revision $Revision: 4539 $ * Revision $Revision: 9786 $
* *
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
public enum UmlDiagramType { public enum UmlDiagramType {
SEQUENCE, STATE, CLASS, OBJECT, ACTIVITY, USECASE, COMPONENT, COMPOSITE SEQUENCE, STATE, CLASS, OBJECT, ACTIVITY, DESCRIPTION, COMPOSITE, FLOW
} }

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