Commit b1e52f0b authored by Axel Howind's avatar Axel Howind

change application title display to only show application name and document path

parent b5c551eb
Pipeline #58119695 failed with stages
in 18 minutes and 49 seconds
......@@ -208,19 +208,19 @@ public abstract class FxApplication<A extends FxApplication<A, C>, C extends FxC
protected void updateApplicationTitle() {
FxDocument document = controller.getCurrentDocument();
String name = document.toString();
String locStr = document.getLocationString();
boolean dirty = document.isDirty();
StringBuilder title = new StringBuilder();
title.append(applicationName);
if (!name.isEmpty() || document.isDirty()) {
if (!locStr.isEmpty() || document.isDirty()) {
title.append(" - ");
}
String marker = dirty ? MARKER_MODIFIED : MARKER_UNMODIFIED;
title.append(marker).append(name);
title.append(marker).append(locStr);
mainStage.setTitle(title.toString());
}
......
package com.dua3.fx.application;
import java.io.IOException;
import java.net.URI;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;
import com.dua3.utility.lang.LangUtil;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleObjectProperty;
import java.io.IOException;
import java.net.URI;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;
public abstract class FxDocument {
/** The void URI that represents "no document". */
public static final URI VOID_URI = URI.create("");
......@@ -56,8 +55,13 @@ public abstract class FxDocument {
return dirtyProperty.get();
}
public String getLocationString() {
URI location = getLocation();
return location.equals(VOID_URI) ? "untitled" : location.toString();
}
@Override
public String toString() {
return getClass().getSimpleName()+"["+getLocation()+"]";
return getClass().getSimpleName()+"["+ getLocationString() +"]";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment