diff --git a/helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/CharityPageController.java b/helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/CharityPageController.java index 44a66b6..363afbc 100644 --- a/helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/CharityPageController.java +++ b/helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/CharityPageController.java @@ -79,6 +79,7 @@ protected void authTokenisSet(){ public void setCharity(Charity charity) { this.charity = charity; + CharityDescription.setText(charity.getDescription()); CharityName.setText(charity.getName()); @@ -97,25 +98,27 @@ public void setCharity(Charity charity) { // Sets key values to a List String input = charity.getKeyValues(); - - String[] parts = input.split(":"); - List numbers = new ArrayList<>(); - - for (String part : parts) { - part = part.replace(",", "."); - numbers.add(Double.parseDouble(part)); + if (input != null) { + + String[] parts = input.split(":"); + List numbers = new ArrayList<>(); + + for (String part : parts) { + part = part.replace(",", "."); + numbers.add(Double.parseDouble(part)); + } + + // Sets the value of each arc and label + setArc(keyValueInnsamlingArc, numbers.getFirst()); + keyValueInnsamlingLabel.setText(String.format("%.1f%%", numbers.getFirst())); + setArc(keyValueAdminArc, numbers.get(1)); + keyValueAdminLabel.setText(String.format("%.1f%%", numbers.get(1))); + setArc(keyValueFormaalArc, numbers.getLast()); + keyValueFormaalLabel.setText(String.format("%.1f%%", numbers.getLast())); } - // Sets the value of each arc and label - setArc(keyValueInnsamlingArc, numbers.getFirst()); - keyValueInnsamlingLabel.setText(String.format("%.1f%%", numbers.getFirst())); - setArc(keyValueAdminArc, numbers.get(1)); - keyValueAdminLabel.setText(String.format("%.1f%%", numbers.get(1))); - setArc(keyValueFormaalArc, numbers.getLast()); - keyValueFormaalLabel.setText(String.format("%.1f%%", numbers.getLast())); - - // Sets the categories - setCategories(charity.getCategory()); + // Sets the categories + setCategories(charity.getCategory()); } /** diff --git a/helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/components/LoaderScene.java b/helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/components/LoaderScene.java index 1c61e22..5adc1c0 100644 --- a/helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/components/LoaderScene.java +++ b/helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/components/LoaderScene.java @@ -73,7 +73,6 @@ public static void LoadScene(String sceneName, Stage stage, Charity charity, Str stage.setScene(scene); stage.setFullScreen(true); stage.show(); - // Re-enter fullscreen when restored from taskbar stage.iconifiedProperty().addListener((obs, wasIconified, isNowIconified) -> { if (!isNowIconified) { stage.setFullScreen(true); diff --git a/helpmehelpapplication/src/main/resources/fxml/charityPage.fxml b/helpmehelpapplication/src/main/resources/fxml/charityPage.fxml index d0a8097..8b7309f 100644 --- a/helpmehelpapplication/src/main/resources/fxml/charityPage.fxml +++ b/helpmehelpapplication/src/main/resources/fxml/charityPage.fxml @@ -20,6 +20,8 @@ + + @@ -66,84 +68,89 @@ - + + - + - - - - + + - + - + - + - - - - - + @@ -163,13 +170,8 @@ - - - - - - - + + @@ -178,10 +180,9 @@ - + - - + @@ -191,20 +192,19 @@ - - + - + - + @@ -213,130 +213,148 @@ - - + + + + + + + + + + - - - + + + - + + + - - - - - - - - - + - - - + + - - + + - - + + - - + + - - + + + + + - - - + + - + + + - - - + + - - - + + - - - - - - + + + + + + + + + + +