Skip to content

Commit

Permalink
added 3 organisations for testing connections between frontPage and o…
Browse files Browse the repository at this point in the history
…rganizationCard
  • Loading branch information
robinsp committed Mar 11, 2026
1 parent e641b67 commit 334a7e6
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package ntnu.systemutvikling.team6.controller;

import java.util.List;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.layout.FlowPane;
import ntnu.systemutvikling.team6.models.Charity;

public class FrontpageController {

Expand All @@ -13,12 +15,29 @@ public class FrontpageController {
public void initialize() {
try {

for (int i = 0; i < 6; i++) {
List<Charity> charities =
List.of(
new Charity("Redd Barna",
"Protecting children's rights worldwide.",
"Children"),
new Charity("Leger Uten Grenser",
"Emergency medical aid in crisis areas.",
"Health"),
new Charity(
"Kirkens Nødhjelp",
"Humanitarian aid and long-term development work.",
"Emergency Aid"));

for (Charity ch : charities) {

FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/organizationCard.fxml"));

Parent card = loader.load();

OrganizationCardController cardController = loader.getController();

cardController.setOrganization(ch.getName(), ch.getDescription());

cardsContainer.getChildren().add(card);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package ntnu.systemutvikling.team6.controller;

import javafx.fxml.FXML;
import javafx.scene.control.Label;

public class OrganizationCardController {

@FXML private Label organizationName;

@FXML private Label organizationDescription;

public void setOrganization(String name, String description) {
organizationName.setText(name);
organizationDescription.setText(description);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>


<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="240.0" prefWidth="380.0" spacing="12.0" style="-fx-background-color: white; -fx-background-radius: 20; -fx-border-radius: 20; -fx-border-color: #3b82f6; -fx-border-width: 2;" xmlns="http://javafx.com/javafx/25" xmlns:fx="http://javafx.com/fxml/1">
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="240.0" prefWidth="380.0" spacing="12.0" style="-fx-background-color: white; -fx-background-radius: 20; -fx-border-radius: 20; -fx-border-color: #3b82f6; -fx-border-width: 2;" xmlns="http://javafx.com/javafx/25" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ntnu.systemutvikling.team6.controller.OrganizationCardController">
<padding>
<Insets bottom="12.0" left="12.0" right="12.0" top="12.0" />
</padding>
Expand All @@ -22,12 +21,12 @@
<Label style="-fx-background-color: #cdedcf; -fx-background-radius: 12; -fx-padding: 4 10 4 10; -fx-text-fill: #2e7d32; -fx-font-size: 12;" text="Verified" />
</children>
</HBox>
<Label text="Organization name">
<Label fx:id="organizationName" text="Organization name">
<font>
<Font name="System Bold" size="26.0" />
</font>
</Label>
<Label prefWidth="300.0" text="Some interesting information about the organization" wrapText="true" />
<Label fx:id="organizationDescription" prefWidth="300.0" text="Some interesting information about the organization" wrapText="true" />
<Region prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" />
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" spacing="12.0">
<children>
Expand Down

0 comments on commit 334a7e6

Please sign in to comment.