/* ======================================================================== * PlantUML : a free UML diagram generator * ======================================================================== * * (C) Copyright 2009-2017, Arnaud Roques * * Project Info: http://plantuml.com * * This file is part of PlantUML. * * Licensed under The MIT License (Massachusetts Institute of Technology License) * * See http://opensource.org/licenses/MIT * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * Original Author: Arnaud Roques */ package net.sourceforge.plantuml.svek; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; public final class InnerActivity extends AbstractTextBlock implements IEntityImage { private final IEntityImage im; private final HtmlColor borderColor; private final boolean shadowing; private final HtmlColor backColor; public InnerActivity(final IEntityImage im, HtmlColor borderColor, HtmlColor backColor, boolean shadowing) { this.im = im; this.backColor = backColor; this.borderColor = borderColor; this.shadowing = shadowing; } public final static double THICKNESS_BORDER = 1.5; public void drawU(UGraphic ug) { final Dimension2D total = calculateDimension(ug.getStringBounder()); ug = ug.apply(new UChangeBackColor(backColor)).apply(new UChangeColor(borderColor)) .apply(new UStroke(THICKNESS_BORDER)); final URectangle rect = new URectangle(total.getWidth(), total.getHeight(), IEntityImage.CORNER, IEntityImage.CORNER); if (shadowing) { rect.setDeltaShadow(4); } ug.draw(rect); ug = ug.apply(new UStroke()); im.drawU(ug); } public HtmlColor getBackcolor() { return im.getBackcolor(); } public Dimension2D calculateDimension(StringBounder stringBounder) { final Dimension2D img = im.calculateDimension(stringBounder); return img; } public ShapeType getShapeType() { return ShapeType.ROUND_RECTANGLE; } public int getShield() { return 0; } public boolean isHidden() { return im.isHidden(); } }