public class EventClock extends GenericClock
| Modifier and Type | Field and Description |
|---|---|
(package private) boolean |
eventInProgress
Flag to indicate if there are actually events in progress.
|
(package private) javax.swing.JLabel |
eventLabel
Second label attached to this clock, used to provide feedback about
events status.
|
(package private) java.util.ArrayList<java.lang.Integer> |
eventsToLaunch
List of event IDs to be fired inmediately, of both types.
|
(package private) GenericPopUp |
informationPopUp
Pop-up to show information about events.
|
(package private) boolean |
isPopUpVisible
Pop-up behaviour control variables.
|
(package private) java.util.ArrayList<Event> |
newAddedEvents
List of events created in execution time (while app is 'working').
|
(package private) java.util.ArrayList<java.lang.Integer> |
nextPXE
List of 'periodicalExecutionEvents' with the smallest 'timeToLaunch'.
|
(package private) java.util.ArrayList<java.lang.Integer> |
nextSXE
List of 'singleExecutionEvents' with the smallest 'timeToLaunch'.
|
(package private) java.util.ArrayList<Event> |
periodExecutionEventList
List of events with periodical execution.
|
(package private) boolean |
playSound
Pop-up behaviour control variable.
|
(package private) boolean |
popUpInFront
Pop-up behaviour control variable.
|
(package private) java.util.ArrayList<Event> |
singleExecutionEventList
List of events with a single execution (fixed time of execution).
|
(package private) java.lang.String |
singleExecutionInformation
Summarized textual data about loaded SXE.
|
(package private) SoundLoader |
soundLoader
MIDI sound (file) handler.
|
(package private) int |
timeToEventEnd
Internal clock counters
|
(package private) int |
timeToNextEvent
Internal clock counters
|
clockToPrint, clockToPrintBlink, hour, label, minute, paused, second, stopped| Constructor and Description |
|---|
EventClock(javax.swing.JLabel timeLabel,
javax.swing.JLabel eventLabel)
Initializes EventClock.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
addNewEvents()
Add events created during execution time to its proper list.
|
private void |
calculateSingleExecutions()
Calculate 'timeToLaunch' of each SXE.
|
private void |
closePopUp()
Hide the pop-up.
|
protected java.lang.Integer |
doInBackground()
Core functionality of EventClock.
|
private void |
endEvent()
Apply changes to clock in order to make the end of an event effective.
|
private void |
eraseData()
Clears internal data of the EventClock.
|
void |
forceEvent()
Forces the start of next events to be deployed.
|
private void |
generateSingleExecutionInformation()
Generates textual summary about the Single Execution Events loaded.
|
boolean |
getEventInProgress() |
java.util.ArrayList<Event> |
getNewAddedEvents() |
java.util.ArrayList<Event> |
getPXE() |
java.util.ArrayList<Event> |
getSXE() |
private java.lang.String |
getSXEInfo()
Obtain information about the SXE being executed.
|
void |
ignoreEvent()
Avoids the execution of an event, or forces it to end inmediately.
|
void |
loadConfiguration(ConfigLoader configuration)
Loads the configuration into the EventClock.
|
private void |
searchNextEvent()
Search the next events to be deployed.
|
private int |
searchShortestEvent(java.util.ArrayList<Event> listOfEvents)
Searchs in the specified list the event with shortest 'timeToLaunch'.
|
private void |
setClock(int seconds)
Establish clock time.
|
private void |
setPXEInfo()
Sends to pop-up information regards to the Periodical Execution Events.
|
void |
showPopUp()
Make the pop-up visible with the information about the events.
|
void |
stopClock()
Stops EventClock.
|
private void |
triggerEvent(Flags.EventType eventType)
Executes operations related to the start of an event or events.
|
protected void |
updateClock()
Updates EventClock time, decreasing its value.
|
private void |
updateEvents(Flags.EventType eventType)
Updates event 'timeToLaunch' value.
|
private void |
updateLabels()
Updates time label and event label to depict current situation.
|
private void |
waitEventEnd()
Decrease 'timeToEventEnd' value by one until it reaches 0.
|
pauseClock, printClock, startClockjava.util.ArrayList<Event> periodExecutionEventList
java.util.ArrayList<Event> singleExecutionEventList
java.util.ArrayList<Event> newAddedEvents
java.util.ArrayList<java.lang.Integer> eventsToLaunch
java.util.ArrayList<java.lang.Integer> nextPXE
java.util.ArrayList<java.lang.Integer> nextSXE
javax.swing.JLabel eventLabel
GenericPopUp informationPopUp
int timeToNextEvent
int timeToEventEnd
java.lang.String singleExecutionInformation
boolean eventInProgress
SoundLoader soundLoader
boolean isPopUpVisible
boolean playSound
boolean popUpInFront
public EventClock(javax.swing.JLabel timeLabel,
javax.swing.JLabel eventLabel)
timeLabel - label to print time values (hour, minutes and seconds).eventLabel - label to print information about the event or events.public void loadConfiguration(ConfigLoader configuration)
configuration - configuration to be loaded of ConfigLoader type.private void generateSingleExecutionInformation()
private void updateEvents(Flags.EventType eventType)
eventType - type of events to be updated (specifides the list of
events to be iterated).private void triggerEvent(Flags.EventType eventType)
eventType - type of event being started.private void setPXEInfo()
private java.lang.String getSXEInfo()
public void showPopUp()
private void closePopUp()
private void searchNextEvent()
private void updateLabels()
private int searchShortestEvent(java.util.ArrayList<Event> listOfEvents)
listOfEvents - list of events to iterate over.private void setClock(int seconds)
seconds - number of seconds that represents the clock time.private void waitEventEnd()
private void endEvent()
protected void updateClock()
updateClock in class GenericClockGenericClock,
GenericClock.updateClock()public void ignoreEvent()
public void forceEvent()
private void eraseData()
private void calculateSingleExecutions()
private void addNewEvents()
public void stopClock()
stopClock in class GenericClockGenericClock,
GenericClock.stopClock()protected java.lang.Integer doInBackground()
throws java.lang.Exception
doInBackground in class GenericClockjava.lang.Exception - SwingWorker inherited exception.SwingWorker,
SwingWorker.doInBackground()public boolean getEventInProgress()
public java.util.ArrayList<Event> getNewAddedEvents()
public java.util.ArrayList<Event> getPXE()
public java.util.ArrayList<Event> getSXE()