From 336510435d8b1104325ae3837babe3903e10e712 Mon Sep 17 00:00:00 2001 From: fdai7736 Date: Wed, 7 Feb 2024 21:06:36 +0100 Subject: [PATCH] add card selected --- src/main/java/de/hsfulda/onses/models/Card.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/de/hsfulda/onses/models/Card.java b/src/main/java/de/hsfulda/onses/models/Card.java index 2dbc3d5..568851f 100644 --- a/src/main/java/de/hsfulda/onses/models/Card.java +++ b/src/main/java/de/hsfulda/onses/models/Card.java @@ -7,11 +7,14 @@ public class Card { public final static String PROPERTY_COLOR = "color"; public final static String PROPERTY_VALUE = "value"; + public final static String PROPERTY_SELECTED = "selected"; + protected PropertyChangeSupport listeners; private Color color; private Value value; private boolean facedown = false; + private boolean selected; public enum Color { RED, BLUE, GREEN, YELLOW, BLACK; @@ -51,6 +54,17 @@ public class Card { return this; } + public boolean isSelected() { + return selected; + } + + public Card setSelected(boolean selected) { + final boolean oldValue = this.selected; + this.selected = selected; + this.firePropertyChange(PROPERTY_SELECTED, oldValue, selected); + return this; + } + public PropertyChangeSupport listeners() { if(this.listeners == null) { this.listeners = new PropertyChangeSupport(this);