jview
Class JBoxedCanvas

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
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, NormalizedCoordinates, NormalizedShapes, UserCoordinates, Zoomable, Initializable, ResourceAware, ResourceComposed, Savable
Direct Known Subclasses:
JDataCanvas, JTargetHistory

public class JBoxedCanvas
extends JFrameCanvas
implements UserCoordinates

A class that allows drawing of ticks and labels on a shape canvas. The following properties are supported:

Note that ticks and labels are Shapes and JNormalizedCanvas.TextDraw objects.

See Also:
Serialized Form

Nested Class Summary
static class JBoxedCanvas.Datum
          A test class for testing the date format.
static class JBoxedCanvas.Test
          A test class for testing the layout
 
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
static double[] AUTODATE
          Default allowed rounding on ticks and labels if date (sec.)
private static double[] AUTOSTEP
          Default allowed rounding on ticks and labels.
static int BOTTOM
          The integer value vor ticks/label at bottom.
private static int[] DATECLEAR
          The calender integer fields to clear.
private static double[] DATECLEARSTEP
          Default fields to clear for start determination on date.
private static String[] DATEFORMAT
          An array of possible date formats to above steps.
private static Color DEFGRIDCOLOR
          The key .
private static boolean DEFIGNOREFORMAT
          The key .
private static int DEFLABELAT
          The key .
private static Color DEFLABELCOLOR
          The key .
private static double DEFLABELXANGLE
          The key .
private static int DEFLABELXAUTO
          The key .
private static int DEFLABELXEXTRA
          The key .
private static boolean DEFLABELXINSIDE
          The key .
private static double DEFLABELYANGLE
          The key .
private static int DEFLABELYAUTO
          The key .
private static int DEFLABELYEXTRA
          The key .
private static boolean DEFLABELYINSIDE
          The key .
private static int DEFMAXLABELS
          The key .
private static int DEFMAXTICKS
          The key .
private static int DEFTICKAT
          The key .
private static Color DEFTICKCOLOR
          The key .
private static float DEFTICKSTRETCH
          The key .
private static int DEFTICKXAUTO
          The key .
private static boolean DEFTICKXGRID
          The key .
private static boolean DEFTICKXINSIDE
          The key .
private static float DEFTICKXSIZE
          The key .
private static int DEFTICKYAUTO
          The key .
private static boolean DEFTICKYGRID
          The key .
private static boolean DEFTICKYINSIDE
          The key .
private static float DEFTICKYSIZE
          The key .
private static boolean DEFXISDATE
          The key .
private static boolean DEFXLOGARITHMIC
          The key .
private static boolean DEFYISDATE
          The key .
private static boolean DEFYLOGARITHMIC
          The key .
private  List<ShapeDraw> grid
          The list of grid lines.
static String KEY_FONT
          The key .
static String KEY_GRIDCOLOR
          The key .
static String KEY_IGNOREFORMAT
          The key .
static String KEY_LABELAT
          The key .
static String KEY_LABELCOLOR
          The key .
static String KEY_LABELXANGLE
          The key .
static String KEY_LABELXAUTO
          The key .
static String KEY_LABELXEND
          The key .
static String KEY_LABELXEXTRA
          The key .
static String KEY_LABELXFORMAT
          The key .
static String KEY_LABELXINSIDE
          The key .
static String KEY_LABELXSTART
          The key .
static String KEY_LABELXSTEP
          The key .
static String KEY_LABELYANGLE
          The key .
static String KEY_LABELYAUTO
          The key .
static String KEY_LABELYEND
          The key .
static String KEY_LABELYEXTRA
          The key .
static String KEY_LABELYFORMAT
          The key .
static String KEY_LABELYINSIDE
          The key .
static String KEY_LABELYSTART
          The key .
static String KEY_LABELYSTEP
          The key .
static String KEY_MAXLABELS
          The key .
static String KEY_MAXTICKS
          The key .
static String KEY_TICKAT
          The key .
static String KEY_TICKCOLOR
          The key .
static String KEY_TICKSTRETCH
          The key .
static String KEY_TICKXAUTO
          The key .
static String KEY_TICKXEND
          The key .
static String KEY_TICKXGRID
          The key .
static String KEY_TICKXINSIDE
          The key .
static String KEY_TICKXSIZE
          The key .
static String KEY_TICKXSTART
          The key .
static String KEY_TICKXSTEP
          The key .
static String KEY_TICKYAUTO
          The key .
static String KEY_TICKYEND
          The key .
static String KEY_TICKYGRID
          The key .
static String KEY_TICKYINSIDE
          The key .
static String KEY_TICKYSIZE
          The key .
static String KEY_TICKYSTART
          The key .
static String KEY_TICKYSTEP
          The key .
static String KEY_XISDATE
          If this key points to a boolean, label format x is a simple date.
static String KEY_XLOGARITHMIC
          If this key points to a boolean, label format x is a simple date.
static String KEY_YISDATE
          If this key points to a boolean, label format y is a simple date.
static String KEY_YLOGARITHMIC
          If this key points to a boolean, label format y is a simple date.
static int LEFT
          The integer value vor ticks/label at left.
private  CoordinateTransforming linear
          The user set transformation into normalized pixel space.
static int RIGHT
          The integer value vor ticks/label at right.
private  List<ShapeDraw> tick
          The list of tick shapes active.
static int TOP
          The integer value vor ticks/label at top.
private  List<TextDraw> xlabels
          The list of labels on the x-axes.
private  List<TextDraw> ylabels
          The list of labels on the y-axes.
 
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
JBoxedCanvas(ResourceSupplying prop)
          Constructs a new boxed canvas with auto-scaling enabled.
 
Method Summary
private  void addLabelsX(Point2D stencil, float vjust, Format form, Font labelfont, Vector2D first, Vector2D last, double step, boolean log, boolean date, Point2D off)
          We step from the starting value to the end value using the step size set in the property container.
private  void addLabelsY(Point2D stencil, float hjust, Format form, Font labelfont, Vector2D first, Vector2D last, double step, boolean log, boolean date, Point2D off)
          We step from the starting value to the end value using the step size.
private  void addTicksX(Line2D stencil, Vector2D first, Vector2D last, double step, boolean log, boolean date, List<ShapeDraw> where)
          Uses a template tick line and adds it between the starting point and the end point using the specified step size.
private  void addTicksY(Line2D stencil, Vector2D first, Vector2D last, double step, boolean log, boolean date, List<ShapeDraw> where)
          Uses a template tick line and adds it between the starting point and the end point using the specified step size.
private static double decimalEnd(double start, double end, double step)
           
private static double decimalStart(double start, double end, double step)
           
private static double decimalStepSize(double raw)
          Returns a decimal step size.
static Format getBestDateFormat(double stepdays)
          For a given step size in date, return a good estimate on the format to use.
 Format getDefaultFormatX()
          Returns the number format used on the x-labels.
 Format getDefaultFormatY()
          Returns the number format used on the y-labels.
private  double getEnd(double start, double end, double step, boolean log, boolean date)
          Uses the stepsize to return the end point of ticks or labels on an axis.
private  double getNextStep(double cur, double step0)
          Returns the next step width, if the step width for ticking or labeling is not constant, but slowly varying.
private  double getStart(double start, double end, double step, boolean log, boolean date)
          Uses the stepsize to return the starting point of ticks or labels on an axis.
private  double getStepSize(double start, double end, int mark, boolean date, boolean log)
          Derives the ideal stepsize to use for producing close to the target number ticks/labels on an axis.
 CoordinateTransforming getUserTransformation()
          Returns the morphing instance assigned to this componenet.
 CoordinateTransforming getUserTransformation(int type)
          Returns the morphing instance assigned to this componenet, ignores type
 void init()
          Initializes the boxed canvas by initializing the tick, grid and label lists.
protected  void prepareCanvas(Graphics g)
          This method is called at the beginning of the paint process of this component.
protected  void printComponent(Graphics g)
          If the fonts change during printing, this could mean that our labels are bigger, thus we should cache to absoulte inset parameters.
 void setComposedProperties(ResourceSupplying prop)
          Adds additional default mappings.
 void setUserTransformation(CoordinateTransforming xy)
          Registers the CoordinateTransforming instance that transforms user coordinates into normalized pixel space.
 void setUserTransformation(CoordinateTransforming xy, int type)
          Registers the CoordinateTransforming instance that transforms user coordinates into normalized pixel space.
protected  boolean silentlySelectViewport(Rectangle2D newview)
          This method is called when the visible viewport in normalized coordinate changes.
 boolean xIsDate()
          Returns true if x axis show a data.
 boolean yIsDate()
          Returns true if x axis show a data.
 
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, addDrawingInfo, addLink, addLink, addPoint, addPoint, addText, addText, allInside, applyDrawingInfo, assignCursorLabel, clearAllDrawable, clearAllText, clearDrawable, clearText, createCanvasCursor, disabledCanvas, drawPoints, drawPointsMap, drawShapes, drawShapesMap, drawText, drawTextMap, firePropertyChange, getActions, getAllCanvasCursors, getAnimationInfo, getBackground, getBackgroundImage, getCanvasCursor, getClosest, getClosest, getClosest, getClosestShape, getComposedProperties, getFromName, getImageOperation, getInside, getInsideShapes, getInverseTransform, getLink, getLinkedTo, getMaximumSize, getMinimumSize, getNormalized, getNormalizedRect, getPreferredSize, getSaveBuffer, getScreen, getScreenRect, getShapeTransform, isEmpty, 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

TOP

public static final int TOP
The integer value vor ticks/label at top.

See Also:
Constant Field Values

LEFT

public static final int LEFT
The integer value vor ticks/label at left.

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
The integer value vor ticks/label at bottom.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
The integer value vor ticks/label at right.

See Also:
Constant Field Values

KEY_MAXTICKS

public static final String KEY_MAXTICKS
The key .

See Also:
Constant Field Values

KEY_MAXLABELS

public static final String KEY_MAXLABELS
The key .

See Also:
Constant Field Values

KEY_TICKAT

public static final String KEY_TICKAT
The key .

See Also:
Constant Field Values

KEY_LABELAT

public static final String KEY_LABELAT
The key .

See Also:
Constant Field Values

KEY_TICKXINSIDE

public static final String KEY_TICKXINSIDE
The key .

See Also:
Constant Field Values

KEY_TICKYINSIDE

public static final String KEY_TICKYINSIDE
The key .

See Also:
Constant Field Values

KEY_LABELXINSIDE

public static final String KEY_LABELXINSIDE
The key .

See Also:
Constant Field Values

KEY_LABELYINSIDE

public static final String KEY_LABELYINSIDE
The key .

See Also:
Constant Field Values

KEY_TICKXSIZE

public static final String KEY_TICKXSIZE
The key .

See Also:
Constant Field Values

KEY_TICKYSIZE

public static final String KEY_TICKYSIZE
The key .

See Also:
Constant Field Values

KEY_TICKSTRETCH

public static final String KEY_TICKSTRETCH
The key .

See Also:
Constant Field Values

KEY_FONT

public static final String KEY_FONT
The key .

See Also:
Constant Field Values

KEY_IGNOREFORMAT

public static final String KEY_IGNOREFORMAT
The key .

See Also:
Constant Field Values

KEY_LABELXFORMAT

public static final String KEY_LABELXFORMAT
The key .

See Also:
Constant Field Values

KEY_LABELYFORMAT

public static final String KEY_LABELYFORMAT
The key .

See Also:
Constant Field Values

KEY_TICKXSTART

public static final String KEY_TICKXSTART
The key .

See Also:
Constant Field Values

KEY_TICKYSTART

public static final String KEY_TICKYSTART
The key .

See Also:
Constant Field Values

KEY_TICKXEND

public static final String KEY_TICKXEND
The key .

See Also:
Constant Field Values

KEY_TICKYEND

public static final String KEY_TICKYEND
The key .

See Also:
Constant Field Values

KEY_TICKXSTEP

public static final String KEY_TICKXSTEP
The key .

See Also:
Constant Field Values

KEY_TICKYSTEP

public static final String KEY_TICKYSTEP
The key .

See Also:
Constant Field Values

KEY_TICKXAUTO

public static final String KEY_TICKXAUTO
The key .

See Also:
Constant Field Values

KEY_TICKYAUTO

public static final String KEY_TICKYAUTO
The key .

See Also:
Constant Field Values

KEY_LABELXSTART

public static final String KEY_LABELXSTART
The key .

See Also:
Constant Field Values

KEY_LABELYSTART

public static final String KEY_LABELYSTART
The key .

See Also:
Constant Field Values

KEY_LABELXEND

public static final String KEY_LABELXEND
The key .

See Also:
Constant Field Values

KEY_LABELYEND

public static final String KEY_LABELYEND
The key .

See Also:
Constant Field Values

KEY_LABELXSTEP

public static final String KEY_LABELXSTEP
The key .

See Also:
Constant Field Values

KEY_LABELYSTEP

public static final String KEY_LABELYSTEP
The key .

See Also:
Constant Field Values

KEY_LABELXANGLE

public static final String KEY_LABELXANGLE
The key .

See Also:
Constant Field Values

KEY_LABELYANGLE

public static final String KEY_LABELYANGLE
The key .

See Also:
Constant Field Values

KEY_LABELXAUTO

public static final String KEY_LABELXAUTO
The key .

See Also:
Constant Field Values

KEY_LABELYAUTO

public static final String KEY_LABELYAUTO
The key .

See Also:
Constant Field Values

KEY_LABELXEXTRA

public static final String KEY_LABELXEXTRA
The key .

See Also:
Constant Field Values

KEY_LABELYEXTRA

public static final String KEY_LABELYEXTRA
The key .

See Also:
Constant Field Values

KEY_TICKXGRID

public static final String KEY_TICKXGRID
The key .

See Also:
Constant Field Values

KEY_TICKYGRID

public static final String KEY_TICKYGRID
The key .

See Also:
Constant Field Values

KEY_TICKCOLOR

public static final String KEY_TICKCOLOR
The key .

See Also:
Constant Field Values

KEY_LABELCOLOR

public static final String KEY_LABELCOLOR
The key .

See Also:
Constant Field Values

KEY_GRIDCOLOR

public static final String KEY_GRIDCOLOR
The key .

See Also:
Constant Field Values

KEY_XISDATE

public static final String KEY_XISDATE
If this key points to a boolean, label format x is a simple date.

See Also:
Constant Field Values

KEY_YISDATE

public static final String KEY_YISDATE
If this key points to a boolean, label format y is a simple date.

See Also:
Constant Field Values

KEY_XLOGARITHMIC

public static final String KEY_XLOGARITHMIC
If this key points to a boolean, label format x is a simple date.

See Also:
Constant Field Values

KEY_YLOGARITHMIC

public static final String KEY_YLOGARITHMIC
If this key points to a boolean, label format y is a simple date.

See Also:
Constant Field Values

DEFMAXTICKS

private static final int DEFMAXTICKS
The key .

See Also:
Constant Field Values

DEFMAXLABELS

private static final int DEFMAXLABELS
The key .

See Also:
Constant Field Values

DEFTICKAT

private static final int DEFTICKAT
The key .

See Also:
Constant Field Values

DEFLABELAT

private static final int DEFLABELAT
The key .

See Also:
Constant Field Values

DEFTICKXINSIDE

private static final boolean DEFTICKXINSIDE
The key .

See Also:
Constant Field Values

DEFTICKYINSIDE

private static final boolean DEFTICKYINSIDE
The key .

See Also:
Constant Field Values

DEFLABELXINSIDE

private static final boolean DEFLABELXINSIDE
The key .

See Also:
Constant Field Values

DEFLABELYINSIDE

private static final boolean DEFLABELYINSIDE
The key .

See Also:
Constant Field Values

DEFTICKXSIZE

private static final float DEFTICKXSIZE
The key .

See Also:
Constant Field Values

DEFTICKYSIZE

private static final float DEFTICKYSIZE
The key .

See Also:
Constant Field Values

DEFTICKSTRETCH

private static final float DEFTICKSTRETCH
The key .

See Also:
Constant Field Values

DEFLABELXEXTRA

private static final int DEFLABELXEXTRA
The key .

See Also:
Constant Field Values

DEFLABELYEXTRA

private static final int DEFLABELYEXTRA
The key .

See Also:
Constant Field Values

DEFTICKXAUTO

private static final int DEFTICKXAUTO
The key .

See Also:
Constant Field Values

DEFTICKYAUTO

private static final int DEFTICKYAUTO
The key .

See Also:
Constant Field Values

DEFLABELXAUTO

private static final int DEFLABELXAUTO
The key .

See Also:
Constant Field Values

DEFLABELYAUTO

private static final int DEFLABELYAUTO
The key .

See Also:
Constant Field Values

DEFLABELXANGLE

private static final double DEFLABELXANGLE
The key .

See Also:
Constant Field Values

DEFLABELYANGLE

private static final double DEFLABELYANGLE
The key .

See Also:
Constant Field Values

DEFTICKXGRID

private static final boolean DEFTICKXGRID
The key .

See Also:
Constant Field Values

DEFTICKYGRID

private static final boolean DEFTICKYGRID
The key .

See Also:
Constant Field Values

DEFXISDATE

private static final boolean DEFXISDATE
The key .

See Also:
Constant Field Values

DEFYISDATE

private static final boolean DEFYISDATE
The key .

See Also:
Constant Field Values

DEFXLOGARITHMIC

private static final boolean DEFXLOGARITHMIC
The key .

See Also:
Constant Field Values

DEFYLOGARITHMIC

private static final boolean DEFYLOGARITHMIC
The key .

See Also:
Constant Field Values

DEFIGNOREFORMAT

private static final boolean DEFIGNOREFORMAT
The key .

See Also:
Constant Field Values

DEFTICKCOLOR

private static final Color DEFTICKCOLOR
The key .


DEFLABELCOLOR

private static final Color DEFLABELCOLOR
The key .


DEFGRIDCOLOR

private static final Color DEFGRIDCOLOR
The key .


AUTOSTEP

private static final double[] AUTOSTEP
Default allowed rounding on ticks and labels.


AUTODATE

public static final double[] AUTODATE
Default allowed rounding on ticks and labels if date (sec.)


DATEFORMAT

private static String[] DATEFORMAT
An array of possible date formats to above steps.


DATECLEARSTEP

private static final double[] DATECLEARSTEP
Default fields to clear for start determination on date.


DATECLEAR

private static final int[] DATECLEAR
The calender integer fields to clear.


linear

private CoordinateTransforming linear
The user set transformation into normalized pixel space.


tick

private List<ShapeDraw> tick
The list of tick shapes active.


grid

private List<ShapeDraw> grid
The list of grid lines.


xlabels

private List<TextDraw> xlabels
The list of labels on the x-axes.


ylabels

private List<TextDraw> ylabels
The list of labels on the y-axes.

Constructor Detail

JBoxedCanvas

public JBoxedCanvas(ResourceSupplying prop)
Constructs a new boxed canvas with auto-scaling enabled.

See Also:
setUserTransformation(jview.CoordinateTransforming)
Method Detail

init

public void init()
Initializes the boxed canvas by initializing the tick, grid and label lists.

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

setComposedProperties

public void setComposedProperties(ResourceSupplying prop)
Adds additional default mappings.

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

setUserTransformation

public void setUserTransformation(CoordinateTransforming xy)
Registers the CoordinateTransforming instance that transforms user coordinates into normalized pixel space. Normal action will require calling the JViewportCanvas.selectViewport(java.awt.geom.Rectangle2D) with the current viewport afterwards to ensure proper labeling.

Specified by:
setUserTransformation in interface UserCoordinates

setUserTransformation

public void setUserTransformation(CoordinateTransforming xy,
                                  int type)
Registers the CoordinateTransforming instance that transforms user coordinates into normalized pixel space. Normal action will require calling the JViewportCanvas.selectViewport(java.awt.geom.Rectangle2D) with the current viewport afterwards to ensure proper labeling. Ignores type.

Specified by:
setUserTransformation in interface UserCoordinates

getUserTransformation

public CoordinateTransforming getUserTransformation()
Returns the morphing instance assigned to this componenet.

Specified by:
getUserTransformation in interface UserCoordinates

getUserTransformation

public CoordinateTransforming getUserTransformation(int type)
Returns the morphing instance assigned to this componenet, ignores type

Specified by:
getUserTransformation in interface UserCoordinates
Parameters:
type - Zero for main type, others for special use.

getBestDateFormat

public static Format getBestDateFormat(double stepdays)
For a given step size in date, return a good estimate on the format to use.


silentlySelectViewport

protected boolean silentlySelectViewport(Rectangle2D newview)
This method is called when the visible viewport in normalized coordinate changes. The parental method keeps track of transforming normalized space to on-screen space, but we have to re-do labels here.

Calling this method sparks the following things:

Autoticking/labeling is done in the way that we aim at integer positions of the ticks/labels, yielding a number that is close to the target number pointed to by the appropriate keys.

Overrides:
silentlySelectViewport in class JViewportCanvas

xIsDate

public boolean xIsDate()
Returns true if x axis show a data.


yIsDate

public boolean yIsDate()
Returns true if x axis show a data.


printComponent

protected void printComponent(Graphics g)
If the fonts change during printing, this could mean that our labels are bigger, thus we should cache to absoulte inset parameters.

Overrides:
printComponent in class JNormalizedCanvas

prepareCanvas

protected void prepareCanvas(Graphics g)
This method is called at the beginning of the paint process of this component. The parental method clears the background, if we are opaque, which is normally the case. This method draws the ticks, labels and grid lines before the parent draws the actual shapes.

Overrides:
prepareCanvas in class JFrameCanvas

getDefaultFormatX

public Format getDefaultFormatX()
Returns the number format used on the x-labels. If the Morphing instance registered to the box is not a FormattingMorphing, then the box-specific format is used.


getDefaultFormatY

public Format getDefaultFormatY()
Returns the number format used on the y-labels.


getStepSize

private double getStepSize(double start,
                           double end,
                           int mark,
                           boolean date,
                           boolean log)
Derives the ideal stepsize to use for producing close to the target number ticks/labels on an axis. The stepsize returned is a 10^n multiple of the possible stepsize given in AUTOSTEP.

Parameters:
start - The x(y) value at pixel coordinate zero.
end - The x(y) value at pixel coordinate one.
mark - The number of steps
Returns:
The ideal stepsize, like 0.05.

decimalStepSize

private static double decimalStepSize(double raw)
Returns a decimal step size.


getStart

private double getStart(double start,
                        double end,
                        double step,
                        boolean log,
                        boolean date)
Uses the stepsize to return the starting point of ticks or labels on an axis. If the end value is less then the start value, the returned entry point is also less then the start value.

Parameters:
start - The coordinate value at pixel zero.
end - The coordinate value at pixel one.
step - The stepwidth on this axis.
Returns:
The starting value in coordinate space.

decimalStart

private static double decimalStart(double start,
                                   double end,
                                   double step)

decimalEnd

private static double decimalEnd(double start,
                                 double end,
                                 double step)

getEnd

private double getEnd(double start,
                      double end,
                      double step,
                      boolean log,
                      boolean date)
Uses the stepsize to return the end point of ticks or labels on an axis. If the start value is less then the end value, the returned entry point is also less then the end value.

Parameters:
start - The coordinate value at pixel zero.
end - The coordinate value at pixel one.
step - The stepwidth on this axis.
Returns:
The starting value in coordinate space.

getNextStep

private double getNextStep(double cur,
                           double step0)
Returns the next step width, if the step width for ticking or labeling is not constant, but slowly varying. Currently, only date formatter can require different step size.


addTicksX

private void addTicksX(Line2D stencil,
                       Vector2D first,
                       Vector2D last,
                       double step,
                       boolean log,
                       boolean date,
                       List<ShapeDraw> where)
Uses a template tick line and adds it between the starting point and the end point using the specified step size.


addTicksY

private void addTicksY(Line2D stencil,
                       Vector2D first,
                       Vector2D last,
                       double step,
                       boolean log,
                       boolean date,
                       List<ShapeDraw> where)
Uses a template tick line and adds it between the starting point and the end point using the specified step size.


addLabelsX

private void addLabelsX(Point2D stencil,
                        float vjust,
                        Format form,
                        Font labelfont,
                        Vector2D first,
                        Vector2D last,
                        double step,
                        boolean log,
                        boolean date,
                        Point2D off)
We step from the starting value to the end value using the step size set in the property container. The template point is shifted along the x-axis to the location of the label, where we draw the label using the current x-value in coordinate space with a justification of 0.5 horizontal and a vertical justification as specified. If we have a FormattingMorphing assigned to this box, we use it to format the label, otherwise the default, box-internal format is used.

Parameters:
stencil - Used for shifting the drawing position of the label.
vjust - Vertical adjustment of label
form - A default formatter, if box-morphing cannot format.
unit - A string appended to the label.
labelfont - The font used to draw the label.
labelcol - The color used to draw the label.
pixstart - The starting label in pixel space.
pixend - The end label in pixel space.
pixstep - The pixel stepping size.
off - Additional offset.

addLabelsY

private void addLabelsY(Point2D stencil,
                        float hjust,
                        Format form,
                        Font labelfont,
                        Vector2D first,
                        Vector2D last,
                        double step,
                        boolean log,
                        boolean date,
                        Point2D off)
We step from the starting value to the end value using the step size. The template point is shifted along the y-axis to the location of the label, where we draw the label using the current y-value in pixel space with a justification of 0.5 vertical and a horizontal justification as specified.

Parameters:
stencil - Used for shifting the drawing position of the label.
hjust - Vertical adjustment of label
form - A default formatter, if box-morphing cannot format.
unit - A string appended to the label.
labelfont - The font used to draw the label.
labelcol - The color used to draw the label.
pixstart - The starting label in pixel space.
pixend - The end label in pixel space.
pixstep - The pixel stepping size.
off - Additional offset.