stella.jview
Class JWeatherCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by jview.JNormalizedCanvas
                  extended by jview.JViewportCanvas
                      extended by jview.JFrameCanvas
                          extended by jview.JBoxedCanvas
                              extended by jview.JDataCanvas
                                  extended by stella.jview.JWeatherCanvas
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, DataCanvasProviding, NormalizedCoordinates, NormalizedShapes, UserCoordinates, Zoomable, Initializable, ResourceAware, ResourceComposed, Savable

public class JWeatherCanvas
extends JDataCanvas

A canvas that collects weather data from a repository and displays it. The set names known to the data canvas must be equal to the sensor names displayed.

See Also:
Serialized Form

Nested Class Summary
static class JWeatherCanvas.Show
           
 
Nested classes/interfaces inherited from class jview.JDataCanvas
JDataCanvas.AnimTest, JDataCanvas.Highlight, JDataCanvas.Histogram, JDataCanvas.Test, JDataCanvas.TestCanvas
 
Nested classes/interfaces inherited from class jview.JBoxedCanvas
JBoxedCanvas.Datum
 
Nested classes/interfaces inherited from class jview.JViewportCanvas
JViewportCanvas.ViewportKey
 
Nested classes/interfaces inherited from class jview.JNormalizedCanvas
JNormalizedCanvas.ShowImage
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private static String BAD
          A bad bar.
private static String DEFDRAWINGSETS
          Per default we display humidity sensors.
private static long DEFMAXRETARD
          Default mximum retard.
private static String DEFPOLYGONSHAPE
          The default shapes.
private static String DEFTABLE
          Incoming sensor names are translated to set names using this table.
private static String GOOD
          A good bar.
static String KEY_BADTOGGLE
          If given, a vertical line is drawn at this normalized coordinate.
static String KEY_GOODTOGGLE
          If given, a vertical line is drawn at this normalized coordinate.
static String KEY_MAXRETARD
          Maximum time the received data event may be out-of-date.
static String KEY_TABLE
          A lookup table converting sensor names to set names.
private  Map<String,String> lookup
          We translate sensor-names to set-names.
 
Fields inherited from class jview.JDataCanvas
DATALOSSPROPERTY, DEFXUSERSPACEMIN, DEFYUSERSPACEMIN, KEY_CONNECT, KEY_DATALAST, KEY_EQUALSCALE, KEY_EQUALSTART, KEY_ERRORALWAYSRED, KEY_ERRORCOLOR, KEY_ERRORHAT, KEY_ERRORHATLENGTH, KEY_ERRORINCLUDE, KEY_ERRORSHOW, KEY_FLIPXAXIS, KEY_FLIPYAXIS, KEY_HIGHLIGHTSHAPE, KEY_JOINDATA, KEY_LABELFONT, KEY_LEGEND, KEY_LEGENDGAP, KEY_LEGENDLENGTH, KEY_LEGENDLIST, KEY_LEGENDMAP, KEY_LEGENDY, KEY_POINTS, KEY_POLYGONSHAPE, KEY_RETAINSIZE, KEY_SAVESETS, KEY_SHAPESIZE, KEY_XAXISDISTANCE, KEY_XAXISLABEL, KEY_XERRORINDEX, KEY_XERRORSHAPE, KEY_XINDEX, KEY_XSHRINK, KEY_XUSERSPACEMIN, KEY_YAXISDISTANCE, KEY_YAXISLABEL, KEY_YERRORINDEX, KEY_YERRORSHAPE, KEY_YINDEX, KEY_YSHRINK, KEY_YUSERSPACEMIN, KEY_ZEROXAXIS, KEY_ZEROYAXIS, RESCALEPROPERTY, SAVEDATA
 
Fields inherited from class jview.JBoxedCanvas
AUTODATE, BOTTOM, KEY_FONT, KEY_GRIDCOLOR, KEY_IGNOREFORMAT, KEY_LABELAT, KEY_LABELCOLOR, KEY_LABELXANGLE, KEY_LABELXAUTO, KEY_LABELXEND, KEY_LABELXEXTRA, KEY_LABELXFORMAT, KEY_LABELXINSIDE, KEY_LABELXSTART, KEY_LABELXSTEP, KEY_LABELYANGLE, KEY_LABELYAUTO, KEY_LABELYEND, KEY_LABELYEXTRA, KEY_LABELYFORMAT, KEY_LABELYINSIDE, KEY_LABELYSTART, KEY_LABELYSTEP, KEY_MAXLABELS, KEY_MAXTICKS, KEY_TICKAT, KEY_TICKCOLOR, KEY_TICKSTRETCH, KEY_TICKXAUTO, KEY_TICKXEND, KEY_TICKXGRID, KEY_TICKXINSIDE, KEY_TICKXSIZE, KEY_TICKXSTART, KEY_TICKXSTEP, KEY_TICKYAUTO, KEY_TICKYEND, KEY_TICKYGRID, KEY_TICKYINSIDE, KEY_TICKYSIZE, KEY_TICKYSTART, KEY_TICKYSTEP, KEY_XISDATE, KEY_XLOGARITHMIC, KEY_YISDATE, KEY_YLOGARITHMIC, LEFT, RIGHT, TOP
 
Fields inherited from class jview.JFrameCanvas
KEY_ABSOLUTEHEIGHT, KEY_ABSOLUTEWIDTH, KEY_DRAWBOX, KEY_RELATIVEHEIGHT, KEY_RELATIVEWIDTH, KEY_TITLECOLOR, KEY_TITLEFONT, KEY_TITLEJUSTIFY, KEY_TITLEOFFSET, KEY_TITLETEXT, KEY_TOPCOLOR, KEY_TOPFONT, KEY_TOPJUSTIFY, KEY_TOPOFFSET, KEY_TOPSEPARATOR, KEY_TOPTEXT, KEY_XFRAME, KEY_XINSETABSOLUTE, KEY_XINSETRELATIVE, KEY_YFRAME, KEY_YINSETABSOLUTE, KEY_YINSETRELATIVE
 
Fields inherited from class jview.JViewportCanvas
MAXVIEW, VIEWPORTIMAGEPROPERTY, VIEWPORTPROPERTY
 
Fields inherited from class jview.JNormalizedCanvas
BACKGROUNDIMAGEPROPERTY, EXPORTACTION, GENERIC, inverse, KEY_BACKGROUND, KEY_CANVASNAME, KEY_CANVASTIP, KEY_CURSORCLASSES, KEY_CURSORPROPS, KEY_DRAWINGSETS, KEY_FOREGROUND, KEY_MAXIMUMHEIGHT, KEY_MAXIMUMWIDTH, KEY_MINIMUMHEIGHT, KEY_MINIMUMWIDTH, KEY_PREFERREDHEIGHT, KEY_PREFERREDWIDTH, KEY_PRINTFONT, KEY_PRINTFONTSCALE, KEY_PRINTSHAPESCALE, KEY_RESTORESHAPES, KEY_XFLIPIMAGE, KEY_YFLIPIMAGE, PRINTACTION, SAVEACTION, transform
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
JWeatherCanvas(ResourceSupplying prop)
          Constructs a new data canvas that goes into listening state on init().
 
Method Summary
 void applyData(Map<String,DataEvent> readings)
          Process a data event generated by a sensor repository to reflect changes.
 void blockData(List<WeatherSurveying.DataBlock> block)
          Sets a list of WeatherSurveying.BlockData measures.
 void init()
          To increase readability, we set up a look-up table here.
 void setComposedProperties(ResourceSupplying prop)
          Defaults the repository name and the sensors to monitor.
 
Methods inherited from class jview.JDataCanvas
addDataObserver, addDelete, addDrawingInfo, addJoint, addMeasure, addMeasure, addZoom, clearData, deleteClosest, deleteInside, drawShapes, extractKeys, extractKeys, getActions, getAnimationInfo, getClosestData, getClosestData, getClosestDataShape, getClosestShape, getComposingCanvases, getDefaultProperties, getInsideData, getInsideShapes, getMainCanvas, getMaximumPoints, getMeasuredData, getShapeForSet, getSpanX, getSpanY, getUserData, isEmpty, notifyClear, notifyNew, notifyOnAdd, notifyOnRemove, prepareCanvas, putMeasuredSet, putMeasuredSet, putMeasuredSets, rebuildOneDataSet, redeemList, removeDataObserver, removeJoint, revertDeleted, setShapeForSet, setUserData
 
Methods inherited from class jview.JBoxedCanvas
getBestDateFormat, getDefaultFormatX, getDefaultFormatY, getUserTransformation, getUserTransformation, printComponent, setUserTransformation, setUserTransformation, silentlySelectViewport, xIsDate, yIsDate
 
Methods inherited from class jview.JFrameCanvas
calculateActiveCanvas, calculateShapeTransform, getArea, isScreenInNormalized, paintObjects, wasReshaped
 
Methods inherited from class jview.JViewportCanvas
addAttachedViewport, addZoom, getViewport, getViewportImage, isMaximalViewport, isNormalizedOnScreen, removeAttachedViewport, resetViewport, selectArea, selectViewport, setViewportImage, transferView
 
Methods inherited from class jview.JNormalizedCanvas
addCrossCursor, addDrawable, addDrawable, addDrawable, addLink, addLink, addPoint, addPoint, addText, addText, allInside, applyDrawingInfo, assignCursorLabel, clearAllDrawable, clearAllText, clearDrawable, clearText, createCanvasCursor, disabledCanvas, drawPoints, drawPointsMap, drawShapesMap, drawText, drawTextMap, firePropertyChange, getAllCanvasCursors, getBackground, getBackgroundImage, getCanvasCursor, getClosest, getClosest, getClosest, getComposedProperties, getFromName, getImageOperation, getInside, getInverseTransform, getLink, getLinkedTo, getMaximumSize, getMinimumSize, getNormalized, getNormalizedRect, getPreferredSize, getSaveBuffer, getScreen, getScreenRect, getShapeTransform, isFlipX, isFlipY, paintComponent, paintPointsList, paintShapesList, paintTextList, removeDrawable, removeDrawable, removeLink, removeText, removeText, repaintLater, repaintNow, setBackgroundImage, setBounds, setComplete, setCursor, setCursor, setDrawable, setImageOperation, setLink, setPrepare, startAnimation, stopAnimation
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setComponentOrientation, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, 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 jview.NormalizedCoordinates
getArea, getNormalized, getNormalizedRect, getScreen, getScreenRect, getViewport, isNormalizedOnScreen, isScreenInNormalized
 

Field Detail

KEY_TABLE

public static final String KEY_TABLE
A lookup table converting sensor names to set names.

See Also:
Constant Field Values

KEY_BADTOGGLE

public static final String KEY_BADTOGGLE
If given, a vertical line is drawn at this normalized coordinate.

See Also:
Constant Field Values

KEY_GOODTOGGLE

public static final String KEY_GOODTOGGLE
If given, a vertical line is drawn at this normalized coordinate.

See Also:
Constant Field Values

KEY_MAXRETARD

public static final String KEY_MAXRETARD
Maximum time the received data event may be out-of-date.

See Also:
Constant Field Values

DEFTABLE

private static final String DEFTABLE
Incoming sensor names are translated to set names using this table.

See Also:
Constant Field Values

BAD

private static final String BAD
A bad bar.

See Also:
Constant Field Values

GOOD

private static final String GOOD
A good bar.

See Also:
Constant Field Values

DEFMAXRETARD

private static final long DEFMAXRETARD
Default mximum retard.

See Also:
Constant Field Values

DEFDRAWINGSETS

private static final String DEFDRAWINGSETS
Per default we display humidity sensors.

See Also:
Constant Field Values

DEFPOLYGONSHAPE

private static final String DEFPOLYGONSHAPE
The default shapes.

See Also:
Constant Field Values

lookup

private Map<String,String> lookup
We translate sensor-names to set-names.

Constructor Detail

JWeatherCanvas

public JWeatherCanvas(ResourceSupplying prop)
Constructs a new data canvas that goes into listening state on init().

Method Detail

setComposedProperties

public void setComposedProperties(ResourceSupplying prop)
Defaults the repository name and the sensors to monitor.

Specified by:
setComposedProperties in interface ResourceAware
Overrides:
setComposedProperties in class JDataCanvas

init

public void init()
To increase readability, we set up a look-up table here.

Specified by:
init in interface Initializable
Overrides:
init in class JDataCanvas

applyData

public void applyData(Map<String,DataEvent> readings)
Process a data event generated by a sensor repository to reflect changes. Data not needed, i.e. data that is not linked to a set-name is ignored.

Parameters:
readings - A mapping of sensor names to data events.

blockData

public void blockData(List<WeatherSurveying.DataBlock> block)
Sets a list of WeatherSurveying.BlockData measures. This data is most likely reconstructed from a database.