net.sourceforge.plantuml.swing.SimpleLine 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.swing;
import java.io.File;
import java.util.List;
import java.util.concurrent.Future;
import net.sourceforge.plantuml.GeneratedImage;
class SimpleLine implements Comparable {
private final File file;
private final GeneratedImage generatedImage;
private final Future> future;
public static SimpleLine fromFuture(File file, Future> future) {
return new SimpleLine(file, null, future);
}
public static SimpleLine fromGeneratedImage(File file, GeneratedImage generatedImage) {
return new SimpleLine(file, generatedImage, null);
}
private SimpleLine(File file, GeneratedImage generatedImage, Future> future) {
this.generatedImage = generatedImage;
this.file = file;
this.future = future;
}
public File getFile() {
return file;
}
public boolean pendingAndFinished() {
return generatedImage == null && future.isDone();
}
@Override
public String toString() {
if (generatedImage == null) {
return file.getName() + " (...pending...)";
}
final StringBuilder sb = new StringBuilder(generatedImage.getPngFile().getName());
sb.append(" ");
sb.append(generatedImage.getDescription());
return sb.toString();
}
public Future> getFuture() {
return future;
}
public int compareTo(SimpleLine other) {
return toString().compareTo(other.toString());
}
public GeneratedImage getGeneratedImage() {
return generatedImage;
}
}