-
Notifications
You must be signed in to change notification settings - Fork 0
/
EventView.java
72 lines (60 loc) · 1.24 KB
/
EventView.java
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
66
67
68
69
70
71
72
import java.util.*;
import javax.swing.*;
/**
* This class defines the view of the events that displayed on the right side of the overall calendar application
* @author amalachirayil
*
*/
public class EventView extends JPanel{
// Defining the different components of an day/event view
private JLabel timeLabel;
private EventRow eventRow;
private String title;
private boolean isAllocated;
/**
* Constructs an event view object
* @param title
*/
public EventView(String title) {
this.title = title;
init();
}
/**
* Initializes the day view
*/
private void init() {
JPanel view = new JPanel();
timeLabel = new JLabel(title);
eventRow = new EventRow();
view.add(timeLabel);
view.add(eventRow);
add(view);
}
/**
* Retrieves title of day view
* @return
*/
public String getTitle() {
return title;
}
/**
* Sets title of event
* @param title - event title
*/
public void setTitle(String title) {
eventRow.setLabel(title);
}
public boolean isAllocated() {
return isAllocated;
}
public void setAllocated(boolean isAllocated) {
this.isAllocated = isAllocated;
}
/**
* Clears the area that displays the events
*/
public void clear() {
setAllocated(false);
eventRow.clear();
}
}