Skip to content
Snippets Groups Projects
Commit 4e627023 authored by tobias's avatar tobias
Browse files

Update LaunchDialog with profile name next to project name

parent c71db40f
Branches
Tags
No related merge requests found
......@@ -70,3 +70,11 @@
-fx-background-color: derive(-fx-hover-base,+50%);
}
.projectname {
-fx-font-size: 13px;
}
.profilename {
-fx-font-size: 10px;
-fx-text-fill: gray;
}
\ No newline at end of file
......@@ -5,10 +5,15 @@ import java.nio.file.Path;
import de.tobias.playpad.Displayable;
import de.tobias.playpad.project.ProjectReference;
import de.tobias.playpad.settings.ProfileReference;
import de.tobias.utils.ui.icon.FontAwesomeType;
import de.tobias.utils.ui.icon.FontIcon;
import javafx.scene.control.ContentDisplay;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
public class ProjectCell extends ListCell<ProjectReference> {
......@@ -20,15 +25,40 @@ public class ProjectCell extends ListCell<ProjectReference> {
super.updateItem(ref, empty);
if (!empty) {
if (this.ref == null || this.ref != ref) {
HBox rootBox = new HBox(14);
VBox nameBox = new VBox(3);
// init
rootBox.setAlignment(Pos.CENTER_LEFT);
// Project Name
Label projectNameLabel = new Label();
projectNameLabel.textProperty().bind(ref.displayProperty());
projectNameLabel.getStyleClass().add("projectname");
nameBox.getChildren().add(projectNameLabel);
// Profile name
ProfileReference profileRef = ref.getProfileReference();
if (profileRef != null) {
String name = profileRef.getName();
Label label = new Label(name);
label.getStyleClass().add("profilename");
nameBox.getChildren().add(label);
}
HBox.setHgrow(nameBox, Priority.ALWAYS);
rootBox.getChildren().add(nameBox);
// File not Exists
Path path = ref.getProjectPath();
if (Files.notExists(path)) {
FontIcon graphics = new FontIcon(FontAwesomeType.WARNING);
graphics.setColor(Color.RED);
setGraphic(graphics);
rootBox.getChildren().add(graphics);
}
setContentDisplay(ContentDisplay.RIGHT);
textProperty().bind(ref.displayProperty());
setGraphic(rootBox);
this.ref = ref;
}
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment