vipratech.beans.standardbeans
Class HorizontalChartRecorder

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--vipratech.awt.VPanel
                          |
                          +--vipratech.beans.standardbeans.HorizontalChartRecorder

public class HorizontalChartRecorder
extends VPanel
implements java.lang.Runnable, java.lang.Cloneable

The HorizontalChartRecorder.class provides a GUI component that functions as a "chart recorder" or "oscilloscope screen" display. The chart recorder simulates a static pen drawing on a moving chart, the oscillosope simulates a moving trace on a static screen.

The TIMING of this bean is controlled by an instance of a vipratech.beans.Clock object that sends a signal to the chart recorder each second of SIMULATION time. The designer must decide at design time how many milliseconds of COMPUTER TIME represent 1 second of SIMULATION TIME. For example, a designer might use 50ms to represent 1 second in a a simulation. If this value is chosen, the designer must pass 50 as an argument to the setMillisecsPerSec(int millisecsPerSec) method.

The chart or trace MOVEMENT is controlled by the pixelsPerSec variable. This is the number or fraction of pixels moved in one second of SIMULATION time. The default value is 1px per second of simulation time.

This bean can recieve two property change events to draw two traces each scaled against different axis. Y1 values are scaled against the left axis, Y2 values against the right. Property change events are linked to public void channel1(PropertyEvent e) and public void channel1(PropertyEvent e) respectively.

vipratech.beans.SimpleDataSource is an example of a data source bean that can be wired up to this bean at desing time. See the source code of vipratech.beans.SimpleDataSource for an example of how to wire a bean to this chart recorder.

Version:
1.05, June 24 2002
Author:
Warwick Bailey   warwick-bailey@bigfoot.com
See Also:
HorizontalChartPaper, Clock, SimpleDataSource, Serialized Form

Fields inherited from class vipratech.awt.VPanel
fm
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
HorizontalChartRecorder()
          Constructor
 
Method Summary
 void channel1(java.beans.PropertyChangeEvent event)
          Method to receive property change events to the y1 axis
 void channel2(java.beans.PropertyChangeEvent event)
          Method to receive property change events to the y2 axis
 java.lang.Object clone()
          Method to clone the Object
 void destroy()
          Cleans up thread, paper and clock.
 java.awt.Color getColorY1()
          Returns the color for y1 data.
 java.awt.Color getColorY2()
          Returns the color for y2 data.
 java.util.Locale getLocale()
          Returns the locale for this component.
 float getMaxY1()
          Returns the maximum value of the left hand y-axis.
 float getMaxY2()
          Returns the maximum value of the right hand y-axis.
 int getMillisecsPerSec()
          Returns the number of milliseconds of USER time that represent one SIMULATION second.
 float getMinY1()
          Returns the minimum value of the left hand y-axis.
 float getMinY2()
          Returns the minimum value of the right hand y-axis.
 HorizontalChartPaper getPaper()
          Returns the panel with the paer for printing
 float getPixelsPerSec()
          Returns the number of pixels that the chart paper scrolls in one SIMULATION second.
 int getPlaces1()
          Returns the number of decimal places for the left axes.
 int getPlaces2()
          Returns the number of decimal places for the right axis.
 boolean getScreen()
          Sets the display to screen style.
 boolean getSimulationTimeVisible()
          Returns toggle state of time display.
 java.lang.String getUnitY1()
          Gets the left hand unit for the chart.
 java.lang.String getUnitY2()
          Gets the right hand unit for the chart.
 void initialize()
          Initialises the chart paper and vectors for holding datapoints.
 void propertyChange(java.beans.PropertyChangeEvent event)
          Method to receive property change events.
 void reset()
          Resets all variables back to zero.
 void run()
          Moves the chart paper one px for each pause.
 void setColorY1(java.awt.Color colorY1)
          Sets the color for y1 data.
 void setColorY2(java.awt.Color colorY2)
          Sets the color for 2 data.
 void setLocale(java.util.Locale locale)
          Sets the locale for this component.
 void setMaxY1(float maxY1)
          Sets the maximum value of the left hand y-axis.
 void setMaxY2(float maxY2)
          Sets the maximum value of the right hand y-axis.
 void setMillisecsPerSec(int millisecsPerSec)
          Sets the number of milliseconds of USER time that represent one SIMULATION second.
 void setMinY1(float minY1)
          Sets the minimum value of the left hand y-axis.
 void setMinY2(float minY2)
          Sets the minimum value of the right hand y-axis.
 void setPixelsPerSec(float pixelsPerSec)
          Sets the number of pixels that the chart paper scrolls in one SIMULATION second.
 void setPlaces1(int places1)
          Sets the number of decimal places for the left axes.
 void setPlaces2(int places2)
          Sets the number of decimal places for the right axis.
 void setScreen(boolean screen)
          Toggles the display between screen and chart paper style.
 void setSimulationTimeVisible(boolean simulationTimeVisible)
          Toggle time display on/off.
 void setTitle(java.lang.String title)
          Sets the title for the chart.
 void setUnitY1(java.lang.String unitY1)
          Sets the left hand unit for the chart.
 void setUnitY2(java.lang.String unitY2)
          Sets the right hand unit for the chart.
 void start()
          Starts the paper movement and the clock.
 void stop()
          Stops the paper movement and the clock.
 void upDateTimeLabel(int simulationTime)
          Updates the time display label
 
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, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, 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, 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, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, 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
 

Constructor Detail

HorizontalChartRecorder

public HorizontalChartRecorder()
Constructor
Method Detail

upDateTimeLabel

public final void upDateTimeLabel(int simulationTime)
Updates the time display label

initialize

public final void initialize()
Initialises the chart paper and vectors for holding datapoints.

start

public final void start()
Starts the paper movement and the clock.

stop

public final void stop()
Stops the paper movement and the clock.

run

public final void run()
Moves the chart paper one px for each pause. The pause is the value of the millisecsPerPixel variable.
Specified by:
run in interface java.lang.Runnable

propertyChange

public final void propertyChange(java.beans.PropertyChangeEvent event)
Method to receive property change events.

channel1

public final void channel1(java.beans.PropertyChangeEvent event)
Method to receive property change events to the y1 axis

channel2

public final void channel2(java.beans.PropertyChangeEvent event)
Method to receive property change events to the y2 axis

reset

public final void reset()
Resets all variables back to zero.

destroy

public final void destroy()
Cleans up thread, paper and clock.

setPixelsPerSec

public final void setPixelsPerSec(float pixelsPerSec)
Sets the number of pixels that the chart paper scrolls in one SIMULATION second.

getPixelsPerSec

public final float getPixelsPerSec()
Returns the number of pixels that the chart paper scrolls in one SIMULATION second.

setMillisecsPerSec

public final void setMillisecsPerSec(int millisecsPerSec)
Sets the number of milliseconds of USER time that represent one SIMULATION second.

getMillisecsPerSec

public final int getMillisecsPerSec()
Returns the number of milliseconds of USER time that represent one SIMULATION second.

setMaxY1

public final void setMaxY1(float maxY1)
Sets the maximum value of the left hand y-axis.

getMaxY1

public final float getMaxY1()
Returns the maximum value of the left hand y-axis.

setMaxY2

public final void setMaxY2(float maxY2)
Sets the maximum value of the right hand y-axis.

getMaxY2

public final float getMaxY2()
Returns the maximum value of the right hand y-axis.

setMinY1

public final void setMinY1(float minY1)
Sets the minimum value of the left hand y-axis.

getMinY1

public final float getMinY1()
Returns the minimum value of the left hand y-axis.

setMinY2

public final void setMinY2(float minY2)
Sets the minimum value of the right hand y-axis.

getMinY2

public final float getMinY2()
Returns the minimum value of the right hand y-axis.

setSimulationTimeVisible

public final void setSimulationTimeVisible(boolean simulationTimeVisible)
Toggle time display on/off.

getSimulationTimeVisible

public final boolean getSimulationTimeVisible()
Returns toggle state of time display.

setTitle

public final void setTitle(java.lang.String title)
Sets the title for the chart.

setUnitY1

public final void setUnitY1(java.lang.String unitY1)
Sets the left hand unit for the chart.

getUnitY1

public java.lang.String getUnitY1()
Gets the left hand unit for the chart.

getUnitY2

public java.lang.String getUnitY2()
Gets the right hand unit for the chart.

setUnitY2

public final void setUnitY2(java.lang.String unitY2)
Sets the right hand unit for the chart.

setLocale

public void setLocale(java.util.Locale locale)
Sets the locale for this component.
Overrides:
setLocale in class java.awt.Component

getLocale

public java.util.Locale getLocale()
Returns the locale for this component.
Overrides:
getLocale in class java.awt.Component

setPlaces1

public void setPlaces1(int places1)
Sets the number of decimal places for the left axes.

getPlaces1

public int getPlaces1()
Returns the number of decimal places for the left axes.

setPlaces2

public void setPlaces2(int places2)
Sets the number of decimal places for the right axis.

getPlaces2

public int getPlaces2()
Returns the number of decimal places for the right axis.

setScreen

public void setScreen(boolean screen)
Toggles the display between screen and chart paper style. The screen style display is green on black, whilst when the screen variable is set to false the default chart paper white/grey background is shown.

getScreen

public boolean getScreen()
Sets the display to screen style.

setColorY1

public final void setColorY1(java.awt.Color colorY1)
Sets the color for y1 data.

getColorY1

public final java.awt.Color getColorY1()
Returns the color for y1 data.

setColorY2

public final void setColorY2(java.awt.Color colorY2)
Sets the color for 2 data.

getColorY2

public final java.awt.Color getColorY2()
Returns the color for y2 data.

clone

public java.lang.Object clone()
Method to clone the Object

getPaper

public HorizontalChartPaper getPaper()
Returns the panel with the paer for printing

dathe@chemie.uni-leipzig.de"

http://leipzig.vernetztes-studium.de