1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-17 07:32:24 +00:00
plantuml/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java

96 lines
4.0 KiB
Java
Raw Normal View History

2013-12-10 19:36:50 +00:00
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
2023-02-22 18:43:48 +00:00
* (C) Copyright 2009-2024, Arnaud Roques
2013-12-10 19:36:50 +00:00
*
2023-02-22 18:43:48 +00:00
* Project Info: https://plantuml.com
2013-12-10 19:36:50 +00:00
*
2017-03-15 19:13:31 +00:00
* If you like this project or if you find it useful, you can support us at:
*
2023-02-22 18:43:48 +00:00
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
2017-03-15 19:13:31 +00:00
*
2013-12-10 19:36:50 +00:00
* 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.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact;
import java.util.Collection;
2013-12-10 19:36:50 +00:00
import java.util.List;
import net.sourceforge.plantuml.activitydiagram3.Branch;
2015-09-28 20:42:17 +00:00
import net.sourceforge.plantuml.activitydiagram3.LinkRendering;
import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
2013-12-10 19:36:50 +00:00
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
2015-07-11 09:32:49 +00:00
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.ConditionalBuilder;
2023-02-02 17:59:43 +00:00
import net.sourceforge.plantuml.klimt.color.HColor;
2023-02-22 18:43:48 +00:00
import net.sourceforge.plantuml.skin.Pragma;
2023-12-11 17:34:23 +00:00
import net.sourceforge.plantuml.stereo.Stereotype;
2019-08-26 17:07:21 +00:00
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
2019-06-26 19:24:49 +00:00
import net.sourceforge.plantuml.svek.ConditionEndStyle;
2013-12-10 19:36:50 +00:00
import net.sourceforge.plantuml.svek.ConditionStyle;
2023-02-02 17:59:43 +00:00
import net.sourceforge.plantuml.url.Url;
2013-12-10 19:36:50 +00:00
public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
2016-01-09 12:15:40 +00:00
private final Pragma pragma;
2016-06-19 14:16:41 +00:00
public FtileFactoryDelegatorIf(FtileFactory factory, Pragma pragma) {
super(factory);
2016-01-09 12:15:40 +00:00
this.pragma = pragma;
2013-12-10 19:36:50 +00:00
}
@Override
2015-09-28 20:42:17 +00:00
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering, Url url, Collection<PositionedNote> notes, Stereotype stereotype,
StyleBuilder currentStyleBuilder) {
2013-12-10 19:36:50 +00:00
2016-06-19 14:16:41 +00:00
final ConditionStyle conditionStyle = skinParam().getConditionStyle();
2019-06-26 19:24:49 +00:00
final ConditionEndStyle conditionEndStyle = skinParam().getConditionEndStyle();
2015-04-07 18:18:37 +00:00
final Branch branch0 = thens.get(0);
2013-12-10 19:36:50 +00:00
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(currentStyleBuilder);
2023-12-11 17:34:23 +00:00
final Style styleDiamond = getDefaultStyleDefinitionDiamond().withTOBECHANGED(stereotype)
.getMergedStyle(currentStyleBuilder);
2023-02-22 18:43:48 +00:00
final HColor backColor = branch0.getColor() == null
? styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getIHtmlColorSet())
: branch0.getColor();
2018-08-26 12:09:50 +00:00
2013-12-10 19:36:50 +00:00
if (thens.size() > 1) {
2016-01-09 12:15:40 +00:00
if (pragma.useVerticalIf()/* OptionFlags.USE_IF_VERTICAL */)
2023-04-18 16:14:10 +00:00
return FtileIfLongVertical.create(swimlane, backColor, getFactory(), conditionStyle, thens, elseBranch,
topInlinkRendering, afterEndwhile, styleArrow, styleDiamond);
return FtileIfLongHorizontal.create(swimlane, backColor, getFactory(), conditionStyle, thens, elseBranch,
topInlinkRendering, afterEndwhile, styleArrow, styleDiamond);
2015-07-11 09:32:49 +00:00
}
2023-04-18 16:14:10 +00:00
return ConditionalBuilder.create(swimlane, backColor, getFactory(), conditionStyle, conditionEndStyle,
thens.get(0), elseBranch, skinParam(), getStringBounder(), url, styleArrow, styleDiamond, notes);
2016-01-09 12:15:40 +00:00
}
2013-12-10 19:36:50 +00:00
}