Skip to content

Commit

Permalink
Code cleanup in CalendarEvent.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemmermann committed Aug 31, 2022
1 parent 0706c1e commit 862e584
Showing 1 changed file with 17 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,75 +48,65 @@ public class CalendarEvent extends Event {
/**
* The supertype of all event types in this event class.
*/
public static final EventType<CalendarEvent> ANY = new EventType<>(
Event.ANY, "ANY");
public static final EventType<CalendarEvent> ANY = new EventType<>(Event.ANY, "ANY");

/**
* An event type used to inform the application that "something" inside the
* calendar has changed and that the views need to update their visuals
* accordingly (brute force update).
*/
public static final EventType<CalendarEvent> CALENDAR_CHANGED = new EventType<>(
CalendarEvent.ANY, "CALENDAR_CHANGED");
public static final EventType<CalendarEvent> CALENDAR_CHANGED = new EventType<>(CalendarEvent.ANY, "CALENDAR_CHANGED");

/**
* The supertype of all events that a related to an entry itself and not the
* calendar.
*/
public static final EventType<CalendarEvent> ENTRY_CHANGED = new EventType<>(
CalendarEvent.ANY, "ENTRY_CHANGED");
public static final EventType<CalendarEvent> ENTRY_CHANGED = new EventType<>(CalendarEvent.ANY, "ENTRY_CHANGED");

/**
* An event type used to inform the application that an entry has been moved
* from one calendar to another.
*/
public static final EventType<CalendarEvent> ENTRY_CALENDAR_CHANGED = new EventType<>(
CalendarEvent.ENTRY_CHANGED, "ENTRY_CALENDAR_CHANGED");
public static final EventType<CalendarEvent> ENTRY_CALENDAR_CHANGED = new EventType<>(CalendarEvent.ENTRY_CHANGED, "ENTRY_CALENDAR_CHANGED");

/**
* An event type used to inform the application that an entry has become a
* "full day" entry, meaning its start and end time are no longer relevant.
* The entry should be visualized in a way that signals that the entry will
* take all day (e.g. a birthday).
*/
public static final EventType<CalendarEvent> ENTRY_FULL_DAY_CHANGED = new EventType<>(
CalendarEvent.ENTRY_CHANGED, "ENTRY_FULL_DAY_CHANGED");
public static final EventType<CalendarEvent> ENTRY_FULL_DAY_CHANGED = new EventType<>(CalendarEvent.ENTRY_CHANGED, "ENTRY_FULL_DAY_CHANGED");

/**
* An event type used to inform the application that an entry has been
* assigned a new user object.
*/
public static final EventType<CalendarEvent> ENTRY_RECURRENCE_RULE_CHANGED = new EventType<>(
CalendarEvent.ENTRY_CHANGED, "ENTRY_RECURRENCE_RULE_CHANGED");
public static final EventType<CalendarEvent> ENTRY_RECURRENCE_RULE_CHANGED = new EventType<>(CalendarEvent.ENTRY_CHANGED, "ENTRY_RECURRENCE_RULE_CHANGED");

/**
* An event type used to inform the application that an entry has been
* assigned a new title.
*/
public static final EventType<CalendarEvent> ENTRY_TITLE_CHANGED = new EventType<>(
CalendarEvent.ENTRY_CHANGED, "ENTRY_TITLE_CHANGED");
public static final EventType<CalendarEvent> ENTRY_TITLE_CHANGED = new EventType<>(CalendarEvent.ENTRY_CHANGED, "ENTRY_TITLE_CHANGED");

/**
* An event type used to inform the application that an entry has been
* assigned a new user object.
*/
public static final EventType<CalendarEvent> ENTRY_USER_OBJECT_CHANGED = new EventType<>(
CalendarEvent.ENTRY_CHANGED, "ENTRY_USER_OBJECT_CHANGED");
public static final EventType<CalendarEvent> ENTRY_USER_OBJECT_CHANGED = new EventType<>(CalendarEvent.ENTRY_CHANGED, "ENTRY_USER_OBJECT_CHANGED");

/**
* An event type used to inform the application that an entry has been
* assigned a new user object.
*/
public static final EventType<CalendarEvent> ENTRY_LOCATION_CHANGED = new EventType<>(
CalendarEvent.ENTRY_CHANGED, "ENTRY_LOCATION_CHANGED");
public static final EventType<CalendarEvent> ENTRY_LOCATION_CHANGED = new EventType<>(CalendarEvent.ENTRY_CHANGED, "ENTRY_LOCATION_CHANGED");

/**
* An event type used to inform the application that the time bounds of an
* entry have been changed. One or several of start / end date, start / end
* time.
*/
public static final EventType<CalendarEvent> ENTRY_INTERVAL_CHANGED = new EventType<>(
CalendarEvent.ENTRY_CHANGED, "ENTRY_INTERVAL_CHANGED");
public static final EventType<CalendarEvent> ENTRY_INTERVAL_CHANGED = new EventType<>(CalendarEvent.ENTRY_CHANGED, "ENTRY_INTERVAL_CHANGED");

private Entry<?> entry;

Expand All @@ -138,8 +128,7 @@ public class CalendarEvent extends Event {
* @param eventType the event type
* @param calendar the calendar where the event occurred.
*/
protected CalendarEvent(EventType<? extends CalendarEvent> eventType,
Calendar calendar) {
protected CalendarEvent(EventType<? extends CalendarEvent> eventType, Calendar calendar) {
super(calendar, calendar, eventType);

this.calendar = requireNonNull(calendar);
Expand All @@ -152,8 +141,7 @@ protected CalendarEvent(EventType<? extends CalendarEvent> eventType,
* @param calendar the calendar where the event occured
* @param entry the affected entry
*/
public CalendarEvent(EventType<? extends CalendarEvent> eventType,
Calendar calendar, Entry<?> entry) {
public CalendarEvent(EventType<? extends CalendarEvent> eventType, Calendar calendar, Entry<?> entry) {
super(calendar, calendar, eventType);

this.calendar = calendar;
Expand All @@ -170,8 +158,7 @@ public CalendarEvent(EventType<? extends CalendarEvent> eventType,
* @param entry the affected entry
* @param oldCalendar the calendar to which the event belonged before
*/
public CalendarEvent(EventType<CalendarEvent> eventType, Calendar calendar,
Entry<?> entry, Calendar oldCalendar) {
public CalendarEvent(EventType<CalendarEvent> eventType, Calendar calendar, Entry<?> entry, Calendar oldCalendar) {
this(eventType, calendar, entry);
this.oldCalendar = oldCalendar;
}
Expand All @@ -186,8 +173,7 @@ public CalendarEvent(EventType<CalendarEvent> eventType, Calendar calendar,
* @param entry the affected entry
* @param oldUserObject the calendar to which the event belonged before
*/
public CalendarEvent(EventType<CalendarEvent> eventType, Calendar calendar,
Entry<?> entry, Object oldUserObject) {
public CalendarEvent(EventType<CalendarEvent> eventType, Calendar calendar, Entry<?> entry, Object oldUserObject) {
this(eventType, calendar, entry);
this.oldUserObject = oldUserObject;
}
Expand All @@ -202,8 +188,7 @@ public CalendarEvent(EventType<CalendarEvent> eventType, Calendar calendar,
* @param entry the affected entry
* @param oldInterval the previous time interval
*/
public CalendarEvent(EventType<CalendarEvent> eventType, Calendar calendar,
Entry<?> entry, Interval oldInterval) {
public CalendarEvent(EventType<CalendarEvent> eventType, Calendar calendar, Entry<?> entry, Interval oldInterval) {
this(eventType, calendar, entry);
this.oldInterval = requireNonNull(oldInterval);
}
Expand All @@ -218,8 +203,7 @@ public CalendarEvent(EventType<CalendarEvent> eventType, Calendar calendar,
* @param entry the affected entry
* @param oldText the previous value of the text
*/
public CalendarEvent(EventType<CalendarEvent> eventType, Calendar calendar,
Entry<?> entry, String oldText) {
public CalendarEvent(EventType<CalendarEvent> eventType, Calendar calendar, Entry<?> entry, String oldText) {
this(eventType, calendar, entry);
this.oldText = oldText;
}
Expand All @@ -234,8 +218,7 @@ public CalendarEvent(EventType<CalendarEvent> eventType, Calendar calendar,
* @param entry the affected entry
* @param oldFullDay the previous value of the full day
*/
public CalendarEvent(EventType<CalendarEvent> eventType, Calendar calendar,
Entry<?> entry, boolean oldFullDay) {
public CalendarEvent(EventType<CalendarEvent> eventType, Calendar calendar, Entry<?> entry, boolean oldFullDay) {
this(eventType, calendar, entry);
this.oldFullDay = oldFullDay;
}
Expand Down

0 comments on commit 862e584

Please sign in to comment.