net.sourceforge.plantuml.gitlog.GitDiagram 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.gitlog;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Collection;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.shape.AbstractTextBlock;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
import net.sourceforge.plantuml.skin.UmlDiagramType;
public class GitDiagram extends UmlDiagram {
private final Collection gnodes;
public GitDiagram(UmlSource source, GitTextArea textArea) {
super(source, UmlDiagramType.GIT, null);
this.gnodes = new GNodeBuilder(textArea.getAllCommits()).getAllNodes();
new GNodeBuilder(textArea.getAllCommits());
}
public DiagramDescription getDescription() {
return new DiagramDescription("(Git)");
}
@Override
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException {
return createImageBuilder(fileFormatOption).drawable(getTextBlock()).write(os);
}
private void drawInternal(UGraphic ug) {
new SmetanaForGit(ug, getSkinParam()).drawMe(gnodes);
// final Display display = Display.getWithNewlines("Your data does not sound like GIT data");
// final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(UFont.courier(14));
// TextBlock result = display.create(fontConfiguration, HorizontalAlignment.LEFT, getSkinParam());
// result = TextBlockUtils.withMargin(result, 5, 2);
// result.drawU(ug);
}
@Override
protected TextBlock getTextBlock() {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {
drawInternal(ug);
}
public XDimension2D calculateDimension(StringBounder stringBounder) {
return null;
}
};
}
}