diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/SellHouse.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/SellHouse.java index 3b1fcf1..38d09b2 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/SellHouse.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/popups/SellHouse.java @@ -32,20 +32,43 @@ import java.util.Set; import java.util.stream.Collectors; /** - * SellHouse is a popup which appears when a player clicks on the "demolish"-button in the BuildingAdminMenu + * SellHouse is a popup that appears when a player clicks on the "Demolish" button + * in the BuildingAdminMenu. + *

+ * This dialog allows players to select their properties and demolish houses or hotels + * for a partial refund of their purchase cost. + *

*/ public class SellHouse extends Dialog { + /** Reference to the Monopoly application instance. */ private final MonopolyApp app; + + /** Main container for the SellHouse dialog UI. */ private final Container sellhouseContainer; + + /** 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 selling. */ private Set selectedProperties = new HashSet<>(); + /** Label to display the total refund amount for the selected properties. */ private Label cost = new Label("0", new ElementId("label-Text")); - + /** + * Constructs a new SellHouse dialog. + * + * @param app The MonopolyApp instance. + */ public SellHouse(MonopolyApp app) { super(app.getDialogManager()); this.app = app; @@ -180,6 +203,11 @@ public class SellHouse 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()) { @@ -188,7 +216,9 @@ public class SellHouse 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(); @@ -211,7 +241,7 @@ public class SellHouse 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() { @@ -220,6 +250,9 @@ public class SellHouse extends Dialog { super.close(); } + /** + * Handles the escape action to close the dialog. + */ @Override public void escape() { new SettingsMenu(app).open();