diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TakeMortage.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TakeMortage.java
index c53999b..2790fb2 100644
--- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TakeMortage.java
+++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/TakeMortage.java
@@ -29,20 +29,43 @@ import java.util.Set;
import java.util.stream.Collectors;
/**
- * TakeMortage is a popup which appears when a player clicks on the "TakeMortage"-button in the BuildingAdminMenu
+ * TakeMortage is a popup that appears when a player clicks on the "Take Mortage" button
+ * in the BuildingAdminMenu.
+ *
+ * This popup allows the player to select properties and take a mortgage on them
+ * to gain financial benefit during gameplay.
+ *
*/
public class TakeMortage extends Dialog {
+ /** Reference to the Monopoly application instance. */
private final MonopolyApp app;
+
+ /** Main container for the TakeMortage dialog UI. */
private final Container takeMortageContainer;
+
+ /** Background container providing a styled border around the main dialog. */
private final Container backgroundContainer;
- private TextField selectionDisplay; // TextField to display selections
+
+ /** Text field to display selected properties. */
+ private TextField selectionDisplay;
+
+ /** Reference to track selection changes in the property selector. */
private VersionedReference> selectionRef;
+
+ /** Dropdown selector for displaying available properties. */
private Selector propertySelector;
+
+ /** Set of properties selected for mortgaging. */
private Set selectedProperties = new HashSet<>();
+ /** Label to display the total mortgage amount. */
private Label cost = new Label("0", new ElementId("label-Text"));
-
+ /**
+ * Constructs a new TakeMortage dialog.
+ *
+ * @param app The MonopolyApp instance.
+ */
public TakeMortage(MonopolyApp app) {
super(app.getDialogManager());
this.app = app;
@@ -122,7 +145,7 @@ public class TakeMortage extends Dialog {
/**
* Creates a dropdown menu for selecting a property.
*
- * @return The dropdown container.
+ * @return The dropdown container with property options.
*/
private Container createPropertyDropdown() {
Container dropdownContainer = new Container(new SpringGridLayout(Axis.Y, Axis.X));
@@ -155,10 +178,14 @@ public class TakeMortage extends Dialog {
return dropdownContainer;
}
+
/**
* Retrieves the list of properties owned by the current player.
+ *
+ * Only properties that are not currently mortgaged are included.
+ *
*
- * @return List of PropertyField objects owned by the player.
+ * @return List of eligible PropertyField objects owned by the player.
*/
private List getPlayerProperties() {
Player self = app.getGameLogic().getPlayerHandler().getPlayerById(app.getId());
@@ -171,6 +198,11 @@ public class TakeMortage extends Dialog {
.collect(Collectors.toList());
}
+ /**
+ * Updates the dialog UI, tracking changes in the property selection.
+ *
+ * @param delta Time since the last update.
+ */
@Override
public void update(float delta) {
if(selectionRef.update()) {
@@ -179,7 +211,9 @@ public class TakeMortage extends Dialog {
}
/**
- * Handles property selection changes.
+ * Handles changes to the property selection.
+ *
+ * @param playerProperties The dropdown menu's selection state.
*/
private void onDropdownSelectionChanged(Selector playerProperties) {
String selected = playerProperties.getSelectedItem();
@@ -202,7 +236,7 @@ public class TakeMortage extends Dialog {
}
/**
- * Schließt das Menü und entfernt die GUI-Elemente.
+ * Closes the dialog and removes GUI elements from the screen.
*/
@Override
public void close() {
@@ -211,6 +245,9 @@ public class TakeMortage extends Dialog {
super.close();
}
+ /**
+ * Handles the escape action to close the dialog.
+ */
@Override
public void escape() {
new SettingsMenu(app).open();