edu.davidson.tools
Class SApplet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--edu.davidson.tools.SApplet
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class SApplet
extends java.applet.Applet

See Also:
Serialized Form

Field Summary
 SClock clock
           
 java.util.Vector dataConnections
           
static java.util.Hashtable dataListeners
           
static java.util.Hashtable dataSources
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
SApplet()
           
 
Method Summary
static void addDataListener(java.lang.Object dl)
           
static void addDataSource(java.lang.Object ds)
          Add a data source to the list.
 void cleanupDataConnections()
          Remove dataConnections if either the source or the listener no longer exist.
 void clearAllData()
          Delete all the data that has been sent to the DataConnections.
 void clearData(int id)
          Delete all the data that has been sent to the DataConnections.
 void deleteDataConnection(int id)
          Break the data connection identified by the id.
 void deleteDataConnections()
          Break all data connections for this applet.
 void destroy()
           
 void forward()
          Start clock.
 int getClockID()
          Get the clock id for use as a data source.
 SDataConnection getDataConnectionFromDL(SDataListener dl)
          Find the first data connection in the list that has a specific data listener.
 SDataConnection getDataConnectionFromDS(SDataSource ds)
          Find the first data connection in the list that has a specific data source.
 java.lang.String getDataFromDS(int id)
          Return the data as a string.
static SDataListener getDataListener(int id)
           
static SDataListener getDataListener(java.lang.String key)
           
static SDataSource getDataSource(int id)
          Find the data source with the given id.
static SDataSource getDataSource(java.lang.String key)
          Find the data source with the given key.
 int getID()
           
 java.lang.Object getRunningID()
           
 boolean isClockRunning()
          Test to see if the clock is running.
 int makeDataConnection(int sourceID, int listenerID, int seriesID, java.lang.String xStr, java.lang.String yStr)
          Have the applet make a new data connection.
 void pause()
          Pause the clock.
 void removeDataListener(int key)
           
 void removeDataSource(int id)
          Remove the data source with the given id.
 void reset()
          Reset the clock to time=0.
 void reverse()
          Stop the clock.
 void setAutoRefresh(boolean ar)
          Repaint whenevers the system parameters are changed.
 void setClockContinous()
          Set the clock to run continously.
 void setClockCycle(double minTime, double maxTime)
          Set the clock to cycle between the minTime and maxTime.
 void setClockOneShot(double minTime, double maxTime)
          Set the clock to run from minTime to maxTime and stop.
 void setClockTime(double t)
          Set the clock time.
 boolean setConnectionBlock(int id, boolean block)
          Block data from passing through the data connection.
 boolean setConnectionListener(int id)
          Set the data listener for the data connection.
 boolean setConnectionSmoothing(int id, int num)
          Have the data connection smooth the data before it is sent to the data listener.
 boolean setConnectionSource(int id)
          Set the data source for the data connection.
 boolean setConnectionStride(int id, int num)
          Have the data connection skip every num-1 data points.
 void setDefault()
          Reset the clock to time=0.
 void setDt(double dt)
          Set the time increment.
 void setFPS(double fps)
          Set the frames per second.
 void setRunningID()
           
 void setRunningID(java.lang.Object id)
           
 void setTimeContinuous()
          Set the time increment.
 void setTimeCycle(double maxTime)
          Set the clock to cycle between the 0 and maxTime.
 void setTimeOneShot(double maxTime, java.lang.String msg)
          Set the clock to run from minTime to maxTime and stop.
 void startClock()
          Start the clock
 void stepClock()
          Step the clock by one tick, dt.
 void stepTime()
          Step the clock by dt.
 void stepTimeBack()
          Step the clock back by dt.
 void stepTimeForward()
          Step the clock forward by dt.
 void stopClock()
          Stop the clock
 void updateDataConnection(int id)
          Have a single data source update its data connections.
 void updateDataConnections()
          Have all data sources update their data connections.
 void useMasterClock()
          Sets applet to use the master clock shared by all applets.
 
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, init, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setCursor, setFont, setLayout, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dataSources

public static java.util.Hashtable dataSources

dataListeners

public static java.util.Hashtable dataListeners

clock

public SClock clock

dataConnections

public java.util.Vector dataConnections
Constructor Detail

SApplet

public SApplet()
Method Detail

destroy

public void destroy()
Overrides:
destroy in class java.applet.Applet

makeDataConnection

public int makeDataConnection(int sourceID,
                              int listenerID,
                              int seriesID,
                              java.lang.String xStr,
                              java.lang.String yStr)
Have the applet make a new data connection.
Parameters:
sourceID - The id of the data source.
listenerID - The id of the data listener. This is usually an applet.
seriesID - The id of the series in the data listener.
xStr - The function of the data source variables to be plotted on the horizontal axis.
xStr - The function of the data source variables to be plotted on the vertical axis.
Returns:
SDataConnection The hasCode id of the newly created data connection.

clearAllData

public void clearAllData()
Delete all the data that has been sent to the DataConnections.

clearData

public void clearData(int id)
Delete all the data that has been sent to the DataConnections.
Parameters:
id - int The hashCode id of the data source.

updateDataConnection

public void updateDataConnection(int id)
Have a single data source update its data connections.
Parameters:
id - The integer id of the data source.

updateDataConnections

public void updateDataConnections()
Have all data sources update their data connections.

deleteDataConnections

public void deleteDataConnections()
Break all data connections for this applet.

deleteDataConnection

public void deleteDataConnection(int id)
Break the data connection identified by the id.
Parameters:
id - The data connection id.

getDataConnectionFromDS

public SDataConnection getDataConnectionFromDS(SDataSource ds)
Find the first data connection in the list that has a specific data source.

getDataFromDS

public java.lang.String getDataFromDS(int id)
Return the data as a string.

getDataConnectionFromDL

public SDataConnection getDataConnectionFromDL(SDataListener dl)
Find the first data connection in the list that has a specific data listener.

cleanupDataConnections

public final void cleanupDataConnections()
Remove dataConnections if either the source or the listener no longer exist.

getRunningID

public final java.lang.Object getRunningID()

setRunningID

public final void setRunningID(java.lang.Object id)

setRunningID

public final void setRunningID()

getID

public final int getID()

setConnectionSmoothing

public final boolean setConnectionSmoothing(int id,
                                            int num)
Have the data connection smooth the data before it is sent to the data listener.
Parameters:
id - int The id of of the data connection.
num - int The number of data points to smooth.
Returns:
boolean Return true if data connection found.

setConnectionStride

public final boolean setConnectionStride(int id,
                                         int num)
Have the data connection skip every num-1 data points.

setConnectionBlock

public final boolean setConnectionBlock(int id,
                                        boolean block)
Block data from passing through the data connection.

setConnectionSource

public final boolean setConnectionSource(int id)
Set the data source for the data connection.

setConnectionListener

public final boolean setConnectionListener(int id)
Set the data listener for the data connection.

setAutoRefresh

public void setAutoRefresh(boolean ar)
Repaint whenevers the system parameters are changed.
Parameters:
autoRefresh - Automatic repaint?

forward

public void forward()
Start clock.

reverse

public void reverse()
Stop the clock.

pause

public void pause()
Pause the clock.

reset

public void reset()
Reset the clock to time=0.

setDefault

public void setDefault()
Reset the clock to time=0.

setDt

public void setDt(double dt)
Set the time increment.

setFPS

public void setFPS(double fps)
Set the frames per second.

setTimeContinuous

public void setTimeContinuous()
Set the time increment.

getClockID

public final int getClockID()
Get the clock id for use as a data source.

stepClock

public void stepClock()
Step the clock by one tick, dt.

stepTimeForward

public void stepTimeForward()
Step the clock forward by dt.

stepTimeBack

public void stepTimeBack()
Step the clock back by dt.

stepTime

public void stepTime()
Step the clock by dt.

useMasterClock

public void useMasterClock()
Sets applet to use the master clock shared by all applets. This process cannot be reversed!

setClockTime

public void setClockTime(double t)
Set the clock time.
Parameters:
t - The clock time.

setTimeOneShot

public void setTimeOneShot(double maxTime,
                           java.lang.String msg)
Set the clock to run from minTime to maxTime and stop.
Parameters:
minTime - The maximum time.
maxTime - The maximum time.

setClockOneShot

public void setClockOneShot(double minTime,
                            double maxTime)
Set the clock to run from minTime to maxTime and stop.
Parameters:
minTime - The maximum time.
maxTime - The maximum time.

setClockContinous

public void setClockContinous()
Set the clock to run continously.
See Also:
setClockOneShot(double, double), setClockCycle(double, double)

setTimeCycle

public void setTimeCycle(double maxTime)
Set the clock to cycle between the 0 and maxTime.
Parameters:
maxTime - The maximum time.

setClockCycle

public void setClockCycle(double minTime,
                          double maxTime)
Set the clock to cycle between the minTime and maxTime.
Parameters:
minTime - The maximum time.
maxTime - The maximum time.

startClock

public void startClock()
Start the clock

isClockRunning

public boolean isClockRunning()
Test to see if the clock is running.
Returns:
true if clock is running.

stopClock

public void stopClock()
Stop the clock

addDataSource

public static final void addDataSource(java.lang.Object ds)
Add a data source to the list.
Parameters:
ds - The data source object.

removeDataSource

public final void removeDataSource(int id)
Remove the data source with the given id. Look for and remove data connections to this data source.
Parameters:
id - The integer id that identifies the data source.

getDataSource

public static final SDataSource getDataSource(java.lang.String key)
Find the data source with the given key. The key is the String representation of the hash code.
Parameters:
key - The string id that identifies the data source.

getDataSource

public static final SDataSource getDataSource(int id)
Find the data source with the given id.
Parameters:
id - The integer id that identifies the data source.

removeDataListener

public final void removeDataListener(int key)

addDataListener

public static final void addDataListener(java.lang.Object dl)

getDataListener

public static final SDataListener getDataListener(java.lang.String key)

getDataListener

public static final SDataListener getDataListener(int id)

Copyright Wolfgang Christian

Visit the Davidson CollegeSTools Documentation Page