Class JobDashboardView
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.orderedlayout.VerticalLayout>
com.decs.application.views.jobdashboard.JobDashboardView
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasStyle,Serializable
@Route(value="job-dashboard",
layout=MainLayout.class)
@RouteAlias(value="",
layout=MainLayout.class)
@PermitAll
@Uses(com.vaadin.flow.component.icon.Icon.class)
public class JobDashboardView
extends com.vaadin.flow.component.Composite<com.vaadin.flow.component.orderedlayout.VerticalLayout>
Job Dashboard View Class
This class implements the web application job dashboard page. It is responsible for all visual components and their behavior.
- Version:
- 1.0
- Author:
- Bruno Guiomar
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate com.vaadin.flow.component.orderedlayout.VerticalLayoutprivate String[]private com.vaadin.flow.component.grid.Grid<Problem> private com.vaadin.flow.component.orderedlayout.VerticalLayoutprivate com.vaadin.flow.component.orderedlayout.HorizontalLayoutprivate com.vaadin.flow.component.html.Spanprivate com.vaadin.flow.component.button.Buttonprivate com.vaadin.flow.component.grid.dataview.GridListDataView<Problem> private com.vaadin.flow.component.orderedlayout.HorizontalLayoutprivate com.vaadin.flow.component.html.Spanprivate com.vaadin.flow.component.html.Spanprivate com.vaadin.flow.component.notification.Notificationprivate com.vaadin.flow.component.html.Spanprivate com.vaadin.flow.component.html.Spanprivate com.vaadin.flow.component.html.Spanprivate com.vaadin.flow.component.html.Spanprivate com.vaadin.flow.component.html.Spanprivate com.vaadin.flow.component.html.Spanprivate EvolutionEngineprivate com.vaadin.flow.component.orderedlayout.HorizontalLayoutprivate com.vaadin.flow.component.button.Buttonprivate com.vaadin.flow.component.orderedlayout.HorizontalLayoutprivate com.vaadin.flow.component.button.Buttonprivate com.vaadin.flow.component.button.Buttonprivate com.vaadin.flow.component.select.Select<String> private com.vaadin.flow.component.html.Spanprivate com.vaadin.flow.component.html.Spanprivate com.vaadin.flow.component.orderedlayout.VerticalLayoutprivate com.vaadin.flow.component.grid.Grid<Job> private com.vaadin.flow.component.html.Spanprivate com.vaadin.flow.component.button.Buttonprivate final com.vaadin.flow.function.SerializableBiConsumer<com.vaadin.flow.component.button.Button, Job> Creates the solution button for the job activity grid component and defines its behaviorprivate static final com.vaadin.flow.function.SerializableBiConsumer<com.vaadin.flow.component.html.Span, Job> Creates the status badge for the job activity grid component and defines its behaviorprivate com.vaadin.flow.component.grid.dataview.GridListDataView<Job> private com.vaadin.flow.component.button.Buttonprivate com.vaadin.flow.component.orderedlayout.VerticalLayoutprivate com.vaadin.flow.component.orderedlayout.HorizontalLayoutprivate com.vaadin.flow.component.html.NativeLabelprivate com.vaadin.flow.component.orderedlayout.VerticalLayoutprivate com.vaadin.flow.component.orderedlayout.VerticalLayoutprivate com.vaadin.flow.component.progressbar.ProgressBarprivate com.vaadin.flow.component.orderedlayout.VerticalLayoutprivate com.vaadin.flow.component.orderedlayout.HorizontalLayoutprivate com.vaadin.flow.component.html.NativeLabelprivate com.vaadin.flow.component.html.Spanprivate com.vaadin.flow.component.orderedlayout.VerticalLayoutprivate com.vaadin.flow.component.grid.Grid<Job> private com.vaadin.flow.component.html.Spanprivate com.vaadin.flow.component.grid.dataview.GridListDataView<Job> private com.vaadin.flow.component.textfield.TextAreaprivate com.vaadin.flow.component.orderedlayout.VerticalLayoutprivate com.vaadin.flow.component.html.NativeLabelprivate com.vaadin.flow.component.orderedlayout.HorizontalLayoutprivate Jobprivate ObjectListDatabaseprivate com.vaadin.flow.component.button.Buttonprivate final com.vaadin.flow.function.SerializableBiConsumer<com.vaadin.flow.component.button.Button, Problem> Creates the edit button for the job activity grid component and defines its behaviorprivate com.vaadin.flow.component.dialog.Dialogprivate com.vaadin.flow.component.orderedlayout.VerticalLayoutprivate com.vaadin.flow.component.html.Spanprivate com.vaadin.flow.component.html.Spanprivate SessionManagerprivate SlaveManagerprivate com.vaadin.flow.component.button.Buttonprivate com.vaadin.flow.component.button.Buttonprivate com.vaadin.flow.component.textfield.TextAreaprivate Timerprivate com.vaadin.flow.component.UIprivate com.vaadin.flow.component.html.Div -
Constructor Summary
ConstructorsConstructorDescriptionJobDashboardView(SlaveManager slaveManager, ObjectListDatabase objectListDatabase, Timer timer, SessionManager sessionManager, org.springframework.boot.ApplicationArguments args) Class Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a property change listener to the session managerprivate com.vaadin.flow.component.dialog.DialogBuilds a dialog requesting the user to input a name for the jobprivate com.vaadin.flow.component.dialog.DialogbuildProblemEditor(Problem currentProblem) Builds a dialog containing a problem file editorprivate com.vaadin.flow.component.dialog.DialogbuildSolutionsDialog(Job currentJob) Builds a dialog with a job's solutionsprivate voidChecks the system status and updates the visual components accordinglyprivate voidBuilds the available problems sectionprivate com.vaadin.flow.component.dialog.DialogBuilds a dialog informing the user about the new system state (Busy state)private static com.vaadin.flow.component.button.ButtoncreateCloseNotificationBtn(com.vaadin.flow.component.notification.Notification notification) Creates a button specifically for closing a notificationprivate com.vaadin.flow.data.renderer.ComponentRenderer<com.vaadin.flow.component.button.Button, Job> Creates a component renderer for the solution button in the job activity grid componentprivate static com.vaadin.flow.data.renderer.ComponentRenderer<com.vaadin.flow.component.html.Span, Job> Creates a component renderer for the status badge in the job activity grid componentprivate voidBuilds the job progress bar componentprivate voidBuilds the lower widget group sectionprivate com.vaadin.flow.data.renderer.ComponentRenderer<com.vaadin.flow.component.button.Button, Problem> Creates a component renderer for the edit button in the available problems list componentprivate voidAdapts the web app visual components to a busy system statevoidsetJobMetrics(com.vaadin.flow.component.UI ui, int breedThreads, int evalThreads) Sets the initial values for the job metrics visual componentsprivate voidstartProblem(String jobName) Event handler for starting a new Jobprivate voidupdateAvailableProblemsList(com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.button.Button> event) Updates the web application available problems grid componentvoidupdateInferenceResults(com.vaadin.flow.component.UI ui) Updates the visual components with the respective inference resultsvoidupdateJobMetrics(com.vaadin.flow.component.UI ui, int evaluations, int generation) Updates the job metrics visual components with fresh valuesvoidupdateProgressBar(com.vaadin.flow.component.UI ui, float progress) Updates the progress bar with the current Job's execution progressMethods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement, initContentMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
ui
private com.vaadin.flow.component.UI ui -
evolutionEngine
-
newJob
-
slaveManager
-
objectListDatabase
-
timer
-
sessionManager
-
args
-
availableProblemsLayoutGroup
private com.vaadin.flow.component.orderedlayout.HorizontalLayout availableProblemsLayoutGroup -
availableProblemsGridLayout
private com.vaadin.flow.component.orderedlayout.VerticalLayout availableProblemsGridLayout -
availableProblemsUpperGroup
private com.vaadin.flow.component.orderedlayout.HorizontalLayout availableProblemsUpperGroup -
availableProblemsTitle
private com.vaadin.flow.component.html.Span availableProblemsTitle -
availableProblemsTitleUpdateBtn
private com.vaadin.flow.component.button.Button availableProblemsTitleUpdateBtn -
availableProblemsGrid
-
factoryProblemsList
-
userProblemsList
-
availableProblemsUpdater
-
jobProgressBar
private com.vaadin.flow.component.progressbar.ProgressBar jobProgressBar -
jobProgressBarLabelText
private com.vaadin.flow.component.html.NativeLabel jobProgressBarLabelText -
jobProgressBarLabelValue
private com.vaadin.flow.component.html.Span jobProgressBarLabelValue -
jobProgressBarLabel
private com.vaadin.flow.component.orderedlayout.HorizontalLayout jobProgressBarLabel -
jobProgressBarComp
private com.vaadin.flow.component.orderedlayout.VerticalLayout jobProgressBarComp -
lowerWidgetGroup
private com.vaadin.flow.component.orderedlayout.HorizontalLayout lowerWidgetGroup -
jobQueueGrid
-
jobQueueUpdater
-
jobQueueLabel
private com.vaadin.flow.component.html.Span jobQueueLabel -
jobQueue
private com.vaadin.flow.component.orderedlayout.VerticalLayout jobQueue -
jobActivityGrid
-
jobActivityUpdater
-
jobActivityGridLabel
private com.vaadin.flow.component.html.Span jobActivityGridLabel -
jobActivity
private com.vaadin.flow.component.orderedlayout.VerticalLayout jobActivity -
jobActivitySolutionBtn
private com.vaadin.flow.component.button.Button jobActivitySolutionBtn -
problemEditorBtn
private com.vaadin.flow.component.button.Button problemEditorBtn -
verticalSeparator
private com.vaadin.flow.component.html.Div verticalSeparator -
jobMetricsGroupLayout
private com.vaadin.flow.component.orderedlayout.HorizontalLayout jobMetricsGroupLayout -
jobMetricsTitlesLayout
private com.vaadin.flow.component.orderedlayout.VerticalLayout jobMetricsTitlesLayout -
jobMetricsValuesLayout
private com.vaadin.flow.component.orderedlayout.VerticalLayout jobMetricsValuesLayout -
jobMetricsTitleLabel
private com.vaadin.flow.component.html.NativeLabel jobMetricsTitleLabel -
evaluationsTitle
private com.vaadin.flow.component.html.Span evaluationsTitle -
generationTitle
private com.vaadin.flow.component.html.Span generationTitle -
breedThreadsTitle
private com.vaadin.flow.component.html.Span breedThreadsTitle -
evaluationThreadsTitle
private com.vaadin.flow.component.html.Span evaluationThreadsTitle -
randomSeedTitle
private com.vaadin.flow.component.html.Span randomSeedTitle -
connectedSlavesTitle
private com.vaadin.flow.component.html.Span connectedSlavesTitle -
evaluationsValue
private com.vaadin.flow.component.html.Span evaluationsValue -
generationValue
private com.vaadin.flow.component.html.Span generationValue -
breedThreadsValue
private com.vaadin.flow.component.html.Span breedThreadsValue -
evaluationThreadsValue
private com.vaadin.flow.component.html.Span evaluationThreadsValue -
randomSeedValue
private com.vaadin.flow.component.html.Span randomSeedValue -
connectedSlavesValue
private com.vaadin.flow.component.html.Span connectedSlavesValue -
jobMetrics
private com.vaadin.flow.component.orderedlayout.VerticalLayout jobMetrics -
jobResults
private com.vaadin.flow.component.textfield.TextArea jobResults -
jobResultsLayout
private com.vaadin.flow.component.orderedlayout.VerticalLayout jobResultsLayout -
jobResultsTitleLabel
private com.vaadin.flow.component.html.NativeLabel jobResultsTitleLabel -
actionBtnGroup
private com.vaadin.flow.component.orderedlayout.VerticalLayout actionBtnGroup -
startBtn
private com.vaadin.flow.component.button.Button startBtn -
stopBtn
private com.vaadin.flow.component.button.Button stopBtn -
problemEditorDialog
private com.vaadin.flow.component.dialog.Dialog problemEditorDialog -
problemEditorLayoutGroup
private com.vaadin.flow.component.orderedlayout.VerticalLayout problemEditorLayoutGroup -
fileActionsLayoutGroup
private com.vaadin.flow.component.orderedlayout.HorizontalLayout fileActionsLayoutGroup -
fileActionsButtonLayout
private com.vaadin.flow.component.orderedlayout.HorizontalLayout fileActionsButtonLayout -
fileSelector
-
fileActionsOpenBtn
private com.vaadin.flow.component.button.Button fileActionsOpenBtn -
fileActionsSaveBtn
private com.vaadin.flow.component.button.Button fileActionsSaveBtn -
fileActionsDiscardBtn
private com.vaadin.flow.component.button.Button fileActionsDiscardBtn -
textEditor
private com.vaadin.flow.component.textfield.TextArea textEditor -
busyNotification
private com.vaadin.flow.component.notification.Notification busyNotification -
jobDialogBtn
private com.vaadin.flow.component.button.Button jobDialogBtn -
jobActivityStatusUpdater
private static final com.vaadin.flow.function.SerializableBiConsumer<com.vaadin.flow.component.html.Span,Job> jobActivityStatusUpdaterCreates the status badge for the job activity grid component and defines its behavior -
jobActivitySolutionButton
private final com.vaadin.flow.function.SerializableBiConsumer<com.vaadin.flow.component.button.Button,Job> jobActivitySolutionButtonCreates the solution button for the job activity grid component and defines its behavior -
problemEditorButton
private final com.vaadin.flow.function.SerializableBiConsumer<com.vaadin.flow.component.button.Button,Problem> problemEditorButtonCreates the edit button for the job activity grid component and defines its behavior
-
-
Constructor Details
-
JobDashboardView
public JobDashboardView(SlaveManager slaveManager, ObjectListDatabase objectListDatabase, Timer timer, SessionManager sessionManager, org.springframework.boot.ApplicationArguments args) Class Constructor- Parameters:
slaveManager- Slave manager objectobjectListDatabase- Object list database objecttimer- Timer objectsessionManager- Session Manager objectargs- Command line arguments
-
-
Method Details
-
createAvailableProblems
private void createAvailableProblems()Builds the available problems section -
createJobProgressBar
private void createJobProgressBar()Builds the job progress bar component -
createLowerWidgetGroup
private void createLowerWidgetGroup()Builds the lower widget group section -
checkServerStatus
private void checkServerStatus()Checks the system status and updates the visual components accordingly -
updateInferenceResults
public void updateInferenceResults(com.vaadin.flow.component.UI ui) Updates the visual components with the respective inference results- Parameters:
ui- UI object to be updated
-
updateProgressBar
public void updateProgressBar(com.vaadin.flow.component.UI ui, float progress) Updates the progress bar with the current Job's execution progress- Parameters:
ui- UI object to be updatedprogress- Current Job's progress value
-
setJobMetrics
public void setJobMetrics(com.vaadin.flow.component.UI ui, int breedThreads, int evalThreads) Sets the initial values for the job metrics visual components- Parameters:
ui- UI object to be updatedbreedThreads- Amount of CPU threads being used for the evolutionary breeding processevalThreads- Amount of CPU threads being used for the evolutionary evaluation process
-
updateJobMetrics
public void updateJobMetrics(com.vaadin.flow.component.UI ui, int evaluations, int generation) Updates the job metrics visual components with fresh values- Parameters:
ui- UI object to be updatedevaluations- Number of performed evaluationsgeneration- Current generation
-
startProblem
Event handler for starting a new Job- Parameters:
jobName- Name for the new job
-
updateAvailableProblemsList
private void updateAvailableProblemsList(com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.button.Button> event) Updates the web application available problems grid component- Parameters:
event- Event object
-
buildJobNameDialog
private com.vaadin.flow.component.dialog.Dialog buildJobNameDialog()Builds a dialog requesting the user to input a name for the job- Returns:
- Dialog object
-
buildSolutionsDialog
Builds a dialog with a job's solutions- Parameters:
currentJob- Respective Job for the solutions to be extracted- Returns:
- Dialog object
-
buildProblemEditor
Builds a dialog containing a problem file editor- Parameters:
currentProblem- Problem to be edited- Returns:
- Dialog object
-
addEvolutionEngineBusyListener
public void addEvolutionEngineBusyListener()Adds a property change listener to the session manager -
evolutionEngineBusyEvent
Adapts the web app visual components to a busy system stateThis method is called whenever the system state transitions to 'busy' and the web app must adapt itself to block the current user from starting another Job.
- Parameters:
evt- Fired event
-
createBusyInfoDialog
private com.vaadin.flow.component.dialog.Dialog createBusyInfoDialog()Builds a dialog informing the user about the new system state (Busy state)- Returns:
- Dialog object
-
createCloseNotificationBtn
private static com.vaadin.flow.component.button.Button createCloseNotificationBtn(com.vaadin.flow.component.notification.Notification notification) Creates a button specifically for closing a notification- Parameters:
notification- Notification to be closed- Returns:
- Button object
-
createJobActivityStatusRenderer
private static com.vaadin.flow.data.renderer.ComponentRenderer<com.vaadin.flow.component.html.Span,Job> createJobActivityStatusRenderer()Creates a component renderer for the status badge in the job activity grid component- Returns:
- Component renderer object
-
createJobActivitySolutionRenderer
private com.vaadin.flow.data.renderer.ComponentRenderer<com.vaadin.flow.component.button.Button,Job> createJobActivitySolutionRenderer()Creates a component renderer for the solution button in the job activity grid component- Returns:
- Component renderer object
-
createProblemEditorRenderer
private com.vaadin.flow.data.renderer.ComponentRenderer<com.vaadin.flow.component.button.Button,Problem> createProblemEditorRenderer()Creates a component renderer for the edit button in the available problems list component- Returns:
- Component renderer object
-