org.das2.graph.DasCanvas

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

DasCanvas( )

Creates a new instance of DasCanvas.

DasCanvas( int width, int height )

Creates a new instance of DasCanvas with the specified width and height


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.


PROPERTIES_ACTION


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


add

add( org.das2.graph.DasCanvasComponent c, org.das2.graph.DasRow row, org.das2.graph.DasColumn column ) → void

This methods adds the specified DasCanvasComponent to this canvas.

Parameters

c - the component to be added to this canvas Note that the canvas will need to be revalidated after the component is added.
row - DasRow specifying the layout of the component.
column - DasColumn specifying the layout of the component.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


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 - a Painter

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [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 - a Painter

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


changePerformed

changePerformed( Object client, Object lockObject ) → void

indicate to the canvas that a change is now complete.

Parameters

client - the client registering the change
lockObject - an object identifying the change

Returns:

void (returns nothing)

See Also:

ChangesSupport


[search for examples] [view on GitHub] [view on old javadoc] [view source]


childIsDirty

childIsDirty( org.das2.graph.DasCanvas c ) → boolean

scans through all the canvas components and returns true if any are in a "dirty" state and need repainting.

Parameters

c - a DasCanvas

Returns:

true if any canvas component is dirty.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


createFormCanvas

createFormCanvas( String name, int width, int height ) → DasCanvas

Parameters

name - a String
width - an int
height - an int

Returns:

DasCanvas with a name.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


devicePositionList

devicePositionList( ) → List

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

Returns:

a java.util.List

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getActions

getActions( ) → Action

Returns:

javax.swing.Action[]

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getApplication

getApplication( ) → DasApplication

Returns:

org.das2.DasApplication

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [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 on old javadoc] [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 on old javadoc] [view source]

getCanvasComponents( ) → DasCanvasComponent

getCellAt

getCellAt( int x, int y ) → Cell

TODO

Parameters

x - an int
y - an int

Returns:

an org.das2.graph.DasCanvas.Cell

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getDasApplication

getDasApplication( ) → DasApplication

return the application object for this canvas.

Returns:

the application object for this canvas.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getDasName

getDasName( ) → String

return the name identifying the component.

Returns:

the name identifying the component.

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [view source]


getDnDSupport

getDnDSupport( ) → DnDSupport

TODO

Returns:

an org.das2.util.DnDSupport

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getEditingMode

getEditingMode( ) → boolean

TODO

Returns:

a boolean

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getFocusCanvas

getFocusCanvas( ) → DasCanvas

return the canvas that has the focus.

Returns:

an org.das2.graph.DasCanvas

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getGlassPane

getGlassPane( ) → Component

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

Returns:

a java.awt.Component

[search for examples] [view on GitHub] [view on old javadoc] [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 - an int
height - an int

Returns:

a BufferedImage

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getImageMetadata

getImageMetadata( ) → String

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

Returns:

a String

[search for examples] [view on GitHub] [view on old javadoc] [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 - an int
height - an int

Returns:

an Image

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getLineAt

getLineAt( int x, int y ) → HotLine

TODO

Parameters

x - an int
y - an int

Returns:

an org.das2.graph.DasCanvas.HotLine

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getMaximumSize

getMaximumSize( ) → Dimension

simply returns getPreferredSize()

Returns:

getPreferredSize()

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getPaintCount

getPaintCount( ) → int

provide a property which can be used to monitor updates.

Returns:

arbitrary int which will change as the canvas is painted.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getPreferredScrollableViewportSize

getPreferredScrollableViewportSize( ) → Dimension

Returns:

java.awt.Dimension

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [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 on old javadoc] [view source]


getScrollableBlockIncrement

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

Parameters

visibleRect - a Rectangle
orientation - an int
direction - an int

Returns:

int

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getScrollableTracksViewportHeight

getScrollableTracksViewportHeight( ) → boolean

Returns:

boolean

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getScrollableTracksViewportWidth

getScrollableTracksViewportWidth( ) → boolean

Returns:

boolean

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getScrollableUnitIncrement

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

Parameters

visibleRect - a Rectangle
orientation - an int
direction - an int

Returns:

int

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [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 on old javadoc] [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 on old javadoc] [view source]


isDirty

isDirty( ) → boolean

returns true if work needs to be done to make the canvas clean. This checks each component's isDirty.

Returns:

true if work needs to be done to make the canvas clean

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [view source]


isPendingChanges

isPendingChanges( Object lockObject ) → boolean

ask the canvas if the particular change is already pending.

Parameters

lockObject - an object identifying the change

Returns:

true if that particular change is pending.

See Also:

ChangesSupport


[search for examples] [view on GitHub] [view on old javadoc] [view source]

isPendingChanges( ) → boolean

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 on old javadoc] [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 on old javadoc] [view source]


isValueAdjusting

isValueAdjusting( ) → boolean

returns true if an operation is being performed that should be treated as atomic.

Returns:

true if an operation is being performed that should be treated as atomic.

See Also:

ChangesSupport


[search for examples] [view on GitHub] [view on old javadoc] [view source]


lisPaintingForPrint

lisPaintingForPrint( ) → boolean

Java1.6 has this function native

Returns:

a boolean

[search for examples] [view on GitHub] [view on old javadoc] [view source]


makeCurrent

makeCurrent( ) → void

make this the current canvas

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


mutatorLock

mutatorLock( ) → Lock

access the lock for an atomic operation.

Returns:

the lock.

See Also:

ChangesSupport


[search for examples] [view on GitHub] [view on old javadoc] [view source]


otherPlotOnTop

otherPlotOnTop( org.das2.graph.DasAxis aThis ) → DasPlot

return a plot which shares this row and column, or null.

Parameters

aThis - a DasAxis

Returns:

a plot which shares this row and column, or null.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


pendingChanges

pendingChanges( java.util.Map result ) → void

return a list of pending changes.

Parameters

result - a java.util.Map

Returns:

void (returns nothing)

See Also:

waitUntilIdle


[search for examples] [view on GitHub] [view on old javadoc] [view source]


performingChange

performingChange( Object client, Object lockObject ) → void

indicate to the canvas that a change is being performed.

Parameters

client - the client registering the change
lockObject - an object identifying the change

Returns:

void (returns nothing)

See Also:

ChangesSupport


[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [view source]


print

print( java.awt.Graphics printGraphics, java.awt.print.PageFormat format, int pageIndex ) → int

Prints the canvas, scaling and possibly rotating it to improve fit.

Parameters

printGraphics - the Graphics object.
format - the PageFormat object.
pageIndex - should be 0, since the image will be on one page.

Returns:

Printable.PAGE_EXISTS or Printable.NO_SUCH_PAGE

[search for examples] [view on GitHub] [view on old javadoc] [view source]

print( java.awt.Graphics g1 ) → void

registerPendingChange

registerPendingChange( Object client, Object lockObject ) → void

indicate to the canvas that a change will be made soon. For example, the canvas should wait for the change to be performed before creating an image.

Parameters

client - the client registering the change
lockObject - an object identifying the change

Returns:

void (returns nothing)

See Also:

ChangesSupport


[search for examples] [view on GitHub] [view on old javadoc] [view source]


remove

remove( int index ) → void

Removes the component, specified by index, from this container, calling its uninstallComponent method if it's a DasCanvasComponent.

Parameters

index - the index of the component to be removed.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]

remove( java.awt.Component comp ) → void

removeBottomDecorator

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

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

Parameters

painter - a Painter

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [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 - a DasDevicePosition

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


removeTopDecorator

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

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

Parameters

painter - a Painter

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [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 on old javadoc] [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 on old javadoc] [view source]


setApplication

setApplication( org.das2.DasApplication application ) → void

Parameters

application - a DasApplication

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [view source]


setDasName

setDasName( String name ) → void

set the name identifying the component.

Parameters

name - the name identifying the component.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


setDisableActions

setDisableActions( boolean val ) → void

Parameters

val - a boolean

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


setEditingMode

setEditingMode( boolean b ) → void

TODO

Parameters

b - a boolean

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [view source]


setFont

setFont( java.awt.Font font ) → void

Parameters

font - a Font

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [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 on old javadoc] [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 on old javadoc] [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 on old javadoc] [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 on old javadoc] [view source]


startDrag

startDrag( int x, int y, int action, java.awt.event.MouseEvent evt ) → boolean

TODO

Parameters

x - an int
y - an int
action - an int
evt - a MouseEvent

Returns:

a boolean

[search for examples] [view on GitHub] [view on old javadoc] [view source]


toString

toString( ) → String

Returns:

java.lang.String

[search for examples] [view on GitHub] [view on old javadoc] [view source]


waitUntilIdle

waitUntilIdle( boolean monitors ) → void

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

Parameters

monitors - a boolean

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]

waitUntilIdle( ) → void

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 on old javadoc] [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 on old javadoc] [view source]

writeToGraphicsOutput( String filename, String graphicsOutput ) → void

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 on old javadoc] [view source]


writeToImageImmediatelyNoCount

writeToImageImmediatelyNoCount( java.awt.Image image ) → void

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

Parameters

image - an Image

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [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 on old javadoc] [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 on old javadoc] [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. It is the responsibility of the caller to close the stream.

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 on old javadoc] [view source]

writeToPng( String filename ) → void

writeToSVG

writeToSVG( String filename ) → void

Parameters

filename - the specified filename

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]