Class ControlPanel

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.util.EventListener

    public abstract class ControlPanel
    extends java.lang.Object
    implements java.awt.event.ActionListener
    • Constructor Summary

      Constructors 
      Constructor Description
      ControlPanel​(java.lang.String name, boolean showGui)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent e)  
      protected void addToMenu​(java.lang.String[] actions, javax.swing.JMenu jm)  
      protected javax.swing.JMenuItem addToMenuWithShortcut​(java.lang.String action, javax.swing.JMenu jm, int key, int modifier)  
      protected void clearAll()  
      protected void clearCurrentSimulation()  
      protected void createToolbar()
      The toolbar for the control panel - open, layer and run The buttons have matching menu items performing the same actions
      protected abstract Sim importFile​(java.io.File sourceFile)  
      Sim initialise​(java.io.File file)  
      protected void loadRunConfigsFromSimulation()
      load the runConfigs from the simulation into the runConfigs map.
      protected void positionViewers()
      Lay out the StandaloneViewer windows in a
      protected void registerSimulation​(Sim sim, java.io.File simFile)
      The control panel handles one simulation at a time, this should be "registered" using this method.
      protected void restoreViewerWindows()  
      protected void runSimulationInNewThread()
      When simulation.run() is called from the actionPerformed method below, it holds up the Java Swing display thread and we don't get the nice animation, so call run() in its own thread here.
      protected void setNewWorkingFile​(java.io.File newfile)  
      protected void setPrevWorkingFile()  
      protected void setRunSimulationEnabled​(boolean enabled)  
      void setTitle​(java.lang.String title)  
      void show()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • frame

        javax.swing.JFrame frame
      • pmain

        javax.swing.JPanel pmain
      • statusLabel

        javax.swing.JLabel statusLabel
      • menuItemReloadAndRun

        javax.swing.JMenuItem menuItemReloadAndRun
      • menuItemDump

        javax.swing.JMenuItem menuItemDump
      • buttonReloadAndRun

        javax.swing.JButton buttonReloadAndRun
      • workingFile

        java.io.File workingFile
      • prevWorkingFile

        java.io.File prevWorkingFile
      • curentSimulation

        Sim curentSimulation
      • runConfigs

        java.util.Map<java.lang.Integer,​RunConfig> runConfigs
      • viewerRects

        java.util.Map<java.lang.String,​java.awt.Rectangle> viewerRects
      • windowDimension

        java.awt.Dimension windowDimension
      • multiThreadService

        java.util.concurrent.ExecutorService multiThreadService
      • showGui

        boolean showGui
    • Constructor Detail

      • ControlPanel

        public ControlPanel​(java.lang.String name,
                            boolean showGui)
    • Method Detail

      • setTitle

        public void setTitle​(java.lang.String title)
      • registerSimulation

        protected void registerSimulation​(Sim sim,
                                          java.io.File simFile)
        The control panel handles one simulation at a time, this should be "registered" using this method. Load all the windows, one per display
        Parameters:
        sim - - simulation object
        simFile - - new file to load (can be null)
        Throws:
        ConnectionError
        ContentError
        RuntimeError
        ParseError
      • createToolbar

        protected final void createToolbar()
        The toolbar for the control panel - open, layer and run The buttons have matching menu items performing the same actions
      • loadRunConfigsFromSimulation

        protected void loadRunConfigsFromSimulation()
        load the runConfigs from the simulation into the runConfigs map. The runConfigs map is indexed for easy referencing
      • positionViewers

        protected void positionViewers()
        Lay out the StandaloneViewer windows in a
      • setRunSimulationEnabled

        protected final void setRunSimulationEnabled​(boolean enabled)
      • addToMenu

        protected final void addToMenu​(java.lang.String[] actions,
                                       javax.swing.JMenu jm)
      • addToMenuWithShortcut

        protected final javax.swing.JMenuItem addToMenuWithShortcut​(java.lang.String action,
                                                                    javax.swing.JMenu jm,
                                                                    int key,
                                                                    int modifier)
        Parameters:
        action - - The name of the action item
        jm - - the menu for this item to be added to
        key - - int representing the ID of KeyEvent (eg KeyEvent.VK_F6)
        modifier - - int representing the ID of ActionEvent (eg ActionEvent.ALT_MASK , 0 for no modifier)
        Returns:
        JMenuItem
      • show

        public final void show()
      • runSimulationInNewThread

        protected void runSimulationInNewThread()
        When simulation.run() is called from the actionPerformed method below, it holds up the Java Swing display thread and we don't get the nice animation, so call run() in its own thread here.
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
      • clearCurrentSimulation

        protected void clearCurrentSimulation()
      • restoreViewerWindows

        protected void restoreViewerWindows()
      • clearAll

        protected void clearAll()
      • setNewWorkingFile

        protected void setNewWorkingFile​(java.io.File newfile)
      • setPrevWorkingFile

        protected void setPrevWorkingFile()