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

83 lines
3.0 KiB
Java
Raw Normal View History

2016-01-30 12:20:07 +00:00
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
2016-03-06 16:47:34 +00:00
* Project Info: http://plantuml.com
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.DiagramDescriptionImpl;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.graphic.GraphicStrings;
2016-11-18 21:12:09 +00:00
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
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 {
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
2016-11-18 21:12:09 +00:00
final TextBlockBackcolored result = getGraphicStrings();
2016-01-30 12:20:07 +00:00
final ImageBuilder imageBuilder = new ImageBuilder(new ColorMapperIdentity(), 1.0, result.getBackcolor(),
getMetadata(), null, 0, 0, null, false);
2016-03-06 16:47:34 +00:00
imageBuilder.setUDrawable(result);
2016-01-30 12:20:07 +00:00
return imageBuilder.writeImageTOBEMOVED(fileFormat, os);
}
2016-11-18 21:12:09 +00:00
private TextBlockBackcolored 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-11-18 21:12:09 +00:00
return GraphicStrings.createBlackOnWhite(lines, null, null, 35);
2016-01-30 12:20:07 +00:00
}
public DiagramDescription getDescription() {
return new DiagramDescriptionImpl("(Sprites)", getClass());
}
}