com.jjt.utbeg
Class SeismicDesignExerciseApplet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--com.jjt.utbeg.SeismicDesignExerciseApplet
Direct Known Subclasses:
Applet1

public abstract class SeismicDesignExerciseApplet
extends Applet

An abstract parent class for all of the Seismic Design Exercise Applets.

This Component lays out three main Panels in which subclasses can place components: A Parameter Display Panel for showing static parameters that may have been input by the user in previous excercises, a Parameter Input Panel for input Components used by the human to enter parameter values for this exercise, and a Viewer Panel for displaying the results of parameters for this exercise. Subclasses should only place components into one of these Panels, accessed by getParameterDisplayPanel(), getParameterInputPanel(), and getViewerPanel().

See Also:
getParameterDisplayPanel(), getParameterInputPanel(), getViewerPanel(), Serialized Form

Inner classes inherited from class java.awt.Component
Component.AWTTreeLock, Component.NativeInLightFixer
 
Field Summary
private  boolean inputParametersAreValid
          Flag set during init() after validateInputParameters() is called.
private static Insets insets
          Empty border Insets for these Applets.
private  Panel parameterDisplayPanel
          The panel for displaying (read-only) parameters that were set in previous exercises.
private  Panel parameterInputPanel
          The panel where the human specifies parameters for this exercise.
private  UserParameters parameters
          The saved parameter values for the current human user.
private  Panel viewerPanel
          The panel where the graphical viewer will reside.
 
Fields inherited from class java.applet.Applet
serialVersionUID, stub
 
Fields inherited from class java.awt.Panel
base, nameCounter, serialVersionUID
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, maxSize, ncomponents, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, assert, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, hasFocus, height, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, serialVersionUID, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowListenerK, x, y
 
Constructor Summary
SeismicDesignExerciseApplet()
           
 
Method Summary
 Container getContentPane()
          Returns the main Container for this Applet's components.
 Insets getInsets()
          Component method over-ridden to define an empty border around this Applet.
 double getNumericAppletParameter(String parameterName)
          Loads an Applet parameter as a number.
protected  Container getParameterDisplayPanel()
          Returns the Container where static display Components should be placed.
protected  Container getParameterInputPanel()
          Returns the Container where parameter input Components should be placed.
protected  UserParameters getParameters()
          Returns the collection of parameters for this and other Applets.
protected  java.net.URL getPostURL()
          Returns the URL to submit this applet's parameters to the server.
protected  Container getViewerPanel()
          Returns the Container where the viewer Component should be placed.
 void init()
          Initializes this Applet.
protected  boolean inputParametersAreValid()
          Returns true if the input parameters were valid when verifyInputParameters() was called during init().
protected  void loadParameters()
          Loads the parameters for this user, which were set in previous exercises.
 String[] readAppletParameterArray(String arrayName)
          Utility method for reading Applet parameters that make up an array sequence.
 void saveInputs()
          Submits the parameters in this Applet to the server, by making an HTTP request to the AGIServlet.
protected abstract  void setInitialParameters()
          Sets initial parameters for this exercise.
protected abstract  String verifyInputParameters()
          This method is called so that subclasses may verify that all their required parameters have been set.
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify, constructComponentName
 
Methods inherited from class java.awt.Container
, add, add, add, add, add, addContainerListener, addImpl, applyOrientation, countComponents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPrint, list, list, locate, minimumSize, nextFocus, paint, paintComponents, paramString, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, print, printComponents, printOneComponent, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, readObject, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusOwner, setFont, setLayout, transferFocus, update, validate, validateTree, writeObject
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

parameterInputPanel

private Panel parameterInputPanel
The panel where the human specifies parameters for this exercise.

This panel includes the "save" button.


parameterDisplayPanel

private Panel parameterDisplayPanel
The panel for displaying (read-only) parameters that were set in previous exercises.

viewerPanel

private Panel viewerPanel
The panel where the graphical viewer will reside.

parameters

private UserParameters parameters
The saved parameter values for the current human user.
See Also:
getParameters()

inputParametersAreValid

private boolean inputParametersAreValid
Flag set during init() after validateInputParameters() is called.

This flag can be accessed by subclasses via the inputParametersAreValid() method.

See Also:
inputParametersAreValid()

insets

private static Insets insets
Empty border Insets for these Applets.
Constructor Detail

SeismicDesignExerciseApplet

public SeismicDesignExerciseApplet()
Method Detail

init

public void init()
Initializes this Applet.

Because of the Applet implementation, Applets create components during init() instead of construction.

In addition, this method calls loadParameters(), then verifyInputParameters(), and then, if valid, setInitialParameters().

Overrides:
init in class Applet
See Also:
loadParameters(), verifyInputParameters(), setInitialParameters()

getParameterDisplayPanel

protected Container getParameterDisplayPanel()
Returns the Container where static display Components should be placed.
Returns:
the Container Panel into which Components can be added.

getParameterInputPanel

protected Container getParameterInputPanel()
Returns the Container where parameter input Components should be placed.
Returns:
the Container Panel into which Components can be added.

getViewerPanel

protected Container getViewerPanel()
Returns the Container where the viewer Component should be placed.
Returns:
the Container Panel into which Components can be added.

getContentPane

public Container getContentPane()
Returns the main Container for this Applet's components.

This currently returns the Applet itself, but if a status bar is needed in the future, this method could return a separate Panel.

Subclasses which use the three default panels should not need to use this method.

Returns:
the Container Panel into which Components can be added.

getParameters

protected UserParameters getParameters()
Returns the collection of parameters for this and other Applets.
Returns:
the UserParameters collection Object.

loadParameters

protected void loadParameters()
Loads the parameters for this user, which were set in previous exercises.

verifyInputParameters

protected abstract String verifyInputParameters()
This method is called so that subclasses may verify that all their required parameters have been set.

If this exercise (Applet) requires parameters to be set by previous exercises, then that will be validated here. Parameters are set in the UserParameters Object which can be retrieved by the getParameters() method.

Returns:
a message explaining which parameters must be set, or null if all required parameters are loaded.
See Also:
getParameters()

setInitialParameters

protected abstract void setInitialParameters()
Sets initial parameters for this exercise.

Initial parameter values are usually based on input parameters which have been set in previous exercises. When this method is called, verifyInputParameters() has already been called, so all required input parameters can be assumed present.

See Also:
verifyInputParameters()

inputParametersAreValid

protected boolean inputParametersAreValid()
Returns true if the input parameters were valid when verifyInputParameters() was called during init().

This method is available so that subclasses can check after there super.init() call, so that visual components will not be created needlessly.

Returns:
true if the verifyInputParameters() validated the input parameters okay.

getInsets

public Insets getInsets()
Component method over-ridden to define an empty border around this Applet.
Returns:
the Insets Object containing the 4 border widths.
Overrides:
getInsets in class Container

readAppletParameterArray

public String[] readAppletParameterArray(String arrayName)
Utility method for reading Applet parameters that make up an array sequence.

For example, if arrayName is "peanut", then the parameters read would be peanut1, peanut2, peanut3, etc., until no parameter is found. If a parameter #0 is available, it is treated as the first element in the array. If no #0 is found, parameter #1 is used for the first element. If no elements are found, a zero-length array is returned.

Parameters:
arrayName - the prefix of each parameter in the array.
Returns:
an array of Strings containing the parameter values.

getNumericAppletParameter

public double getNumericAppletParameter(String parameterName)
Loads an Applet parameter as a number.

Applet parameters are String values specified in the APPLET tag of the HTML code presenting this Applet.

Returns:
the numeric value as a primative, or Double.NaN if the parameter cannot be parse as a number.

getPostURL

protected java.net.URL getPostURL()
                           throws java.net.MalformedURLException
Returns the URL to submit this applet's parameters to the server.

The URL is probably actually an HTTP GET request, with the parameters attached as query arguments.

This parent method returns a simple Servlet URL with one query parameter.


saveInputs

public void saveInputs()
Submits the parameters in this Applet to the server, by making an HTTP request to the AGIServlet.