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 Details

    • ui

      private com.vaadin.flow.component.UI ui
    • evolutionEngine

      private EvolutionEngine evolutionEngine
    • newJob

      private Job newJob
    • slaveManager

      private SlaveManager slaveManager
    • objectListDatabase

      private ObjectListDatabase objectListDatabase
    • timer

      private Timer timer
    • sessionManager

      private SessionManager sessionManager
    • args

      private String[] 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

      private com.vaadin.flow.component.grid.Grid<Problem> availableProblemsGrid
    • factoryProblemsList

      private ArrayList<Problem> factoryProblemsList
    • userProblemsList

      private ArrayList<Problem> userProblemsList
    • availableProblemsUpdater

      private com.vaadin.flow.component.grid.dataview.GridListDataView<Problem> 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

      private com.vaadin.flow.component.grid.Grid<Job> jobQueueGrid
    • jobQueueUpdater

      private com.vaadin.flow.component.grid.dataview.GridListDataView<Job> jobQueueUpdater
    • jobQueueLabel

      private com.vaadin.flow.component.html.Span jobQueueLabel
    • jobQueue

      private com.vaadin.flow.component.orderedlayout.VerticalLayout jobQueue
    • jobActivityGrid

      private com.vaadin.flow.component.grid.Grid<Job> jobActivityGrid
    • jobActivityUpdater

      private com.vaadin.flow.component.grid.dataview.GridListDataView<Job> 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

      private com.vaadin.flow.component.select.Select<String> 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> jobActivityStatusUpdater
      Creates 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> jobActivitySolutionButton
      Creates 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> problemEditorButton
      Creates 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 object
      objectListDatabase - Object list database object
      timer - Timer object
      sessionManager - Session Manager object
      args - 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 updated
      progress - 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 updated
      breedThreads - Amount of CPU threads being used for the evolutionary breeding process
      evalThreads - 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 updated
      evaluations - Number of performed evaluations
      generation - Current generation
    • startProblem

      private void startProblem(String jobName)
      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

      private com.vaadin.flow.component.dialog.Dialog buildSolutionsDialog(Job currentJob)
      Builds a dialog with a job's solutions
      Parameters:
      currentJob - Respective Job for the solutions to be extracted
      Returns:
      Dialog object
    • buildProblemEditor

      private com.vaadin.flow.component.dialog.Dialog buildProblemEditor(Problem currentProblem)
      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

      private void evolutionEngineBusyEvent(PropertyChangeEvent evt)
      Adapts the web app visual components to a busy system state

      This 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