2013-12-10 19:36:50 +00:00
|
|
|
/* ========================================================================
|
|
|
|
* PlantUML : a free UML diagram generator
|
|
|
|
* ========================================================================
|
|
|
|
*
|
2016-01-09 12:15:40 +00:00
|
|
|
* (C) Copyright 2009-2017, Arnaud Roques
|
2013-12-10 19:36:50 +00:00
|
|
|
*
|
2016-03-06 16:47:34 +00:00
|
|
|
* Project Info: http://plantuml.com
|
2013-12-10 19:36:50 +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.donors;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.StringTokenizer;
|
|
|
|
|
|
|
|
import net.sourceforge.plantuml.AbstractPSystem;
|
|
|
|
import net.sourceforge.plantuml.FileFormatOption;
|
|
|
|
import net.sourceforge.plantuml.code.Transcoder;
|
|
|
|
import net.sourceforge.plantuml.code.TranscoderImpl;
|
|
|
|
import net.sourceforge.plantuml.core.DiagramDescription;
|
|
|
|
import net.sourceforge.plantuml.core.DiagramDescriptionImpl;
|
|
|
|
import net.sourceforge.plantuml.core.ImageData;
|
|
|
|
import net.sourceforge.plantuml.graphic.GraphicPosition;
|
|
|
|
import net.sourceforge.plantuml.graphic.GraphicStrings;
|
2016-11-18 21:12:09 +00:00
|
|
|
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
|
2015-04-07 18:18:37 +00:00
|
|
|
import net.sourceforge.plantuml.ugraphic.ColorMapperIdentity;
|
|
|
|
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
|
2013-12-10 19:36:50 +00:00
|
|
|
import net.sourceforge.plantuml.version.PSystemVersion;
|
|
|
|
|
|
|
|
public class PSystemDonors extends AbstractPSystem {
|
|
|
|
|
2016-11-04 21:39:29 +00:00
|
|
|
public static final String DONORS = "UDfTKqjosp0CtUCKN6lIGoXsxDQ_PAmqdSaEbX29DaMe9ELKFbjtlLYXj3BfS2MC0F3zc9li_o47JnJ8gTm6jXfBUAOi7cvXmx5q7l9f50-mTF4N3L3G0NtGQDME6mkvhTYf9LEuqFZvzYOTKpjQs61oaGqmrrEX3UHnDP-Xw2E40POwkpsMOJMXx3qKWRg6h9enTy9lFjr37jRjfr5sC6EZhTfpxmbM_QV_sP65o5Hq6hO9QcpJKgxA3Vr2MucSiqRBrXhT84ptLzgsXbsAFbpWqUYp3CnrUHBarp_QmeE_hhO9Y8pECB-qEhX1RR3X2c4rYlxQeAnF-Z8oqIuvfq5aiXYaJ_09hjK_y7IwOMKhALqfcYpmu8OJl_kJbaL6nXvTq1Vu6hihXgqk6pBg7hKPKWRcaeBn7bQ4ziiAovyzUJNl3mx5InFvll0nKDcejKEF4L9D4j74iVSnMTAYrdpMQL0-el8z4jO8-oIyunKfp-meqrqIApwDojopGukckrEl590x3tiXYAvIQprQ2ml3RjHx--UtCH-cnq2O99mIfyqrJWudjKVNcrj6Fad8QDeJJc7PwnlukT6gGApa8RcQr0-oDRaxjSsVlnLv37h65fPqyu1I7MmfWMdLYt2OIuJNiTFHwBCydGqHF9pJTt16sCKbr4uWiuJKijUIahubjU2UGbIxzB18VVhW4hDXBwc80dUdQqbKeLlu2u2IDTa0";
|
2015-04-07 18:18:37 +00:00
|
|
|
|
2013-12-10 19:36:50 +00:00
|
|
|
public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException {
|
2016-11-18 21:12:09 +00:00
|
|
|
final TextBlockBackcolored result = getGraphicStrings();
|
2015-04-07 18:18:37 +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);
|
2015-05-31 18:56:03 +00:00
|
|
|
return imageBuilder.writeImageTOBEMOVED(fileFormat, os);
|
2013-12-10 19:36:50 +00:00
|
|
|
}
|
|
|
|
|
2016-11-18 21:12:09 +00:00
|
|
|
private TextBlockBackcolored getGraphicStrings() throws IOException {
|
2013-12-10 19:36:50 +00:00
|
|
|
final List<String> lines = new ArrayList<String>();
|
|
|
|
lines.add("<b>Special thanks to our sponsors and donors !");
|
|
|
|
lines.add(" ");
|
2015-04-07 18:18:37 +00:00
|
|
|
int i = 0;
|
|
|
|
final List<String> donors = getDonors();
|
|
|
|
final int maxLine = (donors.size() + 1) / 2;
|
|
|
|
for (String d : donors) {
|
|
|
|
lines.add(d);
|
|
|
|
i++;
|
|
|
|
if (i == maxLine) {
|
|
|
|
lines.add(" ");
|
|
|
|
lines.add(" ");
|
|
|
|
i = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
lines.add(" ");
|
2016-11-18 21:12:09 +00:00
|
|
|
return GraphicStrings.createBlackOnWhite(lines, PSystemVersion.getPlantumlImage(),
|
|
|
|
GraphicPosition.BACKGROUND_CORNER_BOTTOM_RIGHT, maxLine + 2);
|
2015-04-07 18:18:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private List<String> getDonors() throws IOException {
|
|
|
|
final List<String> lines = new ArrayList<String>();
|
2013-12-10 19:36:50 +00:00
|
|
|
final Transcoder t = new TranscoderImpl();
|
2015-04-07 18:18:37 +00:00
|
|
|
final String s = t.decode(DONORS).replace('*', '.');
|
2013-12-10 19:36:50 +00:00
|
|
|
final StringTokenizer st = new StringTokenizer(s, "\n");
|
|
|
|
while (st.hasMoreTokens()) {
|
|
|
|
lines.add(st.nextToken());
|
|
|
|
}
|
2015-04-07 18:18:37 +00:00
|
|
|
return lines;
|
2013-12-10 19:36:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public DiagramDescription getDescription() {
|
|
|
|
return new DiagramDescriptionImpl("(Donors)", getClass());
|
|
|
|
}
|
|
|
|
|
|
|
|
public static PSystemDonors create() {
|
|
|
|
return new PSystemDonors();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|