Browse Source

add card selected

main^2
fdai7736 11 months ago
parent
commit
336510435d
  1. 14
      src/main/java/de/hsfulda/onses/models/Card.java

14
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_COLOR = "color";
public final static String PROPERTY_VALUE = "value"; public final static String PROPERTY_VALUE = "value";
public final static String PROPERTY_SELECTED = "selected";
protected PropertyChangeSupport listeners; protected PropertyChangeSupport listeners;
private Color color; private Color color;
private Value value; private Value value;
private boolean facedown = false; private boolean facedown = false;
private boolean selected;
public enum Color { public enum Color {
RED, BLUE, GREEN, YELLOW, BLACK; RED, BLUE, GREEN, YELLOW, BLACK;
@ -51,6 +54,17 @@ public class Card {
return this; 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() { public PropertyChangeSupport listeners() {
if(this.listeners == null) { if(this.listeners == null) {
this.listeners = new PropertyChangeSupport(this); this.listeners = new PropertyChangeSupport(this);

Loading…
Cancel
Save