From 4e627023b155f260a0854b4789b424b208637d50 Mon Sep 17 00:00:00 2001 From: tobias <tobias.ullerich@icloud.com> Date: Thu, 18 Aug 2016 18:40:37 +0200 Subject: [PATCH] Update LaunchDialog with profile name next to project name --- .../assets/style/launchDialog_style.css | 8 ++++ .../viewcontroller/cell/ProjectCell.java | 38 +++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/PlayWall/assets/de/tobias/playpad/assets/style/launchDialog_style.css b/PlayWall/assets/de/tobias/playpad/assets/style/launchDialog_style.css index 5140429a..781fca54 100644 --- a/PlayWall/assets/de/tobias/playpad/assets/style/launchDialog_style.css +++ b/PlayWall/assets/de/tobias/playpad/assets/style/launchDialog_style.css @@ -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 diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/cell/ProjectCell.java b/PlayWall/src/de/tobias/playpad/viewcontroller/cell/ProjectCell.java index 57d9105b..184351eb 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/cell/ProjectCell.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/cell/ProjectCell.java @@ -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 { -- GitLab