2010-11-15 20:35:36 +00:00
|
|
|
/* ========================================================================
|
|
|
|
* PlantUML : a free UML diagram generator
|
|
|
|
* ========================================================================
|
|
|
|
*
|
|
|
|
* (C) Copyright 2009, Arnaud Roques
|
|
|
|
*
|
|
|
|
* 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 Lesser 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
|
|
|
|
*
|
2011-09-07 20:41:58 +00:00
|
|
|
* Revision $Revision: 7170 $
|
2010-11-15 20:35:36 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
package net.sourceforge.plantuml.skin.rose;
|
|
|
|
|
|
|
|
import java.awt.geom.Dimension2D;
|
|
|
|
|
|
|
|
import net.sourceforge.plantuml.graphic.HorizontalAlignement;
|
2011-08-08 17:48:29 +00:00
|
|
|
import net.sourceforge.plantuml.graphic.HtmlColor;
|
2010-11-15 20:35:36 +00:00
|
|
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
|
|
|
import net.sourceforge.plantuml.skin.AbstractTextualComponent;
|
2011-08-08 17:48:29 +00:00
|
|
|
import net.sourceforge.plantuml.ugraphic.UFont;
|
2010-11-15 20:35:36 +00:00
|
|
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
|
|
|
import net.sourceforge.plantuml.ugraphic.ULine;
|
|
|
|
import net.sourceforge.plantuml.ugraphic.UStroke;
|
|
|
|
|
|
|
|
public class ComponentRoseGroupingElse extends AbstractTextualComponent {
|
|
|
|
|
2011-08-08 17:48:29 +00:00
|
|
|
private final HtmlColor groupBorder;
|
2011-04-19 16:50:40 +00:00
|
|
|
|
2011-08-08 17:48:29 +00:00
|
|
|
public ComponentRoseGroupingElse(HtmlColor fontColor, HtmlColor groupBorder, UFont smallFont, CharSequence comment) {
|
2010-11-15 20:35:36 +00:00
|
|
|
super(comment == null ? null : "[" + comment + "]", fontColor, smallFont, HorizontalAlignement.LEFT, 5, 5, 1);
|
2011-04-19 16:50:40 +00:00
|
|
|
this.groupBorder = groupBorder;
|
2010-11-15 20:35:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2011-09-07 20:41:58 +00:00
|
|
|
protected void drawInternalU(UGraphic ug, Dimension2D dimensionToUse, boolean withShadow) {
|
2011-01-12 19:06:53 +00:00
|
|
|
stroke(ug, 2, 2);
|
2011-04-19 16:50:40 +00:00
|
|
|
ug.getParam().setColor(groupBorder);
|
2010-11-15 20:35:36 +00:00
|
|
|
ug.draw(0, 1, new ULine(dimensionToUse.getWidth(), 0));
|
|
|
|
ug.getParam().setStroke(new UStroke());
|
|
|
|
getTextBlock().drawU(ug, getMarginX1(), getMarginY());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public double getPreferredHeight(StringBounder stringBounder) {
|
|
|
|
return 15;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public double getPreferredWidth(StringBounder stringBounder) {
|
|
|
|
return getTextWidth(stringBounder);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|