1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-01 16:10:48 +00:00
plantuml/src/net/sourceforge/plantuml/ugraphic/sprite/PSystemListInternalSprites.java

93 lines
3.4 KiB
Java
Raw Normal View History

2016-01-30 12:20:07 +00:00
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
2019-01-16 18:34:41 +00:00
* (C) Copyright 2009-2020, Arnaud Roques
2016-01-30 12:20:07 +00:00
*
2016-03-06 16:47:34 +00:00
* Project Info: http://plantuml.com
2016-01-30 12:20:07 +00:00
*
2017-03-15 19:13:31 +00:00
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
2016-01-30 12:20:07 +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.ugraphic.sprite;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
2016-12-01 20:29:25 +00:00
import net.sourceforge.plantuml.donors.PSystemDonors;
import net.sourceforge.plantuml.graphic.HtmlColorUtils;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockHorizontal;
import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.graphic.VerticalAlignment;
2016-01-30 12:20:07 +00:00
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
public class PSystemListInternalSprites extends AbstractPSystem {
2016-12-01 20:29:25 +00:00
@Override
2017-04-19 18:30:16 +00:00
final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed)
2016-12-01 20:29:25 +00:00
throws IOException {
final UDrawable result = getGraphicStrings();
final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, HtmlColorUtils.WHITE,
2016-01-30 12:20:07 +00:00
getMetadata(), null, 0, 0, null, false);
2016-03-06 16:47:34 +00:00
imageBuilder.setUDrawable(result);
2017-04-19 18:30:16 +00:00
return imageBuilder.writeImageTOBEMOVED(fileFormat, seed, os);
2016-01-30 12:20:07 +00:00
}
2016-12-01 20:29:25 +00:00
private UDrawable getGraphicStrings() throws IOException {
2016-01-30 12:20:07 +00:00
final List<String> lines = new ArrayList<String>();
lines.add("<b>List Current Sprits");
lines.add("<i>Credit to");
lines.add("http://www.archimatetool.com");
lines.add(" ");
for (String folder : RessourcesUtils.getJarFile("sprites", true)) {
lines.add("<u>" + folder + "</u> :");
lines.add(" ");
for (String png : RessourcesUtils.getJarFile("sprites/" + folder, false)) {
if (png.endsWith(".png")) {
final String spriteName = png.substring(0, png.length() - 4);
lines.add("<$archimate/" + spriteName + "> " + spriteName);
}
}
}
2016-12-01 20:29:25 +00:00
final List<TextBlock> cols = PSystemDonors.getCols(lines, 4, 0);
return new TextBlockHorizontal(cols, VerticalAlignment.TOP);
2016-01-30 12:20:07 +00:00
}
public DiagramDescription getDescription() {
2017-03-12 17:22:02 +00:00
return new DiagramDescription("(Sprites)");
2016-01-30 12:20:07 +00:00
}
}