-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSemesterConfigSpinner.java
More file actions
65 lines (42 loc) · 1.4 KB
/
Copy pathSemesterConfigSpinner.java
File metadata and controls
65 lines (42 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//Dylan Barrett
//Description
//1/26/25
import javax.swing.*;
import javax.swing.event.ChangeEvent;
public class SemesterConfigSpinner extends JSpinner {
private DutyType type;
private Period period;
private String day;
private BigDuty bigDuty;
public SemesterConfigSpinner(SpinnerModel model, DutyType type, Period period, String day, BigDuty bigDuty) {
super(model);
this.type = type;
this.period = period;
this.day = day;
this.bigDuty = bigDuty;
bigDuty.addDutySlot(period, day, type, getValue());
this.addChangeListener(this::stateChanged);
}
public void stateChanged(ChangeEvent e) {
System.out.println("CustomSpinner.stateChanged");
bigDuty.addDutySlot(period, day, type, getValue());
bigDuty.refreshPanels();
}
public Integer getValue() {
return (Integer) super.getValue();
}
public DutyType getType() {
return type;
}
public Period getPeriod() {
return period;
}
public String getDay() {
return day;
}
public boolean equals(Object o) {
if(!(o instanceof SemesterConfigSpinner)) return false;
SemesterConfigSpinner spinner = (SemesterConfigSpinner) o;
return spinner.getDay().equals(this.getDay()) && spinner.getType().equals(this.getType()) && spinner.getPeriod().equals(this.getPeriod());
}
}