org.das2.graph.DasCanvas

Canvas for das2 graphics. The DasCanvas contains any number of DasCanvasComponents such as axes, plots, colorbars, etc.


DEFAULT_LAYER

Default drawing layer of the JLayeredPane


PLOT_LAYER

Z-Layer for drawing the plot.


VERTICAL_AXIS_LAYER

Z-Layer for vertical axis. Presently lower than the horizontal axis, presumably to remove ambiguity


HORIZONTAL_AXIS_LAYER

Z-Layer


AXIS_LAYER

Z-Layer


ANNOTATION_LAYER

Z-Layer


GLASS_PANE_LAYER

Z-Layer


SAVE_AS_PNG_ACTION


SAVE_AS_SVG_ACTION


SAVE_AS_PDF_ACTION


EDIT_DAS_PROPERTIES_ACTION


PRINT_ACTION


REFRESH_ACTION


ABOUT_ACTION

Override Component.setBounds for debugging.


broken


PROP_SCALEFONTS

The font used should be the base font scaled based on the canvas size. If this is false, then the canvas font is simply the base font.


PROP_BASEFONT

Property name for the base font.


PROP_PAINTCOUNT


addBottomDecorator

addBottomDecorator( org.das2.graph.Painter painter ) → void

add a decorator that will be painted on below all other objects. Each decorator object should complete painting within 100 milliseconds, and the total for all decorators should not exceed 300 milliseconds. This should be done on the event thread.

Parameters

painter -

Returns:

void (returns nothing)

search for examples view on GitHub view source


addTopDecorator

addTopDecorator( org.das2.graph.Painter painter ) → void

add a decorator that will be painted on top of all other objects. Each decorator object should complete painting within 100 milliseconds, and the total for all decorators should not exceed 300 milliseconds. This should be done on the event thread.

Parameters

painter -

Returns:

void (returns nothing)

search for examples view on GitHub view source


devicePositionList

devicePositionList( ) → List

returns a list of all the rows and columns on the canvas.

Returns:

java.util.List

search for examples view on GitHub view source


getApplication

getApplication( ) → DasApplication

Returns:

org.das2.DasApplication

search for examples view on GitHub view source


getBaseFont

getBaseFont( ) → Font

the base font, which is the font or the font which is scaled when scaleFont is true.

Returns:

the base font, which is the font or the font which is scaled when scaleFont is true.

search for examples view on GitHub view source


getCanvasComponentAt

getCanvasComponentAt( int x, int y ) → DasCanvasComponent

Returns the DasCanvasComponent that contains the (x, y) location. If there is no component at that location, this method returns null

Parameters

x - the x coordinate
y - the y coordinate

Returns:

the component at the specified point, or null

search for examples view on GitHub view source


getCanvasComponents

getCanvasComponents( int index ) → DasCanvasComponent

return the component at the index.

Parameters

index - the index

Returns:

the component at the index.

search for examples view on GitHub view source


getCellAt

getCellAt( int x, int y ) → Cell

TODO

Parameters

x -
y -

Returns:

org.das2.graph.DasCanvas.Cell

search for examples view on GitHub view source


getDevicePositionList

getDevicePositionList( ) → List

return a list of all the rows and columns.

Returns:

a list of all the rows and columns.

search for examples view on GitHub view source


getFocusCanvas

getFocusCanvas( ) → DasCanvas

return the canvas that has the focus.

Returns:

org.das2.graph.DasCanvas

search for examples view on GitHub view source


getGlassPane

getGlassPane( ) → Component

returns the GlassPane above all other components. This is used for drawing dragRenderers, etc.

Returns:

java.awt.Component

search for examples view on GitHub view source


getImage

getImage( int width, int height ) → BufferedImage

Creates a BufferedImage by blocking until the image is ready. This includes waiting for datasets to load, etc. Works by submitting an invokeAfter request to the RequestProcessor that calls {@link #writeToImageImmediately(Image)}.

Parameters

width -
height -

Returns:

a BufferedImage

search for examples view on GitHub view source


getImageMetadata

getImageMetadata( ) → String

returns JSON code that can be used to get plot positions and axes.

Returns:

java.lang.String

search for examples view on GitHub view source


getImageNonPrint

getImageNonPrint( int width, int height ) → Image

Creates a BufferedImage by blocking until the image is ready. This includes waiting for datasets to load, etc. Works by submitting an invokeAfter request to the RequestProcessor that calls {@link #writeToImageImmediately(Image)}. Note, this calls writeToImageImmediatelyNonPrint, which avoids the usual overhead of revalidating the DasPlot elements we normally do when printing to a new device.

Parameters

width -
height -

Returns:

an Image

search for examples view on GitHub view source


getLineAt

getLineAt( int x, int y ) → HotLine

TODO

Parameters

x -
y -

Returns:

org.das2.graph.DasCanvas.HotLine

search for examples view on GitHub view source


getPreferredScrollableViewportSize

getPreferredScrollableViewportSize( ) → Dimension

Returns:

java.awt.Dimension

search for examples view on GitHub view source


getPrintable

getPrintable( ) → Printable

Returns an instance of java.awt.print.Printable that can be used to render this canvas to a printer. The current implementation returns a reference to this canvas. This method is provided so that in the future, the canvas can delegate it's printing to another object.

Returns:

a Printable instance for rendering this component.

search for examples view on GitHub view source


getPrintingTag

getPrintingTag( ) → String

printingTag is the DateFormat string to use to tag printed images.

Returns:

Value of property printingTag.

search for examples view on GitHub view source


getScrollableBlockIncrement

getScrollableBlockIncrement( java.awt.Rectangle visibleRect, int orientation, int direction ) → int

Returns:

int

search for examples view on GitHub view source


getScrollableTracksViewportHeight

getScrollableTracksViewportHeight( ) → boolean

Returns:

boolean

search for examples view on GitHub view source


getScrollableTracksViewportWidth

getScrollableTracksViewportWidth( ) → boolean

Returns:

boolean

search for examples view on GitHub view source


getScrollableUnitIncrement

getScrollableUnitIncrement( java.awt.Rectangle visibleRect, int orientation, int direction ) → int

Returns:

int

search for examples view on GitHub view source


hasBottomDecorators

hasBottomDecorators( ) → boolean

returns true if there are any bottom decorators.

Returns:

true if there are any decorators.

search for examples view on GitHub view source


hasTopDecorators

hasTopDecorators( ) → boolean

returns true if there are any top decorators.

Returns:

true if there are any decorators.

search for examples view on GitHub view source


isAntiAlias

isAntiAlias( ) → boolean

true if data will be fully rendered with anti-aliasing.

Returns:

true if data will be fully rendered with anti-aliasing.

search for examples view on GitHub view source


isFitted

isFitted( ) → boolean

If true, and the canvas was added to a scrollpane, the canvas will size itself to fit within the scrollpane.

Returns:

value of fitted property

search for examples view on GitHub view source


isScaleFonts

isScaleFonts( ) → boolean

true if the fonts should be rescaled as the window size is changed.

Returns:

true if the fonts should be rescaled as the window size is changed.

search for examples view on GitHub view source


isTextAntiAlias

isTextAntiAlias( ) → boolean

return true if fonts will be fully rendered.

Returns:

true if fonts will be fully rendered.

search for examples view on GitHub view source


lisPaintingForPrint

lisPaintingForPrint( ) → boolean

Java1.6 has this function native

Returns:

boolean

search for examples view on GitHub view source


makeCurrent

makeCurrent( ) → void

make this the current canvas

Returns:

void (returns nothing)

search for examples view on GitHub view source


prepareForOutput

prepareForOutput( int width, int height ) → void

resets the width and height, then waits for all update messages to be processed. In headless mode, the GUI components are validated. This must not be called from the event queue, because it uses eventQueueBlocker!

Parameters

width - the width of the output in pixels.
height - the width of the output in pixels.

Returns:

void (returns nothing)

search for examples view on GitHub view source


removeBottomDecorator

removeBottomDecorator( org.das2.graph.Painter painter ) → void

remove the decorator. This should be done on the event thread.

Parameters

painter -

Returns:

void (returns nothing)

search for examples view on GitHub view source


removeBottomDecorators

removeBottomDecorators( ) → void

remove all bottom decorators. This should be done on the event thread.

Returns:

void (returns nothing)

search for examples view on GitHub view source


removeDasDevicePosition

removeDasDevicePosition( org.das2.graph.DasDevicePosition position ) → void

remove the device position from the list we keep track of. Note those with parent rows and columns should not be registered (or at least existing code doesn't add it).

Parameters

position -

Returns:

void (returns nothing)

search for examples view on GitHub view source


removeTopDecorator

removeTopDecorator( org.das2.graph.Painter painter ) → void

remove the decorator. This should be done on the event thread.

Parameters

painter -

Returns:

void (returns nothing)

search for examples view on GitHub view source


removeTopDecorators

removeTopDecorators( ) → void

remove all top decorators. This should be done on the event thread.

Returns:

void (returns nothing)

search for examples view on GitHub view source


removepwDevicePosition

Deprecated: use removeDasDevicePosition instead.

resizeAllComponents

resizeAllComponents( ) → void

introduced as a kludgy way for clients to force the canvas to resize all of its components. validate or revalidate should probably do this.

Returns:

void (returns nothing)

search for examples view on GitHub view source


setAntiAlias

setAntiAlias( boolean antiAlias ) → void

true if data will be fully rendered with anti-aliasing.

Parameters

antiAlias - if data will be fully rendered with anti-aliasing.

Returns:

void (returns nothing)

search for examples view on GitHub view source


setApplication

setApplication( org.das2.DasApplication application ) → void

Returns:

void (returns nothing)

search for examples view on GitHub view source


setBaseFont

setBaseFont( java.awt.Font font ) → void

the base font, which is the font or the font which is scaled with canvas size when scaleFont is true.

Parameters

font - the font used to derive all other fonts.

Returns:

void (returns nothing)

search for examples view on GitHub view source


setDisableActions

setDisableActions( boolean val ) → void

Returns:

void (returns nothing)

search for examples view on GitHub view source


setFitted

setFitted( boolean fitted ) → void

If true, and the canvas was added to a scrollpane, the canvas will size itself to fit within the scrollpane.

Parameters

fitted - value of fitted property

Returns:

void (returns nothing)

search for examples view on GitHub view source


setFont

setFont( java.awt.Font font ) → void

Returns:

void (returns nothing)

search for examples view on GitHub view source


setPreferredHeight

setPreferredHeight( int height ) → void

Sets the preferred height of the canvas to the specified height.

Parameters

height - the specified height

Returns:

void (returns nothing)

search for examples view on GitHub view source


setPreferredWidth

setPreferredWidth( int width ) → void

Sets the preferred width of the canvas to the specified width.

Parameters

width - the specified width.

Returns:

void (returns nothing)

search for examples view on GitHub view source


setPrintingTag

setPrintingTag( String printingTag ) → void

printingTag is the string to use to tag printed images. This can be 'yyyymmdd (SimpleDateFormat) or $Y$m$d, or just a string.

Parameters

printingTag - New value of property printingTag.

Returns:

void (returns nothing)

search for examples view on GitHub view source


setScaleFonts

setScaleFonts( boolean scaleFonts ) → void

true if the fonts should be rescaled as the window size is changed.

Parameters

scaleFonts - true if the fonts should be rescaled as the window size is changed.

Returns:

void (returns nothing)

search for examples view on GitHub view source


setTextAntiAlias

setTextAntiAlias( boolean textAntiAlias ) → void

true if fonts will be fully rendered.

Parameters

textAntiAlias - true if fonts will be fully rendered.

Returns:

void (returns nothing)

search for examples view on GitHub view source


waitUntilIdle

waitUntilIdle( boolean monitors ) → void

blocks until everything is idle, including no active monitors. PRESENTLY THIS DOES NOT CHECK MONITORS!

Parameters

monitors -

Returns:

void (returns nothing)

search for examples view on GitHub view source


waitUntilValid

waitUntilValid( ) → void

process all pending operations and make sure we're repainted. See PlotCommand in Autoplot.

Returns:

void (returns nothing)

search for examples view on GitHub view source


writeToGraphicsOutput

writeToGraphicsOutput( java.io.OutputStream out, org.das2.util.awt.GraphicsOutput go ) → void

write to various graphics devices such as png, pdf and svg. This handles the synchronization and parameter settings.

Parameters

out - OutputStream to receive the data
go - GraphicsOutput object.

Returns:

void (returns nothing)

search for examples view on GitHub view source


writeToImageImmediately

writeToImageImmediately( java.awt.Image image ) → void

Writes on to the image without waiting, using the print method. The graphics context is accessed with image.getGraphics.

Parameters

image - the image

Returns:

void (returns nothing)

search for examples view on GitHub view source


writeToImageImmediatelyNoCount

writeToImageImmediatelyNoCount( java.awt.Image image ) → void

silly code so that Autoplot can get an image without incrementing paintCount.

Parameters

image -

Returns:

void (returns nothing)

search for examples view on GitHub view source


writeToImageImmediatelyNonPrint

writeToImageImmediatelyNonPrint( java.awt.Image image ) → void

This by passes the normal print method used in writeToImageImmedately, which sets the printing flags which tell the components, like DasPlot, to fully reset. This was introduced so that Autoplot could get thumbnails and an image of the canvas for its layout tab without having to reset.

Parameters

image - the image

Returns:

void (returns nothing)

search for examples view on GitHub view source


writeToPDF

writeToPDF( String filename ) → void

write the canvas to a PDF file.

Parameters

filename - the PDF file name.

Returns:

void (returns nothing)

search for examples view on GitHub view source


writeToPng

writeToPng( java.io.OutputStream out, int w, int h ) → void

uses getImage to get an image of the canvas and encodes it as a png. Note this now puts in a JSON representation of plot locations in the "plotInfo" tag. The plotInfo tag will contain:

   "size:[640,480]"
   "numberOfPlots:0"   
   "plots: { ... "  where each plot contains:
   "title" "xaxis" "yaxis"
}
See http://autoplot.org/richPng.

Parameters

out - the outputStream. This is left open, so the opener code must close it!
w - width in pixels
h - height in pixels

Returns:

void (returns nothing)

search for examples view on GitHub view source


writeToSVG

writeToSVG( String filename ) → void

Parameters

filename - the specified filename

Returns:

void (returns nothing)

search for examples view on GitHub view source