data
Class Data

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by edu.davidson.tools.SApplet
                      extended by data.Data
All Implemented Interfaces:
edu.davidson.tools.SDataListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class Data
extends edu.davidson.tools.SApplet
implements edu.davidson.tools.SDataListener

Data is an applet that serves two roles:
It acts as a relay between an SDataSource and JavaScript in a Web Page
It stores data, which can be retrieved via other Applets or JavaScript APPLET PARAMETERS
IsReady : JavaScript variable that is set true when this applet has been initialized
ShowLabel : if true the label is used
LabelWidth : width of the label in pixels
LabelHeight : height of the label in pixels
LabelID : ID of the data set whose x or y value is displayed in the label
ShowY : if true the y value is displayed in the label, if false the x value is displayed

Version:
2.0, 2008
Author:
David N. Blauch
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class edu.davidson.tools.SApplet
autoRefresh, clock, dataConnections, dataListeners, dataSources, lock, oneShotMsg
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Data()
           
 
Method Summary
 void addData(edu.davidson.tools.SDataSource ds, int id, double[] x, double[] y)
          SDataListener Method: Use to submit an array of data points Calls the JavaScript method addData
 int addDataSet(java.lang.String func, int id)
          Adds a new Data Set with identification id.
 void addDatum(edu.davidson.tools.SDataSource ds, int id, double x, double y)
          SDataListener Method: Use to submit a single data point Calls JavaScript method addDatum
 void callJavaScript(boolean val)
          Determines whether JavaScript addData and addDatum functions are automatically called.
 void clearSeries(int id)
          SDataListener Method: Clears the specified data set.
 void deleteSeries(int id)
          SDataListener Method: Deletes the specified data set.
 void destroy()
           
 java.lang.String getAppletInfo()
           
 int getNumberPoints(int id)
          Gets number of points in a set
 edu.davidson.tools.SApplet getOwner()
          SDataListener Method: Returns the owner of this SDataListener
 java.lang.String getParameter(java.lang.String key, java.lang.String def)
           
 java.lang.String[][] getParameterInfo()
           
 void init()
           
 void setBackgroundColor(java.lang.String rgb)
          Sets the background color of the applet
 void setLabelFont(java.awt.Font fnt)
          Sets the font for the label.
 void setLabelFormat(int nbrLength, int nbrDecimal)
          Sets the format for the values displayed in the label
 void setLabelSize(int wid, int ht)
          Sets the size of the label.
 void setLabelText(java.lang.String val)
          Sets the text in the label.
 void setOwner(edu.davidson.tools.SApplet owner)
          SDataListener Method: Sets the owner of this SDataListener
 void start()
           
 void stop()
           
 
Methods inherited from class edu.davidson.tools.SApplet
addDataListener, addDataSource, cleanupDataConnections, clearAllData, clearData, cyclingClock, deleteDataConnection, deleteDataConnections, forward, getClockID, getClockTime, getDataConnectionFromDL, getDataConnectionFromDS, getDataFromDS, getDataListener, getDataListener, getDataSource, getDataSource, getID, getRunningID, getSourceData, getSourceVariables, isAutoRefresh, isClockRunning, makeDataConnection, pause, pausingClock, removeDataListener, removeDataSource, reset, reverse, setAutoRefresh, setClockContinous, setClockCycle, setClockOneShot, setClockTime, setConnectionBlock, setConnectionListener, setConnectionSmoothing, setConnectionSource, setConnectionStride, setDefault, setDt, setExternalClock, setFPS, setRunningID, setRunningID, setTimeContinuous, setTimeCycle, setTimeOneShot, startClock, stepClock, stepTime, stepTimeBack, stepTimeForward, stopClock, stoppingClock, updateDataConnection, updateDataConnections
 
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.davidson.tools.SDataListener
getID
 

Constructor Detail

Data

public Data()
Method Detail

getParameter

public java.lang.String getParameter(java.lang.String key,
                                     java.lang.String def)

init

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

start

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

stop

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

destroy

public void destroy()
Overrides:
destroy in class edu.davidson.tools.SApplet

getAppletInfo

public java.lang.String getAppletInfo()
Overrides:
getAppletInfo in class java.applet.Applet

getParameterInfo

public java.lang.String[][] getParameterInfo()
Overrides:
getParameterInfo in class java.applet.Applet

addData

public void addData(edu.davidson.tools.SDataSource ds,
                    int id,
                    double[] x,
                    double[] y)
SDataListener Method: Use to submit an array of data points Calls the JavaScript method addData

Specified by:
addData in interface edu.davidson.tools.SDataListener
Parameters:
ds - SDataSource (obtained from the source getID function
id - data set id
x - array of x values
y - array of y values
See Also:
SApplet.getID()

addDatum

public void addDatum(edu.davidson.tools.SDataSource ds,
                     int id,
                     double x,
                     double y)
SDataListener Method: Use to submit a single data point Calls JavaScript method addDatum

Specified by:
addDatum in interface edu.davidson.tools.SDataListener
Parameters:
ds - SDataSource (obtained from the source getID function
id - data set id
x - x value of data point
y - y value of data point
See Also:
SApplet.getID()

addDataSet

public int addDataSet(java.lang.String func,
                      int id)
Adds a new Data Set with identification id. func is the JavaScript function that will be called whenever new data is received via the addDatum method. The JavaScript function must be defined and must be of the form func(x,y), where x and y are the values for the data point.

Parameters:
func - string containing name of the JavaScript function
id - identification of data set associated with this function
Returns:
0 if method failed or 1 if method succeeded

callJavaScript

public void callJavaScript(boolean val)
Determines whether JavaScript addData and addDatum functions are automatically called.


clearSeries

public void clearSeries(int id)
SDataListener Method: Clears the specified data set. The data removed but the JavaScript function remains.

Specified by:
clearSeries in interface edu.davidson.tools.SDataListener
Parameters:
id - identification of the data set to be cleared

deleteSeries

public void deleteSeries(int id)
SDataListener Method: Deletes the specified data set. This method also removes the JavaScript function and frees this id.

Specified by:
deleteSeries in interface edu.davidson.tools.SDataListener
Parameters:
id - identification of the data set to be cleared

getNumberPoints

public int getNumberPoints(int id)
Gets number of points in a set

Parameters:
id - data set identification

getOwner

public edu.davidson.tools.SApplet getOwner()
SDataListener Method: Returns the owner of this SDataListener

Specified by:
getOwner in interface edu.davidson.tools.SDataListener

setBackgroundColor

public void setBackgroundColor(java.lang.String rgb)
Sets the background color of the applet

Parameters:
rgb - this string is converted into a 24-bit integer that defines the color

setLabelFont

public void setLabelFont(java.awt.Font fnt)
Sets the font for the label.


setLabelFormat

public void setLabelFormat(int nbrLength,
                           int nbrDecimal)
Sets the format for the values displayed in the label

Parameters:
nbrLength - total number of characters in number including sign and decimal point
nbrDecimal - total number of decimal places displayed

setLabelSize

public void setLabelSize(int wid,
                         int ht)
Sets the size of the label. It may be necessary to use this method rather than the APPLET LabelWidth and LabelHeight parameters.

Parameters:
wid - width in pixels
ht - height in pixels

setLabelText

public void setLabelText(java.lang.String val)
Sets the text in the label. If the label is shown but the data source with the label's ID is not used, the label text will not be updated by DataConnections. This method can be used to set the text.


setOwner

public void setOwner(edu.davidson.tools.SApplet owner)
SDataListener Method: Sets the owner of this SDataListener

Specified by:
setOwner in interface edu.davidson.tools.SDataListener