net.sourceforge.plantuml.cucadiagram.GroupPrinter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml-mit Show documentation
Show all versions of plantuml-mit Show documentation
PlantUML is a component that allows to quickly write diagrams from text.
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package net.sourceforge.plantuml.cucadiagram;
import java.io.IOException;
import java.io.PrintWriter;
import net.sourceforge.plantuml.abel.Entity;
import net.sourceforge.plantuml.log.Logme;
import net.sourceforge.plantuml.security.SFile;
public class GroupPrinter {
// ::remove file when __CORE__
private final PrintWriter pw;
private GroupPrinter(PrintWriter pw) {
this.pw = pw;
}
private void printGroup(Entity group) {
pw.println("");
pw.println("");
pw.println("");
pw.println(group.getName());
pw.println(" ");
pw.println("");
if (group.leafs().size() == 0) {
pw.println("No direct leaf");
} else {
for (Entity leaf : group.leafs()) {
pw.println("");
printLeaf(leaf);
pw.println("
");
}
}
pw.println(" ");
pw.println(" ");
if (group.groups().size() > 0) {
pw.println("");
pw.println("");
for (Entity g : group.groups()) {
pw.println("
");
printGroup(g);
pw.println("
");
}
pw.println(" ");
pw.println(" ");
}
pw.println("
");
}
private void printLeaf(Entity leaf) {
pw.println("" + leaf.getName());
}
public static void print(SFile f, Entity rootGroup) {
try (PrintWriter pw = f.createPrintWriter()) {
pw.println("");
new GroupPrinter(pw).printGroup(rootGroup);
pw.println("");
} catch (IOException e) {
Logme.error(e);
}
}
}