diff --git a/pom.xml b/pom.xml
index 16dbc0ebc..0005cf2c7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
net.sourceforge.plantuml
plantuml
- 1.2019.8-SNAPSHOT
+ 1.2019.9-SNAPSHOT
jar
PlantUML
diff --git a/skin/debug.skin b/skin/debug.skin
new file mode 100644
index 000000000..114cf9021
--- /dev/null
+++ b/skin/debug.skin
@@ -0,0 +1,169 @@
+style root {
+ FontName SansSerif
+ HyperLinkColor red
+ FontColor green
+ FontSize 19
+ FontStyle plain
+ HorizontalAlignment left
+ RoundCorner 15
+ DiagonalCorner 0
+ LineColor #3600A8
+ LineThickness 1.0
+ BackGroundColor #AAA
+ Shadowing 0.0
+}
+
+style stereotype {
+ FontColor blue
+ FontSize 8
+ FontStyle bold
+}
+
+style title {
+ HorizontalAlignment right
+ FontSize 24
+ FontColor blue
+}
+
+style header {
+ HorizontalAlignment center
+ FontSize 26
+ FontColor purple
+}
+
+style footer {
+ HorizontalAlignment left
+ FontSize 28
+ FontColor red
+}
+
+style legend {
+ FontSize 30
+ BackGroundColor yellow
+ Margin 30
+ Padding 50
+}
+
+style caption {
+ FontSize 32
+}
+
+
+style element {
+ BackGroundColor #CEFEFE
+}
+
+style sequenceDiagram {
+}
+
+style classDiagram {
+}
+
+style activityDiagram {
+}
+
+
+style group {
+ LineThickness 3.5
+ BackGroundColor MistyRose
+ LineColor DarkOrange
+
+ FontSize 12
+ FontStyle italic
+ FontColor red
+}
+
+style groupHeader {
+ BackGroundColor tan
+ LineThickness 0.5
+ LineColor yellow
+
+ FontSize 18
+ FontStyle bold
+ FontColor blue
+}
+
+style lifeLine {
+ BackGroundColor gold
+}
+
+style destroy {
+ LineColor red
+}
+
+style reference {
+ LineColor red
+ FontSize 10
+ FontStyle bold
+ FontColor blue
+ BackGroundColor gold
+ HorizontalAlignment right
+}
+
+style box {
+ LineThickness 0.1
+ LineColor FireBrick
+ BackGroundColor PowderBlue
+
+ FontSize 12
+ FontStyle italic
+ FontColor Maroon
+}
+
+style separator {
+ LineColor red
+ BackGroundColor green
+
+ FontSize 16
+ FontStyle bold
+ FontColor white
+}
+
+style delay {
+ FontSize 22
+ FontStyle italic
+}
+
+style participant {
+ LineThickness 2.5
+}
+
+style actor {
+ LineThickness 0.5
+}
+
+style boundary {
+ LineThickness 1.5
+}
+
+style control {
+ LineThickness 1.5
+}
+
+style entity {
+ LineThickness 1.5
+}
+
+style queue {
+ LineThickness 1.5
+}
+
+style database {
+ LineThickness 1.5
+}
+
+style collections {
+ LineThickness 1.5
+}
+
+style message {
+}
+
+style note {
+ BackGroundColor GoldenRod
+}
+
+style swimlane {
+}
+
+
diff --git a/skin/plantuml.skin b/skin/plantuml.skin
new file mode 100644
index 000000000..97c731130
--- /dev/null
+++ b/skin/plantuml.skin
@@ -0,0 +1,164 @@
+style root {
+ FontName SansSerif
+ HyperLinkColor red
+ FontColor black
+ FontSize 14
+ FontStyle plain
+ HorizontalAlignment left
+ RoundCorner 0
+ DiagonalCorner 0
+ LineThickness 1.0
+ LineColor #A80036
+ BackGroundColor #FEFECE
+ Shadowing 0.0
+}
+
+style stereotype {
+ FontStyle italic
+}
+
+style title {
+ HorizontalAlignment center
+ FontSize 14
+ FontStyle bold
+ Padding 0
+ Margin 4
+ LineColor none
+ BackGroundColor none
+}
+
+style header {
+ HorizontalAlignment center
+ FontSize 10
+ FontColor #888888
+}
+
+style footer {
+ HorizontalAlignment left
+ FontSize 10
+ FontColor #888888
+}
+
+style legend {
+ LineColor black
+ BackGroundColor #DDDDDD
+ FontSize 14
+ RoundCorner 15
+ Padding 6
+ Margin 8
+}
+
+style caption {
+ HorizontalAlignment center
+ FontSize 14
+ Padding 0
+ Margin 1
+ LineColor none
+ BackGroundColor none
+}
+
+
+style element {
+ Shadowing 4.0
+}
+
+style sequenceDiagram {
+}
+
+style classDiagram {
+}
+
+style activityDiagram {
+}
+
+style group {
+ BackGroundColor none
+ LineColor black
+ LineThickness 2.0
+ FontSize 11
+
+ FontStyle bold
+}
+
+style groupHeader {
+ BackGroundColor #EEEEEE
+ LineColor black
+
+ FontSize 13
+ FontStyle bold
+}
+
+style lifeLine {
+ BackGroundColor none
+}
+
+style destroy {
+}
+
+style reference {
+ LineColor red
+ FontSize 10
+ FontStyle bold
+ FontColor blue
+ BackGroundColor gold
+ HorizontalAlignment right
+}
+
+style box {
+ BackGroundColor #DDDDDD
+
+ FontSize 13
+ FontStyle bold
+}
+
+style separator {
+ LineColor black
+ LineThickness 2.0
+ BackGroundColor #EEEEEE
+
+ FontSize 13
+ FontStyle bold
+}
+
+style delay {
+ FontSize 22
+ FontStyle italic
+}
+
+style participant {
+ LineThickness 1.5
+}
+
+style actor {
+ LineThickness 2.0
+}
+
+style boundary {
+}
+
+style control {
+}
+
+style entity {
+}
+
+style queue {
+}
+
+style database {
+}
+
+style collections {
+}
+
+style swimlane {
+}
+
+style message {
+ FontSize 13
+}
+
+style note {
+ FontSize 13
+ BackGroundColor #FBFB77
+}
\ No newline at end of file
diff --git a/skin/reddress.skin b/skin/reddress.skin
new file mode 100644
index 000000000..eaee122cb
--- /dev/null
+++ b/skin/reddress.skin
@@ -0,0 +1,116 @@
+!ifndef FONTNAME
+!define FONTNAME "Verdana"
+!endif
+
+!ifndef FONTSIZE
+!define FONTSIZE 11
+!endif
+
+!ifdef DARKBLUE
+skinparam backgroundColor 777
+!define ACCENT 1a66c2
+!define ACCENTDARK 002642
+skinparam stereotypeCBackgroundColor ACCENT
+!define DARKSTYLE
+!endif
+!ifdef LIGHTBLUE
+!define ACCENT 2a86e2
+!define ACCENTDARK 1a66c2
+skinparam stereotypeCBackgroundColor ACCENTDARK
+!define LIGHTSTYLE
+!endif
+
+!ifdef DARKRED
+!define ACCENT 880000
+!define ACCENTDARK 330000
+skinparam stereotypeCBackgroundColor ACCENT
+!define DARKSTYLE
+!endif
+!ifdef LIGHTRED
+!define ACCENT CC0033
+!define ACCENTDARK AA0033
+skinparam stereotypeCBackgroundColor ACCENTDARK
+!define LIGHTSTYLE
+!endif
+
+!ifdef DARKGREEN
+!define ACCENT 228811
+!define ACCENTDARK 113300
+skinparam stereotypeCBackgroundColor ACCENT
+!define DARKSTYLE
+!endif
+!ifdef LIGHTGREEN
+!define ACCENT 55BB33
+!define ACCENTDARK 338822
+skinparam stereotypeCBackgroundColor ACCENTDARK
+!define LIGHTSTYLE
+!endif
+
+!ifdef DARKORANGE
+!define ACCENT BB6600
+!define ACCENTDARK 662200
+skinparam stereotypeCBackgroundColor ACCENT
+!define DARKSTYLE
+!endif
+!ifdef LIGHTORANGE
+!define ACCENT FF8800
+!define ACCENTDARK BB6600
+skinparam stereotypeCBackgroundColor ACCENT
+!define LIGHTSTYLE
+!endif
+
+!ifdef LIGHTSTYLE
+!define PRIMARY 000
+!define SECONDARY 333
+!define ARROWCOLOR 000
+!define ARROWFONTCOLOR 333
+!define BORDERCOLOR aaa
+!define BOXBG ccc
+skinparam backgroundColor fff
+!endif
+
+!ifdef DARKSTYLE
+!define PRIMARY fff
+!define SECONDARY aaa
+!define ARROWCOLOR fff
+!define ARROWFONTCOLOR bbb
+!define BORDERCOLOR 1b1b1b
+!define BOXBG 2e2e2e
+skinparam backgroundColor 777
+!endif
+
+
+skinparam circledCharacter {
+ radius 8
+ fontSize FONTSIZE
+ fontName FONTNAME
+}
+
+skinparam class {
+ backgroundColor BOXBG
+ borderColor BORDERCOLOR
+
+ fontColor PRIMARY
+ fontName FONTNAME
+ fontSize FONTSIZE
+
+ arrowColor ARROWCOLOR
+ arrowFontName FONTNAME
+ arrowFontColor ARROWFONTCOLOR
+ arrowFontSize FONTSIZE
+
+ attributeFontColor SECONDARY
+ attributeFontSize FONTSIZE
+ attributeIconSize FONTSIZE
+ stereotypeFontColor SECONDARY
+ stereotypeFontSize FONTSIZE
+}
+
+skinparam note {
+ backgroundColor ACCENT
+ borderColor ACCENTDARK
+
+ fontColor PRIMARY
+ fontName FONTNAME
+ fontSize FONTSIZE
+}
\ No newline at end of file
diff --git a/skin/sonyxperiadev.skin b/skin/sonyxperiadev.skin
new file mode 100644
index 000000000..d42f74ab2
--- /dev/null
+++ b/skin/sonyxperiadev.skin
@@ -0,0 +1,37 @@
+SkinParam BackgroundColor #white
+SkinParam Shadowing false
+SkinParam SequenceMessageAlign center
+SkinParam DefaultFontName Arial
+SkinParam DefaultFontStyle bold
+SkinParam DefaultFontColor #333333
+
+SkinParam NoteBackgroundColor #fbfb77
+SkinParam NoteBorderColor #cbcb47
+
+SkinParam NoteBackgroundColor #ffffcd
+SkinParam NoteBorderColor #a9a980
+SkinParam NoteFontColor #676735
+SkinParam NoteFontStyle italic
+
+SkinParam SequenceArrowColor #555555
+SkinParam SequenceArrowFontColor #555555
+SkinParam SequenceArrowFontStyle none
+
+SkinParam SequenceBoxBackgroundColor #fafafa
+SkinParam SequenceBoxBorderColor #eeeeee
+SkinParam SequenceBoxFontColor #666666
+SkinParam SequenceBoxFontSize 12
+SkinParam SequenceBoxFontStyle italic
+
+SkinParam ParticipantBackgroundColor #dde5ff
+SkinParam ParticipantBorderColor #cccccc
+SkinParam ParticipantFontColor #333333
+SkinParam ParticipantFontStyle bold
+
+SkinParam DatabaseBackgroundColor #df4646
+SkinParam DatabaseFontColor #red
+SkinParam DatabaseFontStyle bold
+
+SkinParam EntityBackgroundColor #999999
+
+SkinParam SequenceLifeLineBorderColor #bbbbbb
diff --git a/src/jcckit/GraphicsPlotCanvas.java b/src/jcckit/GraphicsPlotCanvas.java
deleted file mode 100644
index 5d2b41b4a..000000000
--- a/src/jcckit/GraphicsPlotCanvas.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.image.BufferedImage;
-
-import jcckit.graphic.GraphicalElement;
-import jcckit.graphic.Renderer;
-import jcckit.plot.Plot;
-import jcckit.plot.PlotCanvas;
-import jcckit.renderer.Graphics2DRenderer;
-import jcckit.renderer.Transformation;
-import jcckit.util.ConfigParameters;
-import jcckit.util.Factory;
-
-/**
- * Class which handles plotting into a Graphics context based on the
- * {@link jcckit.renderer.GraphicsRenderer}. This class is not a subclass of
- * java.awt.Component. The actual AWT component presenting the plot
- * is an innerclass. Its instance wrapped by GraphicsPlotCanvas can
- * be obtained with {@link #getGraphicsCanvas}.
- *
- * The plot is painted by using double-buffering and pre-rendered view of the
- * coordinate system. That is, the coordinate system is drawn into an off-screen
- * image. It will be redrawn only if the size of the embedding AWT component is
- * changed.
- *
- * @author Franz-Josef Elmer
- */
-public class GraphicsPlotCanvas extends PlotCanvas {
- /** Key of a configuration parameter. */
- public static final String BACKGROUND_KEY = "background";
- public static final String FOREGROUND_KEY = "foreground";
- public static final String DOUBLE_BUFFERING_KEY = "doubleBuffering";
-
- /**
- * Class which does the actual painting. Needs the Component into
- * which the plot is painted for some resources like size, background color,
- * etc.
- *
- * @author Franz-Josef Elmer
- */
- private final BufferedImage img3;
-
- private final Graphics2D g3;
-
- private Transformation _transformation;
- private String _renderer = "jcckit.renderer.GraphicsRenderer";
-
- private GraphicalElement _marker;
-
- /**
- * Creates an instance from the specified configuration parameters.
- *
- * Key & Default Value |
- * Type |
- * Mandatory |
- * Description |
- *
- *
- * background = default background color of the wrapped
- * AWT component |
- * Color |
- * no |
- * Background color of the wrapped AWT component. |
- *
- *
- * foreground = default foreground color of the wrapped
- * AWT component |
- * Color |
- * no |
- * Foreground color of the wrapped AWT component. |
- *
- *
- * doubleBuffering = true |
- * boolean | no |
- * If true the plot will be painted by using
- * double-buffering and pre-rendered view of the coordinate system.
- * |
- *
- * In addition the configuration parameters of the
- *
- * constructor of the superclass {@link jcckit.plot.PlotCanvas} apply.
- */
- public GraphicsPlotCanvas(ConfigParameters config, BufferedImage img3) {
- super(config);
- this.img3 = img3;
- setRenderer("jcckit.renderer.Graphics2DRenderer");
-
- g3 = img3.createGraphics();
- g3.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
-
- // _doubleBuffering = config.getBoolean(DOUBLE_BUFFERING_KEY, true);
- background = config.getColor(BACKGROUND_KEY, Color.WHITE);
- foreground = config.getColor(FOREGROUND_KEY, Color.BLACK);
- }
-
- private final Color background;
- private final Color foreground;
-
- /**
- * Paints the plot. If {@link GraphicsPlotCanvas#_doubleBuffering} is set
- * double-buffering and pre-rendered view of the coordinate system is used.
- */
- public void paint() {
- Dimension size = new Dimension(img3.getWidth(), img3.getHeight());
- g3.setColor(background);
- g3.fillRect(0, 0, size.width + 1, size.height + 1);
-
- init(size);
-
- _transformation.apply(g3);
- Plot plot = getPlot();
- drawCoordinateSystem(size, plot);
- drawPlot(plot);
- if (_marker != null) {
- _marker.renderWith(createRenderer());
- }
- }
-
- private void drawPlot(Plot plot) {
- prepare();
- Renderer renderer = createRenderer();
- GraphicalElement[] curves = plot.getCurves();
- for (int i = 0; i < curves.length; i++) {
- curves[i].renderWith(renderer);
- }
- GraphicalElement annotation = plot.getAnnotation();
- if (annotation != null) {
- annotation.renderWith(renderer);
- }
- if (plot.isLegendVisible()) {
- plot.getLegend().renderWith(renderer);
- }
- }
-
- private void init(Dimension size) {
- calculateTransformation(size);
- }
-
- private void drawCoordinateSystem(Dimension size, Plot plot) {
- g3.setColor(foreground);
- plot.getCoordinateSystem().renderWith(createRenderer());
- }
-
- /**
- * Prepare graphics context before drawing the pre-rendered view of the
- * coordinate system. Does nothing but will be used in subclasses.
- */
- protected void prepare() {
- }
-
- /**
- * Calculate the transformation form device-independent coordinates into
- * device-dependent coordinates according to the specified canvas size.
- */
- protected void calculateTransformation(Dimension size) {
- _transformation = new Transformation(size.width, size.height, getPaper(), getHorizontalAnchor(),
- getVerticalAnchor());
- }
-
- /**
- * Creates an appropriated {@link Renderer} for the specified
- * Graphics context.
- */
- protected Renderer createRenderer() {
- return ((Graphics2DRenderer) Factory.create(_renderer)).init(g3);
- // return ((GraphicsRenderer) Factory.create(_renderer)).init(g, null,
- // _transformation);
- }
-
- /**
- * Sets the renderer used to render the plot. The default value is
- * {@link GraphicsRenderer}.
- *
- * @param className
- * Fully qualified name of the renderer class.
- */
- public void setRenderer(String className) {
- _renderer = className;
- }
-
- // /**
- // * Maps the cursor position onto a point in device-independent
- // coordinates.
- // *
- // * @param x
- // * X-coordinate of the cursor.
- // * @param y
- // * Y-coordinate of the cursor.
- // */
- // public GraphPoint mapCursorPosition(int x, int y) {
- // return _transformation.transformBack(x, y);
- // }
-
- /**
- * Defines a graphical marker which will be drawn on top of the plot. To
- * remove the marker call this method with argument null.
- *
- * @param marker
- * Marker element. Can be null.
- */
- public void setMarker(GraphicalElement marker) {
- _marker = marker;
- }
-
-}
diff --git a/src/jcckit/data/DataContainer.java b/src/jcckit/data/DataContainer.java
deleted file mode 100644
index 831ad0b32..000000000
--- a/src/jcckit/data/DataContainer.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.data;
-
-import java.text.MessageFormat;
-import java.util.Vector;
-
-/**
- * Abstract superclass of all data containers. A data container holds an
- * ordered list of {@link DataElement DataElements} of the same type.
- *
- * Data elements can be added, inserted, removed, or replaced.
- * Such an action leads to a {@link DataEvent} which will be delivered to
- * all {@link DataListener DataListeners} observing this
- * DataContainer
. If this data container also implements
- * {@link DataEvent} (as {@link DataCurve} does) also the listeners
- * registrated at the data container containg this container will be notified.
- * As a consequence a DataListener must only be registered at the
- * {@link DataPlot} instance and it will automatically also received events
- * caused by manipulating one of its DataCurves.
- *
- * Concrete subclasses have to implement {@link #isValid} which
- * checks whether the added or inserted DataElement is of the right
- * type. This is an application of the Template Method Design Pattern.
- *
- * @author Franz-Josef Elmer
- */
-public abstract class DataContainer {
- private final static String TEMPLATE
- = "Invalid operation: {0}, Element: {1}, Container: {2}";
- final static String ADD = "add",
- REPLACE = "replace",
- INSERT = "insert";
-
- private final Vector _listeners = new Vector();
- private final Vector _container = new Vector();
-
- /** Adds a {@link DataListener}. Does nothing if already added. */
- public void addDataListener(DataListener listener) {
- if (!_listeners.contains(listener)) {
- _listeners.addElement(listener);
- }
- }
-
- /** Removes a {@link DataListener}. Does nothing if already removed. */
- public void removeDataListener(DataListener listener) {
- _listeners.removeElement(listener);
- }
-
- private void notifyListeners(DataEvent event) {
- for (int i = 0, n = _listeners.size(); i < n; i++) {
- ((DataListener) _listeners.elementAt(i)).dataChanged(event);
- }
- // Notifies also parent container
- if (this instanceof DataElement) {
- DataContainer container = ((DataElement) this).getContainer();
- if (container != null) {
- container.notifyListeners(event);
- }
- }
- }
-
- /** Returns the number of elements of this container. */
- public int getNumberOfElements() {
- return _container.size();
- }
-
- /** Returns the element for the specified index. */
- public DataElement getElement(int index) {
- return (DataElement) _container.elementAt(index);
- }
-
- /**
- * Returns the index of the specified element.
- * @param element Element to be looked for.
- * @return -1 if not found.
- */
- public int getIndexOf(DataElement element) {
- return _container.indexOf(element);
- }
-
- /**
- * Adds a {@link DataElement}. After the element has been successfully
- * added all {@link DataListener DataListeners} will be informed.
- * @param element DataElement to be added.
- * @throws IllegalArgumentException if element is not of the correct
- * type which will be checked by the method {@link #isValid}.
- */
- public void addElement(DataElement element) {
- if (isValid(element)) {
- _container.addElement(element);
- element.setContainer(this);
- notifyListeners(DataEvent.createAddEvent(this));
- } else {
- throwException(ADD, element);
- }
- }
-
- /**
- * Inserts a {@link DataElement} at the specified index.
- * After the element has been successfully inserted
- * all {@link DataListener DataListeners} will be informed.
- * @param index Index at which element will be inserted.
- * All elements with an index >= index will be shifted.
- * @param element DataElement to be added.
- * @throws IllegalArgumentException if element is not of the correct
- * type which will be checked by the method {@link #isValid}.
- */
- public void insertElementAt(int index, DataElement element) {
- if (isValid(element)) {
- _container.insertElementAt(element, index);
- element.setContainer(this);
- notifyListeners(DataEvent.createInsertEvent(this, index));
- } else {
- throwException(INSERT, element);
- }
- }
-
- /**
- * Removes a {@link DataElement} at the specified index.
- * After the element has been successfully removed
- * all {@link DataListener DataListeners} will be informed.
- * @param index Index of the element which will be removed.
- * All elements with an index > index will be shifted.
- */
- public void removeElementAt(int index) {
- DataElement element = (DataElement) _container.elementAt(index);
- element.setContainer(null);
- _container.removeElementAt(index);
- notifyListeners(DataEvent.createRemoveEvent(this, index, element));
- }
-
- /**
- * Replaces the {@link DataElement} at the specified index.
- * After the element has been successfully replaced
- * all {@link DataListener DataListeners} will be informed.
- * @param index Index of the element which will be replaced by
- * element.
- * @param element The new DataElement.
- * @throws IllegalArgumentException if element is not of the correct
- * type which will be checked by the method {@link #isValid}.
- */
- public void replaceElementAt(int index, DataElement element) {
- if (isValid(element)) {
- DataElement oldElement = (DataElement) _container.elementAt(index);
- oldElement.setContainer(null);
- _container.setElementAt(element, index);
- element.setContainer(this);
- notifyListeners(DataEvent.createReplaceEvent(this, index, oldElement));
- } else {
- throwException(REPLACE, element);
- }
- }
-
- private void throwException(String operation, DataElement element) {
- throw new IllegalArgumentException(MessageFormat.format(TEMPLATE,
- new Object[] {operation, element, this.getClass().getName()}));
- }
-
- /**
- * Returns true if the specified {@link DataElement} has the
- * correct type. Concrete subclasses have to implement this method.
- * @param element DataElement to be checked.
- */
- protected abstract boolean isValid(DataElement element);
-}
diff --git a/src/jcckit/data/DataCurve.java b/src/jcckit/data/DataCurve.java
deleted file mode 100644
index caf94f3fc..000000000
--- a/src/jcckit/data/DataCurve.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.data;
-
-import jcckit.util.ConfigParameters;
-
-/**
- * A curve is a {@link DataContainer} of {@link DataPoint DataPoints}.
- *
- * @author Franz-Josef Elmer
- */
-public class DataCurve extends DataContainer implements DataElement {
- /** Config parameter key. */
- public static final String X_KEY = "x",
- Y_KEY = "y",
- TITLE_KEY = "title";
-
- private final String _title;
- private DataContainer _container;
-
- /** Creates an empty instance with the specified title. */
- public DataCurve(String title) {
- _title = title;
- }
-
- /**
- * Creates an instance from the specified config parameters.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * title = empty string |
- * String | no |
- * Curve title. |
- * x | double[] | yes |
- * x-coordinates of the curve points. |
- * y | double[] | yes |
- * y-coordinates of the curve points. |
- *
- */
- public DataCurve(ConfigParameters config) {
- this(config.get(TITLE_KEY, ""));
- double[] xPoints = config.getDoubleArray(X_KEY);
- double[] yPoints = config.getDoubleArray(Y_KEY);
- int n = Math.min(xPoints.length, yPoints.length);
- for (int i = 0; i < n; i++) {
- addElement(new DataPoint(xPoints[i], yPoints[i]));
- }
- }
-
- /**
- * Returns the {@link DataPlot} containing this curve.
- */
- public DataContainer getContainer() {
- return _container;
- }
-
-
- /**
- * Sets the {@link DataPlot} where this is a curve of.
- */
- public void setContainer(DataContainer container) {
- _container = container;
- }
-
- /** Returns the title of this curve. */
- public String getTitle() {
- return _title;
- }
-
- /**
- * Returns true if element is an instance of
- * {@link DataPoint}.
- */
- protected boolean isValid(DataElement element) {
- return element instanceof DataPoint;
- }
-}
diff --git a/src/jcckit/data/DataElement.java b/src/jcckit/data/DataElement.java
deleted file mode 100644
index a66ce4993..000000000
--- a/src/jcckit/data/DataElement.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.data;
-
-/**
- * Interface for all kinds of data elements.
- *
- * @author Franz-Josef Elmer
- */
-public interface DataElement {
- /**
- * Returns the container containing this element.
- * @return null if this element is not an element of a container.
- */
- public DataContainer getContainer();
-
- /**
- * Sets the container which should contain this element.
- * This method should not used outside {@link DataContainer}..
- * @param container Container which should contains this element. Cann be
- * null if this element does not belong to a container.
- */
- public void setContainer(DataContainer container);
-}
diff --git a/src/jcckit/data/DataEvent.java b/src/jcckit/data/DataEvent.java
deleted file mode 100644
index 8839f1350..000000000
--- a/src/jcckit/data/DataEvent.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.data;
-
-/**
- * Event to be sent to a {@link DataListener}.
- *
- * @author Franz-Josef Elmer
- */
-public class DataEvent {
- private final DataContainer _container;
- private final DataEventType _type;
- private final int _index;
- private final DataElement _deletedElement;
-
- /**
- * Creates an instance for the specified parameters.
- * @param container The container which has been changed.
- * @param type Type of change.
- * @param index Index of the element which has been added, inserted,
- * replaced, or removed.
- * @param deletedElement Element which has been replaced or removed.
- */
- private DataEvent(DataContainer container, DataEventType type, int index,
- DataElement deletedElement) {
- _container = container;
- _type = type;
- _index = index;
- _deletedElement = deletedElement;
- }
-
- /**
- * Creates an event of type {@link DataEventType#ELEMENT_ADDED} for the
- * specified container.
- * @param container Container where an element has been added.
- * @return ELEMENT_ADDED event.
- */
- public static final DataEvent createAddEvent(DataContainer container) {
- return new DataEvent(container, DataEventType.ELEMENT_ADDED,
- container.getNumberOfElements() - 1, null);
- }
-
- /**
- * Creates an event of type {@link DataEventType#ELEMENT_INSERTED} for the
- * specified container.
- * @param container Container where an element has been inserted.
- * @param index Index at which an element has been inserted.
- * @return ELEMENT_INSERTED event.
- */
- public static final DataEvent createInsertEvent(DataContainer container,
- int index) {
- return new DataEvent(container, DataEventType.ELEMENT_INSERTED, index,
- null);
- }
-
- /**
- * Creates an event of type {@link DataEventType#ELEMENT_REPLACED} for the
- * specified container.
- * @param container Container where an element has been replaced.
- * @param index Index of the replaced element.
- * @param replacedElement The previous element at index.
- * @return ELEMENT_REPLACED event.
- */
- public static final DataEvent createReplaceEvent(DataContainer container,
- int index, DataElement replacedElement) {
- return new DataEvent(container, DataEventType.ELEMENT_REPLACED, index,
- replacedElement);
- }
-
- /**
- * Creates an event of type {@link DataEventType#ELEMENT_REMOVED} for the
- * specified container.
- * @param container Container where an element has been removed.
- * @param index Index of the removed element.
- * @param removedElement The previous element at index.
- * @return ELEMENT_REMOVED event.
- */
- public static final DataEvent createRemoveEvent(DataContainer container,
- int index, DataElement removedElement) {
- return new DataEvent(container, DataEventType.ELEMENT_REMOVED, index,
- removedElement);
- }
-
- /** Returns the container. */
- public DataContainer getContainer() {
- return _container;
- }
-
- /**
- * Returns the event type. Will be one of the constants
- * {@link DataEventType#ELEMENT_ADDED},
- * {@link DataEventType#ELEMENT_INSERTED},
- * {@link DataEventType#ELEMENT_REMOVED}, or
- * {@link DataEventType#ELEMENT_REPLACED}.
- */
- public DataEventType getType() {
- return _type;
- }
-
- /** Returns the index. */
- public int getIndex() {
- return _index;
- }
-
- /**
- * Returns the deleted element.
- * @return null if either an element has been added or inserted.
- */
- public DataElement getDeletedElement() {
- return _deletedElement;
- }
-}
diff --git a/src/jcckit/data/DataEventType.java b/src/jcckit/data/DataEventType.java
deleted file mode 100644
index 116139b33..000000000
--- a/src/jcckit/data/DataEventType.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.data;
-
-/**
- * Type of a {@link DataEvent}. Implements the typesafe enumeration pattern.
- *
- * @author Franz-Josef Elmer
- */
-public class DataEventType {
- private DataEventType() {}
-
- /** Event type. */
- public static final DataEventType ELEMENT_ADDED = new DataEventType(),
- ELEMENT_INSERTED = new DataEventType(),
- ELEMENT_REPLACED = new DataEventType(),
- ELEMENT_REMOVED = new DataEventType();
-
-}
diff --git a/src/jcckit/data/DataListener.java b/src/jcckit/data/DataListener.java
deleted file mode 100644
index cd2c70841..000000000
--- a/src/jcckit/data/DataListener.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.data;
-
-/**
- * An interface all observers of {@link DataEvent DataEvents}
- * have to implement.
- *
- * @author Franz-Josef Elmer
- */
-public interface DataListener {
- /**
- * Sends the specified data event to this object.
- * @param event Data event informing where and what happened.
- */
- public void dataChanged(DataEvent event);
-}
diff --git a/src/jcckit/data/DataPlot.java b/src/jcckit/data/DataPlot.java
deleted file mode 100644
index 4ebf14f94..000000000
--- a/src/jcckit/data/DataPlot.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.data;
-
-import java.util.StringTokenizer;
-
-import jcckit.util.ConfigParameters;
-
-/**
- * A plot is a {@link DataContainer} of {@link DataCurve DataCurves}.
- *
- * @author Franz-Josef Elmer
- */
-public class DataPlot extends DataContainer {
- /** Config parameter key. */
- public static final String CURVES_KEY = "curves",
- DATA_KEY = "data";
-
- /** Creates an empty instance. */
- public DataPlot() {}
-
- /**
- * Creates an instance from the specified config parameters.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * curves | String[] | yes |
- * List of keys denoting data curves. Each key refers to
- * config parameters used in the
- *
- * constructor of {@link DataCurve}. |
- *
- */
- public DataPlot(ConfigParameters config) {
- StringTokenizer tokenizer = new StringTokenizer(config.get(CURVES_KEY));
- while (tokenizer.hasMoreTokens()) {
- addElement(new DataCurve(config.getNode(tokenizer.nextToken())));
- }
- }
-
- /**
- * Convenient method to create a DataPlot based on the specified
- * config parameters. It is a short-cut of
- * new DataPlot(config.getNode("data")).
- */
- public static DataPlot create(ConfigParameters config) {
- return new DataPlot(config.getNode(DATA_KEY));
- }
-
- /**
- * Returns true if element is an instance of
- * {@link DataCurve}.
- */
- protected boolean isValid(DataElement element) {
- return element instanceof DataCurve;
- }
-}
-
diff --git a/src/jcckit/data/DataPoint.java b/src/jcckit/data/DataPoint.java
deleted file mode 100644
index 38810ebf3..000000000
--- a/src/jcckit/data/DataPoint.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.data;
-
-import jcckit.util.Point;
-
-/**
- * Immutable two-dimensional point in data coordinates.
- *
- * @author Franz-Josef Elmer
- */
-public class DataPoint extends Point implements DataElement {
- public DataPoint(double x, double y) {
- super(x, y);
- }
-
- /** Returns always null. */
- public DataContainer getContainer() {
- return null;
- }
-
- /** Does nothing. */
- public void setContainer(DataContainer container) {}
-}
diff --git a/src/jcckit/graphic/Anchor.java b/src/jcckit/graphic/Anchor.java
deleted file mode 100644
index 71ad63638..000000000
--- a/src/jcckit/graphic/Anchor.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-import jcckit.util.ConfigParameters;
-import jcckit.util.FactoryException;
-
-/**
- * Anchor of a graphical element. There exist only the three
- * instances {@link #LEFT_BOTTOM}, {@link #CENTER}, and
- * {@link #RIGHT_TOP}.
- *
- * The anchor factor can be used in a position formular. Its value
- * for the three instances reads:
- *
- *
- *
- * Instance | Factor |
- * LEFT_BOTTOM | 0 |
- * CENTER | 1 |
- * RIGHT_TOP | 2 |
- *
- *
- *
- * @author Franz-Josef Elmer
- */
-public class Anchor {
- /** Anchor constant. */
- public static final Anchor LEFT_BOTTOM = new Anchor(0),
- CENTER = new Anchor(1),
- RIGHT_TOP = new Anchor(2);
- private static final String LEFT_VALUE = "left",
- RIGHT_VALUE = "right",
- CENTER_VALUE = "center",
- TOP_VALUE = "top",
- BOTTOM_VALUE = "bottom";
-
- /**
- * Returns form the specified configuration parameters the
- * horizontal anchor defined by the specified key or the
- * specified default value.
- * @param config Configuration parameters.
- * @param key The key of the anchor. null is not allowed.
- * @param defaultValue The default value.
- * @return one of the three instances of Anchor.
- * @throws FactoryException if the value of key is
- * neither left, center,
- * nor right.
- * Note, that {@link FactoryException#getClassName()}
- * returns the invalid value.
- */
- public static Anchor getHorizontalAnchor(ConfigParameters config, String key,
- Anchor defaultValue) {
- Anchor result = defaultValue;
- String anchor = config.get(key, null);
- if (anchor != null) {
- if (anchor.equals(LEFT_VALUE)) {
- result = Anchor.LEFT_BOTTOM;
- } else if (anchor.equals(CENTER_VALUE)) {
- result = Anchor.CENTER;
- } else if (anchor.equals(RIGHT_VALUE)) {
- result = Anchor.RIGHT_TOP;
- } else {
- throw new FactoryException(config, key, "Invalid horizontal anchor.");
- }
- }
- return result;
- }
-
- /**
- * Returns form the specified configuration parameters the
- * vertical anchor defined by the specified key or the
- * specified default value.
- * @param config Configuration parameters.
- * @param key The key of the anchor. null is not allowed.
- * @param defaultValue The default value.
- * @return one of the three instances of Anchor.
- * @throws FactoryException if the value of key is
- * neither top, center,
- * nor bottom.
- * Note, that {@link FactoryException#getClassName()}
- * returns the invalid value.
- */
- public static Anchor getVerticalAnchor(ConfigParameters config, String key,
- Anchor defaultValue) {
- Anchor result = defaultValue;
- String anchor = config.get(key, null);
- if (anchor != null) {
- if (anchor.equals(BOTTOM_VALUE)) {
- result = Anchor.LEFT_BOTTOM;
- } else if (anchor.equals(CENTER_VALUE)) {
- result = Anchor.CENTER;
- } else if (anchor.equals(TOP_VALUE)) {
- result = Anchor.RIGHT_TOP;
- } else {
- throw new FactoryException(config, key, "Invalid vertcal anchor.");
- }
- }
- return result;
- }
-
- private final int _factor;
-
- private Anchor(int factor) {
- _factor = factor;
- }
-
- /** Returns the factor. */
- public int getFactor() {
- return _factor;
- }
-}
-
diff --git a/src/jcckit/graphic/BasicGraphicAttributes.java b/src/jcckit/graphic/BasicGraphicAttributes.java
deleted file mode 100644
index 5b63ff161..000000000
--- a/src/jcckit/graphic/BasicGraphicAttributes.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-import java.awt.Color;
-
-import jcckit.util.ConfigParameters;
-
-/**
- * The basic attributes of any {@link BasicGraphicalElement}. This is an
- * extension of {@link ShapeAttributes} implementing {@link TextAttributes}.
- *
- * @author Franz-Josef Elmer
- */
-public class BasicGraphicAttributes extends ShapeAttributes
- implements TextAttributes {
- /** Configuration parameter key. */
- public static final String TEXT_COLOR_KEY = "textColor",
- FONT_NAME_KEY = "fontName",
- FONT_STYLE_KEY = "fontStyle",
- FONT_SIZE_KEY = "fontSize",
- HORIZONTAL_ANCHOR_KEY = "horizontalAnchor",
- VERTICAL_ANCHOR_KEY = "verticalAnchor",
- ORIENTATION_ANGLE_KEY = "orientationAngle";
-
- private final Color _textColor;
- private final String _fontName;
- private final FontStyle _fontStyle;
- private final double _fontSize;
- private final double _orientationAngle;
- private final Anchor _horizontalAnchor;
- private final Anchor _verticalAnchor;
-
- /**
- * Creates a new instance based on the specified configuration
- * parameters.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * textColor = default foreground color of the
- * renderer | Color | no |
- * The text color. |
- * fontName = default font name of the
- * renderer | String | no |
- * The name of the text font. The standard Java font name
- * "Serif", "SansSerif", and "Monospaced" can be used.
- * Other font names depend on the actual {@link Renderer}
- * rendering the corresponding {@link BasicGraphicalElement}.
- * |
- * fontStyle = normal | String
- * | no |
- * The font style. Possible values are:
- * - normal
- bold
- italic
- *
- bold italic
- * |
- * fontSize = default font size of the
- * renderer | double | no |
- * The font size in units of the device-independent
- * coordinates. |
- * orientationAngle = 0 | double |
- * no |
- * The orientation angle of the text (in degree).
- * Zero means normal orientation whereas a positive value means
- * a rotation in counter-clockweise direction. |
- * horizontalAnchor = left | String
- * | no |
- * Anchor for horizontal text position. Possible values are
- * left, center, and right. |
- * verticalAnchor = center | String
- * | no |
- * Anchor for vertical text position. Possible values are
- * top, center, and bottom. |
- *
- * Additional configuration parameters are explained in the
- * {@link ShapeAttributes#ShapeAttributes constructor}
- * of the superclass {@link ShapeAttributes}.
- */
- public BasicGraphicAttributes(ConfigParameters config) {
- super(config);
- _textColor = config.getColor(TEXT_COLOR_KEY, null);
- _fontName = config.get(FONT_NAME_KEY, null);
- _fontStyle = FontStyle.getFontStyle(config, FONT_STYLE_KEY,
- FontStyle.NORMAL);
- _fontSize = config.getDouble(FONT_SIZE_KEY, 0);
- _orientationAngle = config.getDouble(ORIENTATION_ANGLE_KEY, 0);
-
- _horizontalAnchor = Anchor.getHorizontalAnchor(config,
- HORIZONTAL_ANCHOR_KEY, Anchor.LEFT_BOTTOM);
- _verticalAnchor = Anchor.getVerticalAnchor(config,
- VERTICAL_ANCHOR_KEY, Anchor.CENTER);
- }
-
- /**
- * Creates a new instance.
- * @param fillColor The fill color. May be null.
- * @param lineColor The line color. May be null.
- * @param lineThickness Thickness of the line.
- * Negative numbers will be trimmed to zero.
- * @param linePattern Line pattern. May be null.
- * @param textColor The text color. May be null.
- * @param fontName The font name. May be null.
- * @param fontStyle The font style. May be null.
- * @param fontSize The font size in units of the device-independent
- * coordinates. May be null.
- * @param orientationAngle Orientation angle of the text.
- * @param horizontalAnchor Horizontal text anchor.
- * @param verticalAnchor Vertical text anchor.
- */
- public BasicGraphicAttributes(Color fillColor, Color lineColor,
- double lineThickness,
- double[] linePattern, Color textColor,
- String fontName, FontStyle fontStyle,
- double fontSize, double orientationAngle,
- Anchor horizontalAnchor,
- Anchor verticalAnchor) {
- super(fillColor, lineColor, lineThickness, linePattern);
- _textColor = textColor;
- _fontName = fontName;
- _fontStyle = fontStyle;
- _fontSize = fontSize;
- _orientationAngle = orientationAngle;
- _horizontalAnchor = horizontalAnchor;
- _verticalAnchor = verticalAnchor;
- }
-
- /**
- * Returns the text color.
- * @return null means default color of the renderer.
- */
- public Color getTextColor() {
- return _textColor;
- }
-
- /**
- * Returns the font name.
- * @return null means default font name of the renderer.
- */
- public String getFontName() {
- return _fontName;
- }
-
- /**
- * Returns the font style.
- * @return null means default font style of the renderer.
- */
- public FontStyle getFontStyle() {
- return _fontStyle;
- }
-
- /**
- * Returns the font size in units of the device-independent coordinates.
- */
- public double getFontSize() {
- return _fontSize;
- }
-
- /**
- * Returns the orientation angle in degree. Zero means
- * normal text orientation. Any positive angle means a
- * counter-clockwise rotation of the text.
- */
- public double getOrientationAngle() {
- return _orientationAngle;
- }
-
- /**
- * Returns the anchor for horizontal position of the text.
- * Note, that the anchor is related to the text before
- * it is rotated by the orientation angle.
- * @return one of the three instances of Anchor.
- */
- public Anchor getHorizontalAnchor() {
- return _horizontalAnchor;
- }
-
- /**
- * Returns the anchor for vertical position of the text.
- * Note, that the anchor is related to the text before
- * it is rotated by the orientation angle.
- * @return one of the three instances of Anchor.
- */
- public Anchor getVerticalAnchor() {
- return _verticalAnchor;
- }
-}
-
diff --git a/src/jcckit/graphic/BasicGraphicalElement.java b/src/jcckit/graphic/BasicGraphicalElement.java
deleted file mode 100644
index 37ed247ff..000000000
--- a/src/jcckit/graphic/BasicGraphicalElement.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-/**
- * Abstract superclass of all basic {@link GraphicalElement
- * GraphicalElements}. Concrete subclasses have to implement
- * the method {@link GraphicalElement#renderWith}.
- *
- * @author Franz-Josef Elmer
- */
-public abstract class BasicGraphicalElement implements GraphicalElement {
- private final GraphicAttributes _attributes;
-
- /**
- * Creates an instance with the specified drawing attributes.
- * Note, that a {@link Renderer} should use default attributes
- * in the case no attributes are defined.
- * @param attributes Drawing attributes or null if undefined.
- */
- public BasicGraphicalElement(GraphicAttributes attributes) {
- _attributes = attributes;
- }
-
- /**
- * Returns the drawing attributes.
- * @return null if undefined.
- */
- public GraphicAttributes getGraphicAttributes() {
- return _attributes;
- }
-
- /**
- * Returns whether this basic graphical element has a closed shape
- * or not. By default always true. Subclasses may override
- * this behaviour.
- * @return true if the shape is closed.
- */
- public boolean isClosed() {
- return true;
- }
-}
diff --git a/src/jcckit/graphic/ClippingRectangle.java b/src/jcckit/graphic/ClippingRectangle.java
deleted file mode 100644
index 3c56241c2..000000000
--- a/src/jcckit/graphic/ClippingRectangle.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-/**
- * Immutable class of a rectangular clipping area.
- *
- * @author Franz-Josef Elmer
- */
-public class ClippingRectangle implements ClippingShape {
- private final double _minX, _minY, _maxX, _maxY;
-
- /**
- * Creates an instance for the specified coordinates of
- * two opposite corner points.
- */
- public ClippingRectangle(double x1, double y1, double x2, double y2) {
- _minX = Math.min(x1, x2);
- _minY = Math.min(y1, y2);
- _maxX = Math.max(x1, x2);
- _maxY = Math.max(y1, y2);
- }
-
- /**
- * Returns true if the specified point is inside this
- * rectangle.
- */
- public boolean isInside(GraphPoint point) {
- double x = point.getX();
- double y = point.getY();
- return _minX <= x && x <= _maxX && _minY <= y && y <= _maxY;
- }
-
- /** Returns the minimum x value. */
- public double getMinX() {
- return _minX;
- }
-
- /** Returns the maximum x value. */
- public double getMaxX() {
- return _maxX;
- }
-
- /** Returns the minimum y value. */
- public double getMinY() {
- return _minY;
- }
-
- /** Returns the maximum y value. */
- public double getMaxY() {
- return _maxY;
- }
-
- /** Returns this instance. */
- public ClippingRectangle getBoundingBox() {
- return this;
- }
-
- /** Returns a {@link Rectangle}. */
- public BasicGraphicalElement getGraphicalElement() {
- return new Rectangle(new GraphPoint(0.5 * (_minX + _maxX),
- 0.5 * (_minY + _maxY)),
- _maxX - _minX, _maxY - _minY, null);
- }
-}
diff --git a/src/jcckit/graphic/ClippingShape.java b/src/jcckit/graphic/ClippingShape.java
deleted file mode 100644
index 8559a9e8b..000000000
--- a/src/jcckit/graphic/ClippingShape.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-/**
- * Defining a clipping shape applied to all {@link GraphicalElement
- * GraphicalElements} of a {@link GraphicalComposite}.
- *
- * @author Franz-Josef Elmer
- */
-public interface ClippingShape {
- /**
- * Returns true if the specified point is inside this
- * clipping shape.
- */
- public boolean isInside(GraphPoint point);
-
- /**
- * Returns the bounding box of this clipping shape.
- * This method will be used by renderers who supports only
- * rectangular clipping shapes.
- */
- public ClippingRectangle getBoundingBox();
-
- /**
- * Returns a basic graphical element (such as {@link Rectangle}
- * or {@link Polygon}) which may be used by renderers to
- * define the clipping shape for the output device.
- */
- public BasicGraphicalElement getGraphicalElement();
-}
diff --git a/src/jcckit/graphic/FillAttributes.java b/src/jcckit/graphic/FillAttributes.java
deleted file mode 100644
index 7af1b56f2..000000000
--- a/src/jcckit/graphic/FillAttributes.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-import java.awt.Color;
-
-/**
- * Interface for fill attributes.
- *
- * @author Franz-Josef Elmer
- */
-public interface FillAttributes extends GraphicAttributes {
- /**
- * Returns the fill color.
- * @return null means no filling.
- */
- public Color getFillColor();
-}
-
diff --git a/src/jcckit/graphic/FontStyle.java b/src/jcckit/graphic/FontStyle.java
deleted file mode 100644
index 7c037d9c3..000000000
--- a/src/jcckit/graphic/FontStyle.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-import java.util.Hashtable;
-
-import jcckit.util.ConfigParameters;
-import jcckit.util.FactoryException;
-
-/**
- * Font style constants.
- * This class is based on the typesafe enumeration pattern.
- *
- * @author Franz-Josef Elmer
- */
-public class FontStyle {
- private static final Hashtable REPOSITORY = new Hashtable();
- static final String NORMAL_TXT = "normal",
- BOLD_TXT = "bold",
- ITALIC_TXT = "italic",
- BOLD_ITALIC_TXT = "bold italic";
- /** Font style constant. */
- public static final FontStyle NORMAL = new FontStyle(NORMAL_TXT),
- BOLD = new FontStyle(BOLD_TXT),
- ITALIC = new FontStyle(ITALIC_TXT),
- BOLD_ITALIC = new FontStyle(BOLD_ITALIC_TXT);
-
- private final String _description;
-
- /** Non-public constructor to control the number of instances. */
- private FontStyle(String description) {
- _description = description;
- REPOSITORY.put(description, this);
- }
-
- /**
- * Returns from the specified configuration parameters the font style
- * defined by the specified key or the specified default value.
- * @param config Configuration parameters.
- * @param key The key of the font style.
- * @param defaultValue The default value.
- * @return one of the four instances of FontStyle.
- * @throws FactoryException if the value of the key-value pair denoted
- * by key is neither normal, bold,
- * italic, nor bold italic,
- * Note, that {@link FactoryException#getClassName()}
- * returns the invalid value.
- */
- public static FontStyle getFontStyle(ConfigParameters config, String key,
- FontStyle defaultValue) {
- FontStyle result = defaultValue;
- String value = config.get(key, null);
- if (value != null) {
- result = (FontStyle) REPOSITORY.get(value);
- if (result == null) {
- throw new FactoryException(config, key, "Invalid font style.");
- }
- }
- return result;
- }
-
- /** Returns a human readable description for pretty printing. */
- public String toString() {
- return _description;
- }
-}
diff --git a/src/jcckit/graphic/GraphPoint.java b/src/jcckit/graphic/GraphPoint.java
deleted file mode 100644
index a85de78a3..000000000
--- a/src/jcckit/graphic/GraphPoint.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-import jcckit.util.Point;
-
-/**
- * Immutable class of a two-dimensional point in the device-independent
- * coordinate system.
- *
- * @author Franz-Josef Elmer
- */
-public class GraphPoint extends Point {
- /**
- * Creates an instance for the specified vector.
- * If vector is null or not long enough the
- * default value 0 will be used instead.
- */
- public GraphPoint(double[] vector) {
- super(vector);
- }
-
- /** Creates an instance for the specified coordinates. */
- public GraphPoint(double x, double y) {
- super(x, y);
- }
-}
diff --git a/src/jcckit/graphic/GraphicAttributes.java b/src/jcckit/graphic/GraphicAttributes.java
deleted file mode 100644
index a418c1cd1..000000000
--- a/src/jcckit/graphic/GraphicAttributes.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-/**
- * Marker interface for all types of graphic attributes
- * of a {@link BasicGraphicalElement}. Graphic attributes are only
- * hints for {@link Renderer Renderers} how to render a
- * BasicGraphicalElement. Whether they are used and how
- * they are interpreted depends on the concrete Renderer.
- *
- * This is only a marker interface. There are several subinterfaces
- * specifying various attributes grouped by the type of element to
- * be rendered.
- *
- * @author Franz-Josef Elmer
- */
-public interface GraphicAttributes {
-}
-
diff --git a/src/jcckit/graphic/GraphicalComposite.java b/src/jcckit/graphic/GraphicalComposite.java
deleted file mode 100644
index b981343d7..000000000
--- a/src/jcckit/graphic/GraphicalComposite.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-import java.util.Vector;
-
-/**
- * Container for {@link GraphicalElement GraphicalElements}.
- *
- * @author Franz-Josef Elmer
- */
-public class GraphicalComposite implements GraphicalElement {
- private final Vector _elements = new Vector();
- private final ClippingShape _clippingShape;
-
- /**
- * Creates an instance with the specified clipping shape.
- * @param clippingShape Clipping shape or null if no clipping.
- */
- public GraphicalComposite(ClippingShape clippingShape) {
- _clippingShape = clippingShape;
- }
-
- /**
- * Returns the clipping shape.
- * @return null if no clipping should be applied.
- */
- public ClippingShape getClippingShape() {
- return _clippingShape;
- }
-
- /**
- * Adds the specified element at the end of the list of elements.
- * @param element Element to be added. null is not allowed.
- * @throws NullPointerException if element == null
- */
- public void addElement(GraphicalElement element) {
- if (element == null) {
- throwNullPointerException();
- } else {
- _elements.addElement(element);
- }
- }
-
- /** Remove all elements. */
- public void removeAllElements() {
- _elements.removeAllElements();
- }
-
- /**
- * Replaces the specified element at the specified index of
- * the list of elements.
- * @param element New element. null is not allowed.
- * @throws NullPointerException if element == null
- */
- public void replaceElementAt(int index, GraphicalElement element) {
- if (element == null) {
- throwNullPointerException();
- } else {
- _elements.setElementAt(element, index);
- }
- }
-
- private void throwNullPointerException() {
- throw new NullPointerException(
- "A null as an GraphicalElement is not allowed");
- }
-
- /**
- * Renders all {@link GraphicalElement GraphicalElements} in the sequence
- * they have been added.
- * @param renderer Renderer which implements all renderer interfaces
- * necessary to render the child elements.
- * @throws IllegalArgumentException if renderer is not
- * an instance of GraphicalCompositeRenderer.
- */
- public void renderWith(Renderer renderer) {
- if (renderer instanceof GraphicalCompositeRenderer) {
- GraphicalCompositeRenderer r = (GraphicalCompositeRenderer) renderer;
- r.startRendering(this);
- for (int i = 0, n = _elements.size(); i < n; i++) {
- ((GraphicalElement) _elements.elementAt(i)).renderWith(r);
- }
- r.finishRendering(this);
- } else {
- throw new IllegalArgumentException(renderer
- + " does not implements GraphicalCompositeRenderer.");
- }
- }
-}
diff --git a/src/jcckit/graphic/GraphicalCompositeRenderer.java b/src/jcckit/graphic/GraphicalCompositeRenderer.java
deleted file mode 100644
index f3c7ba402..000000000
--- a/src/jcckit/graphic/GraphicalCompositeRenderer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-/**
- * Interface of all {@link Renderer Renderers} who render a
- * {@link GraphicalComposite}. Note, that a
- * GraphicalCompositeRenderer does not
- * render the element of a GraphicalComposite
- *
- * @author Franz-Josef Elmer
- */
-public interface GraphicalCompositeRenderer extends Renderer {
- /**
- * Starts rendering of the specified composite before its
- * elements are rendererd. Implementations of this method
- * usually obtain the {@link ClippingShape} from
- * composite.
- */
- public void startRendering(GraphicalComposite composite);
-
- /** Finishes rendering of the specified composite. */
- public void finishRendering(GraphicalComposite composite);
-}
diff --git a/src/jcckit/graphic/GraphicalElement.java b/src/jcckit/graphic/GraphicalElement.java
deleted file mode 100644
index 2b28fa40a..000000000
--- a/src/jcckit/graphic/GraphicalElement.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-/**
- * Interface all graphical elements have to implement.
- * Together with the marker interface {@link Renderer} it
- * realizes the Anticyclic Visitor Pattern, a variant of the
- * GoF Visitor Pattern. This allows not only to extend JCCKit with
- * new renderers but also with new types of GraphicalElements
- * without touching existing code.
- *
- * @author Franz-Josef Elmer
- */
-public interface GraphicalElement {
- /**
- * Renders this element according to the type of renderer.
- * Concrete GraphicalElements who are not instances of
- * {@link GraphicalComposite} dynamically cast renderer.
- * If it does not implement the type of renderer specific for
- * the concrete GraphicalElement it should throw an
- * IllegalArgumentException.
- */
- public abstract void renderWith(Renderer renderer);
-}
diff --git a/src/jcckit/graphic/LineAttributes.java b/src/jcckit/graphic/LineAttributes.java
deleted file mode 100644
index 2d8f7a178..000000000
--- a/src/jcckit/graphic/LineAttributes.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-import java.awt.Color;
-
-/**
- * Interface for line attributes.
- *
- * @author Franz-Josef Elmer
- */
-public interface LineAttributes extends GraphicAttributes {
- /**
- * Returns the line color.
- * @return null means default color of the renderer.
- */
- public Color getLineColor();
-
- /**
- * Returns the line tickness. 0 means that the line thickness is
- * chosen as thin as possible.
- * Implementations have to guarantee that the returned value is
- * never negative.
- */
- public double getLineThickness();
-
- /**
- * Returns the line pattern. This is a sequence of length where the
- * pen is down or up. The first element is the length where the
- * pen is down. The next element is the length where the pen is up.
- * The pattern is cyclically repeated.
- * @return null means solid line.
- */
- public double[] getLinePattern();
-}
-
diff --git a/src/jcckit/graphic/Oval.java b/src/jcckit/graphic/Oval.java
deleted file mode 100644
index 9d49621a6..000000000
--- a/src/jcckit/graphic/Oval.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-/**
- * An oval (i.e. an ellipse).
- *
- * @author Franz-Josef Elmer
- */
-public class Oval extends Rectangle {
- /**
- * Creates a new instance.
- * @param center The position of the center of this element.
- * @param width The width.
- * @param height The height.
- * @param attributes Drawing attributes. Can be null.
- */
- public Oval(GraphPoint center, double width, double height,
- GraphicAttributes attributes) {
- super(center, width, height, attributes);
- }
-
- /**
- * Renders this oval with the specified {@link Renderer}.
- * @param renderer An instance of {@link OvalRenderer}.
- * @throws IllegalArgumentException if renderer is not
- * an instance of OvalRenderer.
- */
- public void renderWith(Renderer renderer) {
- if (renderer instanceof OvalRenderer) {
- ((OvalRenderer) renderer).render(this);
- } else {
- throw new IllegalArgumentException(renderer
- + " does not implements OvalRenderer.");
- }
- }
-}
-
diff --git a/src/jcckit/graphic/OvalRenderer.java b/src/jcckit/graphic/OvalRenderer.java
deleted file mode 100644
index 97108eb2e..000000000
--- a/src/jcckit/graphic/OvalRenderer.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-/**
- * Interface of all {@link Renderer Renderers} who render a
- * {@link Oval}.
- *
- * @author Franz-Josef Elmer
- */
-public interface OvalRenderer extends Renderer {
- /** Renders the specified oval. */
- public void render(Oval oval);
-}
diff --git a/src/jcckit/graphic/Polygon.java b/src/jcckit/graphic/Polygon.java
deleted file mode 100644
index 45245b4d8..000000000
--- a/src/jcckit/graphic/Polygon.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-import java.util.Vector;
-
-/**
- * A polygon or polyline.
- *
- * @author Franz-Josef Elmer
- */
-public class Polygon extends BasicGraphicalElement {
- private final Vector _points = new Vector();
- private final boolean _closed;
-
- /**
- * Creates an instance of the specified graphic attributes.
- * @param closed true if this polygon is closed.
- */
- public Polygon(GraphicAttributes attributes, boolean closed) {
- super(attributes);
- _closed = closed;
- }
-
- /** Returns true if this polygon is closed. */
- public boolean isClosed() {
- return _closed;
- }
-
- /** Returns the number points. */
- public int getNumberOfPoints() {
- return _points.size();
- }
-
- /** Returns the point for the specified index. */
- public GraphPoint getPoint(int index) {
- return (GraphPoint) _points.elementAt(index);
- }
-
- /** Adds a new point to the end of the list of points. */
- public void addPoint(GraphPoint point) {
- _points.addElement(point);
- }
-
- /** Removes all points. */
- public void removeAllPoints() {
- _points.removeAllElements();
- }
-
- /** Replaces the point at the specified index by a new one. */
- public void replacePointAt(int index, GraphPoint point) {
- _points.setElementAt(point, index);
- }
-
- /**
- * Renders this line with the specified {@link Renderer}.
- * @param renderer An instance of {@link PolygonRenderer}.
- * @throws IllegalArgumentException if renderer is not
- * an instance of PolygonRenderer.
- */
- public void renderWith(Renderer renderer) {
- if (renderer instanceof PolygonRenderer) {
- ((PolygonRenderer) renderer).render(this);
- } else {
- throw new IllegalArgumentException(renderer
- + " does not implements PolygonRenderer.");
- }
- }
-}
diff --git a/src/jcckit/graphic/PolygonRenderer.java b/src/jcckit/graphic/PolygonRenderer.java
deleted file mode 100644
index 0c07f905d..000000000
--- a/src/jcckit/graphic/PolygonRenderer.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-/**
- * Interface of all {@link Renderer Renderers} who render an
- * instance of {@link Polygon}.
- *
- * @author Franz-Josef Elmer
- */
-public interface PolygonRenderer extends Renderer {
- /** Renders the specified Polygon instance. */
- public void render(Polygon polygon);
-}
diff --git a/src/jcckit/graphic/Rectangle.java b/src/jcckit/graphic/Rectangle.java
deleted file mode 100644
index f66a3c5f1..000000000
--- a/src/jcckit/graphic/Rectangle.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-/**
- * A rectangle.
- *
- * @author Franz-Josef Elmer
- */
-public class Rectangle extends BasicGraphicalElement {
- private final GraphPoint _center;
- private final double _width;
- private final double _height;
-
- /**
- * Creates a new instance.
- * @param center The position of the center of this element.
- * @param width The width.
- * @param height The height.
- * @param attributes Drawing attributes. Can be null.
- */
- public Rectangle(GraphPoint center, double width, double height,
- GraphicAttributes attributes) {
- super(attributes);
- _center = center;
- _width = width;
- _height = height;
- }
-
- /** Returns the center of this element. */
- public GraphPoint getCenter() {
- return _center;
- }
-
- /** Returns the width of this element. */
- public double getWidth() {
- return _width;
- }
-
- /** Returns the height of this element. */
- public double getHeight() {
- return _height;
- }
-
- /**
- * Renders this rectangle with the specified {@link Renderer}.
- * @param renderer An instance of {@link RectangleRenderer}.
- * @throws IllegalArgumentException if renderer is not
- * an instance of RectangleRenderer.
- */
- public void renderWith(Renderer renderer) {
- if (renderer instanceof RectangleRenderer) {
- ((RectangleRenderer) renderer).render(this);
- } else {
- throw new IllegalArgumentException(renderer
- + " does not implements RectangleRenderer.");
- }
- }
-}
-
diff --git a/src/jcckit/graphic/RectangleRenderer.java b/src/jcckit/graphic/RectangleRenderer.java
deleted file mode 100644
index 6a1d01c66..000000000
--- a/src/jcckit/graphic/RectangleRenderer.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-/**
- * Interface of all {@link Renderer Renderers} who render a
- * {@link Rectangle}.
- *
- * @author Franz-Josef Elmer
- */
-public interface RectangleRenderer extends Renderer {
- /** Renders the specified rectangle. */
- public void render(Rectangle rectangle);
-}
diff --git a/src/jcckit/graphic/Renderer.java b/src/jcckit/graphic/Renderer.java
deleted file mode 100644
index b3d722645..000000000
--- a/src/jcckit/graphic/Renderer.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-/**
- * Marker interface. Each subclass is an interface for a specific
- * type of {@link GraphicalElement}.
- *
- * @author Franz-Josef Elmer
- */
-public interface Renderer {}
diff --git a/src/jcckit/graphic/ShapeAttributes.java b/src/jcckit/graphic/ShapeAttributes.java
deleted file mode 100644
index 362f3037d..000000000
--- a/src/jcckit/graphic/ShapeAttributes.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-import java.awt.Color;
-
-import jcckit.util.ConfigParameters;
-
-/**
- * Basic attributes for shapes.
- *
- * @author Franz-Josef Elmer
- */
-public class ShapeAttributes implements LineAttributes, FillAttributes {
- /** Configuration parameter key. */
- public static final String FILL_COLOR_KEY = "fillColor",
- LINE_COLOR_KEY = "lineColor",
- LINE_THICKNESS_KEY = "lineThickness",
- LINE_PATTERN_KEY = "linePattern";
-
- private final Color _fillColor;
- private final Color _lineColor;
- private final double _lineThickness;
- private final double[] _linePattern;
-
- /**
- * Creates a new instance based on the specified configuration
- * parameters.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * fillColor = no filling | Color |
- * no | The fill color of the shape. |
- * lineColor = no line | Color |
- * no | The color of a line, a polygon, or the border of a shape. |
- * lineThickness = 0 | double |
- * no |
- * The thickness of a line. A thickness of zero means that
- * the renderer will draw the thinest line possible. |
- * linePattern = solid line |
- * double[] | no |
- * A sequence of lengths where the pen is alternatively
- * down or up. For example, 0.1 0.1 will lead to a dashed
- * line whereas 0.02 0.02 is the pattern of a dotted
- * line and 0.02 0.02 0.1 0.02 of a dashed-dotted
- * line. |
- *
- */
- public ShapeAttributes(ConfigParameters config) {
- this(config.getColor(FILL_COLOR_KEY, null),
- config.getColor(LINE_COLOR_KEY, null),
- config.getDouble(LINE_THICKNESS_KEY, 0),
- config.getDoubleArray(LINE_PATTERN_KEY, null));
- }
-
- /**
- * Creates a new instance.
- * @param fillColor The fill color. May be null.
- * @param lineColor The line color. May be null.
- * @param lineThickness Thickness of the line.
- * Negative numbers will be trimmed to zero.
- * @param linePattern Line pattern. May be null.
- */
- public ShapeAttributes(Color fillColor, Color lineColor,
- double lineThickness, double[] linePattern) {
- _fillColor = fillColor;
- _lineColor = lineColor;
- _lineThickness = Math.max(0, lineThickness);
- _linePattern = linePattern;
- }
-
- public Color getFillColor() {
- return _fillColor;
- }
-
- public Color getLineColor() {
- return _lineColor;
- }
-
- public double getLineThickness() {
- return _lineThickness;
- }
-
- public double[] getLinePattern() {
- return _linePattern;
- }
-}
-
diff --git a/src/jcckit/graphic/Text.java b/src/jcckit/graphic/Text.java
deleted file mode 100644
index 23133c260..000000000
--- a/src/jcckit/graphic/Text.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-/**
- * A single line of text.
- *
- * @author Franz-Josef Elmer
- */
-public class Text extends BasicGraphicalElement {
- private final GraphPoint _position;
- private final String _text;
-
-
- /**
- * Creates an instance with the specified parameters.
- * @param position Position of the text.
- * @param text Text.
- * @param attributes Drawing attributes. Can be null.
- */
- public Text(GraphPoint position, String text, GraphicAttributes attributes) {
- super(attributes);
- _position = position;
- _text = text;
- }
-
- /** Returns the position. */
- public GraphPoint getPosition() {
- return _position;
- }
-
- /** Returns the text string. */
- public String getText() {
- return _text;
- }
-
- /**
- * Renders this line with the specified {@link Renderer}.
- * @param renderer An instance of {@link TextRenderer}.
- * @throws IllegalArgumentException if renderer is not
- * an instance of TextRenderer.
- */
- public void renderWith(Renderer renderer) {
- if (renderer instanceof TextRenderer) {
- ((TextRenderer) renderer).render(this);
- } else {
- throw new IllegalArgumentException(renderer
- + " does not implements TextRenderer.");
- }
- }
-}
diff --git a/src/jcckit/graphic/TextAttributes.java b/src/jcckit/graphic/TextAttributes.java
deleted file mode 100644
index 3e6080d85..000000000
--- a/src/jcckit/graphic/TextAttributes.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-import java.awt.Color;
-
-/**
- * Interface for text attributes.
- *
- * @author Franz-Josef Elmer
- */
-public interface TextAttributes extends GraphicAttributes {
- /**
- * Returns the text color.
- * @return null means default color of the renderer.
- */
- public Color getTextColor();
-
- /**
- * Returns the font name.
- * @return null means default font name of the renderer.
- */
- public String getFontName();
-
- /**
- * Returns the font style.
- * @return null means default font style of the renderer.
- */
- public FontStyle getFontStyle();
-
- /**
- * Returns the font size in units of the device-independent coordinates.
- */
- public double getFontSize();
-
- /**
- * Returns the orientation angle in degree. Zero means
- * normal text orientation. Any positive angle means a
- * counter-clockwise rotation of the text.
- */
- public double getOrientationAngle();
-
- /**
- * Returns the anchor for horizontal position of the text.
- * Note, that the anchor is related to the text before
- * it is rotated by the orientation angle.
- * @return one of the three instances of Anchor.
- */
- public Anchor getHorizontalAnchor();
-
- /**
- * Returns the anchor for vertical position of the text.
- * Note, that the anchor is related to the text before
- * it is rotated by the orientation angle.
- * @return one of the three instances of Anchor.
- */
- public Anchor getVerticalAnchor();
-}
-
diff --git a/src/jcckit/graphic/TextRenderer.java b/src/jcckit/graphic/TextRenderer.java
deleted file mode 100644
index 98f2124ee..000000000
--- a/src/jcckit/graphic/TextRenderer.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.graphic;
-
-/**
- * Interface of all {@link Renderer Renderers} who render an
- * instance of {@link Text}.
- *
- * @author Franz-Josef Elmer
- */
-public interface TextRenderer extends Renderer {
- /** Renders the specified Text instance. */
- public void render(Text text);
-}
diff --git a/src/jcckit/plot/AbstractSymbolFactory.java b/src/jcckit/plot/AbstractSymbolFactory.java
deleted file mode 100644
index f88f18abd..000000000
--- a/src/jcckit/plot/AbstractSymbolFactory.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import jcckit.graphic.GraphPoint;
-import jcckit.graphic.GraphicAttributes;
-import jcckit.graphic.GraphicalElement;
-import jcckit.util.ConfigParameters;
-import jcckit.util.Factory;
-
-/**
- * Abstract superclass of all {@link SymbolFactory SymbolFactories}.
- * Subclasses have to implement {@link #createPlainSymbol createPlainSymbol()}.
- *
- * @author Franz-Josef Elmer
- */
-public abstract class AbstractSymbolFactory implements SymbolFactory {
- /** Size of all symbols. */
- protected final double _size;
-
- /** Attributes of all symbols. */
- protected final GraphicAttributes _attributes;
-
- /**
- * Creates an instance from the specified configuration parameters.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * size = 0.01 |
- * double | no |
- * Size of the symbol in device-independent units. |
- * attributes |
- * ConfigParameters | no |
- * Configuration parameters for the attributes of the symbol.
- * className has to be a class which is an instance of
- * {@link GraphicAttributes}. |
- *
- */
- public AbstractSymbolFactory(ConfigParameters config) {
- _size = config.getDouble(SIZE_KEY, DEFAULT_SIZE);
- _attributes = (GraphicAttributes) Factory.createOrGet(
- config.getNode(ATTRIBUTES_KEY), null);
- }
-
- /**
- * Creates a symbol.
- * Evaluate hintFromPreviousPoint if it is a {@link AttributesHint}.
- * Calls {@link #createSymbol(GraphPoint, GraphicAttributes, Hint, Hint)}.
- * @param point Symbol position.
- * @param hintFromPreviousPoint Hint from the previous point.
- * @param hintFromPreviousCurve Hint from the previous curve.
- */
- public Symbol createSymbol(GraphPoint point, Hint hintFromPreviousPoint,
- Hint hintFromPreviousCurve) {
- GraphicAttributes attributes = _attributes;
- Hint hintForNextPoint = hintFromPreviousPoint;
- if (hintFromPreviousPoint instanceof AttributesHint) {
- attributes = ((AttributesHint) hintFromPreviousPoint).getAttributes();
- hintForNextPoint
- = ((AttributesHint) hintFromPreviousPoint).getNextHint();
- }
- return createSymbol(point, attributes, hintForNextPoint,
- hintFromPreviousCurve);
- }
-
- /**
- * Creates a symbol.
- * Uses {@link #createPlainSymbol createPlainSymbol()}.
- * @param point Symbol position.
- * @param attributes Symbol attributes.
- * @param hintForNextPoint Hint for the next point. Will be delivered
- * unchanged in the return Symbol object.
- * @param hintFromPreviousCurve Hint from the previous curve.
- * Will be delivered unchanged in the return Symbol object.
- * Subclasses may override this behavior.
- */
- protected Symbol createSymbol(GraphPoint point, GraphicAttributes attributes,
- Hint hintForNextPoint,
- Hint hintFromPreviousCurve) {
- return new Symbol(createPlainSymbol(point, _size, attributes),
- hintForNextPoint, hintFromPreviousCurve);
- }
-
- /**
- * Creates a symbol for the legend at the specified position.
- * Uses {@link #createPlainSymbol createPlainSymbol()}
- * @param centerPosition Center position of the symbol.
- * @param size The size of the symbol. Will be ignored because the value
- * given in the constructor will be used.
- */
- public GraphicalElement createLegendSymbol(GraphPoint centerPosition,
- double size) {
- return createPlainSymbol(centerPosition, _size, _attributes);
- }
-
- /**
- * Creates the graphical element of the plain symbol.
- * @param centerPosition Center position of the symbol.
- * @param size The size of the symbol.
- * @param attributes The attributes of the symbol.
- */
- protected abstract GraphicalElement createPlainSymbol(
- GraphPoint centerPosition, double size, GraphicAttributes attributes);
-}
diff --git a/src/jcckit/plot/AttributesHint.java b/src/jcckit/plot/AttributesHint.java
deleted file mode 100644
index 0ab44166f..000000000
--- a/src/jcckit/plot/AttributesHint.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import jcckit.graphic.GraphicAttributes;
-
-/**
- * A {@link Hint} which wraps a {@link GraphicAttributes} instance.
- * In addition the method {@link #getNextHint()} creates a new instance
- * with different attributes derivated from the wrapped attributes.
- *
- * @author Franz-Josef Elmer
- */
-public interface AttributesHint extends Hint {
- /**
- * Returns the hint for the next {@link Symbol} of a {@link Curve}.
- * The new hint has a different {@link GraphicAttributes}.
- */
- public AttributesHint getNextHint();
-
- /** Returns the attributes value. */
- public GraphicAttributes getAttributes();
-}
diff --git a/src/jcckit/plot/AxisParameters.java b/src/jcckit/plot/AxisParameters.java
deleted file mode 100644
index 3fd2aa089..000000000
--- a/src/jcckit/plot/AxisParameters.java
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import java.util.Properties;
-
-import jcckit.graphic.BasicGraphicAttributes;
-import jcckit.graphic.GraphPoint;
-import jcckit.graphic.LineAttributes;
-import jcckit.graphic.ShapeAttributes;
-import jcckit.graphic.TextAttributes;
-import jcckit.util.ConfigData;
-import jcckit.util.ConfigParameters;
-import jcckit.util.ConfigParametersBasedConfigData;
-import jcckit.util.Factory;
-import jcckit.util.Format;
-import jcckit.util.PropertiesBasedConfigData;
-import jcckit.util.TicLabelFormat;
-import jcckit.util.Util;
-
-/**
- * Helper class with various parameters defining an axis.
- * This helper class is used by {@link CartesianCoordinateSystem}
- * to set up a coordinate systems.
- *
- * This class holds more than a dozen parameters. There are two factory
- * methods creating instances for x- and y-axis based on
- * {@link ConfigParameters}. They differ in their default parameters for
- * those axes.
- *
- * Note, that there is a direct access of these parameters without getters
- * and setters but only for classes in the package jcckit.plot.
- *
- * @author Franz-Josef Elmer
- */
-public class AxisParameters {
- /** Configuration parameter key. */
- public static final String LOG_SCALE_KEY = "logScale",
- MINIMUM_KEY = "minimum",
- MAXIMUM_KEY = "maximum",
- AXIS_LENGTH_KEY = "axisLength",
- AXIS_ATTRIBUTES_KEY = "axisAttributes",
- AXIS_LABEL_KEY = "axisLabel",
- AXIS_LABEL_POSITION_KEY = "axisLabelPosition",
- AXIS_LABEL_ATTRIBUTES_KEY = "axisLabelAttributes",
- AUTOMATIC_TIC_CALCULATION_KEY
- = "automaticTicCalculation",
- MINIMUM_TIC_KEY = "minimumTic",
- MAXIMUM_TIC_KEY = "maximumTic",
- NUMBER_OF_TICS_KEY = "numberOfTics",
- TIC_LENGTH_KEY = "ticLength",
- TIC_ATTRIBUTES_KEY = "ticAttributes",
- TIC_LABEL_FORMAT_KEY = "ticLabelFormat",
- TIC_LABEL_POSITION_KEY = "ticLabelPosition",
- TIC_LABEL_ATTRIBUTES_KEY = "ticLabelAttributes",
- GRID_KEY = "grid",
- GRID_ATTRIBUTES_KEY = "gridAttributes";
-
- private static final double LN10 = Math.log(10);
-
- /** If true the scale is logarithmic otherwise linear. */
- boolean logScale;
- /** Minimum data value represented by the axis. */
- double minimum;
- /** Maximum data value represented by the axis. */
- double maximum;
- /** Length of the axis in device-independent graphical units. */
- double axisLength;
- /**
- * Line attributes of the axis.
- * Can be null which means default attributes.
- */
- LineAttributes axisAttributes;
-
- boolean automaticTicCalculation;
- double minimumTic;
- double maximumTic;
- int numberOfTics;
- /**
- * Length of the tics in device-independent graphical units.
- * If 0 no tics and tics label will be drawn.
- */
- double ticLength;
- /**
- * Attributes of the tics.
- * Can be null which means default attributes.
- */
- LineAttributes ticAttributes;
- /** Tic label formatter. */
- TicLabelFormat ticLabelFormat;
- /** Position of the tic label relative to the tic. */
- GraphPoint ticLabelPosition;
- /** Text attributes of the tic labels. */
- TextAttributes ticLabelAttributes;
-
- /** If true grid lines are drawn. */
- boolean grid;
- /**
- * Attributes of the grid lines.
- * Can be null which means default attributes.
- */
- LineAttributes gridAttributes;
-
- /** Axis label. */
- String axisLabel;
- /** Position of the axis label relative to the center of the axis. */
- GraphPoint axisLabelPosition;
- /** Text attributes of the axis label. */
- TextAttributes axisLabelAttributes;
-
- /**
- * Calculate the tics based on minimumTic, maximumTic,
- * and numberOfTics. If automaticTicCalculation == true
- * appropriated values for these fields are calculated.
- */
- double[] calculateTics() {
- if (automaticTicCalculation) {
- calculateTicsParameters();
- }
- double[] result = new double[numberOfTics];
- if (numberOfTics > 0) {
- double b = Util.log(minimumTic, logScale);
- double a = Util.log(maximumTic, logScale);
- a = numberOfTics > 1 ? (a - b) / (numberOfTics - 1) : 0;
- for (int i = 0; i < result.length; i++) {
- result[i] = Util.exp(a * i + b, logScale);
- }
- result[0] = adjust(minimum, result[0]);
- result[numberOfTics - 1] = adjust(maximum, result[numberOfTics - 1]);
- }
- return result;
- }
-
- private void calculateTicsParameters() {
- double min = Math.min(minimum, maximum);
- double max = Math.max(minimum, maximum);
- if (logScale) {
- int minExponent = (int) (199.9999 + Math.log(min) / LN10) - 199;
- int maxExponent = (int) (200.0001 + Math.log(max) / LN10) - 200;
- minimumTic = Math.exp(LN10 * minExponent);
- maximumTic = Math.exp(LN10 * maxExponent);
- numberOfTics = maxExponent - minExponent + 1;
- } else {
- int baseExponent = (int) (199.69 + Math.log(max - min) / LN10) - 200;
- double base = 0.2 * Math.exp(LN10 * baseExponent);
- do
- {
- base *= 5;
- int minInt = (int) (999999.999999 + min / base) - 999999;
- int maxInt = (int) (1000000.000001 + max / base) - 1000000;
- minimumTic = minInt * base;
- maximumTic = maxInt * base;
- numberOfTics = maxInt - minInt + 1;
- } while (numberOfTics > 11);
- }
- }
-
- /**
- * Returns adjustingValue if value is very close
- * to adjustingValue. Otherwise value is returned.
- */
- private static double adjust(double adjustingValue, double value) {
- return value != 0 && Math.abs(adjustingValue / value - 1) < 1e-11
- ? adjustingValue : value;
- }
-
- /**
- * Returns a Properties object with those default parameters
- * which are common for x- and y-axis.
- */
- private static Properties createDefaultAxisProperties() {
- Properties p = new Properties();
- p.put(LOG_SCALE_KEY, "false");
- p.put(MINIMUM_KEY, "0");
- p.put(MAXIMUM_KEY, "1");
- p.put(AXIS_LENGTH_KEY, "0.8");
- p.put(AXIS_ATTRIBUTES_KEY + '/' + Factory.CLASS_NAME_KEY,
- ShapeAttributes.class.getName());
- p.put(AXIS_LABEL_KEY, "x");
- p.put(AXIS_LABEL_POSITION_KEY, "0 -0.05");
- p.put(AXIS_LABEL_ATTRIBUTES_KEY + '/' + Factory.CLASS_NAME_KEY,
- BasicGraphicAttributes.class.getName());
- p.put(AXIS_LABEL_ATTRIBUTES_KEY + '/'
- + BasicGraphicAttributes.HORIZONTAL_ANCHOR_KEY, "center");
- p.put(AUTOMATIC_TIC_CALCULATION_KEY, "true");
- p.put(TIC_LENGTH_KEY, "0.01");
- p.put(TIC_ATTRIBUTES_KEY + '/' + Factory.CLASS_NAME_KEY,
- ShapeAttributes.class.getName());
- p.put(TIC_LABEL_POSITION_KEY, "0 -0.01");
- p.put(TIC_LABEL_FORMAT_KEY, "%1.1f");
- p.put(TIC_LABEL_ATTRIBUTES_KEY + '/' + Factory.CLASS_NAME_KEY,
- BasicGraphicAttributes.class.getName());
- p.put(TIC_LABEL_ATTRIBUTES_KEY + '/'
- + BasicGraphicAttributes.HORIZONTAL_ANCHOR_KEY, "center");
- p.put(TIC_LABEL_ATTRIBUTES_KEY + '/'
- + BasicGraphicAttributes.VERTICAL_ANCHOR_KEY, "top");
- p.put(GRID_KEY, "false");
- p.put(GRID_ATTRIBUTES_KEY + '/' + Factory.CLASS_NAME_KEY,
- ShapeAttributes.class.getName());
- return p;
- }
-
- /**
- * Returns a Properties object of the default parameters for
- * an x-axis.
- */
- private static Properties createDefaultXAxisProperties() {
- Properties p = createDefaultAxisProperties();
- p.put(AXIS_LABEL_KEY, "x");
- p.put(AXIS_LABEL_POSITION_KEY, "0 -0.05");
- p.put(AXIS_LABEL_ATTRIBUTES_KEY + '/'
- + BasicGraphicAttributes.VERTICAL_ANCHOR_KEY, "top");
- p.put(TIC_LABEL_POSITION_KEY, "0 -0.01");
- p.put(TIC_LABEL_ATTRIBUTES_KEY + '/'
- + BasicGraphicAttributes.HORIZONTAL_ANCHOR_KEY, "center");
- p.put(TIC_LABEL_ATTRIBUTES_KEY + '/'
- + BasicGraphicAttributes.VERTICAL_ANCHOR_KEY, "top");
- return p;
- }
-
- /**
- * Creates an x axis based on the specified configuration parameters.
- * All numbers (lengths, fontsizes, linethicknesses, etc.) are in
- * device-independent units.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * automaticTicCalculation = true |
- * boolean | no |
- * Has to be true if the tics should be calculated
- * automatically. |
- * axisAttributes = default values of
- * {@link ShapeAttributes} |
- * ConfigParameters | no |
- * Attributes of the axis box. |
- * axisLabel = x |
- * String | no |
- * Axis label. |
- * axisLabelAttributes = default values of
- * {@link BasicGraphicAttributes} with a text anchor CENTER
- * TOP. |
- * ConfigParameters | no |
- * Text attributes of axis label. |
- * axisLabelPosition = 0 -0.05 |
- * double[] | no |
- * Position of the anchor of the axis
- * label relative to the center of the x-axis line. |
- * axisLength = 0.8 |
- * double | no |
- * Length of the x-axis. |
- * grid = false |
- * boolean | no |
- * If true grid lines will be drawn through the axis
- * tics. |
- * gridAttributes = default values of
- * {@link ShapeAttributes} |
- * ConfigParameters | no |
- * Attributes of the grid lines. |
- * logScale = false |
- * boolean | no |
- * If true the axis will be logarithmic. Otherwise
- * the axis is linear. |
- * maximum = 1 |
- * double | no |
- * The corresponding data value of one end of the axis. |
- * maximumTic = result from automatic calculation |
- * double | no |
- * The corresponding data value of the tic nearest the maximum end
- * of the axis. |
- * minimum = 0 |
- * double | no |
- * The corresponding data value of one end of the axis. |
- * minimumTic = result from automatic calculation |
- * double | no |
- * The corresponding data value of the tic nearest the minimum end
- * of the axis. |
- * numberOfTics = result from automatic calculation |
- * int | no |
- * Number of tics. The tics between the minimum and maximum tic
- * are spaced equidistantly. |
- * ticAttributes = default values of
- * {@link ShapeAttributes} |
- * ConfigParameters | no |
- * Attributes of the tics. |
- * ticLabelAttributes = default values of
- * {@link BasicGraphicAttributes} with a text anchor CENTER
- * TOP. |
- * ConfigParameters | no |
- * Text attributes of tic labels. |
- * ticLabelFormat = %1.1f |
- * String or ConfigParameters | no |
- * Defines rendering of the tic label. By default a
- * printf-like format string is given (see {@link Format}).
- * Note, that an empty string means that tic labels are dropped.
- *
- * For non-numerical rendering an implementation of a
- * {@link TicLabelFormat} can be specified (e.g.
- * {@link TicLabelMap}). Note, that a configuration sub tree with
- * a className key-value pair overwrites any string
- * definition. |
- * ticLabelPosition = 0 -0.01 |
- * double[] | no |
- * Position of the anchor of the tic label relative to the
- * tic position on the axis. |
- * ticLength = 0.01 |
- * double | no |
- * Length of the tics. Negative/positive values mean tics
- * inside/outside the box. |
- *
- */
- public static AxisParameters createXAxis(ConfigParameters config) {
- return createAxis(config, createDefaultXAxisProperties());
- }
-
- /**
- * Returns a Properties object of the default parameters for
- * an x-axis.
- */
- private static Properties createDefaultYAxisProperties() {
- Properties p = createDefaultAxisProperties();
- p.put(AXIS_LENGTH_KEY, "0.45");
- p.put(AXIS_LABEL_KEY, "y");
- p.put(AXIS_LABEL_POSITION_KEY, "-0.1 0");
- p.put(AXIS_LABEL_ATTRIBUTES_KEY + '/'
- + BasicGraphicAttributes.VERTICAL_ANCHOR_KEY, "bottom");
- p.put(AXIS_LABEL_ATTRIBUTES_KEY + '/'
- + BasicGraphicAttributes.ORIENTATION_ANGLE_KEY, "90");
- p.put(TIC_LABEL_POSITION_KEY, "-0.01 0");
- p.put(TIC_LABEL_ATTRIBUTES_KEY + '/'
- + BasicGraphicAttributes.HORIZONTAL_ANCHOR_KEY, "right");
- p.put(TIC_LABEL_ATTRIBUTES_KEY + '/'
- + BasicGraphicAttributes.VERTICAL_ANCHOR_KEY, "center");
- return p;
- }
-
- /**
- * Creates an y axis based on the specified configuration parameters.
- * All numbers (lengths, fontsizes, linethicknesses, etc.) are in
- * device-independent units.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * automaticTicCalculation = true |
- * boolean | no |
- * Has to be true if the tics should be calculated
- * automatically. |
- * axisAttributes = default values of
- * {@link ShapeAttributes} |
- * ConfigParameters | no |
- * Attributes of the axis box. |
- * axisLabel = y |
- * String | no |
- * Axis label. |
- * axisLabelAttributes = default values of
- * {@link BasicGraphicAttributes} with a text anchor CENTER
- * BOTTOM and the text rotated by 90 degree. |
- * ConfigParameters | no |
- * Text attributes of axis label. |
- * axisLabelPosition = -0.1 0 |
- * double[] | no |
- * Position of the anchor of the axis
- * label relative to the center of the y-axis line. |
- * axisLength = 0.45 |
- * double | no |
- * Length of the y-axis. |
- * grid = false |
- * boolean | no |
- * If true grid lines will be drawn through the axis
- * tics. |
- * gridAttributes = default values of
- * {@link ShapeAttributes} |
- * ConfigParameters | no |
- * Attributes of the grid lines. |
- * logScale = false |
- * boolean | no |
- * If true the axis will be logarithmic. Otherwise
- * the axis is linear. |
- * maximum = 1 |
- * double | no |
- * The corresponding data value of one end of the axis. |
- * maximumTic = result from automatic calculation |
- * double | no |
- * The corresponding data value of the tic nearest the maximum end
- * of the axis. |
- * minimum = 0 |
- * double | no |
- * The corresponding data value of one end of the axis. |
- * minimumTic = result from automatic calculation |
- * double | no |
- * The corresponding data value of the tic nearest the minimum end
- * of the axis. |
- * numberOfTics = result from automatic calculation |
- * int | no |
- * Number of tics. The tics between the minimum and maximum tic
- * are spaced equidistantly. |
- * ticAttributes = default values of
- * {@link ShapeAttributes} |
- * ConfigParameters | no |
- * Attributes of the tics. |
- * ticLabelAttributes = default values of
- * {@link BasicGraphicAttributes} with a text anchor RIGHT CENTER.
- * |
- * ConfigParameters | no |
- * Text attributes of tic labels. |
- * ticLabelFormat = %1.1f |
- * String | no |
- * Defines rendering of the tic label. By default a
- * printf-like format string is given (see {@link Format}).
- * Note, that an empty string means that tic labels are dropped.
- *
- * For non-numerical rendering an implementation of a
- * {@link TicLabelFormat} can be specified (e.g.
- * {@link TicLabelMap}). Note, that a configuration sub tree with
- * a className key-value pair overwrites any string
- * definition. |
- * ticLabelPosition = -0.01 0 |
- * double[] | no |
- * Position of the anchor of the tic label relative to the
- * tic position on the axis. |
- * ticLength = 0.01 |
- * double | no |
- * Length of the tics. Negative/positive values mean tics
- * inside/outside the box. |
- *
- */
- public static AxisParameters createYAxis(ConfigParameters config) {
- return createAxis(config, createDefaultYAxisProperties());
- }
-
- private static AxisParameters createAxis(ConfigParameters config,
- Properties p) {
- ConfigData cd = new PropertiesBasedConfigData(p);
- ConfigParameters c = new ConfigParameters(cd);
- cd = new ConfigParametersBasedConfigData(config, c);
- c = new ConfigParameters(cd);
-
- AxisParameters a = new AxisParameters();
- a.logScale = c.getBoolean(LOG_SCALE_KEY);
- a.minimum = c.getDouble(MINIMUM_KEY);
- a.maximum = c.getDouble(MAXIMUM_KEY);
- a.axisLength = c.getDouble(AXIS_LENGTH_KEY);
- a.axisAttributes
- = (LineAttributes) Factory.create(c.getNode(AXIS_ATTRIBUTES_KEY));
- a.axisLabel = c.get(AXIS_LABEL_KEY);
- a.axisLabelPosition
- = new GraphPoint(c.getDoubleArray(AXIS_LABEL_POSITION_KEY));
- a.axisLabelAttributes = (TextAttributes) Factory.create(
- c.getNode(AXIS_LABEL_ATTRIBUTES_KEY));
- a.ticLength = c.getDouble(TIC_LENGTH_KEY);
- a.automaticTicCalculation
- = c.getBoolean(AUTOMATIC_TIC_CALCULATION_KEY);
- if (!a.automaticTicCalculation) {
- a.calculateTicsParameters(); // calculate default parameters
- a.minimumTic = c.getDouble(MINIMUM_TIC_KEY, a.minimumTic);
- a.maximumTic = c.getDouble(MAXIMUM_TIC_KEY, a.maximumTic);
- a.numberOfTics = c.getInt(NUMBER_OF_TICS_KEY, a.numberOfTics);
- }
- a.ticAttributes
- = (LineAttributes) Factory.create(c.getNode(TIC_ATTRIBUTES_KEY));
- a.ticLabelFormat = createTicLabelFormat(c);
- a.ticLabelPosition
- = new GraphPoint(c.getDoubleArray(TIC_LABEL_POSITION_KEY));
- a.ticLabelAttributes = (TextAttributes) Factory.create(
- c.getNode(TIC_LABEL_ATTRIBUTES_KEY));
- a.grid = c.getBoolean(GRID_KEY);
- a.gridAttributes
- = (LineAttributes) Factory.create(c.getNode(GRID_ATTRIBUTES_KEY));
- return a;
- }
-
- private static TicLabelFormat createTicLabelFormat(ConfigParameters c)
- {
- TicLabelFormat result = Format.create(c, TIC_LABEL_FORMAT_KEY);
- ConfigParameters node = c.getNode(TIC_LABEL_FORMAT_KEY);
- if (node.get(Factory.CLASS_NAME_KEY, null) != null) {
- result = (TicLabelFormat) Factory.create(node);
- }
- return result;
- }
-}
diff --git a/src/jcckit/plot/BarFactory.java b/src/jcckit/plot/BarFactory.java
deleted file mode 100644
index 6a452a1e6..000000000
--- a/src/jcckit/plot/BarFactory.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import jcckit.graphic.ClippingShape;
-import jcckit.graphic.GraphPoint;
-import jcckit.graphic.GraphicAttributes;
-import jcckit.graphic.GraphicalElement;
-import jcckit.graphic.Rectangle;
-import jcckit.util.ConfigParameters;
-
-/**
- * A factory of bars. The bars are {@link Rectangle Rectangles}.
- * Depending on the configuration parameters the bars can be
- * horizontal or vertical. Bars of several curves can be side by side or
- * stacked. The bar length is determined by the x or y value of the
- * curve point in device-independent coordinates. If the value is negative
- * the bar goes into the negative direction. For stacked bars the values
- * should always be positive.
- *
- * When used inside a {@link SimpleCurve} soft clipping should always be
- * switched off (see
- * {@link SimpleCurve#SimpleCurve(ConfigParameters, int, int, ClippingShape, Legend)}).
- *
- * @author Franz-Josef Elmer
- */
-public class BarFactory extends AbstractSymbolFactory {
- /** Configuration parameter key. */
- public static final String STACKED_KEY = "stacked",
- HORIZONTAL_BARS_KEY = "horizontalBars";
-
- private final boolean _stacked;
- private final boolean _horizontalBars;
-
- /**
- * Creates an instance from the specified configuration parameters.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * horizontalBars = false |
- * boolean | no |
- * If true horizontal bars will be drawn. Otherwise
- * vertical bars are drawn. |
- * stacked = false |
- * boolean | no |
- * If true the bars of several curves will be
- * stacked. |
- *
- * In addition the configuration parameters of the
- *
- * constructor of the superclass {@link AbstractSymbolFactory} apply.
- */
- public BarFactory(ConfigParameters config) {
- super(config);
- _horizontalBars = config.getBoolean(HORIZONTAL_BARS_KEY, false);
- _stacked = config.getBoolean(STACKED_KEY, false);
- }
-
- /**
- * Creates a bar at the specified point.
- * If hintFromPreviousCurve
- * is not an instance of {@link PositionHint} the values of
- * origin and position will be (0,0).
- * @param hintFromPreviousCurve Hint from previous curve. Will be used
- * to calculate symbol shape and hint for the next curve.
- */
- protected Symbol createSymbol(GraphPoint point, GraphicAttributes attributes,
- Hint hintForNextPoint,
- Hint hintFromPreviousCurve) {
- GraphPoint origin = new GraphPoint(null);
- GraphPoint position = origin;
- if (hintFromPreviousCurve instanceof PositionHint) {
- origin = ((PositionHint) hintFromPreviousCurve).getOrigin();
- position = ((PositionHint) hintFromPreviousCurve).getPosition();
- }
- double px = position.getX();
- double py = position.getY();
- double x = point.getX() - origin.getX();
- double y = point.getY() - origin.getY();
- if (_horizontalBars) {
- y = _size;
- position = new GraphPoint(px + 0.5 * x, point.getY() + py);
- px += _stacked ? x : 0;
- py += _stacked ? 0 : _size;
- } else {
- x = _size;
- position = new GraphPoint(point.getX() + px, py + 0.5 * y);
- px += _stacked ? 0 : _size;
- py += _stacked ? y : 0;
- }
- Hint hintForNextCurve = new PositionHint(origin, new GraphPoint(px, py));
- return new Symbol(new Rectangle(position, Math.abs(x), Math.abs(y),
- attributes),
- hintForNextPoint, hintForNextCurve);
- }
-
- /**
- * Creates a symbol for the legend at the specified position.
- * @param centerPosition Center position of the symbol.
- * @param size The size of the symbol.
- */
- public GraphicalElement createLegendSymbol(GraphPoint centerPosition,
- double size) {
- return new Rectangle(centerPosition, size, size, _attributes);
- }
-
- /**
- * Returns null because this method isn't needed but has to be
- * implemented.
- */
- protected GraphicalElement createPlainSymbol(
- GraphPoint centerPosition, double size, GraphicAttributes attributes) {
- return null;
- }
-}
diff --git a/src/jcckit/plot/CartesianCoordinateSystem.java b/src/jcckit/plot/CartesianCoordinateSystem.java
deleted file mode 100644
index dbfaae8db..000000000
--- a/src/jcckit/plot/CartesianCoordinateSystem.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import jcckit.data.DataPoint;
-import jcckit.graphic.ClippingRectangle;
-import jcckit.graphic.ClippingShape;
-import jcckit.graphic.GraphPoint;
-import jcckit.graphic.GraphicAttributes;
-import jcckit.graphic.GraphicalComposite;
-import jcckit.graphic.GraphicalElement;
-import jcckit.graphic.LineAttributes;
-import jcckit.graphic.Polygon;
-import jcckit.graphic.Text;
-import jcckit.transformation.CartesianTransformation;
-import jcckit.transformation.Transformation;
-import jcckit.util.ConfigParameters;
-
-/**
- * A Cartesian coordinate system. One or both axes can be logarithmic.
- *
- * @author Franz-Josef Elmer
- */
-public class CartesianCoordinateSystem implements CoordinateSystem {
- /** Configuration parameter key. */
- public static final String ORIGIN_KEY = "origin",
- X_AXIS_KEY = "xAxis",
- Y_AXIS_KEY = "yAxis";
-
- private final CartesianTransformation _transformation;
- private final GraphicalComposite _view;
- private final ClippingRectangle _clippingRectangle;
-
- /**
- * Creates an instance from the specified configuration parameters.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * origin = 0.15, 0.1 |
- * double[] | no |
- * Position (in device-independent coordinates) of the lower-left
- * corner of the axis box. |
- * xAxis |
- * ConfigParameters | no |
- * Parameters defining the x-axis. For definitions and default
- * values see {@link AxisParameters#createXAxis
- * AxisParameters.createXAxis()}. |
- * yAxis |
- * ConfigParameters | no |
- * Parameters defining the y-axis. For definitions and default
- * values see {@link AxisParameters#createYAxis
- * AxisParameters.createYAxis()}. |
- *
- */
- public CartesianCoordinateSystem(ConfigParameters config) {
- this(new GraphPoint(config.getDoubleArray(ORIGIN_KEY,
- new double[] {0.15, 0.1})),
- AxisParameters.createXAxis(config.getNode(X_AXIS_KEY)),
- AxisParameters.createYAxis(config.getNode(Y_AXIS_KEY)));
- }
-
- /**
- * Creates an instance for the specified origin and parameters
- * of both axes.
- * @param origin Position (in device-independent coordinates) of the
- * lower-left corner of the axis box.
- * @param xAxisParameters Parameters of the x-axis.
- * @param yAxisParameters Parameters of the y-axis.
- */
- public CartesianCoordinateSystem(GraphPoint origin,
- AxisParameters xAxisParameters,
- AxisParameters yAxisParameters) {
- double x = origin.getX();
- double y = origin.getY();
- _transformation = new CartesianTransformation(xAxisParameters.logScale,
- yAxisParameters.logScale,
- new DataPoint(xAxisParameters.minimum, yAxisParameters.minimum),
- new GraphPoint(x, y),
- new DataPoint(xAxisParameters.maximum, yAxisParameters.maximum),
- new GraphPoint(x + xAxisParameters.axisLength,
- y + yAxisParameters.axisLength));
- _clippingRectangle = new ClippingRectangle(x, y,
- x + xAxisParameters.axisLength,
- y + yAxisParameters.axisLength);
- _view = new GraphicalComposite(null);
- createView(origin, xAxisParameters, yAxisParameters);
- }
-
- /** Creates the graphical representation of this coordinate system. */
- private void createView(GraphPoint origin,
- AxisParameters xAxisParameters,
- AxisParameters yAxisParameters) {
- double x0 = origin.getX();
- double x1 = x0 + xAxisParameters.axisLength;
- double y0 = origin.getY();
- double y1 = y0 + yAxisParameters.axisLength;
- GraphPoint lowerLeftCorner = new GraphPoint(x0, y0);
- GraphPoint upperLeftCorner = new GraphPoint(x0, y1);
- GraphPoint lowerRightCorner = new GraphPoint(x1, y0);
- GraphPoint upperRightCorner = new GraphPoint(x1, y1);
- LineAttributes xLineAttributes = xAxisParameters.axisAttributes;
- LineAttributes yLineAttributes = yAxisParameters.axisAttributes;
- createTicsAndGrid(true, y0, y1, xAxisParameters);
- createTicsAndGrid(false, x0, x1, yAxisParameters);
- addLine(lowerLeftCorner, lowerRightCorner, xLineAttributes);
- addLine(lowerLeftCorner, upperLeftCorner, yLineAttributes);
- addLine(upperLeftCorner, upperRightCorner, xLineAttributes);
- addLine(lowerRightCorner, upperRightCorner, yLineAttributes);
- createLabel(0.5 * (x0 + x1), y0, xAxisParameters);
- createLabel(x0, 0.5 * (y0 + y1), yAxisParameters);
- }
-
- private void createLabel(double x, double y, AxisParameters parameters) {
- if (parameters.axisLabel.length() > 0) {
- _view.addElement(new Text(
- new GraphPoint(x + parameters.axisLabelPosition.getX(),
- y + parameters.axisLabelPosition.getY()),
- parameters.axisLabel, parameters.axisLabelAttributes));
- }
- }
-
- private void createTicsAndGrid(boolean isXAxis, double low, double high,
- AxisParameters parameters) {
- double[] tics = parameters.calculateTics();
- int offIndex = isXAxis ? 1 : 0;
- double[] point = new double[2]; // helper array
- for (int i = 0; i < tics.length; i++) {
- point[1 - offIndex] = tics[i];
- point[offIndex] = 1;
- GraphPoint gPoint1 =
- _transformation.transformToGraph(new DataPoint(point[0], point[1]));
- point[0] = gPoint1.getX();
- point[1] = gPoint1.getY();
- point[offIndex] = high;
- gPoint1 = new GraphPoint(point[0], point[1]);
- point[offIndex] += parameters.ticLength;
- addLine(gPoint1, new GraphPoint(point[0], point[1]),
- parameters.ticAttributes);
- point[offIndex] = low;
- GraphPoint gPoint2 = new GraphPoint(point[0], point[1]);
- if (parameters.grid) {
- addLine(gPoint1, gPoint2, parameters.gridAttributes);
- }
- point[offIndex] -= parameters.ticLength;
- addLine(gPoint2, new GraphPoint(point[0], point[1]),
- parameters.ticAttributes);
- if (parameters.ticLabelFormat != null) {
- point[offIndex] += parameters.ticLength;
- point[0] += parameters.ticLabelPosition.getX();
- point[1] += parameters.ticLabelPosition.getY();
- _view.addElement(new Text(new GraphPoint(point[0], point[1]),
- parameters.ticLabelFormat.form(tics[i]),
- parameters.ticLabelAttributes));
- }
- }
- }
-
- private void addLine(GraphPoint point1, GraphPoint point2,
- GraphicAttributes attributes) {
- Polygon line = new Polygon(attributes, false);
- line.addPoint(point1);
- line.addPoint(point2);
- _view.addElement(line);
- }
-
- /**
- * Returns the graphical representation of the coordinate system.
- * In each call the same instance is returned.
- */
- public GraphicalElement getView() {
- return _view;
- }
-
- /**
- * Returns the clipping rectangle of specified by the axis.
- * In each call the same instance is returned.
- */
- public ClippingShape getClippingShape() {
- return _clippingRectangle;
- }
-
- /**
- * Returns the transformation of data coordinates into the device-independent
- * coordinates of the axis box.
- * In each call the same instance is returned.
- */
- public Transformation getTransformation() {
- return _transformation;
- }
-}
diff --git a/src/jcckit/plot/CircleSymbolFactory.java b/src/jcckit/plot/CircleSymbolFactory.java
deleted file mode 100644
index b9eb9a6b9..000000000
--- a/src/jcckit/plot/CircleSymbolFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import jcckit.graphic.GraphPoint;
-import jcckit.graphic.GraphicAttributes;
-import jcckit.graphic.GraphicalElement;
-import jcckit.graphic.Oval;
-import jcckit.util.ConfigParameters;
-
-/**
- * A factory of circle symbols.
- *
- * @author Franz-Josef Elmer
- */
-public class CircleSymbolFactory extends AbstractSymbolFactory {
- /**
- * Creates an instance from the specified configuration parameters.
- * For the configuration parameters see the
- *
- * constructor of the superclass {@link AbstractSymbolFactory}.
- */
- public CircleSymbolFactory(ConfigParameters config) {
- super(config);
- }
-
- /**
- * Creates a circle.
- * @param centerPosition Position of the center of the circle.
- * @param size Diameter of the circle.
- * @param attributes Circle attributes.
- */
- protected GraphicalElement createPlainSymbol(GraphPoint centerPosition,
- double size,
- GraphicAttributes attributes) {
- return new Oval(centerPosition, size, size, attributes);
- }
-}
diff --git a/src/jcckit/plot/CoordinateSystem.java b/src/jcckit/plot/CoordinateSystem.java
deleted file mode 100644
index 11ac62838..000000000
--- a/src/jcckit/plot/CoordinateSystem.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import jcckit.graphic.ClippingShape;
-import jcckit.graphic.GraphicalElement;
-import jcckit.transformation.Transformation;
-
-/**
- * Interface for all generators of coordinate systems. A
- * CoordinateSystem creates a
- * {@link jcckit.graphic.GraphicalComposite} which contains all the
- * {@link GraphicalElement GraphicalElements} defining axes, labels, grid, etc.
- *
- * @author Franz-Josef Elmer
- */
-public interface CoordinateSystem {
- /**
- * Returns the graphical representation of a coordinate
- * system. Different invocations of this method may return
- * different coordinate systems, e.g., due to changes in the
- * transformation or clipping shapes.
- */
- public GraphicalElement getView();
-
- /**
- * Returns the clipping chape of {@link Curve Curves} drawn on top
- * of the coordinates system. Different invocations of
- * this method may return different clipping shapes.
- */
- public ClippingShape getClippingShape();
-
- /**
- * Returns the transformation between data coordinates and
- * device-independent graphcial coordinates. Different invocations
- * of this method may return different transformations.
- */
- public Transformation getTransformation();
-}
diff --git a/src/jcckit/plot/Curve.java b/src/jcckit/plot/Curve.java
deleted file mode 100644
index 03cb3cb78..000000000
--- a/src/jcckit/plot/Curve.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import jcckit.graphic.GraphPoint;
-import jcckit.graphic.GraphicalElement;
-
-/**
- * A curve is defined by a sequence of points in device-independent
- * coordinates. The points can be decorated by symbols and/or
- * connected by lines.{@link Hint Hints} are used to determine additional
- * properties of the symbol. This is especially important for
- * charts with bars.
- *
- * In accordance with the Factory Method Pattern
- * the symbols are created by a {@link SymbolFactory}.
- *
- * @author Franz-Josef Elmer
- */
-public interface Curve {
- /**
- * Returns the graphical representation of a curve.
- * Different invocations of this method might return
- * different instances.
- * This is especially true after adding, inserting, removing, or
- * repplacing a point of the curve.
- */
- public GraphicalElement getView();
-
- /**
- * Returns a symbol which can be used to create the legend for the curve.
- * For example, it should return a horizontal line with the symbol
- * in the middle if the curve is a line with points decorated by symbols.
- */
- public GraphicalElement getLegendSymbol();
-
- /**
- * Appends a new point to the curve.
- * @param point Position in device-independent coordinates.
- * @param hintFromPreviousCurve Hint which may be used to calculate
- * the corresponding {@link GraphicalElement}.
- * @return hint for next curve.
- */
- public Hint addPoint(GraphPoint point, Hint hintFromPreviousCurve);
-
- /** Removes all points from the curve. */
- public void removeAllPoints();
-}
diff --git a/src/jcckit/plot/CurveFactory.java b/src/jcckit/plot/CurveFactory.java
deleted file mode 100644
index 0e6ee53fa..000000000
--- a/src/jcckit/plot/CurveFactory.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import jcckit.graphic.ClippingShape;
-
-/**
- * Interface of a curve factory. A curve factory creates a new instance
- * of a {@link Curve}.
- *
- * @author Franz-Josef Elmer
- */
-public interface CurveFactory {
- /**
- * Creates a new curve instance.
- * @param curveIndex The index of the curve in the {@link Plot} to which
- * it should belong.
- * @param numberOfCurves Number of curves. Will be needed to calculate the
- * y-coordinate of the legend symbol.
- * @param clippingShape Clipping shape applied to the curve.
- * @param legend The legend which will show the curve symbol.
- * @return an empty instance.
- */
- public Curve create(int curveIndex, int numberOfCurves,
- ClippingShape clippingShape, Legend legend);
-}
diff --git a/src/jcckit/plot/ErrorBarFactory.java b/src/jcckit/plot/ErrorBarFactory.java
deleted file mode 100644
index 2c55462d3..000000000
--- a/src/jcckit/plot/ErrorBarFactory.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import jcckit.graphic.GraphPoint;
-import jcckit.graphic.GraphicAttributes;
-import jcckit.graphic.GraphicalComposite;
-import jcckit.graphic.GraphicalElement;
-import jcckit.graphic.Rectangle;
-import jcckit.util.ConfigParameters;
-import jcckit.util.Factory;
-
-/**
- * Symbol factory for creating symbols with error bars. It wraps
- * a {@link SymbolFactory} for creating the symbol. The error bars
- * are {@link Rectangle Rectangles}.
- *
- * Curves with error bars are based on two
- * {@link jcckit.data.DataCurve DataCurves}:
- *
- The plain curve.
- *
- An instance which stores the errors in x and y.
- * It is assumed that the errors are positive values defining
- * the error symmetrically around the curve points.
- *
- *
- * The ErrorBarFactory needs an instance of {@link PositionHint}
- * as initial {@link Hint} for the next curve. Its origin must be
- * the origin of the data coordinate system in device-independent coordinates.
- * The position of PositionHint must be undefined.
- *
- * @author Franz-Josef Elmer
- */
-public class ErrorBarFactory implements SymbolFactory {
- /** Configuration parameter key. */
- public static final String SYMBOL_FACTORY_KEY = "symbolFactory";
-
- private final SymbolFactory _symbolFactory;
- private final GraphicAttributes _attributes;
- private final double _size;
-
- /**
- * Creates an instance from the specified configuration parameters.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * symbolFactory = null |
- * ConfigParameters | no |
- * Definition of the wrapped {@link SymbolFactory} which generates
- * the curve symbol without bars. By default an empty
- * {@link GraphicalComposite} will be created. |
- * size = 0 |
- * double | no |
- * Width of the error bars. |
- * attributes = null |
- * ConfigParameters | no |
- * Definition of the {@link GraphicAttributes} of the error
- * bars. |
- *
- */
- public ErrorBarFactory(ConfigParameters config) {
- _symbolFactory = (SymbolFactory) Factory.createOrGet(
- config.getNode(SYMBOL_FACTORY_KEY), null);
- _size = config.getDouble(SIZE_KEY, 0);
- _attributes = (GraphicAttributes) Factory.createOrGet(
- config.getNode(ATTRIBUTES_KEY), null);
- }
-
- /**
- * Creates the legend symbol. Calls the wrapped {@link SymbolFactory}
- * or returns an empty instance of {@link GraphicalComposite} if undefined.
- */
- public GraphicalElement createLegendSymbol(GraphPoint centerPosition,
- double size) {
- return _symbolFactory == null ? new GraphicalComposite(null)
- : _symbolFactory.createLegendSymbol(centerPosition, size);
- }
-
- /**
- * Creates either the curve symbol or the error bars. Error bars are
- * created when hintFromPreviousCurve is an instance of
- * {@link PositionHint} and its position attribute is not null.
- * Otherwise the curve symbol is created. The position attributes stores
- * the curve point (in device-independent coordinates). The origin is
- * always as set in the initial PositionHint. The hint for
- * the next curve wrapped by the returned Symbol is always
- * a PositionHint.
- */
- public Symbol createSymbol(GraphPoint point, Hint hintFromPreviousPoint,
- Hint hintFromPreviousCurve) {
- GraphPoint origin = new GraphPoint(null);
- GraphPoint position = null;
- if (hintFromPreviousCurve instanceof PositionHint) {
- origin = ((PositionHint) hintFromPreviousCurve).getOrigin();
- position = ((PositionHint) hintFromPreviousCurve).getPosition();
- }
- if (position == null) {
- if (_symbolFactory == null) {
- return new Symbol(new GraphicalComposite(null), hintFromPreviousPoint,
- new PositionHint(origin, point));
- } else {
- return _symbolFactory.createSymbol(point, hintFromPreviousPoint,
- new PositionHint(origin, point));
- }
- } else {
- double xError = point.getX() - origin.getX();
- double yError = point.getY() - origin.getY();
- GraphicalComposite errorBars = new GraphicalComposite(null);
- if (xError > 0) {
- errorBars.addElement(new Rectangle(position, 2 * xError, _size,
- _attributes));
- }
- if (yError > 0) {
- errorBars.addElement(new Rectangle(position, _size, 2 * yError,
- _attributes));
- }
- return new Symbol(errorBars, hintFromPreviousPoint,
- new PositionHint(origin, null));
- }
- }
-}
diff --git a/src/jcckit/plot/Hint.java b/src/jcckit/plot/Hint.java
deleted file mode 100644
index ff565b8f4..000000000
--- a/src/jcckit/plot/Hint.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-
-/**
- * Marker interface of all types of hints. Hints are used to calculate
- * {@link jcckit.graphic.GraphicalElement} representing a point in a {@link
- * Curve}. For example, in a chart with stacked
- * bars the data determines the height of a bar but the foot of
- * a bar is determined by the height of the bar below. Its value will be
- * stored in a {@link PositionHint}.
- *
- * @author Franz-Josef Elmer
- */
-public interface Hint {}
diff --git a/src/jcckit/plot/Legend.java b/src/jcckit/plot/Legend.java
deleted file mode 100644
index 3feea40c8..000000000
--- a/src/jcckit/plot/Legend.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import java.util.Properties;
-
-import jcckit.graphic.BasicGraphicAttributes;
-import jcckit.graphic.GraphPoint;
-import jcckit.graphic.GraphicAttributes;
-import jcckit.graphic.GraphicalComposite;
-import jcckit.graphic.GraphicalElement;
-import jcckit.graphic.Polygon;
-import jcckit.graphic.Rectangle;
-import jcckit.graphic.ShapeAttributes;
-import jcckit.graphic.Text;
-import jcckit.graphic.TextAttributes;
-import jcckit.util.ConfigData;
-import jcckit.util.ConfigParameters;
-import jcckit.util.ConfigParametersBasedConfigData;
-import jcckit.util.Factory;
-import jcckit.util.PropertiesBasedConfigData;
-
-
-/**
- * Helper class for creating the legend of a {@link Plot}.
- *
- * @author Franz-Josef Elmer
- */
-public class Legend {
- /** Configuration parameter key. */
- public static final String UPPER_RIGHT_CORNER_KEY = "upperRightCorner",
- BOX_WIDTH_KEY = "boxWidth",
- BOX_HEIGHT_KEY = "boxHeight",
- BOX_ATTRIBUTES_KEY = "boxAttributes",
- TITLE_KEY = "title",
- TITLE_DISTANCE_KEY = "titleDistance",
- TITLE_ATTRIBUTES_KEY = "titleAttributes",
- LEFT_DISTANCE_KEY = "leftDistance",
- BOTTOM_DISTANCE_KEY = "bottomDistance",
- TOP_DISTANCE_KEY = "topDistance",
- LINE_LENGTH_KEY = "lineLength",
- SYMBOL_SIZE_KEY = "symbolSize",
- CURVE_TITLE_DISTANCE_KEY = "curveTitleDistance",
- CURVE_TITLE_ATTRIBUTES_KEY
- = "curveTitleAttributes";
-
- private final GraphicalComposite _box;
- private final TextAttributes _curveTitleAttributes;
- private final double _xSymbol;
- private final double _xText;
- private final double _yBase;
- private final double _yLastRow;
- private final double _length;
- private final double _size;
-
- /**
- * Creates an instance from the specified configuration parameters.
- * All numbers (lengths, fontsizes, linethicknesses, etc.) are in
- * device-independent units.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * bottomDistance = 0.02 |
- * double | no |
- * Distance between the last row and the bottom of the legend box.
- * |
- * boxAttributes = default values of
- * {@link ShapeAttributes} with a white fill color. |
- * ConfigParameters | no |
- * Attributes of the legend box. |
- * boxHeight = 0.1 |
- * double | no |
- * Height of the legend box. |
- * boxWidth = 0.2 |
- * double | no |
- * Width of the legend box. |
- * curveTitleAttributes = default values of
- * {@link BasicGraphicAttributes} |
- * ConfigParameters | no |
- * Text attributes of curve titles printed in the legend. |
- * curveTitleDistance = 0.005 |
- * double | no |
- * Horizontal distance between the line part of the legend symbol
- * and the curve title. |
- * leftDistance = 0.01 |
- * double | no |
- * Horizontal distance between the line part of the legend symbol
- * and the left border of the legend box. |
- * lineLength = 0.035 |
- * double | no |
- * Length of the line part of the legend symbol. |
- * symbolSize = 0.01 |
- * double | no |
- * Size of the symbol part of the legend symbol. Will be the
- * size argument of {@link SymbolFactory#createLegendSymbol
- * createLegendSymbol} in a {@link SymbolFactory}. |
- * titleAttributes = default values of
- * {@link BasicGraphicAttributes} with a text anchor CENTER
- * TOP. |
- * ConfigParameters | no |
- * Text attributes of the title of the legend box. |
- * title = Legend |
- * String | no |
- * Title of the legend box. |
- * titleDistance = 0.005 |
- * double | no |
- * Distance between the center of the upper line of the legend box
- * and the anchor of the legend title. |
- * topDistance = 0.04 |
- * double | no |
- * Distance between the first row and the top of the legend box.
- * |
- * upperRightCorner = 0.94, 0.54 |
- * double[] | no |
- * Position of the upper-right corner of the legend box. |
- *
- */
- public Legend(ConfigParameters config) {
- config = mergeWithDefaultConfig(config);
- GraphPoint corner
- = new GraphPoint(config.getDoubleArray(UPPER_RIGHT_CORNER_KEY,
- new double[] {0.94, 0.54}));
- double width = config.getDouble(BOX_WIDTH_KEY, 0.2);
- double height = config.getDouble(BOX_HEIGHT_KEY, 0.1);
- _curveTitleAttributes = (TextAttributes) Factory.create(
- config.getNode(CURVE_TITLE_ATTRIBUTES_KEY));
- _xSymbol = corner.getX() - width
- + config.getDouble(LEFT_DISTANCE_KEY, 0.01);
- _yBase = corner.getY() - config.getDouble(TOP_DISTANCE_KEY, 0.04);
- _yLastRow = corner.getY() - height
- + config.getDouble(BOTTOM_DISTANCE_KEY, 0.02);
- _length = config.getDouble(LINE_LENGTH_KEY, 0.035);
- _size = config.getDouble(SYMBOL_SIZE_KEY, 0.01);
- _xText = _xSymbol + _length
- + config.getDouble(CURVE_TITLE_DISTANCE_KEY, 0.005);
-
- _box = new GraphicalComposite(null);
- double xCenter = corner.getX() - width / 2;
- _box.addElement(new Rectangle(
- new GraphPoint(xCenter, corner.getY() - height / 2), width, height,
- (GraphicAttributes) Factory.create(
- config.getNode(BOX_ATTRIBUTES_KEY))));
- _box.addElement(new Text(
- new GraphPoint(xCenter, corner.getY()
- - config.getDouble(TITLE_DISTANCE_KEY, 0.005)),
- config.get(TITLE_KEY, "Legend"),
- (TextAttributes) Factory.create(
- config.getNode(TITLE_ATTRIBUTES_KEY))));
- }
-
- private ConfigParameters mergeWithDefaultConfig(ConfigParameters config) {
- Properties p = new Properties();
- p.put(BOX_ATTRIBUTES_KEY + '/' + Factory.CLASS_NAME_KEY,
- ShapeAttributes.class.getName());
- p.put(BOX_ATTRIBUTES_KEY + '/'
- + ShapeAttributes.FILL_COLOR_KEY, "0xffffff");
- p.put(BOX_ATTRIBUTES_KEY + '/'
- + ShapeAttributes.LINE_COLOR_KEY, "0");
- p.put(TITLE_ATTRIBUTES_KEY + '/' + Factory.CLASS_NAME_KEY,
- BasicGraphicAttributes.class.getName());
- p.put(TITLE_ATTRIBUTES_KEY + '/'
- + BasicGraphicAttributes.HORIZONTAL_ANCHOR_KEY, "center");
- p.put(TITLE_ATTRIBUTES_KEY + '/'
- + BasicGraphicAttributes.VERTICAL_ANCHOR_KEY, "top");
- p.put(CURVE_TITLE_ATTRIBUTES_KEY + '/' + Factory.CLASS_NAME_KEY,
- BasicGraphicAttributes.class.getName());
- ConfigData cd = new PropertiesBasedConfigData(p);
- cd = new ConfigParametersBasedConfigData(config, new ConfigParameters(cd));
- return new ConfigParameters(cd);
- }
-
- /**
- * Returns the legend box with title but without legend symbols and curve
- * titles.
- */
- public GraphicalElement getBox() {
- return _box;
- }
-
- /**
- * Creates the symbol part of a legend symbol.
- * @param curveIndex Index of the curve. Will be needed to calculate the
- * y-coordinate of the symbol.
- * @param numberOfCurves Number of curves. Will be needed to calculate the
- * y-coordinate of the symbol.
- * @param factory Factory for the symbol part of the legend symbol.
- * Can be null.
- * @param withLine true if the line part of the legend symbol
- * should be created.
- * @param lineAttributes Attributes of the line part.
- */
- public GraphicalElement createSymbol(int curveIndex, int numberOfCurves,
- SymbolFactory factory,
- boolean withLine,
- GraphicAttributes lineAttributes) {
- GraphicalComposite result = new GraphicalComposite(null);
- double y = calculateBaseLine(curveIndex, numberOfCurves);
- if (withLine) {
- Polygon line = new Polygon(lineAttributes, false);
- line.addPoint(new GraphPoint(_xSymbol, y));
- line.addPoint(new GraphPoint(_xSymbol + _length, y));
- result.addElement(line);
- }
- if (factory != null) {
- result.addElement(factory.createLegendSymbol(
- new GraphPoint(_xSymbol + _length / 2, y), _size));
- }
- return result;
- }
-
- private double calculateBaseLine(int curveIndex, int numberOfCurves) {
- if (numberOfCurves > 1) {
- return _yBase + ((_yLastRow - _yBase) / (numberOfCurves - 1))
- * curveIndex;
- } else {
- return 0.5 * (_yBase + _yLastRow);
- }
- }
-
- /**
- * Creates the title part of a legend symbol.
- * @param curveIndex Index of the curve. Will be needed to calculate the
- * y-coordinate of the title.
- * @param numberOfCurves Number of curves. Will be needed to calculate the
- * y-coordinate of the symbol.
- * @param title Title text.
- */
- public GraphicalElement createCurveTitle(int curveIndex, int numberOfCurves,
- String title) {
- return new Text(new GraphPoint(_xText, calculateBaseLine(curveIndex,
- numberOfCurves)),
- title, _curveTitleAttributes);
- }
-}
diff --git a/src/jcckit/plot/Plot.java b/src/jcckit/plot/Plot.java
deleted file mode 100644
index 0a2c7d274..000000000
--- a/src/jcckit/plot/Plot.java
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import java.util.Vector;
-
-import jcckit.data.DataCurve;
-import jcckit.data.DataEvent;
-import jcckit.data.DataListener;
-import jcckit.data.DataPlot;
-import jcckit.data.DataPoint;
-import jcckit.graphic.ClippingShape;
-import jcckit.graphic.GraphPoint;
-import jcckit.graphic.GraphicalComposite;
-import jcckit.graphic.GraphicalElement;
-import jcckit.transformation.Transformation;
-import jcckit.util.ConfigParameters;
-import jcckit.util.Factory;
-
-/**
- * A plot is determined by a {@link CoordinateSystem}, {@link Curve Curves},
- * an optional annotation layer and an optional {@link Legend}. When rendered
- * these components are draw in this order.
- *
- * Registrated {@link PlotListener PlotListeners} will be informed
- * when the plot changes.
- *
- * A {@link DataPlot} can be connected with a Plot instance.
- * This is done with the method {@link #connect connect()} which registrates
- * this Plot instance as
- * a {@link DataListener} at the connected DataPlot.
- * After an received {@link DataEvent DataEvents} has been handled
- * the registrated PlotListeners will receive a
- * {@link PlotEvent} of the type {@link PlotEventType#DATA_PLOT_CHANGED}.
- *
- * @author Franz-Josef Elmer
- */
-public class Plot implements DataListener {
- /** Configuration parameter key. */
- public static final String COORDINATE_SYSTEM_KEY = "coordinateSystem",
- CURVE_FACTORY_KEY = "curveFactory",
- LEGEND_VISIBLE_KEY = "legendVisible",
- LEGEND_KEY = "legend",
- INITIAL_HINT_FOR_NEXT_CURVE_KEY
- = "initialHintForNextCurve";
- private final Vector _plotListeners = new Vector();
- private DataPlot _dataPlot;
- private final CurveFactory _curveFactory;
- private final Vector _curves = new Vector();
- private final Vector _nextCurveHints = new Vector();
- private final Hint _initialHintForNextCurve;
- private final Legend _legend;
- private final boolean _legendVisibility;
-
- private GraphicalElement _coordinateSystemView;
- private ClippingShape _clippingShape;
- private Transformation _transformation;
- private GraphicalElement _annotation;
- private GraphicalComposite _legendView = new GraphicalComposite(null);
-
- /**
- * Creates an instance from the specified configuration parameters.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * coordinateSystem = {@link CartesianCoordinateSystem} |
- * ConfigParameters | no |
- * Definition of the {@link CoordinateSystem}. |
- * curveFactory = {@link SimpleCurveFactory} |
- * ConfigParameters | no |
- * Definition of the {@link CurveFactory}. |
- * initialHintForNextCurve = null |
- * ConfigParameters | no |
- * Definition of the initial {@link Hint} which is needed by some
- * {@link SymbolFactory SymbolFactories} like {@link BarFactory}.
- * |
- * legend = default values of {@link Legend} |
- * ConfigParameters | no |
- * Configuration parameters of a {@link Legend}. |
- * legendVisible = true |
- * boolean | no |
- * If true the {@link Legend} will be created. |
- *
- */
- public Plot(ConfigParameters config) {
- CoordinateSystem coordinateSystem = (CoordinateSystem) Factory.create(
- config.getNode(COORDINATE_SYSTEM_KEY),
- CartesianCoordinateSystem.class.getName());
- setCoordinateSystem(coordinateSystem);
- _curveFactory = (CurveFactory) Factory.create(
- config.getNode(CURVE_FACTORY_KEY),
- SimpleCurveFactory.class.getName());
- _initialHintForNextCurve = (Hint) Factory.createOrGet(
- config.getNode(INITIAL_HINT_FOR_NEXT_CURVE_KEY), null);
- _legend = new Legend(config.getNode(LEGEND_KEY));
- _legendVisibility = config.getBoolean(LEGEND_VISIBLE_KEY, true);
- }
-
- /**
- * Sets the coordinate system. All curves will be regenerated and a
- * {@link PlotEvent} of type {@link PlotEventType#COODINATE_SYSTEM_CHANGED}
- * will be fired.
- *
- * @param coordinateSystem New coordinate system.
- */
- public void setCoordinateSystem(CoordinateSystem coordinateSystem)
- {
- _coordinateSystemView = coordinateSystem.getView();
- _clippingShape = coordinateSystem.getClippingShape();
- _transformation = coordinateSystem.getTransformation();
- if (_dataPlot != null)
- {
- generateCurves(_dataPlot);
- }
- notifyListeners(
- new PlotEvent(this, PlotEventType.COODINATE_SYSTEM_CHANGED, null));
- }
-
- /**
- * Adds the specified {@link PlotListener}. Does nothing if
- * already added.
- */
- public void addPlotListener(PlotListener listener) {
- if (!_plotListeners.contains(listener)) {
- _plotListeners.addElement(listener);
- }
- }
-
- /**
- * Removes the specfied {@link PlotListener}. Does nothing if
- * already removed.
- */
- public void removePlotListener(PlotListener listener) {
- _plotListeners.removeElement(listener);
- }
-
- /**
- * Sends all registrated {@link PlotListener PlotListeners}
- * the specified event.
- */
- protected void notifyListeners(PlotEvent event) {
- for (int i = 0, n = _plotListeners.size(); i < n; i++) {
- ((PlotListener) _plotListeners.elementAt(i)).plotChanged(event);
- }
- }
-
- /**
- * Connect the specified {@link DataPlot} with this instance.
- *
- * If this Plot instance is already connected with a
- * DataPlot the connection will be released and a
- * {@link PlotEvent} of the type {@link PlotEventType#DATA_PLOT_DISCONNECTED}
- * will be sent to all registrated {@link PlotListener PlotListeners}.
- *
- * It registers itself at dataPlot and
- * all its {@link DataCurve DataCurves}.
- *
- * Finally all curves will be generated and a PlotEvent
- * of the type {@link PlotEventType#DATA_PLOT_CONNECTED} will be transmitted.
- * @param dataPlot Data to be connected with this plot instance.
- * Can be null in order to disconnect this instance from
- * any DataPlot.
- */
- public void connect(DataPlot dataPlot) {
- if (_dataPlot != null) {
- _dataPlot.removeDataListener(this);
- notifyListeners(new PlotEvent(this, PlotEventType.DATA_PLOT_DISCONNECTED,
- _dataPlot));
- }
- _dataPlot = dataPlot;
- if (_dataPlot != null)
- {
- _dataPlot.addDataListener(this);
- generateCurves(_dataPlot);
- notifyListeners(new PlotEvent(this, PlotEventType.DATA_PLOT_CONNECTED,
- _dataPlot));
- }
- }
-
- /**
- * Transforms a point from device-independent coordinates into
- * data coordinates.
- * @param point Point in device-independent coordinates.
- * @return transform point.
- */
- public DataPoint transform(GraphPoint point) {
- return _transformation.transformToData(point);
- }
-
- /**
- * Creates a graphical representation of the complete plot.
- * @return GraphicalComposite containing the views of the
- * coordinate system, the curves, and optionally the legend (in this order).
- */
- public GraphicalComposite getCompletePlot() {
- GraphicalComposite result = new GraphicalComposite(null);
- result.addElement(_coordinateSystemView);
- GraphicalElement[] curves = getCurves();
- for (int i = 0; i < curves.length; i++) {
- result.addElement(curves[i]);
- }
- if (_annotation != null) {
- result.addElement(_annotation);
- }
- if (_legendVisibility) {
- result.addElement(getLegend());
- }
- return result;
- }
-
- /** Returns the view of the coordinate system. */
- public GraphicalElement getCoordinateSystem() {
- return _coordinateSystemView;
- }
-
- /** Returns the graphical representations of all curves. */
- public GraphicalElement[] getCurves() {
- synchronized (_curves) {
- GraphicalElement[] curves = new GraphicalElement[_curves.size()];
- for (int i = 0; i < curves.length; i++) {
- curves[i] = ((Curve) _curves.elementAt(i)).getView();
- }
- return curves;
- }
- }
-
- /**
- * Returns the annotation layer.
- * @return null if no annotation layer.
- */
- public GraphicalElement getAnnotation()
- {
- return _annotation;
- }
-
- /**
- * Sets the annotation layer.
- * @param annotation Any kind of graphics which will be drawn on the
- * top of the curves but may be covered by the legend.
- * Can be null.
- */
- public void setAnnotation(GraphicalElement annotation)
- {
- _annotation = annotation;
- }
-
- /** Returns true if the legend is visible. */
- public boolean isLegendVisible() {
- return _legendVisibility;
- }
-
- /** Returns the graphical representations of the legend. */
- public GraphicalElement getLegend() {
- return _legendView;
- }
-
- /**
- * Handles the received {@link DataEvent} and notifies
- * {@link PlotListener PlotListeners} by an event of the type
- * {@link PlotEventType#DATA_CURVE_CHANGED} or
- * {@link PlotEventType#DATA_PLOT_CHANGED}. The following table shows what
- * this method does:
- *
- * Source of event |
- * All hints for the next curve are null? |
- * Action | Type of sent {@link PlotEvent} |
- * {@link DataCurve} | Yes | Recreate changed curve. |
- * | DATA_CURVE_CHANGED |
- * {@link DataCurve} | No | Recreate changed curve
- * and all curves with large curve index. |
- * | DATA_PLOT_CHANGED |
- * {@link DataPlot} | - | Recreate all curves
- * and {@link Legend} view. |
- * | DATA_PLOT_CHANGED |
- *
- */
- public void dataChanged(DataEvent event) {
- Integer index = new Integer(0);
- PlotEventType type = PlotEventType.DATA_PLOT_CHANGED;
- synchronized (_curves) {
- int numberOfCurves = _curves.size();
- if (event.getContainer() instanceof DataCurve
- && numberOfCurves == _dataPlot.getNumberOfElements()) {
- DataCurve curve = (DataCurve) event.getContainer();
- index = new Integer(curve.getContainer().getIndexOf(curve));
- type = PlotEventType.DATA_CURVE_CHANGED;
- fillCurve(index.intValue(), curve);
- if (index.intValue() < numberOfCurves - 1) {
- Vector curveHints
- = (Vector) _nextCurveHints.elementAt(index.intValue());
- for (int i = 0, n = curveHints.size(); i < n; i++) {
- if (curveHints.elementAt(i) != null) {
- type = PlotEventType.DATA_PLOT_CHANGED;
- for (int j = index.intValue()+1; j < numberOfCurves; j++) {
- fillCurve(j, (DataCurve) _dataPlot.getElement(j));
- }
- break;
- }
- }
- }
- } else {
- generateCurves(_dataPlot);
- }
- }
- notifyListeners(new PlotEvent(Plot.this, type, index));
- }
-
- /**
- * Generates all curves based on the specified data.
- * In addition the legend view is created.
- */
- private void generateCurves(DataPlot dataPlot) {
- synchronized (_curves) {
- _legendView = new GraphicalComposite(null);
- _legendView.addElement(_legend.getBox());
- _curves.setSize(0);
- _nextCurveHints.setSize(0);
- for (int i = 0, n = dataPlot.getNumberOfElements(); i < n; i++) {
- Curve curve = _curveFactory.create(i, n, _clippingShape, _legend);
- _curves.addElement(curve);
- _nextCurveHints.addElement(new Vector());
- DataCurve dataCurve = (DataCurve) dataPlot.getElement(i);
- _legendView.addElement(curve.getLegendSymbol());
- _legendView.addElement(
- _legend.createCurveTitle(i, n, dataCurve.getTitle()));
- fillCurve(i, dataCurve);
- }
- }
- }
-
- private void fillCurve(int curveIndex, DataCurve dataCurve) {
- Vector curveHints = (Vector) _nextCurveHints.elementAt(curveIndex);
- Curve curve = (Curve) _curves.elementAt(curveIndex);
- curve.removeAllPoints();
- for (int i = 0, n = dataCurve.getNumberOfElements(); i < n; i++) {
- setHintForNextCurve(curveHints, i,
- curve.addPoint(_transformation.transformToGraph(
- (DataPoint) dataCurve.getElement(i)),
- getHintForNextCurve(curveIndex - 1, i)));
- }
- }
-
- private Hint getHintForNextCurve(int curveIndex, int pointIndex) {
- Hint result = _initialHintForNextCurve;
- if (curveIndex >= 0) {
- Vector curveHints = (Vector) _nextCurveHints.elementAt(curveIndex);
- result = pointIndex < curveHints.size() ?
- (Hint) curveHints.elementAt(pointIndex)
- : getHintForNextCurve(curveIndex - 1, pointIndex);
- }
- return result;
- }
-
- private void setHintForNextCurve(Vector curveHints, int pointIndex,
- Hint hint) {
- while (curveHints.size() <= pointIndex) {
- curveHints.addElement(_initialHintForNextCurve);
- }
- curveHints.setElementAt(hint, pointIndex);
- }
-}
diff --git a/src/jcckit/plot/PlotCanvas.java b/src/jcckit/plot/PlotCanvas.java
deleted file mode 100644
index 9c5480d5b..000000000
--- a/src/jcckit/plot/PlotCanvas.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import jcckit.data.DataPlot;
-import jcckit.graphic.Anchor;
-import jcckit.graphic.ClippingRectangle;
-import jcckit.util.ConfigParameters;
-
-/**
- * An abstract canvas containg a single {@link Plot}. The canvas is specified
- * by a {@link ClippingRectangle}, called paper. A horizontal and
- * vertical {@link Anchor} determine the position of the paper on the actual
- * device.
- *
- * @author Franz-Josef Elmer
- */
-public class PlotCanvas implements PlotListener {
- /** Configuration parameter key. */
- public static final String PAPER_KEY = "paper", HORIZONTAL_ANCHOR_KEY = "horizontalAnchor",
- VERTICAL_ANCHOR_KEY = "verticalAnchor", PLOT_KEY = "plot";
- private final ClippingRectangle _paper;
- private final Anchor _horizontalAnchor;
- private final Anchor _verticalAnchor;
- private final Plot _plot;
-
- /**
- * Creates an instance from the specified configuration parameters.
- *
- * Key & Default Value |
- * Type |
- * Mandatory |
- * Description |
- *
- *
- * horizontalAnchor = center |
- * String |
- * no |
- * Horizontal position of the paper relative to the device border.
- * Possible values are left, center, and
- * right. |
- *
- *
- * paper = 0, 0, 1, 0.6 |
- * double[] |
- * no |
- * Rectangle defining the paper. The first two values determine the x-
- * and y- coordinates (in device-independent units) of the lower-left
- * corner. The last two values determine the upper-right corner. |
- *
- *
- * plot = default values of {@link Plot} |
- * ConfigParameters |
- * no |
- * Definition of the {@link Plot}. |
- *
- *
- * verticalAnchor = center |
- * String |
- * no |
- * Vertical position of the paper relative to the device border.
- * Possible values are top, center, and
- * bottom. |
- *
- *
- *
- * Note, that this instance registers itself at the wrapped {@link Plot}
- * instance.
- */
- public PlotCanvas(ConfigParameters config) {
- double[] paper = config.getDoubleArray(PAPER_KEY, new double[] { 0, 0, 1, 0.6 });
- _paper = new ClippingRectangle(paper[0], paper[1], paper[2], paper[3]);
- _horizontalAnchor = Anchor.getHorizontalAnchor(config, HORIZONTAL_ANCHOR_KEY, Anchor.CENTER);
- _verticalAnchor = Anchor.getVerticalAnchor(config, VERTICAL_ANCHOR_KEY, Anchor.CENTER);
- _plot = new Plot(config.getNode(PLOT_KEY));
- _plot.addPlotListener(this);
- }
-
- /** Returns the paper definition. */
- public ClippingRectangle getPaper() {
- return _paper;
- }
-
- /** Returns the horizontal anchor. */
- public Anchor getHorizontalAnchor() {
- return _horizontalAnchor;
- }
-
- /** Returns the vertical anchor. */
- public Anchor getVerticalAnchor() {
- return _verticalAnchor;
- }
-
- /** Returns the plot. */
- public Plot getPlot() {
- return _plot;
- }
-
- /**
- * Connects the wrapped {@link Plot} instance with the specified
- * {@link DataPlot}.
- *
- * @param dataPlot
- * Data to be connected with this plot canvas. Can be
- * null in order to disconnect this instance from a
- * DataPlot.
- */
- public void connect(DataPlot dataPlot) {
- _plot.connect(dataPlot);
- }
-
- /**
- * Handles the spcified event. Here nothing is done. But subclass may
- * override this method.
- */
- public void plotChanged(PlotEvent event) {
- }
-}
diff --git a/src/jcckit/plot/PlotEvent.java b/src/jcckit/plot/PlotEvent.java
deleted file mode 100644
index b1fecc382..000000000
--- a/src/jcckit/plot/PlotEvent.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-/**
- * A plot event signales some changes of a {@link Plot}.
- * It has three attributes:
- *
- source: Indicates the Plot instance responsible
- * for this event.
- *
- type: The type of event.
- *
- message: The message object. Its meaning depends on the
- * type of event:
- *
- * Type | Meaning of the message object |
- * {@link PlotEventType#DATA_PLOT_CONNECTED},
- * {@link PlotEventType#DATA_PLOT_DISCONNECTED} |
- * The {@link jcckit.data.DataPlot} (dis)connected with the
- * {@link Plot} instance specified by the source. |
- *
{@link PlotEventType#DATA_PLOT_CHANGED} |
- * An Integer indicating the lowest index of
- * those curves which have been changed. |
- *
{@link PlotEventType#DATA_CURVE_CHANGED} |
- * An Integer indicating the index of the curve
- * which has been changed. |
- *
- *
- *
- *
- * @author Franz-Josef Elmer
- */
-public class PlotEvent {
- private final Plot _source;
- private final PlotEventType _type;
- private final Object _message;
-
- /**
- * Creates a new event for the specified source, type, and message.
- * @param source Plot causing this event.
- * @param type Type of the event. Possible values are
- * {@link PlotEventType#DATA_PLOT_CHANGED},
- * {@link PlotEventType#DATA_CURVE_CHANGED},
- * {@link PlotEventType#DATA_PLOT_CONNECTED}, and
- * {@link PlotEventType#DATA_PLOT_DISCONNECTED}.
- * @param message Message object. Can be null
- */
- public PlotEvent(Plot source, PlotEventType type, Object message) {
- _source = source;
- _type = type;
- _message = message;
- }
-
- /** Returns the source of this event. */
- public Plot getSource() {
- return _source;
- }
-
- /**
- * Returns the event type.
- * @return either {@link PlotEventType#DATA_PLOT_CHANGED},
- * {@link PlotEventType#DATA_CURVE_CHANGED},
- * {@link PlotEventType#DATA_PLOT_CONNECTED}, or
- * {@link PlotEventType#DATA_PLOT_DISCONNECTED}.
- */
- public PlotEventType getType() {
- return _type;
- }
-
- /** Returns the message object. */
- public Object getMessage() {
- return _message;
- }
-}
diff --git a/src/jcckit/plot/PlotEventType.java b/src/jcckit/plot/PlotEventType.java
deleted file mode 100644
index 24a2a3cfc..000000000
--- a/src/jcckit/plot/PlotEventType.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-/**
- * Types of {@link PlotEvent PlotEvents}. Using the typesafe enumeration
- * pattern.
- *
- * @author Franz-Josef Elmer
- */
-public class PlotEventType {
- /** Event type. */
- public static final PlotEventType DATA_PLOT_CONNECTED = new PlotEventType(),
- DATA_PLOT_DISCONNECTED = new PlotEventType(),
- COODINATE_SYSTEM_CHANGED = new PlotEventType(),
- DATA_CURVE_CHANGED = new PlotEventType(),
- DATA_PLOT_CHANGED = new PlotEventType();
-
- private PlotEventType() {}
-}
diff --git a/src/jcckit/plot/PlotListener.java b/src/jcckit/plot/PlotListener.java
deleted file mode 100644
index ed37113f8..000000000
--- a/src/jcckit/plot/PlotListener.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-/**
- * Listener for changes of plots, diagrams, and charts.
- *
- * @author Franz-Josef Elmer
- */
-public interface PlotListener {
- /** Receives the specified plot event.*/
- public void plotChanged(PlotEvent event);
-}
diff --git a/src/jcckit/plot/PositionHint.java b/src/jcckit/plot/PositionHint.java
deleted file mode 100644
index d068e2970..000000000
--- a/src/jcckit/plot/PositionHint.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import jcckit.graphic.GraphPoint;
-import jcckit.util.ConfigParameters;
-
-/**
- * An immutable {@link Hint} capsulating two {@link GraphPoint GraphPoints}.
- *
- * @author Franz-Josef Elmer
- */
-public class PositionHint implements Hint {
- /** Configuration parameter key. */
- public static final String POSITION_KEY = "position",
- ORIGIN_KEY = "origin";
- private final GraphPoint _position;
- private final GraphPoint _origin;
-
- /**
- * Creates an instance from the specified configuration parameters.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * position = null |
- * double[] | no |
- * Definition of position. |
- * origin = position or (0,0) if position
- * undefined |
- * double[] | no |
- * Definition of origin. |
- *
- */
- public PositionHint(ConfigParameters config) {
- double[] point = config.getDoubleArray(POSITION_KEY, null);
- _position = point == null ? null : new GraphPoint(point);
- _origin = new GraphPoint(config.getDoubleArray(ORIGIN_KEY, point));
- }
-
- /**
- * Creates an instance based on two points.
- * @param origin The origin.
- * @param position The position.
- */
- public PositionHint(GraphPoint origin, GraphPoint position) {
- _origin = origin;
- _position = position;
- }
-
- /** Returns the position. */
- public GraphPoint getPosition() {
- return _position;
- }
-
- /** Returns the origin. */
- public GraphPoint getOrigin() {
- return _origin;
- }
-}
diff --git a/src/jcckit/plot/ShapeAttributesHint.java b/src/jcckit/plot/ShapeAttributesHint.java
deleted file mode 100644
index 4c71835af..000000000
--- a/src/jcckit/plot/ShapeAttributesHint.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import java.awt.Color;
-
-import jcckit.graphic.GraphicAttributes;
-import jcckit.graphic.ShapeAttributes;
-import jcckit.util.ConfigParameters;
-
-/**
- * An {@link AttributesHint} which wraps {@link ShapeAttributes}.
- * Each call of {@link #getNextHint()} returns a new instance of
- * ShapeAttributes where fill color, line color and/or
- * line thickness has been increased by a constant amount.
- *
- * @author Franz-Josef Elmer
- */
-public class ShapeAttributesHint implements AttributesHint, Cloneable {
- /** Configuration parameter key. */
- public static final String INITIAL_ATTRIBUTES_KEY = "initialAttributes",
- FILL_COLOR_HSB_INCREMENT_KEY
- = "fillColorHSBIncrement",
- LINE_COLOR_HSB_INCREMENT_KEY
- = "lineColorHSBIncrement",
- LINE_THICKNESS_INCREMENT_KEY
- = "lineThicknessIncrement";
- private static float[] extractHSB(Color color) {
- return color == null ? null
- : Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(),
- null);
- }
-
- private static Color createColor(float[] colorHSB) {
- return colorHSB == null ? null
- : Color.getHSBColor(colorHSB[0], colorHSB[1], colorHSB[2]);
- }
-
- private static float[] incrementColor(float[] colorHSB,
- double[] increments) {
- float[] result = null;
- if (colorHSB != null) {
- result = (float[]) colorHSB.clone();
- for (int i = 0; i < 3; i++) {
- result[i] += increments[i];
- }
- }
- return result;
- }
-
- private float[] _fillColorHSB;
- private float[] _lineColorHSB;
- private double _lineThickness;
- private double[] _linePattern;
- private double[] _fillColorHSBIncrement;
- private double[] _lineColorHSBIncrement;
- private double _lineThicknessIncrement;
-
- /**
- * Creates an instance from the specified configuration parameters.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * initialAttributes = default values of
- * {@link ShapeAttributes} |
- * ConfigParameters | no |
- * Initial values of shape attributes. Note, that default
- * fill and line colors are undefined (they depend on the
- * Renderer). In this case color increments have no effects.
- * |
- * fillColorHSBIncrement = 0 0 0 |
- * double[] | no |
- * Hue, saturation, and brightness increments of the fill color.
- * |
- * lineColorHSBIncrement = 0 0 0 |
- * double[] | no |
- * Hue, saturation, and brightness increments of the line color.
- * |
- * lineThicknessIncrement = 0 |
- * double | no |
- * Line thickness increment. |
- *
- */
- public ShapeAttributesHint(ConfigParameters config) {
- ShapeAttributes attributes
- = new ShapeAttributes(config.getNode(INITIAL_ATTRIBUTES_KEY));
- _fillColorHSB = extractHSB(attributes.getFillColor());
- _lineColorHSB = extractHSB(attributes.getLineColor());
- _lineThickness = attributes.getLineThickness();
- _linePattern = attributes.getLinePattern();
-
- _fillColorHSBIncrement
- = config.getDoubleArray(FILL_COLOR_HSB_INCREMENT_KEY, new double[3]);
- _lineColorHSBIncrement
- = config.getDoubleArray(LINE_COLOR_HSB_INCREMENT_KEY, new double[3]);
- _lineThicknessIncrement
- = config.getDouble(LINE_THICKNESS_INCREMENT_KEY, 0);
- }
-
- /**
- * Creates a new ShapeAttributesHint where all attributes has been
- * incremented.
- */
- public AttributesHint getNextHint() {
- ShapeAttributesHint nextHint = null;
- try {
- nextHint = (ShapeAttributesHint) clone();
- } catch (CloneNotSupportedException e) {}
- nextHint._fillColorHSB
- = incrementColor(_fillColorHSB, _fillColorHSBIncrement);
- nextHint._lineColorHSB
- = incrementColor(_lineColorHSB, _lineColorHSBIncrement);
- nextHint._lineThickness
- = Math.max(0, _lineThickness + _lineThicknessIncrement);
- return nextHint;
- }
-
- /** Returns the wrapped {@link ShapeAttributes} instance. */
- public GraphicAttributes getAttributes() {
- return new ShapeAttributes(createColor(_fillColorHSB),
- createColor(_lineColorHSB),
- _lineThickness, _linePattern);
- }
-}
diff --git a/src/jcckit/plot/SimpleCurve.java b/src/jcckit/plot/SimpleCurve.java
deleted file mode 100644
index 7477d2c24..000000000
--- a/src/jcckit/plot/SimpleCurve.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import java.awt.Color;
-
-import jcckit.graphic.ClippingShape;
-import jcckit.graphic.GraphPoint;
-import jcckit.graphic.GraphicalComposite;
-import jcckit.graphic.GraphicalElement;
-import jcckit.graphic.LineAttributes;
-import jcckit.graphic.Polygon;
-import jcckit.graphic.ShapeAttributes;
-import jcckit.util.ConfigParameters;
-import jcckit.util.Factory;
-
-/**
- * A simple curve is the basic implementation of the {@link Curve} interface.
- *
- * @author Franz-Josef Elmer
- */
-public class SimpleCurve implements Curve {
- /** Configuration parameter key. */
- public static final String SYMBOL_FACTORY_KEY = "symbolFactory",
- WITH_LINE_KEY = "withLine",
- SOFT_CLIPPING_KEY = "softClipping",
- LINE_ATTRIBUTES_KEY = "lineAttributes",
- INITIAL_HINT_FOR_NEXT_POINT_KEY
- = "initialHintForNextPoint";
- private final ClippingShape _clippingShape;
- private final SymbolFactory _symbolFactory;
- private final GraphicalComposite _symbols;
- private final GraphicalComposite _completeCurve;
- private final GraphicalElement _legendSymbol;
- private final Hint _initialHintForNextPoint;
- private final Polygon _curve;
- private final boolean _softClipping;
- private Hint _hintForNextPoint;
-
- /**
- * Creates a new curve. The parameter config contains:
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * initialHintForNextPoint = null |
- * ConfigParameters | no |
- * Definition of an initial {@link Hint} for the first curve point.
- * |
- * lineAttributes = a {@link ShapeAttributes}
- * instances with default values and line colors based on
- * the formula Color.getHSBColor(curveIndex/6,1,0.8) |
- * ConfigParameters | no |
- * Configuration parameters of an instances of
- * {@link jcckit.graphic.GraphicAttributes} for the
- * {@link Polygon Polygons} connecting curve points. |
- * symbolFactory = null |
- * ConfigParameters | no |
- * Configuration parameters defining an instances of
- * {@link SymbolFactory} for the {@link Symbol Symbols}
- * decorating curve points. |
- * softClipping = true |
- * boolean | no |
- * If true no explicit clipping takes
- * place but the symbol is not drawn if the corresponding curve
- * point is outside the axis box.
- * If false the symbol is
- * drawn in any case but it may be clipped by the axis box.
- * Soft-clipping should be set to false if the
- * symbols are not located around the curve point (like for bars).
- * |
- * withLine = true |
- * boolean | no |
- * If true curve points are connected by a
- * {@link jcckit.graphic.Polygon}. |
- *
- * @param config Configuration parameters described above.
- * @param curveIndex Index of this curve in the collection of curves
- * defining a {@link Plot}.
- * @param numberOfCurves Number of curves in this collection.
- * @param clippingShape Clipping shape. Can be null.
- * @param legend Legend. Will be used to calculate the legend symbol.
- * @throws IllegalArgumentException if symbolFactory == null and
- * withLine == false.
- *
- */
- public SimpleCurve(ConfigParameters config, int curveIndex,
- int numberOfCurves, ClippingShape clippingShape,
- Legend legend) {
- _symbolFactory = (SymbolFactory) Factory.createOrGet(
- config.getNode(SYMBOL_FACTORY_KEY), null);
- boolean withLine = config.getBoolean(WITH_LINE_KEY, true);
- LineAttributes lineAttributes = (LineAttributes) Factory.createOrGet(
- config.getNode(LINE_ATTRIBUTES_KEY),
- new ShapeAttributes(null, Color.getHSBColor((curveIndex % 6) / 6f,
- 1f, 0.8f),
- 0, null));
- if (_symbolFactory != null || withLine) {
- _clippingShape = clippingShape;
- _completeCurve = new GraphicalComposite(null);
- if (withLine) {
- GraphicalComposite container = new GraphicalComposite(clippingShape);
- _curve = new Polygon(lineAttributes, false);
- container.addElement(_curve);
- _completeCurve.addElement(container);
- } else {
- _curve = null;
- }
- _softClipping = config.getBoolean(SOFT_CLIPPING_KEY, true);
- if (_symbolFactory != null) {
- _symbols = new GraphicalComposite(_softClipping ? null
- : clippingShape);
- _completeCurve.addElement(_symbols);
- } else {
- _symbols = null;
- }
- } else {
- throw new IllegalArgumentException(
- "Either a SymbolFactory must exist or withLines == true.");
- }
- _hintForNextPoint = _initialHintForNextPoint
- = (Hint) Factory.createOrGet(
- config.getNode(INITIAL_HINT_FOR_NEXT_POINT_KEY), null);
- _legendSymbol = legend.createSymbol(curveIndex, numberOfCurves,
- _symbolFactory, withLine,
- lineAttributes);
- }
-
- /**
- * Returns the graphical representation of a curve.
- * @return always the same instance.
- */
- public GraphicalElement getView() {
- return _completeCurve;
- }
-
- /** Returns the legend symbol. */
- public GraphicalElement getLegendSymbol() {
- return _legendSymbol;
- }
-
- /** Appends a new point to the curve if inside the clipping shape. */
- public Hint addPoint(GraphPoint point, Hint hintFromPreviousCurve) {
- if (_curve != null) {
- _curve.addPoint(point);
- }
- Hint hintForNextCurve = hintFromPreviousCurve;
- if (_symbolFactory != null) {
- Symbol symbol = _symbolFactory.createSymbol(point, _hintForNextPoint,
- hintFromPreviousCurve);
- if (_clippingShape == null || !_softClipping
- || _clippingShape.isInside(point)) {
- _symbols.addElement(symbol.getSymbol());
- }
- _hintForNextPoint = symbol.getHintForNextPoint();
- hintForNextCurve = symbol.getHintForNextCurve();
- }
- return hintForNextCurve;
- }
-
- public void removeAllPoints() {
- if (_curve != null) {
- _curve.removeAllPoints();
- }
- if (_symbols != null) {
- _symbols.removeAllElements();
- }
- _hintForNextPoint = _initialHintForNextPoint;
- }
-}
diff --git a/src/jcckit/plot/SimpleCurveFactory.java b/src/jcckit/plot/SimpleCurveFactory.java
deleted file mode 100644
index 4d7b2bc02..000000000
--- a/src/jcckit/plot/SimpleCurveFactory.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import jcckit.graphic.ClippingShape;
-import jcckit.util.ConfigParameters;
-import jcckit.util.PropertiesBasedConfigData;
-
-/**
- * Factory for {@link SimpleCurve SimpleCurves}.
- *
- * @author Franz-Josef Elmer
- */
-public class SimpleCurveFactory implements CurveFactory {
- /** Configuration parameter key. */
- public static final String DEFINITIONS_KEY = "definitions";
-
- private ConfigParameters[] _configs = new ConfigParameters[]
- {new ConfigParameters(new PropertiesBasedConfigData(new Properties()))};
-
- /**
- * Creates an instance from the specified configuration parameter.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * definitions = one empty ConfigParameters
- * instance |
- * String[] | no |
- * Keys of subtrees defining {@link ConfigParameters}
- * used by the {@link SimpleCurve#SimpleCurve constructor} of
- * {@link SimpleCurve}. |
- *
- */
- public SimpleCurveFactory(ConfigParameters config) {
- String value = config.get(DEFINITIONS_KEY, null);
- if (value != null) {
- StringTokenizer tokenizer = new StringTokenizer(value);
- _configs = new ConfigParameters[tokenizer.countTokens()];
- for (int i = 0; i < _configs.length; i++) {
- _configs[i] = config.getNode(tokenizer.nextToken());
- }
- }
- }
-
- /**
- * Creates an instance of {@link SimpleCurve}.
- * @param curveIndex Index of the curve. Will be used to select the
- * {@link ConfigParameters} object and the line attributes.
- * In addition it will be used to calculate the y-coordinate
- * of the legend symbol.
- * @param numberOfCurves Number of curves. Will be needed to calculate
- * the y-coordinate of the legend symbol.
- * @param clippingShape The clipping shape.
- * @param legend The legend. Will be needed to create the legend symbol.
- */
- public Curve create(int curveIndex, int numberOfCurves,
- ClippingShape clippingShape, Legend legend) {
- return new SimpleCurve(_configs[curveIndex % _configs.length], curveIndex,
- numberOfCurves, clippingShape, legend);
- }
-}
diff --git a/src/jcckit/plot/SquareSymbolFactory.java b/src/jcckit/plot/SquareSymbolFactory.java
deleted file mode 100644
index 4dc377268..000000000
--- a/src/jcckit/plot/SquareSymbolFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import jcckit.graphic.GraphPoint;
-import jcckit.graphic.GraphicAttributes;
-import jcckit.graphic.GraphicalElement;
-import jcckit.graphic.Rectangle;
-import jcckit.util.ConfigParameters;
-
-/**
- * A factory of square symbols.
- *
- * @author Franz-Josef Elmer
- */
-public class SquareSymbolFactory extends AbstractSymbolFactory {
- /**
- * Creates an instance from the specified configuration parameters.
- * For the configuration parameters see the
- *
- * constructor of the superclass {@link AbstractSymbolFactory}.
- */
- public SquareSymbolFactory(ConfigParameters config) {
- super(config);
- }
-
- /**
- * Creates a {@link Rectangle}.
- * @param centerPosition Position of the center of the rectangle.
- * @param size Diameter of the rectangle.
- * @param attributes Rectangle attributes.
- */
- protected GraphicalElement createPlainSymbol(GraphPoint centerPosition,
- double size,
- GraphicAttributes attributes) {
- return new Rectangle(centerPosition, size, size, attributes);
- }
-}
diff --git a/src/jcckit/plot/Symbol.java b/src/jcckit/plot/Symbol.java
deleted file mode 100644
index 69a2aa5db..000000000
--- a/src/jcckit/plot/Symbol.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import jcckit.graphic.GraphicalElement;
-
-/**
- * Immutable class holding the graphical represention of the symbol and
- * two {@link Hint Hints}.
- *
- * @author Franz-Josef Elmer
- */
-public class Symbol {
- private final GraphicalElement _symbol;
- private final Hint _hintForNextPoint;
- private final Hint _hintForNextCurve;
-
- /** Creates an instance for the specified symbol and hints. */
- public Symbol(GraphicalElement symbol, Hint hintForNextPoint,
- Hint hintForNextCurve) {
- _symbol = symbol;
- _hintForNextPoint = hintForNextPoint;
- _hintForNextCurve = hintForNextCurve;
- }
-
- /** Returns the graphical symbol. */
- public GraphicalElement getSymbol() {
- return _symbol;
- }
-
- /** Returns the hint for the next point. */
- public Hint getHintForNextPoint() {
- return _hintForNextPoint;
- }
-
- /** Returns the hint for the next curve. */
- public Hint getHintForNextCurve() {
- return _hintForNextCurve;
- }
-}
diff --git a/src/jcckit/plot/SymbolFactory.java b/src/jcckit/plot/SymbolFactory.java
deleted file mode 100644
index d354bc095..000000000
--- a/src/jcckit/plot/SymbolFactory.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import jcckit.graphic.GraphPoint;
-import jcckit.graphic.GraphicalElement;
-
-/**
- * Interface of a symbol factory. A symbol is a {@link GraphicalElement}
- * or {@link jcckit.graphic.GraphicalComposite}. A symbol factory creates
- * the same type of symbols. In general, they have all the same size.
- * But they are distinguished from each other by their positions.
- * In addition they may also differ in other properties which will
- * be determined by {@link Hint Hints}.
- *
- * @author Franz-Josef Elmer
- */
-public interface SymbolFactory {
- /** Common configuration parameter key need by implementing classes. */
- public static final String SIZE_KEY = "size",
- ATTRIBUTES_KEY = "attributes";
-
- /** Default size of a symbol = 0.01. */
- public static final double DEFAULT_SIZE = 0.01;
-
- /**
- * Creates a symbol for the specified point taking into account
- * the specified hints.
- * @param point The position of the symbol. In general it is a transformation
- * of a corresponding {@link jcckit.data.DataPoint} into a
- * {@link GraphPoint}.
- * @param hintFromPreviousPoint Hint from the previous point of the same
- * {@link Curve} or null.
- * @param hintFromPreviousCurve Hint from the previous
- * {@link Curve} or null.
- */
- public Symbol createSymbol(GraphPoint point, Hint hintFromPreviousPoint,
- Hint hintFromPreviousCurve);
-
- /**
- * Creates a symbol for the legend at the specified position.
- * @param centerPosition Center position of the symbol.
- * @param size The size of the symbol. Will not be used if the symbol
- * of the curve points have all the same size. In this case
- * the symbol for the legend has the size of the curve symbols.
- */
- public GraphicalElement createLegendSymbol(GraphPoint centerPosition,
- double size);
-}
diff --git a/src/jcckit/plot/TicLabelMap.java b/src/jcckit/plot/TicLabelMap.java
deleted file mode 100644
index d2989e481..000000000
--- a/src/jcckit/plot/TicLabelMap.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.plot;
-
-import java.util.StringTokenizer;
-
-import jcckit.util.ConfigParameters;
-import jcckit.util.TicLabelFormat;
-
-/**
- * Map of number intervals onto a text label. The map is defined by a
- * map description string provided by configuration data.
- *
- * The map description is a list
- * of conditions separated by ';'. The conditions are tested from left to
- * right until a condition is fulfilled for the tic value. If no condition
- * is fullfilled a '?' will be returned.
- *
- * A condition description has one of the following forms:
- *
<label>
- * <number>=<label>
- * <number1>:<number2>=<label>
- *
- * The first type of condition is always fulfilled. It will return
- * <label>. This is a kind of else condtion
- * which is put at the end of the condition list.
- *
- * The second form maps a particular number onto a label. In order to be
- * equal with the sepcified number the tic value should not deviate more
- * than 1 ppm (part per millions) from <number>.
- *
- * The third form maps an interval onto a label. The condition reads
- *
- * <number1> <= tic label < <number2>
- *
- * Examples:
- *
- * 1=monday;2=tuesday;3=wednesday;4=thursday;5=friday;6=saturday;7=sunday
- * 0.5:1.5=I; 1.5:2.5 = II; 2.5:3.5 = III; the rest
- *
- *
- * @author Franz-Josef Elmer
- */
-public class TicLabelMap implements TicLabelFormat {
- public static final String MAP_KEY = "map";
-
- private static class MapItem {
- private double _min = Double.MIN_VALUE;
- private double _max = Double.MAX_VALUE;
- private final String label;
- public MapItem(String item) {
- int index = item.indexOf('=');
- if (index < 0) {
- label = item;
- } else {
- label = item.substring(index + 1).trim();
- item = item.substring(0, index).trim();
- index = item.indexOf(':');
- if (index < 0) {
- _min = new Double(item).doubleValue();
- _max = _min == 0 ? Double.MIN_VALUE : _min * 1.000001d;
- _min = _min * 0.999999d;
- if (_min > _max) {
- double z = _min;
- _min = _max;
- _max = z;
- }
- } else {
- _min = new Double(item.substring(0, index)).doubleValue();
- _max = new Double(item.substring(index + 1)).doubleValue();
- }
- }
- }
- public boolean isInside(double value) {
- return value >= _min && value < _max;
- }
- }
-
- private final MapItem[] _map;
-
- /**
- * Creates an instance from the specified configuration parameters.
- *
- * Key & Default Value | Type | Mandatory |
- * Description |
- * map |
- * String | yes |
- * Map description as explained above. |
- *
- */
- public TicLabelMap(ConfigParameters config) {
- StringTokenizer tokenizer = new StringTokenizer(config.get(MAP_KEY), ";");
- _map = new MapItem[tokenizer.countTokens()];
- for (int i = 0; i < _map.length; i++)
- {
- String item = tokenizer.nextToken();
- try {
- _map[i] = new MapItem(item.trim());
- } catch (NumberFormatException e) {
- throw new NumberFormatException("Item '" + item + "' of "
- + config.getFullKey(MAP_KEY) + " has an invalid number.");
- }
- }
- }
-
- /**
- * Maps the specified tic value onto a text label in accordance
- * with the map description.
- */
- public String form(double ticValue) {
- String result = "?";
- for (int i = 0; i < _map.length; i++) {
- if (_map[i].isInside(ticValue)) {
- result = _map[i].label;
- break;
- }
- }
- return result;
- }
-}
diff --git a/src/jcckit/renderer/Graphics2DRenderer.java b/src/jcckit/renderer/Graphics2DRenderer.java
deleted file mode 100644
index 9b229ebf9..000000000
--- a/src/jcckit/renderer/Graphics2DRenderer.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.renderer;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.Graphics2D;
-import java.awt.Shape;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.Ellipse2D;
-import java.awt.geom.GeneralPath;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-
-import jcckit.graphic.BasicGraphicalElement;
-import jcckit.graphic.ClippingRectangle;
-import jcckit.graphic.ClippingShape;
-import jcckit.graphic.FillAttributes;
-import jcckit.graphic.FontStyle;
-import jcckit.graphic.GraphPoint;
-import jcckit.graphic.GraphicAttributes;
-import jcckit.graphic.GraphicalComposite;
-import jcckit.graphic.GraphicalCompositeRenderer;
-import jcckit.graphic.LineAttributes;
-import jcckit.graphic.Oval;
-import jcckit.graphic.OvalRenderer;
-import jcckit.graphic.Polygon;
-import jcckit.graphic.PolygonRenderer;
-import jcckit.graphic.Rectangle;
-import jcckit.graphic.RectangleRenderer;
-import jcckit.graphic.Text;
-import jcckit.graphic.TextAttributes;
-import jcckit.graphic.TextRenderer;
-
-/**
- * Renderer who draws the {@link jcckit.graphic.GraphicalElement
- * GraphicalElements} into a java.awt.Graphics2D context.
- *
- * The default color for lines and texts is determined by the current color of
- * the Graphics2D context when a new instance of
- * Graphics2DRenderer is created.
- *
- * The default font is SansSerif-12.
- *
- * @author Franz-Josef Elmer
- */
-public class Graphics2DRenderer implements GraphicalCompositeRenderer, PolygonRenderer, OvalRenderer, TextRenderer,
- RectangleRenderer {
- private static final int FS = 1;
- private static final String DEFAULT_FONT_NAME = "SansSerif";
- private static final FontStyle DEFAULT_FONT_STYLE = FontStyle.NORMAL;
- private static final int DEFAULT_FONT_SIZE = 12;
-
- private Color _defaultColor;
- private Graphics2D _graphics;
-
- /**
- * Initializes this instance. During renderering the current transformation
- * will be leaved unchanged. But the current Clip may be cleared.
- *
- * @param graphics
- * Graphics2D context into which the
- * {@link BasicGraphicalElement BaiscGraphicalElements} are
- * painted.
- * @return this instance.
- */
- public Graphics2DRenderer init(Graphics2D graphics) {
- _graphics = graphics;
- _defaultColor = graphics.getColor(); // the foreground color
- return this;
- }
-
- /**
- * Starts rendering of the specified composite. Does nothing except if
- * composite has a {@link ClippingShape}. In this case the Clip
- * of the Graphics2D context becomes the clipping rectangle
- * determined by the bounding box of the ClippingShape.
- */
- public void startRendering(GraphicalComposite composite) {
- ClippingShape shape = composite.getClippingShape();
- if (shape != null) {
- ClippingRectangle rect = shape.getBoundingBox();
- _graphics.clip(new Rectangle2D.Double(rect.getMinX(), rect.getMinY(), rect.getMaxX() - rect.getMinX(), rect
- .getMaxY()
- - rect.getMinY()));
- }
- }
-
- /**
- * Finishes rendering of the specified composite. Does nothing except if
- * composite has a {@link ClippingShape}. In this case the Clip
- * of the Graphics2D context will be cleared.
- */
- public void finishRendering(GraphicalComposite composite) {
- _graphics.setClip(null);
- }
-
- /** Paints the specified polygon into the Graphics2D context. */
- public void render(Polygon polygon) {
- int numberOfPoints = polygon.getNumberOfPoints();
- if (numberOfPoints > 0) {
- Color currentColor = _graphics.getColor();
- GeneralPath p = new GeneralPath(GeneralPath.WIND_EVEN_ODD, numberOfPoints);
- p.moveTo((float) polygon.getPoint(0).getX(), (float) polygon.getPoint(0).getY());
- for (int i = 1; i < numberOfPoints; i++) {
- p.lineTo((float) polygon.getPoint(i).getX(), (float) polygon.getPoint(i).getY());
- }
- if (polygon.isClosed()) {
- p.closePath();
- }
- drawShape(p, polygon, currentColor);
- }
- }
-
- /**
- * Paints the specified rectangle into the current Graphics
- * context.
- */
- public void render(Rectangle rectangle) {
- Color currentColor = _graphics.getColor();
- GraphPoint center = rectangle.getCenter();
- double width = rectangle.getWidth();
- double height = rectangle.getHeight();
- Rectangle2D rect = new Rectangle2D.Double(center.getX() - 0.5 * width, center.getY() - 0.5 * height, width,
- height);
- drawShape(rect, rectangle, currentColor);
- }
-
- /**
- * Paints the specified oval into the current Graphics context.
- */
- public void render(Oval oval) {
- Color currentColor = _graphics.getColor();
- GraphPoint center = oval.getCenter();
- double width = oval.getWidth();
- double height = oval.getHeight();
- Ellipse2D ellipse = new Ellipse2D.Double(center.getX() - 0.5 * width, center.getY() - 0.5 * height, width,
- height);
- drawShape(ellipse, oval, currentColor);
- }
-
- private void drawShape(Shape shape, BasicGraphicalElement element, Color backupColor) {
- GraphicAttributes attributes = element.getGraphicAttributes();
- Color fillColor = null;
- if (element.isClosed() && attributes instanceof FillAttributes) {
- fillColor = ((FillAttributes) attributes).getFillColor();
- }
- if (fillColor != null) {
- _graphics.setColor(fillColor);
- _graphics.fill(shape);
- }
- Color lineColor = _defaultColor;
- if (attributes instanceof LineAttributes) {
- LineAttributes la = (LineAttributes) attributes;
- BasicStroke stroke = new BasicStroke((float) la.getLineThickness());
- double[] linePattern = la.getLinePattern();
- if (linePattern != null) {
- float[] dash = new float[linePattern.length];
- for (int i = 0; i < dash.length; i++) {
- dash[i] = (float) la.getLinePattern()[i];
- }
- stroke = new BasicStroke(stroke.getLineWidth(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10f,
- dash, 0f);
- }
- _graphics.setStroke(stroke);
- if (la.getLineColor() != null || fillColor != null) {
- lineColor = la.getLineColor();
- }
- }
- if (lineColor != null) {
- _graphics.setColor(lineColor);
- _graphics.draw(shape);
- }
- _graphics.setColor(backupColor);
- }
-
- /**
- * Paints the specified text into the current Graphics context.
- *
- * If the font size is zero the default font size will be used.
- *
- * If the orientation angle is unequal zero the text will first be painted
- * into an off-screen image and rotated. Finally, it will be drawn into the
- * current Graphics context. Note, that only integer multiples of
- * 90 degree rotation are performed. Other orientation angles will be
- * adjusted to the nearest integer multiple of 90 degree.
- */
- public void render(Text text) {
- final GraphicAttributes ga = text.getGraphicAttributes();
- if (ga instanceof TextAttributes) {
- final TextAttributes ta = (TextAttributes) ga;
- final Color currentColor = _graphics.getColor();
- Color fontColor = ta.getTextColor();
- if (fontColor == null) {
- fontColor = _defaultColor;
- }
- _graphics.setColor(fontColor);
-
- final double scale = _graphics.getTransform().getScaleX();
- final String str = text.getText();
-
- AffineTransform before = _graphics.getTransform();
- _graphics.setTransform(new AffineTransform());
-
- double fs = ta.getFontSize();
- fs = fs == 0 ? 1 : fs * scale / DEFAULT_FONT_SIZE;
-
- Font font = createFont(ta, 0);
-
- AffineTransform fontTransform = new AffineTransform();
- fontTransform.scale(fs, fs);
- fontTransform.rotate(-ta.getOrientationAngle() * Math.PI / 180);
- font = font.deriveFont(fontTransform);
- _graphics.setFont(font);
- Rectangle2D bounds = _graphics.getFontMetrics().getStringBounds(str, _graphics);
-
- fontTransform.rotate(-ta.getOrientationAngle() * Math.PI / 180);
-
- final double yy = bounds.getHeight() + bounds.getY();
-
- Point2D.Double pos = new Point2D.Double(text.getPosition().getX(), text.getPosition().getY());
- before.transform(pos, pos);
-
- double x = 0;
- double y = 0;
- if (ta.getOrientationAngle() == 0) {
- x = -0.5 * ta.getHorizontalAnchor().getFactor() * bounds.getWidth();
- y = 0.5 * ta.getVerticalAnchor().getFactor() * bounds.getHeight() - yy;
- x = pos.x + x;
- y = pos.y + y;
- } else {
- x = 0.5 * ta.getVerticalAnchor().getFactor() * bounds.getHeight();
- y = 0.5 * ta.getHorizontalAnchor().getFactor() * bounds.getWidth();
- // System.err.println("yy="+y+" dx="+x+" dy="+y);
- // x = 0;
- // y = 0;
- x = pos.x + x;
- y = pos.y + y;
- }
-
-// if (ta.getOrientationAngle() == 0) {
-//// System.err.println("x0=" + x);
-//// System.err.println("y0=" + y);
-// } else {
-// System.err.println("bounds=" + bounds + " y=" + bounds.getY() + " h=" + bounds.getHeight() + " vert="
-// + ta.getVerticalAnchor().getFactor()+" horz="+ta.getHorizontalAnchor().getFactor());
-// System.err.println("x1=" + x);
-// System.err.println("y1=" + y);
-// }
-
-
- _graphics.drawString(str, (float) x, (float) y);
- // _graphics.fillRect((int)x, (int)y, 5, 5);
- _graphics.setTransform(before);
- _graphics.setColor(currentColor);
- }
- }
-
- /**
- * Creates a font instance based on the specified text attributes and font
- * size.
- *
- * @param attributes
- * Text attributes (font name and style).
- * @param size
- * Font size in pixel. If 0 {@link #DEFAULT_FONT_SIZE} will be
- * used.
- * @return new font instance.
- */
- static Font createFont(TextAttributes attributes, int size) {
- String fontName = attributes.getFontName();
- if (fontName == null) {
- fontName = DEFAULT_FONT_NAME;
- }
-
- FontStyle fontStyle = attributes.getFontStyle();
- if (fontStyle == null) {
- fontStyle = DEFAULT_FONT_STYLE;
- }
- int style = Font.PLAIN;
- if (fontStyle == FontStyle.BOLD) {
- style = Font.BOLD;
- } else if (fontStyle == FontStyle.ITALIC) {
- style = Font.ITALIC;
- } else if (fontStyle == FontStyle.BOLD_ITALIC) {
- style = Font.BOLD + Font.ITALIC;
- }
-
- if (size == 0) {
- size = DEFAULT_FONT_SIZE;
- }
-
- return new Font(fontName, style, size);
- }
-
-}
diff --git a/src/jcckit/renderer/Transformation.java b/src/jcckit/renderer/Transformation.java
deleted file mode 100644
index 1277c2e7e..000000000
--- a/src/jcckit/renderer/Transformation.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.renderer;
-
-import java.awt.Graphics2D;
-
-import jcckit.graphic.Anchor;
-import jcckit.graphic.ClippingRectangle;
-import jcckit.graphic.GraphPoint;
-
-/**
- * Transformation between device-independent coordinates
- * and standard Java coordinates. The aspect-ratio will
- * be the same. The position in the canvas is determined by a
- * {@link jcckit.graphic.Rectangle Rectangle} defining a (virtual)
- * paper which is placed in the canvas according to an anchor point.
- * Depending on the aspect ratio of the canvas the paper width or
- * height occupies the canvas width or height.
- *
- * @author Franz-Josef Elmer
- */
-public class Transformation {
- private final double _scale, _x0, _y0;
-
- public String toString() {
- return "_scale=" + _scale + " _x0=" + _x0 + " _y0=" + _y0;
- }
-
- /**
- * Creates an instance for the specified canvas size, paper size,
- * and anchor points of the paper.
- * @param width Width of the canvas.
- * @param height Height of the canvas.
- * @param paper Rectangle defining the paper in device-independent
- * coordinates.
- * @param horizontalAnchor Horizontal anchor of the paper in the canvas.
- * @param verticalAnchor Vertical anchor of the paper in the canvas.
- */
- public Transformation(int width, int height, ClippingRectangle paper,
- Anchor horizontalAnchor, Anchor verticalAnchor) {
- double pWidth = paper.getMaxX() - paper.getMinX();
- double pHeight = paper.getMaxY() - paper.getMinY();
- _scale = Math.min(width / pWidth, height / pHeight);
- _x0 = 0.5 * horizontalAnchor.getFactor() * (width - _scale * pWidth)
- - _scale * paper.getMinX();
- _y0 = 0.5 * verticalAnchor.getFactor() * (_scale * pHeight - height)
- + height + _scale * + paper.getMinY();
- }
-
- /** Transforms the device-independent x coordinate into Java coordinates. */
- public int transformX(double x) {
- return trim(_scale * x + _x0);
- }
-
- /** Transforms the device-independent y coordinate into Java coordinates. */
- public int transformY(double y) {
- return trim(_y0 - _scale * y);
- }
-
- /** Transforms the device-independent width into Java width. */
- public int transformWidth(double width) {
- return trim(_scale * width + 0.5);
- }
-
- /** Transforms the device-independent height into Java height. */
- public int transformHeight(double height) {
- return trim(_scale * height + 0.5);
- }
-
- private static int trim(double number)
- {
- return number > Short.MAX_VALUE
- ? Short.MAX_VALUE
- : (number < Short.MIN_VALUE ? Short.MIN_VALUE : (int) number);
- }
-
- /**
- * Transforms a point in Java coordinates back into device-independent
- * coordinates.
- */
- public GraphPoint transformBack(int x, int y) {
- return new GraphPoint((x - _x0) / _scale, (_y0 - y) / _scale);
- }
-
-public void apply(Graphics2D g) {
- g.translate(_x0, _y0);
- g.scale(_scale, -_scale);
-
-}
-}
-
diff --git a/src/jcckit/transformation/CartesianTransformation.java b/src/jcckit/transformation/CartesianTransformation.java
deleted file mode 100644
index d2c30da49..000000000
--- a/src/jcckit/transformation/CartesianTransformation.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.transformation;
-
-import jcckit.data.DataPoint;
-import jcckit.graphic.GraphPoint;
-import jcckit.util.Util;
-
-/**
- * Two-dimensional Cartesian transformation. The two independent
- * transformations for the x-axis and the y-axis can be logarithmic
- * from data coordinates to device-independent coordinates in order to
- * realize diagrams with logarithmic scales.
- *
- * @author Franz-Josef Elmer
- */
-public class CartesianTransformation implements Transformation {
- private final boolean _xLogScale;
- private final double _xOffset;
- private final double _xScale;
- private final boolean _yLogScale;
- private final double _yOffset;
- private final double _yScale;
-
- /**
- * Creates an instance from the specified reference points.
- * Note, that the reference points must differ in x and y coordinates
- * otherwise a transformation would not be possible.
- * @param xLogScale true if logarithmic x axis.
- * @param yLogScale true if logarithmic y axis.
- * @param dataPoint1 First reference point in data coordinates.
- * @param graphPoint1 First reference point in device-independent
- * coordinates.
- * @param dataPoint2 Second reference point in data coordinates.
- * @param graphPoint2 Second reference point in device-independent
- * coordinates.
- * @throws IllegalArgumentException if transformation in at least
- * one of both directions is not possible.
- */
- public CartesianTransformation(boolean xLogScale, boolean yLogScale,
- DataPoint dataPoint1, GraphPoint graphPoint1,
- DataPoint dataPoint2, GraphPoint graphPoint2) {
- _xLogScale = xLogScale;
- double d1 = Util.log(dataPoint1.getX(), xLogScale);
- double dd = Util.log(dataPoint2.getX(), xLogScale) - d1;
- check(dd, "data", "x", d1);
- _xScale = (graphPoint2.getX() - graphPoint1.getX()) / dd;
- check(_xScale, "graphical", "x", graphPoint1.getX());
- _xOffset = graphPoint1.getX() - d1 * _xScale;
-
- _yLogScale = yLogScale;
- d1 = Util.log(dataPoint1.getY(), yLogScale);
- dd = Util.log(dataPoint2.getY(), yLogScale) - d1;
- check(dd, "data", "y", d1);
- _yScale = (graphPoint2.getY() - graphPoint1.getY()) / dd;
- check(_yScale, "graphical", "y", graphPoint1.getY());
- _yOffset = graphPoint1.getY() - d1 * _yScale;
- }
-
- private void check(double valueToCheck, String type, String axis,
- double value) {
- if (valueToCheck == 0) {
- throw new IllegalArgumentException("The " + type
- + " reference points in " + axis + " must be different; both are "
- + value);
- }
- }
-
- public GraphPoint transformToGraph(DataPoint point) {
- return new GraphPoint(
- _xOffset + Util.log(point.getX(), _xLogScale) * _xScale,
- _yOffset + Util.log(point.getY(), _yLogScale) * _yScale);
- }
-
- public DataPoint transformToData(GraphPoint point) {
- return new DataPoint(
- Util.exp((point.getX() - _xOffset) / _xScale, _xLogScale),
- Util.exp((point.getY() - _yOffset) / _yScale, _yLogScale));
- }
-}
diff --git a/src/jcckit/transformation/Transformation.java b/src/jcckit/transformation/Transformation.java
deleted file mode 100644
index 46b3d16a9..000000000
--- a/src/jcckit/transformation/Transformation.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.transformation;
-
-import jcckit.data.DataPoint;
-import jcckit.graphic.GraphPoint;
-
-/**
- * Interface for transformations between data coordinates
- * and device-independent coordinates.
- *
- * @author Franz-Josef Elmer
- */
-public interface Transformation {
- /**
- * Transforms a {@link DataPoint} into a {@link GraphPoint}.
- * @param point A point in data coordinates.
- * @return point tranformed into device-independent coordinates..
- */
- public GraphPoint transformToGraph(DataPoint point);
-
- /**
- * Transforms a {@link GraphPoint} into a {@link DataPoint}.
- * @param point A point in device-independent coordinates..
- * @return point tranformed into data coordinates.
- */
- public DataPoint transformToData(GraphPoint point);
-}
diff --git a/src/jcckit/util/AppletBasedConfigData.java b/src/jcckit/util/AppletBasedConfigData.java
deleted file mode 100644
index e46b7208d..000000000
--- a/src/jcckit/util/AppletBasedConfigData.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.util;
-
-import java.applet.Applet;
-
-/**
- * Implementation of {@link FlatConfigData} based on
- * java.applet.Applet.
- *
- * @author Franz-Josef Elmer
- */
-public class AppletBasedConfigData extends FlatConfigData {
- private final Applet _applet;
-
- /**
- * Creates an instance based on the specified applet.
- * The path is undefined.
- */
- public AppletBasedConfigData(Applet applet) {
- this(applet, null);
- }
-
- /** Creates an instance based on the specified properties and path. */
- private AppletBasedConfigData(Applet applet, String path) {
- super(path);
- _applet = applet;
- }
-
- protected String getValue(String fullKey) {
- return _applet.getParameter(fullKey);
- }
-
- protected ConfigData createConfigData(String path) {
- return new AppletBasedConfigData(_applet, path);
- }
-}
diff --git a/src/jcckit/util/ConfigData.java b/src/jcckit/util/ConfigData.java
deleted file mode 100644
index 7a48bb395..000000000
--- a/src/jcckit/util/ConfigData.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.util;
-
-/**
- * Interface for hierarchically managed key-value pairs. The key is
- * always a string which contains any kind of printable character except
- * '/', '=', ':', and whitespace characters like ' ' and '\t'.
- * The value is either a string or a ConfigData object.
- *
- * This interface will be used by {@link ConfigParameters} in accordance
- * with the Strategy design pattern.
- *
- * @author Franz-Josef Elmer
- */
-public interface ConfigData {
- /**
- * Returns the full key.
- * @param key A (relative) key. null is not allowed.
- * @return the full key including path.
- */
- public String getFullKey(String key);
-
- /**
- * Returns the value associated with this key.
- * @param key The relative key. null is not allowed.
- * @return the associated value. Will be null if no value exists
- * for key.
- */
- public String get(String key);
-
- /**
- * Returns the ConfigData object associated with this key.
- * @param key The relative key. null is not allowed.
- * @return the associated value. Will never return null.
- * Instead an empty ConfigData is returned.
- */
- public ConfigData getNode(String key);
-}
diff --git a/src/jcckit/util/ConfigParameters.java b/src/jcckit/util/ConfigParameters.java
deleted file mode 100644
index 2594a2566..000000000
--- a/src/jcckit/util/ConfigParameters.java
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.util;
-
-import java.awt.Color;
-import java.util.StringTokenizer;
-
-import net.sourceforge.plantuml.graphic.HtmlColorSet;
-import net.sourceforge.plantuml.graphic.HtmlColorSetSimple;
-import net.sourceforge.plantuml.graphic.IHtmlColorSet;
-import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
-
-/**
- * Read-only class for hierarchically organized key-value pairs.
- * The key is always a string. The following value types are
- * supported:
- *
- String
- *
- boolean
- *
- int
- *
- double
- *
- double[]
- *
- Color
- *
- ConfigParameters
- *
- *
- * In accordance with the Strategy design pattern the retrieval of
- * a key-value pair is delegated to an instance of
- * {@link ConfigData}.
- *
- * @author Franz-Josef Elmer
- */
-public class ConfigParameters {
- private final ConfigData _configData;
-
- /** Creates an instance from the specified ConfigData object. */
- public ConfigParameters(ConfigData configData) {
- _configData = configData;
- }
-
- /**
- * Returns the full key.
- * @return the path concatenated with key.
- * @see ConfigData#getFullKey
- */
- public String getFullKey(String key) {
- return _configData.getFullKey(key);
- }
-
- /**
- * Returns the string value associated with the specified key.
- * @param key The (relative) key. null is not allowed.
- * @return the corresponding value. Will always be not null.
- * @throws IllegalArgumentException if no value exists for key.
- * The exception message is the full key.
- */
- public String get(String key) {
- String result = _configData.get(key);
- if (result == null) {
- throw new IllegalArgumentException(getFullKey(key));
- }
- return result;
- }
-
- /**
- * Returns the string value associated with the specified key or
- * defaultValue if undefined.
- * @param key The (relative) key. null is not allowed.
- * @param defaultValue The default value. Can be null.
- * @return the corresponding value or defaultValue.
- */
- public String get(String key, String defaultValue) {
- String result = _configData.get(key);
- if (result == null) {
- result = defaultValue;
- }
- return result;
- }
-
- /**
- * Returns the boolean associated with the specified key.
- * @param key The (relative) key. null is not allowed.
- * @return true if the value is "true" otherwise false.
- * @throws IllegalArgumentException if no value exists for key.
- * The exception message is the full key.
- * @throws NumberFormatException if the value is neither "true" nor "false".
- */
- public boolean getBoolean(String key) {
- return parseBoolean(get(key), key);
- }
-
- /**
- * Returns the boolean associated with the specified key.
- * @param key The (relative) key. null is not allowed.
- * @param defaultValue The default value. Can be null.
- * @return true if the value is "true" otherwise false.
- * @throws NumberFormatException if the value is neither "true" nor "false".
- */
- public boolean getBoolean(String key, boolean defaultValue) {
- String value = _configData.get(key);
- return value == null ? defaultValue : parseBoolean(value, key);
- }
-
- private boolean parseBoolean(String value, String key) {
- if (value.equals("true")) {
- return true;
- } else if (value.equals("false")) {
- return false;
- } else {
- throw createNumberFormatException("boolean", value, key);
- }
- }
-
- private NumberFormatException createNumberFormatException(String text,
- String value,
- String key) {
- return new NumberFormatException("Not a " + text + ": " + getFullKey(key)
- + " = " + value);
- }
-
- /**
- * Returns the integer associated with the specified key.
- * The value can be either
- *
- a decimal number (starting with a non-zero digit),
- *
- a hexadecimal number (starting with 0x), or
- *
- an octal number (starting with zero).
- *
- * @param key The (relative) key. null is not allowed.
- * @return the integer value.
- * @throws IllegalArgumentException if no value exists for key.
- * The exception message is the full key.
- * @throws NumberFormatException if the value is not a number.
- * The exception message contains the full key and the invalid value.
- */
- public int getInt(String key) {
- return parseInt(get(key), key);
- }
-
- /**
- * Returns the integer associated with the specified key or
- * defaultValue if no key-value pair exists for the specified key.
- * The value can be either
- * - a decimal number (starting with a non-zero digit),
- *
- a hexadecimal number (starting with 0x), or
- *
- an octal number (starting with zero).
- *
- * @param key The (relative) key. null is not allowed.
- * @param defaultValue The default value. Can be null.
- * @return the integer value.
- * @throws NumberFormatException if the value exists but is not a number.
- * The exception message contains the full key and the invalid value.
- */
- public int getInt(String key, int defaultValue) {
- String value = _configData.get(key);
- return value == null ? defaultValue : parseInt(value, key);
- }
-
- private int parseInt(String value, String key) {
- try {
- return Integer.decode(value).intValue();
- } catch (NumberFormatException e) {
- throw createNumberFormatException("number", value, key);
- }
- }
-
- /**
- * Returns the double associated with the specified key.
- * @param key The (relative) key. null is not allowed.
- * @return the double value.
- * @throws IllegalArgumentException if no value exists for key.
- * The exception message is the full key.
- * @throws NumberFormatException if the value is not a valid number.
- * The exception message contains the full key and the invalid value.
- */
- public double getDouble(String key) {
- return parseDouble(get(key), key);
- }
-
- /**
- * Returns the double associated with the specified key or
- * defaultValue if no key-value pair exists for the specified key.
- * @param key The (relative) key. null is not allowed.
- * @param defaultValue The default value. Can be null.
- * @return the double value.
- * @throws NumberFormatException if the value exists but is not a valid
- * number.
- * The exception message contains the full key and the invalid value.
- */
- public double getDouble(String key, double defaultValue) {
- String value = _configData.get(key);
- return value == null ? defaultValue : parseDouble(value, key);
- }
-
- private double parseDouble(String value, String key) {
- try {
- return new Double(value).doubleValue();
- } catch (NumberFormatException e) {
- throw createNumberFormatException("number", value, key);
- }
- }
-
- /**
- * Returns the array of doubles associated with the specified key.
- * The numbers are separated by whitespaces.
- * @param key The (relative) key. null is not allowed.
- * @return the array of double values.
- * @throws IllegalArgumentException if no value exists for key.
- * The exception message is the full key.
- * @throws NumberFormatException if the value exists but is not a
- * sequence of number. The exception message contains
- * the full key and the invalid value.
- */
- public double[] getDoubleArray(String key) {
- return parseDoubleArray(get(key), key);
- }
-
- /**
- * Returns the array of doubles associated with the specified key
- * or defaultValue if no key-value pair exists for
- * the specified key. The numbers are separated by whitespaces.
- * @param key The (relative) key. null is not allowed.
- * @param defaultValue The default value. Can be null.
- * @return the array of double values.
- * @throws NumberFormatException if the value exists but is not a
- * sequence of number. The exception message contains
- * the full key and the invalid value.
- */
- public double[] getDoubleArray(String key, double[] defaultValue) {
- String value = _configData.get(key);
- return value == null ? defaultValue : parseDoubleArray(value, key);
- }
-
- private double[] parseDoubleArray(String value, String key) {
- try {
- StringTokenizer tokenizer = new StringTokenizer(value);
- double[] result = new double[tokenizer.countTokens()];
- for (int i = 0; i < result.length; i++) {
- result[i] = new Double(tokenizer.nextToken()).doubleValue();
- }
- return result;
- } catch (NumberFormatException e) {
- throw createNumberFormatException("sequence of numbers", value, key);
- }
- }
-
- /**
- * Returns the color associated with the specified key.
- * The color is coded as
- * - a decimal number (starting with a non-zero digit),
- *
- a hexadecimal number (starting with 0x), or
- *
- an octal number (starting with zero).
- *
- * @param key The (relative) key. null is not allowed.
- * @return the color.
- * @throws NumberFormatException if the value exists but is not a number.
- * The exception message contains the full key and the invalid value.
- */
- public Color getColor(String key) {
- return parseColor(get(key), key);
- }
-
- /**
- * Returns the color associated with the specified key or the specified
- * default value if no key-value pair exists for the specified key.
- * The color is coded as
- * - a decimal number (starting with a non-zero digit),
- *
- a hexadecimal number (starting with 0x), or
- *
- an octal number (starting with zero).
- *
- * @param key The (relative) key. null is not allowed.
- * @param defaultValue The default value. Can be null.
- * @return the color or null if the value is an empty string.
- * @throws NumberFormatException if the value exists but is not a number.
- * The exception message contains the full key and the invalid value.
- */
- public Color getColor(String key, Color defaultValue) {
- String value = _configData.get(key);
- return value == null ? defaultValue : parseColor(value, key);
- }
-
- private Color parseColor(String value, String key) {
- try {
- return value.length() == 0 ? null : decodeInternal(value);
- } catch (NumberFormatException e) {
- throw createNumberFormatException("number", value, key);
- }
- }
-
-static private IHtmlColorSet colors = new HtmlColorSetSimple();
-private Color decodeInternal(String value) {
- if (colors.getColorIfValid(value)!=null) {
- return new ColorMapperIdentity().getMappedColor(colors.getColorIfValid(value));
- }
- return Color.decode(value);
-}
-
- /**
- * Returns the child node associated with the specified key.
- * This method returns in any case a non-null result.
- * @param key The (relative) key. null is not allowed.
- * @return the corresponding child node which may be empty.
- */
- public ConfigParameters getNode(String key) {
- return new ConfigParameters(_configData.getNode(key));
- }
-}
diff --git a/src/jcckit/util/ConfigParametersBasedConfigData.java b/src/jcckit/util/ConfigParametersBasedConfigData.java
deleted file mode 100644
index 77138a7ea..000000000
--- a/src/jcckit/util/ConfigParametersBasedConfigData.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.util;
-
-/**
- * An implementation of {@link ConfigData} based on two instances of
- * {@link ConfigParameters}. The second one serves as a set of
- * default parameters. It will be used if the first one has not the requested
- * key-value pair.
- *
- * @author Franz-Josef Elmer
- */
-public class ConfigParametersBasedConfigData implements ConfigData {
- private ConfigParameters _config;
- private ConfigParameters _defaultConfig;
-
- /**
- * Creates an instance.
- * @param config A set of key-value pairs.
- * @param defaultConfig The default set of key-value pairs.
- */
- public ConfigParametersBasedConfigData(ConfigParameters config,
- ConfigParameters defaultConfig) {
- _config = config;
- _defaultConfig = defaultConfig;
- }
-
- /**
- * Returns the full key.
- * @param key A (relative) key. null is not allowed.
- * @return the full key including path.
- */
- public String getFullKey(String key) {
- return _config.getFullKey(key);
- }
-
- /**
- * Returns the value associated with this key.
- * @param key The relative key. null is not allowed.
- * @return the associated value. Will be null if no value exists
- * for key.
- */
- public String get(String key) {
- String value = _config.get(key, null);
- return value == null ? _defaultConfig.get(key, null) : value;
- }
-
- /**
- * Returns the ConfigData object associated with this key.
- * @param key The relative key. null is not allowed.
- * @return the associated value. Will never return null.
- * Instead an empty ConfigData is returned.
- */
- public ConfigData getNode(String key) {
- return new ConfigParametersBasedConfigData(_config.getNode(key),
- _defaultConfig.getNode(key));
- }
-}
diff --git a/src/jcckit/util/Factory.java b/src/jcckit/util/Factory.java
deleted file mode 100644
index 240f8befe..000000000
--- a/src/jcckit/util/Factory.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.util;
-
-import java.lang.reflect.Constructor;
-
-/**
- * General purpose factory method based on {@link ConfigParameters}
- * and Java's Reflection API.
- *
- * @author Franz-Josef Elmer
- */
-public class Factory {
- /** The constant defining the key className. */
- public static final String CLASS_NAME_KEY = "className";
-
- /** No public constructor necessary. */
- private Factory() {}
-
- /**
- * Creates an instance of the specified class.
- * @param className Fully-qualified name of a class with a default
- * constructor.
- * @return a new instance.
- * @throws IllegalArgumentException if the instance could be created.
- */
- public static Object create(String className) {
- try {
- return Class.forName(className).newInstance();
- } catch (Throwable t) {
- throw new IllegalArgumentException("Could not create an instance of "
- + className + " because of " + t);
- }
- }
-
- /**
- * Creates an object based on the specified configuration
- * parameters. The class of the object is determined by the
- * parameter with the key {@link #CLASS_NAME_KEY}.
- * The constructor with a single argument of the type
- * ConfigParameter is invoked with the argument
- * configParameters. If such a constructor
- * does not exists the default constructor is invoked. If
- * neither of these constructors exist a {@link FactoryException}
- * is thrown.
- * @param configParameters Configuration parameters.
- * @return the newly created object.
- * @throws IllegalArgumentException if key className is missing.
- * @throws FactoryException wrapping any kind of exception or error occured.
- */
- public static Object create(ConfigParameters configParameters) {
- String className = configParameters.get(CLASS_NAME_KEY);
- return createObject(configParameters, className);
- }
-
- /**
- * Creates an object based on the specified configuration
- * parameters and default class name. If the
- * parameter with the key {@link #CLASS_NAME_KEY} is missed in
- * configParameters defaultClassName is used.
- * Otherwise it works as {@link #create(jcckit.util.ConfigParameters)}.
- * @param configParameters Configuration parameters.
- * @param defaultClassName Default class name.
- * @return the newly created object.
- * @throws FactoryException wrapping any kind of exception or error occured.
- */
- public static Object create(ConfigParameters configParameters,
- String defaultClassName) {
- String className = configParameters.get(CLASS_NAME_KEY, defaultClassName);
- return createObject(configParameters, className);
- }
-
- /**
- * Creates an object based on the specified configuration
- * parameters or returns the default object. This method behaves
- * as {@link #create(jcckit.util.ConfigParameters)}, except that is does
- * not throw an IllegalArgumentException if key className
- * is missing. Instead defaultObject is returned.
- */
- public static Object createOrGet(ConfigParameters configParameters,
- Object defaultObject) {
- String className = configParameters.get(CLASS_NAME_KEY, null);
- return className == null ? defaultObject
- : createObject(configParameters, className);
- }
-
- private static Object createObject(ConfigParameters configParameters,
- String className) {
- try {
- Class c = Class.forName(className);
- Object result = null;
- Constructor constructor = null;
- try {
- constructor = c.getConstructor(new Class[] {ConfigParameters.class});
- result = constructor.newInstance(new Object[] {configParameters});
- } catch (NoSuchMethodException e) {
- result = c.newInstance();
- }
- return result;
- } catch (Throwable t) {
- throw new FactoryException(configParameters, CLASS_NAME_KEY, t);
- }
- }
-}
diff --git a/src/jcckit/util/FactoryException.java b/src/jcckit/util/FactoryException.java
deleted file mode 100644
index 28d0f39e9..000000000
--- a/src/jcckit/util/FactoryException.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.util;
-
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * Exception thrown in the case of an error during creation of a new
- * object by {@link Factory#create}.
- *
- * @author Franz-Josef Elmer
- */
-public class FactoryException extends RuntimeException {
- private final String _fullKey;
- private final String _className;
- private final Object _reason;
-
- /**
- * Creates a new instance based on the specified configuration parameters
- * and reason object.
- *
- * If reason is an instance of InvocationTargetException
- * it will be replaced by the wrapped Throwable.
- * @param configParameters Configuration parameters from which the
- * className will be extracted (if it exists, otherwise
- * null will be taken).
- * @param reason The reason causing this exception. Most often an
- * an exception.
- */
- public FactoryException(ConfigParameters configParameters, String key,
- Object reason) {
- _fullKey = configParameters.getFullKey(key);
- _className = configParameters.get(key, null);
- if (reason instanceof InvocationTargetException) {
- reason = ((InvocationTargetException) reason).getTargetException();
- }
- _reason = reason;
- }
-
- /** Returns the full class name key. */
- public String getFullKey() {
- return _fullKey;
- }
-
- /** Returns the fully qualified class name. */
- public String getClassName() {
- return _className;
- }
-
- /** Returns the reason object causing this exception. */
- public Object getReason() {
- return _reason;
- }
-
- /**
- * Renders this instance as follows: jcckit.util.FactoryException:
- * full key = class name: reason.
- */
- public String toString() {
- return getClass().getName() + ": " + _fullKey + " = " + _className
- + ": " + _reason;
- }
-}
diff --git a/src/jcckit/util/FlatConfigData.java b/src/jcckit/util/FlatConfigData.java
deleted file mode 100644
index 1384e5ca1..000000000
--- a/src/jcckit/util/FlatConfigData.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.util;
-
-/**
- * An implementation of ConfigData based on a flat
- * representation of the hierachically organized key-value pairs.
- * Concrete subclasses must implement the methods
- * {@link #getValue} and {@link #createConfigData} in accordance
- * with the Template Method pattern and Factory Method pattern,
- * respectively.
- *
- * In a flat representation of hierachically organized key-value
- * pairs all key-value pairs are stored in a single Hashtable.
- * Its key is the full key of the configuration data (i.e. the key
- * including its path).
- *
- * Example (using the notation for a .properties file):
- *
- * title = example
- * symbolAttributes/className = jcckit.graphic.BasicDrawingAttributes
- * symbolAttributes/fillColor = 0xcaffee
- * symbolAttributes/lineColor = 0xff0000
- *
- * The following table shows the result of some method calls at a
- * FlatConfigData instance prepared with
- * this example:
- *
- *
- *
- * Method call | Result |
- * get("title") | example |
- * getNode("symbolAttributes").get("fillColor")
- * | 0xcaffee |
- *
- *
- *
- * In addition FlatConfigData implements inheritance
- * of key-value pairs.
- * Basically a node in the tree of key-value pairs
- * may extend another node in the tree.
- * The extended node inherit all key-value pairs from the extending
- * one including the key-value pairs of all descendants.
- * The value of a inherited key-value pair may be overridden.
- * Also new key-value pairs may be placed in the inherited node or
- * anywhere in the subtree.
- * Note, that the extending node has to be a node which is not a
- * descendant of the extended node (otherwise a circulary chain
- * of references occurs). As a consequence not more than 20 inheritance
- * levels are allowed.
- *
- * The implementation of this kind of inheritance in a flat hashtable
- * is done by an additional key-value pair of the form
- *
- * extending-node/ = extended-node/
- *
- * Example:
- *
- * A/a/priority = high
- * A/a/alpha/hello = universe
- * A/a/alpha/answer = 42
- * A/b/1/ = A/a/
- * A/b/1/alpha/hello = world
- * A/b/1/alpha/question = 6 * 7
- *
- * The following table shows the result of various method calls
- * applied at the node A/b/1/ of a FlatConfigData
- * instance prepared with this example:
- *
- *
- *
- * Method call | Result | Comment |
- * get("priority") | high | inherited |
- * getNode("alpha").get("hello")
- * | world | overridden |
- * getNode("alpha").get("question")
- * | 6 * 7 | added |
- * getNode("alpha").get("answer")
- * | 42 | inherited |
- *
- *
- *
- * @author Franz-Josef Elmer
- */
-public abstract class FlatConfigData implements ConfigData {
- private final String _path;
-
- /** Creates a new instance for the specified path. */
- public FlatConfigData(String path) {
- _path = path;
- }
-
- /**
- * Returns the full key.
- * @param key A (relative) key. null is not allowed.
- * @return the path concatenated with key or key
- * if the path is undefined.
- */
- public String getFullKey(String key) {
- return _path == null ? key : _path + key;
- }
-
- /**
- * Returns the value associated with this key.
- * @param key The relative key. null is not allowed.
- * @return the associated value. Will be null if no value exists
- * for key.
- */
- public String get(String key) {
- return get(_path, key, 0);
- }
-
- /**
- * Obtains a value in accordance with hierarchy (path) and
- * inheritance (recursive calls of this routine).
- */
- private String get(String path, String key, int numberOfLevels) {
- String result = null;
- if (numberOfLevels < 20) {
- String fullKey = path == null ? key : path + key;
- result = getValue(fullKey);
- if (result == null) {
- // posAfterDelim is the index in path just after '/'
- int posAfterDelim = path == null ? -1 : path.length();
- String replacement;
- while (posAfterDelim > 0) {
- // look for a sub-tree
- replacement = getValue(path.substring(0, posAfterDelim));
- if (replacement != null) {
- // sub-tree found, add last part of the original path
- result = get(replacement + path.substring(posAfterDelim), key,
- numberOfLevels + 1);
- // break whether result is null or not.
- break;
- }
- // remove last element from the path
- posAfterDelim = path.lastIndexOf('/', posAfterDelim - 2) + 1;
- }
- }
- }
- return result;
- }
-
- /**
- * Returns the ConfigData object associated with this key.
- * @param key The relative key.
- * @return the associated value. Will never return null.
- * Instead an empty ConfigData is returned.
- */
- public ConfigData getNode(String key) {
- String path = (_path == null ? key : _path + key) + '/';
- return createConfigData(path);
- }
-
- /**
- * Returns the value for the specified full key from the flat
- * representation of the hierarchically organized key-value pairs.
- * @param fullKey The full key including path. null is not allowed.
- * @return the value or null if not found.
- */
- protected abstract String getValue(String fullKey);
-
- /**
- * Returns the FlatConfigData object for the specified full path.
- * In general path will be used in the constructor with
- * path argument.
- * @param path The full path.
- * @return a new instance in any case.
- */
- protected abstract ConfigData createConfigData(String path);
-}
diff --git a/src/jcckit/util/Format.java b/src/jcckit/util/Format.java
deleted file mode 100644
index c4e04e2b4..000000000
--- a/src/jcckit/util/Format.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.util;
-
-import java.util.Vector;
-
-/**
- * A helper class for formatting numbers according to
- * a printf-like format string. Each instance of
- * this class is initialized by a format string for a
- * single number.
- *
- * @author Franz-Josef Elmer
- */
-public class Format implements TicLabelFormat {
- /**
- * Creates a new instance based of specified key-value pair of the
- * specified configuration parameters.
- * @param config Config parameters.
- * @param key The key of the key-value pair in config containing
- * the format string.
- * @return null if undefined key-value pair or format string
- * is an empty string.
- * @throws FactoryException if the format string is invalid.
- */
- public static Format create(ConfigParameters config, String key) {
- Format result = null;
- String format = config.get(key, null);
- if (format != null && format.length() > 0) {
- try {
- result = new Format(format);
- } catch (Exception e) {
- throw new FactoryException(config, key, e);
- }
- }
- return result;
- }
-
- private final FormatElement[] _formatElements;
- private final Vector _staticParts;
-
- /**
- * Creates an instance for the specified format string.
- * The format string is an alternation of some static texts and
- * format elements.
- * A format element has to start with '%' and it must end with
- * one of the following format descriptors:
- *
- * d |
- * decimal integer |
- * o |
- * octal integer |
- * x |
- * hex integer |
- * f |
- * floating point number with a fixed decimal point |
- * e, E |
- * floating point number in logarithmic format |
- * g, G |
- * floating point number rendered either in fixed-decimal
- * format of logarithmic format depending on the size of
- * the mantissa. |
- *
- * The characters between '%' and the decriptor are optional.
- * They can be grouped into
- * - modifier
- * it is
- * - '-' if the formated result should be flushed left
- *
- '+' if the sign should be always appear
- *
- '0' if the leading space should be filled with zeros
- *
- * - width
- * a decimal number given the minimum number of characters
- * of the result
- * - precision
- *
- * A plain '%' is coded as '%%'.
- * @param formatString The format string.
- * @exception IllegalArgumentException if invalid format string.
- */
- public Format(String formatString) {
- _staticParts = new Vector();
- Vector formatElements = new Vector();
- StringBuffer part = new StringBuffer();
- boolean insideFormatElement = false;
- boolean atPercentSymbol = false;
- for (int i = 0, n = formatString.length(); i < n; i++) {
- char c = formatString.charAt(i);
- if (insideFormatElement) {
- part.append(c);
- if (FormatElement.DESCRIPTORS.indexOf(c) >= 0) {
- formatElements.addElement(new String(part));
- part.setLength(0);
- insideFormatElement = false;
- }
- } else if (atPercentSymbol) {
- atPercentSymbol = false;
- if (c != '%') {
- _staticParts.addElement(new String(part));
- part.setLength(0);
- insideFormatElement = true;
- }
- part.append(c);
- if (FormatElement.DESCRIPTORS.indexOf(c) >= 0) {
- formatElements.addElement(new String(part));
- part.setLength(0);
- insideFormatElement = false;
- }
- } else {
- if (c == '%') {
- atPercentSymbol = true;
- } else {
- part.append(c);
- }
- }
- }
- if (insideFormatElement) {
- formatElements.addElement(new String(part));
- } else {
- _staticParts.addElement(new String(part));
- }
-
- _formatElements = new FormatElement[formatElements.size()];
- for (int i = 0; i < _formatElements.length; i++) {
- _formatElements[i]
- = new FormatElement((String) formatElements.elementAt(i));
- }
- }
-
- /**
- * Format a number.
- * If there are no format elements the numbers will be ignored.
- * If there are more than one format elements the
- * additional format elements will be ignored and only the static parts
- * are taken.
- * @param number Number to be formated.
- * @return Formated number.
- */
- public String form(long number) {
- StringBuffer result = new StringBuffer();
- result.append(_staticParts.elementAt(0));
- if (_formatElements.length > 0) {
- _formatElements[0].form(result, number);
- }
- return appendRest(result);
- }
-
- /**
- * Format a number.
- * If there are no format elements the numbers will be ignored.
- * If there are more than one format elements the
- * additional format elements will be ignored and only the static parts
- * are taken.
- * @param number Number to be formated.
- * @return Formated number.
- */
- public String form(double number) {
- StringBuffer result = new StringBuffer();
- result.append(_staticParts.elementAt(0));
- if (_formatElements.length > 0) {
- _formatElements[0].form(result, number);
- }
- return appendRest(result);
- }
-
- private String appendRest(StringBuffer buffer) {
- for (int i = 1, n = _staticParts.size(); i < n; i++) {
- buffer.append(_staticParts.elementAt(i));
- }
- return new String(buffer);
- }
-
- /**
- * Format an array of double numbers.
- * If there are less format elements than numbers the additional numbers
- * will be ignored. If there are less numbers than format elements the
- * additional format elements will be ignored and only the static parts
- * are taken.
- * @param numbers Numbers to be formated.
- * @return Formated numbers.
- */
- public String form(double[] numbers) {
- StringBuffer result = new StringBuffer();
- for (int i = 0, n = _staticParts.size(); i < n; i++) {
- result.append(_staticParts.elementAt(i));
- if (i < _formatElements.length && i < numbers.length) {
- _formatElements[i].form(result, numbers[i]);
- }
- }
- return new String(result);
- }
-}
diff --git a/src/jcckit/util/FormatElement.java b/src/jcckit/util/FormatElement.java
deleted file mode 100644
index 84f629a99..000000000
--- a/src/jcckit/util/FormatElement.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.util;
-
-/**
- *
- *
- * @author Franz-Josef Elmer
- */
-class FormatElement {
- /** All descriptor characters. */
- static final String DESCRIPTORS = "doxfeEgG";
- private static final String INT_DESCRIPTORS = "dox";
- private static final int INT_DESCRIPTOR = 0;
- private static final int FLOAT_DESCRIPTOR = 1;
- /**
- * Calculate the integer power of a floating point number.
- * @param n Exponent.
- * @param x Number.
- * @return x^n.
- */
- private static final double power(double x, int n) {
- return n < 0 ? 1.0 / power2(x, -n) : power2(x, n);
- }
-
- /** Calculate x^n recursively assuming n > 0. */
- private static final double power2(double x, int n) {
- switch (n) {
- case 0: return 1;
- case 1: return x;
- default:
- double p = power2(x, n / 2);
- return p * p * power2(x, n % 2);
- }
- }
-
- private final char _descriptor;
- private final int _descriptorType;
- private final double _tenToPrecision;
- private boolean _decimalPoint;
- private boolean _flushLeft;
- private boolean _leadingZeros;
- private boolean _alwaysSign;
- private int _width;
- private int _precision;
-
- /** Creates an instance for the specified format string. */
- FormatElement(String formatString) {
- int len = formatString.length() - 1;
- _descriptor = formatString.charAt(len);
- if (DESCRIPTORS.indexOf(_descriptor) < 0) {
- throw new IllegalArgumentException("Format element '" + formatString
- + "' does not ends with one of the following characters: "
- + DESCRIPTORS);
- }
- _descriptorType = INT_DESCRIPTORS.indexOf(_descriptor) >= 0
- ? INT_DESCRIPTOR : FLOAT_DESCRIPTOR;
- if (formatString.length() > 1) {
- switch (formatString.charAt(0)) {
- case '-':
- _flushLeft = true;
- formatString = formatString.substring(1);
- break;
- case '0':
- _leadingZeros = true;
- formatString = formatString.substring(1);
- break;
- case '+':
- _alwaysSign = true;
- formatString = formatString.substring(1);
- break;
- }
- len = formatString.length() - 1;
- int index = formatString.indexOf('.');
- _decimalPoint = index >= 0;
- int last = _decimalPoint ? index : len;
- if (last > 0) {
- _width = Integer.parseInt(formatString.substring(0, last));
- }
- if (_decimalPoint) {
- index++;
- if (index < len) {
- _precision = Integer.parseInt(formatString.substring(index, len));
- }
- }
- }
- _tenToPrecision = power(10, _precision);
- }
-
- /**
- * Format a number in accordance of the format string
- * given at the initialisation of this instance.
- * @param buffer Buffer to which the formated output will be appended.
- * @param number Number to be formated.
- */
- public void form(StringBuffer buffer, long number) {
- if (_descriptorType == FLOAT_DESCRIPTOR) {
- form(buffer, (double) number);
- } else {
- // Format absolut value in the right base
- buffer.append(form(number < 0,
- Long.toString(Math.abs(number),
- _descriptor == 'o' ? 8
- : (_descriptor == 'x' ? 16 : 10)),
- ""));
- }
- }
-
- /**
- * Format a number in accordance of the format string
- * given at the initialisation of this instance.
- * @param buffer Buffer to which the formated output will be appended.
- * @param number Number to be formated.
- */
- public void form(StringBuffer buffer, double number) {
- if (_descriptorType == INT_DESCRIPTOR) {
- form(buffer, (long) Math.floor(number + 0.5));
- } else if (_descriptor == 'f') {
- buffer.append(formF(number));
- } else if (_descriptor == 'e' || _descriptor == 'E') {
- buffer.append(formE(number));
- } else if (_descriptor == 'g' || _descriptor == 'G') {
- String formF = formF(number);
- String formE = formE(number);
- buffer.append(formF.length() > formE.length() ? formE : formF);
- }
- }
-
- private String form(boolean negativeValue, String intPart, String fracPart) {
- int len = intPart.length() + fracPart.length();
-
- // Buffer holding the result
- StringBuffer result = new StringBuffer();
- int count = 0;
-
- // add sign if necessary
- if (_alwaysSign || negativeValue) {
- result.append(negativeValue ? '-' : '+');
- count++;
- }
-
- // add zeros if necessary
- if (_leadingZeros) {
- for (int i = count + len; i < _width; i++) {
- result.append('0');
- count++;
- }
- }
-
- // add number
- result.append(intPart).append(fracPart);
- count += len;
-
- // add spaces if necessary
- if (_flushLeft) {
- for (; count < _width; count++) {
- result.append(' ');
- }
- } else {
- for (; count < _width; count++) {
- result.insert(0, ' ');
- }
- }
-
- return new String(result);
- }
-
- /** Format floating point number with exponent. */
- private String formE(double number) {
- // format absolute mantisse
- int exponent = 0;
- String zeros = "00000000000000000000000".substring(0, _precision + 1);
- if (number != 0) {
- exponent = (int) Math.floor(Math.log(Math.abs(number)) / Math.log(10));
- double mantisse = Math.floor(Math.abs(number * power(10.0,
- _precision - exponent)) + 0.5);
- if (mantisse >= 10 * _tenToPrecision) {
- exponent++;
- mantisse = Math.floor(Math.abs(number * power(10.0,
- _precision - exponent)) + 0.5);
- }
- zeros = Long.toString((long) mantisse);
- }
-
- // make fractional part
- StringBuffer fracPart = new StringBuffer();
- if (_decimalPoint) {
- fracPart.append('.').append(zeros.substring(1));
- }
-
- // make exponent
- fracPart.append(Character.isLowerCase(_descriptor) ? 'e': 'E')
- .append(exponent < 0 ? '-' : '+');
- exponent = Math.abs(exponent);
- for (int i = 0, n = fracPart.length(); i < 3; i++) {
- fracPart.insert(n, Character.forDigit(exponent % 10, 10));
- exponent /= 10;
- }
-
- return form(number < 0, zeros.substring(0, 1), new String(fracPart));
- }
-
- /** Format floating point number. */
- private String formF(double number) {
- // Format absolut value
- double multiplier = number < 0 ? - _tenToPrecision : _tenToPrecision;
- String digits
- = Long.toString((long) Math.floor(number * multiplier + 0.5));
- String intPart = digits;
- StringBuffer fracPart = new StringBuffer();
- if (_decimalPoint) {
- int len = digits.length() - _precision;
- fracPart.append('.').append(digits.substring(Math.max(0, len)));
- if (len > 0) {
- intPart = digits.substring(0, len);
- } else {
- intPart = "0";
- for (; len < 0; len++) {
- fracPart.insert(1, '0');
- }
- }
- }
-
- return form(number < 0, intPart, new String(fracPart));
- }
-}
diff --git a/src/jcckit/util/Point.java b/src/jcckit/util/Point.java
deleted file mode 100644
index 623c78fc1..000000000
--- a/src/jcckit/util/Point.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.util;
-
-/**
- * Immutable class of a two-dimensional point with floating point
- * coordinates.
- *
- * @author Franz-Josef Elmer
- */
-public class Point {
- private final double _x;
- private final double _y;
-
- /**
- * Creates an instance for the specified vector. The value of the
- * first/second element of vector denotes the x/y value.
- * If vector is null or not long enough 0 will be used
- * as default values.
- */
- public Point(double[] vector) {
- double x = 0;
- double y = 0;
- if (vector != null && vector.length > 0) {
- x = vector[0];
- if (vector.length > 1) {
- y = vector[1];
- }
- }
- _x = x;
- _y = y;
- }
-
- /** Creates an instance for the specified coordinates. */
- public Point(double x, double y) {
- _x = x;
- _y = y;
- }
-
- /** Returns the x-coordinate of the point. */
- public double getX() {
- return _x;
- }
-
- /** Returns the y-coordinate of the point. */
- public double getY() {
- return _y;
- }
-}
diff --git a/src/jcckit/util/PropertiesBasedConfigData.java b/src/jcckit/util/PropertiesBasedConfigData.java
deleted file mode 100644
index 1d5bcc436..000000000
--- a/src/jcckit/util/PropertiesBasedConfigData.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.util;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Properties;
-
-/**
- * Implementation of {@link FlatConfigData} based on
- * java.util.Properties.
- *
- * @author Franz-Josef Elmer
- */
-public class PropertiesBasedConfigData extends FlatConfigData {
- private final Properties _properties;
-
- /**
- * Creates an instance from the specified .properties file.
- * @param fileName File name of the .properties file relative
- * to the working directory or absolute.
- * @throws IOException if the .properties does not exist or could
- * not be read.
- */
- public PropertiesBasedConfigData(String fileName) throws IOException {
- super(null);
- _properties = new Properties();
- _properties.load(new FileInputStream(fileName));
- }
-
- /**
- * Creates an instance based on the specified properties.
- * The path is undefined.
- */
- public PropertiesBasedConfigData(Properties properties) {
- this(properties, null);
- }
-
- /** Creates an instance based on the specified properties and path. */
- private PropertiesBasedConfigData(Properties properties, String path) {
- super(path);
- _properties = properties;
- }
-
- /**
- * Returns the value for the specified full key. The call will be delegated
- * to the wrapped java.util.properties object.
- * @param fullKey The full key including path. null is not allowed.
- * @return the value or null if not found.
- */
- protected String getValue(String fullKey) {
- return _properties.getProperty(fullKey);
- }
-
- /**
- * Returns a new instance of PropertiesBasedConfigData
- * for the specified full path. The wrapped java.util.Properties
- * will be the same as of this instance.
- * @param path The full path.
- * @return a new instance.
- */
- protected ConfigData createConfigData(String path) {
- return new PropertiesBasedConfigData(_properties, path);
- }
-}
diff --git a/src/jcckit/util/TicLabelFormat.java b/src/jcckit/util/TicLabelFormat.java
deleted file mode 100644
index 61d924c58..000000000
--- a/src/jcckit/util/TicLabelFormat.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.util;
-
-/**
- * Format interface for tic labels. Maps a numerical tic value onto a string.
- *
- * @author Franz-Josef Elmer
- */
-public interface TicLabelFormat
-{
- /**
- * Forms the specified tic value to a string. Note, the numerical
- * ticValue may be mapped onto a non-numerical one.
- */
- public String form(double ticValue);
-}
diff --git a/src/jcckit/util/Util.java b/src/jcckit/util/Util.java
deleted file mode 100644
index 5715d5a46..000000000
--- a/src/jcckit/util/Util.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
- *
- * This library is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is 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
- * (http://www.gnu.org/copyleft/lesser.html).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package jcckit.util;
-
-/**
- * Collection of static utility methods.
- *
- * @author Franz-Josef Elmer
- */
-public class Util {
- /** Private constructor to prevent instanciation of this class. */
- private Util() {}
-
- /**
- * Returns the natural logarithm of the specified number if
- * logScale is true.
- * @return x if logScale == false.
- */
- public static double log(double x, boolean logScale) {
- return logScale ? Math.log(x) : x;
- }
-
- /**
- * Returns the exponential function of the specified number if
- * logScale is true.
- * @return x if logScale == false.
- */
- public static double exp(double x, boolean logScale) {
- return logScale ? Math.exp(x) : x;
- }
-}
diff --git a/src/net/sourceforge/plantuml/AnnotatedWorker.java b/src/net/sourceforge/plantuml/AnnotatedWorker.java
index 1afec513c..1e294f53e 100644
--- a/src/net/sourceforge/plantuml/AnnotatedWorker.java
+++ b/src/net/sourceforge/plantuml/AnnotatedWorker.java
@@ -52,6 +52,9 @@ import net.sourceforge.plantuml.graphic.SymbolContext;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.USymbol;
+import net.sourceforge.plantuml.style.SName;
+import net.sourceforge.plantuml.style.Style;
+import net.sourceforge.plantuml.style.StyleDefinition;
import net.sourceforge.plantuml.svek.DecorateEntityImage;
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
import net.sourceforge.plantuml.ugraphic.MinMax;
@@ -146,7 +149,6 @@ public class AnnotatedWorker {
return original;
}
final TextBlock text = getCaption();
-
return DecorateEntityImage.addBottom(original, text, HorizontalAlignment.CENTER);
}
@@ -155,6 +157,11 @@ public class AnnotatedWorker {
if (caption.isNull()) {
return TextBlockUtils.empty(0, 0);
}
+ if (SkinParam.USE_STYLES()) {
+ final Style style = StyleDefinition.of(SName.root, SName.caption).getMergedStyle(
+ skinParam.getCurrentStyleBuilder());
+ return style.createTextBlockBordered(caption.getDisplay(), skinParam.getIHtmlColorSet(), skinParam);
+ }
return caption.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.CAPTION, null),
HorizontalAlignment.CENTER, getSkinParam());
}
@@ -165,6 +172,9 @@ public class AnnotatedWorker {
return original;
}
ISkinParam skinParam = getSkinParam();
+ // if (SkinParam.USE_STYLES()) {
+ // throw new UnsupportedOperationException();
+ // }
final FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.TITLE, null);
final TextBlock block = TextBlockUtils.title(fontConfiguration, title.getDisplay(), skinParam);
diff --git a/src/net/sourceforge/plantuml/FontParam.java b/src/net/sourceforge/plantuml/FontParam.java
index 13d2333e6..cd8cb4eb4 100644
--- a/src/net/sourceforge/plantuml/FontParam.java
+++ b/src/net/sourceforge/plantuml/FontParam.java
@@ -38,6 +38,8 @@ package net.sourceforge.plantuml;
import java.awt.Font;
import net.sourceforge.plantuml.graphic.FontConfiguration;
+import net.sourceforge.plantuml.style.SName;
+import net.sourceforge.plantuml.style.StyleDefinition;
interface FontParamConstant {
String FAMILY = "SansSerif";
@@ -179,4 +181,18 @@ public enum FontParam {
return new FontConfiguration(skinParam, this, null);
}
+ public StyleDefinition getStyleDefinition() {
+ if (this == FOOTER) {
+ return StyleDefinition.of(SName.root, SName.footer);
+ }
+ if (this == HEADER) {
+ return StyleDefinition.of(SName.root, SName.header);
+ }
+ if (this == TITLE) {
+ return StyleDefinition.of(SName.root, SName.title);
+ }
+ System.err.println("Warning " + this);
+ return null;
+ }
+
}
diff --git a/src/net/sourceforge/plantuml/ISkinParam.java b/src/net/sourceforge/plantuml/ISkinParam.java
index 2dda7edfd..0f18a50cd 100644
--- a/src/net/sourceforge/plantuml/ISkinParam.java
+++ b/src/net/sourceforge/plantuml/ISkinParam.java
@@ -43,6 +43,9 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ArrowDirection;
+import net.sourceforge.plantuml.skin.Padder;
+import net.sourceforge.plantuml.style.Style;
+import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.svek.PackageStyle;
@@ -119,7 +122,7 @@ public interface ISkinParam extends ISkinSimple {
public ConditionStyle getConditionStyle();
public ConditionEndStyle getConditionEndStyle();
-
+
public double minClassWidth();
public boolean sameClassWidth();
@@ -168,4 +171,10 @@ public interface ISkinParam extends ISkinSimple {
public boolean isUseVizJs();
+ public Padder getSequenceDiagramPadder();
+
+ public StyleBuilder getCurrentStyleBuilder();
+
+ public void muteStyle(Style modifiedStyle);
+
}
\ No newline at end of file
diff --git a/src/net/sourceforge/plantuml/OptionPrint.java b/src/net/sourceforge/plantuml/OptionPrint.java
index 95ba824cf..a03a57a2b 100644
--- a/src/net/sourceforge/plantuml/OptionPrint.java
+++ b/src/net/sourceforge/plantuml/OptionPrint.java
@@ -56,10 +56,16 @@ import net.sourceforge.plantuml.version.Version;
public class OptionPrint {
static public void printTestDot() throws InterruptedException {
- for (String s : GraphvizUtils.getTestDotStrings(false)) {
- System.out.println(s);
+ final List result = new ArrayList();
+ final int errorCode = GraphvizUtils.addDotStatus(result, false);
+ for (String s : result) {
+ if (errorCode == 0) {
+ System.out.println(s);
+ } else {
+ System.err.println(s);
+ }
}
- exit();
+ exit(errorCode);
}
static public void printHelp() throws InterruptedException {
@@ -149,12 +155,12 @@ public class OptionPrint {
System.out.println(" -cypher\t\tTo cypher texts of diagrams so that you can share them");
System.out.println();
System.out.println("If needed, you can setup the environment variable GRAPHVIZ_DOT.");
- exit();
+ exit(0);
}
- static private void exit() throws InterruptedException {
- if (OptionFlags.getInstance().isSystemExit()) {
- System.exit(0);
+ static private void exit(int errorCode) throws InterruptedException {
+ if (OptionFlags.getInstance().isSystemExit() || errorCode != 0) {
+ System.exit(errorCode);
}
throw new InterruptedException("exit");
}
@@ -163,11 +169,11 @@ public class OptionPrint {
for (String s : License.getCurrent().getTextFull()) {
System.out.println(s);
}
- exit();
+ exit(0);
}
public static void printVersion() throws InterruptedException {
- System.out.println("PlantUML version " + Version.versionString() + " (" + Version.compileTimeString() + ")");
+ System.out.println(Version.fullDescription());
System.out.println("(" + License.getCurrent() + " source distribution)");
for (String v : interestingProperties()) {
System.out.println(v);
@@ -176,10 +182,12 @@ public class OptionPrint {
System.out.println(v);
}
System.out.println();
- for (String s : GraphvizUtils.getTestDotStrings(false)) {
+ final List result = new ArrayList();
+ final int errorCode = GraphvizUtils.addDotStatus(result, false);
+ for (String s : result) {
System.out.println(s);
}
- exit();
+ exit(errorCode);
}
public static Collection interestingProperties() {
@@ -250,7 +258,7 @@ public class OptionPrint {
}
public static void checkVersion() throws InterruptedException {
- System.out.println("PlantUML version " + Version.versionString() + " (" + Version.compileTimeString() + ")");
+ System.out.println(Version.fullDescription());
System.out.println();
final int lastversion = PSystemVersion.extractDownloadableVersion(null, null);
if (lastversion == -1) {
@@ -270,19 +278,19 @@ public class OptionPrint {
}
}
- exit();
+ exit(0);
}
public static void printAbout() throws InterruptedException {
for (String s : PSystemVersion.getAuthorsStrings(false)) {
System.out.println(s);
}
- OptionPrint.exit();
+ exit(0);
}
public static void printLanguage() throws InterruptedException {
new LanguageDescriptor().print(System.out);
- exit();
+ exit(0);
}
}
diff --git a/src/net/sourceforge/plantuml/PSystemBuilder.java b/src/net/sourceforge/plantuml/PSystemBuilder.java
index 62d7e1774..28d27aaf4 100644
--- a/src/net/sourceforge/plantuml/PSystemBuilder.java
+++ b/src/net/sourceforge/plantuml/PSystemBuilder.java
@@ -38,6 +38,9 @@ package net.sourceforge.plantuml;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
import net.sourceforge.plantuml.acearth.PSystemXearthFactory;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagramFactory;
@@ -45,6 +48,7 @@ import net.sourceforge.plantuml.activitydiagram3.ActivityDiagramFactory3;
import net.sourceforge.plantuml.api.PSystemFactory;
import net.sourceforge.plantuml.bpm.BpmDiagramFactory;
import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory;
+import net.sourceforge.plantuml.command.UmlDiagramFactory;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.compositediagram.CompositeDiagramFactory;
import net.sourceforge.plantuml.core.Diagram;
@@ -69,7 +73,6 @@ import net.sourceforge.plantuml.error.PSystemErrorUtils;
import net.sourceforge.plantuml.flowdiagram.FlowDiagramFactory;
import net.sourceforge.plantuml.font.PSystemListFontsFactory;
import net.sourceforge.plantuml.help.HelpFactory;
-import net.sourceforge.plantuml.jcckit.PSystemJcckitFactory;
import net.sourceforge.plantuml.math.PSystemLatexFactory;
import net.sourceforge.plantuml.math.PSystemMathFactory;
import net.sourceforge.plantuml.mindmap.MindMapDiagramFactory;
@@ -139,10 +142,9 @@ public class PSystemBuilder {
Log.info("Compilation duration " + (System.currentTimeMillis() - now));
RegexConcat.printCacheInfo();
}
-
}
- private List getAllFactories(ISkinSimple skinParam) {
+ private static List getAllFactories(ISkinSimple skinParam) {
final List factories = new ArrayList();
factories.add(new PSystemWelcomeFactory());
factories.add(new PSystemColorsFactory());
@@ -173,8 +175,8 @@ public class PSystemBuilder {
factories.add(new PSystemDitaaFactory(DiagramType.DITAA));
factories.add(new PSystemDitaaFactory(DiagramType.UML));
if (License.getCurrent() == License.GPL || License.getCurrent() == License.GPLV2) {
- factories.add(new PSystemJcckitFactory(DiagramType.JCCKIT));
- factories.add(new PSystemJcckitFactory(DiagramType.UML));
+ // factories.add(new PSystemJcckitFactory(DiagramType.JCCKIT));
+ // factories.add(new PSystemJcckitFactory(DiagramType.UML));
// factories.add(new PSystemLogoFactory());
factories.add(new PSystemSudokuFactory());
}
diff --git a/src/net/sourceforge/plantuml/Pipe.java b/src/net/sourceforge/plantuml/Pipe.java
index fbfda6801..6cef1d73b 100644
--- a/src/net/sourceforge/plantuml/Pipe.java
+++ b/src/net/sourceforge/plantuml/Pipe.java
@@ -104,6 +104,7 @@ public class Pipe {
ps.println();
} else {
ps.println(result);
+ error.goOk();
}
} else {
final OutputStream os = noStdErr ? new ByteArrayOutputStream() : ps;
diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java
index 9036e1bca..0eed4dcfc 100644
--- a/src/net/sourceforge/plantuml/SkinParam.java
+++ b/src/net/sourceforge/plantuml/SkinParam.java
@@ -36,6 +36,7 @@
package net.sourceforge.plantuml;
import java.awt.Font;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -62,6 +63,11 @@ import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ArrowDirection;
+import net.sourceforge.plantuml.skin.Padder;
+import net.sourceforge.plantuml.style.FromSkinparamToStyle;
+import net.sourceforge.plantuml.style.Style;
+import net.sourceforge.plantuml.style.StyleBuilder;
+import net.sourceforge.plantuml.style.StyleLoader;
import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.svek.PackageStyle;
@@ -77,6 +83,21 @@ import net.sourceforge.plantuml.ugraphic.sprite.SpriteImage;
public class SkinParam implements ISkinParam {
+ public static final String DEFAULT_STYLE = "plantuml.skin";
+
+ // public static final String DEFAULT_STYLE = "debug.skin";
+
+ static public boolean USE_STYLES() {
+ return USE_STYLE2.get();
+ }
+
+ private static ThreadLocal USE_STYLE2 = new ThreadLocal();
+
+ private SkinParam(UmlDiagramType type) {
+ USE_STYLE2.set(false);
+ this.type = type;
+ }
+
private static final String stereoPatternString = "\\<\\<(.*?)\\>\\>";
private static final Pattern2 stereoPattern = MyPattern.cmpile(stereoPatternString);
@@ -96,13 +117,19 @@ public class SkinParam implements ISkinParam {
public void setParam(String key, String value) {
for (String key2 : cleanForKey(key)) {
params.put(key2, StringUtils.trin(value));
+ if (key2.startsWith("usebetastyle")) {
+ USE_STYLE2.set("true".equalsIgnoreCase(value));
+ }
+ if (USE_STYLES()) {
+ final FromSkinparamToStyle convertor = new FromSkinparamToStyle(key2, value, getCurrentStyleBuilder());
+ final Style style = convertor.getStyle();
+ if (style != null) {
+ muteStyle(style);
+ }
+ }
}
}
- private SkinParam(UmlDiagramType type) {
- this.type = type;
- }
-
public static SkinParam create(UmlDiagramType type) {
return new SkinParam(type);
}
@@ -1015,15 +1042,17 @@ public class SkinParam implements ISkinParam {
}
public double getPadding() {
- final String value = getValue("padding");
- if (value != null && value.matches("\\d+(\\.\\d+)?")) {
- return Double.parseDouble(value);
- }
- return 0;
+ final String name = "padding";
+ return getAsDouble(name);
}
public double getPadding(PaddingParam param) {
- final String value = getValue(param.getSkinName());
+ final String name = param.getSkinName();
+ return getAsDouble(name);
+ }
+
+ private double getAsDouble(final String name) {
+ final String value = getValue(name);
if (value != null && value.matches("\\d+(\\.\\d+)?")) {
return Double.parseDouble(value);
}
@@ -1079,4 +1108,37 @@ public class SkinParam implements ISkinParam {
return useVizJs;
}
+ public Padder getSequenceDiagramPadder() {
+ final double padding = getAsDouble("SequenceMessagePadding");
+ final double margin = getAsDouble("SequenceMessageMargin");
+ final String borderColor = getValue("SequenceMessageBorderColor");
+ final String backgroundColor = getValue("SequenceMessageBackGroundColor");
+ if (padding == 0 && margin == 0 && borderColor == null && backgroundColor == null) {
+ return Padder.NONE;
+ }
+ final HtmlColor border = getIHtmlColorSet().getColorIfValid(borderColor);
+ final HtmlColor background = getIHtmlColorSet().getColorIfValid(backgroundColor);
+ final double roundCorner = getRoundCorner(CornerParam.DEFAULT, null);
+ return Padder.NONE.withMargin(margin).withPadding(padding).withBackgroundColor(background)
+ .withBorderColor(border).withRoundCorner(roundCorner);
+ }
+
+ private StyleBuilder styleBuilder;
+
+ public StyleBuilder getCurrentStyleBuilder() {
+ if (styleBuilder == null && SkinParam.USE_STYLES()) {
+ try {
+ this.styleBuilder = StyleLoader.mainStyle(this);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ return styleBuilder;
+ }
+
+ public void muteStyle(Style modifiedStyle) {
+ if (SkinParam.USE_STYLES()) {
+ styleBuilder = getCurrentStyleBuilder().muteStyle(modifiedStyle);
+ }
+ }
}
diff --git a/src/net/sourceforge/plantuml/SkinParamDelegator.java b/src/net/sourceforge/plantuml/SkinParamDelegator.java
index 535ea752e..05551fd92 100644
--- a/src/net/sourceforge/plantuml/SkinParamDelegator.java
+++ b/src/net/sourceforge/plantuml/SkinParamDelegator.java
@@ -46,6 +46,9 @@ import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.SkinParameter;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ArrowDirection;
+import net.sourceforge.plantuml.skin.Padder;
+import net.sourceforge.plantuml.style.Style;
+import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.svek.PackageStyle;
@@ -182,7 +185,7 @@ public class SkinParamDelegator implements ISkinParam {
public ConditionEndStyle getConditionEndStyle() {
return skinParam.getConditionEndStyle();
}
-
+
public double minClassWidth() {
return skinParam.minClassWidth();
}
@@ -322,10 +325,21 @@ public class SkinParamDelegator implements ISkinParam {
public Map values() {
return skinParam.values();
}
-
+
public HorizontalAlignment getStereotypeAlignment() {
return skinParam.getStereotypeAlignment();
}
+ public Padder getSequenceDiagramPadder() {
+ return skinParam.getSequenceDiagramPadder();
+ }
+
+ public StyleBuilder getCurrentStyleBuilder() {
+ return skinParam.getCurrentStyleBuilder();
+ }
+
+ public void muteStyle(Style modifiedStyle) {
+ skinParam.muteStyle(modifiedStyle);
+ }
}
diff --git a/src/net/sourceforge/plantuml/StringUtils.java b/src/net/sourceforge/plantuml/StringUtils.java
index f439d59ca..f88460e85 100644
--- a/src/net/sourceforge/plantuml/StringUtils.java
+++ b/src/net/sourceforge/plantuml/StringUtils.java
@@ -435,7 +435,8 @@ public class StringUtils {
while (matcher.find()) {
final String num = matcher.group(1);
final int value = Integer.parseInt(num, 16);
- matcher.appendReplacement(result, new String(Character.toChars(value)));
+ final String replace = new String(Character.toChars(value));
+ matcher.appendReplacement(result, Matcher.quoteReplacement(replace));
}
matcher.appendTail(result);
return result.toString();
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java
index 8db8a86f6..6e9da7cc7 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandIf.java
@@ -39,6 +39,7 @@ import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
+import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@@ -53,6 +54,7 @@ import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType;
+import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
public class CommandIf extends SingleLineCommand2 {
@@ -69,7 +71,15 @@ public class CommandIf extends SingleLineCommand2 {
new RegexLeaf("BAR", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"))), //
RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("ARROW", "([=-]+(?:(left|right|up|down|le?|ri?|up?|do?)(?=[-=.]))?[=-]*\\>)?"), //
+ //new RegexOptional(new RegexLeaf("ARROW", "([=-]+(?:(left|right|up|down|le?|ri?|up?|do?)(?=[-=.]))?[=-]*\\>)")), //
+ new RegexOptional(new RegexConcat( //
+ new RegexLeaf("ARROW_BODY1", "([-.]+)"), //
+ new RegexLeaf("ARROW_STYLE1", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
+ new RegexLeaf("ARROW_DIRECTION", "(\\*|left|right|up|down|le?|ri?|up?|do?)?"), //
+ new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
+ new RegexLeaf("ARROW_BODY2", "([-.]*)"), //
+ new RegexLeaf("\\>") //
+ )), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("BRACKET", "\\[([^\\]*]+[^\\]]*)\\]")), //
RegexLeaf.spaceZeroOrMore(), //
@@ -82,8 +92,8 @@ public class CommandIf extends SingleLineCommand2 {
}
@Override
- protected CommandExecutionResult executeArg(ActivityDiagram system, LineLocation location, RegexResult arg) {
- final IEntity entity1 = CommandLinkActivity.getEntity(system, arg, true);
+ protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) {
+ final IEntity entity1 = CommandLinkActivity.getEntity(diagram, arg, true);
if (entity1 == null) {
return CommandExecutionResult.error("No if possible at this point");
}
@@ -97,20 +107,26 @@ public class CommandIf extends SingleLineCommand2 {
ifCode = null;
ifLabel = arg.get("IF2", 0);
}
- system.startIf(Code.of(ifCode));
+ diagram.startIf(Code.of(ifCode));
int lenght = 2;
- if (arg.get("ARROW", 0) != null) {
- final String arrow = StringUtils.manageArrowForCuca(arg.get("ARROW", 0));
+ if (arg.get("ARROW_BODY1", 0) != null) {
+// final String arrow = StringUtils.manageArrowForCuca(arg.get("ARROW", 0));
+// lenght = arrow.length() - 1;
+ final String arrowBody1 = CommandLinkClass.notNull(arg.get("ARROW_BODY1", 0));
+ final String arrowBody2 = CommandLinkClass.notNull(arg.get("ARROW_BODY2", 0));
+ final String arrowDirection = CommandLinkClass.notNull(arg.get("ARROW_DIRECTION", 0));
+
+ final String arrow = StringUtils.manageArrowForCuca(arrowBody1 + arrowDirection + arrowBody2 + ">");
lenght = arrow.length() - 1;
}
- final IEntity branch = system.getCurrentContext().getBranch();
+ final IEntity branch = diagram.getCurrentContext().getBranch();
Link link = new Link(entity1, branch, new LinkType(LinkDecor.ARROW, LinkDecor.NONE),
- Display.getWithNewlines(arg.get("BRACKET", 0)), lenght, null, ifLabel, system.getLabeldistance(),
- system.getLabelangle());
+ Display.getWithNewlines(arg.get("BRACKET", 0)), lenght, null, ifLabel, diagram.getLabeldistance(),
+ diagram.getLabelangle(), diagram.getSkinParam().getCurrentStyleBuilder());
if (arg.get("ARROW", 0) != null) {
final Direction direction = StringUtils.getArrowDirection(arg.get("ARROW", 0));
if (direction == Direction.LEFT || direction == Direction.UP) {
@@ -118,7 +134,8 @@ public class CommandIf extends SingleLineCommand2 {
}
}
- system.addLink(link);
+ link.applyStyle(arg.getLazzy("ARROW_STYLE", 0));
+ diagram.addLink(link);
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java
index 4e5381ad6..792c0ff62 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java
@@ -91,7 +91,8 @@ public class CommandLinkActivity extends SingleLineCommand2 {
new RegexLeaf("ARROW_STYLE1", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
new RegexLeaf("ARROW_DIRECTION", "(\\*|left|right|up|down|le?|ri?|up?|do?)?"), //
new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
- new RegexLeaf("ARROW_BODY2", "([-.]*)\\>"), //
+ new RegexLeaf("ARROW_BODY2", "([-.]*)"), //
+ new RegexLeaf("\\>"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("BRACKET", "\\[([^\\]*]+[^\\]]*)\\]")), //
@@ -160,7 +161,7 @@ public class CommandLinkActivity extends SingleLineCommand2 {
type = type.goDotted();
}
- Link link = new Link(entity1, entity2, type, linkLabel, lenght);
+ Link link = new Link(entity1, entity2, type, linkLabel, lenght, diagram.getSkinParam().getCurrentStyleBuilder());
if (arrowDirection.contains("*")) {
link.setConstraint(false);
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java
index 9f5889bd6..3c3fec1c9 100644
--- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java
+++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java
@@ -100,12 +100,14 @@ public class CommandLinkLongActivity extends CommandMultilines2
new RegexLeaf("ARROW_STYLE1", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
new RegexLeaf("ARROW_DIRECTION", "(\\*|left|right|up|down|le?|ri?|up?|do?)?"), //
new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
- new RegexLeaf("ARROW_BODY2", "([-.]*)\\>"), //
+ new RegexLeaf("ARROW_BODY2", "([-.]*)"), //
+ new RegexLeaf("\\>"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("BRACKET", "\\[([^\\]*]+[^\\]]*)\\]")), //
RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("DESC", "[%g]([^%g]*?)"), //
+ new RegexLeaf("[%g]"), //
+ new RegexLeaf("DESC", "([^%g]*?)"), //
RegexLeaf.spaceZeroOrMore(), //
RegexLeaf.end());
}
@@ -208,7 +210,7 @@ public class CommandLinkLongActivity extends CommandMultilines2
if (arrow.contains(".")) {
type = type.goDotted();
}
- Link link = new Link(entity1, entity2, type, linkLabel, lenght);
+ Link link = new Link(entity1, entity2, type, linkLabel, lenght, diagram.getSkinParam().getCurrentStyleBuilder());
final Direction direction = StringUtils.getArrowDirection(arrowBody1 + arrowDirection + arrowBody2 + ">");
if (direction == Direction.LEFT || direction == Direction.UP) {
link = link.getInv();
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java
index fc850eb0b..739306570 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java
@@ -163,7 +163,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
final public boolean kill() {
if (endifCalled) {
for (Branch branch : thens) {
- if (branch.getLast().kill() == false) {
+ if (branch.getLast() != null && branch.getLast().kill() == false) {
return false;
}
if (elseBranch != null && elseBranch.getLast() != null && elseBranch.getLast().kill() == false) {
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java
index c9026392a..4ba86633a 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandCase.java
@@ -55,7 +55,9 @@ public class CommandCase extends SingleLineCommand2 {
return RegexConcat.build(CommandCase.class.getName(), RegexLeaf.start(), //
new RegexLeaf("case"), //
RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("TEST", "\\((.*?)\\)"), //
+ new RegexLeaf("\\("), //
+ new RegexLeaf("TEST", "(.*?)"), //
+ new RegexLeaf("\\)"), //
RegexLeaf.spaceZeroOrMore(), //
RegexLeaf.end());
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java
index 5ab2e5c4c..b58812020 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElse3.java
@@ -58,7 +58,7 @@ public class CommandElse3 extends SingleLineCommand2 {
new RegexOptional( //
new RegexConcat( //
RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("WHEN", "(?:\\(([^()]*)\\))?") //
+ new RegexLeaf("WHEN", "(?:\\((.*)\\))?") //
)), //
new RegexLeaf(";?"), //
RegexLeaf.end());
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java
index 540dc7cf2..236c045fa 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandElseIf2.java
@@ -64,7 +64,9 @@ public class CommandElseIf2 extends SingleLineCommand2 {
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("if"), //
RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("TEST", "\\((.*?)\\)"), //
+ new RegexLeaf("\\("), //
+ new RegexLeaf("TEST", "(.*?)"), //
+ new RegexLeaf("\\)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional( //
new RegexConcat( //
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java
index 30c1b9149..76c65fb72 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandEndPartition3.java
@@ -53,7 +53,7 @@ public class CommandEndPartition3 extends SingleLineCommand2 {
static IRegex getRegexConcat() {
return RegexConcat.build(CommandEndPartition3.class.getName(), //
RegexLeaf.start(), //
- new RegexLeaf("(\\})"), //
+ new RegexLeaf("\\}"), //
RegexLeaf.end()); //
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java
index 70a459732..933e562d7 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java
@@ -63,7 +63,9 @@ public class CommandIf2 extends SingleLineCommand2 {
ColorParser.exp4(), //
new RegexLeaf("if"), //
RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("TEST", "\\((.*?)\\)"), //
+ new RegexLeaf("\\("), //
+ new RegexLeaf("TEST", "(.*?)"), //
+ new RegexLeaf("\\)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional( //
new RegexConcat( //
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java
index e0281dd3c..b309b0935 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf4.java
@@ -58,11 +58,15 @@ public class CommandIf4 extends SingleLineCommand2 {
ColorParser.exp4(), //
new RegexLeaf("if"), //
RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("TEST", "\\((.*?)\\)"), //
+ new RegexLeaf("\\("), //
+ new RegexLeaf("TEST", "(.*?)"), //
+ new RegexLeaf("\\)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("(is|equals?)"), //
RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("WHEN", "\\((.+?)\\)"), //
+ new RegexLeaf("\\("), //
+ new RegexLeaf("WHEN", "(.+?)"), //
+ new RegexLeaf("\\)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("then"), //
RegexLeaf.spaceZeroOrMore(), //
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java
index 12f3b64fe..508ceeb16 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIfLegacy1.java
@@ -55,7 +55,9 @@ public class CommandIfLegacy1 extends SingleLineCommand2 {
return RegexConcat.build(CommandIfLegacy1.class.getName(), RegexLeaf.start(), //
new RegexLeaf("if"), //
RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("TEST", "\\((.+?)\\)"), //
+ new RegexLeaf("\\("), //
+ new RegexLeaf("TEST", "(.+?)"), //
+ new RegexLeaf("\\)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("then"), //
RegexLeaf.spaceOneOrMore(), //
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java
index 2fe67d5af..5586b603e 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandSwitch.java
@@ -58,7 +58,9 @@ public class CommandSwitch extends SingleLineCommand2 {
ColorParser.exp4(), //
new RegexLeaf("switch"), //
RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("TEST", "\\((.*?)\\)"), //
+ new RegexLeaf("\\("), //
+ new RegexLeaf("TEST", "(.*?)"), //
+ new RegexLeaf("\\)"), //
RegexLeaf.spaceZeroOrMore(), //
RegexLeaf.end());
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java
index 7d7426f01..38c4a80d6 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandWhile3.java
@@ -59,7 +59,9 @@ public class CommandWhile3 extends SingleLineCommand2 {
ColorParser.exp4(), //
new RegexLeaf("while"), //
RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("TEST", "\\((.*?)\\)"), //
+ new RegexLeaf("\\("), //
+ new RegexLeaf("TEST", "(.*?)"), //
+ new RegexLeaf("\\)"), //
new RegexOptional(new RegexConcat(//
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("(is|equals?)"), //
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java
index 4c33cbb71..78ff7379f 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/EntityImageLegend.java
@@ -38,14 +38,18 @@ package net.sourceforge.plantuml.activitydiagram3.ftile;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
+import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.skin.rose.Rose;
+import net.sourceforge.plantuml.style.PName;
+import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UStroke;
public class EntityImageLegend {
@@ -59,7 +63,9 @@ public class EntityImageLegend {
final HtmlColor legendColor = rose.getHtmlColor(skinParam, ColorParam.legendBorder);
final UStroke stroke = skinParam.getThickness(LineParam.legendBorder, null);
- final TextBlock result = TextBlockUtils.bordered(textBlock, stroke, legendColor, legendBackgroundColor, 10);
+ final int cornersize = 10;
+ final TextBlock result = TextBlockUtils.bordered(textBlock, stroke, legendColor, legendBackgroundColor,
+ cornersize);
return TextBlockUtils.withMargin(result, 8, 8);
}
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesA.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesA.java
index 16c19c118..09c9b6adc 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesA.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesA.java
@@ -41,6 +41,7 @@ import java.util.List;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.Pragma;
+import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.activitydiagram3.Instruction;
import net.sourceforge.plantuml.activitydiagram3.InstructionList;
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
@@ -63,6 +64,10 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.UGraphicDelegator;
import net.sourceforge.plantuml.graphic.color.ColorType;
+import net.sourceforge.plantuml.style.SName;
+import net.sourceforge.plantuml.style.Style;
+import net.sourceforge.plantuml.style.StyleDefinition;
+import net.sourceforge.plantuml.style.Styleable;
import net.sourceforge.plantuml.svek.UGraphicForSnake;
import net.sourceforge.plantuml.ugraphic.LimitFinder;
import net.sourceforge.plantuml.ugraphic.MinMax;
@@ -76,7 +81,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.comp.SlotSet;
import net.sourceforge.plantuml.utils.MathUtils;
-public class SwimlanesA extends AbstractTextBlock implements TextBlock {
+public class SwimlanesA extends AbstractTextBlock implements TextBlock, Styleable {
protected final ISkinParam skinParam;;
private final Pragma pragma;
@@ -88,12 +93,24 @@ public class SwimlanesA extends AbstractTextBlock implements TextBlock {
private Instruction currentInstruction = root;
private LinkRendering nextLinkRenderer = LinkRendering.none();
+ private Style style;
+
+ public StyleDefinition getDefaultStyleDefinition() {
+ return StyleDefinition.of(SName.root, SName.element, SName.classDiagram, SName.swimlane);
+ }
public SwimlanesA(ISkinParam skinParam, Pragma pragma) {
this.skinParam = skinParam;
this.pragma = pragma;
}
+ protected Style getStyle() {
+ if (style == null) {
+ this.style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
+ }
+ return style;
+ }
+
private FtileFactory getFtileFactory(StringBounder stringBounder) {
FtileFactory factory = new VCompactFactory(skinParam, stringBounder);
factory = new FtileFactoryDelegatorAddUrl(factory);
diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java
index 1f4e9edbb..fbb852959 100644
--- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java
+++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/SwimlanesB.java
@@ -40,12 +40,14 @@ import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.Pragma;
+import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@@ -66,7 +68,10 @@ public class SwimlanesB extends SwimlanesA {
final StringBounder stringBounder = ug.getStringBounder();
- final HtmlColor color = skinParam.getHtmlColor(ColorParam.swimlaneTitleBackground, null, false);
+ HtmlColor color = skinParam.getHtmlColor(ColorParam.swimlaneTitleBackground, null, false);
+ if (SkinParam.USE_STYLES()) {
+ color = getStyle().value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
+ }
if (color != null) {
final double titleHeight = getTitlesHeight(stringBounder);
final URectangle back = new URectangle(getTitlesWidth(stringBounder), titleHeight);
diff --git a/src/net/sourceforge/plantuml/asciiart/AbstractComponentText.java b/src/net/sourceforge/plantuml/asciiart/AbstractComponentText.java
index cba9b0dab..1dbc3fb64 100644
--- a/src/net/sourceforge/plantuml/asciiart/AbstractComponentText.java
+++ b/src/net/sourceforge/plantuml/asciiart/AbstractComponentText.java
@@ -40,6 +40,8 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.skin.Component;
+import net.sourceforge.plantuml.style.Style;
+import net.sourceforge.plantuml.style.StyleDefinition;
public abstract class AbstractComponentText implements Component {
@@ -48,5 +50,14 @@ public abstract class AbstractComponentText implements Component {
final double h = getPreferredHeight(stringBounder);
return new Dimension2DDouble(w, h);
}
+
+ public Style[] getUsedStyles() {
+ throw new UnsupportedOperationException();
+ }
+
+ public StyleDefinition getDefaultStyleDefinition() {
+ throw new UnsupportedOperationException();
+ }
+
}
diff --git a/src/net/sourceforge/plantuml/asciiart/TextSkin.java b/src/net/sourceforge/plantuml/asciiart/TextSkin.java
index 63959571b..5d609aa1a 100644
--- a/src/net/sourceforge/plantuml/asciiart/TextSkin.java
+++ b/src/net/sourceforge/plantuml/asciiart/TextSkin.java
@@ -45,6 +45,7 @@ import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.rose.ComponentRoseGroupingSpace;
import net.sourceforge.plantuml.skin.rose.Rose;
+import net.sourceforge.plantuml.style.Style;
public class TextSkin extends Rose {
@@ -55,7 +56,7 @@ public class TextSkin extends Rose {
}
@Override
- public ArrowComponent createComponentArrow(ArrowConfiguration config, ISkinParam param, Display stringsToDisplay) {
+ public ArrowComponent createComponentArrow(Style[] styles, ArrowConfiguration config, ISkinParam param, Display stringsToDisplay) {
if (config.getArrowDirection() == ArrowDirection.LEFT_TO_RIGHT_NORMAL
|| config.getArrowDirection() == ArrowDirection.RIGHT_TO_LEFT_REVERSE
|| config.getArrowDirection() == ArrowDirection.BOTH_DIRECTION) {
@@ -68,8 +69,9 @@ public class TextSkin extends Rose {
throw new UnsupportedOperationException();
}
- public Component createComponent(ComponentType type, ArrowConfiguration config, ISkinParam param,
- Display stringsToDisplay) {
+ @Override
+ public Component createComponent(Style style[], ComponentType type, ArrowConfiguration config,
+ ISkinParam param, Display stringsToDisplay) {
if (type == ComponentType.ACTOR_HEAD || type == ComponentType.ACTOR_TAIL) {
return new ComponentTextActor(type, stringsToDisplay, fileFormat,
fileFormat == FileFormat.UTXT ? AsciiShape.STICKMAN_UNICODE : AsciiShape.STICKMAN);
diff --git a/src/net/sourceforge/plantuml/bpm/CommandEndBranch.java b/src/net/sourceforge/plantuml/bpm/CommandEndBranch.java
index 19b327b78..3627d2197 100644
--- a/src/net/sourceforge/plantuml/bpm/CommandEndBranch.java
+++ b/src/net/sourceforge/plantuml/bpm/CommandEndBranch.java
@@ -51,7 +51,9 @@ public class CommandEndBranch extends SingleLineCommand2 {
static IRegex getRegexConcat() {
return RegexConcat.build(CommandEndBranch.class.getName(), RegexLeaf.start(), //
- new RegexLeaf("end branch"), //
+ new RegexLeaf("end"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("branch"), //
RegexLeaf.end());
}
diff --git a/src/net/sourceforge/plantuml/bpm/CommandNewBranch.java b/src/net/sourceforge/plantuml/bpm/CommandNewBranch.java
index 536fa6d21..d4cd55021 100644
--- a/src/net/sourceforge/plantuml/bpm/CommandNewBranch.java
+++ b/src/net/sourceforge/plantuml/bpm/CommandNewBranch.java
@@ -50,8 +50,11 @@ public class CommandNewBranch extends SingleLineCommand2 {
}
static IRegex getRegexConcat() {
- return RegexConcat.build(CommandNewBranch.class.getName(), RegexLeaf.start(), //
- new RegexLeaf("new branch"), //
+ return RegexConcat.build(CommandNewBranch.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexLeaf("new"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("branch"), //
RegexLeaf.end());
}
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandAllowMixing.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandAllowMixing.java
index 9028fded5..9c0b805ad 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandAllowMixing.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandAllowMixing.java
@@ -52,8 +52,11 @@ public class CommandAllowMixing extends SingleLineCommand2 {
private static IRegex getRegexConcat() {
- return RegexConcat.build(CommandAllowMixing.class.getName(), RegexLeaf.start(), //
- new RegexLeaf("allow_?mixing"), //
+ return RegexConcat.build(CommandAllowMixing.class.getName(), //
+ RegexLeaf.start(), //
+ new RegexLeaf("allow"), //
+ new RegexLeaf("_?"), //
+ new RegexLeaf("mixing"), //
RegexLeaf.end());
}
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java
index 828cad7e2..b94d766f5 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java
@@ -78,7 +78,8 @@ public class CommandCreateClass extends SingleLineCommand2 {
private static IRegex getRegexConcat() {
return RegexConcat.build(CommandCreateClass.class.getName(), RegexLeaf.start(), //
new RegexLeaf("TYPE", //
- "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|circle|diamond)[%s]+"), //
+ "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|circle|diamond)"), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexOr(//
new RegexConcat(//
new RegexLeaf("DISPLAY1", DISPLAY_WITH_GENERIC), //
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java
index 8fb68e0e9..a49f90cda 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java
@@ -107,7 +107,8 @@ public class CommandCreateClassMultilines extends CommandMultilines2"))), //
+ new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(), new RegexLeaf("GENERIC", "\\<("
+ + GenericRegexProducer.PATTERN + ")\\>"))), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.+\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
@@ -117,9 +118,12 @@ public class CommandCreateClassMultilines extends CommandMultilines2
}
private static RegexConcat getRegexConcat(Mode mode) {
-
- // String regex = "(?:(actor|usecase|component)[%s]+)";
- String regex = "(?:(state|" + CommandCreateElementFull.ALL_TYPES + ")[%s]+)";
+ String regex = "(state|" + CommandCreateElementFull.ALL_TYPES + ")";
if (mode == Mode.WITH_MIX_PREFIX) {
- regex = "mix_" + regex;
+ return RegexConcat.build(CommandCreateElementFull2.class.getName() + mode, //
+ RegexLeaf.start(), //
+ new RegexLeaf("mix_"), //
+ new RegexLeaf("SYMBOL", regex), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexOr(//
+ new RegexLeaf("CODE1", CommandCreateElementFull.CODE_WITH_QUOTE), //
+ new RegexConcat(//
+ new RegexLeaf("DISPLAY2", CommandCreateElementFull.DISPLAY), //
+ new RegexOptional( //
+ new RegexConcat( //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("STEREOTYPE2", "(\\<\\<.+\\>\\>)") //
+ )), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("as"), //
+ RegexLeaf.spaceOneOrMore(), //
+ new RegexLeaf("CODE2", CommandCreateElementFull.CODE)) //
+ ), //
+ new RegexOptional( //
+ new RegexConcat( //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("STEREOTYPE", "(\\<\\<.+\\>\\>)")//
+ )), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ ColorParser.exp1(), //
+ RegexLeaf.end());
}
- return RegexConcat.build(CommandCreateElementFull2.class.getName() + mode, RegexLeaf.start(), //
+ return RegexConcat.build(CommandCreateElementFull2.class.getName() + mode, //
+ RegexLeaf.start(), //
new RegexLeaf("SYMBOL", regex), //
- RegexLeaf.spaceZeroOrMore(), //
+ RegexLeaf.spaceOneOrMore(), //
new RegexOr(//
new RegexLeaf("CODE1", CommandCreateElementFull.CODE_WITH_QUOTE), //
new RegexConcat(//
@@ -107,7 +136,8 @@ public class CommandCreateElementFull2 extends SingleLineCommand2
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
RegexLeaf.spaceZeroOrMore(), //
- ColorParser.exp1(), RegexLeaf.end());
+ ColorParser.exp1(), //
+ RegexLeaf.end());
}
@Override
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java
index 2750991a2..ee7958167 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java
@@ -54,7 +54,7 @@ public class CommandHideShow2 extends SingleLineCommand2 {
return RegexConcat.build(CommandHideShow2.class.getName(), RegexLeaf.start(), //
new RegexLeaf("COMMAND", "(hide|hide-class|show|show-class)"), //
RegexLeaf.spaceOneOrMore(), //
- new RegexLeaf("WHAT", "(.+)"), //
+ new RegexLeaf("WHAT", "([^%s]+|\\<\\<.*\\>\\>)"), //
RegexLeaf.end());
}
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java
index d214a8dd1..b60ad093b 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowByGender.java
@@ -81,7 +81,7 @@ public class CommandHideShowByGender extends SingleLineCommand2 {
new RegexLeaf("EMPTY", "(empty)"), //
RegexLeaf.spaceOneOrMore()) //
), //
- new RegexLeaf("PORTION", "(members?|attributes?|fields?|methods?|circle\\w*|stereotypes?)"), //
+ new RegexLeaf("PORTION", "(members?|attributes?|fields?|methods?|circles?|circled?|stereotypes?)"), //
RegexLeaf.end());
}
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandImport.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandImport.java
index 0fd64eb09..e14ebc936 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandImport.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandImport.java
@@ -105,16 +105,17 @@ public class CommandImport extends SingleLineCommand2 {
// }
}
- private void includeFileJava(ClassDiagram classDiagram, final File f) throws IOException {
+ private void includeFileJava(ClassDiagram diagram, final File f) throws IOException {
final JavaFile javaFile = new JavaFile(f);
for (JavaClass cl : javaFile.getJavaClasses()) {
final Code name = Code.of(cl.getName());
- final IEntity ent1 = classDiagram.getOrCreateLeaf(name, cl.getType(), null);
+ final IEntity ent1 = diagram.getOrCreateLeaf(name, cl.getType(), null);
for (String p : cl.getParents()) {
- final IEntity ent2 = classDiagram.getOrCreateLeaf(Code.of(p), cl.getParentType(), null);
- final Link link = new Link(ent2, ent1, new LinkType(LinkDecor.NONE, LinkDecor.EXTENDS), Display.NULL, 2);
- classDiagram.addLink(link);
+ final IEntity ent2 = diagram.getOrCreateLeaf(Code.of(p), cl.getParentType(), null);
+ final Link link = new Link(ent2, ent1, new LinkType(LinkDecor.NONE, LinkDecor.EXTENDS), Display.NULL,
+ 2, diagram.getSkinParam().getCurrentStyleBuilder());
+ diagram.addLink(link);
}
}
}
diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java
index d4426f0d4..a05f57f0b 100644
--- a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java
+++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java
@@ -257,7 +257,7 @@ final public class CommandLinkClass extends SingleLineCommand2 implements Command {
private final SingleLineCommand2 cmd;
private final boolean removeEmptyColumn;
private final int nbMaxLines;
-
+
public CommandDecoratorMultine(SingleLineCommand2 cmd, int nbMaxLines) {
this(cmd, false, nbMaxLines);
}
diff --git a/src/net/sourceforge/plantuml/command/CommandFooter.java b/src/net/sourceforge/plantuml/command/CommandFooter.java
index 9a4d66692..29018a800 100644
--- a/src/net/sourceforge/plantuml/command/CommandFooter.java
+++ b/src/net/sourceforge/plantuml/command/CommandFooter.java
@@ -35,8 +35,12 @@
*/
package net.sourceforge.plantuml.command;
+import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.LineLocation;
+import net.sourceforge.plantuml.OptionFlags;
+import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.TitledDiagram;
+import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
@@ -45,6 +49,7 @@ import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.style.PName;
public class CommandFooter extends SingleLineCommand2 {
@@ -67,8 +72,14 @@ public class CommandFooter extends SingleLineCommand2 {
@Override
protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) {
final String align = arg.get("POSITION", 0);
- diagram.getFooter().put(Display.getWithNewlines(arg.get("LABEL", 0)),
- HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER));
+ HorizontalAlignment defaultAlign = HorizontalAlignment.CENTER;
+ if (SkinParam.USE_STYLES()) {
+ defaultAlign = FontParam.FOOTER.getStyleDefinition()
+ .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
+ .value(PName.HorizontalAlignment).asHorizontalAlignment();
+ }
+ diagram.getFooter().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)),
+ HorizontalAlignment.fromString(align, defaultAlign));
return CommandExecutionResult.ok();
}
}
diff --git a/src/net/sourceforge/plantuml/command/CommandHeader.java b/src/net/sourceforge/plantuml/command/CommandHeader.java
index a909b1900..f58136a47 100644
--- a/src/net/sourceforge/plantuml/command/CommandHeader.java
+++ b/src/net/sourceforge/plantuml/command/CommandHeader.java
@@ -35,8 +35,12 @@
*/
package net.sourceforge.plantuml.command;
+import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.LineLocation;
+import net.sourceforge.plantuml.OptionFlags;
+import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.TitledDiagram;
+import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
@@ -45,6 +49,7 @@ import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.style.PName;
public class CommandHeader extends SingleLineCommand2 {
@@ -69,8 +74,14 @@ public class CommandHeader extends SingleLineCommand2 {
@Override
protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) {
final String align = arg.get("POSITION", 0);
- diagram.getHeader().put(Display.getWithNewlines(arg.get("LABEL", 0)),
- HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT));
+ HorizontalAlignment defaultAlign = HorizontalAlignment.RIGHT;
+ if (SkinParam.USE_STYLES()) {
+ defaultAlign = FontParam.HEADER.getStyleDefinition()
+ .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
+ .value(PName.HorizontalAlignment).asHorizontalAlignment();
+ }
+ diagram.getHeader().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)),
+ HorizontalAlignment.fromString(align, defaultAlign));
return CommandExecutionResult.ok();
}
}
diff --git a/src/net/sourceforge/plantuml/command/CommandHideUnlinked.java b/src/net/sourceforge/plantuml/command/CommandHideUnlinked.java
index fb9de180a..ce5454481 100644
--- a/src/net/sourceforge/plantuml/command/CommandHideUnlinked.java
+++ b/src/net/sourceforge/plantuml/command/CommandHideUnlinked.java
@@ -52,7 +52,8 @@ public class CommandHideUnlinked extends SingleLineCommand2 {
return RegexConcat.build(CommandHideUnlinked.class.getName(), RegexLeaf.start(), //
new RegexLeaf("HIDE", "(hide|show)"), //
RegexLeaf.spaceOneOrMore(), //
- new RegexLeaf("unlinked"), RegexLeaf.end()); //
+ new RegexLeaf("unlinked"), //
+ RegexLeaf.end()); //
}
@Override
diff --git a/src/net/sourceforge/plantuml/command/CommandMultilines.java b/src/net/sourceforge/plantuml/command/CommandMultilines.java
index ad6386b88..6f4f8eec7 100644
--- a/src/net/sourceforge/plantuml/command/CommandMultilines.java
+++ b/src/net/sourceforge/plantuml/command/CommandMultilines.java
@@ -43,7 +43,7 @@ import net.sourceforge.plantuml.core.Diagram;
public abstract class CommandMultilines implements Command {
private final Pattern2 starting;
-
+
public CommandMultilines(String patternStart) {
if (patternStart.startsWith("(?i)^") == false || patternStart.endsWith("$") == false) {
throw new IllegalArgumentException("Bad pattern " + patternStart);
diff --git a/src/net/sourceforge/plantuml/command/CommandMultilines2.java b/src/net/sourceforge/plantuml/command/CommandMultilines2.java
index c13bcb9cf..cad3ae205 100644
--- a/src/net/sourceforge/plantuml/command/CommandMultilines2.java
+++ b/src/net/sourceforge/plantuml/command/CommandMultilines2.java
@@ -36,7 +36,6 @@
package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.StringLocated;
-import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
@@ -47,7 +46,7 @@ public abstract class CommandMultilines2 implements Command implements Command implements Command {
private final Pattern2 starting;
-
+
public CommandMultilinesBracket(String patternStart) {
if (patternStart.startsWith("(?i)^") == false || patternStart.endsWith("$") == false) {
throw new IllegalArgumentException("Bad pattern " + patternStart);
diff --git a/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java b/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java
index 017a68a2a..d21fb031c 100644
--- a/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java
+++ b/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java
@@ -35,10 +35,15 @@
*/
package net.sourceforge.plantuml.command;
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.OptionFlags;
+import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.TitledDiagram;
+import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.style.PName;
public class CommandMultilinesFooter extends CommandMultilines {
@@ -61,7 +66,13 @@ public class CommandMultilinesFooter extends CommandMultilines {
lines = lines.subExtract(1, 1);
final Display strings = lines.toDisplay();
if (strings.size() > 0) {
- diagram.getFooter().put(strings, HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER));
+ HorizontalAlignment defaultAlign = HorizontalAlignment.CENTER;
+ if (SkinParam.USE_STYLES()) {
+ defaultAlign = FontParam.FOOTER.getStyleDefinition()
+ .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
+ .value(PName.HorizontalAlignment).asHorizontalAlignment();
+ }
+ diagram.getFooter().putDisplay(strings, HorizontalAlignment.fromString(align, defaultAlign));
return CommandExecutionResult.ok();
}
return CommandExecutionResult.error("Empty footer");
diff --git a/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java b/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java
index 83d4c9c3f..f164a3454 100644
--- a/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java
+++ b/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java
@@ -35,10 +35,15 @@
*/
package net.sourceforge.plantuml.command;
+import net.sourceforge.plantuml.FontParam;
+import net.sourceforge.plantuml.OptionFlags;
+import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.TitledDiagram;
+import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
+import net.sourceforge.plantuml.style.PName;
public class CommandMultilinesHeader extends CommandMultilines {
@@ -61,7 +66,13 @@ public class CommandMultilinesHeader extends CommandMultilines {
lines = lines.subExtract(1, 1);
final Display strings = lines.toDisplay();
if (strings.size() > 0) {
- diagram.getHeader().put(strings, HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT));
+ HorizontalAlignment defaultAlign = HorizontalAlignment.RIGHT;
+ if (SkinParam.USE_STYLES()) {
+ defaultAlign = FontParam.HEADER.getStyleDefinition()
+ .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder())
+ .value(PName.HorizontalAlignment).asHorizontalAlignment();
+ }
+ diagram.getHeader().putDisplay(strings, HorizontalAlignment.fromString(align, defaultAlign));
return CommandExecutionResult.ok();
}
return CommandExecutionResult.error("Empty header");
diff --git a/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java b/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java
index 3437506e7..f114e7c63 100644
--- a/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java
+++ b/src/net/sourceforge/plantuml/command/CommandPackageEmpty.java
@@ -73,7 +73,10 @@ public class CommandPackageEmpty extends SingleLineCommand2 {
return RegexConcat.build(CommandRankDir.class.getName(), RegexLeaf.start(), //
new RegexLeaf("DIRECTION", "(left[%s]to[%s]right|top[%s]to[%s]bottom)"), //
RegexLeaf.spaceOneOrMore(), //
- new RegexLeaf("direction"), RegexLeaf.end()); //
+ new RegexLeaf("direction"), //
+ RegexLeaf.end()); //
}
@Override
diff --git a/src/net/sourceforge/plantuml/command/MultilinesStrategy.java b/src/net/sourceforge/plantuml/command/MultilinesStrategy.java
index 3971be9c4..cc730f513 100644
--- a/src/net/sourceforge/plantuml/command/MultilinesStrategy.java
+++ b/src/net/sourceforge/plantuml/command/MultilinesStrategy.java
@@ -39,7 +39,6 @@ import java.util.Iterator;
import java.util.List;
import net.sourceforge.plantuml.StringLocated;
-import net.sourceforge.plantuml.StringUtils;
public enum MultilinesStrategy {
REMOVE_STARTING_QUOTE, KEEP_STARTING_QUOTE;
diff --git a/src/net/sourceforge/plantuml/command/SingleLineCommand2.java b/src/net/sourceforge/plantuml/command/SingleLineCommand2.java
index b13b5b929..f3f9eb3f3 100644
--- a/src/net/sourceforge/plantuml/command/SingleLineCommand2.java
+++ b/src/net/sourceforge/plantuml/command/SingleLineCommand2.java
@@ -46,7 +46,7 @@ public abstract class SingleLineCommand2 implements Command implements Command {
+public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactoryCommand {
private IRegex getRegexConcatMultiLine() {
- return RegexConcat.build(FactorySequenceNoteAccrossCommand.class.getName() + "multi", RegexLeaf.start(), //
+ return RegexConcat.build(FactorySequenceNoteAcrossCommand.class.getName() + "multi", RegexLeaf.start(), //
new RegexLeaf("VMERGE", "(/)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("accross"), //
+ new RegexLeaf("ACROSS", "(accross|across)"), //
RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), //
@@ -81,14 +81,14 @@ public final class FactorySequenceNoteAccrossCommand implements SingleMultiFacto
}
private IRegex getRegexConcatSingleLine() {
- return RegexConcat.build(FactorySequenceNoteAccrossCommand.class.getName() + "single", RegexLeaf.start(), //
+ return RegexConcat.build(FactorySequenceNoteAcrossCommand.class.getName() + "single", RegexLeaf.start(), //
new RegexLeaf("VMERGE", "(/)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), //
RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("accross"), //
+ new RegexLeaf("ACROSS", "(accross|across)"), //
RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), //
@@ -142,21 +142,27 @@ public final class FactorySequenceNoteAccrossCommand implements SingleMultiFacto
// final Participant p2 = diagram.getOrCreateParticipant(StringUtils
// .eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P2", 0)));
+ final String across = line0.get("ACROSS", 0);
+ if (across.equalsIgnoreCase("accross")) {
+ return CommandExecutionResult.error("Use 'across' instead of 'accross'");
+ }
+
if (lines.size() > 0) {
final boolean tryMerge = line0.get("VMERGE", 0) != null;
final Display display = diagram.manageVariable(lines.toDisplay());
- final Note note = new Note((Participant) null, (Participant) null, display);
+ final Note note = new Note((Participant) null, (Participant) null, display, diagram.getSkinParam().getCurrentStyleBuilder());
Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
final String stereotypeString = line0.get("STEREO", 0);
if (stereotypeString != null) {
final Stereotype stereotype = new Stereotype(stereotypeString);
colors = colors.applyStereotypeForNote(stereotype, diagram.getSkinParam(), FontParam.NOTE,
ColorParam.noteBackground, ColorParam.noteBorder);
+ note.setStereotype(stereotype);
}
note.setColors(colors);
// note.setSpecificColorTOBEREMOVED(ColorType.BACK,
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
- note.setStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0)));
+ note.setNoteStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0)));
if (line0.get("URL", 0) != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
final Url urlLink = urlBuilder.getUrl(line0.get("URL", 0));
diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java
index 62c238d67..85456cf2d 100644
--- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java
+++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java
@@ -132,9 +132,9 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
return new SingleLineCommand2(getRegexConcatSingleLine()) {
@Override
- protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location,
+ protected CommandExecutionResult executeArg(final SequenceDiagram diagram, LineLocation location,
RegexResult arg) {
- return executeInternal(system, arg, BlocLines.getWithNewlines(arg.get("NOTE", 0)));
+ return executeInternal(diagram, arg, BlocLines.getWithNewlines(arg.get("NOTE", 0)));
}
};
@@ -150,16 +150,17 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
final boolean tryMerge = arg.get("VMERGE", 0) != null;
final boolean parallel = arg.get("PARALLEL", 0) != null;
final Display display = diagram.manageVariable(strings.toDisplay());
- final Note note = new Note(p, position, display);
+ final Note note = new Note(p, position, display, diagram.getSkinParam().getCurrentStyleBuilder());
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final String stereotypeString = arg.get("STEREO", 0);
if (stereotypeString != null) {
final Stereotype stereotype = new Stereotype(stereotypeString);
colors = colors.applyStereotypeForNote(stereotype, diagram.getSkinParam(), FontParam.NOTE,
ColorParam.noteBackground, ColorParam.noteBorder);
+ note.setStereotype(stereotype);
}
note.setColors(colors);
- note.setStyle(NoteStyle.getNoteStyle(arg.get("STYLE", 0)));
+ note.setNoteStyle(NoteStyle.getNoteStyle(arg.get("STYLE", 0)));
if (arg.get("URL", 0) != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
final Url urlLink = urlBuilder.getUrl(arg.get("URL", 0));
diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java
index f14da7ac9..054b37b47 100644
--- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java
+++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java
@@ -122,37 +122,38 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
return "(?i)^[%s]*end[%s]?note$";
}
- protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) {
+ protected CommandExecutionResult executeNow(final SequenceDiagram diagram, BlocLines lines) {
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
- return executeInternal(system, line0, lines);
+ return executeInternal(diagram, line0, lines);
}
};
}
- private CommandExecutionResult executeInternal(SequenceDiagram system, final RegexResult line0, BlocLines lines) {
- final EventWithDeactivate m = system.getLastEventWithDeactivate();
+ private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines) {
+ final EventWithDeactivate m = diagram.getLastEventWithDeactivate();
if (m instanceof AbstractMessage || m instanceof GroupingLeaf) {
final NotePosition position = NotePosition.valueOf(StringUtils.goUpperCase(line0.get("POSITION", 0)));
Url url = null;
if (line0.get("URL", 0) != null) {
- final UrlBuilder urlBuilder = new UrlBuilder(system.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
+ final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
url = urlBuilder.getUrl(line0.get("URL", 0));
}
final NoteStyle style = NoteStyle.getNoteStyle(line0.get("STYLE", 0));
- final Display display = system.manageVariable(lines.toDisplay());
+ final Display display = diagram.manageVariable(lines.toDisplay());
final String backcolor0 = line0.get("COLOR", 0);
Colors colors = Colors.empty().add(ColorType.BACK, HtmlColorSet.getInstance().getColorIfValid(backcolor0));
+ final Note note = new Note(display, position, style, diagram.getSkinParam().getCurrentStyleBuilder());
final String stereotypeString = line0.get("STEREO", 0);
if (stereotypeString != null) {
final Stereotype stereotype = new Stereotype(stereotypeString);
- colors = colors.applyStereotypeForNote(stereotype, system.getSkinParam(), FontParam.NOTE,
+ colors = colors.applyStereotypeForNote(stereotype, diagram.getSkinParam(), FontParam.NOTE,
ColorParam.noteBackground, ColorParam.noteBorder);
+ note.setStereotype(stereotype);
}
- final Note note = new Note(display, position, style);
note.setUrl(url);
note.setColors(colors);
if (m instanceof AbstractMessage) {
diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java
index 8dfc9b137..dbac9d126 100644
--- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java
+++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java
@@ -75,7 +75,9 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("over"), //
RegexLeaf.spaceOneOrMore(), //
- new RegexLeaf("P1", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*\\,"), //
+ new RegexLeaf("P1", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf(","), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("P2", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])"), //
RegexLeaf.spaceZeroOrMore(), //
@@ -95,7 +97,9 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("over"), //
RegexLeaf.spaceOneOrMore(), //
- new RegexLeaf("P1", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*\\,"), //
+ new RegexLeaf("P1", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])"), //
+ RegexLeaf.spaceZeroOrMore(), //
+ new RegexLeaf(","), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("P2", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])"), //
RegexLeaf.spaceZeroOrMore(), //
@@ -154,18 +158,19 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
if (lines.size() > 0) {
final boolean tryMerge = line0.get("VMERGE", 0) != null;
final Display display = diagram.manageVariable(lines.toDisplay());
- final Note note = new Note(p1, p2, display);
+ final Note note = new Note(p1, p2, display, diagram.getSkinParam().getCurrentStyleBuilder());
Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
final String stereotypeString = line0.get("STEREO", 0);
if (stereotypeString != null) {
final Stereotype stereotype = new Stereotype(stereotypeString);
colors = colors.applyStereotypeForNote(stereotype, diagram.getSkinParam(), FontParam.NOTE,
ColorParam.noteBackground, ColorParam.noteBorder);
+ note.setStereotype(stereotype);
}
note.setColors(colors);
// note.setSpecificColorTOBEREMOVED(ColorType.BACK,
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
- note.setStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0)));
+ note.setNoteStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0)));
if (line0.get("URL", 0) != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
final Url urlLink = urlBuilder.getUrl(line0.get("URL", 0));
diff --git a/src/net/sourceforge/plantuml/command/regex/IRegex.java b/src/net/sourceforge/plantuml/command/regex/IRegex.java
index 5ee34d867..ea6dad52b 100644
--- a/src/net/sourceforge/plantuml/command/regex/IRegex.java
+++ b/src/net/sourceforge/plantuml/command/regex/IRegex.java
@@ -51,5 +51,4 @@ public interface IRegex {
public boolean match(StringLocated full);
public RegexResult matcher(String full);
-
}
\ No newline at end of file
diff --git a/src/net/sourceforge/plantuml/command/regex/RegexComposed.java b/src/net/sourceforge/plantuml/command/regex/RegexComposed.java
index 47f546cad..4b2e8988d 100644
--- a/src/net/sourceforge/plantuml/command/regex/RegexComposed.java
+++ b/src/net/sourceforge/plantuml/command/regex/RegexComposed.java
@@ -61,7 +61,7 @@ public abstract class RegexComposed implements IRegex {
}
return fullCached;
}
-
+
protected boolean isCompiled() {
return fullCached != null;
}
diff --git a/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java b/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java
index 8a7e441be..ec8f6ce73 100644
--- a/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java
+++ b/src/net/sourceforge/plantuml/command/regex/RegexLeaf.java
@@ -40,6 +40,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import java.util.StringTokenizer;
import java.util.regex.Pattern;
import net.sourceforge.plantuml.StringLocated;
@@ -76,6 +77,17 @@ public class RegexLeaf implements IRegex {
public RegexLeaf(String name, String regex) {
this.pattern = regex;
this.name = name;
+ // unknow=(left[%s]to[%s]right|top[%s]to[%s]bottom)
+ // unknow=is off on
+ // unknow=(-+)\>
+ // unknow=\[([^\[\]]+?)\]
+ // unknow=([*]+)
+
+ // if (regex.equals("([*]+)") || regex.equals("\\[([^\\[\\]]+?)\\]") || regex.equals("(-+)\\>")
+ // || regex.equals("is off on")) {
+ // Thread.dumpStack();
+ // System.exit(0);
+ // }
}
@Override
@@ -119,9 +131,25 @@ public class RegexLeaf implements IRegex {
}
static private final Set UNKNOWN = new HashSet();
-
- static private final Pattern p1 = Pattern.compile("^[-0A-Za-z_!:@;/=]+$");
- static private final Pattern p2 = Pattern.compile("^[-0A-Za-z_!:@;/=]+\\?$");
+
+ static private final Pattern p1 = Pattern.compile("^[-0A-Za-z_!:@;/=,\"]+$");
+ static private final Pattern p2 = Pattern.compile("^[-0A-Za-z_!:@;/=,\"]+\\?$");
+ static private final Pattern p3 = Pattern
+ .compile("^\\(?[-0A-Za-z_!:@;/=\" ]+\\??(\\|[-0A-Za-z_!:@;/=,\" ]+\\??)+\\)?$");
+
+ private static long getSignatureP3(String s) {
+ long result = -1L;
+ for (StringTokenizer st = new StringTokenizer(s, "()|"); st.hasMoreTokens();) {
+ final String val = st.nextToken();
+ final long sig = FoxSignature.getFoxSignature(val.endsWith("?") ? val.substring(0, val.length() - 2) : val);
+ result = result & sig;
+ }
+ return result;
+ }
+
+ public long getFoxSignatureNone() {
+ return 0;
+ }
public long getFoxSignature() {
if (p1.matcher(pattern).matches()) {
@@ -130,9 +158,29 @@ public class RegexLeaf implements IRegex {
if (p2.matcher(pattern).matches()) {
return FoxSignature.getFoxSignature(pattern.substring(0, pattern.length() - 2));
}
- if (pattern.length() == 2 && pattern.startsWith("\\")) {
+ if (p3.matcher(pattern).matches()) {
+ // System.err.println("special " + pattern);
+ // System.err.println("result " + FoxSignature.backToString(getSignatureP3(pattern)));
+ return getSignatureP3(pattern);
+ }
+ if (pattern.length() == 2 && pattern.startsWith("\\") && Character.isLetterOrDigit(pattern.charAt(1)) == false) {
return FoxSignature.getFoxSignature(pattern.substring(1));
}
+ if (pattern.equals("\\<\\>") || pattern.equals("(\\<\\<.*\\>\\>)")) {
+ return FoxSignature.getFoxSignature("<>");
+ }
+ if (pattern.equals("\\<-\\>")) {
+ return FoxSignature.getFoxSignature("<->");
+ }
+ if (pattern.equals("(-+)")) {
+ return FoxSignature.getFoxSignature("-");
+ }
+ if (pattern.equals("\\|+") || pattern.equals("\\|\\|")) {
+ return FoxSignature.getFoxSignature("|");
+ }
+ if (pattern.equals("([*]+)")) {
+ return FoxSignature.getFoxSignature("*");
+ }
if (pattern.equals("[%s]+") || pattern.equals("[%s]*")) {
return 0;
}
diff --git a/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java b/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java
index 0d229fe9b..e3e3193ec 100644
--- a/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java
+++ b/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java
@@ -91,7 +91,7 @@ public class CommandLinkBlock extends SingleLineCommand2 {
final String queue = arg.get("QUEUE", 0);
- final Link link = new Link(cl1, cl2, linkType, Display.getWithNewlines(arg.get("DISPLAY", 0)), queue.length());
+ final Link link = new Link(cl1, cl2, linkType, Display.getWithNewlines(arg.get("DISPLAY", 0)), queue.length(), diagram.getSkinParam().getCurrentStyleBuilder());
diagram.addLink(link);
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/Display.java b/src/net/sourceforge/plantuml/cucadiagram/Display.java
index 134a3eb21..ec7109841 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/Display.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/Display.java
@@ -83,33 +83,17 @@ public class Display implements Iterable {
public final static Display NULL = new Display(null, null, true, CreoleMode.FULL);
- private void check() {
- // if (displayData != null)
- // for (CharSequence s : displayData) {
- // if (s == null) {
- // continue;
- // }
- // if (s instanceof String) {
- // continue;
- // }
- // if (s instanceof Stereotype) {
- // continue;
- // }
- // // if (s instanceof CharSequence2) {
- // // continue;
- // // }
- // if (s instanceof MessageNumber) {
- // continue;
- // }
- // if (s instanceof EmbeddedDiagram) {
- // continue;
- // }
- // System.err.println("PB=" + s);
- // System.err.println("PB=" + s.getClass());
- // for (int i = 0; i < 100; i++)
- // Thread.dumpStack();
- // System.exit(0);
- // }
+ public Display withoutStereotype() {
+ final List copy = new ArrayList(displayData);
+ final Display result = new Display(naturalHorizontalAlignment, isNull, defaultCreoleMode);
+ for (Iterator it = copy.iterator(); it.hasNext();) {
+ final CharSequence cs = it.next();
+ if (cs instanceof Stereotype) {
+ it.remove();
+ }
+ }
+ result.displayData.addAll(copy);
+ return result;
}
public Display replaceBackslashT() {
@@ -120,7 +104,6 @@ public class Display implements Iterable {
result.displayData.set(i, s.toString().replace("\\t", "\t"));
}
}
- result.check();
return result;
}
@@ -214,7 +197,6 @@ public class Display implements Iterable {
private Display(Display other, CreoleMode mode) {
this(other.naturalHorizontalAlignment, other.isNull, mode);
this.displayData.addAll(other.displayData);
- this.check();
}
private Display(HorizontalAlignment naturalHorizontalAlignment, boolean isNull, CreoleMode defaultCreoleMode) {
@@ -222,7 +204,6 @@ public class Display implements Iterable {
this.isNull = isNull;
this.displayData = isNull ? null : new ArrayList();
this.naturalHorizontalAlignment = isNull ? null : naturalHorizontalAlignment;
- this.check();
}
private Display(Collection extends CharSequence> other, HorizontalAlignment naturalHorizontalAlignment,
@@ -231,7 +212,6 @@ public class Display implements Iterable {
if (isNull == false) {
this.displayData.addAll(manageEmbeddedDiagrams(other));
}
- this.check();
}
private static List manageEmbeddedDiagrams(final Collection extends CharSequence> strings) {
@@ -325,21 +305,18 @@ public class Display implements Iterable {
public Display addAll(Display other) {
final Display result = new Display(this, this.defaultCreoleMode);
result.displayData.addAll(other.displayData);
- result.check();
return result;
}
public Display addFirst(CharSequence s) {
final Display result = new Display(this, this.defaultCreoleMode);
result.displayData.add(0, s);
- result.check();
return result;
}
public Display add(CharSequence s) {
final Display result = new Display(this, this.defaultCreoleMode);
result.displayData.add(s);
- result.check();
return result;
}
@@ -351,7 +328,6 @@ public class Display implements Iterable {
} else {
result.displayData.set(size - 1, displayData.get(size - 1) + "<" + s + ">");
}
- result.check();
return result;
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/DisplaySection.java b/src/net/sourceforge/plantuml/cucadiagram/DisplaySection.java
index 26de94330..1e13f8869 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/DisplaySection.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/DisplaySection.java
@@ -39,15 +39,13 @@ import java.util.EnumMap;
import java.util.Map;
import net.sourceforge.plantuml.ISkinSimple;
+import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.TextBlock;
public class DisplaySection {
- // private final Display display;
- // private final HorizontalAlignment horizontalAlignment;
-
private final Map map = new EnumMap(
HorizontalAlignment.class);
@@ -62,13 +60,15 @@ public class DisplaySection {
return result;
}
- // public static DisplaySection single(Display display, HorizontalAlignment horizontalAlignment) {
- // return new DisplaySection(display, horizontalAlignment);
- // }
+ public Display getDisplay() {
+ if (map.size() == 0) {
+ return null;
+ }
+ return map.values().iterator().next();
+ }
public static DisplaySection none() {
return new DisplaySection();
- // return new DisplaySection(Display.NULL, horizontalAlignment);
}
public final HorizontalAlignment getHorizontalAlignment() {
@@ -94,10 +94,13 @@ public class DisplaySection {
if (Display.isNull(display) || display.size() == 0) {
return null;
}
+ // if (SkinParam.USE_STYLES()) {
+ // throw new UnsupportedOperationException();
+ // }
return display.create(fontConfiguration, getHorizontalAlignment(), spriteContainer);
}
- public void put(Display display, HorizontalAlignment horizontalAlignment) {
+ public void putDisplay(Display display, HorizontalAlignment horizontalAlignment) {
this.map.put(horizontalAlignment, display);
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/Link.java b/src/net/sourceforge/plantuml/cucadiagram/Link.java
index 814e51ba7..305d77050 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/Link.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/Link.java
@@ -52,12 +52,17 @@ import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.USymbolInterface;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.VisibilityModifier;
+import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.svek.Bibliotekon;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.utils.UniqueSequence;
public class Link extends WithLinkType implements Hideable, Removeable {
+ public final StyleBuilder getStyleBuilder() {
+ return styleBuilder;
+ }
+
final private IEntity cl1;
final private IEntity cl2;
@@ -90,20 +95,22 @@ public class Link extends WithLinkType implements Hideable, Removeable {
private boolean horizontalSolitary;
private String sametail;
private VisibilityModifier visibilityModifier;
+ private final StyleBuilder styleBuilder;
private Url url;
- public Link(IEntity cl1, IEntity cl2, LinkType type, Display label, int length) {
- this(cl1, cl2, type, label, length, null, null, null, null, null);
+ public Link(IEntity cl1, IEntity cl2, LinkType type, Display label, int length, StyleBuilder styleBuilder) {
+ this(cl1, cl2, type, label, length, null, null, null, null, null, styleBuilder);
}
public Link(IEntity cl1, IEntity cl2, LinkType type, Display label, int length, String qualifier1,
- String qualifier2, String labeldistance, String labelangle) {
- this(cl1, cl2, type, label, length, qualifier1, qualifier2, labeldistance, labelangle, null);
+ String qualifier2, String labeldistance, String labelangle, StyleBuilder styleBuilder) {
+ this(cl1, cl2, type, label, length, qualifier1, qualifier2, labeldistance, labelangle, null, styleBuilder);
}
public Link(IEntity cl1, IEntity cl2, LinkType type, Display label, int length, String qualifier1,
- String qualifier2, String labeldistance, String labelangle, HtmlColor specificColor) {
+ String qualifier2, String labeldistance, String labelangle, HtmlColor specificColor,
+ StyleBuilder styleBuilder) {
if (length < 1) {
throw new IllegalArgumentException();
}
@@ -114,6 +121,7 @@ public class Link extends WithLinkType implements Hideable, Removeable {
throw new IllegalArgumentException();
}
+ this.styleBuilder = styleBuilder;
this.cl1 = cl1;
this.cl2 = cl2;
this.type = type;
@@ -160,7 +168,7 @@ public class Link extends WithLinkType implements Hideable, Removeable {
// cl2.setXposition(x-1);
// }
final Link result = new Link(cl2, cl1, getType().getInversed(), label, length, qualifier2, qualifier1,
- labeldistance, labelangle, getSpecificColor());
+ labeldistance, labelangle, getSpecificColor(), styleBuilder);
result.inverted = !this.inverted;
result.port1 = this.port2;
result.port2 = this.port1;
diff --git a/src/net/sourceforge/plantuml/cucadiagram/Magma.java b/src/net/sourceforge/plantuml/cucadiagram/Magma.java
index 55fbfc07c..88b2cf8f0 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/Magma.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/Magma.java
@@ -39,23 +39,25 @@ import java.util.List;
class Magma {
- private final CucaDiagram system;
+ private final CucaDiagram diagram;
private final List standalones;
private final LinkType linkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getInvisible();
public Magma(CucaDiagram system, List standalones) {
- this.system = system;
+ this.diagram = system;
this.standalones = standalones;
}
public void putInSquare() {
final SquareLinker linker = new SquareLinker() {
public void topDown(ILeaf top, ILeaf down) {
- system.addLink(new Link(top, down, linkType, Display.NULL, 2));
+ diagram.addLink(new Link(top, down, linkType, Display.NULL, 2, diagram.getSkinParam()
+ .getCurrentStyleBuilder()));
}
public void leftRight(ILeaf left, ILeaf right) {
- system.addLink(new Link(left, right, linkType, Display.NULL, 1));
+ diagram.addLink(new Link(left, right, linkType, Display.NULL, 1, diagram.getSkinParam()
+ .getCurrentStyleBuilder()));
}
};
new SquareMaker().putInSquare(standalones, linker);
@@ -101,12 +103,14 @@ class Magma {
}
public void linkToDown(Magma down) {
- system.addLink(new Link(this.getBottomLeft(), down.getTopLeft(), linkType, Display.NULL, 2));
+ diagram.addLink(new Link(this.getBottomLeft(), down.getTopLeft(), linkType, Display.NULL, 2, diagram
+ .getSkinParam().getCurrentStyleBuilder()));
}
public void linkToRight(Magma right) {
- system.addLink(new Link(this.getTopRight(), right.getTopLeft(), linkType, Display.NULL, 1));
+ diagram.addLink(new Link(this.getTopRight(), right.getTopLeft(), linkType, Display.NULL, 1, diagram
+ .getSkinParam().getCurrentStyleBuilder()));
}
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java b/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java
index 6f2d3b6a9..a82530f95 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java
@@ -58,6 +58,8 @@ import net.sourceforge.plantuml.graphic.HtmlColor;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.IHtmlColorSet;
import net.sourceforge.plantuml.graphic.TextBlock;
+import net.sourceforge.plantuml.style.Style;
+import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.sprite.Sprite;
@@ -269,6 +271,24 @@ public class Stereotype implements CharSequence {
return cutLabels(labelLocal, guillemet);
}
+ public List