mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-25 04:06:08 +00:00
fix: note placement in listfiles
This commit is contained in:
parent
6c73caa943
commit
48dc07da95
@ -70,8 +70,8 @@ public abstract class USymbols {
|
||||
public final static USymbol FOLDER = record("FOLDER", new USymbolFolder(SName.folder, false));
|
||||
public final static USymbol FILE = record("FILE", new USymbolFile());
|
||||
public final static USymbol RECTANGLE = record("RECTANGLE", new USymbolRectangle(SName.rectangle));
|
||||
public final static USymbol ACTION = record("ACTION", new USymbolAction(SName.rectangle));
|
||||
public final static USymbol PROCESS = record("PROCESS", new USymbolProcess(SName.rectangle));
|
||||
public final static USymbol ACTION = record("ACTION", new USymbolAction(SName.action));
|
||||
public final static USymbol PROCESS = record("PROCESS", new USymbolProcess(SName.process));
|
||||
public final static USymbol HEXAGON = record("HEXAGON", new USymbolHexagon());
|
||||
public final static USymbol PERSON = record("PERSON", new USymbolPerson());
|
||||
public final static USymbol LABEL = record("LABEL", new USymbolLabel());
|
||||
|
@ -60,47 +60,48 @@ import net.sourceforge.plantuml.svek.image.Opale;
|
||||
|
||||
public class FEntry implements Iterable<FEntry> {
|
||||
|
||||
private final ISkinParam skinParam;
|
||||
private final FEntry parent;
|
||||
private final List<String> note;
|
||||
private final String name;
|
||||
private FilesType type;
|
||||
private List<FEntry> children = new ArrayList<>();
|
||||
|
||||
public static FEntry createRoot(ISkinParam skinParam) {
|
||||
return new FEntry(null, "", FilesType.FOLDER, skinParam);
|
||||
public static FEntry createRoot() {
|
||||
return new FEntry(null, FilesType.FOLDER, "", null);
|
||||
}
|
||||
|
||||
private FEntry(List<String> note, String name, FilesType type, ISkinParam skinParam) {
|
||||
private FEntry(FEntry parent, FilesType type, String name, List<String> note) {
|
||||
this.parent = parent;
|
||||
this.note = note;
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.skinParam = skinParam;
|
||||
}
|
||||
|
||||
public void addRawEntry(String raw, ISkinParam skinParam) {
|
||||
public FEntry addRawEntry(String raw) {
|
||||
final int x = raw.indexOf('/');
|
||||
if (x == -1) {
|
||||
final FEntry result = new FEntry(null, raw, FilesType.DATA, skinParam);
|
||||
final FEntry result = new FEntry(this, FilesType.DATA, raw, null);
|
||||
children.add(result);
|
||||
return;
|
||||
return result;
|
||||
}
|
||||
final FEntry folder = getOrCreateFolder(raw.substring(0, x), skinParam);
|
||||
final FEntry folder = getOrCreateFolder(raw.substring(0, x));
|
||||
final String remain = raw.substring(x + 1);
|
||||
if (remain.length() != 0)
|
||||
folder.addRawEntry(remain, skinParam);
|
||||
return folder.addRawEntry(remain);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addNote(List<String> note, ISkinParam skinParam) {
|
||||
final FEntry result = new FEntry(note, "NONE", FilesType.NOTE, skinParam);
|
||||
public void addNote(List<String> note) {
|
||||
final FEntry result = new FEntry(this, FilesType.NOTE, "NONE", note);
|
||||
children.add(result);
|
||||
}
|
||||
|
||||
private FEntry getOrCreateFolder(String folderName, ISkinParam skinParam) {
|
||||
private FEntry getOrCreateFolder(String folderName) {
|
||||
for (FEntry child : children)
|
||||
if (child.type == FilesType.FOLDER && child.getName().equals(folderName))
|
||||
return child;
|
||||
|
||||
final FEntry result = new FEntry(null, folderName, FilesType.FOLDER, skinParam);
|
||||
final FEntry result = new FEntry(this, FilesType.FOLDER, folderName, null);
|
||||
children.add(result);
|
||||
return result;
|
||||
}
|
||||
@ -110,6 +111,10 @@ public class FEntry implements Iterable<FEntry> {
|
||||
return Collections.unmodifiableCollection(children).iterator();
|
||||
}
|
||||
|
||||
public FEntry getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@ -132,14 +137,15 @@ public class FEntry implements Iterable<FEntry> {
|
||||
|
||||
private TextBlock getTextBlock(FontConfiguration fontConfiguration, ISkinParam skinParam) {
|
||||
if (type == FilesType.NOTE)
|
||||
return createOpale();
|
||||
return createOpale(skinParam);
|
||||
|
||||
final Display display = Display.getWithNewlines(getEmoticon() + getName());
|
||||
TextBlock result = display.create7(fontConfiguration, HorizontalAlignment.LEFT, skinParam, CreoleMode.NO_CREOLE);
|
||||
TextBlock result = display.create7(fontConfiguration, HorizontalAlignment.LEFT, skinParam,
|
||||
CreoleMode.NO_CREOLE);
|
||||
return result;
|
||||
}
|
||||
|
||||
private Opale createOpale() {
|
||||
private Opale createOpale(ISkinParam skinParam) {
|
||||
|
||||
final StyleSignatureBasic signature = StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram,
|
||||
SName.note);
|
||||
|
@ -49,10 +49,11 @@ public class FilesListing extends AbstractTextBlock {
|
||||
private final ISkinParam skinParam;
|
||||
private final FontConfiguration fontConfiguration = FontConfiguration.blackBlueTrue(UFont.courier(14));
|
||||
private final FEntry root;
|
||||
private FEntry lastCreated;
|
||||
|
||||
public FilesListing(ISkinParam skinParam) {
|
||||
this.skinParam = skinParam;
|
||||
this.root = FEntry.createRoot(skinParam);
|
||||
this.root = FEntry.createRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -67,11 +68,14 @@ public class FilesListing extends AbstractTextBlock {
|
||||
}
|
||||
|
||||
public void addRawEntry(String raw) {
|
||||
root.addRawEntry(raw, skinParam);
|
||||
lastCreated = root.addRawEntry(raw);
|
||||
}
|
||||
|
||||
public void addNote(List<String> note) {
|
||||
root.addNote(note, skinParam);
|
||||
if (lastCreated == null)
|
||||
root.addNote(note);
|
||||
else
|
||||
lastCreated.getParent().addNote(note);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
package net.sourceforge.plantuml.style;
|
||||
|
||||
public enum SName {
|
||||
action, //
|
||||
activity, //
|
||||
activityBar, //
|
||||
activityDiagram, //
|
||||
@ -113,6 +114,7 @@ public enum SName {
|
||||
partition, //
|
||||
person, //
|
||||
port, //
|
||||
process, //
|
||||
queue, //
|
||||
rectangle, //
|
||||
reference, //
|
||||
|
Loading…
Reference in New Issue
Block a user