Class EjsControlFrame

All Implemented Interfaces:
RootPaneContainer, Control, MainFrame, SimControl
Direct Known Subclasses:
EjsCalculationControl, EjsSimulationControl

public class EjsControlFrame extends ParsedEjsControl implements RootPaneContainer, MainFrame
EjsControlFrame defines an Easy Java Simulations control that is guaranteed to have a parent frame.
Version:
1.0
Author:
Wolfgang Christian
  • Field Details

  • Constructor Details

    • EjsControlFrame

      public EjsControlFrame(Object _simulation)
      Constructor EjsControlFrame
      Parameters:
      _simulation -
    • EjsControlFrame

      public EjsControlFrame(Object _simulation, String param)
      Constructor EjsControlFrame
      Parameters:
      _simulation -
      param -
  • Method Details

    • addChildFrame

      public void addChildFrame(JFrame child)
      Adds a child frame that depends on the main frame. Child frames are closed when this frame is closed.
      Specified by:
      addChildFrame in interface MainFrame
      Parameters:
      mainFrame - JFrame
    • clearChildFrames

      public void clearChildFrames()
      Clears the child frames from the main frame.
      Specified by:
      clearChildFrames in interface MainFrame
    • getChildFrames

      public Collection<JFrame> getChildFrames()
      Gets a copy of the ChildFrames collection.
      Specified by:
      getChildFrames in interface MainFrame
      Returns:
      Collection
    • getMainFrame

      public OSPFrame getMainFrame()
      Gets the OSPFrame that contains the control. The main frame will usually exit program when it is closed.
      Specified by:
      getMainFrame in interface MainFrame
      Returns:
    • getMainFrameSize

      public int[] getMainFrameSize()
      Gets the Main Frame size.
    • getFrame

      @Deprecated public OSPFrame getFrame()
      Deprecated.
      Gets the OSPFrame that contains the control. Replaced by getMainFrame to implement MainFrame interface.
      Returns:
    • loadToolsMenu

      protected JMenu loadToolsMenu()
      Adds a Tools menu to the menu bar.
    • loadDisplayMenu

      protected void loadDisplayMenu()
      Adds a Display menu to the menu bar.
    • printToGraphics

      public int printToGraphics(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException
      Draws the frame into a graphics object suitable for printing.
      Parameters:
      g -
      pageFormat -
      pageIndex -
      Returns:
      status code
      Throws:
      PrinterException
    • refreshGUI

      protected void refreshGUI()
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Adds a PropertyChangeListener.
      Parameters:
      listener - the object requesting property change notification
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Removes a PropertyChangeListener.
      Parameters:
      listener - the listener requesting removal
    • println

      public void println(String s)
      Prints a string in the control's message area followed by a CR and LF. GUI controls will usually display messages in a non-editable text area.
      Specified by:
      println in interface Control
      Overrides:
      println in class EjsControl
      Parameters:
      s -
    • println

      public void println()
      Prints a blank line in the control's message area. GUI controls will usually display messages in a non-editable text area.
      Specified by:
      println in interface Control
      Overrides:
      println in class EjsControl
    • print

      public void print(String s)
      Prints a string in the control's message area. GUI controls will usually display messages in a non-editable text area.
      Specified by:
      print in interface Control
      Overrides:
      print in class EjsControl
      Parameters:
      s -
    • clearMessages

      public void clearMessages()
      Remove all text from the message area.
      Specified by:
      clearMessages in interface Control
      Overrides:
      clearMessages in class EjsControl
    • calculationDone

      public void calculationDone(String message)
      Stops the animation and prints a message.
      Specified by:
      calculationDone in interface Control
      Overrides:
      calculationDone in class EjsControl
      Parameters:
      message - String
    • render

      public void render()
      Renders the frame. Subclass this method to render the contents of this frame in the calling thread.
    • addObject

      public ControlElement addObject(Object object, String classname, String propList)
      Adds an existing object to this control.
      Overrides:
      addObject in class EjsControl
      Parameters:
      object - Object
      classname - String
      propList - String
      Returns:
      ControlElement
    • clearData

      public void clearData()
      Clears data from drawing objects within this frame. Override this method to clear objects that have data.
    • clearDataAndRepaint

      public void clearDataAndRepaint()
      Clears data from drawing objects within this frame. Override this method to clear and repaint objects that have data.
    • getTopLevelAncestor

      public Container getTopLevelAncestor()
      Gets the frame that contains the control.
      Returns:
    • getRootPane

      public JRootPane getRootPane()
      Gets the frame's root pane. Implementation of RootPaneContainer.
      Specified by:
      getRootPane in interface RootPaneContainer
      Returns:
    • getContentPane

      public Container getContentPane()
      Gets the frame's content pane. Implementation of RootPaneContainer.
      Specified by:
      getContentPane in interface RootPaneContainer
      Returns:
      content pane of the frame
    • setContentPane

      public void setContentPane(Container contentPane)
      Sets the frame's content pane. Implementation of RootPaneContainer.
      Specified by:
      setContentPane in interface RootPaneContainer
      Parameters:
      contentPane -
    • getLayeredPane

      public JLayeredPane getLayeredPane()
      Implementation of RootPaneContainer.
      Specified by:
      getLayeredPane in interface RootPaneContainer
      Returns:
      layeredPane of the frame
      See Also:
    • setLayeredPane

      public void setLayeredPane(JLayeredPane layeredPane)
      Implementation of RootPaneContainer.
      Specified by:
      setLayeredPane in interface RootPaneContainer
      Parameters:
      layeredPane -
      See Also:
    • getGlassPane

      public Component getGlassPane()
      Implementation of RootPaneContainer.
      Specified by:
      getGlassPane in interface RootPaneContainer
      Returns:
      glass pane component
      See Also:
    • setGlassPane

      public void setGlassPane(Component glassPane)
      Implementation of RootPaneContainer.
      Specified by:
      setGlassPane in interface RootPaneContainer
      Parameters:
      glassPane -
      See Also:
    • parseXMLMenu

      public void parseXMLMenu(String xmlMenu)
    • saveXML

      public void saveXML()
    • getOSPApp

      public OSPApplication getOSPApp()
      Gets the OSP Application controlled by this frame.
      Specified by:
      getOSPApp in interface MainFrame
      Returns:
    • loadDefaultXML

      public void loadDefaultXML()
      Loads the current XML default.
    • clearDefaultXML

      public void clearDefaultXML()
      Clears the current XML default.
    • loadXML

      public void loadXML(String fileName)
    • loadXML

      public void loadXML(XMLControlElement xml, boolean compatibleModel)
    • loadXML

      public void loadXML()
    • inspectXML

      public void inspectXML()
    • loadXML

      public void loadXML(String[] args)