vmm.ode
Class ODE_2D.ODEView

java.lang.Object
  extended by vmm.core.View
      extended by vmm.ode.ODE_2D.ODEView
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.ChangeListener, Decorateable, Parameterizable
Enclosing class:
ODE_2D

public class ODE_2D.ODEView
extends View

Represents the default view for an ODEFirstOrder2D.


Field Summary
protected  ToggleAction animateDrawingToggle
           
protected  ToggleAction connectDotsToggle
           
protected  AbstractActionVMM continueOrbitAction
           
protected  AbstractActionVMM eraseOrbitsAction
           
protected  ActionRadioGroup orbitTypeSelect
           
protected  ToggleAction showControlPanelToggle
           
protected  ToggleAction showDirectionFieldToggle
           
protected  ToggleAction showProjectedOrbitsToggle
           
 
Fields inherited from class vmm.core.View
backgroundCommands, buildAnimation, buildingImageForFilmstrip, currentGraphics, decorations, directOffscreenDrawing, fullOSI, needsRedraw, offscreenImageType, parameters, showAxesAction
 
Constructor Summary
ODE_2D.ODEView()
           
 
Method Summary
 void addExtraXML(org.w3c.dom.Document containingDocument, org.w3c.dom.Element viewElement)
          This method is called when an XML representation of this view is being constructed by the SaveAndRestore class to give the View a chance to add any extra infomation that is not saved by default.
 ActionList getActions()
          Generates a list of "Action commands" that can be applied to this View.
 boolean getAnimateDrawing()
           
 boolean getConnectDotsOnOrbit()
          Tells whether orbits should be drawn as dots or as solid lines.
protected  vmm.ode.ODE_2D.Orbit getCurrentOrbit()
          Returns the current orbit (shown in green), if any.
 double getCurrentTimeFromControlPanel()
           
 MouseTask getDefaultMouseTask()
          Returns a MouseTask that can be installed in the Display attached to this View.
 int getOrbitType()
           
 boolean getShowControlPanel()
           
 boolean getShowDirectionField()
           
 boolean getShowProjectedOrbits()
           
 void readExtraXML(org.w3c.dom.Element viewInfo)
          This method is called when this View is being reconstructed from an XML representation by the SaveAndRestore class.
 void setAnimateDrawing(boolean animateDrawing)
           
 void setConnectDotsOnOrbit(boolean connectDotsOnOrbit)
          Set the property that tells whether an orbit should be drawn simply as a sequence of dots, or the dots should be connected to make a solid curve.
protected  void setCurrentOrbit(vmm.ode.ODE_2D.Orbit orbit)
          Sets the current orbit (shown in green).
 void setDisplay(Display display)
          Sets the Display where this View is installed.
 void setExhibit(Exhibit ex)
          Set the Exhibit that is shown in this View.
 void setOrbitType(int type)
           
 void setShowControlPanel(boolean showControlPanel)
           
 void setShowDirectionField(boolean showDirectionField)
          The showDirectionField property determines whether a direction field is drawn for the exhibit in this view.
 void setShowProjectedOrbits(boolean showProjectedOrbits)
          When the showProjectedOrbits property is true, an auxiliary view is added to the bottom of the display where the x- and y-coordinates of the points on the current orbit are plotted.
 void startOrbitAtPoint(double[] initialPointData)
           
 void stateChanged(javax.swing.event.ChangeEvent evt)
          A View listens for state change events that are generated when the Exhibit or Decoration that it is displaying is changed, or by the transform (that converts real coords to pixel coords).
 
Methods inherited from class vmm.core.View
addDecoration, addParameter, beginDrawToOffscreenImage, clearDecorations, clearOSI, createAxes, createOSI, doDraw, drawCurve, drawCurve, drawCurve, drawDot, drawLine, drawLine, drawLineDirect, drawPixel, drawPixel, drawPixelDirect, drawPixels, drawString, drawString, endDrawToOffscreenImage, fillRectDirect, finish, finishOSIDraw, forceRedraw, getActionsForViewAndExhibit, getAdditionalAnimations, getAdditionalAnimationsForViewAndExhibit, getAntialiased, getApplyGraphics2DTransform, getBackground, getColor, getDecorations, getDisplay, getExhibit, getFastDrawing, getForeground, getImage, getName, getParameterByName, getParameters, getPreserveAspect, getRequestedWindow, getSettingsCommands, getSettingsCommandsForViewAndExhibit, getShowAxes, getStatusText, getTitle, getTransform, getViewAndExhibitParameters, getViewCommands, getWindow, needsNewOSI, parameterChanged, prepareOSIForDrawing, putOSI, removeDecoration, removeParameter, render, setAntialiased, setApplyGraphics2DTransform, setBackground, setColor, setFastDrawing, setFastDrawing, setForeground, setName, setPreserveAspect, setShowAxes, setStrokeSizeMultiplier, setTransform, setWindow, setWindow, takeExhibit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

showDirectionFieldToggle

protected ToggleAction showDirectionFieldToggle

showProjectedOrbitsToggle

protected ToggleAction showProjectedOrbitsToggle

animateDrawingToggle

protected ToggleAction animateDrawingToggle

showControlPanelToggle

protected ToggleAction showControlPanelToggle

continueOrbitAction

protected AbstractActionVMM continueOrbitAction

connectDotsToggle

protected ToggleAction connectDotsToggle

eraseOrbitsAction

protected AbstractActionVMM eraseOrbitsAction

orbitTypeSelect

protected ActionRadioGroup orbitTypeSelect
Constructor Detail

ODE_2D.ODEView

public ODE_2D.ODEView()
Method Detail

getShowDirectionField

public boolean getShowDirectionField()

setShowDirectionField

public void setShowDirectionField(boolean showDirectionField)
The showDirectionField property determines whether a direction field is drawn for the exhibit in this view. This property is true by default. This method has no effect if the exhbit can't show direction fields.


getAnimateDrawing

public boolean getAnimateDrawing()

setAnimateDrawing

public void setAnimateDrawing(boolean animateDrawing)

getCurrentOrbit

protected vmm.ode.ODE_2D.Orbit getCurrentOrbit()
Returns the current orbit (shown in green), if any.


setCurrentOrbit

protected void setCurrentOrbit(vmm.ode.ODE_2D.Orbit orbit)
Sets the current orbit (shown in green). When a new orbit is added to the exhibit, this method is called, so that the new orbit becomes the current orbit.


getConnectDotsOnOrbit

public boolean getConnectDotsOnOrbit()
Tells whether orbits should be drawn as dots or as solid lines.

See Also:
setConnectDotsOnOrbit(boolean)

setConnectDotsOnOrbit

public void setConnectDotsOnOrbit(boolean connectDotsOnOrbit)
Set the property that tells whether an orbit should be drawn simply as a sequence of dots, or the dots should be connected to make a solid curve. If there is a current (green) orbit when the property is changed, the new value is applied immediately to the current orbit. It also applies to new orbits created in the future. It does not change the appearance of old (red) orbits that exist when the value of the property is set.


getShowProjectedOrbits

public boolean getShowProjectedOrbits()

getOrbitType

public int getOrbitType()

setOrbitType

public void setOrbitType(int type)

getShowControlPanel

public boolean getShowControlPanel()

setShowControlPanel

public void setShowControlPanel(boolean showControlPanel)

setShowProjectedOrbits

public void setShowProjectedOrbits(boolean showProjectedOrbits)
When the showProjectedOrbits property is true, an auxiliary view is added to the bottom of the display where the x- and y-coordinates of the points on the current orbit are plotted. This property is false by default.


getActions

public ActionList getActions()
Description copied from class: View
Generates a list of "Action commands" that can be applied to this View. The commands must implement the ActionItem interface and will generally belong to one of the classes AbstractActionVMM, ToggleAction, ActionRadioGroup, or ActionList. Null items represent separators. The idea is that the list items will be added to a menu or otherwise presented to the user so that the user can invoke the commands (with ActionList items representing submenus). Null values can occur in the list; they are meant to become separaters in the menu.

Subclasses that override this method should generally call super.getActionss() and add their commands to the list retured by that method. This top-level View class does not define any Action commands; the return value is an empty non-null ArrayList.

Overrides:
getActions in class View

setDisplay

public void setDisplay(Display display)
Description copied from class: View
Sets the Display where this View is installed. This method will ordinarily be called only by the install method in the Display class, which is used to install a View into a Display. It is not meant to be called directly (since that would bypass a lot of the set-up performed automatically by the install method).

Overrides:
setDisplay in class View
See Also:
Display.install(View, Exhibit)

setExhibit

public void setExhibit(Exhibit ex)
Description copied from class: View
Set the Exhibit that is shown in this View. If the View is already showing an Exhibit, it is first removed from the View. When an Exhibit is installed, the transform associated with the View is set to the default transform of the Exhibit. If there is a Display associated with the View, its repaint method is called. This setExhibit method will be called automatically when an Exhibit is installed in a Display; although it might be called directly, that would be much less usual since it would by-pass all the set-up that is done automatically by the Display's install method.

If the exhibit is non-null, then the foreground and background colors of the view are set to the default foreground and background colors of the exhibit. If the exhibit is null, then the view's foreground and background are set to black and white.

Note when overriding this method: You should almost certainly start by saying "if (exhibit == getExhibit()) return". That is, in general, this method should do nothing when the exhibit that is being installed is already installed.

Overrides:
setExhibit in class View
Parameters:
ex - The exhibit to be installed in this View. The value can be null. In that case, no Exhibit will be associated with the View after the method executes. If exhibit is already installed in this View, then no changes are made.
See Also:
Display.install(View, Exhibit)

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent evt)
Description copied from class: View
A View listens for state change events that are generated when the Exhibit or Decoration that it is displaying is changed, or by the transform (that converts real coords to pixel coords). This method is automatically called by the Exhibit, Decoration, or Transform when it is changed. It will not ordinarly be called directly. Note that in fact, this method simply calls forceRedraw(), which causes the View to be completely resdrawn.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Overrides:
stateChanged in class View
See Also:
View.forceRedraw()

getDefaultMouseTask

public MouseTask getDefaultMouseTask()
Description copied from class: View
Returns a MouseTask that can be installed in the Display attached to this View. This method is called automatically by the Display class when a View is intalled, and it should not be necessary to call it directly. A sub-class of View can override this to provide an appropriate MouseTask that will let the user interact with the View; the method can return null if there should be no default mouse interaction.

Overrides:
getDefaultMouseTask in class View
Returns:
The value returned in the top-level View class is a BasicMouseTask2D, which allows dragging and zooming of the 2D window.
See Also:
MouseTask

getCurrentTimeFromControlPanel

public double getCurrentTimeFromControlPanel()

startOrbitAtPoint

public void startOrbitAtPoint(double[] initialPointData)

addExtraXML

public void addExtraXML(org.w3c.dom.Document containingDocument,
                        org.w3c.dom.Element viewElement)
Description copied from class: View
This method is called when an XML representation of this view is being constructed by the SaveAndRestore class to give the View a chance to add any extra infomation that is not saved by default. Any Parameters associated with the View are saved automatically, as are the transform and the applyGraphics2DTransform, antialiased, and preserveAspect properties. Decorations associated with the View are not saved automatically UNLESS they are marked with the VMMSave annotation. Property variables will also be saved automatically IF they are marked with VMMSave annotations.

The method in this top-level View class does nothing.

When a subclass overrides this method, it should start by calling super.addExtraXML(containingDocument,viewElement) to make sure that information from the superclass is saved.

Overrides:
addExtraXML in class View
Parameters:
containingDocument - The overall XML document that contains the view Element that is being created. This parameter is necessary because it is needed to create any nested subelements that are to be added to the view element.
viewElement - The XML element that is being constructed. This element already exists; the purpose of this method to add any extra information that would be needed to reconstruct this view object from the XML represenation.
See Also:
View.readExtraXML(Element)

readExtraXML

public void readExtraXML(org.w3c.dom.Element viewInfo)
                  throws java.io.IOException
Description copied from class: View
This method is called when this View is being reconstructed from an XML representation by the SaveAndRestore class. The View object has already been created, and default information (parameters, colors, and transform) have been retrieved. This method is responsible for retrieving any data that was written by View.addExtraXML(Document, Element), except that properties written with SaveAndRestore.addProperty(Object, String, Document, Element) are retrieved automatically, and decorations written with SaveAndRestore.addDecorationElement(Document, Element, Decoration) are retrieved automatically. The method in this top-level View class does nothing.

In general, when a subclass overrides this method, it should be sure to call super.readExtraXML(viewInfo).

Overrides:
readExtraXML in class View
Parameters:
viewInfo - The <view> element from the XML file that contains the information about this view. Some methods from the SaveAndRestore class might be useful for getting the data.
Throws:
java.io.IOException - If an error is found, an exception of type IOException should be thrown. This will abort the whole processing of the XML file.