jview
Class JExpressionCanvas

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 jview.JExpressionCanvas
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, DataCanvasProviding, NormalizedCoordinates, NormalizedShapes, UserCoordinates, Zoomable, Initializable, ResourceAware, ResourceComposed, Savable

public class JExpressionCanvas
extends JDataCanvas

An expression canvas allows manipulating of the data points before putting it onto the canvas. A global setting might be present via the KEY_GLOBALEXPRESSIONS property. Here, for each component in the input vector, an expression might be given, separated by commas. Empty expressions are treated as the identical expression. A per-setname setting may be present in the KEY_SETEXPRESSIONS property. Here, a propertisable mapping must used, colons separate a setname=expression entry.

For each data point put via the addMeasure(java.lang.String, vec_math.VectorG, java.lang.Object) or putMeasuredSet(java.lang.String, java.util.List, java.util.List) methods, first the individual expression is searched. If no expression is found, the global expression is used. If this is also not present, the identical transformation is used.

In each expression, the components of the vector are named as v#index, where index starts at zero (e.g. v#0 is the first vector component. Applications that want to provide some additional variables should override the getExternals() method. This method should return a mapping of variable names to (double) values.

See Also:
Serialized Form

Nested Class Summary
 
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  Map<String,Number> extern
          The external variables.
private  List<String> global
          The list of globale expressions.
private  Map<String,List<String>> individual
          The mapping of setnames to individual expressions.
static String KEY_GLOBALEXPRESSIONS
          The global expressions, valid for all sets.
static String KEY_SETEXPRESSIONS
          Expressions valid only for specific sets.
static String VARID
          The string-id for vector components.
 
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
JExpressionCanvas(ResourceSupplying prop)
          Constructs a new expression canvas.
 
Method Summary
 int addMeasure(String setname, VectorG onepoint, Object key)
          Add a point specifying the set name instead of the set color.
private  VectorG calculate(String set, VectorG org, Map<String,Number> ext)
          Tries to calculate an expression for the given vector.
protected  Map<String,Number> getExternals()
          Returns null.
 void init()
          On init, parse the expressions from the properties.
 int putMeasuredSet(String setname, List<? extends VectorG> points, List<Object> keys)
          Sets a new list of data into the specified set.
protected  void setExternals(Map<String,Number> ms)
          Sets the external constants.
 
Methods inherited from class jview.JDataCanvas
addDataObserver, addDelete, addDrawingInfo, addJoint, 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, putMeasuredSets, rebuildOneDataSet, redeemList, removeDataObserver, removeJoint, revertDeleted, setComposedProperties, 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

VARID

public static final String VARID
The string-id for vector components.

See Also:
Constant Field Values

KEY_GLOBALEXPRESSIONS

public static final String KEY_GLOBALEXPRESSIONS
The global expressions, valid for all sets.

See Also:
Constant Field Values

KEY_SETEXPRESSIONS

public static final String KEY_SETEXPRESSIONS
Expressions valid only for specific sets.

See Also:
Constant Field Values

global

private List<String> global
The list of globale expressions.


individual

private Map<String,List<String>> individual
The mapping of setnames to individual expressions.


extern

private Map<String,Number> extern
The external variables.

Constructor Detail

JExpressionCanvas

public JExpressionCanvas(ResourceSupplying prop)
Constructs a new expression canvas.

Method Detail

init

public void init()
On init, parse the expressions from the properties.

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

addMeasure

public int addMeasure(String setname,
                      VectorG onepoint,
                      Object key)
Add a point specifying the set name instead of the set color. If the set name is not found in our look-up table, the entry is ignored.

Overrides:
addMeasure in class JDataCanvas

putMeasuredSet

public int putMeasuredSet(String setname,
                          List<? extends VectorG> points,
                          List<Object> keys)
Sets a new list of data into the specified set.

Overrides:
putMeasuredSet in class JDataCanvas

getExternals

protected Map<String,Number> getExternals()
Returns null. Must be overriden, if the expressions used require additional data.


setExternals

protected void setExternals(Map<String,Number> ms)
Sets the external constants.


calculate

private VectorG calculate(String set,
                          VectorG org,
                          Map<String,Number> ext)
Tries to calculate an expression for the given vector.