1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-07 19:00:53 +00:00
plantuml/src/net/sourceforge/plantuml/skin/rose/Rose.java

392 lines
22 KiB
Java
Raw Normal View History

2010-11-15 20:35:36 +00:00
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
2013-12-10 19:36:50 +00:00
* (C) Copyright 2009-2013, Arnaud Roques
2010-11-15 20:35:36 +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
2013-12-10 19:36:50 +00:00
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
2010-11-15 20:35:36 +00:00
* 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
*
2013-12-10 19:36:50 +00:00
* Revision $Revision: 11873 $
2010-11-15 20:35:36 +00:00
*
*/
package net.sourceforge.plantuml.skin.rose;
import java.util.EnumMap;
import java.util.Map;
2011-08-08 17:48:29 +00:00
import net.sourceforge.plantuml.AlignParam;
2010-11-15 20:35:36 +00:00
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
2013-12-10 19:36:50 +00:00
import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
2010-11-15 20:35:36 +00:00
import net.sourceforge.plantuml.graphic.HtmlColor;
2013-12-10 19:36:50 +00:00
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.skin.ArrowDirection;
2010-11-15 20:35:36 +00:00
import net.sourceforge.plantuml.skin.Component;
import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.Skin;
2011-08-08 17:48:29 +00:00
import net.sourceforge.plantuml.ugraphic.UFont;
2013-12-10 19:36:50 +00:00
import net.sourceforge.plantuml.ugraphic.UStroke;
2010-11-15 20:35:36 +00:00
public class Rose implements Skin {
private final Map<ColorParam, HtmlColor> defaultsColor = new EnumMap<ColorParam, HtmlColor>(ColorParam.class);
2013-12-10 19:36:50 +00:00
final private double paddingX = 5;
final private double paddingY = 5;
2010-11-15 20:35:36 +00:00
public Rose() {
2013-12-10 19:36:50 +00:00
defaultsColor.put(ColorParam.background, HtmlColorUtils.getColorIfValid("white"));
2011-01-23 19:36:52 +00:00
2013-12-10 19:36:50 +00:00
defaultsColor.put(ColorParam.sequenceArrow, HtmlColorUtils.getColorIfValid("#A80036"));
defaultsColor.put(ColorParam.usecaseArrow, HtmlColorUtils.getColorIfValid("#A80036"));
defaultsColor.put(ColorParam.classArrow, HtmlColorUtils.getColorIfValid("#A80036"));
defaultsColor.put(ColorParam.objectArrow, HtmlColorUtils.getColorIfValid("#A80036"));
defaultsColor.put(ColorParam.activityArrow, HtmlColorUtils.getColorIfValid("#A80036"));
// defaultsColor.put(ColorParam.componentArrow, HtmlColorUtils.getColorIfValid("#A80036"));
defaultsColor.put(ColorParam.stateArrow, HtmlColorUtils.getColorIfValid("#A80036"));
2011-01-23 19:36:52 +00:00
2013-12-10 19:36:50 +00:00
defaultsColor.put(ColorParam.sequenceLifeLineBackground, HtmlColorUtils.getColorIfValid("white"));
defaultsColor.put(ColorParam.sequenceLifeLineBorder, HtmlColorUtils.getColorIfValid("#A80036"));
defaultsColor.put(ColorParam.sequenceGroupBackground, HtmlColorUtils.getColorIfValid("#EEEEEE"));
defaultsColor.put(ColorParam.sequenceGroupBorder, HtmlColorUtils.BLACK);
defaultsColor.put(ColorParam.sequenceDividerBackground, HtmlColorUtils.getColorIfValid("#EEEEEE"));
defaultsColor.put(ColorParam.sequenceReferenceBorder, HtmlColorUtils.BLACK);
defaultsColor.put(ColorParam.sequenceReferenceBackground, HtmlColorUtils.getColorIfValid("white"));
defaultsColor.put(ColorParam.sequenceReferenceHeaderBackground, HtmlColorUtils.getColorIfValid("#EEEEEE"));
defaultsColor.put(ColorParam.sequenceBoxBorder, HtmlColorUtils.getColorIfValid("#A80036"));
defaultsColor.put(ColorParam.sequenceBoxBackground, HtmlColorUtils.getColorIfValid("#DDDDDD"));
2011-01-23 19:36:52 +00:00
2013-12-10 19:36:50 +00:00
defaultsColor.put(ColorParam.noteBackground, HtmlColorUtils.getColorIfValid("#FBFB77"));
defaultsColor.put(ColorParam.noteBorder, HtmlColorUtils.getColorIfValid("#A80036"));
2011-01-23 19:36:52 +00:00
2013-12-10 19:36:50 +00:00
defaultsColor.put(ColorParam.legendBackground, HtmlColorUtils.getColorIfValid("#DDDDDD"));
defaultsColor.put(ColorParam.legendBorder, HtmlColorUtils.getColorIfValid("#000000"));
2011-01-23 19:36:52 +00:00
2013-12-10 19:36:50 +00:00
defaultsColor.put(ColorParam.activityBackground, HtmlColorUtils.getColorIfValid("#FEFECE"));
defaultsColor.put(ColorParam.activityBorder, HtmlColorUtils.getColorIfValid("#A80036"));
defaultsColor.put(ColorParam.activityStart, HtmlColorUtils.BLACK);
defaultsColor.put(ColorParam.activityEnd, HtmlColorUtils.BLACK);
defaultsColor.put(ColorParam.activityBar, HtmlColorUtils.BLACK);
2011-01-23 19:36:52 +00:00
2013-12-10 19:36:50 +00:00
defaultsColor.put(ColorParam.stateBackground, HtmlColorUtils.getColorIfValid("#FEFECE"));
defaultsColor.put(ColorParam.stateBorder, HtmlColorUtils.getColorIfValid("#A80036"));
defaultsColor.put(ColorParam.stateStart, HtmlColorUtils.BLACK);
defaultsColor.put(ColorParam.stateEnd, HtmlColorUtils.BLACK);
2011-01-23 19:36:52 +00:00
2013-12-10 19:36:50 +00:00
defaultsColor.put(ColorParam.usecaseBackground, HtmlColorUtils.getColorIfValid("#FEFECE"));
defaultsColor.put(ColorParam.usecaseBorder, HtmlColorUtils.getColorIfValid("#A80036"));
defaultsColor.put(ColorParam.componentBackground, HtmlColorUtils.getColorIfValid("#FEFECE"));
defaultsColor.put(ColorParam.componentBorder, HtmlColorUtils.getColorIfValid("#A80036"));
defaultsColor.put(ColorParam.componentInterfaceBackground, HtmlColorUtils.getColorIfValid("#FEFECE"));
defaultsColor.put(ColorParam.componentInterfaceBorder, HtmlColorUtils.getColorIfValid("#A80036"));
defaultsColor.put(ColorParam.usecaseActorBackground, HtmlColorUtils.getColorIfValid("#FEFECE"));
defaultsColor.put(ColorParam.usecaseActorBorder, HtmlColorUtils.getColorIfValid("#A80036"));
2011-01-23 19:36:52 +00:00
2013-12-10 19:36:50 +00:00
defaultsColor.put(ColorParam.sequenceActorBackground, HtmlColorUtils.getColorIfValid("#FEFECE"));
defaultsColor.put(ColorParam.sequenceActorBorder, HtmlColorUtils.getColorIfValid("#A80036"));
defaultsColor.put(ColorParam.sequenceParticipantBackground, HtmlColorUtils.getColorIfValid("#FEFECE"));
defaultsColor.put(ColorParam.sequenceParticipantBorder, HtmlColorUtils.getColorIfValid("#A80036"));
defaultsColor.put(ColorParam.classBackground, HtmlColorUtils.getColorIfValid("#FEFECE"));
defaultsColor.put(ColorParam.classBorder, HtmlColorUtils.getColorIfValid("#A80036"));
2011-01-23 19:36:52 +00:00
2013-12-10 19:36:50 +00:00
defaultsColor.put(ColorParam.objectBackground, HtmlColorUtils.getColorIfValid("#FEFECE"));
defaultsColor.put(ColorParam.objectBorder, HtmlColorUtils.getColorIfValid("#A80036"));
2011-01-23 19:36:52 +00:00
2013-12-10 19:36:50 +00:00
defaultsColor.put(ColorParam.stereotypeCBackground, HtmlColorUtils.getColorIfValid("#ADD1B2"));
defaultsColor.put(ColorParam.stereotypeABackground, HtmlColorUtils.getColorIfValid("#A9DCDF"));
defaultsColor.put(ColorParam.stereotypeIBackground, HtmlColorUtils.getColorIfValid("#B4A7E5"));
defaultsColor.put(ColorParam.stereotypeEBackground, HtmlColorUtils.getColorIfValid("#EB937F"));
2011-01-23 19:36:52 +00:00
2013-12-10 19:36:50 +00:00
defaultsColor.put(ColorParam.packageBackground, HtmlColorUtils.getColorIfValid("#FEFECE"));
defaultsColor.put(ColorParam.packageBorder, HtmlColorUtils.BLACK);
defaultsColor.put(ColorParam.iconPrivate, HtmlColorUtils.getColorIfValid("#C82930"));
defaultsColor.put(ColorParam.iconPrivateBackground, HtmlColorUtils.getColorIfValid("#F24D5C"));
defaultsColor.put(ColorParam.iconProtected, HtmlColorUtils.getColorIfValid("#B38D22"));
defaultsColor.put(ColorParam.iconProtectedBackground, HtmlColorUtils.getColorIfValid("#FFFF44"));
defaultsColor.put(ColorParam.iconPackage, HtmlColorUtils.getColorIfValid("#1963A0"));
defaultsColor.put(ColorParam.iconPackageBackground, HtmlColorUtils.getColorIfValid("#4177AF"));
defaultsColor.put(ColorParam.iconPublic, HtmlColorUtils.getColorIfValid("#038048"));
defaultsColor.put(ColorParam.iconPublicBackground, HtmlColorUtils.getColorIfValid("#84BE84"));
2010-11-15 20:35:36 +00:00
}
2011-08-08 17:48:29 +00:00
public HtmlColor getFontColor(ISkinParam skin, FontParam fontParam) {
return skin.getFontHtmlColor(fontParam, null);
2010-11-15 20:35:36 +00:00
}
2011-01-11 07:42:49 +00:00
2010-11-15 20:35:36 +00:00
public HtmlColor getHtmlColor(ISkinParam param, ColorParam color) {
2011-01-05 18:23:06 +00:00
return getHtmlColor(param, color, null);
}
public HtmlColor getHtmlColor(ISkinParam param, ColorParam color, String stereotype) {
2013-12-10 19:36:50 +00:00
HtmlColor result = param.getHtmlColor(color, stereotype, false);
2010-11-15 20:35:36 +00:00
if (result == null) {
result = defaultsColor.get(color);
if (result == null) {
throw new IllegalArgumentException();
}
}
return result;
}
2013-12-10 19:36:50 +00:00
public Component createComponent(ComponentType type, ArrowConfiguration config, ISkinParam param,
Display stringsToDisplay) {
2011-08-08 17:48:29 +00:00
final HtmlColor background = param.getBackgroundColor();
final HtmlColor groupBorder = getHtmlColor(param, ColorParam.sequenceGroupBorder);
final HtmlColor groupBackground = getHtmlColor(param, ColorParam.sequenceGroupBackground);
final HtmlColor sequenceDividerBackground = getHtmlColor(param, ColorParam.sequenceDividerBackground);
final HtmlColor sequenceReferenceBackground = getHtmlColor(param, ColorParam.sequenceReferenceBackground);
final HtmlColor sequenceReferenceHeaderBackground = getHtmlColor(param,
ColorParam.sequenceReferenceHeaderBackground);
final HtmlColor sequenceReferenceBorder = getHtmlColor(param, ColorParam.sequenceReferenceBorder);
final HtmlColor lifeLineBackgroundColor = getHtmlColor(param, ColorParam.sequenceLifeLineBackground);
final HtmlColor sequenceActorBackground = getHtmlColor(param, ColorParam.sequenceActorBackground);
final HtmlColor sequenceParticipantBackground = getHtmlColor(param, ColorParam.sequenceParticipantBackground);
2010-11-15 20:35:36 +00:00
2011-08-08 17:48:29 +00:00
final UFont fontArrow = param.getFont(FontParam.SEQUENCE_ARROW, null);
final UFont fontGrouping = param.getFont(FontParam.SEQUENCE_GROUP, null);
final UFont fontParticipant = param.getFont(FontParam.SEQUENCE_PARTICIPANT, null);
final UFont fontActor = param.getFont(FontParam.SEQUENCE_ACTOR, null);
2010-11-15 20:35:36 +00:00
2013-12-10 19:36:50 +00:00
final double deltaShadow = param.shadowing() ? 4.0 : 0;
2011-01-11 07:42:49 +00:00
if (type.isArrow()) {
2013-12-10 19:36:50 +00:00
// if (param.maxMessageSize() > 0) {
// final FontConfiguration fc = new FontConfiguration(fontArrow, HtmlColorUtils.BLACK);
// stringsToDisplay = DisplayUtils.breakLines(stringsToDisplay, fc, param, param.maxMessageSize());
// }
final HtmlColor sequenceArrow = config.getColor() == null ? getHtmlColor(param, ColorParam.sequenceArrow)
: config.getColor();
if (config.getArrowDirection() == ArrowDirection.SELF) {
2011-01-11 07:42:49 +00:00
return new ComponentRoseSelfArrow(sequenceArrow, getFontColor(param, FontParam.SEQUENCE_ARROW),
2013-12-10 19:36:50 +00:00
fontArrow, stringsToDisplay, config, param, param.maxMessageSize(),
param.strictUmlStyle() == false);
2011-01-11 07:42:49 +00:00
}
2013-12-10 19:36:50 +00:00
final HorizontalAlignment messageHorizontalAlignment = param
.getHorizontalAlignment(AlignParam.SEQUENCE_MESSAGE_ALIGN);
final HorizontalAlignment textHorizontalAlignment = param
.getHorizontalAlignment(AlignParam.SEQUENCE_MESSAGETEXT_ALIGN);
return new ComponentRoseArrow2(sequenceArrow, getFontColor(param, FontParam.SEQUENCE_ARROW), fontArrow,
stringsToDisplay, config, messageHorizontalAlignment, param, textHorizontalAlignment,
param.maxMessageSize(), param.strictUmlStyle() == false);
2010-11-15 20:35:36 +00:00
}
if (type == ComponentType.PARTICIPANT_HEAD) {
2011-08-08 17:48:29 +00:00
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceParticipantBorder);
2010-11-15 20:35:36 +00:00
return new ComponentRoseParticipant(sequenceParticipantBackground, borderColor, getFontColor(param,
2013-12-10 19:36:50 +00:00
FontParam.SEQUENCE_PARTICIPANT), fontParticipant, stringsToDisplay, param, deltaShadow,
param.getRoundCorner(), getStroke(param, LineParam.sequenceParticipantBorder, 1.5));
2010-11-15 20:35:36 +00:00
}
if (type == ComponentType.PARTICIPANT_TAIL) {
2011-08-08 17:48:29 +00:00
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceParticipantBorder);
2010-11-15 20:35:36 +00:00
return new ComponentRoseParticipant(sequenceParticipantBackground, borderColor, getFontColor(param,
2013-12-10 19:36:50 +00:00
FontParam.SEQUENCE_PARTICIPANT), fontParticipant, stringsToDisplay, param, deltaShadow,
param.getRoundCorner(), getStroke(param, LineParam.sequenceParticipantBorder, 1.5));
2010-11-15 20:35:36 +00:00
}
if (type == ComponentType.PARTICIPANT_LINE) {
2011-08-08 17:48:29 +00:00
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder);
2013-12-10 19:36:50 +00:00
return new ComponentRoseLine(borderColor, false, getStroke(param, LineParam.sequenceLifeLineBorder, 1));
2011-01-23 19:36:52 +00:00
}
if (type == ComponentType.CONTINUE_LINE) {
2011-08-08 17:48:29 +00:00
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder);
2013-12-10 19:36:50 +00:00
return new ComponentRoseLine(borderColor, true, getStroke(param, LineParam.sequenceLifeLineBorder, 1.5));
2010-11-15 20:35:36 +00:00
}
if (type == ComponentType.ACTOR_HEAD) {
2011-08-08 17:48:29 +00:00
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceActorBorder);
2010-11-15 20:35:36 +00:00
return new ComponentRoseActor(sequenceActorBackground, borderColor, getFontColor(param,
2013-12-10 19:36:50 +00:00
FontParam.SEQUENCE_ACTOR), fontActor, stringsToDisplay, true, param, deltaShadow, getStroke(param,
LineParam.sequenceActorBorder, 2));
2010-11-15 20:35:36 +00:00
}
if (type == ComponentType.ACTOR_TAIL) {
2011-08-08 17:48:29 +00:00
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceActorBorder);
2010-11-15 20:35:36 +00:00
return new ComponentRoseActor(sequenceActorBackground, borderColor, getFontColor(param,
2013-12-10 19:36:50 +00:00
FontParam.SEQUENCE_ACTOR), fontActor, stringsToDisplay, false, param, deltaShadow, getStroke(param,
LineParam.sequenceActorBorder, 2));
}
if (type == ComponentType.BOUNDARY_HEAD) {
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceActorBorder);
return new ComponentRoseBoundary(sequenceActorBackground, borderColor, getFontColor(param,
FontParam.SEQUENCE_ACTOR), fontActor, stringsToDisplay, true, param, deltaShadow, getStroke(param,
LineParam.sequenceActorBorder, 2));
}
if (type == ComponentType.BOUNDARY_TAIL) {
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceActorBorder);
return new ComponentRoseBoundary(sequenceActorBackground, borderColor, getFontColor(param,
FontParam.SEQUENCE_ACTOR), fontActor, stringsToDisplay, false, param, deltaShadow, getStroke(param,
LineParam.sequenceActorBorder, 2));
}
if (type == ComponentType.CONTROL_HEAD) {
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceActorBorder);
return new ComponentRoseControl(sequenceActorBackground, borderColor, getFontColor(param,
FontParam.SEQUENCE_ACTOR), fontActor, stringsToDisplay, true, param, deltaShadow, getStroke(param,
LineParam.sequenceActorBorder, 2));
}
if (type == ComponentType.CONTROL_TAIL) {
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceActorBorder);
return new ComponentRoseControl(sequenceActorBackground, borderColor, getFontColor(param,
FontParam.SEQUENCE_ACTOR), fontActor, stringsToDisplay, false, param, deltaShadow, getStroke(param,
LineParam.sequenceActorBorder, 2));
}
if (type == ComponentType.ENTITY_HEAD) {
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceActorBorder);
return new ComponentRoseEntity(sequenceActorBackground, borderColor, getFontColor(param,
FontParam.SEQUENCE_ACTOR), fontActor, stringsToDisplay, true, param, deltaShadow, getStroke(param,
LineParam.sequenceActorBorder, 2));
}
if (type == ComponentType.ENTITY_TAIL) {
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceActorBorder);
return new ComponentRoseEntity(sequenceActorBackground, borderColor, getFontColor(param,
FontParam.SEQUENCE_ACTOR), fontActor, stringsToDisplay, false, param, deltaShadow, getStroke(param,
LineParam.sequenceActorBorder, 2));
}
if (type == ComponentType.DATABASE_HEAD) {
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceActorBorder);
return new ComponentRoseDatabase(sequenceActorBackground, borderColor, getFontColor(param,
FontParam.SEQUENCE_ACTOR), fontActor, stringsToDisplay, true, param, deltaShadow, getStroke(param,
LineParam.sequenceActorBorder, 2));
}
if (type == ComponentType.DATABASE_TAIL) {
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceActorBorder);
return new ComponentRoseDatabase(sequenceActorBackground, borderColor, getFontColor(param,
FontParam.SEQUENCE_ACTOR), fontActor, stringsToDisplay, false, param, deltaShadow, getStroke(param,
LineParam.sequenceActorBorder, 2));
2010-11-15 20:35:36 +00:00
}
if (type == ComponentType.NOTE) {
2011-08-08 17:48:29 +00:00
final HtmlColor noteBackgroundColor = getHtmlColor(param, ColorParam.noteBackground);
final HtmlColor borderColor = getHtmlColor(param, ColorParam.noteBorder);
final UFont fontNote = param.getFont(FontParam.NOTE, null);
2010-11-15 20:35:36 +00:00
return new ComponentRoseNote(noteBackgroundColor, borderColor, getFontColor(param, FontParam.NOTE),
2013-12-10 19:36:50 +00:00
fontNote, stringsToDisplay, paddingX, paddingY, param, deltaShadow, getStroke(param,
LineParam.noteBorder, 1));
2010-11-15 20:35:36 +00:00
}
2011-09-07 20:41:58 +00:00
if (type == ComponentType.NOTE_HEXAGONAL) {
final HtmlColor noteBackgroundColor = getHtmlColor(param, ColorParam.noteBackground);
final HtmlColor borderColor = getHtmlColor(param, ColorParam.noteBorder);
final UFont fontNote = param.getFont(FontParam.NOTE, null);
2013-12-10 19:36:50 +00:00
return new ComponentRoseNoteHexagonal(noteBackgroundColor, borderColor,
getFontColor(param, FontParam.NOTE), fontNote, stringsToDisplay, param, deltaShadow, getStroke(
param, LineParam.noteBorder, 1));
2011-09-07 20:41:58 +00:00
}
if (type == ComponentType.NOTE_BOX) {
final HtmlColor noteBackgroundColor = getHtmlColor(param, ColorParam.noteBackground);
final HtmlColor borderColor = getHtmlColor(param, ColorParam.noteBorder);
final UFont fontNote = param.getFont(FontParam.NOTE, null);
return new ComponentRoseNoteBox(noteBackgroundColor, borderColor, getFontColor(param, FontParam.NOTE),
2013-12-10 19:36:50 +00:00
fontNote, stringsToDisplay, param, deltaShadow, getStroke(param, LineParam.noteBorder, 1));
2011-09-07 20:41:58 +00:00
}
2010-11-15 20:35:36 +00:00
if (type == ComponentType.GROUPING_HEADER) {
2011-08-08 17:48:29 +00:00
final UFont fontGroupingHeader = param.getFont(FontParam.SEQUENCE_GROUP_HEADER, null);
2011-04-19 16:50:40 +00:00
return new ComponentRoseGroupingHeader(getFontColor(param, FontParam.SEQUENCE_GROUP_HEADER), background,
2013-12-10 19:36:50 +00:00
groupBackground, groupBorder, fontGroupingHeader, fontGrouping, stringsToDisplay, param,
deltaShadow, getStroke(param, LineParam.sequenceGroupBorder, 2));
2010-11-15 20:35:36 +00:00
}
if (type == ComponentType.GROUPING_ELSE) {
2011-04-19 16:50:40 +00:00
return new ComponentRoseGroupingElse(getFontColor(param, FontParam.SEQUENCE_GROUP), groupBorder,
2013-12-10 19:36:50 +00:00
fontGrouping, stringsToDisplay.get(0), param, background, getStroke(param,
LineParam.sequenceGroupBorder, 2));
}
if (type == ComponentType.GROUPING_SPACE) {
return new ComponentRoseGroupingSpace(7);
2010-11-15 20:35:36 +00:00
}
2011-01-29 15:09:35 +00:00
if (type == ComponentType.ALIVE_BOX_CLOSE_CLOSE) {
2011-08-08 17:48:29 +00:00
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder);
2013-12-10 19:36:50 +00:00
return new ComponentRoseActiveLine(borderColor, lifeLineBackgroundColor, true, true, deltaShadow > 0);
2011-01-29 15:09:35 +00:00
}
if (type == ComponentType.ALIVE_BOX_CLOSE_OPEN) {
2011-08-08 17:48:29 +00:00
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder);
2013-12-10 19:36:50 +00:00
return new ComponentRoseActiveLine(borderColor, lifeLineBackgroundColor, true, false, deltaShadow > 0);
2011-01-29 15:09:35 +00:00
}
if (type == ComponentType.ALIVE_BOX_OPEN_CLOSE) {
2011-08-08 17:48:29 +00:00
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder);
2013-12-10 19:36:50 +00:00
return new ComponentRoseActiveLine(borderColor, lifeLineBackgroundColor, false, true, deltaShadow > 0);
2011-01-29 15:09:35 +00:00
}
if (type == ComponentType.ALIVE_BOX_OPEN_OPEN) {
2011-08-08 17:48:29 +00:00
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder);
2013-12-10 19:36:50 +00:00
return new ComponentRoseActiveLine(borderColor, lifeLineBackgroundColor, false, false, deltaShadow > 0);
2010-11-15 20:35:36 +00:00
}
2011-01-12 19:06:53 +00:00
if (type == ComponentType.DELAY_LINE) {
2011-08-08 17:48:29 +00:00
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder);
2011-01-12 19:06:53 +00:00
return new ComponentRoseDelayLine(borderColor);
}
if (type == ComponentType.DELAY_TEXT) {
return new ComponentRoseDelayText(getFontColor(param, FontParam.SEQUENCE_DELAY), param.getFont(
2013-12-10 19:36:50 +00:00
FontParam.SEQUENCE_DELAY, null), stringsToDisplay, param);
2011-01-12 19:06:53 +00:00
}
2010-11-15 20:35:36 +00:00
if (type == ComponentType.DESTROY) {
2011-08-08 17:48:29 +00:00
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder);
2010-11-15 20:35:36 +00:00
return new ComponentRoseDestroy(borderColor);
}
if (type == ComponentType.NEWPAGE) {
2011-04-19 16:50:40 +00:00
return new ComponentRoseNewpage(getFontColor(param, FontParam.SEQUENCE_GROUP));
2010-11-15 20:35:36 +00:00
}
if (type == ComponentType.DIVIDER) {
2011-01-11 07:42:49 +00:00
return new ComponentRoseDivider(getFontColor(param, FontParam.SEQUENCE_DIVIDER), param.getFont(
2013-12-10 19:36:50 +00:00
FontParam.SEQUENCE_DIVIDER, null), sequenceDividerBackground, stringsToDisplay, param,
deltaShadow > 0, getStroke(param, LineParam.sequenceDividerBorder, 2));
2010-11-15 20:35:36 +00:00
}
2011-04-19 16:50:40 +00:00
if (type == ComponentType.REFERENCE) {
2011-08-08 17:48:29 +00:00
final UFont fontGroupingHeader = param.getFont(FontParam.SEQUENCE_GROUP_HEADER, null);
return new ComponentRoseReference(getFontColor(param, FontParam.SEQUENCE_REFERENCE), getFontColor(param,
FontParam.SEQUENCE_GROUP), param.getFont(FontParam.SEQUENCE_REFERENCE, null),
sequenceReferenceBorder, sequenceReferenceHeaderBackground, sequenceReferenceBackground,
fontGroupingHeader, stringsToDisplay,
2013-12-10 19:36:50 +00:00
param.getHorizontalAlignment(AlignParam.SEQUENCE_REFERENCE_ALIGN), param, deltaShadow, getStroke(
param, LineParam.sequenceReferenceBorder, 2));
2011-04-19 16:50:40 +00:00
}
2010-11-15 20:35:36 +00:00
if (type == ComponentType.TITLE) {
2011-01-11 07:42:49 +00:00
return new ComponentRoseTitle(getFontColor(param, FontParam.SEQUENCE_TITLE), param.getFont(
2013-12-10 19:36:50 +00:00
FontParam.SEQUENCE_TITLE, null), stringsToDisplay, param);
2010-11-15 20:35:36 +00:00
}
if (type == ComponentType.SIGNATURE) {
2013-12-10 19:36:50 +00:00
return new ComponentRoseTitle(HtmlColorUtils.BLACK, fontGrouping, Display.asList("This skin was created ",
"in April 2009."), param);
2010-11-15 20:35:36 +00:00
}
if (type == ComponentType.ENGLOBER) {
2011-08-08 17:48:29 +00:00
final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceBoxBorder);
final HtmlColor backColor = getHtmlColor(param, ColorParam.sequenceBoxBackground);
2010-11-15 20:35:36 +00:00
return new ComponentRoseEnglober(borderColor, backColor, stringsToDisplay, getFontColor(param,
2013-12-10 19:36:50 +00:00
FontParam.SEQUENCE_BOX), param.getFont(FontParam.SEQUENCE_BOX, null), param);
2010-11-15 20:35:36 +00:00
}
2013-12-10 19:36:50 +00:00
2010-11-15 20:35:36 +00:00
return null;
}
2013-12-10 19:36:50 +00:00
static public UStroke getStroke(ISkinParam param, LineParam lineParam, double defaultValue) {
final UStroke result = param.getThickness(lineParam);
if (result == null) {
return new UStroke(defaultValue);
}
return result;
}
2010-11-15 20:35:36 +00:00
public Object getProtocolVersion() {
return 1;
}
}