2015-04-07 18:26:58 +00:00
|
|
|
/* ========================================================================
|
|
|
|
* PlantUML : a free UML diagram generator
|
|
|
|
* ========================================================================
|
|
|
|
*
|
2016-01-09 12:15:40 +00:00
|
|
|
* (C) Copyright 2009-2017, Arnaud Roques
|
2015-04-07 18:26:58 +00:00
|
|
|
*
|
|
|
|
* Project Info: http://plantuml.sourceforge.net
|
|
|
|
*
|
|
|
|
* This file is part of PlantUML.
|
|
|
|
*
|
|
|
|
* PlantUML is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* PlantUML distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
|
|
* License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
|
|
* USA.
|
|
|
|
*
|
|
|
|
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
|
|
|
* in the United States and other countries.]
|
|
|
|
*
|
|
|
|
* Original Author: Arnaud Roques
|
|
|
|
*
|
|
|
|
* Revision $Revision: 4636 $
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
package net.sourceforge.plantuml.sequencediagram.teoz;
|
|
|
|
|
|
|
|
import java.awt.geom.Dimension2D;
|
|
|
|
|
|
|
|
import net.sourceforge.plantuml.ISkinParam;
|
2015-05-31 18:56:03 +00:00
|
|
|
import net.sourceforge.plantuml.SkinParamBackcolored;
|
2015-04-07 18:26:58 +00:00
|
|
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
|
|
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
|
|
|
import net.sourceforge.plantuml.real.Real;
|
|
|
|
import net.sourceforge.plantuml.sequencediagram.Event;
|
|
|
|
import net.sourceforge.plantuml.sequencediagram.GroupingLeaf;
|
|
|
|
import net.sourceforge.plantuml.skin.Component;
|
|
|
|
import net.sourceforge.plantuml.skin.ComponentType;
|
|
|
|
import net.sourceforge.plantuml.skin.Skin;
|
|
|
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
|
|
|
|
2015-05-31 18:56:03 +00:00
|
|
|
public class ElseTile implements TileWithCallbackY {
|
2015-04-07 18:26:58 +00:00
|
|
|
|
|
|
|
private final Skin skin;
|
|
|
|
private final ISkinParam skinParam;
|
|
|
|
private final GroupingLeaf anElse;
|
|
|
|
private final Tile parent;
|
2015-05-31 18:56:03 +00:00
|
|
|
|
2015-04-07 18:26:58 +00:00
|
|
|
public Event getEvent() {
|
|
|
|
return anElse;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ElseTile(GroupingLeaf anElse, Skin skin, ISkinParam skinParam, Tile parent) {
|
|
|
|
this.anElse = anElse;
|
|
|
|
this.skin = skin;
|
|
|
|
this.skinParam = skinParam;
|
|
|
|
this.parent = parent;
|
|
|
|
}
|
|
|
|
|
2015-06-07 10:23:10 +00:00
|
|
|
public Component getComponent(StringBounder stringBounder) {
|
2015-05-31 18:56:03 +00:00
|
|
|
// final Display display = Display.create(anElse.getTitle());
|
|
|
|
final ISkinParam tmp = new SkinParamBackcolored(skinParam, anElse.getBackColorElement(),
|
|
|
|
anElse.getBackColorGeneral());
|
|
|
|
|
|
|
|
final Display display = Display.create(anElse.getComment());
|
|
|
|
final Component comp = skin.createComponent(ComponentType.GROUPING_ELSE, null, tmp, display);
|
2015-04-07 18:26:58 +00:00
|
|
|
return comp;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void drawU(UGraphic ug) {
|
2015-06-07 10:23:10 +00:00
|
|
|
// final StringBounder stringBounder = ug.getStringBounder();
|
|
|
|
// final Component comp = getComponent(stringBounder);
|
|
|
|
// final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
|
|
|
// final Real min = getMinX(stringBounder);
|
|
|
|
// final Real max = getMaxX(stringBounder);
|
|
|
|
// final Context2D context = (Context2D) ug;
|
|
|
|
// double height = dim.getHeight();
|
|
|
|
// // if (context.isBackground() && parent instanceof GroupingTile) {
|
|
|
|
// // final double startingY = ((GroupingTile) parent).getStartY();
|
|
|
|
// // final double totalParentHeight = parent.getPreferredHeight(stringBounder);
|
|
|
|
// // height = totalParentHeight - (startingY - y);
|
|
|
|
// // }
|
|
|
|
// final Area area = new Area(max.getCurrentValue() - min.getCurrentValue(), height);
|
|
|
|
// ug = ug.apply(new UTranslate(min.getCurrentValue(), 0));
|
|
|
|
// comp.drawU(ug, area, context);
|
2015-04-07 18:26:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public double getPreferredHeight(StringBounder stringBounder) {
|
|
|
|
final Component comp = getComponent(stringBounder);
|
|
|
|
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
|
|
|
return dim.getHeight();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void addConstraints(StringBounder stringBounder) {
|
|
|
|
// final Component comp = getComponent(stringBounder);
|
|
|
|
// final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
|
|
|
// final double width = dim.getWidth();
|
|
|
|
}
|
|
|
|
|
|
|
|
public Real getMinX(StringBounder stringBounder) {
|
|
|
|
return parent.getMinX(stringBounder);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Real getMaxX(StringBounder stringBounder) {
|
2015-06-07 10:23:10 +00:00
|
|
|
final Component comp = getComponent(stringBounder);
|
|
|
|
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
|
|
|
|
return getMinX(stringBounder).addFixed(dim.getWidth());
|
2015-04-07 18:26:58 +00:00
|
|
|
}
|
|
|
|
|
2015-05-31 18:56:03 +00:00
|
|
|
private double y;
|
|
|
|
|
|
|
|
public void callbackY(double y) {
|
|
|
|
this.y = y;
|
|
|
|
}
|
|
|
|
|
2015-06-07 10:23:10 +00:00
|
|
|
public double getCallbackY() {
|
|
|
|
return y;
|
|
|
|
}
|
|
|
|
|
2015-04-07 18:26:58 +00:00
|
|
|
}
|