|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
spv.graphics.GraphicsCanvasDecorator
public abstract class GraphicsCanvasDecorator
Abstract superclass of all classes that implement plot decorators.
Subclasses must basically provide a custom implementation of
draw( Graphics g ) to perform the specific decorator
plotting.
Ex.: to add a cross-hair cursor to a plot, use code such as this:
GraphicsCanvas canvas = new CursorCanvas( new DataCanvas());
A decorated object, or even a bare-bones DataCanvas
plot, must be added to a Container object in order
to be displayable on screen. This must be done by the way of the
getComponent() or getJComponent() methods,
that return a Component or JComponent
version, respectively, of the GraphicsCanvas plot object.
Ex.:
JPanel panel = new JPanel(); panel.setLayout ( new BorderLayout()); panel.add ( canvas.getComponent(), BorderLayout.CENTER);
The use of BorderLayout with "Center" positioning is
recommended to allow automatic and transparent plot resizing.
DataCanvas,
Serialized Form| Nested Class Summary |
|---|
| 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 javax.swing.JComponent |
component
|
GraphicsCanvas |
decorated_canvas
|
protected GraphicsCanvas |
decorator
|
protected boolean |
ignore_cursor
|
protected boolean |
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 | |
|---|---|
GraphicsCanvasDecorator(GraphicsCanvas decorated_canvas)
Constructor. |
|
| Method Summary | |
|---|---|
void |
addToChart(javax.swing.JComponent component)
Add yourself to the chart. |
void |
attachDataSet(DataSet ds)
Associates a DataSet instance with the canvas. |
void |
attachRange(DataSet ds)
Associates a DataSet instance with the canvas. |
void |
clearInternalReferences()
|
void |
disableIntegrator()
Disables the measurement gizmo. |
private void |
dispatchMouseEvent(java.awt.event.MouseEvent e)
Dispatches mouse events to underlying component. |
abstract void |
draw(java.awt.Graphics g)
Performs the drawing operations. |
void |
enableIntegrator()
Enables the integrator gizmo. |
void |
eraseMarkers()
Erases all markers. |
void |
eraseMarkers(GraphicsMarker[] markers)
Erases selected markers. |
java.util.Map |
getAnnotations()
Gets a map of annotation objects. |
java.util.List |
getAnnotationSets()
Gets the list of annotation sets. |
AxisType |
getAxisType()
Gets the axis types. |
int |
getBottomBorder()
Gets the bottom border. |
Viewport |
getCanvasViewport()
Gets the canvas' current viewport. |
java.util.Vector |
getDataSets()
Gets the instances of DataSet associated with
this canvas. |
java.awt.Graphics2D |
getGraphics2D()
Gets the current Graphics2D context where data
is being plotted. |
IntegrationRegionSet |
getIntegrationRegions()
Gets the integration regions. |
javax.swing.JComponent |
getJComponent()
Gets the Swing JComponent where the plot lives. |
int |
getLeftBorder()
Gets the left border. |
Logarithm |
getLogarithm()
Gets the Logarithm object associated with this
graphics canvas. |
java.lang.Object |
getOriginalObject()
Gets the original object that gave rise to the plot. |
java.lang.String |
getOriginalObjectID()
Gets the ID of the original object that gave rise to the plot. |
java.lang.Object |
getPlottableObject()
Gets the plottable object that gave rise to the plot. |
int |
getRightBorder()
Gets the right border. |
java.awt.Cursor |
getSystemCursor()
Gets the cursor. |
int |
getTopBorder()
Gets the top border. |
WCSTransform |
getTransform()
Gets the coordinate transform. |
Viewport |
getWCSViewport()
Gets the current WCS viewport. |
Units |
getXUnits()
Gets the X units. |
Units |
getYUnits()
Gets the Y units. |
boolean |
ignoreCursorEvent()
This is used to synchronize behavior in between canvases that use the same cursor event for different purposes. |
boolean |
isMeasurementEnabled()
Checks if measurements are enabled. |
boolean |
isMouseClickEnabled()
This is used to syncronize the actions between canvases that process mouse clicks. |
void |
paintComponent(java.awt.Graphics g)
Overrides paintComponent in the superclass. |
void |
plot()
Calls the plot() method in the next decorator. |
void |
print(java.awt.Graphics g)
Prints this decorator into the given Graphics
context, and calls print( Graphics g ) in the
decorator above this. |
int |
print(java.awt.Graphics g,
java.awt.print.PageFormat pf,
int pi)
Prints this component into the given graphics context, at the specified index and with the specified format. |
void |
removeAnnotation(Annotation annotation)
Removes annotation instance from canvas. |
void |
reset()
Resets the canvas to default WCS viewport. |
void |
reset2()
Resets the canvas to WCS viewport adjusted to the central part of the attached data sets. |
void |
setAnnotations(java.util.Map list)
Sets annotation objects |
void |
setAnnotationSets(java.util.List sets)
Sets a list of annotation sets. |
void |
setAxisType(AxisType at)
Sets the axis types. |
void |
setBorders(int left,
int right,
int top,
int bottom)
Sets the borders around the canvas viewport. |
void |
setCursorDashPattern(java.lang.String dash)
Sets cursor dash pattern. |
void |
setDecorator(GraphicsCanvas decorator)
Stores the next level decorator of this canvas. |
void |
setIntegrationRegions(IntegrationRegionSet regions)
Sets the integration regions to values specified in a list. |
void |
setLogarithm(Logarithm log)
Sets a Logarithm object into this canvas. |
void |
setMarkers(GraphicsMarker[] markers,
java.awt.Color color)
Sets an array of GraphicsMarker objects. |
void |
setMinimumSizes(java.awt.Dimension size)
Sets the canvas minimum size. |
void |
setOriginalObject(java.lang.Object origin)
Sets the original object that gave rise to the plot. |
void |
setOriginalObjectGraphicsID(java.lang.String origin_gid)
Sets the graphics ID of the original object that gave rise to the plot. |
void |
setOriginalObjectID(java.lang.String origin_id)
Sets the ID of the original object that gave rise to the plot. |
void |
setPlottableObject(java.lang.Object plottable)
Sets the original plottable object that gave rise to the plot. |
void |
setSizes(java.awt.Dimension size)
Sets the canvas size. |
void |
setSystemCursor(java.awt.Cursor cursor)
Sets the cursor. |
void |
setTitles(java.lang.String xtitle,
java.lang.String ytitle)
Sets the axis titles. |
void |
setWCSViewport(Viewport wcs)
Sets the WCS viewport. |
void |
setXAutoLog(boolean auto_log)
Sets the X auto log mode. |
void |
setXUnits(Units xunits)
Sets the X units. |
void |
setYAutoLog(boolean auto_log)
Sets the Y auto log mode. |
void |
setYUnits(Units yunits)
Sets the Y units. |
void |
stopCursorObservation()
Stops listening to the global cursor. |
void |
undoWCSViewport()
Goes back to the previous WCS viewport. |
| 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 |
|---|
public GraphicsCanvas decorated_canvas
protected GraphicsCanvas decorator
protected boolean printing
protected boolean ignore_cursor
private javax.swing.JComponent component
| Constructor Detail |
|---|
public GraphicsCanvasDecorator(GraphicsCanvas decorated_canvas)
decorated_canvas - the GraphicsCanvas object to be
decorated| Method Detail |
|---|
private void dispatchMouseEvent(java.awt.event.MouseEvent e)
e - the MouseEvent object to be
dispatchedpublic void paintComponent(java.awt.Graphics g)
paintComponent in the superclass.
Just calls the draw() method, which should
be implemented in each decorator to perform the drawing
operations specific to that decorator.
This method shouldn't normally be called by users; it exists solely to allow an entry point for the underlying windowing system.
paintComponent in class javax.swing.JComponentg - the graphics context
public int print(java.awt.Graphics g,
java.awt.print.PageFormat pf,
int pi)
throws java.awt.print.PrinterException
print() in the decorated object. The bottommost
decorated object (an instance of DataCanvas
This method shouldn't normally be called by users; it exists
solely to allow an entry point for the underlying system.
print in interface java.awt.print.Printableg - the graphics contextpf - the page formatpi - the page index
java.awt.print.PrinterExceptionpublic void plot()
plot() method in the next decorator.
plot in interface GraphicsCanvasplot in interface PlottableGraphicspublic void print(java.awt.Graphics g)
Graphics
context, and calls print( Graphics g ) in the
decorator above this. This method is used to consolidate all
drawing operations into a single Graphics context.
print in interface GraphicsCanvasprint in class javax.swing.JComponentg - the graphics contextpublic abstract void draw(java.awt.Graphics g)
paintComponent() and print() from the
Printable interface.
draw in interface PlottableGraphicsg - the Graphics context where to drawpublic void clearInternalReferences()
clearInternalReferences in interface GraphicsCanvaspublic void setOriginalObject(java.lang.Object origin)
setOriginalObject in interface GraphicsCanvasorigin - the object that gave rise to the plotpublic void setPlottableObject(java.lang.Object plottable)
setPlottableObject in interface GraphicsCanvasplottable - the plottable object that gave rise to the plotpublic void setOriginalObjectID(java.lang.String origin_id)
setOriginalObjectID in interface GraphicsCanvasorigin_id - the ID of the object that gave rise to the plotpublic void setOriginalObjectGraphicsID(java.lang.String origin_gid)
setOriginalObjectGraphicsID in interface GraphicsCanvasorigin_gid - the graphics ID of the object that gave rise
to the plotpublic boolean isMouseClickEnabled()
isMouseClickEnabled in interface GraphicsCanvasfalse if other canvases can't be
allowed to process mouse clickspublic java.lang.Object getOriginalObject()
getOriginalObject in interface GraphicsCanvaspublic java.lang.Object getPlottableObject()
getPlottableObject in interface GraphicsCanvaspublic java.lang.String getOriginalObjectID()
getOriginalObjectID in interface GraphicsCanvaspublic void setDecorator(GraphicsCanvas decorator)
setDecorator in interface GraphicsCanvasdecorator - the decoratorpublic void attachDataSet(DataSet ds)
DataSet instance with the canvas.
Data sets are plotted by attaching them to the plot canvas.
attachDataSet in interface GraphicsCanvasds - the data set to be attachedpublic java.util.Vector getDataSets()
DataSet associated with
this canvas.
getDataSets in interface GraphicsCanvasDataSet associated with
this canvaspublic void attachRange(DataSet ds)
DataSet instance with the canvas.
The data sets associated with the canvas by this method get
plotted using a different model. They are meant to depict
data ranges in the independent variable.
attachRange in interface GraphicsCanvasds - the data set to be attachedpublic Logarithm getLogarithm()
Logarithm object associated with this
graphics canvas.
getLogarithm in interface GraphicsCanvasLogarithm object associated with this
graphics canvaspublic void setLogarithm(Logarithm log)
Logarithm object into this canvas. The logarithm
object is used to perform conversions between log and linear WCS
spaces.
setLogarithm in interface GraphicsCanvaslog - a Logarithm objectpublic void reset()
reset in interface GraphicsCanvaspublic void reset2()
reset2 in interface GraphicsCanvaspublic void stopCursorObservation()
stopCursorObservation in interface GraphicsCanvaspublic boolean ignoreCursorEvent()
ignoreCursorEvent in interface GraphicsCanvastrue if other canvases should ignore
cursor eventspublic javax.swing.JComponent getJComponent()
JComponent where the plot lives.
getJComponent in interface GraphicsCanvaspublic java.awt.Cursor getSystemCursor()
getSystemCursor in interface GraphicsCanvaspublic void setSystemCursor(java.awt.Cursor cursor)
setSystemCursor in interface GraphicsCanvascursor - the cursorpublic void setCursorDashPattern(java.lang.String dash)
setCursorDashPattern in interface GraphicsCanvasdash - the dash patternpublic java.awt.Graphics2D getGraphics2D()
Graphics2D context where data
is being plotted.
getGraphics2D in interface GraphicsCanvasGraphics2D context, or
null if no plot took place yet.public void addToChart(javax.swing.JComponent component)
addToChart in interface GraphicsCanvascomponent - the chart to be added topublic void setWCSViewport(Viewport wcs)
setWCSViewport in interface GraphicsCanvaswcs - the WCS viewportpublic void undoWCSViewport()
undoWCSViewport in interface GraphicsCanvaspublic Viewport getWCSViewport()
getWCSViewport in interface GraphicsCanvasnull if no
data is attached to this canvas.public void setXAutoLog(boolean auto_log)
setXAutoLog in interface GraphicsCanvasauto_log - the auto log modepublic void setYAutoLog(boolean auto_log)
setYAutoLog in interface GraphicsCanvasauto_log - the auto log modepublic void setAxisType(AxisType at)
setAxisType in interface GraphicsCanvasat - the axis typepublic AxisType getAxisType()
getAxisType in interface GraphicsCanvaspublic Viewport getCanvasViewport()
getCanvasViewport in interface GraphicsCanvasnull if
the canvas size is not defined yet.public WCSTransform getTransform()
getTransform in interface GraphicsCanvasnull if
the canvas size is not defined.public java.util.Map getAnnotations()
getAnnotations in interface GraphicsCanvaspublic void setAnnotations(java.util.Map list)
setAnnotations in interface GraphicsCanvaslist - the list of annotation objectspublic void removeAnnotation(Annotation annotation)
removeAnnotation in interface GraphicsCanvasannotation - the instance to be removedpublic java.util.List getAnnotationSets()
getAnnotationSets in interface GraphicsCanvaspublic void setAnnotationSets(java.util.List sets)
setAnnotationSets in interface GraphicsCanvassets - the list of annotation sets
public void setBorders(int left,
int right,
int top,
int bottom)
setBorders in interface GraphicsCanvasleft - the left borderright - the right bordertop - the top borderbottom - the bottom border
public void setTitles(java.lang.String xtitle,
java.lang.String ytitle)
setTitles in interface GraphicsCanvasxtitle - the tite for the X axisytitle - the tite for the Y axispublic int getLeftBorder()
getLeftBorder in interface GraphicsCanvaspublic int getRightBorder()
getRightBorder in interface GraphicsCanvaspublic int getBottomBorder()
getBottomBorder in interface GraphicsCanvaspublic int getTopBorder()
getTopBorder in interface GraphicsCanvaspublic void setSizes(java.awt.Dimension size)
setSizes in interface GraphicsCanvassize - the canvas sizepublic void setMinimumSizes(java.awt.Dimension size)
setMinimumSizes in interface GraphicsCanvassize - the canvas minimum sizepublic Units getXUnits()
getXUnits in interface GraphicsCanvaspublic Units getYUnits()
getYUnits in interface GraphicsCanvaspublic void setXUnits(Units xunits)
setXUnits in interface GraphicsCanvasxunits - the X unitspublic void setYUnits(Units yunits)
setYUnits in interface GraphicsCanvasyunits - the Y unitspublic void enableIntegrator()
enableIntegrator in interface GraphicsCanvaspublic void disableIntegrator()
disableIntegrator in interface GraphicsCanvaspublic boolean isMeasurementEnabled()
isMeasurementEnabled in interface GraphicsCanvastrue if measurements are enabledpublic void setIntegrationRegions(IntegrationRegionSet regions)
setIntegrationRegions in interface GraphicsCanvasregions - the region parameterspublic IntegrationRegionSet getIntegrationRegions()
getIntegrationRegions in interface GraphicsCanvas
public void setMarkers(GraphicsMarker[] markers,
java.awt.Color color)
GraphicsMarker objects.
setMarkers in interface GraphicsCanvasmarkers - the array of GraphicsMarker objectscolor - the color to paint the markerspublic void eraseMarkers()
eraseMarkers in interface GraphicsCanvaspublic void eraseMarkers(GraphicsMarker[] markers)
eraseMarkers in interface GraphicsCanvasmarkers - the markers to be erased
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||