From 828a0758f2cae7703444c00ee26ac54ef7c41eb5 Mon Sep 17 00:00:00 2001
From: tobias <tobias.ullerich@icloud.com>
Date: Mon, 29 Aug 2016 21:43:01 +0200
Subject: [PATCH] changed profile name in open dialog

---
 .../assets/dialog/project/openDialog.fxml     |  4 ++--
 .../playpad/assets/lang/ui_de.properties      |  2 +-
 .../playpad/viewcontroller/LaunchDialog.java  |  2 +-
 .../viewcontroller/cell/ProjectCell.java      | 24 ++++++++++++-------
 .../dialog/ProjectManagerDialog.java          | 15 ++++++------
 5 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/PlayWall/assets/de/tobias/playpad/assets/dialog/project/openDialog.fxml b/PlayWall/assets/de/tobias/playpad/assets/dialog/project/openDialog.fxml
index f5055c1a..256e734c 100644
--- a/PlayWall/assets/de/tobias/playpad/assets/dialog/project/openDialog.fxml
+++ b/PlayWall/assets/de/tobias/playpad/assets/dialog/project/openDialog.fxml
@@ -24,13 +24,13 @@
                      <children>
                         <VBox spacing="14.0">
                            <children>
-                              <Label text="%project.label.fileSize" />
+                              <Label text="%project.label.profile" />
                               <Label text="%project.label.lastModified" />
                            </children>
                         </VBox>
                         <VBox spacing="14.0">
                            <children>
-                              <Label fx:id="sizeLabel" text="100 MB" />
+                              <Label fx:id="profileLabel" text="Default" />
                               <Label fx:id="dateLabel" text="20. Dez 2015 19:45" />
                            </children>
                         </VBox>
diff --git a/PlayWall/assets/de/tobias/playpad/assets/lang/ui_de.properties b/PlayWall/assets/de/tobias/playpad/assets/lang/ui_de.properties
index 0a25de60..9438e06b 100644
--- a/PlayWall/assets/de/tobias/playpad/assets/lang/ui_de.properties
+++ b/PlayWall/assets/de/tobias/playpad/assets/lang/ui_de.properties
@@ -144,7 +144,7 @@ project.button.export=Exportieren...
 project.button.import=Importieren..
 project.label.export=Wenn Sie ein ge�ffnetes Projekt exportieren, wird dieses zuerst gespeichert.
 project.label.name=Name:
-project.label.fileSize=Dateigr��e
+project.label.profile=Profile:
 project.label.lastModified=Zuletzt bearbeitet:
 
 project.export.label.headline=Projekt exportieren:
diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/LaunchDialog.java b/PlayWall/src/de/tobias/playpad/viewcontroller/LaunchDialog.java
index a1aa9393..d659f482 100644
--- a/PlayWall/src/de/tobias/playpad/viewcontroller/LaunchDialog.java
+++ b/PlayWall/src/de/tobias/playpad/viewcontroller/LaunchDialog.java
@@ -77,7 +77,7 @@ public class LaunchDialog extends ViewController implements ProfileChooseable {
 		// Load project to list
 		projectListView.setPlaceholder(new Label(getString(Strings.UI_Placeholder_Project)));
 		projectListView.setId("list");
-		projectListView.setCellFactory(list -> new ProjectCell());
+		projectListView.setCellFactory(list -> new ProjectCell(true));
 
 		// List selection listener
 		projectListView.getSelectionModel().selectedItemProperty().addListener((a, b, c) ->
diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/cell/ProjectCell.java b/PlayWall/src/de/tobias/playpad/viewcontroller/cell/ProjectCell.java
index 184351eb..650064aa 100644
--- a/PlayWall/src/de/tobias/playpad/viewcontroller/cell/ProjectCell.java
+++ b/PlayWall/src/de/tobias/playpad/viewcontroller/cell/ProjectCell.java
@@ -18,7 +18,13 @@ import javafx.scene.paint.Color;
 
 public class ProjectCell extends ListCell<ProjectReference> {
 
-	private Displayable ref;
+	private transient Displayable ref;
+
+	private boolean showProfileName;
+
+	public ProjectCell(boolean showProfileName) {
+		this.showProfileName = showProfileName;
+	}
 
 	@Override
 	protected void updateItem(ProjectReference ref, boolean empty) {
@@ -37,14 +43,16 @@ public class ProjectCell extends ListCell<ProjectReference> {
 				projectNameLabel.getStyleClass().add("projectname");
 				nameBox.getChildren().add(projectNameLabel);
 
-				// Profile name
-				ProfileReference profileRef = ref.getProfileReference();
-				if (profileRef != null) {
-					String name = profileRef.getName();
+				if (showProfileName) {
+					// 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);
+						Label label = new Label(name);
+						label.getStyleClass().add("profilename");
+						nameBox.getChildren().add(label);
+					}
 				}
 
 				HBox.setHgrow(nameBox, Priority.ALWAYS);
diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/ProjectManagerDialog.java b/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/ProjectManagerDialog.java
index 6de43dc9..83bf7d61 100644
--- a/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/ProjectManagerDialog.java
+++ b/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/ProjectManagerDialog.java
@@ -13,12 +13,12 @@ import de.tobias.playpad.project.Project;
 import de.tobias.playpad.project.ProjectImporter;
 import de.tobias.playpad.project.ProjectReference;
 import de.tobias.playpad.settings.Profile;
+import de.tobias.playpad.settings.ProfileReference;
 import de.tobias.playpad.viewcontroller.cell.ProjectCell;
 import de.tobias.utils.ui.NotificationHandler;
 import de.tobias.utils.ui.ViewController;
 import de.tobias.utils.ui.scene.NotificationPane;
 import de.tobias.utils.util.Localization;
-import de.tobias.utils.util.NumberUtils;
 import de.tobias.utils.util.TimeUtils;
 import javafx.application.Platform;
 import javafx.event.ActionEvent;
@@ -56,7 +56,7 @@ public class ProjectManagerDialog extends ViewController implements Notification
 	@FXML private Button exportButton;
 
 	@FXML private Label dateLabel;
-	@FXML private Label sizeLabel;
+	@FXML private Label profileLabel;
 
 	private Project currentProject;
 
@@ -85,7 +85,7 @@ public class ProjectManagerDialog extends ViewController implements Notification
 		((AnchorPane) getParent()).getChildren().add(notificationPane);
 
 		projectList.setPlaceholder(new Label(Localization.getString(Strings.UI_Placeholder_Project)));
-		projectList.setCellFactory(list -> new ProjectCell());
+		projectList.setCellFactory(list -> new ProjectCell(false));
 
 		projectList.setOnMouseClicked(mouseEvent ->
 		{
@@ -109,10 +109,11 @@ public class ProjectManagerDialog extends ViewController implements Notification
 
 				nameTextField.setText(c.toString());
 				try {
-					sizeLabel.setText(NumberUtils.numberToString(ref.getSize()));
+					ProfileReference profileRef = ref.getProfileReference();
+					profileLabel.setText(profileRef.getName());
 					dateLabel.setText(TimeUtils.getDfmLong().format(ref.getLastMofied()));
 				} catch (Exception e) {
-					sizeLabel.setText("-");
+					profileLabel.setText("-");
 					dateLabel.setText("-");
 					e.printStackTrace();
 				}
@@ -130,7 +131,7 @@ public class ProjectManagerDialog extends ViewController implements Notification
 				renameButton.setDisable(true);
 
 				nameTextField.setText(null);
-				sizeLabel.setText("-");
+				profileLabel.setText("-");
 				dateLabel.setText("-");
 			}
 		});
@@ -141,7 +142,7 @@ public class ProjectManagerDialog extends ViewController implements Notification
 		exportButton.setDisable(true);
 		renameButton.setDisable(true);
 
-		sizeLabel.setText("-");
+		profileLabel.setText("-");
 		dateLabel.setText("-");
 
 		addCloseKeyShortcut(() -> getStage().close());
-- 
GitLab