1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-27 12:13:32 +00:00
plantuml/src/net/sourceforge/plantuml/activitydiagram3/Branch.java

137 lines
3.7 KiB
Java
Raw Normal View History

2013-12-10 19:36:50 +00:00
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
2016-01-09 12:15:40 +00:00
* (C) Copyright 2009-2017, Arnaud Roques
2013-12-10 19:36:50 +00:00
*
2016-03-06 16:47:34 +00:00
* Project Info: http://plantuml.com
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;
import java.util.Collection;
2016-06-19 14:16:41 +00:00
import net.sourceforge.plantuml.ISkinParam;
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.Swimlane;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HtmlColor;
2016-05-11 21:31:47 +00:00
import net.sourceforge.plantuml.graphic.Rainbow;
2016-07-04 19:06:50 +00:00
import net.sourceforge.plantuml.graphic.color.Colors;
2013-12-10 19:36:50 +00:00
import net.sourceforge.plantuml.sequencediagram.NotePosition;
2016-05-19 18:41:37 +00:00
import net.sourceforge.plantuml.sequencediagram.NoteType;
2013-12-10 19:36:50 +00:00
public class Branch {
private final InstructionList list;
private final Display labelTest;
private final Display labelPositive;
2015-04-07 18:18:37 +00:00
private final HtmlColor color;
2016-05-11 21:31:47 +00:00
private LinkRendering inlinkRendering = LinkRendering.none();
2013-12-10 19:36:50 +00:00
private Ftile ftile;
2015-04-07 18:18:37 +00:00
public Branch(Swimlane swimlane, Display labelPositive, Display labelTest, HtmlColor color) {
2015-07-11 09:32:49 +00:00
if (labelPositive == null) {
throw new IllegalArgumentException();
}
if (labelTest == null) {
throw new IllegalArgumentException();
}
2013-12-10 19:36:50 +00:00
this.list = new InstructionList(swimlane);
this.labelTest = labelTest;
this.labelPositive = labelPositive;
2015-04-07 18:18:37 +00:00
this.color = color;
2013-12-10 19:36:50 +00:00
}
public void add(Instruction ins) {
list.add(ins);
}
public boolean kill() {
return list.kill();
}
2016-07-04 19:06:50 +00:00
public boolean addNote(Display note, NotePosition position, NoteType type, Colors colors) {
return list.addNote(note, position, type, colors);
2013-12-10 19:36:50 +00:00
}
public final void setInlinkRendering(LinkRendering inlinkRendering) {
2016-05-11 21:31:47 +00:00
if (inlinkRendering == null) {
throw new IllegalArgumentException();
}
2013-12-10 19:36:50 +00:00
this.inlinkRendering = inlinkRendering;
}
public void updateFtile(FtileFactory factory) {
this.ftile = factory.decorateOut(list.createFtile(factory), inlinkRendering);
}
public Collection<? extends Swimlane> getSwimlanes() {
return list.getSwimlanes();
}
public final Display getLabelPositive() {
2015-04-07 18:18:37 +00:00
final LinkRendering in = ftile.getInLinkRendering();
2015-07-11 09:32:49 +00:00
if (in != null && Display.isNull(in.getDisplay()) == false) {
2015-04-07 18:18:37 +00:00
return in.getDisplay();
}
2013-12-10 19:36:50 +00:00
return labelPositive;
}
public final Display getLabelTest() {
return labelTest;
}
2016-05-11 21:31:47 +00:00
public final Rainbow getInlinkRenderingColorAndStyle() {
return inlinkRendering == null ? null : inlinkRendering.getRainbow();
2013-12-10 19:36:50 +00:00
}
public final Ftile getFtile() {
return ftile;
}
2016-06-19 14:16:41 +00:00
public ISkinParam skinParam() {
return ftile.skinParam();
2013-12-10 19:36:50 +00:00
}
2015-04-07 18:18:37 +00:00
public final HtmlColor getColor() {
return color;
}
public boolean isEmpty() {
return list.isEmpty();
}
2015-09-06 17:28:59 +00:00
public Instruction getLast() {
return list.getLast();
}
2016-08-25 20:45:37 +00:00
public boolean isOnlySingleStop() {
return list.isOnlySingleStop();
}
2013-12-10 19:36:50 +00:00
}