Class AnimationPanel

All Implemented Interfaces:
GuiInterface, ImageObserver, MenuContainer, Serializable, Accessible

public class AnimationPanel extends JMCHWizardPanel implements GuiInterface
Panel for JTeach models. It is the same class for all types of Queueing Network.
Author:
Lorenzo Torri Date: 30-mar-2024 Time: 14.40
See Also:
  • Field Details

    • editArrivalDistrAction

      protected AbstractAction editArrivalDistrAction
    • editServiceDistrAction

      protected AbstractAction editServiceDistrAction
  • Constructor Details

  • Method Details

    • createMenu

      protected void createMenu()
      Update the menuBar for the Scheduling Window
    • createToolbar

      protected void createToolbar()
      Update the toolbar for the Scheduling Window
    • canGoBack

      public boolean canGoBack()
      Overrides:
      canGoBack in class WizardPanel
      Returns:
      true if it is ok for the wizard to go back. It is ok for the queried panel to pop up a message box explaining why it cannot go back.
    • getName

      public String getName()
      Overrides:
      getName in class JMCHWizardPanel
      Returns:
      the panel's name
    • getSimulationType

      public SimulationType getSimulationType()
    • startAnimation

      public void startAnimation()
      Description copied from class: JMCHWizardPanel
      Starts the animation
      Overrides:
      startAnimation in class JMCHWizardPanel
    • setUpAnimation

      public void setUpAnimation()
    • pauseAnimation

      public void pauseAnimation()
      Description copied from class: JMCHWizardPanel
      Pauses the animation
      Overrides:
      pauseAnimation in class JMCHWizardPanel
    • reloadAnimation

      public void reloadAnimation()
      Description copied from class: JMCHWizardPanel
      Reloads the animation
      Overrides:
      reloadAnimation in class JMCHWizardPanel
    • nextStepAnimation

      public void nextStepAnimation()
      Description copied from class: JMCHWizardPanel
      Updates the animation to the next step
      Overrides:
      nextStepAnimation in class JMCHWizardPanel
    • resetNextStepAnimation

      public void resetNextStepAnimation()
      Set all the buttons correclty when the Step simulation is complete (called by AnimationClass)
    • increaseVelocity

      public void increaseVelocity()
      Description copied from class: JMCHWizardPanel
      Double the animation's velocity
      Overrides:
      increaseVelocity in class JMCHWizardPanel
    • decreaseVelocity

      public void decreaseVelocity()
      Description copied from class: JMCHWizardPanel
      Halve the animation's velocity
      Overrides:
      decreaseVelocity in class JMCHWizardPanel
    • stopAnimation

      public void stopAnimation()
      Description copied from class: JMCHWizardPanel
      Stops the simulation, used in Markov Chain, but also in the Simulation Models in reverse mode (it's the simulation that decides when the animation has to be stopped and all the UI changes must be done)
      Overrides:
      stopAnimation in class JMCHWizardPanel
    • setLastPanel

      public void setLastPanel()
      Overrides:
      setLastPanel in class JMCHWizardPanel
    • lostFocus

      public void lostFocus()
      Description copied from class: WizardPanel
      called by the Wizard before when switching to another panel
      Overrides:
      lostFocus in class WizardPanel
    • enableButtons

      public void enableButtons(boolean str, boolean ps, boolean rl, boolean nxtSt, boolean decVel, boolean incVel)
      Enable or disable the buttons
      Parameters:
      str - start button
      ps - pause button
      rl - reload button
      nxtSt - nextStep button
      decVel - decreseVelocity button
      incVel - increaseVelocity button
    • showErrorMessage

      public void showErrorMessage(String message)
      Description copied from interface: GuiInterface
      Shows a panel with an error message
      Specified by:
      showErrorMessage in interface GuiInterface
      Parameters:
      message - specified error message
    • handleException

      public void handleException(Exception e)
      Description copied from interface: GuiInterface
      Shows a panel with caught exception
      Specified by:
      handleException in interface GuiInterface
      Parameters:
      e - exception to be shown
    • changeSimActionsState

      public void changeSimActionsState(boolean start, boolean pause, boolean stop)
      Description copied from interface: GuiInterface
      Changes simulation action status. This method is called by DispatcherThread.
      Specified by:
      changeSimActionsState in interface GuiInterface
      Parameters:
      start - state for start action
      pause - state for pause action
      stop - state for stop action
    • setResultsWindow

      public void setResultsWindow(JFrame rsw)
      Description copied from interface: GuiInterface
      Sets resultWindow to be shown. This method is used by pollerThread.
      Specified by:
      setResultsWindow in interface GuiInterface
      Parameters:
      rsw - window to be set as current ResultsWindow
    • showResultsWindow

      public void showResultsWindow()
      Description copied from interface: GuiInterface
      Shows results window. This method is used by pollerThread.
      Specified by:
      showResultsWindow in interface GuiInterface
    • isAnimationDisplayable

      public boolean isAnimationDisplayable()
      Description copied from interface: GuiInterface
      Used to discover if the instance can display simulation animation
      Specified by:
      isAnimationDisplayable in interface GuiInterface
      Returns:
      true if the instance can display simulation animation
    • showRelatedPanel

      public void showRelatedPanel(int problemType, int problemSubType, Object relatedStation, Object relatedCLass)
      Description copied from interface: GuiInterface
      Shows the panel to solve a problem
      Specified by:
      showRelatedPanel in interface GuiInterface
    • setAnimationHolder

      public void setAnimationHolder(Thread thread)
      Specified by:
      setAnimationHolder in interface GuiInterface
    • getFileName

      public String getFileName()
      Specified by:
      getFileName in interface GuiInterface
    • simulationFinished

      public void simulationFinished()
      Called by dispatcher when the simulation with JSIM Engine is finished. I opted for this solution since the progressionListener is not very well synchronized with the available data, it happened most of the times that the progression was 100% but there was no available data
      Specified by:
      simulationFinished in interface GuiInterface
    • getLastMeasure

      public double getLastMeasure(MeasureDefinition md, int index)
    • updateAnimResults

      public void updateAnimResults(int genereatedJobs, double[] measures)
    • terminateThreads

      public void terminateThreads()
    • exit

      public void exit()
      Description copied from class: JMCHWizardPanel
      Go back to the main menu
      Overrides:
      exit in class JMCHWizardPanel