spv.graphics
Class AxisCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by spv.graphics.GraphicsCanvasDecorator
                  extended by spv.graphics.AbstractSensitiveCanvas
                      extended by spv.graphics.AxisCanvas
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable, GraphicsCanvas, PlottableGraphics

public class AxisCanvas
extends AbstractSensitiveCanvas

This canvas adds axis with labels and titles to the decorated object.

Version:
1.0 - 28Jan99
Author:
Ivo Busko (Space Telescope Science Institute)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class spv.graphics.AbstractSensitiveCanvas
AbstractSensitiveCanvas.CursorIconControl, AbstractSensitiveCanvas.MouseControl
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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
private  Annotation[] annotations
           
private  Axis bottom_axis
           
static java.lang.String BOTTOM_AXIS_KEY
           
private  java.awt.Graphics2D boundedGraphics
           
private  Viewport dev
           
private  boolean is_ready_to_draw
           
private  Axis left_axis
           
static java.lang.String LEFT_AXIS_KEY
           
private  Axis right_axis
           
private  Axis top_axis
           
 
Fields inherited from class spv.graphics.AbstractSensitiveCanvas
sense_regions
 
Fields inherited from class spv.graphics.GraphicsCanvasDecorator
decorated_canvas, decorator, ignore_cursor, printing
 
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.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AxisCanvas(GraphicsCanvas graphic_canvas)
          Constructor.
 
Method Summary
protected  void activate(int index)
          This method is called whenever the mouse is clicked on one of the axis titles.
protected  void activate(int region, boolean showTextFields)
           
 void draw(java.awt.Graphics g)
          Performs the drawing operations.
private  void drawAxis(java.awt.Graphics g)
          Draws the four axis.
 void plot()
          Re-computes everything necessary to plot in the current viewports and calls plot() in the superclass.
private  java.awt.Graphics2D resetClipRegion(java.awt.Graphics g)
          Reset the clip region to current viewport.
 void setAnnotations(java.util.Map list)
          Sets annotation objects witb the axis labels
private  void setTitleRegions()
          Set sensitive regions for the axis titles.
 void setTitles(java.lang.String xtitle, java.lang.String ytitle)
          Sets the axis titles.
 
Methods inherited from class spv.graphics.AbstractSensitiveCanvas
setSensitiveRegions, unsetSensitiveRegions
 
Methods inherited from class spv.graphics.GraphicsCanvasDecorator
addToChart, attachDataSet, attachRange, clearInternalReferences, disableIntegrator, enableIntegrator, eraseMarkers, eraseMarkers, getAnnotations, getAnnotationSets, getAxisType, getBottomBorder, getCanvasViewport, getDataSets, getGraphics2D, getIntegrationRegions, getJComponent, getLeftBorder, getLogarithm, getOriginalObject, getOriginalObjectID, getPlottableObject, getRightBorder, getSystemCursor, getTopBorder, getTransform, getWCSViewport, getXUnits, getYUnits, ignoreCursorEvent, isMeasurementEnabled, isMouseClickEnabled, paintComponent, print, print, removeAnnotation, reset, reset2, setAnnotationSets, setAxisType, setBorders, setCursorDashPattern, setDecorator, setIntegrationRegions, setLogarithm, setMarkers, setMinimumSizes, setOriginalObject, setOriginalObjectGraphicsID, setOriginalObjectID, setPlottableObject, setSizes, setSystemCursor, setWCSViewport, setXAutoLog, setXUnits, setYAutoLog, setYUnits, stopCursorObservation, undoWCSViewport
 
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, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, 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, printAll, printBorder, printChildren, printComponent, 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, firePropertyChange, getBackground, 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, setBounds, setComponentOrientation, setCursor, 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
 

Field Detail

dev

private Viewport dev

top_axis

private Axis top_axis

bottom_axis

private Axis bottom_axis

left_axis

private Axis left_axis

right_axis

private Axis right_axis

is_ready_to_draw

private boolean is_ready_to_draw

annotations

private Annotation[] annotations

boundedGraphics

private java.awt.Graphics2D boundedGraphics

LEFT_AXIS_KEY

public static final java.lang.String LEFT_AXIS_KEY
See Also:
Constant Field Values

BOTTOM_AXIS_KEY

public static final java.lang.String BOTTOM_AXIS_KEY
See Also:
Constant Field Values
Constructor Detail

AxisCanvas

public AxisCanvas(GraphicsCanvas graphic_canvas)
Constructor.

Parameters:
graphic_canvas - the GraphicsCanvas object to be decorated with a frame
Method Detail

setTitles

public void setTitles(java.lang.String xtitle,
                      java.lang.String ytitle)
Sets the axis titles.

Specified by:
setTitles in interface GraphicsCanvas
Overrides:
setTitles in class GraphicsCanvasDecorator
Parameters:
xtitle - the X axis title
ytitle - the Y axis title

draw

public void draw(java.awt.Graphics g)
Performs the drawing operations.

Specified by:
draw in interface PlottableGraphics
Overrides:
draw in class AbstractSensitiveCanvas
Parameters:
g - the Graphics context where to draw

drawAxis

private void drawAxis(java.awt.Graphics g)
Draws the four axis.

This method basically defers the required operations to the underlying Axis objects in this.

Parameters:
g - the graphics context

resetClipRegion

private java.awt.Graphics2D resetClipRegion(java.awt.Graphics g)
Reset the clip region to current viewport.

Parameters:
g - the graphics context
Returns:
new graphics context bounded by the viewport

setTitleRegions

private void setTitleRegions()
Set sensitive regions for the axis titles.


plot

public void plot()
Re-computes everything necessary to plot in the current viewports and calls plot() in the superclass.

This method basically defers the required operations to the underlying Axis objects in this.

Specified by:
plot in interface GraphicsCanvas
Specified by:
plot in interface PlottableGraphics
Overrides:
plot in class GraphicsCanvasDecorator

activate

protected void activate(int index)
This method is called whenever the mouse is clicked on one of the axis titles. It activates the annotation object associated with the title.

Specified by:
activate in class AbstractSensitiveCanvas
Parameters:
index - the region to be activated

activate

protected void activate(int region,
                        boolean showTextFields)
Specified by:
activate in class AbstractSensitiveCanvas

setAnnotations

public void setAnnotations(java.util.Map list)
Sets annotation objects witb the axis labels

Specified by:
setAnnotations in interface GraphicsCanvas
Overrides:
setAnnotations in class GraphicsCanvasDecorator
Parameters:
list - the list of annotation objects