org.opensourcephysics.ejs.control
Class EjsControlFrame

java.lang.Object
  extended by org.opensourcephysics.ejs.control.GroupControl
      extended by org.opensourcephysics.ejs.control.EjsControl
          extended by org.opensourcephysics.ejs.control.ParsedEjsControl
              extended by org.opensourcephysics.ejs.control.EjsControlFrame
All Implemented Interfaces:
javax.swing.RootPaneContainer, Control, MainFrame, SimControl
Direct Known Subclasses:
EjsCalculationControl, EjsSimulationControl

public class EjsControlFrame
extends ParsedEjsControl
implements javax.swing.RootPaneContainer, MainFrame

EjsControlFrame defines an Easy Java Simulations control that is guaranteed to have a parent frame.

Version:
1.0
Author:
Wolfgang Christian

Field Summary
protected  OSPApplication app
           
protected  javax.swing.JMenuItem clearItem
           
protected  javax.swing.JMenuItem[] languageItems
           
protected  javax.swing.JMenu languageMenu
           
protected  javax.swing.JFrame messageFrame
           
protected  Tool reply
           
protected  javax.swing.JMenuItem snapshotItem
           
protected  java.beans.PropertyChangeSupport support
           
protected  javax.swing.JMenuItem translateItem
           
protected  javax.swing.JMenuItem videoItem
           
protected  XMLControlElement xmlDefault
           
 
Fields inherited from class org.opensourcephysics.ejs.control.GroupControl
DEBUG_ALL, DEBUG_CONTROL, DEBUG_CONTROL_VERBOSE, DEBUG_DRAWING, DEBUG_DRAWING_VERBOSE, DEBUG_ELEMENTS, DEBUG_NONE, DEBUG_SET_AND_GET, DEBUG_SYSTEM, DEBUG_SYSTEM_VERBOSE, replaceOwnerFrame, replaceOwnerName
 
Fields inherited from interface org.opensourcephysics.controls.Control
NOT_EDITABLE_BACKGROUND
 
Constructor Summary
EjsControlFrame(java.lang.Object _simulation)
          Constructor EjsControlFrame
EjsControlFrame(java.lang.Object _simulation, java.lang.String param)
          Constructor EjsControlFrame
 
Method Summary
 void addChildFrame(javax.swing.JFrame child)
          Adds a child frame that depends on the main frame.
 ControlElement addObject(java.lang.Object object, java.lang.String classname, java.lang.String propList)
          Adds an existing object to this control.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 void calculationDone(java.lang.String message)
          Stops the animation and prints a message.
 void clearChildFrames()
          Clears the child frames from the main frame.
 void clearData()
          Clears data from drawing objects within this frame.
 void clearDataAndRepaint()
          Clears data from drawing objects within this frame.
 void clearDefaultXML()
          Clears the current XML default.
 void clearMessages()
          Remove all text from the message area.
 java.util.Collection<javax.swing.JFrame> getChildFrames()
          Gets a copy of the ChildFrames collection.
 java.awt.Container getContentPane()
          Gets the frame's content pane.
 OSPFrame getFrame()
          Deprecated.  
 java.awt.Component getGlassPane()
          Implementation of RootPaneContainer.
 javax.swing.JLayeredPane getLayeredPane()
          Implementation of RootPaneContainer.
 OSPFrame getMainFrame()
          Gets the OSPFrame that contains the control.
 OSPApplication getOSPApp()
          Gets the OSP Application controlled by this frame.
 javax.swing.JRootPane getRootPane()
          Gets the frame's root pane.
 java.awt.Container getTopLevelAncestor()
          Gets the frame that contains the control.
 void inspectXML()
           
 void loadDefaultXML()
          Loads the current XML default.
protected  void loadDisplayMenu()
          Adds a Display menu to the menu bar.
protected  javax.swing.JMenu loadToolsMenu()
          Adds a Tools menu to the menu bar.
 void loadXML()
           
 void loadXML(java.lang.String fileName)
           
 void loadXML(java.lang.String[] args)
           
 void loadXML(XMLControlElement xml, boolean compatibleModel)
           
 void parseXMLMenu(java.lang.String xmlMenu)
           
 void print(java.lang.String s)
          Prints a string in the control's message area.
 void println()
          Prints a blank line in the control's message area.
 void println(java.lang.String s)
          Prints a string in the control's message area followed by a CR and LF.
 int printToGraphics(java.awt.Graphics g, java.awt.print.PageFormat pageFormat, int pageIndex)
          Draws the frame into a graphics object suitable for printing.
protected  void refreshGUI()
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener.
 void render()
          Renders the frame.
 void saveXML()
           
 void setContentPane(java.awt.Container contentPane)
          Sets the frame's content pane.
 void setGlassPane(java.awt.Component glassPane)
          Implementation of RootPaneContainer.
 void setLayeredPane(javax.swing.JLayeredPane layeredPane)
          Implementation of RootPaneContainer.
 
Methods inherited from class org.opensourcephysics.ejs.control.ParsedEjsControl
getDouble, getInt, getObject, removeParameter, setAdjustableValue, setAdjustableValue, setAdjustableValue, setAdjustableValue, setParameterToFixed
 
Methods inherited from class org.opensourcephysics.ejs.control.EjsControl
clearValues, getPropertyNames, getValue, reset, setLockValues, setValue
 
Methods inherited from class org.opensourcephysics.ejs.control.GroupControl
add, add, addListener, addListener, addNamed, addObject, addTarget, appendPrefixPath, clear, clearPrefixPath, clearVariables, destroy, destroy, getBoolean, getComponent, getContainer, getControl, getDebugLevel, getDefaultPrefixList, getElement, getLoader, getOwnerFrame, getReplaceOwnerFrame, getReplaceOwnerName, getSimulation, getString, getTarget, getTopLevelAncestor, getVisual, initialize, isVariableRegistered, registerVariable, removeTarget, rename, replaceOwnerFrame, setActive, setDebugLevel, setOwnerFrame, setSimulation, setValue, setValue, setValue, setValue, setValue, update, variableChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensourcephysics.controls.Control
clearValues, getBoolean, getPropertyNames, getString, setLockValues, setValue, setValue, setValue, setValue
 

Field Detail

reply

protected Tool reply

languageItems

protected javax.swing.JMenuItem[] languageItems

translateItem

protected javax.swing.JMenuItem translateItem

snapshotItem

protected javax.swing.JMenuItem snapshotItem

videoItem

protected javax.swing.JMenuItem videoItem

clearItem

protected javax.swing.JMenuItem clearItem

languageMenu

protected javax.swing.JMenu languageMenu

messageFrame

protected javax.swing.JFrame messageFrame

xmlDefault

protected volatile XMLControlElement xmlDefault

support

protected java.beans.PropertyChangeSupport support

app

protected OSPApplication app
Constructor Detail

EjsControlFrame

public EjsControlFrame(java.lang.Object _simulation)
Constructor EjsControlFrame

Parameters:
_simulation -

EjsControlFrame

public EjsControlFrame(java.lang.Object _simulation,
                       java.lang.String param)
Constructor EjsControlFrame

Parameters:
_simulation -
param -
Method Detail

addChildFrame

public void addChildFrame(javax.swing.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 java.util.Collection<javax.swing.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.

Specified by:
getMainFrame in interface MainFrame
Returns:

getFrame

public OSPFrame getFrame()
Deprecated. 

Gets the OSPFrame that contains the control. Replaced by getMainFrame to implement MainFrame interface.

Returns:

loadToolsMenu

protected javax.swing.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(java.awt.Graphics g,
                           java.awt.print.PageFormat pageFormat,
                           int pageIndex)
                    throws java.awt.print.PrinterException
Draws the frame into a graphics object suitable for printing.

Parameters:
g -
pageFormat -
pageIndex -
Returns:
status code
Throws:
java.awt.print.PrinterException

refreshGUI

protected void refreshGUI()

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener.

Parameters:
listener - the object requesting property change notification

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener.

Parameters:
listener - the listener requesting removal

println

public void println(java.lang.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(java.lang.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(java.lang.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(java.lang.Object object,
                                java.lang.String classname,
                                java.lang.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 java.awt.Container getTopLevelAncestor()
Gets the frame that contains the control.

Returns:

getRootPane

public javax.swing.JRootPane getRootPane()
Gets the frame's root pane. Implementation of RootPaneContainer.

Specified by:
getRootPane in interface javax.swing.RootPaneContainer
Returns:

getContentPane

public java.awt.Container getContentPane()
Gets the frame's content pane. Implementation of RootPaneContainer.

Specified by:
getContentPane in interface javax.swing.RootPaneContainer
Returns:
content pane of the frame

setContentPane

public void setContentPane(java.awt.Container contentPane)
Sets the frame's content pane. Implementation of RootPaneContainer.

Specified by:
setContentPane in interface javax.swing.RootPaneContainer
Parameters:
contentPane -

getLayeredPane

public javax.swing.JLayeredPane getLayeredPane()
Implementation of RootPaneContainer.

Specified by:
getLayeredPane in interface javax.swing.RootPaneContainer
Returns:
layeredPane of the frame
See Also:
RootPaneContainer

setLayeredPane

public void setLayeredPane(javax.swing.JLayeredPane layeredPane)
Implementation of RootPaneContainer.

Specified by:
setLayeredPane in interface javax.swing.RootPaneContainer
Parameters:
layeredPane -
See Also:
RootPaneContainer

getGlassPane

public java.awt.Component getGlassPane()
Implementation of RootPaneContainer.

Specified by:
getGlassPane in interface javax.swing.RootPaneContainer
Returns:
glass pane component
See Also:
RootPaneContainer

setGlassPane

public void setGlassPane(java.awt.Component glassPane)
Implementation of RootPaneContainer.

Specified by:
setGlassPane in interface javax.swing.RootPaneContainer
Parameters:
glassPane -
See Also:
RootPaneContainer

parseXMLMenu

public void parseXMLMenu(java.lang.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(java.lang.String fileName)

loadXML

public void loadXML(XMLControlElement xml,
                    boolean compatibleModel)

loadXML

public void loadXML()

inspectXML

public void inspectXML()

loadXML

public void loadXML(java.lang.String[] args)