1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-03 09:00:48 +00:00
plantuml/src/net/sourceforge/plantuml/graphic/TextBlockWithUrl.java

71 lines
2.0 KiB
Java
Raw Normal View History

2016-03-06 16:47:34 +00:00
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* 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
*
*
*/
2016-11-18 21:12:09 +00:00
package net.sourceforge.plantuml.graphic;
2016-03-06 16:47:34 +00:00
2016-11-18 21:12:09 +00:00
import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
2016-03-06 16:47:34 +00:00
2016-11-18 21:12:09 +00:00
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.ugraphic.UGraphic;
2016-03-06 16:47:34 +00:00
2016-11-18 21:12:09 +00:00
public class TextBlockWithUrl implements TextBlock {
private final TextBlock block;
private final Url url;
public static TextBlock withUrl(TextBlock block, Url url) {
if (url == null) {
return block;
2016-03-06 16:47:34 +00:00
}
2016-11-18 21:12:09 +00:00
return new TextBlockWithUrl(block, url);
}
private TextBlockWithUrl(TextBlock block, Url url) {
this.block = block;
this.url = url;
}
public void drawU(UGraphic ug) {
ug.startUrl(url);
block.drawU(ug);
ug.closeAction();
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return block.calculateDimension(stringBounder);
}
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder) {
return block.getInnerPosition(member, stringBounder);
2016-03-06 16:47:34 +00:00
}
2016-11-18 21:12:09 +00:00
}